/// <summary>Snippet for Delete</summary>
        public void DeleteRequestObject()
        {
            // Snippet: Delete(DeleteSnapshotRequest, CallSettings)
            // Create client
            SnapshotsClient snapshotsClient = SnapshotsClient.Create();
            // Initialize request argument(s)
            DeleteSnapshotRequest request = new DeleteSnapshotRequest
            {
                RequestId = "",
                Project   = "",
                Snapshot  = "",
            };
            // Make the request
            lro::Operation <Operation, Operation> response = snapshotsClient.Delete(request);

            // Poll until the returned long-running operation is complete
            lro::Operation <Operation, Operation> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            Operation result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            lro::Operation <Operation, Operation> retrievedResponse = snapshotsClient.PollOnceDelete(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Operation retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
        protected void ExecuteSnapshotDeleteMethod(object[] invokeMethodInputParameters)
        {
            string resourceGroupName = (string)ParseParameter(invokeMethodInputParameters[0]);
            string snapshotName      = (string)ParseParameter(invokeMethodInputParameters[1]);

            SnapshotsClient.Delete(resourceGroupName, snapshotName);
        }
Example #3
0
        public void CorrectRequestForDelete()
        {
            var factory = Substitute.For <IConnection>();
            var client  = new SnapshotsClient(factory);

            client.Delete("snapshot:abc123");

            var parameters = Arg.Is <List <Parameter> >(list => (string)list[0].Value == "snapshot:abc123");

            factory.Received().ExecuteRaw("snapshots/{snapshot_id}", parameters, null, Method.DELETE);
        }
 /// <summary>Snippet for Delete</summary>
 public void Delete()
 {
     // Snippet: Delete(string, string, CallSettings)
     // Create client
     SnapshotsClient snapshotsClient = SnapshotsClient.Create();
     // Initialize request argument(s)
     string project  = "";
     string snapshot = "";
     // Make the request
     Operation response = snapshotsClient.Delete(project, snapshot);
     // End snippet
 }
 /// <summary>Snippet for Delete</summary>
 public void DeleteRequestObject()
 {
     // Snippet: Delete(DeleteSnapshotRequest, CallSettings)
     // Create client
     SnapshotsClient snapshotsClient = SnapshotsClient.Create();
     // Initialize request argument(s)
     DeleteSnapshotRequest request = new DeleteSnapshotRequest
     {
         RequestId = "",
         Project   = "",
         Snapshot  = "",
     };
     // Make the request
     Operation response = snapshotsClient.Delete(request);
     // End snippet
 }
        protected override void ProcessRecord()
        {
            ExecuteClientAction(() =>
            {
                if (ShouldProcess(this.ResourceGroupName, VerbsCommon.Remove) &&
                    (this.Force.IsPresent ||
                     this.ShouldContinue(Properties.Resources.ResourceRemovalConfirmation,
                                         "Remove-AzureRmSnapshot operation")))
                {
                    string resourceGroupName = this.ResourceGroupName;
                    string snapshotName      = this.SnapshotName;

                    var result = SnapshotsClient.Delete(resourceGroupName, snapshotName);
                    WriteObject(result);
                }
            });
        }
Example #7
0
        public override void ExecuteCmdlet()
        {
            ExecuteClientAction(() =>
            {
                if (ShouldProcess(this.SnapshotName, VerbsCommon.Remove) &&
                    (this.Force.IsPresent ||
                     this.ShouldContinue(Properties.Resources.ResourceRemovalConfirmation,
                                         "Remove-AzureRmSnapshot operation")))
                {
                    string resourceGroupName = this.ResourceGroupName;
                    string snapshotName      = this.SnapshotName;

                    var result   = SnapshotsClient.Delete(resourceGroupName, snapshotName);
                    var psObject = new PSOperationStatusResponse();
                    ComputeAutomationAutoMapperProfile.Mapper.Map <Azure.Management.Compute.Models.OperationStatusResponse, PSOperationStatusResponse>(result, psObject);
                    WriteObject(psObject);
                }
            });
        }