
com.amazonaws.services.cloudfront.AmazonCloudFrontClient Maven / Gradle / Ivy
Show all versions of aws-java-sdk-cloudfront Show documentation
/*
* Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights
* Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazonaws.services.cloudfront;
import org.w3c.dom.*;
import java.net.*;
import java.util.*;
import java.util.Map.Entry;
import org.apache.commons.logging.*;
import com.amazonaws.*;
import com.amazonaws.auth.*;
import com.amazonaws.handlers.*;
import com.amazonaws.http.*;
import com.amazonaws.internal.*;
import com.amazonaws.metrics.*;
import com.amazonaws.regions.*;
import com.amazonaws.transform.*;
import com.amazonaws.util.*;
import com.amazonaws.protocol.json.*;
import com.amazonaws.util.AWSRequestMetrics.Field;
import com.amazonaws.annotation.ThreadSafe;
import com.amazonaws.services.cloudfront.model.*;
import com.amazonaws.services.cloudfront.model.transform.*;
/**
* Client for accessing CloudFront. All service calls made using this client are
* blocking, and will not return until the service call completes.
*
*
*/
@ThreadSafe
public class AmazonCloudFrontClient extends AmazonWebServiceClient implements
AmazonCloudFront {
/** Provider for AWS credentials. */
private AWSCredentialsProvider awsCredentialsProvider;
private static final Log log = LogFactory.getLog(AmazonCloudFront.class);
/** Default signing name for the service. */
private static final String DEFAULT_SIGNING_NAME = "cloudfront";
/** The region metadata service name for computing region endpoints. */
private static final String DEFAULT_ENDPOINT_PREFIX = "cloudfront";
/**
* Client configuration factory providing ClientConfigurations tailored to
* this client
*/
protected static final ClientConfigurationFactory configFactory = new ClientConfigurationFactory();
/**
* List of exception unmarshallers for all modeled exceptions
*/
protected final List> exceptionUnmarshallers = new ArrayList>();
/**
* Constructs a new client to invoke service methods on CloudFront. A
* credentials provider chain will be used that searches for credentials in
* this order:
*
* - Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
* - Java System Properties - aws.accessKeyId and aws.secretKey
* - Instance profile credentials delivered through the Amazon EC2
* metadata service
*
*
*
* All service calls made using this new client object are blocking, and
* will not return until the service call completes.
*
* @see DefaultAWSCredentialsProviderChain
*/
public AmazonCloudFrontClient() {
this(new DefaultAWSCredentialsProviderChain(), configFactory
.getConfig());
}
/**
* Constructs a new client to invoke service methods on CloudFront. A
* credentials provider chain will be used that searches for credentials in
* this order:
*
* - Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
* - Java System Properties - aws.accessKeyId and aws.secretKey
* - Instance profile credentials delivered through the Amazon EC2
* metadata service
*
*
*
* All service calls made using this new client object are blocking, and
* will not return until the service call completes.
*
* @param clientConfiguration
* The client configuration options controlling how this client
* connects to CloudFront (ex: proxy settings, retry counts, etc.).
*
* @see DefaultAWSCredentialsProviderChain
*/
public AmazonCloudFrontClient(ClientConfiguration clientConfiguration) {
this(new DefaultAWSCredentialsProviderChain(), clientConfiguration);
}
/**
* Constructs a new client to invoke service methods on CloudFront using the
* specified AWS account credentials.
*
*
* All service calls made using this new client object are blocking, and
* will not return until the service call completes.
*
* @param awsCredentials
* The AWS credentials (access key ID and secret key) to use when
* authenticating with AWS services.
*/
public AmazonCloudFrontClient(AWSCredentials awsCredentials) {
this(awsCredentials, configFactory.getConfig());
}
/**
* Constructs a new client to invoke service methods on CloudFront using the
* specified AWS account credentials and client configuration options.
*
*
* All service calls made using this new client object are blocking, and
* will not return until the service call completes.
*
* @param awsCredentials
* The AWS credentials (access key ID and secret key) to use when
* authenticating with AWS services.
* @param clientConfiguration
* The client configuration options controlling how this client
* connects to CloudFront (ex: proxy settings, retry counts, etc.).
*/
public AmazonCloudFrontClient(AWSCredentials awsCredentials,
ClientConfiguration clientConfiguration) {
super(clientConfiguration);
this.awsCredentialsProvider = new StaticCredentialsProvider(
awsCredentials);
init();
}
/**
* Constructs a new client to invoke service methods on CloudFront using the
* specified AWS account credentials provider.
*
*
* All service calls made using this new client object are blocking, and
* will not return until the service call completes.
*
* @param awsCredentialsProvider
* The AWS credentials provider which will provide credentials to
* authenticate requests with AWS services.
*/
public AmazonCloudFrontClient(AWSCredentialsProvider awsCredentialsProvider) {
this(awsCredentialsProvider, configFactory.getConfig());
}
/**
* Constructs a new client to invoke service methods on CloudFront using the
* specified AWS account credentials provider and client configuration
* options.
*
*
* All service calls made using this new client object are blocking, and
* will not return until the service call completes.
*
* @param awsCredentialsProvider
* The AWS credentials provider which will provide credentials to
* authenticate requests with AWS services.
* @param clientConfiguration
* The client configuration options controlling how this client
* connects to CloudFront (ex: proxy settings, retry counts, etc.).
*/
public AmazonCloudFrontClient(
AWSCredentialsProvider awsCredentialsProvider,
ClientConfiguration clientConfiguration) {
this(awsCredentialsProvider, clientConfiguration, null);
}
/**
* Constructs a new client to invoke service methods on CloudFront using the
* specified AWS account credentials provider, client configuration options,
* and request metric collector.
*
*
* All service calls made using this new client object are blocking, and
* will not return until the service call completes.
*
* @param awsCredentialsProvider
* The AWS credentials provider which will provide credentials to
* authenticate requests with AWS services.
* @param clientConfiguration
* The client configuration options controlling how this client
* connects to CloudFront (ex: proxy settings, retry counts, etc.).
* @param requestMetricCollector
* optional request metric collector
*/
public AmazonCloudFrontClient(
AWSCredentialsProvider awsCredentialsProvider,
ClientConfiguration clientConfiguration,
RequestMetricCollector requestMetricCollector) {
super(clientConfiguration, requestMetricCollector);
this.awsCredentialsProvider = awsCredentialsProvider;
init();
}
private void init() {
exceptionUnmarshallers
.add(new NoSuchInvalidationExceptionUnmarshaller());
exceptionUnmarshallers
.add(new StreamingDistributionAlreadyExistsExceptionUnmarshaller());
exceptionUnmarshallers
.add(new TooManyCloudFrontOriginAccessIdentitiesExceptionUnmarshaller());
exceptionUnmarshallers.add(new InvalidWebACLIdExceptionUnmarshaller());
exceptionUnmarshallers.add(new BatchTooLargeExceptionUnmarshaller());
exceptionUnmarshallers
.add(new DistributionAlreadyExistsExceptionUnmarshaller());
exceptionUnmarshallers
.add(new TooManyInvalidationsInProgressExceptionUnmarshaller());
exceptionUnmarshallers.add(new MissingBodyExceptionUnmarshaller());
exceptionUnmarshallers
.add(new InvalidForwardCookiesExceptionUnmarshaller());
exceptionUnmarshallers
.add(new CloudFrontOriginAccessIdentityInUseExceptionUnmarshaller());
exceptionUnmarshallers
.add(new CloudFrontOriginAccessIdentityAlreadyExistsExceptionUnmarshaller());
exceptionUnmarshallers
.add(new TooManyOriginCustomHeadersExceptionUnmarshaller());
exceptionUnmarshallers
.add(new InvalidResponseCodeExceptionUnmarshaller());
exceptionUnmarshallers
.add(new InvalidViewerCertificateExceptionUnmarshaller());
exceptionUnmarshallers.add(new TooManyOriginsExceptionUnmarshaller());
exceptionUnmarshallers
.add(new TrustedSignerDoesNotExistExceptionUnmarshaller());
exceptionUnmarshallers
.add(new TooManyTrustedSignersExceptionUnmarshaller());
exceptionUnmarshallers
.add(new InvalidRelativePathExceptionUnmarshaller());
exceptionUnmarshallers.add(new AccessDeniedExceptionUnmarshaller());
exceptionUnmarshallers
.add(new TooManyStreamingDistributionsExceptionUnmarshaller());
exceptionUnmarshallers
.add(new PreconditionFailedExceptionUnmarshaller());
exceptionUnmarshallers
.add(new InvalidGeoRestrictionParameterExceptionUnmarshaller());
exceptionUnmarshallers.add(new InvalidTTLOrderExceptionUnmarshaller());
exceptionUnmarshallers
.add(new TooManyStreamingDistributionCNAMEsExceptionUnmarshaller());
exceptionUnmarshallers
.add(new InconsistentQuantitiesExceptionUnmarshaller());
exceptionUnmarshallers
.add(new InvalidRequiredProtocolExceptionUnmarshaller());
exceptionUnmarshallers
.add(new TooManyHeadersInForwardedValuesExceptionUnmarshaller());
exceptionUnmarshallers
.add(new NoSuchCloudFrontOriginAccessIdentityExceptionUnmarshaller());
exceptionUnmarshallers
.add(new DistributionNotDisabledExceptionUnmarshaller());
exceptionUnmarshallers.add(new NoSuchOriginExceptionUnmarshaller());
exceptionUnmarshallers
.add(new InvalidOriginAccessIdentityExceptionUnmarshaller());
exceptionUnmarshallers
.add(new InvalidHeadersForS3OriginExceptionUnmarshaller());
exceptionUnmarshallers.add(new InvalidErrorCodeExceptionUnmarshaller());
exceptionUnmarshallers
.add(new NoSuchDistributionExceptionUnmarshaller());
exceptionUnmarshallers
.add(new CNAMEAlreadyExistsExceptionUnmarshaller());
exceptionUnmarshallers.add(new IllegalUpdateExceptionUnmarshaller());
exceptionUnmarshallers.add(new InvalidOriginExceptionUnmarshaller());
exceptionUnmarshallers
.add(new InvalidDefaultRootObjectExceptionUnmarshaller());
exceptionUnmarshallers
.add(new TooManyCacheBehaviorsExceptionUnmarshaller());
exceptionUnmarshallers
.add(new TooManyCertificatesExceptionUnmarshaller());
exceptionUnmarshallers
.add(new InvalidProtocolSettingsExceptionUnmarshaller());
exceptionUnmarshallers
.add(new InvalidLocationCodeExceptionUnmarshaller());
exceptionUnmarshallers
.add(new NoSuchStreamingDistributionExceptionUnmarshaller());
exceptionUnmarshallers
.add(new TooManyDistributionCNAMEsExceptionUnmarshaller());
exceptionUnmarshallers
.add(new InvalidIfMatchVersionExceptionUnmarshaller());
exceptionUnmarshallers
.add(new TooManyCookieNamesInWhiteListExceptionUnmarshaller());
exceptionUnmarshallers
.add(new InvalidMinimumProtocolVersionExceptionUnmarshaller());
exceptionUnmarshallers.add(new InvalidArgumentExceptionUnmarshaller());
exceptionUnmarshallers
.add(new StreamingDistributionNotDisabledExceptionUnmarshaller());
exceptionUnmarshallers
.add(new TooManyDistributionsExceptionUnmarshaller());
exceptionUnmarshallers.add(new StandardErrorUnmarshaller());
setServiceNameIntern(DEFAULT_SIGNING_NAME);
setEndpointPrefix(DEFAULT_ENDPOINT_PREFIX);
// calling this.setEndPoint(...) will also modify the signer accordingly
this.setEndpoint("https://cloudfront.amazonaws.com/");
HandlerChainFactory chainFactory = new HandlerChainFactory();
requestHandler2s
.addAll(chainFactory
.newRequestHandlerChain("/com/amazonaws/services/cloudfront/request.handlers"));
requestHandler2s
.addAll(chainFactory
.newRequestHandler2Chain("/com/amazonaws/services/cloudfront/request.handler2s"));
}
/**
* Create a new origin access identity.
*
* @param createCloudFrontOriginAccessIdentityRequest
* The request to create a new origin access identity.
* @return Result of the CreateCloudFrontOriginAccessIdentity operation
* returned by the service.
* @throws CloudFrontOriginAccessIdentityAlreadyExistsException
* If the CallerReference is a value you already sent in a previous
* request to create an identity but the content of the
* CloudFrontOriginAccessIdentityConfig is different from the
* original request, CloudFront returns a
* CloudFrontOriginAccessIdentityAlreadyExists error.
* @throws MissingBodyException
* This operation requires a body. Ensure that the body is present
* and the Content-Type header is set.
* @throws TooManyCloudFrontOriginAccessIdentitiesException
* Processing your request would cause you to exceed the maximum
* number of origin access identities allowed.
* @throws InvalidArgumentException
* The argument is invalid.
* @throws InconsistentQuantitiesException
* The value of Quantity and the size of Items do not match.
* @sample AmazonCloudFront.CreateCloudFrontOriginAccessIdentity
*/
@Override
public CreateCloudFrontOriginAccessIdentityResult createCloudFrontOriginAccessIdentity(
CreateCloudFrontOriginAccessIdentityRequest createCloudFrontOriginAccessIdentityRequest) {
ExecutionContext executionContext = createExecutionContext(createCloudFrontOriginAccessIdentityRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateCloudFrontOriginAccessIdentityRequestMarshaller()
.marshall(super
.beforeMarshalling(createCloudFrontOriginAccessIdentityRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new CreateCloudFrontOriginAccessIdentityResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Create a new distribution.
*
* @param createDistributionRequest
* The request to create a new distribution.
* @return Result of the CreateDistribution operation returned by the
* service.
* @throws CNAMEAlreadyExistsException
* @throws DistributionAlreadyExistsException
* The caller reference you attempted to create the distribution
* with is associated with another distribution.
* @throws InvalidOriginException
* The Amazon S3 origin server specified does not refer to a valid
* Amazon S3 bucket.
* @throws InvalidOriginAccessIdentityException
* The origin access identity is not valid or doesn't exist.
* @throws AccessDeniedException
* Access denied.
* @throws TooManyTrustedSignersException
* Your request contains more trusted signers than are allowed per
* distribution.
* @throws TrustedSignerDoesNotExistException
* One or more of your trusted signers do not exist.
* @throws InvalidViewerCertificateException
* @throws InvalidMinimumProtocolVersionException
* @throws MissingBodyException
* This operation requires a body. Ensure that the body is present
* and the Content-Type header is set.
* @throws TooManyDistributionCNAMEsException
* Your request contains more CNAMEs than are allowed per
* distribution.
* @throws TooManyDistributionsException
* Processing your request would cause you to exceed the maximum
* number of distributions allowed.
* @throws InvalidDefaultRootObjectException
* The default root object file name is too big or contains an
* invalid character.
* @throws InvalidRelativePathException
* The relative path is too big, is not URL-encoded, or does not
* begin with a slash (/).
* @throws InvalidErrorCodeException
* @throws InvalidResponseCodeException
* @throws InvalidArgumentException
* The argument is invalid.
* @throws InvalidRequiredProtocolException
* This operation requires the HTTPS protocol. Ensure that you
* specify the HTTPS protocol in your request, or omit the
* RequiredProtocols element from your distribution configuration.
* @throws NoSuchOriginException
* No origin exists with the specified Origin Id.
* @throws TooManyOriginsException
* You cannot create anymore origins for the distribution.
* @throws TooManyCacheBehaviorsException
* You cannot create anymore cache behaviors for the distribution.
* @throws TooManyCookieNamesInWhiteListException
* Your request contains more cookie names in the whitelist than are
* allowed per cache behavior.
* @throws InvalidForwardCookiesException
* Your request contains forward cookies option which doesn't match
* with the expectation for the whitelisted list of cookie names.
* Either list of cookie names has been specified when not allowed
* or list of cookie names is missing when expected.
* @throws TooManyHeadersInForwardedValuesException
* @throws InvalidHeadersForS3OriginException
* @throws InconsistentQuantitiesException
* The value of Quantity and the size of Items do not match.
* @throws TooManyCertificatesException
* You cannot create anymore custom ssl certificates.
* @throws InvalidLocationCodeException
* @throws InvalidGeoRestrictionParameterException
* @throws InvalidProtocolSettingsException
* You cannot specify SSLv3 as the minimum protocol version if you
* only want to support only clients that Support Server Name
* Indication (SNI).
* @throws InvalidTTLOrderException
* @throws InvalidWebACLIdException
* @throws TooManyOriginCustomHeadersException
* @sample AmazonCloudFront.CreateDistribution
*/
@Override
public CreateDistributionResult createDistribution(
CreateDistributionRequest createDistributionRequest) {
ExecutionContext executionContext = createExecutionContext(createDistributionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateDistributionRequestMarshaller()
.marshall(super
.beforeMarshalling(createDistributionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new CreateDistributionResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Create a new invalidation.
*
* @param createInvalidationRequest
* The request to create an invalidation.
* @return Result of the CreateInvalidation operation returned by the
* service.
* @throws AccessDeniedException
* Access denied.
* @throws MissingBodyException
* This operation requires a body. Ensure that the body is present
* and the Content-Type header is set.
* @throws InvalidArgumentException
* The argument is invalid.
* @throws NoSuchDistributionException
* The specified distribution does not exist.
* @throws BatchTooLargeException
* @throws TooManyInvalidationsInProgressException
* You have exceeded the maximum number of allowable InProgress
* invalidation batch requests, or invalidation objects.
* @throws InconsistentQuantitiesException
* The value of Quantity and the size of Items do not match.
* @sample AmazonCloudFront.CreateInvalidation
*/
@Override
public CreateInvalidationResult createInvalidation(
CreateInvalidationRequest createInvalidationRequest) {
ExecutionContext executionContext = createExecutionContext(createInvalidationRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateInvalidationRequestMarshaller()
.marshall(super
.beforeMarshalling(createInvalidationRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new CreateInvalidationResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Create a new streaming distribution.
*
* @param createStreamingDistributionRequest
* The request to create a new streaming distribution.
* @return Result of the CreateStreamingDistribution operation returned by
* the service.
* @throws CNAMEAlreadyExistsException
* @throws StreamingDistributionAlreadyExistsException
* @throws InvalidOriginException
* The Amazon S3 origin server specified does not refer to a valid
* Amazon S3 bucket.
* @throws InvalidOriginAccessIdentityException
* The origin access identity is not valid or doesn't exist.
* @throws AccessDeniedException
* Access denied.
* @throws TooManyTrustedSignersException
* Your request contains more trusted signers than are allowed per
* distribution.
* @throws TrustedSignerDoesNotExistException
* One or more of your trusted signers do not exist.
* @throws MissingBodyException
* This operation requires a body. Ensure that the body is present
* and the Content-Type header is set.
* @throws TooManyStreamingDistributionCNAMEsException
* @throws TooManyStreamingDistributionsException
* Processing your request would cause you to exceed the maximum
* number of streaming distributions allowed.
* @throws InvalidArgumentException
* The argument is invalid.
* @throws InconsistentQuantitiesException
* The value of Quantity and the size of Items do not match.
* @sample AmazonCloudFront.CreateStreamingDistribution
*/
@Override
public CreateStreamingDistributionResult createStreamingDistribution(
CreateStreamingDistributionRequest createStreamingDistributionRequest) {
ExecutionContext executionContext = createExecutionContext(createStreamingDistributionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateStreamingDistributionRequestMarshaller()
.marshall(super
.beforeMarshalling(createStreamingDistributionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new CreateStreamingDistributionResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Delete an origin access identity.
*
* @param deleteCloudFrontOriginAccessIdentityRequest
* The request to delete a origin access identity.
* @return Result of the DeleteCloudFrontOriginAccessIdentity operation
* returned by the service.
* @throws AccessDeniedException
* Access denied.
* @throws InvalidIfMatchVersionException
* The If-Match version is missing or not valid for the
* distribution.
* @throws NoSuchCloudFrontOriginAccessIdentityException
* The specified origin access identity does not exist.
* @throws PreconditionFailedException
* The precondition given in one or more of the request-header
* fields evaluated to false.
* @throws CloudFrontOriginAccessIdentityInUseException
* @sample AmazonCloudFront.DeleteCloudFrontOriginAccessIdentity
*/
@Override
public DeleteCloudFrontOriginAccessIdentityResult deleteCloudFrontOriginAccessIdentity(
DeleteCloudFrontOriginAccessIdentityRequest deleteCloudFrontOriginAccessIdentityRequest) {
ExecutionContext executionContext = createExecutionContext(deleteCloudFrontOriginAccessIdentityRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteCloudFrontOriginAccessIdentityRequestMarshaller()
.marshall(super
.beforeMarshalling(deleteCloudFrontOriginAccessIdentityRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new DeleteCloudFrontOriginAccessIdentityResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Delete a distribution.
*
* @param deleteDistributionRequest
* The request to delete a distribution.
* @return Result of the DeleteDistribution operation returned by the
* service.
* @throws AccessDeniedException
* Access denied.
* @throws DistributionNotDisabledException
* @throws InvalidIfMatchVersionException
* The If-Match version is missing or not valid for the
* distribution.
* @throws NoSuchDistributionException
* The specified distribution does not exist.
* @throws PreconditionFailedException
* The precondition given in one or more of the request-header
* fields evaluated to false.
* @sample AmazonCloudFront.DeleteDistribution
*/
@Override
public DeleteDistributionResult deleteDistribution(
DeleteDistributionRequest deleteDistributionRequest) {
ExecutionContext executionContext = createExecutionContext(deleteDistributionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteDistributionRequestMarshaller()
.marshall(super
.beforeMarshalling(deleteDistributionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new DeleteDistributionResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Delete a streaming distribution.
*
* @param deleteStreamingDistributionRequest
* The request to delete a streaming distribution.
* @return Result of the DeleteStreamingDistribution operation returned by
* the service.
* @throws AccessDeniedException
* Access denied.
* @throws StreamingDistributionNotDisabledException
* @throws InvalidIfMatchVersionException
* The If-Match version is missing or not valid for the
* distribution.
* @throws NoSuchStreamingDistributionException
* The specified streaming distribution does not exist.
* @throws PreconditionFailedException
* The precondition given in one or more of the request-header
* fields evaluated to false.
* @sample AmazonCloudFront.DeleteStreamingDistribution
*/
@Override
public DeleteStreamingDistributionResult deleteStreamingDistribution(
DeleteStreamingDistributionRequest deleteStreamingDistributionRequest) {
ExecutionContext executionContext = createExecutionContext(deleteStreamingDistributionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteStreamingDistributionRequestMarshaller()
.marshall(super
.beforeMarshalling(deleteStreamingDistributionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new DeleteStreamingDistributionResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Get the information about an origin access identity.
*
* @param getCloudFrontOriginAccessIdentityRequest
* The request to get an origin access identity's information.
* @return Result of the GetCloudFrontOriginAccessIdentity operation
* returned by the service.
* @throws NoSuchCloudFrontOriginAccessIdentityException
* The specified origin access identity does not exist.
* @throws AccessDeniedException
* Access denied.
* @sample AmazonCloudFront.GetCloudFrontOriginAccessIdentity
*/
@Override
public GetCloudFrontOriginAccessIdentityResult getCloudFrontOriginAccessIdentity(
GetCloudFrontOriginAccessIdentityRequest getCloudFrontOriginAccessIdentityRequest) {
ExecutionContext executionContext = createExecutionContext(getCloudFrontOriginAccessIdentityRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetCloudFrontOriginAccessIdentityRequestMarshaller()
.marshall(super
.beforeMarshalling(getCloudFrontOriginAccessIdentityRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new GetCloudFrontOriginAccessIdentityResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Get the configuration information about an origin access identity.
*
* @param getCloudFrontOriginAccessIdentityConfigRequest
* The request to get an origin access identity's configuration.
* @return Result of the GetCloudFrontOriginAccessIdentityConfig operation
* returned by the service.
* @throws NoSuchCloudFrontOriginAccessIdentityException
* The specified origin access identity does not exist.
* @throws AccessDeniedException
* Access denied.
* @sample AmazonCloudFront.GetCloudFrontOriginAccessIdentityConfig
*/
@Override
public GetCloudFrontOriginAccessIdentityConfigResult getCloudFrontOriginAccessIdentityConfig(
GetCloudFrontOriginAccessIdentityConfigRequest getCloudFrontOriginAccessIdentityConfigRequest) {
ExecutionContext executionContext = createExecutionContext(getCloudFrontOriginAccessIdentityConfigRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetCloudFrontOriginAccessIdentityConfigRequestMarshaller()
.marshall(super
.beforeMarshalling(getCloudFrontOriginAccessIdentityConfigRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new GetCloudFrontOriginAccessIdentityConfigResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Get the information about a distribution.
*
* @param getDistributionRequest
* The request to get a distribution's information.
* @return Result of the GetDistribution operation returned by the service.
* @throws NoSuchDistributionException
* The specified distribution does not exist.
* @throws AccessDeniedException
* Access denied.
* @sample AmazonCloudFront.GetDistribution
*/
@Override
public GetDistributionResult getDistribution(
GetDistributionRequest getDistributionRequest) {
ExecutionContext executionContext = createExecutionContext(getDistributionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetDistributionRequestMarshaller().marshall(super
.beforeMarshalling(getDistributionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new GetDistributionResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Get the configuration information about a distribution.
*
* @param getDistributionConfigRequest
* The request to get a distribution configuration.
* @return Result of the GetDistributionConfig operation returned by the
* service.
* @throws NoSuchDistributionException
* The specified distribution does not exist.
* @throws AccessDeniedException
* Access denied.
* @sample AmazonCloudFront.GetDistributionConfig
*/
@Override
public GetDistributionConfigResult getDistributionConfig(
GetDistributionConfigRequest getDistributionConfigRequest) {
ExecutionContext executionContext = createExecutionContext(getDistributionConfigRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetDistributionConfigRequestMarshaller()
.marshall(super
.beforeMarshalling(getDistributionConfigRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new GetDistributionConfigResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Get the information about an invalidation.
*
* @param getInvalidationRequest
* The request to get an invalidation's information.
* @return Result of the GetInvalidation operation returned by the service.
* @throws NoSuchInvalidationException
* The specified invalidation does not exist.
* @throws NoSuchDistributionException
* The specified distribution does not exist.
* @throws AccessDeniedException
* Access denied.
* @sample AmazonCloudFront.GetInvalidation
*/
@Override
public GetInvalidationResult getInvalidation(
GetInvalidationRequest getInvalidationRequest) {
ExecutionContext executionContext = createExecutionContext(getInvalidationRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetInvalidationRequestMarshaller().marshall(super
.beforeMarshalling(getInvalidationRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new GetInvalidationResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Get the information about a streaming distribution.
*
* @param getStreamingDistributionRequest
* The request to get a streaming distribution's information.
* @return Result of the GetStreamingDistribution operation returned by the
* service.
* @throws NoSuchStreamingDistributionException
* The specified streaming distribution does not exist.
* @throws AccessDeniedException
* Access denied.
* @sample AmazonCloudFront.GetStreamingDistribution
*/
@Override
public GetStreamingDistributionResult getStreamingDistribution(
GetStreamingDistributionRequest getStreamingDistributionRequest) {
ExecutionContext executionContext = createExecutionContext(getStreamingDistributionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetStreamingDistributionRequestMarshaller()
.marshall(super
.beforeMarshalling(getStreamingDistributionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new GetStreamingDistributionResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Get the configuration information about a streaming distribution.
*
* @param getStreamingDistributionConfigRequest
* To request to get a streaming distribution configuration.
* @return Result of the GetStreamingDistributionConfig operation returned
* by the service.
* @throws NoSuchStreamingDistributionException
* The specified streaming distribution does not exist.
* @throws AccessDeniedException
* Access denied.
* @sample AmazonCloudFront.GetStreamingDistributionConfig
*/
@Override
public GetStreamingDistributionConfigResult getStreamingDistributionConfig(
GetStreamingDistributionConfigRequest getStreamingDistributionConfigRequest) {
ExecutionContext executionContext = createExecutionContext(getStreamingDistributionConfigRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetStreamingDistributionConfigRequestMarshaller()
.marshall(super
.beforeMarshalling(getStreamingDistributionConfigRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new GetStreamingDistributionConfigResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* List origin access identities.
*
* @param listCloudFrontOriginAccessIdentitiesRequest
* The request to list origin access identities.
* @return Result of the ListCloudFrontOriginAccessIdentities operation
* returned by the service.
* @throws InvalidArgumentException
* The argument is invalid.
* @sample AmazonCloudFront.ListCloudFrontOriginAccessIdentities
*/
@Override
public ListCloudFrontOriginAccessIdentitiesResult listCloudFrontOriginAccessIdentities(
ListCloudFrontOriginAccessIdentitiesRequest listCloudFrontOriginAccessIdentitiesRequest) {
ExecutionContext executionContext = createExecutionContext(listCloudFrontOriginAccessIdentitiesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListCloudFrontOriginAccessIdentitiesRequestMarshaller()
.marshall(super
.beforeMarshalling(listCloudFrontOriginAccessIdentitiesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new ListCloudFrontOriginAccessIdentitiesResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* List distributions.
*
* @param listDistributionsRequest
* The request to list your distributions.
* @return Result of the ListDistributions operation returned by the
* service.
* @throws InvalidArgumentException
* The argument is invalid.
* @sample AmazonCloudFront.ListDistributions
*/
@Override
public ListDistributionsResult listDistributions(
ListDistributionsRequest listDistributionsRequest) {
ExecutionContext executionContext = createExecutionContext(listDistributionsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListDistributionsRequestMarshaller()
.marshall(super
.beforeMarshalling(listDistributionsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new ListDistributionsResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* List the distributions that are associated with a specified AWS WAF web
* ACL.
*
* @param listDistributionsByWebACLIdRequest
* The request to list distributions that are associated with a
* specified AWS WAF web ACL.
* @return Result of the ListDistributionsByWebACLId operation returned by
* the service.
* @throws InvalidArgumentException
* The argument is invalid.
* @throws InvalidWebACLIdException
* @sample AmazonCloudFront.ListDistributionsByWebACLId
*/
@Override
public ListDistributionsByWebACLIdResult listDistributionsByWebACLId(
ListDistributionsByWebACLIdRequest listDistributionsByWebACLIdRequest) {
ExecutionContext executionContext = createExecutionContext(listDistributionsByWebACLIdRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListDistributionsByWebACLIdRequestMarshaller()
.marshall(super
.beforeMarshalling(listDistributionsByWebACLIdRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new ListDistributionsByWebACLIdResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* List invalidation batches.
*
* @param listInvalidationsRequest
* The request to list invalidations.
* @return Result of the ListInvalidations operation returned by the
* service.
* @throws InvalidArgumentException
* The argument is invalid.
* @throws NoSuchDistributionException
* The specified distribution does not exist.
* @throws AccessDeniedException
* Access denied.
* @sample AmazonCloudFront.ListInvalidations
*/
@Override
public ListInvalidationsResult listInvalidations(
ListInvalidationsRequest listInvalidationsRequest) {
ExecutionContext executionContext = createExecutionContext(listInvalidationsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListInvalidationsRequestMarshaller()
.marshall(super
.beforeMarshalling(listInvalidationsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new ListInvalidationsResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* List streaming distributions.
*
* @param listStreamingDistributionsRequest
* The request to list your streaming distributions.
* @return Result of the ListStreamingDistributions operation returned by
* the service.
* @throws InvalidArgumentException
* The argument is invalid.
* @sample AmazonCloudFront.ListStreamingDistributions
*/
@Override
public ListStreamingDistributionsResult listStreamingDistributions(
ListStreamingDistributionsRequest listStreamingDistributionsRequest) {
ExecutionContext executionContext = createExecutionContext(listStreamingDistributionsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListStreamingDistributionsRequestMarshaller()
.marshall(super
.beforeMarshalling(listStreamingDistributionsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new ListStreamingDistributionsResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Update an origin access identity.
*
* @param updateCloudFrontOriginAccessIdentityRequest
* The request to update an origin access identity.
* @return Result of the UpdateCloudFrontOriginAccessIdentity operation
* returned by the service.
* @throws AccessDeniedException
* Access denied.
* @throws IllegalUpdateException
* Origin and CallerReference cannot be updated.
* @throws InvalidIfMatchVersionException
* The If-Match version is missing or not valid for the
* distribution.
* @throws MissingBodyException
* This operation requires a body. Ensure that the body is present
* and the Content-Type header is set.
* @throws NoSuchCloudFrontOriginAccessIdentityException
* The specified origin access identity does not exist.
* @throws PreconditionFailedException
* The precondition given in one or more of the request-header
* fields evaluated to false.
* @throws InvalidArgumentException
* The argument is invalid.
* @throws InconsistentQuantitiesException
* The value of Quantity and the size of Items do not match.
* @sample AmazonCloudFront.UpdateCloudFrontOriginAccessIdentity
*/
@Override
public UpdateCloudFrontOriginAccessIdentityResult updateCloudFrontOriginAccessIdentity(
UpdateCloudFrontOriginAccessIdentityRequest updateCloudFrontOriginAccessIdentityRequest) {
ExecutionContext executionContext = createExecutionContext(updateCloudFrontOriginAccessIdentityRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateCloudFrontOriginAccessIdentityRequestMarshaller()
.marshall(super
.beforeMarshalling(updateCloudFrontOriginAccessIdentityRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new UpdateCloudFrontOriginAccessIdentityResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Update a distribution.
*
* @param updateDistributionRequest
* The request to update a distribution.
* @return Result of the UpdateDistribution operation returned by the
* service.
* @throws AccessDeniedException
* Access denied.
* @throws CNAMEAlreadyExistsException
* @throws IllegalUpdateException
* Origin and CallerReference cannot be updated.
* @throws InvalidIfMatchVersionException
* The If-Match version is missing or not valid for the
* distribution.
* @throws MissingBodyException
* This operation requires a body. Ensure that the body is present
* and the Content-Type header is set.
* @throws NoSuchDistributionException
* The specified distribution does not exist.
* @throws PreconditionFailedException
* The precondition given in one or more of the request-header
* fields evaluated to false.
* @throws TooManyDistributionCNAMEsException
* Your request contains more CNAMEs than are allowed per
* distribution.
* @throws InvalidDefaultRootObjectException
* The default root object file name is too big or contains an
* invalid character.
* @throws InvalidRelativePathException
* The relative path is too big, is not URL-encoded, or does not
* begin with a slash (/).
* @throws InvalidErrorCodeException
* @throws InvalidResponseCodeException
* @throws InvalidArgumentException
* The argument is invalid.
* @throws InvalidOriginAccessIdentityException
* The origin access identity is not valid or doesn't exist.
* @throws TooManyTrustedSignersException
* Your request contains more trusted signers than are allowed per
* distribution.
* @throws TrustedSignerDoesNotExistException
* One or more of your trusted signers do not exist.
* @throws InvalidViewerCertificateException
* @throws InvalidMinimumProtocolVersionException
* @throws InvalidRequiredProtocolException
* This operation requires the HTTPS protocol. Ensure that you
* specify the HTTPS protocol in your request, or omit the
* RequiredProtocols element from your distribution configuration.
* @throws NoSuchOriginException
* No origin exists with the specified Origin Id.
* @throws TooManyOriginsException
* You cannot create anymore origins for the distribution.
* @throws TooManyCacheBehaviorsException
* You cannot create anymore cache behaviors for the distribution.
* @throws TooManyCookieNamesInWhiteListException
* Your request contains more cookie names in the whitelist than are
* allowed per cache behavior.
* @throws InvalidForwardCookiesException
* Your request contains forward cookies option which doesn't match
* with the expectation for the whitelisted list of cookie names.
* Either list of cookie names has been specified when not allowed
* or list of cookie names is missing when expected.
* @throws TooManyHeadersInForwardedValuesException
* @throws InvalidHeadersForS3OriginException
* @throws InconsistentQuantitiesException
* The value of Quantity and the size of Items do not match.
* @throws TooManyCertificatesException
* You cannot create anymore custom ssl certificates.
* @throws InvalidLocationCodeException
* @throws InvalidGeoRestrictionParameterException
* @throws InvalidTTLOrderException
* @throws InvalidWebACLIdException
* @throws TooManyOriginCustomHeadersException
* @sample AmazonCloudFront.UpdateDistribution
*/
@Override
public UpdateDistributionResult updateDistribution(
UpdateDistributionRequest updateDistributionRequest) {
ExecutionContext executionContext = createExecutionContext(updateDistributionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateDistributionRequestMarshaller()
.marshall(super
.beforeMarshalling(updateDistributionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new UpdateDistributionResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Update a streaming distribution.
*
* @param updateStreamingDistributionRequest
* The request to update a streaming distribution.
* @return Result of the UpdateStreamingDistribution operation returned by
* the service.
* @throws AccessDeniedException
* Access denied.
* @throws CNAMEAlreadyExistsException
* @throws IllegalUpdateException
* Origin and CallerReference cannot be updated.
* @throws InvalidIfMatchVersionException
* The If-Match version is missing or not valid for the
* distribution.
* @throws MissingBodyException
* This operation requires a body. Ensure that the body is present
* and the Content-Type header is set.
* @throws NoSuchStreamingDistributionException
* The specified streaming distribution does not exist.
* @throws PreconditionFailedException
* The precondition given in one or more of the request-header
* fields evaluated to false.
* @throws TooManyStreamingDistributionCNAMEsException
* @throws InvalidArgumentException
* The argument is invalid.
* @throws InvalidOriginAccessIdentityException
* The origin access identity is not valid or doesn't exist.
* @throws TooManyTrustedSignersException
* Your request contains more trusted signers than are allowed per
* distribution.
* @throws TrustedSignerDoesNotExistException
* One or more of your trusted signers do not exist.
* @throws InconsistentQuantitiesException
* The value of Quantity and the size of Items do not match.
* @sample AmazonCloudFront.UpdateStreamingDistribution
*/
@Override
public UpdateStreamingDistributionResult updateStreamingDistribution(
UpdateStreamingDistributionRequest updateStreamingDistributionRequest) {
ExecutionContext executionContext = createExecutionContext(updateStreamingDistributionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext
.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateStreamingDistributionRequestMarshaller()
.marshall(super
.beforeMarshalling(updateStreamingDistributionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
StaxResponseHandler responseHandler = new StaxResponseHandler(
new UpdateStreamingDistributionResultStaxUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Returns additional metadata for a previously executed successful,
* request, typically used for debugging issues where a service isn't acting
* as expected. This data isn't considered part of the result data returned
* by an operation, so it's available through this separate, diagnostic
* interface.
*
* Response metadata is only cached for a limited period of time, so if you
* need to access this extra diagnostic information for an executed request,
* you should use this method to retrieve it as soon as possible after
* executing the request.
*
* @param request
* The originally executed request
*
* @return The response metadata for the specified request, or null if none
* is available.
*/
public ResponseMetadata getCachedResponseMetadata(
AmazonWebServiceRequest request) {
return client.getResponseMetadataForRequest(request);
}
/**
* Normal invoke with authentication. Credentials are required and may be
* overriden at the request level.
**/
private Response invoke(
Request request,
HttpResponseHandler> responseHandler,
ExecutionContext executionContext) {
executionContext.setCredentialsProvider(CredentialUtils
.getCredentialsProvider(request.getOriginalRequest(),
awsCredentialsProvider));
return doInvoke(request, responseHandler, executionContext);
}
/**
* Invoke with no authentication. Credentials are not required and any
* credentials set on the client or request will be ignored for this
* operation.
**/
private Response anonymousInvoke(
Request request,
HttpResponseHandler> responseHandler,
ExecutionContext executionContext) {
return doInvoke(request, responseHandler, executionContext);
}
/**
* Invoke the request using the http client. Assumes credentials (or lack
* thereof) have been configured in the ExecutionContext beforehand.
**/
private Response doInvoke(
Request request,
HttpResponseHandler> responseHandler,
ExecutionContext executionContext) {
request.setEndpoint(endpoint);
request.setTimeOffset(timeOffset);
DefaultErrorResponseHandler errorResponseHandler = new DefaultErrorResponseHandler(
exceptionUnmarshallers);
return client.execute(request, responseHandler, errorResponseHandler,
executionContext);
}
}