/* * Copyright 2018-2023 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.cloudcontrolapi; import org.w3c.dom.*; import java.net.*; import java.util.*; import javax.annotation.Generated; import org.apache.commons.logging.*; import com.amazonaws.*; import com.amazonaws.annotation.SdkInternalApi; import com.amazonaws.auth.*; import com.amazonaws.handlers.*; import com.amazonaws.http.*; import com.amazonaws.internal.*; import com.amazonaws.internal.auth.*; 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.client.AwsSyncClientParams; import com.amazonaws.client.builder.AdvancedConfig; import com.amazonaws.services.cloudcontrolapi.AWSCloudControlApiClientBuilder; import com.amazonaws.services.cloudcontrolapi.waiters.AWSCloudControlApiWaiters; import com.amazonaws.AmazonServiceException; import com.amazonaws.services.cloudcontrolapi.model.*; import com.amazonaws.services.cloudcontrolapi.model.transform.*; /** * Client for accessing CloudControlApi. All service calls made using this client are blocking, and will not return * until the service call completes. *
*
* For more information about Amazon Web Services Cloud Control API, see the Amazon Web Services * Cloud Control API User Guide. *
*/ @ThreadSafe @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AWSCloudControlApiClient extends AmazonWebServiceClient implements AWSCloudControlApi { /** Provider for AWS credentials. */ private final AWSCredentialsProvider awsCredentialsProvider; private static final Log log = LogFactory.getLog(AWSCloudControlApi.class); /** Default signing name for the service. */ private static final String DEFAULT_SIGNING_NAME = "cloudcontrolapi"; private volatile AWSCloudControlApiWaiters waiters; /** Client configuration factory providing ClientConfigurations tailored to this client */ protected static final ClientConfigurationFactory configFactory = new ClientConfigurationFactory(); private final AdvancedConfig advancedConfig; private static final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory = new com.amazonaws.protocol.json.SdkJsonProtocolFactory( new JsonClientMetadata() .withProtocolVersion("1.0") .withSupportsCbor(false) .withSupportsIon(false) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ConcurrentModificationException").withExceptionUnmarshaller( com.amazonaws.services.cloudcontrolapi.model.transform.ConcurrentModificationExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("HandlerFailureException").withExceptionUnmarshaller( com.amazonaws.services.cloudcontrolapi.model.transform.HandlerFailureExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("HandlerInternalFailureException").withExceptionUnmarshaller( com.amazonaws.services.cloudcontrolapi.model.transform.HandlerInternalFailureExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ServiceLimitExceededException").withExceptionUnmarshaller( com.amazonaws.services.cloudcontrolapi.model.transform.ServiceLimitExceededExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ServiceInternalErrorException").withExceptionUnmarshaller( com.amazonaws.services.cloudcontrolapi.model.transform.ServiceInternalErrorExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("PrivateTypeException").withExceptionUnmarshaller( com.amazonaws.services.cloudcontrolapi.model.transform.PrivateTypeExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("RequestTokenNotFoundException").withExceptionUnmarshaller( com.amazonaws.services.cloudcontrolapi.model.transform.RequestTokenNotFoundExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ClientTokenConflictException").withExceptionUnmarshaller( com.amazonaws.services.cloudcontrolapi.model.transform.ClientTokenConflictExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InvalidRequestException").withExceptionUnmarshaller( com.amazonaws.services.cloudcontrolapi.model.transform.InvalidRequestExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("NetworkFailureException").withExceptionUnmarshaller( com.amazonaws.services.cloudcontrolapi.model.transform.NetworkFailureExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ResourceNotFoundException").withExceptionUnmarshaller( com.amazonaws.services.cloudcontrolapi.model.transform.ResourceNotFoundExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("AlreadyExistsException").withExceptionUnmarshaller( com.amazonaws.services.cloudcontrolapi.model.transform.AlreadyExistsExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ConcurrentOperationException").withExceptionUnmarshaller( com.amazonaws.services.cloudcontrolapi.model.transform.ConcurrentOperationExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("UnsupportedActionException").withExceptionUnmarshaller( com.amazonaws.services.cloudcontrolapi.model.transform.UnsupportedActionExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("NotStabilizedException").withExceptionUnmarshaller( com.amazonaws.services.cloudcontrolapi.model.transform.NotStabilizedExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ResourceConflictException").withExceptionUnmarshaller( com.amazonaws.services.cloudcontrolapi.model.transform.ResourceConflictExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InvalidCredentialsException").withExceptionUnmarshaller( com.amazonaws.services.cloudcontrolapi.model.transform.InvalidCredentialsExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("GeneralServiceException").withExceptionUnmarshaller( com.amazonaws.services.cloudcontrolapi.model.transform.GeneralServiceExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("TypeNotFoundException").withExceptionUnmarshaller( com.amazonaws.services.cloudcontrolapi.model.transform.TypeNotFoundExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ThrottlingException").withExceptionUnmarshaller( com.amazonaws.services.cloudcontrolapi.model.transform.ThrottlingExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("NotUpdatableException").withExceptionUnmarshaller( com.amazonaws.services.cloudcontrolapi.model.transform.NotUpdatableExceptionUnmarshaller.getInstance())) .withBaseServiceExceptionClass(com.amazonaws.services.cloudcontrolapi.model.AWSCloudControlApiException.class)); public static AWSCloudControlApiClientBuilder builder() { return AWSCloudControlApiClientBuilder.standard(); } /** * Constructs a new client to invoke service methods on CloudControlApi using the specified parameters. * ** All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param clientParams * Object providing client parameters. */ AWSCloudControlApiClient(AwsSyncClientParams clientParams) { this(clientParams, false); } /** * Constructs a new client to invoke service methods on CloudControlApi using the specified parameters. * *
* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param clientParams * Object providing client parameters. */ AWSCloudControlApiClient(AwsSyncClientParams clientParams, boolean endpointDiscoveryEnabled) { super(clientParams); this.awsCredentialsProvider = clientParams.getCredentialsProvider(); this.advancedConfig = clientParams.getAdvancedConfig(); init(); } private void init() { setServiceNameIntern(DEFAULT_SIGNING_NAME); setEndpointPrefix(ENDPOINT_PREFIX); // calling this.setEndPoint(...) will also modify the signer accordingly setEndpoint("cloudcontrolapi.us-east-1.amazonaws.com"); HandlerChainFactory chainFactory = new HandlerChainFactory(); requestHandler2s.addAll(chainFactory.newRequestHandlerChain("/com/amazonaws/services/cloudcontrolapi/request.handlers")); requestHandler2s.addAll(chainFactory.newRequestHandler2Chain("/com/amazonaws/services/cloudcontrolapi/request.handler2s")); requestHandler2s.addAll(chainFactory.getGlobalHandlers()); } /** *
* Cancels the specified resource operation request. For more information, see Canceling resource operation requests in the Amazon Web Services Cloud Control API User Guide. *
*
* Only resource operations requests with a status of PENDING
or IN_PROGRESS
can be
* canceled.
*
* Creates the specified resource. For more information, see Creating a * resource in the Amazon Web Services Cloud Control API User Guide. *
*
* After you have initiated a resource creation request, you can monitor the progress of your request by calling
* GetResourceRequestStatus using the RequestToken
of the ProgressEvent
type returned
* by CreateResource
.
*
5XX HTTP
status code.
* @throws HandlerFailureException
* The resource handler has failed without a returning a more specific error code. This can include
* timeouts.
* @throws ServiceLimitExceededException
* The resource handler has returned that a non-transient resource limit was reached on the service side.
* @throws InvalidCredentialsException
* The resource handler has returned that the credentials provided by the user are invalid.
* @throws ResourceConflictException
* The resource is temporarily unavailable to be acted upon. For example, if the resource is currently
* undergoing an operation and can't be acted upon until that operation is finished.
* @throws ClientTokenConflictException
* The specified client token has already been used in another resource request.
*
* It's best practice for client tokens to be unique for each resource operation request. However, client
* token expire after 36 hours.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @sample AWSCloudControlApi.CreateResource
* @see AWS
* API Documentation
*/
@Override
public CreateResourceResult createResource(CreateResourceRequest request) {
request = beforeClientExecution(request);
return executeCreateResource(request);
}
@SdkInternalApi
final CreateResourceResult executeCreateResource(CreateResourceRequest createResourceRequest) {
ExecutionContext executionContext = createExecutionContext(createResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request
* Deletes the specified resource. For details, see Deleting a
* resource in the Amazon Web Services Cloud Control API User Guide.
*
* After you have initiated a resource deletion request, you can monitor the progress of your request by calling
* GetResourceRequestStatus using the RequestToken
of the ProgressEvent
returned by
* DeleteResource
.
* 5XX HTTP
status code.
* @throws HandlerFailureException
* The resource handler has failed without a returning a more specific error code. This can include
* timeouts.
* @throws ServiceLimitExceededException
* The resource handler has returned that a non-transient resource limit was reached on the service side.
* @throws InvalidCredentialsException
* The resource handler has returned that the credentials provided by the user are invalid.
* @throws ResourceConflictException
* The resource is temporarily unavailable to be acted upon. For example, if the resource is currently
* undergoing an operation and can't be acted upon until that operation is finished.
* @throws ClientTokenConflictException
* The specified client token has already been used in another resource request.
* It's best practice for client tokens to be unique for each resource operation request. However, client
* token expire after 36 hours.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @sample AWSCloudControlApi.DeleteResource
* @see AWS
* API Documentation
*/
@Override
public DeleteResourceResult deleteResource(DeleteResourceRequest request) {
request = beforeClientExecution(request);
return executeDeleteResource(request);
}
@SdkInternalApi
final DeleteResourceResult executeDeleteResource(DeleteResourceRequest deleteResourceRequest) {
ExecutionContext executionContext = createExecutionContext(deleteResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request
* Returns information about the current state of the specified resource. For details, see Reading a
* resource's current state.
*
* You can use this action to return information about an existing resource in your account and Amazon Web Services
* Region, whether those resources were provisioned using Cloud Control API.
*
* Returns the current status of a resource operation request. For more information, see Tracking the progress of resource operation requests in the Amazon Web Services Cloud Control API User
* Guide.
*
* Returns existing resource operation requests. This includes requests of all status types. For more information,
* see Listing active resource operation requests in the Amazon Web Services Cloud Control API User Guide.
*
* Resource operation requests expire after 7 days.
*
* Returns information about the specified resources. For more information, see Discovering
* resources in the Amazon Web Services Cloud Control API User Guide.
*
* You can use this action to return information about existing resources in your account and Amazon Web Services
* Region, whether those resources were provisioned using Cloud Control API.
*
* Updates the specified property values in the resource.
*
* You specify your resource property updates as a list of patch operations contained in a JSON patch document that
* adheres to the RFC 6902 - JavaScript Object Notation
* (JSON) Patch standard.
*
* For details on how Cloud Control API performs resource update operations, see Updating a
* resource in the Amazon Web Services Cloud Control API User Guide.
*
* After you have initiated a resource update request, you can monitor the progress of your request by calling
* GetResourceRequestStatus using the
* For more information about the properties of a specific resource, refer to the related topic for the resource in
* the
* Resource and property types reference in the CloudFormation Users Guide.
* 5XX HTTP
status code.
* @throws HandlerFailureException
* The resource handler has failed without a returning a more specific error code. This can include
* timeouts.
* @throws ServiceLimitExceededException
* The resource handler has returned that a non-transient resource limit was reached on the service side.
* @throws InvalidCredentialsException
* The resource handler has returned that the credentials provided by the user are invalid.
* @throws ResourceConflictException
* The resource is temporarily unavailable to be acted upon. For example, if the resource is currently
* undergoing an operation and can't be acted upon until that operation is finished.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @sample AWSCloudControlApi.GetResource
* @see AWS API
* Documentation
*/
@Override
public GetResourceResult getResource(GetResourceRequest request) {
request = beforeClientExecution(request);
return executeGetResource(request);
}
@SdkInternalApi
final GetResourceResult executeGetResource(GetResourceRequest getResourceRequest) {
ExecutionContext executionContext = createExecutionContext(getResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request5XX HTTP
status code.
* @throws HandlerFailureException
* The resource handler has failed without a returning a more specific error code. This can include
* timeouts.
* @throws ServiceLimitExceededException
* The resource handler has returned that a non-transient resource limit was reached on the service side.
* @throws InvalidCredentialsException
* The resource handler has returned that the credentials provided by the user are invalid.
* @throws ResourceConflictException
* The resource is temporarily unavailable to be acted upon. For example, if the resource is currently
* undergoing an operation and can't be acted upon until that operation is finished.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @sample AWSCloudControlApi.ListResources
* @see AWS API
* Documentation
*/
@Override
public ListResourcesResult listResources(ListResourcesRequest request) {
request = beforeClientExecution(request);
return executeListResources(request);
}
@SdkInternalApi
final ListResourcesResult executeListResources(ListResourcesRequest listResourcesRequest) {
ExecutionContext executionContext = createExecutionContext(listResourcesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
RequestRequestToken
of the ProgressEvent
returned by
* UpdateResource
.
* 5XX HTTP
status code.
* @throws HandlerFailureException
* The resource handler has failed without a returning a more specific error code. This can include
* timeouts.
* @throws ServiceLimitExceededException
* The resource handler has returned that a non-transient resource limit was reached on the service side.
* @throws InvalidCredentialsException
* The resource handler has returned that the credentials provided by the user are invalid.
* @throws ResourceConflictException
* The resource is temporarily unavailable to be acted upon. For example, if the resource is currently
* undergoing an operation and can't be acted upon until that operation is finished.
* @throws ClientTokenConflictException
* The specified client token has already been used in another resource request.
* It's best practice for client tokens to be unique for each resource operation request. However, client
* token expire after 36 hours.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @sample AWSCloudControlApi.UpdateResource
* @see AWS
* API Documentation
*/
@Override
public UpdateResourceResult updateResource(UpdateResourceRequest request) {
request = beforeClientExecution(request);
return executeUpdateResource(request);
}
@SdkInternalApi
final UpdateResourceResult executeUpdateResource(UpdateResourceRequest updateResourceRequest) {
ExecutionContext executionContext = createExecutionContext(updateResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request
* 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