software.amazon.awssdk.services.codestarconnections.DefaultCodeStarConnectionsClient Maven / Gradle / Ivy
Show all versions of codestarconnections Show documentation
/*
* Copyright 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 software.amazon.awssdk.services.codestarconnections;
import java.util.Collections;
import java.util.List;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.awscore.internal.AwsProtocolMetadata;
import software.amazon.awssdk.awscore.internal.AwsServiceProtocol;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkPlugin;
import software.amazon.awssdk.core.SdkRequest;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientOption;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
import software.amazon.awssdk.core.client.handler.SyncClientHandler;
import software.amazon.awssdk.core.exception.SdkClientException;
import software.amazon.awssdk.core.http.HttpResponseHandler;
import software.amazon.awssdk.core.metrics.CoreMetric;
import software.amazon.awssdk.metrics.MetricCollector;
import software.amazon.awssdk.metrics.MetricPublisher;
import software.amazon.awssdk.metrics.NoOpMetricCollector;
import software.amazon.awssdk.protocols.core.ExceptionMetadata;
import software.amazon.awssdk.protocols.json.AwsJsonProtocol;
import software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.services.codestarconnections.internal.CodeStarConnectionsServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.codestarconnections.model.AccessDeniedException;
import software.amazon.awssdk.services.codestarconnections.model.CodeStarConnectionsException;
import software.amazon.awssdk.services.codestarconnections.model.ConcurrentModificationException;
import software.amazon.awssdk.services.codestarconnections.model.ConditionalCheckFailedException;
import software.amazon.awssdk.services.codestarconnections.model.ConflictException;
import software.amazon.awssdk.services.codestarconnections.model.CreateConnectionRequest;
import software.amazon.awssdk.services.codestarconnections.model.CreateConnectionResponse;
import software.amazon.awssdk.services.codestarconnections.model.CreateHostRequest;
import software.amazon.awssdk.services.codestarconnections.model.CreateHostResponse;
import software.amazon.awssdk.services.codestarconnections.model.CreateRepositoryLinkRequest;
import software.amazon.awssdk.services.codestarconnections.model.CreateRepositoryLinkResponse;
import software.amazon.awssdk.services.codestarconnections.model.CreateSyncConfigurationRequest;
import software.amazon.awssdk.services.codestarconnections.model.CreateSyncConfigurationResponse;
import software.amazon.awssdk.services.codestarconnections.model.DeleteConnectionRequest;
import software.amazon.awssdk.services.codestarconnections.model.DeleteConnectionResponse;
import software.amazon.awssdk.services.codestarconnections.model.DeleteHostRequest;
import software.amazon.awssdk.services.codestarconnections.model.DeleteHostResponse;
import software.amazon.awssdk.services.codestarconnections.model.DeleteRepositoryLinkRequest;
import software.amazon.awssdk.services.codestarconnections.model.DeleteRepositoryLinkResponse;
import software.amazon.awssdk.services.codestarconnections.model.DeleteSyncConfigurationRequest;
import software.amazon.awssdk.services.codestarconnections.model.DeleteSyncConfigurationResponse;
import software.amazon.awssdk.services.codestarconnections.model.GetConnectionRequest;
import software.amazon.awssdk.services.codestarconnections.model.GetConnectionResponse;
import software.amazon.awssdk.services.codestarconnections.model.GetHostRequest;
import software.amazon.awssdk.services.codestarconnections.model.GetHostResponse;
import software.amazon.awssdk.services.codestarconnections.model.GetRepositoryLinkRequest;
import software.amazon.awssdk.services.codestarconnections.model.GetRepositoryLinkResponse;
import software.amazon.awssdk.services.codestarconnections.model.GetRepositorySyncStatusRequest;
import software.amazon.awssdk.services.codestarconnections.model.GetRepositorySyncStatusResponse;
import software.amazon.awssdk.services.codestarconnections.model.GetResourceSyncStatusRequest;
import software.amazon.awssdk.services.codestarconnections.model.GetResourceSyncStatusResponse;
import software.amazon.awssdk.services.codestarconnections.model.GetSyncBlockerSummaryRequest;
import software.amazon.awssdk.services.codestarconnections.model.GetSyncBlockerSummaryResponse;
import software.amazon.awssdk.services.codestarconnections.model.GetSyncConfigurationRequest;
import software.amazon.awssdk.services.codestarconnections.model.GetSyncConfigurationResponse;
import software.amazon.awssdk.services.codestarconnections.model.InternalServerException;
import software.amazon.awssdk.services.codestarconnections.model.InvalidInputException;
import software.amazon.awssdk.services.codestarconnections.model.LimitExceededException;
import software.amazon.awssdk.services.codestarconnections.model.ListConnectionsRequest;
import software.amazon.awssdk.services.codestarconnections.model.ListConnectionsResponse;
import software.amazon.awssdk.services.codestarconnections.model.ListHostsRequest;
import software.amazon.awssdk.services.codestarconnections.model.ListHostsResponse;
import software.amazon.awssdk.services.codestarconnections.model.ListRepositoryLinksRequest;
import software.amazon.awssdk.services.codestarconnections.model.ListRepositoryLinksResponse;
import software.amazon.awssdk.services.codestarconnections.model.ListRepositorySyncDefinitionsRequest;
import software.amazon.awssdk.services.codestarconnections.model.ListRepositorySyncDefinitionsResponse;
import software.amazon.awssdk.services.codestarconnections.model.ListSyncConfigurationsRequest;
import software.amazon.awssdk.services.codestarconnections.model.ListSyncConfigurationsResponse;
import software.amazon.awssdk.services.codestarconnections.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.codestarconnections.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.codestarconnections.model.ResourceAlreadyExistsException;
import software.amazon.awssdk.services.codestarconnections.model.ResourceNotFoundException;
import software.amazon.awssdk.services.codestarconnections.model.ResourceUnavailableException;
import software.amazon.awssdk.services.codestarconnections.model.RetryLatestCommitFailedException;
import software.amazon.awssdk.services.codestarconnections.model.SyncBlockerDoesNotExistException;
import software.amazon.awssdk.services.codestarconnections.model.SyncConfigurationStillExistsException;
import software.amazon.awssdk.services.codestarconnections.model.TagResourceRequest;
import software.amazon.awssdk.services.codestarconnections.model.TagResourceResponse;
import software.amazon.awssdk.services.codestarconnections.model.ThrottlingException;
import software.amazon.awssdk.services.codestarconnections.model.UnsupportedOperationException;
import software.amazon.awssdk.services.codestarconnections.model.UnsupportedProviderTypeException;
import software.amazon.awssdk.services.codestarconnections.model.UntagResourceRequest;
import software.amazon.awssdk.services.codestarconnections.model.UntagResourceResponse;
import software.amazon.awssdk.services.codestarconnections.model.UpdateHostRequest;
import software.amazon.awssdk.services.codestarconnections.model.UpdateHostResponse;
import software.amazon.awssdk.services.codestarconnections.model.UpdateOutOfSyncException;
import software.amazon.awssdk.services.codestarconnections.model.UpdateRepositoryLinkRequest;
import software.amazon.awssdk.services.codestarconnections.model.UpdateRepositoryLinkResponse;
import software.amazon.awssdk.services.codestarconnections.model.UpdateSyncBlockerRequest;
import software.amazon.awssdk.services.codestarconnections.model.UpdateSyncBlockerResponse;
import software.amazon.awssdk.services.codestarconnections.model.UpdateSyncConfigurationRequest;
import software.amazon.awssdk.services.codestarconnections.model.UpdateSyncConfigurationResponse;
import software.amazon.awssdk.services.codestarconnections.transform.CreateConnectionRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.CreateHostRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.CreateRepositoryLinkRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.CreateSyncConfigurationRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.DeleteConnectionRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.DeleteHostRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.DeleteRepositoryLinkRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.DeleteSyncConfigurationRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.GetConnectionRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.GetHostRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.GetRepositoryLinkRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.GetRepositorySyncStatusRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.GetResourceSyncStatusRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.GetSyncBlockerSummaryRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.GetSyncConfigurationRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.ListConnectionsRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.ListHostsRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.ListRepositoryLinksRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.ListRepositorySyncDefinitionsRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.ListSyncConfigurationsRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.UpdateHostRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.UpdateRepositoryLinkRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.UpdateSyncBlockerRequestMarshaller;
import software.amazon.awssdk.services.codestarconnections.transform.UpdateSyncConfigurationRequestMarshaller;
import software.amazon.awssdk.utils.Logger;
/**
* Internal implementation of {@link CodeStarConnectionsClient}.
*
* @see CodeStarConnectionsClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultCodeStarConnectionsClient implements CodeStarConnectionsClient {
private static final Logger log = Logger.loggerFor(DefaultCodeStarConnectionsClient.class);
private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
.serviceProtocol(AwsServiceProtocol.AWS_JSON).build();
private final SyncClientHandler clientHandler;
private final AwsJsonProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
protected DefaultCodeStarConnectionsClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
/**
*
* Creates a connection that can then be given to other Amazon Web Services services like CodePipeline so that it
* can access third-party code repositories. The connection is in pending status until the third-party connection
* handshake is completed from the console.
*
*
* @param createConnectionRequest
* @return Result of the CreateConnection operation returned by the service.
* @throws LimitExceededException
* Exceeded the maximum limit for connections.
* @throws ResourceNotFoundException
* Resource not found. Verify the connection resource ARN and try again.
* @throws ResourceUnavailableException
* Resource not found. Verify the ARN for the host resource and try again.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.CreateConnection
* @see AWS API Documentation
*/
@Override
public CreateConnectionResponse createConnection(CreateConnectionRequest createConnectionRequest)
throws LimitExceededException, ResourceNotFoundException, ResourceUnavailableException, AwsServiceException,
SdkClientException, CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateConnectionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createConnectionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createConnectionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateConnection");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateConnection").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(createConnectionRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateConnectionRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a resource that represents the infrastructure where a third-party provider is installed. The host is used
* when you create connections to an installed third-party provider type, such as GitHub Enterprise Server. You
* create one host for all connections to that provider.
*
*
*
* A host created through the CLI or the SDK is in `PENDING` status by default. You can make its status `AVAILABLE`
* by setting up the host in the console.
*
*
*
* @param createHostRequest
* @return Result of the CreateHost operation returned by the service.
* @throws LimitExceededException
* Exceeded the maximum limit for connections.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.CreateHost
* @see AWS API Documentation
*/
@Override
public CreateHostResponse createHost(CreateHostRequest createHostRequest) throws LimitExceededException, AwsServiceException,
SdkClientException, CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateHostResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createHostRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createHostRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateHost");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateHost").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(createHostRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateHostRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a link to a specified external Git repository. A repository link allows Git sync to monitor and sync
* changes to files in a specified Git repository.
*
*
* @param createRepositoryLinkRequest
* @return Result of the CreateRepositoryLink operation returned by the service.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws ConcurrentModificationException
* Exception thrown as a result of concurrent modification to an application. For example, two individuals
* attempting to edit the same application at the same time.
* @throws InternalServerException
* Received an internal server exception. Try again later.
* @throws InvalidInputException
* The input is not valid. Verify that the action is typed correctly.
* @throws LimitExceededException
* Exceeded the maximum limit for connections.
* @throws ResourceAlreadyExistsException
* Unable to create resource. Resource already exists.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.CreateRepositoryLink
* @see AWS API Documentation
*/
@Override
public CreateRepositoryLinkResponse createRepositoryLink(CreateRepositoryLinkRequest createRepositoryLinkRequest)
throws AccessDeniedException, ConcurrentModificationException, InternalServerException, InvalidInputException,
LimitExceededException, ResourceAlreadyExistsException, ThrottlingException, AwsServiceException, SdkClientException,
CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateRepositoryLinkResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createRepositoryLinkRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createRepositoryLinkRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateRepositoryLink");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateRepositoryLink").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(createRepositoryLinkRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateRepositoryLinkRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a sync configuration which allows Amazon Web Services to sync content from a Git repository to update a
* specified Amazon Web Services resource. Parameters for the sync configuration are determined by the sync type.
*
*
* @param createSyncConfigurationRequest
* @return Result of the CreateSyncConfiguration operation returned by the service.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws ConcurrentModificationException
* Exception thrown as a result of concurrent modification to an application. For example, two individuals
* attempting to edit the same application at the same time.
* @throws InternalServerException
* Received an internal server exception. Try again later.
* @throws InvalidInputException
* The input is not valid. Verify that the action is typed correctly.
* @throws LimitExceededException
* Exceeded the maximum limit for connections.
* @throws ResourceAlreadyExistsException
* Unable to create resource. Resource already exists.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.CreateSyncConfiguration
* @see AWS API Documentation
*/
@Override
public CreateSyncConfigurationResponse createSyncConfiguration(CreateSyncConfigurationRequest createSyncConfigurationRequest)
throws AccessDeniedException, ConcurrentModificationException, InternalServerException, InvalidInputException,
LimitExceededException, ResourceAlreadyExistsException, ThrottlingException, AwsServiceException, SdkClientException,
CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateSyncConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createSyncConfigurationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createSyncConfigurationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateSyncConfiguration");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateSyncConfiguration").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(createSyncConfigurationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateSyncConfigurationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* The connection to be deleted.
*
*
* @param deleteConnectionRequest
* @return Result of the DeleteConnection operation returned by the service.
* @throws ResourceNotFoundException
* Resource not found. Verify the connection resource ARN and try again.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.DeleteConnection
* @see AWS API Documentation
*/
@Override
public DeleteConnectionResponse deleteConnection(DeleteConnectionRequest deleteConnectionRequest)
throws ResourceNotFoundException, AwsServiceException, SdkClientException, CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteConnectionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteConnectionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteConnectionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteConnection");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteConnection").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(deleteConnectionRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteConnectionRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* The host to be deleted. Before you delete a host, all connections associated to the host must be deleted.
*
*
*
* A host cannot be deleted if it is in the VPC_CONFIG_INITIALIZING or VPC_CONFIG_DELETING state.
*
*
*
* @param deleteHostRequest
* @return Result of the DeleteHost operation returned by the service.
* @throws ResourceNotFoundException
* Resource not found. Verify the connection resource ARN and try again.
* @throws ResourceUnavailableException
* Resource not found. Verify the ARN for the host resource and try again.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.DeleteHost
* @see AWS API Documentation
*/
@Override
public DeleteHostResponse deleteHost(DeleteHostRequest deleteHostRequest) throws ResourceNotFoundException,
ResourceUnavailableException, AwsServiceException, SdkClientException, CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteHostResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteHostRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteHostRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteHost");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteHost").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(deleteHostRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteHostRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes the association between your connection and a specified external Git repository.
*
*
* @param deleteRepositoryLinkRequest
* @return Result of the DeleteRepositoryLink operation returned by the service.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws ConcurrentModificationException
* Exception thrown as a result of concurrent modification to an application. For example, two individuals
* attempting to edit the same application at the same time.
* @throws InternalServerException
* Received an internal server exception. Try again later.
* @throws InvalidInputException
* The input is not valid. Verify that the action is typed correctly.
* @throws SyncConfigurationStillExistsException
* Unable to continue. The sync blocker still exists.
* @throws ResourceNotFoundException
* Resource not found. Verify the connection resource ARN and try again.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws UnsupportedProviderTypeException
* The specified provider type is not supported for connections.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.DeleteRepositoryLink
* @see AWS API Documentation
*/
@Override
public DeleteRepositoryLinkResponse deleteRepositoryLink(DeleteRepositoryLinkRequest deleteRepositoryLinkRequest)
throws AccessDeniedException, ConcurrentModificationException, InternalServerException, InvalidInputException,
SyncConfigurationStillExistsException, ResourceNotFoundException, ThrottlingException,
UnsupportedProviderTypeException, AwsServiceException, SdkClientException, CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteRepositoryLinkResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteRepositoryLinkRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteRepositoryLinkRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteRepositoryLink");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteRepositoryLink").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(deleteRepositoryLinkRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteRepositoryLinkRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes the sync configuration for a specified repository and connection.
*
*
* @param deleteSyncConfigurationRequest
* @return Result of the DeleteSyncConfiguration operation returned by the service.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws ConcurrentModificationException
* Exception thrown as a result of concurrent modification to an application. For example, two individuals
* attempting to edit the same application at the same time.
* @throws InternalServerException
* Received an internal server exception. Try again later.
* @throws InvalidInputException
* The input is not valid. Verify that the action is typed correctly.
* @throws LimitExceededException
* Exceeded the maximum limit for connections.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.DeleteSyncConfiguration
* @see AWS API Documentation
*/
@Override
public DeleteSyncConfigurationResponse deleteSyncConfiguration(DeleteSyncConfigurationRequest deleteSyncConfigurationRequest)
throws AccessDeniedException, ConcurrentModificationException, InternalServerException, InvalidInputException,
LimitExceededException, ThrottlingException, AwsServiceException, SdkClientException, CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteSyncConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteSyncConfigurationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteSyncConfigurationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteSyncConfiguration");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteSyncConfiguration").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(deleteSyncConfigurationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteSyncConfigurationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns the connection ARN and details such as status, owner, and provider type.
*
*
* @param getConnectionRequest
* @return Result of the GetConnection operation returned by the service.
* @throws ResourceNotFoundException
* Resource not found. Verify the connection resource ARN and try again.
* @throws ResourceUnavailableException
* Resource not found. Verify the ARN for the host resource and try again.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.GetConnection
* @see AWS API Documentation
*/
@Override
public GetConnectionResponse getConnection(GetConnectionRequest getConnectionRequest) throws ResourceNotFoundException,
ResourceUnavailableException, AwsServiceException, SdkClientException, CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetConnectionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getConnectionRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getConnectionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetConnection");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetConnection").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(getConnectionRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetConnectionRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns the host ARN and details such as status, provider type, endpoint, and, if applicable, the VPC
* configuration.
*
*
* @param getHostRequest
* @return Result of the GetHost operation returned by the service.
* @throws ResourceNotFoundException
* Resource not found. Verify the connection resource ARN and try again.
* @throws ResourceUnavailableException
* Resource not found. Verify the ARN for the host resource and try again.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.GetHost
* @see AWS
* API Documentation
*/
@Override
public GetHostResponse getHost(GetHostRequest getHostRequest) throws ResourceNotFoundException, ResourceUnavailableException,
AwsServiceException, SdkClientException, CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetHostResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getHostRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getHostRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetHost");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetHost").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(getHostRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetHostRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns details about a repository link. A repository link allows Git sync to monitor and sync changes from files
* in a specified Git repository.
*
*
* @param getRepositoryLinkRequest
* @return Result of the GetRepositoryLink operation returned by the service.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws ConcurrentModificationException
* Exception thrown as a result of concurrent modification to an application. For example, two individuals
* attempting to edit the same application at the same time.
* @throws InternalServerException
* Received an internal server exception. Try again later.
* @throws InvalidInputException
* The input is not valid. Verify that the action is typed correctly.
* @throws ResourceNotFoundException
* Resource not found. Verify the connection resource ARN and try again.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.GetRepositoryLink
* @see AWS API Documentation
*/
@Override
public GetRepositoryLinkResponse getRepositoryLink(GetRepositoryLinkRequest getRepositoryLinkRequest)
throws AccessDeniedException, ConcurrentModificationException, InternalServerException, InvalidInputException,
ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetRepositoryLinkResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getRepositoryLinkRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getRepositoryLinkRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetRepositoryLink");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetRepositoryLink").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(getRepositoryLinkRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetRepositoryLinkRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns details about the sync status for a repository. A repository sync uses Git sync to push and pull changes
* from your remote repository.
*
*
* @param getRepositorySyncStatusRequest
* @return Result of the GetRepositorySyncStatus operation returned by the service.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* Received an internal server exception. Try again later.
* @throws InvalidInputException
* The input is not valid. Verify that the action is typed correctly.
* @throws ResourceNotFoundException
* Resource not found. Verify the connection resource ARN and try again.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.GetRepositorySyncStatus
* @see AWS API Documentation
*/
@Override
public GetRepositorySyncStatusResponse getRepositorySyncStatus(GetRepositorySyncStatusRequest getRepositorySyncStatusRequest)
throws AccessDeniedException, InternalServerException, InvalidInputException, ResourceNotFoundException,
ThrottlingException, AwsServiceException, SdkClientException, CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetRepositorySyncStatusResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getRepositorySyncStatusRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getRepositorySyncStatusRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetRepositorySyncStatus");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetRepositorySyncStatus").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(getRepositorySyncStatusRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetRepositorySyncStatusRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns the status of the sync with the Git repository for a specific Amazon Web Services resource.
*
*
* @param getResourceSyncStatusRequest
* @return Result of the GetResourceSyncStatus operation returned by the service.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* Received an internal server exception. Try again later.
* @throws InvalidInputException
* The input is not valid. Verify that the action is typed correctly.
* @throws ResourceNotFoundException
* Resource not found. Verify the connection resource ARN and try again.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.GetResourceSyncStatus
* @see AWS API Documentation
*/
@Override
public GetResourceSyncStatusResponse getResourceSyncStatus(GetResourceSyncStatusRequest getResourceSyncStatusRequest)
throws AccessDeniedException, InternalServerException, InvalidInputException, ResourceNotFoundException,
ThrottlingException, AwsServiceException, SdkClientException, CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetResourceSyncStatusResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getResourceSyncStatusRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getResourceSyncStatusRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetResourceSyncStatus");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetResourceSyncStatus").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(getResourceSyncStatusRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetResourceSyncStatusRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns a list of the most recent sync blockers.
*
*
* @param getSyncBlockerSummaryRequest
* @return Result of the GetSyncBlockerSummary operation returned by the service.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* Received an internal server exception. Try again later.
* @throws InvalidInputException
* The input is not valid. Verify that the action is typed correctly.
* @throws ResourceNotFoundException
* Resource not found. Verify the connection resource ARN and try again.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.GetSyncBlockerSummary
* @see AWS API Documentation
*/
@Override
public GetSyncBlockerSummaryResponse getSyncBlockerSummary(GetSyncBlockerSummaryRequest getSyncBlockerSummaryRequest)
throws AccessDeniedException, InternalServerException, InvalidInputException, ResourceNotFoundException,
ThrottlingException, AwsServiceException, SdkClientException, CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetSyncBlockerSummaryResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getSyncBlockerSummaryRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getSyncBlockerSummaryRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetSyncBlockerSummary");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetSyncBlockerSummary").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(getSyncBlockerSummaryRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetSyncBlockerSummaryRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns details about a sync configuration, including the sync type and resource name. A sync configuration
* allows the configuration to sync (push and pull) changes from the remote repository for a specified branch in a
* Git repository.
*
*
* @param getSyncConfigurationRequest
* @return Result of the GetSyncConfiguration operation returned by the service.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* Received an internal server exception. Try again later.
* @throws InvalidInputException
* The input is not valid. Verify that the action is typed correctly.
* @throws ResourceNotFoundException
* Resource not found. Verify the connection resource ARN and try again.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.GetSyncConfiguration
* @see AWS API Documentation
*/
@Override
public GetSyncConfigurationResponse getSyncConfiguration(GetSyncConfigurationRequest getSyncConfigurationRequest)
throws AccessDeniedException, InternalServerException, InvalidInputException, ResourceNotFoundException,
ThrottlingException, AwsServiceException, SdkClientException, CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetSyncConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getSyncConfigurationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getSyncConfigurationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetSyncConfiguration");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetSyncConfiguration").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(getSyncConfigurationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetSyncConfigurationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists the connections associated with your account.
*
*
* @param listConnectionsRequest
* @return Result of the ListConnections operation returned by the service.
* @throws ResourceNotFoundException
* Resource not found. Verify the connection resource ARN and try again.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.ListConnections
* @see AWS API Documentation
*/
@Override
public ListConnectionsResponse listConnections(ListConnectionsRequest listConnectionsRequest)
throws ResourceNotFoundException, AwsServiceException, SdkClientException, CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListConnectionsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listConnectionsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listConnectionsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListConnections");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListConnections").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listConnectionsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListConnectionsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists the hosts associated with your account.
*
*
* @param listHostsRequest
* @return Result of the ListHosts operation returned by the service.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.ListHosts
* @see AWS API Documentation
*/
@Override
public ListHostsResponse listHosts(ListHostsRequest listHostsRequest) throws AwsServiceException, SdkClientException,
CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListHostsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listHostsRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listHostsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListHosts");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListHosts").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(listHostsRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListHostsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists the repository links created for connections in your account.
*
*
* @param listRepositoryLinksRequest
* @return Result of the ListRepositoryLinks operation returned by the service.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws ConcurrentModificationException
* Exception thrown as a result of concurrent modification to an application. For example, two individuals
* attempting to edit the same application at the same time.
* @throws InternalServerException
* Received an internal server exception. Try again later.
* @throws InvalidInputException
* The input is not valid. Verify that the action is typed correctly.
* @throws ResourceNotFoundException
* Resource not found. Verify the connection resource ARN and try again.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.ListRepositoryLinks
* @see AWS API Documentation
*/
@Override
public ListRepositoryLinksResponse listRepositoryLinks(ListRepositoryLinksRequest listRepositoryLinksRequest)
throws AccessDeniedException, ConcurrentModificationException, InternalServerException, InvalidInputException,
ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListRepositoryLinksResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listRepositoryLinksRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listRepositoryLinksRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListRepositoryLinks");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListRepositoryLinks").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listRepositoryLinksRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListRepositoryLinksRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists the repository sync definitions for repository links in your account.
*
*
* @param listRepositorySyncDefinitionsRequest
* @return Result of the ListRepositorySyncDefinitions operation returned by the service.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* Received an internal server exception. Try again later.
* @throws InvalidInputException
* The input is not valid. Verify that the action is typed correctly.
* @throws ResourceNotFoundException
* Resource not found. Verify the connection resource ARN and try again.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.ListRepositorySyncDefinitions
* @see AWS API Documentation
*/
@Override
public ListRepositorySyncDefinitionsResponse listRepositorySyncDefinitions(
ListRepositorySyncDefinitionsRequest listRepositorySyncDefinitionsRequest) throws AccessDeniedException,
InternalServerException, InvalidInputException, ResourceNotFoundException, ThrottlingException, AwsServiceException,
SdkClientException, CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListRepositorySyncDefinitionsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listRepositorySyncDefinitionsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
listRepositorySyncDefinitionsRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListRepositorySyncDefinitions");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListRepositorySyncDefinitions").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listRepositorySyncDefinitionsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListRepositorySyncDefinitionsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns a list of sync configurations for a specified repository.
*
*
* @param listSyncConfigurationsRequest
* @return Result of the ListSyncConfigurations operation returned by the service.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* Received an internal server exception. Try again later.
* @throws InvalidInputException
* The input is not valid. Verify that the action is typed correctly.
* @throws ResourceNotFoundException
* Resource not found. Verify the connection resource ARN and try again.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.ListSyncConfigurations
* @see AWS API Documentation
*/
@Override
public ListSyncConfigurationsResponse listSyncConfigurations(ListSyncConfigurationsRequest listSyncConfigurationsRequest)
throws AccessDeniedException, InternalServerException, InvalidInputException, ResourceNotFoundException,
ThrottlingException, AwsServiceException, SdkClientException, CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListSyncConfigurationsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listSyncConfigurationsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listSyncConfigurationsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListSyncConfigurations");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListSyncConfigurations").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listSyncConfigurationsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListSyncConfigurationsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Gets the set of key-value pairs (metadata) that are used to manage the resource.
*
*
* @param listTagsForResourceRequest
* @return Result of the ListTagsForResource operation returned by the service.
* @throws ResourceNotFoundException
* Resource not found. Verify the connection resource ARN and try again.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.ListTagsForResource
* @see AWS API Documentation
*/
@Override
public ListTagsForResourceResponse listTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest)
throws ResourceNotFoundException, AwsServiceException, SdkClientException, CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListTagsForResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listTagsForResourceRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListTagsForResource").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listTagsForResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Adds to or modifies the tags of the given resource. Tags are metadata that can be used to manage a resource.
*
*
* @param tagResourceRequest
* @return Result of the TagResource operation returned by the service.
* @throws ResourceNotFoundException
* Resource not found. Verify the connection resource ARN and try again.
* @throws LimitExceededException
* Exceeded the maximum limit for connections.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.TagResource
* @see AWS API Documentation
*/
@Override
public TagResourceResponse tagResource(TagResourceRequest tagResourceRequest) throws ResourceNotFoundException,
LimitExceededException, AwsServiceException, SdkClientException, CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
TagResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(tagResourceRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, tagResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("TagResource").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(tagResourceRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new TagResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Removes tags from an Amazon Web Services resource.
*
*
* @param untagResourceRequest
* @return Result of the UntagResource operation returned by the service.
* @throws ResourceNotFoundException
* Resource not found. Verify the connection resource ARN and try again.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.UntagResource
* @see AWS API Documentation
*/
@Override
public UntagResourceResponse untagResource(UntagResourceRequest untagResourceRequest) throws ResourceNotFoundException,
AwsServiceException, SdkClientException, CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UntagResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(untagResourceRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, untagResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UntagResource").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(untagResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UntagResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates a specified host with the provided configurations.
*
*
* @param updateHostRequest
* @return Result of the UpdateHost operation returned by the service.
* @throws ConflictException
* Two conflicting operations have been made on the same resource.
* @throws ResourceNotFoundException
* Resource not found. Verify the connection resource ARN and try again.
* @throws ResourceUnavailableException
* Resource not found. Verify the ARN for the host resource and try again.
* @throws UnsupportedOperationException
* The operation is not supported. Check the connection status and try again.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.UpdateHost
* @see AWS API Documentation
*/
@Override
public UpdateHostResponse updateHost(UpdateHostRequest updateHostRequest) throws ConflictException,
ResourceNotFoundException, ResourceUnavailableException, UnsupportedOperationException, AwsServiceException,
SdkClientException, CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateHostResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateHostRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateHostRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateHost");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateHost").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(updateHostRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateHostRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates the association between your connection and a specified external Git repository. A repository link allows
* Git sync to monitor and sync changes to files in a specified Git repository.
*
*
* @param updateRepositoryLinkRequest
* @return Result of the UpdateRepositoryLink operation returned by the service.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws ConditionalCheckFailedException
* The conditional check failed. Try again later.
* @throws InternalServerException
* Received an internal server exception. Try again later.
* @throws InvalidInputException
* The input is not valid. Verify that the action is typed correctly.
* @throws ResourceNotFoundException
* Resource not found. Verify the connection resource ARN and try again.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws UpdateOutOfSyncException
* The update is out of sync. Try syncing again.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.UpdateRepositoryLink
* @see AWS API Documentation
*/
@Override
public UpdateRepositoryLinkResponse updateRepositoryLink(UpdateRepositoryLinkRequest updateRepositoryLinkRequest)
throws AccessDeniedException, ConditionalCheckFailedException, InternalServerException, InvalidInputException,
ResourceNotFoundException, ThrottlingException, UpdateOutOfSyncException, AwsServiceException, SdkClientException,
CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateRepositoryLinkResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateRepositoryLinkRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateRepositoryLinkRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateRepositoryLink");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateRepositoryLink").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(updateRepositoryLinkRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateRepositoryLinkRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Allows you to update the status of a sync blocker, resolving the blocker and allowing syncing to continue.
*
*
* @param updateSyncBlockerRequest
* @return Result of the UpdateSyncBlocker operation returned by the service.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* Received an internal server exception. Try again later.
* @throws InvalidInputException
* The input is not valid. Verify that the action is typed correctly.
* @throws ResourceNotFoundException
* Resource not found. Verify the connection resource ARN and try again.
* @throws RetryLatestCommitFailedException
* Retrying the latest commit failed. Try again later.
* @throws SyncBlockerDoesNotExistException
* Unable to continue. The sync blocker does not exist.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.UpdateSyncBlocker
* @see AWS API Documentation
*/
@Override
public UpdateSyncBlockerResponse updateSyncBlocker(UpdateSyncBlockerRequest updateSyncBlockerRequest)
throws AccessDeniedException, InternalServerException, InvalidInputException, ResourceNotFoundException,
RetryLatestCommitFailedException, SyncBlockerDoesNotExistException, ThrottlingException, AwsServiceException,
SdkClientException, CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateSyncBlockerResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateSyncBlockerRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateSyncBlockerRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateSyncBlocker");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateSyncBlocker").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(updateSyncBlockerRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateSyncBlockerRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates the sync configuration for your connection and a specified external Git repository.
*
*
* @param updateSyncConfigurationRequest
* @return Result of the UpdateSyncConfiguration operation returned by the service.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws ConcurrentModificationException
* Exception thrown as a result of concurrent modification to an application. For example, two individuals
* attempting to edit the same application at the same time.
* @throws InternalServerException
* Received an internal server exception. Try again later.
* @throws InvalidInputException
* The input is not valid. Verify that the action is typed correctly.
* @throws ResourceNotFoundException
* Resource not found. Verify the connection resource ARN and try again.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws UpdateOutOfSyncException
* The update is out of sync. Try syncing again.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws CodeStarConnectionsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample CodeStarConnectionsClient.UpdateSyncConfiguration
* @see AWS API Documentation
*/
@Override
public UpdateSyncConfigurationResponse updateSyncConfiguration(UpdateSyncConfigurationRequest updateSyncConfigurationRequest)
throws AccessDeniedException, ConcurrentModificationException, InternalServerException, InvalidInputException,
ResourceNotFoundException, ThrottlingException, UpdateOutOfSyncException, AwsServiceException, SdkClientException,
CodeStarConnectionsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateSyncConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateSyncConfigurationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateSyncConfigurationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CodeStar connections");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateSyncConfiguration");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateSyncConfiguration").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(updateSyncConfigurationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateSyncConfigurationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
@Override
public final String serviceName() {
return SERVICE_NAME;
}
private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration,
RequestOverrideConfiguration requestOverrideConfiguration) {
List publishers = null;
if (requestOverrideConfiguration != null) {
publishers = requestOverrideConfiguration.metricPublishers();
}
if (publishers == null || publishers.isEmpty()) {
publishers = clientConfiguration.option(SdkClientOption.METRIC_PUBLISHERS);
}
if (publishers == null) {
publishers = Collections.emptyList();
}
return publishers;
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
JsonOperationMetadata operationMetadata) {
return protocolFactory.createErrorResponseHandler(operationMetadata);
}
private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, SdkClientConfiguration clientConfiguration) {
List plugins = request.overrideConfiguration().map(c -> c.plugins()).orElse(Collections.emptyList());
SdkClientConfiguration.Builder configuration = clientConfiguration.toBuilder();
if (plugins.isEmpty()) {
return configuration.build();
}
CodeStarConnectionsServiceClientConfigurationBuilder serviceConfigBuilder = new CodeStarConnectionsServiceClientConfigurationBuilder(
configuration);
for (SdkPlugin plugin : plugins) {
plugin.configureClient(serviceConfigBuilder);
}
return configuration.build();
}
private > T init(T builder) {
return builder
.clientConfiguration(clientConfiguration)
.defaultServiceExceptionSupplier(CodeStarConnectionsException::builder)
.protocol(AwsJsonProtocol.AWS_JSON)
.protocolVersion("1.0")
.registerModeledException(
ExceptionMetadata.builder().errorCode("AccessDeniedException")
.exceptionBuilderSupplier(AccessDeniedException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ConcurrentModificationException")
.exceptionBuilderSupplier(ConcurrentModificationException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("SyncBlockerDoesNotExistException")
.exceptionBuilderSupplier(SyncBlockerDoesNotExistException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ConflictException")
.exceptionBuilderSupplier(ConflictException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ResourceNotFoundException")
.exceptionBuilderSupplier(ResourceNotFoundException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("UnsupportedOperationException")
.exceptionBuilderSupplier(UnsupportedOperationException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidInputException")
.exceptionBuilderSupplier(InvalidInputException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("UnsupportedProviderTypeException")
.exceptionBuilderSupplier(UnsupportedProviderTypeException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ResourceUnavailableException")
.exceptionBuilderSupplier(ResourceUnavailableException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ThrottlingException")
.exceptionBuilderSupplier(ThrottlingException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("SyncConfigurationStillExistsException")
.exceptionBuilderSupplier(SyncConfigurationStillExistsException::builder).httpStatusCode(400)
.build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("UpdateOutOfSyncException")
.exceptionBuilderSupplier(UpdateOutOfSyncException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("RetryLatestCommitFailedException")
.exceptionBuilderSupplier(RetryLatestCommitFailedException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ConditionalCheckFailedException")
.exceptionBuilderSupplier(ConditionalCheckFailedException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InternalServerException")
.exceptionBuilderSupplier(InternalServerException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ResourceAlreadyExistsException")
.exceptionBuilderSupplier(ResourceAlreadyExistsException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("LimitExceededException")
.exceptionBuilderSupplier(LimitExceededException::builder).httpStatusCode(400).build());
}
@Override
public final CodeStarConnectionsServiceClientConfiguration serviceClientConfiguration() {
return new CodeStarConnectionsServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build();
}
@Override
public void close() {
clientHandler.close();
}
}