Exemple #1
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            DeleteSnapshotResponse response = new DeleteSnapshotResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.IsStartElement)
                {
                    if (context.TestExpression("DeleteSnapshotResult", 2))
                    {
                        UnmarshallResult(context, response);
                        continue;
                    }

                    if (context.TestExpression("ResponseMetadata", 2))
                    {
                        response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context);
                    }
                }
            }

            return(response);
        }
Exemple #2
0
        private static void UnmarshallResult(XmlUnmarshallerContext context, DeleteSnapshotResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("Snapshot", targetDepth))
                    {
                        response.Snapshot = SnapshotUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return;
                }
            }
        }
        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);
            }
        }
Exemple #4
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DeleteSnapshotResponse response = new DeleteSnapshotResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("Lifecycle", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Lifecycle = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("SnapshotId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.SnapshotId = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
        public static DeleteSnapshotResponse Unmarshall(UnmarshallerContext _ctx)
        {
            DeleteSnapshotResponse deleteSnapshotResponse = new DeleteSnapshotResponse();

            deleteSnapshotResponse.HttpResponse = _ctx.HttpResponse;
            deleteSnapshotResponse.RequestId    = _ctx.StringValue("DeleteSnapshot.RequestId");

            return(deleteSnapshotResponse);
        }
        public static DeleteSnapshotResponse Unmarshall(UnmarshallerContext context)
        {
            DeleteSnapshotResponse deleteSnapshotResponse = new DeleteSnapshotResponse();

            deleteSnapshotResponse.HttpResponse = context.HttpResponse;
            deleteSnapshotResponse.RequestId = context.StringValue("DeleteSnapshot.RequestId");

            return deleteSnapshotResponse;
        }
Exemple #7
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);
        }
Exemple #8
0
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            DeleteSnapshotResponse response = new DeleteSnapshotResponse();

            while (context.Read())
            {
            }


            return(response);
        }
        public static DeleteSnapshotResponse Unmarshall(UnmarshallerContext context)
        {
            DeleteSnapshotResponse deleteSnapshotResponse = new DeleteSnapshotResponse
            {
                HttpResponse = context.HttpResponse,
                RequestId    = context.StringValue("DeleteSnapshot.RequestId")
            };


            return(deleteSnapshotResponse);
        }
 /// <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
 }
Exemple #11
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();
        }
        /// <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
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            DeleteSnapshotResponse response = new DeleteSnapshotResponse();

            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth = 2;
            }

            while (context.ReadAtDepth(originalDepth))
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                }
            }

            return(response);
        }
Exemple #14
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();
        }
Exemple #15
0
 public virtual Task <bool> OnSnapshotDeleteFailure(string snapshotName, TimeSpan duration, DeleteSnapshotResponse response, Exception ex)
 {
     _logger.LogErrorRequest(ex, response, "Failed to delete snapshot {SnapshotName} after {Duration:g}", snapshotName, duration);
     return(Task.FromResult(true));
 }