/*
* Copyright 2010-2013 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.Node;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map.Entry;
import com.amazonaws.*;
import com.amazonaws.auth.*;
import com.amazonaws.handlers.HandlerChainFactory;
import com.amazonaws.handlers.RequestHandler;
import com.amazonaws.http.StaxResponseHandler;
import com.amazonaws.http.DefaultErrorResponseHandler;
import com.amazonaws.http.ExecutionContext;
import com.amazonaws.internal.StaticCredentialsProvider;
import com.amazonaws.transform.Unmarshaller;
import com.amazonaws.transform.StaxUnmarshallerContext;
import com.amazonaws.transform.StandardErrorUnmarshaller;
import com.amazonaws.services.cloudfront.model.*;
import com.amazonaws.services.cloudfront.model.transform.*;
/**
* Client for accessing AmazonCloudFront. All service calls made
* using this client are blocking, and will not return until the service call
* completes.
* <p>
*
*/
public class AmazonCloudFrontClient extends AmazonWebServiceClient implements AmazonCloudFront {
/** Provider for AWS credentials. */
private AWSCredentialsProvider awsCredentialsProvider;
/**
* List of exception unmarshallers for all AmazonCloudFront exceptions.
*/
protected final List<Unmarshaller<AmazonServiceException, Node>> exceptionUnmarshallers
= new ArrayList<Unmarshaller<AmazonServiceException, Node>>();
/** AWS signer for authenticating requests. */
private CloudFrontSigner signer;
/**
* Constructs a new client to invoke service methods on
* AmazonCloudFront. A credentials provider chain will be used
* that searches for credentials in this order:
* <ul>
* <li> Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY </li>
* <li> Java System Properties - aws.accessKeyId and aws.secretKey </li>
* <li> Instance profile credentials delivered through the Amazon EC2 metadata service </li>
* </ul>
*
* <p>
* All service calls made using this new client object are blocking, and will not
* return until the service call completes.
*
* @see DefaultAWSCredentialsProvider
*/
public AmazonCloudFrontClient() {
this(new DefaultAWSCredentialsProviderChain(), new ClientConfiguration());
}
/**
* Constructs a new client to invoke service methods on
* AmazonCloudFront. A credentials provider chain will be used
* that searches for credentials in this order:
* <ul>
* <li> Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY </li>
* <li> Java System Properties - aws.accessKeyId and aws.secretKey </li>
* <li> Instance profile credentials delivered through the Amazon EC2 metadata service </li>
* </ul>
*
* <p>
* 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 AmazonCloudFront
* (ex: proxy settings, retry counts, etc.).
*
* @see DefaultAWSCredentialsProvider
*/
public AmazonCloudFrontClient(ClientConfiguration clientConfiguration) {
this(new DefaultAWSCredentialsProviderChain(), clientConfiguration);
}
/**
* Constructs a new client to invoke service methods on
* AmazonCloudFront using the specified AWS account credentials.
*
* <p>
* 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, new ClientConfiguration());
}
/**
* Constructs a new client to invoke service methods on
* AmazonCloudFront using the specified AWS account credentials
* and client configuration options.
*
* <p>
* 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 AmazonCloudFront
* (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
* AmazonCloudFront using the specified AWS account credentials provider.
*
* <p>
* 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, new ClientConfiguration());
}
/**
* Constructs a new client to invoke service methods on
* AmazonCloudFront using the specified AWS account credentials
* provider and client configuration options.
*
* <p>
* 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 AmazonCloudFront
* (ex: proxy settings, retry counts, etc.).
*/
public AmazonCloudFrontClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration) {
super(clientConfiguration);
this.awsCredentialsProvider = awsCredentialsProvider;
init();
}
private void init() {
exceptionUnmarshallers.add(new TooManyDistributionsExceptionUnmarshaller());
exceptionUnmarshallers.add(new PreconditionFailedExceptionUnmarshaller());
exceptionUnmarshallers.add(new CNAMEAlreadyExistsExceptionUnmarshaller());
exceptionUnmarshallers.add(new CloudFrontOriginAccessIdentityInUseExceptionUnmarshaller());
exceptionUnmarshallers.add(new TrustedSignerDoesNotExistExceptionUnmarshaller());
exceptionUnmarshallers.add(new DistributionNotDisabledExceptionUnmarshaller());
exceptionUnmarshallers.add(new BatchTooLargeExceptionUnmarshaller());
exceptionUnmarshallers.add(new StreamingDistributionNotDisabledExceptionUnmarshaller());
exceptionUnmarshallers.add(new InvalidArgumentExceptionUnmarshaller());
exceptionUnmarshallers.add(new TooManyStreamingDistributionsExceptionUnmarshaller());
exceptionUnmarshallers.add(new TooManyTrustedSignersExceptionUnmarshaller());
exceptionUnmarshallers.add(new TooManyOriginsExceptionUnmarshaller());
exceptionUnmarshallers.add(new InvalidRequiredProtocolExceptionUnmarshaller());
exceptionUnmarshallers.add(new IllegalUpdateExceptionUnmarshaller());
exceptionUnmarshallers.add(new TooManyCloudFrontOriginAccessIdentitiesExceptionUnmarshaller());
exceptionUnmarshallers.add(new NoSuchOriginExceptionUnmarshaller());
exceptionUnmarshallers.add(new TooManyCacheBehaviorsExceptionUnmarshaller());
exceptionUnmarshallers.add(new NoSuchDistributionExceptionUnmarshaller());
exceptionUnmarshallers.add(new DistributionAlreadyExistsExceptionUnmarshaller());
exceptionUnmarshallers.add(new CloudFrontOriginAccessIdentityAlreadyExistsExceptionUnmarshaller());
exceptionUnmarshallers.add(new TooManyInvalidationsInProgressExceptionUnmarshaller());
exceptionUnmarshallers.add(new InvalidDefaultRootObjectExceptionUnmarshaller());
exceptionUnmarshallers.add(new InvalidIfMatchVersionExceptionUnmarshaller());
exceptionUnmarshallers.add(new InvalidOriginExceptionUnmarshaller());
exceptionUnmarshallers.add(new NoSuchInvalidationExceptionUnmarshaller());
exceptionUnmarshallers.add(new StreamingDistributionAlreadyExistsExceptionUnmarshaller());
exceptionUnmarshallers.add(new AccessDeniedExceptionUnmarshaller());
exceptionUnmarshallers.add(new MissingBodyExceptionUnmarshaller());
exceptionUnmarshallers.add(new TooManyDistributionCNAMEsExceptionUnmarshaller());
exceptionUnmarshallers.add(new NoSuchCloudFrontOriginAccessIdentityExceptionUnmarshaller());
exceptionUnmarshallers.add(new InconsistentQuantitiesExceptionUnmarshaller());
exceptionUnmarshallers.add(new InvalidOriginAccessIdentityExceptionUnmarshaller());
exceptionUnmarshallers.add(new NoSuchStreamingDistributionExceptionUnmarshaller());
exceptionUnmarshallers.add(new TooManyStreamingDistributionCNAMEsExceptionUnmarshaller());
exceptionUnmarshallers.add(new StandardErrorUnmarshaller());
setEndpoint("cloudfront.amazonaws.com/");
signer = new CloudFrontSigner();
HandlerChainFactory chainFactory = new HandlerChainFactory();
requestHandlers.addAll(chainFactory.newRequestHandlerChain(
"/com/amazonaws/services/cloudfront/request.handlers"));
}
/**
* <p>
* Update an origin access identity.
* </p>
*
* @param updateCloudFrontOriginAccessIdentityRequest Container for the
* necessary parameters to execute the
* UpdateCloudFrontOriginAccessIdentity service method on
* AmazonCloudFront.
*
* @return The response from the UpdateCloudFrontOriginAccessIdentity
* service method, as returned by AmazonCloudFront.
*
* @throws InvalidIfMatchVersionException
* @throws IllegalUpdateException
* @throws MissingBodyException
* @throws NoSuchCloudFrontOriginAccessIdentityException
* @throws PreconditionFailedException
* @throws AccessDeniedException
* @throws InvalidArgumentException
* @throws InconsistentQuantitiesException
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonCloudFront indicating
* either a problem with the data in the request, or a server side issue.
*/
public UpdateCloudFrontOriginAccessIdentityResult updateCloudFrontOriginAccessIdentity(UpdateCloudFrontOriginAccessIdentityRequest updateCloudFrontOriginAccessIdentityRequest)
throws AmazonServiceException, AmazonClientException {
Request<UpdateCloudFrontOriginAccessIdentityRequest> request = new UpdateCloudFrontOriginAccessIdentityRequestMarshaller().marshall(updateCloudFrontOriginAccessIdentityRequest);
return invoke(request, new UpdateCloudFrontOriginAccessIdentityResultStaxUnmarshaller());
}
/**
* <p>
* List distributions.
* </p>
*
* @param listDistributionsRequest Container for the necessary parameters
* to execute the ListDistributions service method on AmazonCloudFront.
*
* @return The response from the ListDistributions service method, as
* returned by AmazonCloudFront.
*
* @throws InvalidArgumentException
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonCloudFront indicating
* either a problem with the data in the request, or a server side issue.
*/
public ListDistributionsResult listDistributions(ListDistributionsRequest listDistributionsRequest)
throws AmazonServiceException, AmazonClientException {
Request<ListDistributionsRequest> request = new ListDistributionsRequestMarshaller().marshall(listDistributionsRequest);
return invoke(request, new ListDistributionsResultStaxUnmarshaller());
}
/**
* <p>
* Update a distribution.
* </p>
*
* @param updateDistributionRequest Container for the necessary
* parameters to execute the UpdateDistribution service method on
* AmazonCloudFront.
*
* @return The response from the UpdateDistribution service method, as
* returned by AmazonCloudFront.
*
* @throws InvalidDefaultRootObjectException
* @throws InvalidIfMatchVersionException
* @throws IllegalUpdateException
* @throws MissingBodyException
* @throws TooManyDistributionCNAMEsException
* @throws NoSuchOriginException
* @throws PreconditionFailedException
* @throws InconsistentQuantitiesException
* @throws CNAMEAlreadyExistsException
* @throws InvalidArgumentException
* @throws InvalidOriginAccessIdentityException
* @throws TrustedSignerDoesNotExistException
* @throws TooManyCacheBehaviorsException
* @throws TooManyTrustedSignersException
* @throws NoSuchDistributionException
* @throws AccessDeniedException
* @throws TooManyOriginsException
* @throws InvalidRequiredProtocolException
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonCloudFront indicating
* either a problem with the data in the request, or a server side issue.
*/
public UpdateDistributionResult updateDistribution(UpdateDistributionRequest updateDistributionRequest)
throws AmazonServiceException, AmazonClientException {
Request<UpdateDistributionRequest> request = new UpdateDistributionRequestMarshaller().marshall(updateDistributionRequest);
return invoke(request, new UpdateDistributionResultStaxUnmarshaller());
}
/**
* <p>
* Get the configuration information about a distribution.
* </p>
*
* @param getDistributionConfigRequest Container for the necessary
* parameters to execute the GetDistributionConfig service method on
* AmazonCloudFront.
*
* @return The response from the GetDistributionConfig service method, as
* returned by AmazonCloudFront.
*
* @throws NoSuchDistributionException
* @throws AccessDeniedException
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonCloudFront indicating
* either a problem with the data in the request, or a server side issue.
*/
public GetDistributionConfigResult getDistributionConfig(GetDistributionConfigRequest getDistributionConfigRequest)
throws AmazonServiceException, AmazonClientException {
Request<GetDistributionConfigRequest> request = new GetDistributionConfigRequestMarshaller().marshall(getDistributionConfigRequest);
return invoke(request, new GetDistributionConfigResultStaxUnmarshaller());
}
/**
* <p>
* Get the configuration information about a streaming distribution.
* </p>
*
* @param getStreamingDistributionConfigRequest Container for the
* necessary parameters to execute the GetStreamingDistributionConfig
* service method on AmazonCloudFront.
*
* @return The response from the GetStreamingDistributionConfig service
* method, as returned by AmazonCloudFront.
*
* @throws NoSuchStreamingDistributionException
* @throws AccessDeniedException
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonCloudFront indicating
* either a problem with the data in the request, or a server side issue.
*/
public GetStreamingDistributionConfigResult getStreamingDistributionConfig(GetStreamingDistributionConfigRequest getStreamingDistributionConfigRequest)
throws AmazonServiceException, AmazonClientException {
Request<GetStreamingDistributionConfigRequest> request = new GetStreamingDistributionConfigRequestMarshaller().marshall(getStreamingDistributionConfigRequest);
return invoke(request, new GetStreamingDistributionConfigResultStaxUnmarshaller());
}
/**
* <p>
* Get the information about an origin access identity.
* </p>
*
* @param getCloudFrontOriginAccessIdentityRequest Container for the
* necessary parameters to execute the GetCloudFrontOriginAccessIdentity
* service method on AmazonCloudFront.
*
* @return The response from the GetCloudFrontOriginAccessIdentity
* service method, as returned by AmazonCloudFront.
*
* @throws NoSuchCloudFrontOriginAccessIdentityException
* @throws AccessDeniedException
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonCloudFront indicating
* either a problem with the data in the request, or a server side issue.
*/
public GetCloudFrontOriginAccessIdentityResult getCloudFrontOriginAccessIdentity(GetCloudFrontOriginAccessIdentityRequest getCloudFrontOriginAccessIdentityRequest)
throws AmazonServiceException, AmazonClientException {
Request<GetCloudFrontOriginAccessIdentityRequest> request = new GetCloudFrontOriginAccessIdentityRequestMarshaller().marshall(getCloudFrontOriginAccessIdentityRequest);
return invoke(request, new GetCloudFrontOriginAccessIdentityResultStaxUnmarshaller());
}
/**
* <p>
* Delete an origin access identity.
* </p>
*
* @param deleteCloudFrontOriginAccessIdentityRequest Container for the
* necessary parameters to execute the
* DeleteCloudFrontOriginAccessIdentity service method on
* AmazonCloudFront.
*
* @throws InvalidIfMatchVersionException
* @throws CloudFrontOriginAccessIdentityInUseException
* @throws NoSuchCloudFrontOriginAccessIdentityException
* @throws PreconditionFailedException
* @throws AccessDeniedException
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonCloudFront indicating
* either a problem with the data in the request, or a server side issue.
*/
public void deleteCloudFrontOriginAccessIdentity(DeleteCloudFrontOriginAccessIdentityRequest deleteCloudFrontOriginAccessIdentityRequest)
throws AmazonServiceException, AmazonClientException {
Request<DeleteCloudFrontOriginAccessIdentityRequest> request = new DeleteCloudFrontOriginAccessIdentityRequestMarshaller().marshall(deleteCloudFrontOriginAccessIdentityRequest);
invoke(request, null);
}
/**
* <p>
* List streaming distributions.
* </p>
*
* @param listStreamingDistributionsRequest Container for the necessary
* parameters to execute the ListStreamingDistributions service method on
* AmazonCloudFront.
*
* @return The response from the ListStreamingDistributions service
* method, as returned by AmazonCloudFront.
*
* @throws InvalidArgumentException
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonCloudFront indicating
* either a problem with the data in the request, or a server side issue.
*/
public ListStreamingDistributionsResult listStreamingDistributions(ListStreamingDistributionsRequest listStreamingDistributionsRequest)
throws AmazonServiceException, AmazonClientException {
Request<ListStreamingDistributionsRequest> request = new ListStreamingDistributionsRequestMarshaller().marshall(listStreamingDistributionsRequest);
return invoke(request, new ListStreamingDistributionsResultStaxUnmarshaller());
}
/**
* <p>
* Update a streaming distribution.
* </p>
*
* @param updateStreamingDistributionRequest Container for the necessary
* parameters to execute the UpdateStreamingDistribution service method
* on AmazonCloudFront.
*
* @return The response from the UpdateStreamingDistribution service
* method, as returned by AmazonCloudFront.
*
* @throws InvalidIfMatchVersionException
* @throws IllegalUpdateException
* @throws MissingBodyException
* @throws PreconditionFailedException
* @throws CNAMEAlreadyExistsException
* @throws InvalidArgumentException
* @throws InconsistentQuantitiesException
* @throws InvalidOriginAccessIdentityException
* @throws TrustedSignerDoesNotExistException
* @throws TooManyTrustedSignersException
* @throws NoSuchStreamingDistributionException
* @throws TooManyStreamingDistributionCNAMEsException
* @throws AccessDeniedException
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonCloudFront indicating
* either a problem with the data in the request, or a server side issue.
*/
public UpdateStreamingDistributionResult updateStreamingDistribution(UpdateStreamingDistributionRequest updateStreamingDistributionRequest)
throws AmazonServiceException, AmazonClientException {
Request<UpdateStreamingDistributionRequest> request = new UpdateStreamingDistributionRequestMarshaller().marshall(updateStreamingDistributionRequest);
return invoke(request, new UpdateStreamingDistributionResultStaxUnmarshaller());
}
/**
* <p>
* Create a new invalidation.
* </p>
*
* @param createInvalidationRequest Container for the necessary
* parameters to execute the CreateInvalidation service method on
* AmazonCloudFront.
*
* @return The response from the CreateInvalidation service method, as
* returned by AmazonCloudFront.
*
* @throws TooManyInvalidationsInProgressException
* @throws MissingBodyException
* @throws NoSuchDistributionException
* @throws BatchTooLargeException
* @throws AccessDeniedException
* @throws InvalidArgumentException
* @throws InconsistentQuantitiesException
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonCloudFront indicating
* either a problem with the data in the request, or a server side issue.
*/
public CreateInvalidationResult createInvalidation(CreateInvalidationRequest createInvalidationRequest)
throws AmazonServiceException, AmazonClientException {
Request<CreateInvalidationRequest> request = new CreateInvalidationRequestMarshaller().marshall(createInvalidationRequest);
return invoke(request, new CreateInvalidationResultStaxUnmarshaller());
}
/**
* <p>
* Create a new streaming distribution.
* </p>
*
* @param createStreamingDistributionRequest Container for the necessary
* parameters to execute the CreateStreamingDistribution service method
* on AmazonCloudFront.
*
* @return The response from the CreateStreamingDistribution service
* method, as returned by AmazonCloudFront.
*
* @throws TooManyTrustedSignersException
* @throws MissingBodyException
* @throws TooManyStreamingDistributionCNAMEsException
* @throws StreamingDistributionAlreadyExistsException
* @throws CNAMEAlreadyExistsException
* @throws AccessDeniedException
* @throws TooManyStreamingDistributionsException
* @throws InvalidArgumentException
* @throws InconsistentQuantitiesException
* @throws InvalidOriginAccessIdentityException
* @throws TrustedSignerDoesNotExistException
* @throws InvalidOriginException
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonCloudFront indicating
* either a problem with the data in the request, or a server side issue.
*/
public CreateStreamingDistributionResult createStreamingDistribution(CreateStreamingDistributionRequest createStreamingDistributionRequest)
throws AmazonServiceException, AmazonClientException {
Request<CreateStreamingDistributionRequest> request = new CreateStreamingDistributionRequestMarshaller().marshall(createStreamingDistributionRequest);
return invoke(request, new CreateStreamingDistributionResultStaxUnmarshaller());
}
/**
* <p>
* Get the information about an invalidation.
* </p>
*
* @param getInvalidationRequest Container for the necessary parameters
* to execute the GetInvalidation service method on AmazonCloudFront.
*
* @return The response from the GetInvalidation service method, as
* returned by AmazonCloudFront.
*
* @throws NoSuchInvalidationException
* @throws NoSuchDistributionException
* @throws AccessDeniedException
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonCloudFront indicating
* either a problem with the data in the request, or a server side issue.
*/
public GetInvalidationResult getInvalidation(GetInvalidationRequest getInvalidationRequest)
throws AmazonServiceException, AmazonClientException {
Request<GetInvalidationRequest> request = new GetInvalidationRequestMarshaller().marshall(getInvalidationRequest);
return invoke(request, new GetInvalidationResultStaxUnmarshaller());
}
/**
* <p>
* Get the configuration information about an origin access identity.
* </p>
*
* @param getCloudFrontOriginAccessIdentityConfigRequest Container for
* the necessary parameters to execute the
* GetCloudFrontOriginAccessIdentityConfig service method on
* AmazonCloudFront.
*
* @return The response from the GetCloudFrontOriginAccessIdentityConfig
* service method, as returned by AmazonCloudFront.
*
* @throws NoSuchCloudFrontOriginAccessIdentityException
* @throws AccessDeniedException
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonCloudFront indicating
* either a problem with the data in the request, or a server side issue.
*/
public GetCloudFrontOriginAccessIdentityConfigResult getCloudFrontOriginAccessIdentityConfig(GetCloudFrontOriginAccessIdentityConfigRequest getCloudFrontOriginAccessIdentityConfigRequest)
throws AmazonServiceException, AmazonClientException {
Request<GetCloudFrontOriginAccessIdentityConfigRequest> request = new GetCloudFrontOriginAccessIdentityConfigRequestMarshaller().marshall(getCloudFrontOriginAccessIdentityConfigRequest);
return invoke(request, new GetCloudFrontOriginAccessIdentityConfigResultStaxUnmarshaller());
}
/**
* <p>
* Delete a streaming distribution.
* </p>
*
* @param deleteStreamingDistributionRequest Container for the necessary
* parameters to execute the DeleteStreamingDistribution service method
* on AmazonCloudFront.
*
* @throws InvalidIfMatchVersionException
* @throws NoSuchStreamingDistributionException
* @throws StreamingDistributionNotDisabledException
* @throws PreconditionFailedException
* @throws AccessDeniedException
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonCloudFront indicating
* either a problem with the data in the request, or a server side issue.
*/
public void deleteStreamingDistribution(DeleteStreamingDistributionRequest deleteStreamingDistributionRequest)
throws AmazonServiceException, AmazonClientException {
Request<DeleteStreamingDistributionRequest> request = new DeleteStreamingDistributionRequestMarshaller().marshall(deleteStreamingDistributionRequest);
invoke(request, null);
}
/**
* <p>
* Get the information about a streaming distribution.
* </p>
*
* @param getStreamingDistributionRequest Container for the necessary
* parameters to execute the GetStreamingDistribution service method on
* AmazonCloudFront.
*
* @return The response from the GetStreamingDistribution service method,
* as returned by AmazonCloudFront.
*
* @throws NoSuchStreamingDistributionException
* @throws AccessDeniedException
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonCloudFront indicating
* either a problem with the data in the request, or a server side issue.
*/
public GetStreamingDistributionResult getStreamingDistribution(GetStreamingDistributionRequest getStreamingDistributionRequest)
throws AmazonServiceException, AmazonClientException {
Request<GetStreamingDistributionRequest> request = new GetStreamingDistributionRequestMarshaller().marshall(getStreamingDistributionRequest);
return invoke(request, new GetStreamingDistributionResultStaxUnmarshaller());
}
/**
* <p>
* Create a new origin access identity.
* </p>
*
* @param createCloudFrontOriginAccessIdentityRequest Container for the
* necessary parameters to execute the
* CreateCloudFrontOriginAccessIdentity service method on
* AmazonCloudFront.
*
* @return The response from the CreateCloudFrontOriginAccessIdentity
* service method, as returned by AmazonCloudFront.
*
* @throws TooManyCloudFrontOriginAccessIdentitiesException
* @throws MissingBodyException
* @throws InvalidArgumentException
* @throws InconsistentQuantitiesException
* @throws CloudFrontOriginAccessIdentityAlreadyExistsException
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonCloudFront indicating
* either a problem with the data in the request, or a server side issue.
*/
public CreateCloudFrontOriginAccessIdentityResult createCloudFrontOriginAccessIdentity(CreateCloudFrontOriginAccessIdentityRequest createCloudFrontOriginAccessIdentityRequest)
throws AmazonServiceException, AmazonClientException {
Request<CreateCloudFrontOriginAccessIdentityRequest> request = new CreateCloudFrontOriginAccessIdentityRequestMarshaller().marshall(createCloudFrontOriginAccessIdentityRequest);
return invoke(request, new CreateCloudFrontOriginAccessIdentityResultStaxUnmarshaller());
}
/**
* <p>
* Delete a distribution.
* </p>
*
* @param deleteDistributionRequest Container for the necessary
* parameters to execute the DeleteDistribution service method on
* AmazonCloudFront.
*
* @throws InvalidIfMatchVersionException
* @throws NoSuchDistributionException
* @throws DistributionNotDisabledException
* @throws PreconditionFailedException
* @throws AccessDeniedException
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonCloudFront indicating
* either a problem with the data in the request, or a server side issue.
*/
public void deleteDistribution(DeleteDistributionRequest deleteDistributionRequest)
throws AmazonServiceException, AmazonClientException {
Request<DeleteDistributionRequest> request = new DeleteDistributionRequestMarshaller().marshall(deleteDistributionRequest);
invoke(request, null);
}
/**
* <p>
* Create a new distribution.
* </p>
*
* @param createDistributionRequest Container for the necessary
* parameters to execute the CreateDistribution service method on
* AmazonCloudFront.
*
* @return The response from the CreateDistribution service method, as
* returned by AmazonCloudFront.
*
* @throws InvalidDefaultRootObjectException
* @throws MissingBodyException
* @throws TooManyDistributionCNAMEsException
* @throws TooManyDistributionsException
* @throws NoSuchOriginException
* @throws InconsistentQuantitiesException
* @throws CNAMEAlreadyExistsException
* @throws InvalidArgumentException
* @throws InvalidOriginAccessIdentityException
* @throws TrustedSignerDoesNotExistException
* @throws InvalidOriginException
* @throws TooManyCacheBehaviorsException
* @throws TooManyTrustedSignersException
* @throws AccessDeniedException
* @throws TooManyOriginsException
* @throws DistributionAlreadyExistsException
* @throws InvalidRequiredProtocolException
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonCloudFront indicating
* either a problem with the data in the request, or a server side issue.
*/
public CreateDistributionResult createDistribution(CreateDistributionRequest createDistributionRequest)
throws AmazonServiceException, AmazonClientException {
Request<CreateDistributionRequest> request = new CreateDistributionRequestMarshaller().marshall(createDistributionRequest);
return invoke(request, new CreateDistributionResultStaxUnmarshaller());
}
/**
* <p>
* List invalidation batches.
* </p>
*
* @param listInvalidationsRequest Container for the necessary parameters
* to execute the ListInvalidations service method on AmazonCloudFront.
*
* @return The response from the ListInvalidations service method, as
* returned by AmazonCloudFront.
*
* @throws NoSuchDistributionException
* @throws InvalidArgumentException
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonCloudFront indicating
* either a problem with the data in the request, or a server side issue.
*/
public ListInvalidationsResult listInvalidations(ListInvalidationsRequest listInvalidationsRequest)
throws AmazonServiceException, AmazonClientException {
Request<ListInvalidationsRequest> request = new ListInvalidationsRequestMarshaller().marshall(listInvalidationsRequest);
return invoke(request, new ListInvalidationsResultStaxUnmarshaller());
}
/**
* <p>
* Get the information about a distribution.
* </p>
*
* @param getDistributionRequest Container for the necessary parameters
* to execute the GetDistribution service method on AmazonCloudFront.
*
* @return The response from the GetDistribution service method, as
* returned by AmazonCloudFront.
*
* @throws NoSuchDistributionException
* @throws AccessDeniedException
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonCloudFront indicating
* either a problem with the data in the request, or a server side issue.
*/
public GetDistributionResult getDistribution(GetDistributionRequest getDistributionRequest)
throws AmazonServiceException, AmazonClientException {
Request<GetDistributionRequest> request = new GetDistributionRequestMarshaller().marshall(getDistributionRequest);
return invoke(request, new GetDistributionResultStaxUnmarshaller());
}
/**
* <p>
* List origin access identities.
* </p>
*
* @param listCloudFrontOriginAccessIdentitiesRequest Container for the
* necessary parameters to execute the
* ListCloudFrontOriginAccessIdentities service method on
* AmazonCloudFront.
*
* @return The response from the ListCloudFrontOriginAccessIdentities
* service method, as returned by AmazonCloudFront.
*
* @throws InvalidArgumentException
*
* @throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response. For example
* if a network connection is not available.
* @throws AmazonServiceException
* If an error response is returned by AmazonCloudFront indicating
* either a problem with the data in the request, or a server side issue.
*/
public ListCloudFrontOriginAccessIdentitiesResult listCloudFrontOriginAccessIdentities(ListCloudFrontOriginAccessIdentitiesRequest listCloudFrontOriginAccessIdentitiesRequest)
throws AmazonServiceException, AmazonClientException {
Request<ListCloudFrontOriginAccessIdentitiesRequest> request = new ListCloudFrontOriginAccessIdentitiesRequestMarshaller().marshall(listCloudFrontOriginAccessIdentitiesRequest);
return invoke(request, new ListCloudFrontOriginAccessIdentitiesResultStaxUnmarshaller());
}
/**
* 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.
* <p>
* 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);
}
private <X, Y extends AmazonWebServiceRequest> X invoke(Request<Y> request, Unmarshaller<X, StaxUnmarshallerContext> unmarshaller) {
request.setEndpoint(endpoint);
for (Entry<String, String> entry : request.getOriginalRequest().copyPrivateRequestParameters().entrySet()) {
request.addParameter(entry.getKey(), entry.getValue());
}
AWSCredentials credentials = awsCredentialsProvider.getCredentials();
AmazonWebServiceRequest originalRequest = request.getOriginalRequest();
if (originalRequest != null && originalRequest.getRequestCredentials() != null) {
credentials = originalRequest.getRequestCredentials();
}
ExecutionContext executionContext = createExecutionContext();
executionContext.setSigner(signer);
executionContext.setCredentials(credentials);
StaxResponseHandler<X> responseHandler = new StaxResponseHandler<X>(unmarshaller);
DefaultErrorResponseHandler errorResponseHandler = new DefaultErrorResponseHandler(exceptionUnmarshallers);
return (X)client.execute(request, responseHandler, errorResponseHandler, executionContext);
}
}