コード例 #1
0
        /// <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
        }
コード例 #2
0
        public DeleteSnapshotRequestTests()
        {
            var request  = new DeleteSnapshotRequest("my-repository", "my-snap");
            var response = this._client.DeleteSnapshot(request);

            this._status = response.ConnectionStatus;
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: yamazaki164/ec2snapshot
        static void DescribeSnapshots(AmazonEC2Client client, Volume volume)
        {
            int generation           = 7;
            var describeSnapshotsReq = new DescribeSnapshotsRequest()
            {
                Filters = new List <Filter>()
                {
                    new Filter()
                    {
                        Name   = "volume-id",
                        Values = new List <string>()
                        {
                            volume.VolumeId
                        }
                    }
                }
            };
            var resp      = client.DescribeSnapshotsAsync(describeSnapshotsReq);
            var snapshots = resp.Result.Snapshots.OrderBy(i => i.StartTime).ToList();

            if (snapshots.Count >= generation)
            {
                var req = new DeleteSnapshotRequest(snapshots.First().SnapshotId);
                client.DeleteSnapshotAsync(req).Wait();
            }
        }
コード例 #4
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            if (!ConfirmDelete("OCIFilestorageSnapshot", "Remove"))
            {
                return;
            }

            DeleteSnapshotRequest request;

            try
            {
                request = new DeleteSnapshotRequest
                {
                    SnapshotId   = SnapshotId,
                    IfMatch      = IfMatch,
                    OpcRequestId = OpcRequestId
                };

                response = client.DeleteSnapshot(request).GetAwaiter().GetResult();
                WriteOutput(response);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
コード例 #5
0
        internal DeleteSnapshotResponse DeleteSnapshot(DeleteSnapshotRequest request)
        {
            var marshaller   = new DeleteSnapshotRequestMarshaller();
            var unmarshaller = DeleteSnapshotResponseUnmarshaller.Instance;

            return(Invoke <DeleteSnapshotRequest, DeleteSnapshotResponse>(request, marshaller, unmarshaller));
        }
コード例 #6
0
        private static void DeleteSnapshot(EvsClient client)
        {
            DeleteSnapshotRequest req = new DeleteSnapshotRequest()
            {
                SnapshotId = "fc5281ca-5a1b-4193-814f-514cb5d303e7"
            };

            try
            {
                DeleteSnapshotResponse resp = client.DeleteSnapshot(req);
                Console.WriteLine(resp.HttpStatusCode);
            }
            catch (RequestTimeoutException requestTimeoutException)
            {
                Console.WriteLine(requestTimeoutException.ErrorMessage);
            }
            catch (ServiceResponseException clientRequestException)
            {
                Console.WriteLine(clientRequestException.HttpStatusCode);
                Console.WriteLine(clientRequestException.ErrorCode);
                Console.WriteLine(clientRequestException.ErrorMsg);
            }
            catch (ConnectionException connectionException)
            {
                Console.WriteLine(connectionException.ErrorMessage);
            }
        }
コード例 #7
0
        /// <summary>
        /// Deletes a snapshot
        /// </summary>
        /// <param name="snapShotId"></param>
        public void DeleteSnapShot(string snapShotId)
        {
            var request = new DeleteSnapshotRequest {
                SnapshotId = snapShotId
            };

            Client.DeleteSnapshot(request);
        }
コード例 #8
0
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteSnapshot operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the DeleteSnapshot operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task <DeleteSnapshotResponse> DeleteSnapshotAsync(DeleteSnapshotRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new DeleteSnapshotRequestMarshaller();
            var unmarshaller = DeleteSnapshotResponseUnmarshaller.Instance;

            return(InvokeAsync <DeleteSnapshotRequest, DeleteSnapshotResponse>(request, marshaller,
                                                                               unmarshaller, cancellationToken));
        }
コード例 #9
0
ファイル: Program.cs プロジェクト: kueiwa/AWSToolKit
        static void DeleteSnapshot(string SnapshotID)
        {
            AmazonEC2 ec2      = GetEC2Client();
            var       request  = new DeleteSnapshotRequest().WithSnapshotId(SnapshotID);
            var       response = ec2.DeleteSnapshot(request);

            Console.WriteLine(SnapshotID + "was Deleted");
        }
コード例 #10
0
        /// <summary>
        /// Delete the snapshop with the given ID from EBS
        /// </summary>
        /// <param name="p"></param>
        public static void DeleteSnapsot(string snapshotid)
        {
            AmazonEC2Client ec2 = CreateClient();

            DeleteSnapshotRequest rq = new DeleteSnapshotRequest();

            rq.SnapshotId = snapshotid;

            DeleteSnapshotResponse rs = ec2.DeleteSnapshot(rq);
        }
コード例 #11
0
        public void TestDeleteSnapshot()
        {
            DiskClient            diskClient = GetDiskClient();
            DeleteSnapshotRequest request    = new DeleteSnapshotRequest();

            request.RegionId   = "cn-north-1";
            request.SnapshotId = "snapshot-sq1i919o98";
            var result = diskClient.DeleteSnapshot(request);

            _output.WriteLine(JsonConvert.SerializeObject(result));
        }
コード例 #12
0
        /// <summary>
        /// 删除云硬盘快照
        /// </summary>
        public DeleteSnapshotResponse DeleteSnapshot(DeleteSnapshotRequest deleteSnapshotRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();

            urlParam.Add("snapshot_id", deleteSnapshotRequest.SnapshotId.ToString());
            string              urlPath  = HttpUtils.AddUrlPath("/v2/{project_id}/cloudsnapshots/{snapshot_id}", urlParam);
            SdkRequest          request  = HttpUtils.InitSdkRequest(urlPath, "application/json", deleteSnapshotRequest);
            HttpResponseMessage response = DoHttpRequestSync("DELETE", request);

            return(JsonUtils.DeSerializeNull <DeleteSnapshotResponse>(response));
        }
        /// <summary>Snippet for DeleteSnapshotAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task DeleteSnapshotRequestObjectAsync()
        {
            // Create client
            BigtableTableAdminClient bigtableTableAdminClient = await BigtableTableAdminClient.CreateAsync();

            // Initialize request argument(s)
            DeleteSnapshotRequest request = new DeleteSnapshotRequest
            {
                SnapshotName = SnapshotName.FromProjectInstanceClusterSnapshot("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"),
            };
            // Make the request
            await bigtableTableAdminClient.DeleteSnapshotAsync(request);
        }
コード例 #14
0
        /// <summary>Snippet for DeleteSnapshot</summary>
        public void DeleteSnapshot_RequestObject()
        {
            // Snippet: DeleteSnapshot(DeleteSnapshotRequest,CallSettings)
            // Create client
            BigtableTableAdminClient bigtableTableAdminClient = BigtableTableAdminClient.Create();
            // Initialize request argument(s)
            DeleteSnapshotRequest request = new DeleteSnapshotRequest
            {
                SnapshotName = new SnapshotName("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"),
            };

            // Make the request
            bigtableTableAdminClient.DeleteSnapshot(request);
            // End snippet
        }
コード例 #15
0
 /// <summary>Snippet for DeleteSnapshot</summary>
 public void DeleteSnapshotRequestObject()
 {
     // Snippet: DeleteSnapshot(DeleteSnapshotRequest, CallSettings)
     // Create client
     SnapshotsV1Beta3Client snapshotsV1Beta3Client = SnapshotsV1Beta3Client.Create();
     // Initialize request argument(s)
     DeleteSnapshotRequest request = new DeleteSnapshotRequest
     {
         ProjectId  = "",
         SnapshotId = "",
         Location   = "",
     };
     // Make the request
     DeleteSnapshotResponse response = snapshotsV1Beta3Client.DeleteSnapshot(request);
     // End snippet
 }
コード例 #16
0
 /// <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
 }
コード例 #17
0
        public async stt::Task DeleteRequestObjectAsync()
        {
            moq::Mock <Snapshots.SnapshotsClient> mockGrpcClient = new moq::Mock <Snapshots.SnapshotsClient>(moq::MockBehavior.Strict);
            DeleteSnapshotRequest request = new DeleteSnapshotRequest
            {
                RequestId = "request_id362c8df6",
                Project   = "projectaa6ff846",
                Snapshot  = "snapshotded322c3",
            };
            Operation expectedResponse = new Operation
            {
                Id   = 11672635353343658936UL,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                User = "******",
                Zone = "zone255f4ea8",
                CreationTimestamp   = "creation_timestamp235e59a1",
                StartTime           = "start_timebd8dd9c4",
                OperationGroupId    = "operation_group_idd2040cf0",
                TargetLink          = "target_link9b435dc0",
                Progress            = 278622268,
                Error               = new Error(),
                EndTime             = "end_time89285d30",
                Region              = "regionedb20d96",
                OperationType       = "operation_typeece9e153",
                Status              = Operation.Types.Status.Pending,
                HttpErrorMessage    = "http_error_messageb5ef3c7f",
                TargetId            = 6263187990225347157UL,
                ClientOperationId   = "client_operation_id4e51b631",
                StatusMessage       = "status_message2c618f86",
                HttpErrorStatusCode = 1766362655,
                Description         = "description2cf9da67",
                InsertTime          = "insert_time7467185a",
                SelfLink            = "self_link7e87f12d",
                Warnings            = { new Warnings(), },
            };

            mockGrpcClient.Setup(x => x.DeleteAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Operation>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            SnapshotsClient client = new SnapshotsClientImpl(mockGrpcClient.Object, null);
            Operation       responseCallSettings = await client.DeleteAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Operation responseCancellationToken = await client.DeleteAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #18
0
        /**
         * Deletes a snapshot and waits for it to be deleted.
         *
         * @param fsClient the service client used to communicate with the File Storage service
         * @param snapshot the snapshot to delete
         */
        private static async Task DeleteSnapshot(FileStorageClient fsClient, Snapshot snapshot)
        {
            logger.Info("Deleting snapshot");

            DeleteSnapshotRequest deleteSnapshotRequest = new DeleteSnapshotRequest
            {
                SnapshotId = snapshot.Id
            };
            await fsClient.DeleteSnapshot(deleteSnapshotRequest);

            GetSnapshotRequest getSnapshotRequest = new GetSnapshotRequest
            {
                SnapshotId = snapshot.Id
            };

            fsClient.Waiters.ForSnapshot(getSnapshotRequest, Snapshot.LifecycleStateEnum.Deleted).Execute();
        }
コード例 #19
0
        public async Task DeleteSnapshotAsync2()
        {
            Mock <BigtableTableAdmin.BigtableTableAdminClient> mockGrpcClient = new Mock <BigtableTableAdmin.BigtableTableAdminClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            DeleteSnapshotRequest request = new DeleteSnapshotRequest
            {
                SnapshotName = new SnapshotName("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteSnapshotAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null));
            BigtableTableAdminClient client = new BigtableTableAdminClientImpl(mockGrpcClient.Object, null);
            await client.DeleteSnapshotAsync(request);

            mockGrpcClient.VerifyAll();
        }
コード例 #20
0
        public void DeleteSnapshotRequestObject()
        {
            moq::Mock <SnapshotsV1Beta3.SnapshotsV1Beta3Client> mockGrpcClient = new moq::Mock <SnapshotsV1Beta3.SnapshotsV1Beta3Client>(moq::MockBehavior.Strict);
            DeleteSnapshotRequest request = new DeleteSnapshotRequest
            {
                ProjectId  = "project_id43ad98b0",
                SnapshotId = "snapshot_id3456a275",
                Location   = "locatione09d18d5",
            };
            DeleteSnapshotResponse expectedResponse = new DeleteSnapshotResponse {
            };

            mockGrpcClient.Setup(x => x.DeleteSnapshot(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            SnapshotsV1Beta3Client client   = new SnapshotsV1Beta3ClientImpl(mockGrpcClient.Object, null);
            DeleteSnapshotResponse response = client.DeleteSnapshot(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #21
0
        public void DeleteSnapshot2()
        {
            Mock <BigtableTableAdmin.BigtableTableAdminClient> mockGrpcClient = new Mock <BigtableTableAdmin.BigtableTableAdminClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            DeleteSnapshotRequest request = new DeleteSnapshotRequest
            {
                SnapshotName = new SnapshotName("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteSnapshot(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            BigtableTableAdminClient client = new BigtableTableAdminClientImpl(mockGrpcClient.Object, null);

            client.DeleteSnapshot(request);
            mockGrpcClient.VerifyAll();
        }
コード例 #22
0
        /// <summary>Snippet for DeleteSnapshotAsync</summary>
        public async Task DeleteSnapshotRequestObjectAsync()
        {
            // Snippet: DeleteSnapshotAsync(DeleteSnapshotRequest, CallSettings)
            // Additional: DeleteSnapshotAsync(DeleteSnapshotRequest, CancellationToken)
            // Create client
            SnapshotsV1Beta3Client snapshotsV1Beta3Client = await SnapshotsV1Beta3Client.CreateAsync();

            // Initialize request argument(s)
            DeleteSnapshotRequest request = new DeleteSnapshotRequest
            {
                ProjectId  = "",
                SnapshotId = "",
                Location   = "",
            };
            // Make the request
            DeleteSnapshotResponse response = await snapshotsV1Beta3Client.DeleteSnapshotAsync(request);

            // End snippet
        }
コード例 #23
0
        public async stt::Task DeleteSnapshotRequestObjectAsync()
        {
            moq::Mock <SnapshotsV1Beta3.SnapshotsV1Beta3Client> mockGrpcClient = new moq::Mock <SnapshotsV1Beta3.SnapshotsV1Beta3Client>(moq::MockBehavior.Strict);
            DeleteSnapshotRequest request = new DeleteSnapshotRequest
            {
                ProjectId  = "project_id43ad98b0",
                SnapshotId = "snapshot_id3456a275",
                Location   = "locatione09d18d5",
            };
            DeleteSnapshotResponse expectedResponse = new DeleteSnapshotResponse {
            };

            mockGrpcClient.Setup(x => x.DeleteSnapshotAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <DeleteSnapshotResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            SnapshotsV1Beta3Client client = new SnapshotsV1Beta3ClientImpl(mockGrpcClient.Object, null);
            DeleteSnapshotResponse responseCallSettings = await client.DeleteSnapshotAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            DeleteSnapshotResponse responseCancellationToken = await client.DeleteSnapshotAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #24
0
 partial void Modify_DeleteSnapshotRequest(ref DeleteSnapshotRequest request, ref gaxgrpc::CallSettings settings);
コード例 #25
0
 /// <summary>
 ///  -   删除单个云硬盘快照:快照状态必须为 available 或 error 状态。
 /// -   快照独立于云硬盘生命周期,删除快照不会对创建快照的云硬盘有任何影响。
 /// -   快照删除后不可恢复,请谨慎操作。
 ///
 /// </summary>
 /// <param name="request">请求参数信息</param>
 /// <returns>请求结果信息</returns>
 public async Task <DeleteSnapshotResponse> DeleteSnapshot(DeleteSnapshotRequest request)
 {
     return(await new DeleteSnapshotExecutor().Client(this).Execute <DeleteSnapshotResponse, DeleteSnapshotResult, DeleteSnapshotRequest>(request).ConfigureAwait(false));
 }
コード例 #26
0
 /// <summary>
 ///  -   删除单个云硬盘快照:快照状态必须为 available 或 error 状态。
 /// -   快照独立于云硬盘生命周期,删除快照不会对创建快照的云硬盘有任何影响。
 /// -   快照删除后不可恢复,请谨慎操作。
 ///
 /// </summary>
 /// <param name="request">请求参数信息</param>
 /// <returns>请求结果信息</returns>
 public DeleteSnapshotResponse DeleteSnapshot(DeleteSnapshotRequest request)
 {
     return(new DeleteSnapshotExecutor().Client(this).Execute <DeleteSnapshotResponse, DeleteSnapshotResult, DeleteSnapshotRequest>(request));
 }
コード例 #27
0
		public DeleteSnapshotRequestTests()
		{
			var request = new DeleteSnapshotRequest("my-repository", "my-snap");
			var response = this._client.DeleteSnapshot(request);
			this._status = response.ConnectionStatus;
		}
コード例 #28
0
 /// <summary>
 /// Deletes a snapshot.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public virtual stt::Task <DeleteSnapshotResponse> DeleteSnapshotAsync(DeleteSnapshotRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();
コード例 #29
0
 /// <summary>
 /// Deletes a snapshot.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public virtual stt::Task <DeleteSnapshotResponse> DeleteSnapshotAsync(DeleteSnapshotRequest request, st::CancellationToken cancellationToken) =>
 DeleteSnapshotAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
コード例 #30
0
 /// <summary>
 /// Deletes a snapshot.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>The RPC response.</returns>
 public override DeleteSnapshotResponse DeleteSnapshot(DeleteSnapshotRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_DeleteSnapshotRequest(ref request, ref callSettings);
     return(_callDeleteSnapshot.Sync(request, callSettings));
 }
コード例 #31
0
 /// <summary>
 /// Deletes a snapshot.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public override stt::Task <DeleteSnapshotResponse> DeleteSnapshotAsync(DeleteSnapshotRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_DeleteSnapshotRequest(ref request, ref callSettings);
     return(_callDeleteSnapshot.Async(request, callSettings));
 }