Exemplo n.º 1
0
        public async Task OriginTests()
        {
            var createRequest = new CreateCloudFrontOriginAccessIdentityRequest()
            {
                CloudFrontOriginAccessIdentityConfig = new CloudFrontOriginAccessIdentityConfig()
                {
                    CallerReference = Guid.NewGuid().ToString(),
                    Comment         = UtilityMethods.SDK_TEST_PREFIX
                }
            };
            var createResponse = await Client.CreateCloudFrontOriginAccessIdentityAsync(createRequest);

            Assert.NotNull(createResponse.ETag);
            Assert.NotNull(createResponse.CloudFrontOriginAccessIdentity.Id);
            string etag = createResponse.ETag;

            try
            {
                var updateRequest = new UpdateCloudFrontOriginAccessIdentityRequest()
                {
                    CloudFrontOriginAccessIdentityConfig = new CloudFrontOriginAccessIdentityConfig()
                    {
                        CallerReference = createRequest.CloudFrontOriginAccessIdentityConfig.CallerReference,
                        Comment         = UtilityMethods.SDK_TEST_PREFIX + "update"
                    },
                    Id      = createResponse.CloudFrontOriginAccessIdentity.Id,
                    IfMatch = createResponse.ETag
                };
                var updateResponse = await Client.UpdateCloudFrontOriginAccessIdentityAsync(updateRequest);

                Assert.NotNull(updateResponse.ETag);
                etag = updateResponse.ETag;
                Assert.NotNull(updateResponse.CloudFrontOriginAccessIdentity.CloudFrontOriginAccessIdentityConfig.Comment);

                var listResponse = await Client.ListCloudFrontOriginAccessIdentitiesAsync();

                Assert.True(listResponse.CloudFrontOriginAccessIdentityList.Items.Count > 0);
            }
            finally
            {
                var deleteRequest = new DeleteCloudFrontOriginAccessIdentityRequest()
                {
                    Id      = createResponse.CloudFrontOriginAccessIdentity.Id,
                    IfMatch = etag
                };
                var deleteResponse = await Client.DeleteCloudFrontOriginAccessIdentityAsync(deleteRequest);

                Assert.NotNull(deleteResponse.ResponseMetadata.RequestId);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteCloudFrontOriginAccessIdentity operation.
        /// <seealso cref="Amazon.CloudFront.IAmazonCloudFront"/>
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the DeleteCloudFrontOriginAccessIdentity 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 <DeleteCloudFrontOriginAccessIdentityResponse> DeleteCloudFrontOriginAccessIdentityAsync(DeleteCloudFrontOriginAccessIdentityRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new DeleteCloudFrontOriginAccessIdentityRequestMarshaller();
            var unmarshaller = DeleteCloudFrontOriginAccessIdentityResponseUnmarshaller.Instance;

            return(Invoke <IRequest, DeleteCloudFrontOriginAccessIdentityRequest, DeleteCloudFrontOriginAccessIdentityResponse>(request, marshaller, unmarshaller, signer, cancellationToken));
        }
Exemplo n.º 3
0
        internal DeleteCloudFrontOriginAccessIdentityResponse DeleteCloudFrontOriginAccessIdentity(DeleteCloudFrontOriginAccessIdentityRequest request)
        {
            var task = DeleteCloudFrontOriginAccessIdentityAsync(request);

            try
            {
                return(task.Result);
            }
            catch (AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return(null);
            }
        }
Exemplo n.º 4
0
        internal DeleteCloudFrontOriginAccessIdentityResponse DeleteCloudFrontOriginAccessIdentity(DeleteCloudFrontOriginAccessIdentityRequest request)
        {
            var marshaller   = new DeleteCloudFrontOriginAccessIdentityRequestMarshaller();
            var unmarshaller = DeleteCloudFrontOriginAccessIdentityResponseUnmarshaller.Instance;

            return(Invoke <DeleteCloudFrontOriginAccessIdentityRequest, DeleteCloudFrontOriginAccessIdentityResponse>(request, marshaller, unmarshaller));
        }