Restoring Security Policy from Backup

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.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SetMbSecSnapshot xmlns="http://www.prognoz.ru/PP.SOM.Som">
<tMbSecSnapshot xmlns="">
  <id>S1!M!S!SecSna1</id>
  </tMbSecSnapshot>
<tArg xmlns="">
<pattern>
  <all>true</all>
  </pattern>
<meta>
<execute>
  <command>Load</command>
  <async>false</async>
<snapshotToLoad>
  <id>S1!M!Bin!0</id>
  </snapshotToLoad>
  </execute>
  </meta>
<metaGet>
  <all>true</all>
  </metaGet>
  </tArg>
  </SetMbSecSnapshot>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<SetMbSecSnapshotResult xmlns="http://www.prognoz.ru/PP.SOM.Som" xmlns:q1="http://www.prognoz.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<id xmlns="">
  <id>S1!M!S!SecSna1</id>
  </id>
<meta xmlns="">
<execute>
  <resolveTimeout>600000</resolveTimeout>
  <state>Waiting</state>
<loadState>
<onOperation>
  <applyOperation>Read</applyOperation>
  <state>0</state>
  </onOperation>
  </loadState>
  </execute>
<log>
  <its />
  </log>
  </meta>
  </SetMbSecSnapshotResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{

 "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"

      }

    }

  }

}

JSON response:

{

 "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:

SetMbSecSnapshot