Below is the example of using the SetMbSecSnapshot operation to restore security policy from backup. The request contains moniker of the object that is used to work with backups and moniker of the binary file containing a backup. The response contains the report about security policy restoring.
{ "SetMbSecSnapshot" : { "tMbSecSnapshot" : { "id" : "S1!M!S!SecSna1" }, "tArg" : { "pattern" : { "all" : "true" }, "meta" : { "execute" : { "command" : "Load", "async" : "false", "snapshotToLoad" : { "id" : "S1!M!Bin!0" } } }, "metaGet" : { "all" : "true" } } }}
{ "SetMbSecSnapshotResult" : { "id" : { "id" : "S1!M!S!SecSna1" }, "meta" : { "execute" : { "resolveTimeout" : "600000", "state" : "Waiting", "loadState" : { "onOperation" : { "applyOperation" : "Read", "state" : "0" } } }, "log" : { "its" : "" } } }}
public static SetMbSecSnapshotResult LoadSnapshot(string secSnapshot, string snapshotToLoadId)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tSet = new SetMbSecSnapshot()
{
tArg = new SetMbSecSnapshotArg()
{
meta = new MbSecSnapshotMd()
{
execute = new MbSecSnapshotExecute()
{
command = MbSecSnapshotExecuteCommand.Load,
async = false,
snapshotToLoad = new BinaryId() { id = snapshotToLoadId }
}
},
pattern = new MbSecSnapshotMdPattern()
{
all = true
},
metaGet = new MbSecSnapshotMdPattern()
{
all = true
}
},
tMbSecSnapshot = new MbSecSnapshotId() { id = secSnapshot }
};
//Restore security policy from backup
var result = somClient.SetMbSecSnapshot(tSet);
return result;
}
See also: