software.amazon.awssdk.services.m2.DefaultM2Client Maven / Gradle / Ivy
Show all versions of m2 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.m2;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.core.ApiName;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
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.core.util.VersionInfo;
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.m2.model.AccessDeniedException;
import software.amazon.awssdk.services.m2.model.CancelBatchJobExecutionRequest;
import software.amazon.awssdk.services.m2.model.CancelBatchJobExecutionResponse;
import software.amazon.awssdk.services.m2.model.ConflictException;
import software.amazon.awssdk.services.m2.model.CreateApplicationRequest;
import software.amazon.awssdk.services.m2.model.CreateApplicationResponse;
import software.amazon.awssdk.services.m2.model.CreateDataSetImportTaskRequest;
import software.amazon.awssdk.services.m2.model.CreateDataSetImportTaskResponse;
import software.amazon.awssdk.services.m2.model.CreateDeploymentRequest;
import software.amazon.awssdk.services.m2.model.CreateDeploymentResponse;
import software.amazon.awssdk.services.m2.model.CreateEnvironmentRequest;
import software.amazon.awssdk.services.m2.model.CreateEnvironmentResponse;
import software.amazon.awssdk.services.m2.model.DeleteApplicationFromEnvironmentRequest;
import software.amazon.awssdk.services.m2.model.DeleteApplicationFromEnvironmentResponse;
import software.amazon.awssdk.services.m2.model.DeleteApplicationRequest;
import software.amazon.awssdk.services.m2.model.DeleteApplicationResponse;
import software.amazon.awssdk.services.m2.model.DeleteEnvironmentRequest;
import software.amazon.awssdk.services.m2.model.DeleteEnvironmentResponse;
import software.amazon.awssdk.services.m2.model.GetApplicationRequest;
import software.amazon.awssdk.services.m2.model.GetApplicationResponse;
import software.amazon.awssdk.services.m2.model.GetApplicationVersionRequest;
import software.amazon.awssdk.services.m2.model.GetApplicationVersionResponse;
import software.amazon.awssdk.services.m2.model.GetBatchJobExecutionRequest;
import software.amazon.awssdk.services.m2.model.GetBatchJobExecutionResponse;
import software.amazon.awssdk.services.m2.model.GetDataSetDetailsRequest;
import software.amazon.awssdk.services.m2.model.GetDataSetDetailsResponse;
import software.amazon.awssdk.services.m2.model.GetDataSetImportTaskRequest;
import software.amazon.awssdk.services.m2.model.GetDataSetImportTaskResponse;
import software.amazon.awssdk.services.m2.model.GetDeploymentRequest;
import software.amazon.awssdk.services.m2.model.GetDeploymentResponse;
import software.amazon.awssdk.services.m2.model.GetEnvironmentRequest;
import software.amazon.awssdk.services.m2.model.GetEnvironmentResponse;
import software.amazon.awssdk.services.m2.model.InternalServerException;
import software.amazon.awssdk.services.m2.model.ListApplicationVersionsRequest;
import software.amazon.awssdk.services.m2.model.ListApplicationVersionsResponse;
import software.amazon.awssdk.services.m2.model.ListApplicationsRequest;
import software.amazon.awssdk.services.m2.model.ListApplicationsResponse;
import software.amazon.awssdk.services.m2.model.ListBatchJobDefinitionsRequest;
import software.amazon.awssdk.services.m2.model.ListBatchJobDefinitionsResponse;
import software.amazon.awssdk.services.m2.model.ListBatchJobExecutionsRequest;
import software.amazon.awssdk.services.m2.model.ListBatchJobExecutionsResponse;
import software.amazon.awssdk.services.m2.model.ListDataSetImportHistoryRequest;
import software.amazon.awssdk.services.m2.model.ListDataSetImportHistoryResponse;
import software.amazon.awssdk.services.m2.model.ListDataSetsRequest;
import software.amazon.awssdk.services.m2.model.ListDataSetsResponse;
import software.amazon.awssdk.services.m2.model.ListDeploymentsRequest;
import software.amazon.awssdk.services.m2.model.ListDeploymentsResponse;
import software.amazon.awssdk.services.m2.model.ListEngineVersionsRequest;
import software.amazon.awssdk.services.m2.model.ListEngineVersionsResponse;
import software.amazon.awssdk.services.m2.model.ListEnvironmentsRequest;
import software.amazon.awssdk.services.m2.model.ListEnvironmentsResponse;
import software.amazon.awssdk.services.m2.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.m2.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.m2.model.M2Exception;
import software.amazon.awssdk.services.m2.model.M2Request;
import software.amazon.awssdk.services.m2.model.ResourceNotFoundException;
import software.amazon.awssdk.services.m2.model.ServiceQuotaExceededException;
import software.amazon.awssdk.services.m2.model.StartApplicationRequest;
import software.amazon.awssdk.services.m2.model.StartApplicationResponse;
import software.amazon.awssdk.services.m2.model.StartBatchJobRequest;
import software.amazon.awssdk.services.m2.model.StartBatchJobResponse;
import software.amazon.awssdk.services.m2.model.StopApplicationRequest;
import software.amazon.awssdk.services.m2.model.StopApplicationResponse;
import software.amazon.awssdk.services.m2.model.TagResourceRequest;
import software.amazon.awssdk.services.m2.model.TagResourceResponse;
import software.amazon.awssdk.services.m2.model.ThrottlingException;
import software.amazon.awssdk.services.m2.model.UntagResourceRequest;
import software.amazon.awssdk.services.m2.model.UntagResourceResponse;
import software.amazon.awssdk.services.m2.model.UpdateApplicationRequest;
import software.amazon.awssdk.services.m2.model.UpdateApplicationResponse;
import software.amazon.awssdk.services.m2.model.UpdateEnvironmentRequest;
import software.amazon.awssdk.services.m2.model.UpdateEnvironmentResponse;
import software.amazon.awssdk.services.m2.model.ValidationException;
import software.amazon.awssdk.services.m2.paginators.ListApplicationVersionsIterable;
import software.amazon.awssdk.services.m2.paginators.ListApplicationsIterable;
import software.amazon.awssdk.services.m2.paginators.ListBatchJobDefinitionsIterable;
import software.amazon.awssdk.services.m2.paginators.ListBatchJobExecutionsIterable;
import software.amazon.awssdk.services.m2.paginators.ListDataSetImportHistoryIterable;
import software.amazon.awssdk.services.m2.paginators.ListDataSetsIterable;
import software.amazon.awssdk.services.m2.paginators.ListDeploymentsIterable;
import software.amazon.awssdk.services.m2.paginators.ListEngineVersionsIterable;
import software.amazon.awssdk.services.m2.paginators.ListEnvironmentsIterable;
import software.amazon.awssdk.services.m2.transform.CancelBatchJobExecutionRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.CreateApplicationRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.CreateDataSetImportTaskRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.CreateDeploymentRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.CreateEnvironmentRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.DeleteApplicationFromEnvironmentRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.DeleteApplicationRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.DeleteEnvironmentRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.GetApplicationRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.GetApplicationVersionRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.GetBatchJobExecutionRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.GetDataSetDetailsRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.GetDataSetImportTaskRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.GetDeploymentRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.GetEnvironmentRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.ListApplicationVersionsRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.ListApplicationsRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.ListBatchJobDefinitionsRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.ListBatchJobExecutionsRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.ListDataSetImportHistoryRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.ListDataSetsRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.ListDeploymentsRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.ListEngineVersionsRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.ListEnvironmentsRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.StartApplicationRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.StartBatchJobRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.StopApplicationRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.UpdateApplicationRequestMarshaller;
import software.amazon.awssdk.services.m2.transform.UpdateEnvironmentRequestMarshaller;
import software.amazon.awssdk.utils.Logger;
/**
* Internal implementation of {@link M2Client}.
*
* @see M2Client#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultM2Client implements M2Client {
private static final Logger log = Logger.loggerFor(DefaultM2Client.class);
private final SyncClientHandler clientHandler;
private final AwsJsonProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
protected DefaultM2Client(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration;
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
@Override
public final String serviceName() {
return SERVICE_NAME;
}
/**
*
* Cancels the running of a specific batch job execution.
*
*
* @param cancelBatchJobExecutionRequest
* @return Result of the CancelBatchJobExecution operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws ConflictException
* The parameters provided in the request conflict with existing resources.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.CancelBatchJobExecution
* @see AWS
* API Documentation
*/
@Override
public CancelBatchJobExecutionResponse cancelBatchJobExecution(CancelBatchJobExecutionRequest cancelBatchJobExecutionRequest)
throws ValidationException, ConflictException, InternalServerException, AccessDeniedException, ThrottlingException,
ResourceNotFoundException, AwsServiceException, SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CancelBatchJobExecutionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, cancelBatchJobExecutionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CancelBatchJobExecution");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CancelBatchJobExecution").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(cancelBatchJobExecutionRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CancelBatchJobExecutionRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a new application with given parameters. Requires an existing environment and application definition
* file.
*
*
* @param createApplicationRequest
* @return Result of the CreateApplication operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws ServiceQuotaExceededException
* One or more quotas for Amazon Web Services Mainframe Modernization exceeds the limit.
* @throws ConflictException
* The parameters provided in the request conflict with existing resources.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.CreateApplication
* @see AWS API
* Documentation
*/
@Override
public CreateApplicationResponse createApplication(CreateApplicationRequest createApplicationRequest)
throws ValidationException, ServiceQuotaExceededException, ConflictException, InternalServerException,
AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateApplicationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createApplicationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateApplication");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateApplication").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createApplicationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateApplicationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Starts a data set import task for a specific application.
*
*
* @param createDataSetImportTaskRequest
* @return Result of the CreateDataSetImportTask operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws ServiceQuotaExceededException
* One or more quotas for Amazon Web Services Mainframe Modernization exceeds the limit.
* @throws ConflictException
* The parameters provided in the request conflict with existing resources.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.CreateDataSetImportTask
* @see AWS
* API Documentation
*/
@Override
public CreateDataSetImportTaskResponse createDataSetImportTask(CreateDataSetImportTaskRequest createDataSetImportTaskRequest)
throws ValidationException, ServiceQuotaExceededException, ConflictException, InternalServerException,
AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException, SdkClientException,
M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateDataSetImportTaskResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createDataSetImportTaskRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateDataSetImportTask");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateDataSetImportTask").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createDataSetImportTaskRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateDataSetImportTaskRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates and starts a deployment to deploy an application into an environment.
*
*
* @param createDeploymentRequest
* @return Result of the CreateDeployment operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws ServiceQuotaExceededException
* One or more quotas for Amazon Web Services Mainframe Modernization exceeds the limit.
* @throws ConflictException
* The parameters provided in the request conflict with existing resources.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.CreateDeployment
* @see AWS API
* Documentation
*/
@Override
public CreateDeploymentResponse createDeployment(CreateDeploymentRequest createDeploymentRequest) throws ValidationException,
ServiceQuotaExceededException, ConflictException, InternalServerException, AccessDeniedException,
ThrottlingException, ResourceNotFoundException, AwsServiceException, SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateDeploymentResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createDeploymentRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateDeployment");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateDeployment").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createDeploymentRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateDeploymentRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a runtime environment for a given runtime engine.
*
*
* @param createEnvironmentRequest
* @return Result of the CreateEnvironment operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws ServiceQuotaExceededException
* One or more quotas for Amazon Web Services Mainframe Modernization exceeds the limit.
* @throws ConflictException
* The parameters provided in the request conflict with existing resources.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.CreateEnvironment
* @see AWS API
* Documentation
*/
@Override
public CreateEnvironmentResponse createEnvironment(CreateEnvironmentRequest createEnvironmentRequest)
throws ValidationException, ServiceQuotaExceededException, ConflictException, InternalServerException,
AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateEnvironmentResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createEnvironmentRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateEnvironment");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateEnvironment").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createEnvironmentRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateEnvironmentRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes a specific application. You cannot delete a running application.
*
*
* @param deleteApplicationRequest
* @return Result of the DeleteApplication operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws ConflictException
* The parameters provided in the request conflict with existing resources.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.DeleteApplication
* @see AWS API
* Documentation
*/
@Override
public DeleteApplicationResponse deleteApplication(DeleteApplicationRequest deleteApplicationRequest)
throws ValidationException, ConflictException, InternalServerException, AccessDeniedException, ThrottlingException,
AwsServiceException, SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteApplicationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteApplicationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteApplication");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteApplication").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deleteApplicationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteApplicationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes a specific application from a specified environment where it has been previously deployed. You cannot
* delete an environment using DeleteEnvironment, if any application has ever been deployed to it. This API removes
* the association of the application with the environment so you can delete the environment smoothly.
*
*
* @param deleteApplicationFromEnvironmentRequest
* @return Result of the DeleteApplicationFromEnvironment operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws ConflictException
* The parameters provided in the request conflict with existing resources.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.DeleteApplicationFromEnvironment
* @see AWS API Documentation
*/
@Override
public DeleteApplicationFromEnvironmentResponse deleteApplicationFromEnvironment(
DeleteApplicationFromEnvironmentRequest deleteApplicationFromEnvironmentRequest) throws ValidationException,
ConflictException, InternalServerException, AccessDeniedException, ThrottlingException, ResourceNotFoundException,
AwsServiceException, SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteApplicationFromEnvironmentResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
deleteApplicationFromEnvironmentRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteApplicationFromEnvironment");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteApplicationFromEnvironment").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deleteApplicationFromEnvironmentRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteApplicationFromEnvironmentRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes a specific environment. The environment cannot contain deployed applications. If it does, you must delete
* those applications before you delete the environment.
*
*
* @param deleteEnvironmentRequest
* @return Result of the DeleteEnvironment operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws ConflictException
* The parameters provided in the request conflict with existing resources.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.DeleteEnvironment
* @see AWS API
* Documentation
*/
@Override
public DeleteEnvironmentResponse deleteEnvironment(DeleteEnvironmentRequest deleteEnvironmentRequest)
throws ValidationException, ConflictException, InternalServerException, AccessDeniedException, ThrottlingException,
AwsServiceException, SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteEnvironmentResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteEnvironmentRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteEnvironment");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteEnvironment").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deleteEnvironmentRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteEnvironmentRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Describes the details of a specific application.
*
*
* @param getApplicationRequest
* @return Result of the GetApplication operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.GetApplication
* @see AWS API
* Documentation
*/
@Override
public GetApplicationResponse getApplication(GetApplicationRequest getApplicationRequest) throws ValidationException,
InternalServerException, AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException,
SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetApplicationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getApplicationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetApplication");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetApplication").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getApplicationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetApplicationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns details about a specific version of a specific application.
*
*
* @param getApplicationVersionRequest
* @return Result of the GetApplicationVersion operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.GetApplicationVersion
* @see AWS API
* Documentation
*/
@Override
public GetApplicationVersionResponse getApplicationVersion(GetApplicationVersionRequest getApplicationVersionRequest)
throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException,
ResourceNotFoundException, AwsServiceException, SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetApplicationVersionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getApplicationVersionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetApplicationVersion");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetApplicationVersion").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getApplicationVersionRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetApplicationVersionRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Gets the details of a specific batch job execution for a specific application.
*
*
* @param getBatchJobExecutionRequest
* @return Result of the GetBatchJobExecution operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.GetBatchJobExecution
* @see AWS API
* Documentation
*/
@Override
public GetBatchJobExecutionResponse getBatchJobExecution(GetBatchJobExecutionRequest getBatchJobExecutionRequest)
throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException,
ResourceNotFoundException, AwsServiceException, SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetBatchJobExecutionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getBatchJobExecutionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetBatchJobExecution");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetBatchJobExecution").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getBatchJobExecutionRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetBatchJobExecutionRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Gets the details of a specific data set.
*
*
* @param getDataSetDetailsRequest
* @return Result of the GetDataSetDetails operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.GetDataSetDetails
* @see AWS API
* Documentation
*/
@Override
public GetDataSetDetailsResponse getDataSetDetails(GetDataSetDetailsRequest getDataSetDetailsRequest)
throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException,
ResourceNotFoundException, AwsServiceException, SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetDataSetDetailsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getDataSetDetailsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetDataSetDetails");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetDataSetDetails").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getDataSetDetailsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetDataSetDetailsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Gets the status of a data set import task initiated with the CreateDataSetImportTask operation.
*
*
* @param getDataSetImportTaskRequest
* @return Result of the GetDataSetImportTask operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.GetDataSetImportTask
* @see AWS API
* Documentation
*/
@Override
public GetDataSetImportTaskResponse getDataSetImportTask(GetDataSetImportTaskRequest getDataSetImportTaskRequest)
throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException,
ResourceNotFoundException, AwsServiceException, SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetDataSetImportTaskResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getDataSetImportTaskRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetDataSetImportTask");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetDataSetImportTask").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getDataSetImportTaskRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetDataSetImportTaskRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Gets details of a specific deployment with a given deployment identifier.
*
*
* @param getDeploymentRequest
* @return Result of the GetDeployment operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.GetDeployment
* @see AWS API
* Documentation
*/
@Override
public GetDeploymentResponse getDeployment(GetDeploymentRequest getDeploymentRequest) throws ValidationException,
InternalServerException, AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException,
SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetDeploymentResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getDeploymentRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetDeployment");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetDeployment").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getDeploymentRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetDeploymentRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Describes a specific runtime environment.
*
*
* @param getEnvironmentRequest
* @return Result of the GetEnvironment operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.GetEnvironment
* @see AWS API
* Documentation
*/
@Override
public GetEnvironmentResponse getEnvironment(GetEnvironmentRequest getEnvironmentRequest) throws ValidationException,
InternalServerException, AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException,
SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetEnvironmentResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getEnvironmentRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetEnvironment");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetEnvironment").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getEnvironmentRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetEnvironmentRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns a list of the application versions for a specific application.
*
*
* @param listApplicationVersionsRequest
* @return Result of the ListApplicationVersions operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.ListApplicationVersions
* @see AWS
* API Documentation
*/
@Override
public ListApplicationVersionsResponse listApplicationVersions(ListApplicationVersionsRequest listApplicationVersionsRequest)
throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException,
ResourceNotFoundException, AwsServiceException, SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListApplicationVersionsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listApplicationVersionsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListApplicationVersions");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListApplicationVersions").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listApplicationVersionsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListApplicationVersionsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns a list of the application versions for a specific application.
*
*
*
* This is a variant of
* {@link #listApplicationVersions(software.amazon.awssdk.services.m2.model.ListApplicationVersionsRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.m2.paginators.ListApplicationVersionsIterable responses = client.listApplicationVersionsPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.m2.paginators.ListApplicationVersionsIterable responses = client
* .listApplicationVersionsPaginator(request);
* for (software.amazon.awssdk.services.m2.model.ListApplicationVersionsResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.m2.paginators.ListApplicationVersionsIterable responses = client.listApplicationVersionsPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listApplicationVersions(software.amazon.awssdk.services.m2.model.ListApplicationVersionsRequest)}
* operation.
*
*
* @param listApplicationVersionsRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.ListApplicationVersions
* @see AWS
* API Documentation
*/
@Override
public ListApplicationVersionsIterable listApplicationVersionsPaginator(
ListApplicationVersionsRequest listApplicationVersionsRequest) throws ValidationException, InternalServerException,
AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException, SdkClientException,
M2Exception {
return new ListApplicationVersionsIterable(this, applyPaginatorUserAgent(listApplicationVersionsRequest));
}
/**
*
* Lists the applications associated with a specific Amazon Web Services account. You can provide the unique
* identifier of a specific environment in a query parameter to see all applications associated with that
* environment.
*
*
* @param listApplicationsRequest
* @return Result of the ListApplications operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.ListApplications
* @see AWS API
* Documentation
*/
@Override
public ListApplicationsResponse listApplications(ListApplicationsRequest listApplicationsRequest) throws ValidationException,
InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException,
M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListApplicationsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listApplicationsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListApplications");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListApplications").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listApplicationsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListApplicationsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists the applications associated with a specific Amazon Web Services account. You can provide the unique
* identifier of a specific environment in a query parameter to see all applications associated with that
* environment.
*
*
*
* This is a variant of {@link #listApplications(software.amazon.awssdk.services.m2.model.ListApplicationsRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.m2.paginators.ListApplicationsIterable responses = client.listApplicationsPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.m2.paginators.ListApplicationsIterable responses = client.listApplicationsPaginator(request);
* for (software.amazon.awssdk.services.m2.model.ListApplicationsResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.m2.paginators.ListApplicationsIterable responses = client.listApplicationsPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listApplications(software.amazon.awssdk.services.m2.model.ListApplicationsRequest)} operation.
*
*
* @param listApplicationsRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.ListApplications
* @see AWS API
* Documentation
*/
@Override
public ListApplicationsIterable listApplicationsPaginator(ListApplicationsRequest listApplicationsRequest)
throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException,
SdkClientException, M2Exception {
return new ListApplicationsIterable(this, applyPaginatorUserAgent(listApplicationsRequest));
}
/**
*
* Lists all the available batch job definitions based on the batch job resources uploaded during the application
* creation. The listed batch job definitions can then be used to start a batch job.
*
*
* @param listBatchJobDefinitionsRequest
* @return Result of the ListBatchJobDefinitions operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.ListBatchJobDefinitions
* @see AWS
* API Documentation
*/
@Override
public ListBatchJobDefinitionsResponse listBatchJobDefinitions(ListBatchJobDefinitionsRequest listBatchJobDefinitionsRequest)
throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException,
ResourceNotFoundException, AwsServiceException, SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListBatchJobDefinitionsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listBatchJobDefinitionsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListBatchJobDefinitions");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListBatchJobDefinitions").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listBatchJobDefinitionsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListBatchJobDefinitionsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists all the available batch job definitions based on the batch job resources uploaded during the application
* creation. The listed batch job definitions can then be used to start a batch job.
*
*
*
* This is a variant of
* {@link #listBatchJobDefinitions(software.amazon.awssdk.services.m2.model.ListBatchJobDefinitionsRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.m2.paginators.ListBatchJobDefinitionsIterable responses = client.listBatchJobDefinitionsPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.m2.paginators.ListBatchJobDefinitionsIterable responses = client
* .listBatchJobDefinitionsPaginator(request);
* for (software.amazon.awssdk.services.m2.model.ListBatchJobDefinitionsResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.m2.paginators.ListBatchJobDefinitionsIterable responses = client.listBatchJobDefinitionsPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listBatchJobDefinitions(software.amazon.awssdk.services.m2.model.ListBatchJobDefinitionsRequest)}
* operation.
*
*
* @param listBatchJobDefinitionsRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.ListBatchJobDefinitions
* @see AWS
* API Documentation
*/
@Override
public ListBatchJobDefinitionsIterable listBatchJobDefinitionsPaginator(
ListBatchJobDefinitionsRequest listBatchJobDefinitionsRequest) throws ValidationException, InternalServerException,
AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException, SdkClientException,
M2Exception {
return new ListBatchJobDefinitionsIterable(this, applyPaginatorUserAgent(listBatchJobDefinitionsRequest));
}
/**
*
* Lists historical, current, and scheduled batch job executions for a specific application.
*
*
* @param listBatchJobExecutionsRequest
* @return Result of the ListBatchJobExecutions operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.ListBatchJobExecutions
* @see AWS API
* Documentation
*/
@Override
public ListBatchJobExecutionsResponse listBatchJobExecutions(ListBatchJobExecutionsRequest listBatchJobExecutionsRequest)
throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException,
ResourceNotFoundException, AwsServiceException, SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListBatchJobExecutionsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listBatchJobExecutionsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListBatchJobExecutions");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListBatchJobExecutions").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listBatchJobExecutionsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListBatchJobExecutionsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists historical, current, and scheduled batch job executions for a specific application.
*
*
*
* This is a variant of
* {@link #listBatchJobExecutions(software.amazon.awssdk.services.m2.model.ListBatchJobExecutionsRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.m2.paginators.ListBatchJobExecutionsIterable responses = client.listBatchJobExecutionsPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.m2.paginators.ListBatchJobExecutionsIterable responses = client
* .listBatchJobExecutionsPaginator(request);
* for (software.amazon.awssdk.services.m2.model.ListBatchJobExecutionsResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.m2.paginators.ListBatchJobExecutionsIterable responses = client.listBatchJobExecutionsPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listBatchJobExecutions(software.amazon.awssdk.services.m2.model.ListBatchJobExecutionsRequest)}
* operation.
*
*
* @param listBatchJobExecutionsRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.ListBatchJobExecutions
* @see AWS API
* Documentation
*/
@Override
public ListBatchJobExecutionsIterable listBatchJobExecutionsPaginator(
ListBatchJobExecutionsRequest listBatchJobExecutionsRequest) throws ValidationException, InternalServerException,
AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException, SdkClientException,
M2Exception {
return new ListBatchJobExecutionsIterable(this, applyPaginatorUserAgent(listBatchJobExecutionsRequest));
}
/**
*
* Lists the data set imports for the specified application.
*
*
* @param listDataSetImportHistoryRequest
* @return Result of the ListDataSetImportHistory operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.ListDataSetImportHistory
* @see AWS
* API Documentation
*/
@Override
public ListDataSetImportHistoryResponse listDataSetImportHistory(
ListDataSetImportHistoryRequest listDataSetImportHistoryRequest) throws ValidationException, InternalServerException,
AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException, SdkClientException,
M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListDataSetImportHistoryResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listDataSetImportHistoryRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListDataSetImportHistory");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListDataSetImportHistory").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listDataSetImportHistoryRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListDataSetImportHistoryRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists the data set imports for the specified application.
*
*
*
* This is a variant of
* {@link #listDataSetImportHistory(software.amazon.awssdk.services.m2.model.ListDataSetImportHistoryRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.m2.paginators.ListDataSetImportHistoryIterable responses = client.listDataSetImportHistoryPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.m2.paginators.ListDataSetImportHistoryIterable responses = client
* .listDataSetImportHistoryPaginator(request);
* for (software.amazon.awssdk.services.m2.model.ListDataSetImportHistoryResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.m2.paginators.ListDataSetImportHistoryIterable responses = client.listDataSetImportHistoryPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listDataSetImportHistory(software.amazon.awssdk.services.m2.model.ListDataSetImportHistoryRequest)}
* operation.
*
*
* @param listDataSetImportHistoryRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.ListDataSetImportHistory
* @see AWS
* API Documentation
*/
@Override
public ListDataSetImportHistoryIterable listDataSetImportHistoryPaginator(
ListDataSetImportHistoryRequest listDataSetImportHistoryRequest) throws ValidationException, InternalServerException,
AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException, SdkClientException,
M2Exception {
return new ListDataSetImportHistoryIterable(this, applyPaginatorUserAgent(listDataSetImportHistoryRequest));
}
/**
*
* Lists the data sets imported for a specific application. In Amazon Web Services Mainframe Modernization, data
* sets are associated with applications deployed on environments. This is known as importing data sets. Currently,
* Amazon Web Services Mainframe Modernization can import data sets into catalogs using CreateDataSetImportTask.
*
*
* @param listDataSetsRequest
* @return Result of the ListDataSets operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.ListDataSets
* @see AWS API
* Documentation
*/
@Override
public ListDataSetsResponse listDataSets(ListDataSetsRequest listDataSetsRequest) throws ValidationException,
InternalServerException, AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException,
SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListDataSetsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listDataSetsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListDataSets");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListDataSets").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listDataSetsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListDataSetsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists the data sets imported for a specific application. In Amazon Web Services Mainframe Modernization, data
* sets are associated with applications deployed on environments. This is known as importing data sets. Currently,
* Amazon Web Services Mainframe Modernization can import data sets into catalogs using CreateDataSetImportTask.
*
*
*
* This is a variant of {@link #listDataSets(software.amazon.awssdk.services.m2.model.ListDataSetsRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.m2.paginators.ListDataSetsIterable responses = client.listDataSetsPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.m2.paginators.ListDataSetsIterable responses = client.listDataSetsPaginator(request);
* for (software.amazon.awssdk.services.m2.model.ListDataSetsResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.m2.paginators.ListDataSetsIterable responses = client.listDataSetsPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listDataSets(software.amazon.awssdk.services.m2.model.ListDataSetsRequest)} operation.
*
*
* @param listDataSetsRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.ListDataSets
* @see AWS API
* Documentation
*/
@Override
public ListDataSetsIterable listDataSetsPaginator(ListDataSetsRequest listDataSetsRequest) throws ValidationException,
InternalServerException, AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException,
SdkClientException, M2Exception {
return new ListDataSetsIterable(this, applyPaginatorUserAgent(listDataSetsRequest));
}
/**
*
* Returns a list of all deployments of a specific application. A deployment is a combination of a specific
* application and a specific version of that application. Each deployment is mapped to a particular application
* version.
*
*
* @param listDeploymentsRequest
* @return Result of the ListDeployments operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.ListDeployments
* @see AWS API
* Documentation
*/
@Override
public ListDeploymentsResponse listDeployments(ListDeploymentsRequest listDeploymentsRequest) throws ValidationException,
InternalServerException, AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException,
SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListDeploymentsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listDeploymentsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListDeployments");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListDeployments").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listDeploymentsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListDeploymentsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns a list of all deployments of a specific application. A deployment is a combination of a specific
* application and a specific version of that application. Each deployment is mapped to a particular application
* version.
*
*
*
* This is a variant of {@link #listDeployments(software.amazon.awssdk.services.m2.model.ListDeploymentsRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.m2.paginators.ListDeploymentsIterable responses = client.listDeploymentsPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.m2.paginators.ListDeploymentsIterable responses = client.listDeploymentsPaginator(request);
* for (software.amazon.awssdk.services.m2.model.ListDeploymentsResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.m2.paginators.ListDeploymentsIterable responses = client.listDeploymentsPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listDeployments(software.amazon.awssdk.services.m2.model.ListDeploymentsRequest)} operation.
*
*
* @param listDeploymentsRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.ListDeployments
* @see AWS API
* Documentation
*/
@Override
public ListDeploymentsIterable listDeploymentsPaginator(ListDeploymentsRequest listDeploymentsRequest)
throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException,
ResourceNotFoundException, AwsServiceException, SdkClientException, M2Exception {
return new ListDeploymentsIterable(this, applyPaginatorUserAgent(listDeploymentsRequest));
}
/**
*
* Lists the available engine versions.
*
*
* @param listEngineVersionsRequest
* @return Result of the ListEngineVersions operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.ListEngineVersions
* @see AWS API
* Documentation
*/
@Override
public ListEngineVersionsResponse listEngineVersions(ListEngineVersionsRequest listEngineVersionsRequest)
throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException,
SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListEngineVersionsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listEngineVersionsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListEngineVersions");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListEngineVersions").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listEngineVersionsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListEngineVersionsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists the available engine versions.
*
*
*
* This is a variant of
* {@link #listEngineVersions(software.amazon.awssdk.services.m2.model.ListEngineVersionsRequest)} operation. The
* return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle
* making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.m2.paginators.ListEngineVersionsIterable responses = client.listEngineVersionsPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.m2.paginators.ListEngineVersionsIterable responses = client
* .listEngineVersionsPaginator(request);
* for (software.amazon.awssdk.services.m2.model.ListEngineVersionsResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.m2.paginators.ListEngineVersionsIterable responses = client.listEngineVersionsPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listEngineVersions(software.amazon.awssdk.services.m2.model.ListEngineVersionsRequest)} operation.
*
*
* @param listEngineVersionsRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.ListEngineVersions
* @see AWS API
* Documentation
*/
@Override
public ListEngineVersionsIterable listEngineVersionsPaginator(ListEngineVersionsRequest listEngineVersionsRequest)
throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException,
SdkClientException, M2Exception {
return new ListEngineVersionsIterable(this, applyPaginatorUserAgent(listEngineVersionsRequest));
}
/**
*
* Lists the runtime environments.
*
*
* @param listEnvironmentsRequest
* @return Result of the ListEnvironments operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.ListEnvironments
* @see AWS API
* Documentation
*/
@Override
public ListEnvironmentsResponse listEnvironments(ListEnvironmentsRequest listEnvironmentsRequest) throws ValidationException,
InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException,
M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListEnvironmentsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listEnvironmentsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListEnvironments");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListEnvironments").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listEnvironmentsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListEnvironmentsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Lists the runtime environments.
*
*
*
* This is a variant of {@link #listEnvironments(software.amazon.awssdk.services.m2.model.ListEnvironmentsRequest)}
* operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
* internally handle making service calls for you.
*
*
* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no
* guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response
* pages by making service calls until there are no pages left or your iteration stops. If there are errors in your
* request, you will see the failures only after you start iterating through the iterable.
*
*
*
* The following are few ways to iterate through the response pages:
*
* 1) Using a Stream
*
*
* {@code
* software.amazon.awssdk.services.m2.paginators.ListEnvironmentsIterable responses = client.listEnvironmentsPaginator(request);
* responses.stream().forEach(....);
* }
*
*
* 2) Using For loop
*
*
* {
* @code
* software.amazon.awssdk.services.m2.paginators.ListEnvironmentsIterable responses = client.listEnvironmentsPaginator(request);
* for (software.amazon.awssdk.services.m2.model.ListEnvironmentsResponse response : responses) {
* // do something;
* }
* }
*
*
* 3) Use iterator directly
*
*
* {@code
* software.amazon.awssdk.services.m2.paginators.ListEnvironmentsIterable responses = client.listEnvironmentsPaginator(request);
* responses.iterator().forEachRemaining(....);
* }
*
*
* Please notice that the configuration of maxResults won't limit the number of results you get with the
* paginator. It only limits the number of results in each page.
*
*
* Note: If you prefer to have control on service calls, use the
* {@link #listEnvironments(software.amazon.awssdk.services.m2.model.ListEnvironmentsRequest)} operation.
*
*
* @param listEnvironmentsRequest
* @return A custom iterable that can be used to iterate through all the response pages.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.ListEnvironments
* @see AWS API
* Documentation
*/
@Override
public ListEnvironmentsIterable listEnvironmentsPaginator(ListEnvironmentsRequest listEnvironmentsRequest)
throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException,
SdkClientException, M2Exception {
return new ListEnvironmentsIterable(this, applyPaginatorUserAgent(listEnvironmentsRequest));
}
/**
*
* Lists the tags for the specified resource.
*
*
* @param listTagsForResourceRequest
* @return Result of the ListTagsForResource operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.ListTagsForResource
* @see AWS API
* Documentation
*/
@Override
public ListTagsForResourceResponse listTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest)
throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException,
ResourceNotFoundException, AwsServiceException, SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListTagsForResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListTagsForResource").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listTagsForResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Starts an application that is currently stopped.
*
*
* @param startApplicationRequest
* @return Result of the StartApplication operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws ConflictException
* The parameters provided in the request conflict with existing resources.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.StartApplication
* @see AWS API
* Documentation
*/
@Override
public StartApplicationResponse startApplication(StartApplicationRequest startApplicationRequest) throws ValidationException,
ConflictException, InternalServerException, AccessDeniedException, ThrottlingException, ResourceNotFoundException,
AwsServiceException, SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
StartApplicationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, startApplicationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StartApplication");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("StartApplication").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(startApplicationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new StartApplicationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Starts a batch job and returns the unique identifier of this execution of the batch job. The associated
* application must be running in order to start the batch job.
*
*
* @param startBatchJobRequest
* @return Result of the StartBatchJob operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws ConflictException
* The parameters provided in the request conflict with existing resources.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.StartBatchJob
* @see AWS API
* Documentation
*/
@Override
public StartBatchJobResponse startBatchJob(StartBatchJobRequest startBatchJobRequest) throws ValidationException,
ConflictException, InternalServerException, AccessDeniedException, ThrottlingException, ResourceNotFoundException,
AwsServiceException, SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
StartBatchJobResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, startBatchJobRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StartBatchJob");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("StartBatchJob").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(startBatchJobRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new StartBatchJobRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Stops a running application.
*
*
* @param stopApplicationRequest
* @return Result of the StopApplication operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws ConflictException
* The parameters provided in the request conflict with existing resources.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.StopApplication
* @see AWS API
* Documentation
*/
@Override
public StopApplicationResponse stopApplication(StopApplicationRequest stopApplicationRequest) throws ValidationException,
ConflictException, InternalServerException, AccessDeniedException, ThrottlingException, ResourceNotFoundException,
AwsServiceException, SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
StopApplicationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, stopApplicationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StopApplication");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("StopApplication").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(stopApplicationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new StopApplicationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Adds one or more tags to the specified resource.
*
*
* @param tagResourceRequest
* @return Result of the TagResource operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws ServiceQuotaExceededException
* One or more quotas for Amazon Web Services Mainframe Modernization exceeds the limit.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.TagResource
* @see AWS API
* Documentation
*/
@Override
public TagResourceResponse tagResource(TagResourceRequest tagResourceRequest) throws ValidationException,
ServiceQuotaExceededException, InternalServerException, AccessDeniedException, ThrottlingException,
ResourceNotFoundException, AwsServiceException, SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
TagResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, tagResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("TagResource").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(tagResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new TagResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Removes one or more tags from the specified resource.
*
*
* @param untagResourceRequest
* @return Result of the UntagResource operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.UntagResource
* @see AWS API
* Documentation
*/
@Override
public UntagResourceResponse untagResource(UntagResourceRequest untagResourceRequest) throws ValidationException,
InternalServerException, AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException,
SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UntagResourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, untagResourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UntagResource").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(untagResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UntagResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates an application and creates a new version.
*
*
* @param updateApplicationRequest
* @return Result of the UpdateApplication operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws ConflictException
* The parameters provided in the request conflict with existing resources.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.UpdateApplication
* @see AWS API
* Documentation
*/
@Override
public UpdateApplicationResponse updateApplication(UpdateApplicationRequest updateApplicationRequest)
throws ValidationException, ConflictException, InternalServerException, AccessDeniedException, ThrottlingException,
ResourceNotFoundException, AwsServiceException, SdkClientException, M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateApplicationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateApplicationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateApplication");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateApplication").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(updateApplicationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateApplicationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates the configuration details for a specific environment.
*
*
* @param updateEnvironmentRequest
* @return Result of the UpdateEnvironment operation returned by the service.
* @throws ValidationException
* One or more parameters provided in the request is not valid.
* @throws ServiceQuotaExceededException
* One or more quotas for Amazon Web Services Mainframe Modernization exceeds the limit.
* @throws ConflictException
* The parameters provided in the request conflict with existing resources.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws AccessDeniedException
* The account or role doesn't have the right permissions to make the request.
* @throws ThrottlingException
* The number of requests made exceeds the limit.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @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 M2Exception
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample M2Client.UpdateEnvironment
* @see AWS API
* Documentation
*/
@Override
public UpdateEnvironmentResponse updateEnvironment(UpdateEnvironmentRequest updateEnvironmentRequest)
throws ValidationException, ServiceQuotaExceededException, ConflictException, InternalServerException,
AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException, SdkClientException,
M2Exception {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateEnvironmentResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateEnvironmentRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "m2");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateEnvironment");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateEnvironment").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(updateEnvironmentRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateEnvironmentRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
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 > T init(T builder) {
return builder
.clientConfiguration(clientConfiguration)
.defaultServiceExceptionSupplier(M2Exception::builder)
.protocol(AwsJsonProtocol.REST_JSON)
.protocolVersion("1.1")
.registerModeledException(
ExceptionMetadata.builder().errorCode("ThrottlingException")
.exceptionBuilderSupplier(ThrottlingException::builder).httpStatusCode(429).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ServiceQuotaExceededException")
.exceptionBuilderSupplier(ServiceQuotaExceededException::builder).httpStatusCode(402).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InternalServerException")
.exceptionBuilderSupplier(InternalServerException::builder).httpStatusCode(500).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("AccessDeniedException")
.exceptionBuilderSupplier(AccessDeniedException::builder).httpStatusCode(403).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ConflictException")
.exceptionBuilderSupplier(ConflictException::builder).httpStatusCode(409).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ResourceNotFoundException")
.exceptionBuilderSupplier(ResourceNotFoundException::builder).httpStatusCode(404).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ValidationException")
.exceptionBuilderSupplier(ValidationException::builder).httpStatusCode(400).build());
}
@Override
public void close() {
clientHandler.close();
}
private T applyPaginatorUserAgent(T request) {
Consumer userAgentApplier = b -> b.addApiName(ApiName.builder()
.version(VersionInfo.SDK_VERSION).name("PAGINATED").build());
AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration()
.map(c -> c.toBuilder().applyMutation(userAgentApplier).build())
.orElse((AwsRequestOverrideConfiguration.builder().applyMutation(userAgentApplier).build()));
return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build();
}
}