public GatewayManagementOperationContext SetVirtualNetworkGatewayCommandProcess()
 {
     using (OperationContextScope operationContextScope = new OperationContextScope((IContextChannel)base.Channel))
     {
         try
         {
             UpdateConnection updateConnection = new UpdateConnection();
             SwitchParameter  connect          = this.Connect;
             if (!connect.IsPresent)
             {
                 updateConnection.Operation = UpdateConnectionOperation.Disconnect;
             }
             else
             {
                 updateConnection.Operation = UpdateConnectionOperation.Connect;
             }
             base.RetryCall <GatewayOperationAsyncResponse>((string s) => base.Channel.UpdateVirtualNetworkGatewayConnection(s, this.VNetName, this.LocalNetworkSiteName, updateConnection));
             Operation operation = base.WaitForGatewayOperation(base.CommandRuntime.ToString());
             ManagementOperationContext managementOperationContext = new ManagementOperationContext();
             managementOperationContext.set_OperationDescription(base.CommandRuntime.ToString());
             managementOperationContext.set_OperationId(operation.OperationTrackingId);
             managementOperationContext.set_OperationStatus(operation.Status);
             ManagementOperationContext managementOperationContext1 = managementOperationContext;
             base.WriteObject(managementOperationContext1, true);
         }
         catch (CommunicationException communicationException1)
         {
             CommunicationException communicationException = communicationException1;
             this.WriteErrorDetails(communicationException);
         }
     }
     return(null);
 }
        protected override void OnProcessRecord()
        {
            var uc = new UpdateConnection
            {
                Operation = this.Connect.IsPresent ? UpdateConnectionOperation.Connect : UpdateConnectionOperation.Disconnect
            };

            this.ExecuteClientActionInOCS(null, this.CommandRuntime.ToString(), s => this.Channel.UpdateVirtualNetworkGatewayConnection(s, this.VNetName, this.LocalNetworkSiteName, uc), this.WaitForNewGatewayOperation);
        }
Exemplo n.º 3
0
        protected override void OnProcessRecord()
        {
            var uc = new UpdateConnection
            {
                Operation = this.Connect.IsPresent ? UpdateConnectionOperation.Connect : UpdateConnectionOperation.Disconnect
            };

            this.ExecuteClientActionInOCS(null, this.CommandRuntime.ToString(), s => this.Channel.UpdateVirtualNetworkGatewayConnection(s, this.VNetName, this.LocalNetworkSiteName, uc), this.WaitForNewGatewayOperation);
        }