All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.fis.DefaultFisClient Maven / Gradle / Ivy

/*
 * 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.fis;

import java.util.Collections;
import java.util.List;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.awscore.internal.AwsProtocolMetadata;
import software.amazon.awssdk.awscore.internal.AwsServiceProtocol;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkPlugin;
import software.amazon.awssdk.core.SdkRequest;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientOption;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
import software.amazon.awssdk.core.client.handler.SyncClientHandler;
import software.amazon.awssdk.core.exception.SdkClientException;
import software.amazon.awssdk.core.http.HttpResponseHandler;
import software.amazon.awssdk.core.metrics.CoreMetric;
import software.amazon.awssdk.metrics.MetricCollector;
import software.amazon.awssdk.metrics.MetricPublisher;
import software.amazon.awssdk.metrics.NoOpMetricCollector;
import software.amazon.awssdk.protocols.core.ExceptionMetadata;
import software.amazon.awssdk.protocols.json.AwsJsonProtocol;
import software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.services.fis.internal.FisServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.fis.model.ConflictException;
import software.amazon.awssdk.services.fis.model.CreateExperimentTemplateRequest;
import software.amazon.awssdk.services.fis.model.CreateExperimentTemplateResponse;
import software.amazon.awssdk.services.fis.model.CreateTargetAccountConfigurationRequest;
import software.amazon.awssdk.services.fis.model.CreateTargetAccountConfigurationResponse;
import software.amazon.awssdk.services.fis.model.DeleteExperimentTemplateRequest;
import software.amazon.awssdk.services.fis.model.DeleteExperimentTemplateResponse;
import software.amazon.awssdk.services.fis.model.DeleteTargetAccountConfigurationRequest;
import software.amazon.awssdk.services.fis.model.DeleteTargetAccountConfigurationResponse;
import software.amazon.awssdk.services.fis.model.FisException;
import software.amazon.awssdk.services.fis.model.GetActionRequest;
import software.amazon.awssdk.services.fis.model.GetActionResponse;
import software.amazon.awssdk.services.fis.model.GetExperimentRequest;
import software.amazon.awssdk.services.fis.model.GetExperimentResponse;
import software.amazon.awssdk.services.fis.model.GetExperimentTargetAccountConfigurationRequest;
import software.amazon.awssdk.services.fis.model.GetExperimentTargetAccountConfigurationResponse;
import software.amazon.awssdk.services.fis.model.GetExperimentTemplateRequest;
import software.amazon.awssdk.services.fis.model.GetExperimentTemplateResponse;
import software.amazon.awssdk.services.fis.model.GetTargetAccountConfigurationRequest;
import software.amazon.awssdk.services.fis.model.GetTargetAccountConfigurationResponse;
import software.amazon.awssdk.services.fis.model.GetTargetResourceTypeRequest;
import software.amazon.awssdk.services.fis.model.GetTargetResourceTypeResponse;
import software.amazon.awssdk.services.fis.model.ListActionsRequest;
import software.amazon.awssdk.services.fis.model.ListActionsResponse;
import software.amazon.awssdk.services.fis.model.ListExperimentResolvedTargetsRequest;
import software.amazon.awssdk.services.fis.model.ListExperimentResolvedTargetsResponse;
import software.amazon.awssdk.services.fis.model.ListExperimentTargetAccountConfigurationsRequest;
import software.amazon.awssdk.services.fis.model.ListExperimentTargetAccountConfigurationsResponse;
import software.amazon.awssdk.services.fis.model.ListExperimentTemplatesRequest;
import software.amazon.awssdk.services.fis.model.ListExperimentTemplatesResponse;
import software.amazon.awssdk.services.fis.model.ListExperimentsRequest;
import software.amazon.awssdk.services.fis.model.ListExperimentsResponse;
import software.amazon.awssdk.services.fis.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.fis.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.fis.model.ListTargetAccountConfigurationsRequest;
import software.amazon.awssdk.services.fis.model.ListTargetAccountConfigurationsResponse;
import software.amazon.awssdk.services.fis.model.ListTargetResourceTypesRequest;
import software.amazon.awssdk.services.fis.model.ListTargetResourceTypesResponse;
import software.amazon.awssdk.services.fis.model.ResourceNotFoundException;
import software.amazon.awssdk.services.fis.model.ServiceQuotaExceededException;
import software.amazon.awssdk.services.fis.model.StartExperimentRequest;
import software.amazon.awssdk.services.fis.model.StartExperimentResponse;
import software.amazon.awssdk.services.fis.model.StopExperimentRequest;
import software.amazon.awssdk.services.fis.model.StopExperimentResponse;
import software.amazon.awssdk.services.fis.model.TagResourceRequest;
import software.amazon.awssdk.services.fis.model.TagResourceResponse;
import software.amazon.awssdk.services.fis.model.UntagResourceRequest;
import software.amazon.awssdk.services.fis.model.UntagResourceResponse;
import software.amazon.awssdk.services.fis.model.UpdateExperimentTemplateRequest;
import software.amazon.awssdk.services.fis.model.UpdateExperimentTemplateResponse;
import software.amazon.awssdk.services.fis.model.UpdateTargetAccountConfigurationRequest;
import software.amazon.awssdk.services.fis.model.UpdateTargetAccountConfigurationResponse;
import software.amazon.awssdk.services.fis.model.ValidationException;
import software.amazon.awssdk.services.fis.transform.CreateExperimentTemplateRequestMarshaller;
import software.amazon.awssdk.services.fis.transform.CreateTargetAccountConfigurationRequestMarshaller;
import software.amazon.awssdk.services.fis.transform.DeleteExperimentTemplateRequestMarshaller;
import software.amazon.awssdk.services.fis.transform.DeleteTargetAccountConfigurationRequestMarshaller;
import software.amazon.awssdk.services.fis.transform.GetActionRequestMarshaller;
import software.amazon.awssdk.services.fis.transform.GetExperimentRequestMarshaller;
import software.amazon.awssdk.services.fis.transform.GetExperimentTargetAccountConfigurationRequestMarshaller;
import software.amazon.awssdk.services.fis.transform.GetExperimentTemplateRequestMarshaller;
import software.amazon.awssdk.services.fis.transform.GetTargetAccountConfigurationRequestMarshaller;
import software.amazon.awssdk.services.fis.transform.GetTargetResourceTypeRequestMarshaller;
import software.amazon.awssdk.services.fis.transform.ListActionsRequestMarshaller;
import software.amazon.awssdk.services.fis.transform.ListExperimentResolvedTargetsRequestMarshaller;
import software.amazon.awssdk.services.fis.transform.ListExperimentTargetAccountConfigurationsRequestMarshaller;
import software.amazon.awssdk.services.fis.transform.ListExperimentTemplatesRequestMarshaller;
import software.amazon.awssdk.services.fis.transform.ListExperimentsRequestMarshaller;
import software.amazon.awssdk.services.fis.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.fis.transform.ListTargetAccountConfigurationsRequestMarshaller;
import software.amazon.awssdk.services.fis.transform.ListTargetResourceTypesRequestMarshaller;
import software.amazon.awssdk.services.fis.transform.StartExperimentRequestMarshaller;
import software.amazon.awssdk.services.fis.transform.StopExperimentRequestMarshaller;
import software.amazon.awssdk.services.fis.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.fis.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.fis.transform.UpdateExperimentTemplateRequestMarshaller;
import software.amazon.awssdk.services.fis.transform.UpdateTargetAccountConfigurationRequestMarshaller;
import software.amazon.awssdk.utils.Logger;

/**
 * Internal implementation of {@link FisClient}.
 *
 * @see FisClient#builder()
 */
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultFisClient implements FisClient {
    private static final Logger log = Logger.loggerFor(DefaultFisClient.class);

    private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
            .serviceProtocol(AwsServiceProtocol.REST_JSON).build();

    private final SyncClientHandler clientHandler;

    private final AwsJsonProtocolFactory protocolFactory;

    private final SdkClientConfiguration clientConfiguration;

    protected DefaultFisClient(SdkClientConfiguration clientConfiguration) {
        this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
        this.clientConfiguration = clientConfiguration;
        this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
    }

    /**
     * 

* Creates an experiment template. *

*

* An experiment template includes the following components: *

*
    *
  • *

    * Targets: A target can be a specific resource in your Amazon Web Services environment, or one or more * resources that match criteria that you specify, for example, resources that have specific tags. *

    *
  • *
  • *

    * Actions: The actions to carry out on the target. You can specify multiple actions, the duration of each * action, and when to start each action during an experiment. *

    *
  • *
  • *

    * Stop conditions: If a stop condition is triggered while an experiment is running, the experiment is * automatically stopped. You can define a stop condition as a CloudWatch alarm. *

    *
  • *
*

* For more information, see experiment templates in the * Fault Injection Simulator User Guide. *

* * @param createExperimentTemplateRequest * @return Result of the CreateExperimentTemplate operation returned by the service. * @throws ValidationException * The specified input is not valid, or fails to satisfy the constraints for the request. * @throws ConflictException * The request could not be processed because of a conflict. * @throws ResourceNotFoundException * The specified resource cannot be found. * @throws ServiceQuotaExceededException * You have exceeded your service quota. * @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 FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.CreateExperimentTemplate * @see AWS * API Documentation */ @Override public CreateExperimentTemplateResponse createExperimentTemplate( CreateExperimentTemplateRequest createExperimentTemplateRequest) throws ValidationException, ConflictException, ResourceNotFoundException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreateExperimentTemplateResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createExperimentTemplateRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createExperimentTemplateRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateExperimentTemplate"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("CreateExperimentTemplate").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(createExperimentTemplateRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateExperimentTemplateRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Creates a target account configuration for the experiment template. A target account configuration is required * when accountTargeting of experimentOptions is set to multi-account. For * more information, see experiment options in the * Fault Injection Simulator User Guide. *

* * @param createTargetAccountConfigurationRequest * @return Result of the CreateTargetAccountConfiguration operation returned by the service. * @throws ValidationException * The specified input is not valid, or fails to satisfy the constraints for the request. * @throws ConflictException * The request could not be processed because of a conflict. * @throws ResourceNotFoundException * The specified resource cannot be found. * @throws ServiceQuotaExceededException * You have exceeded your service quota. * @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 FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.CreateTargetAccountConfiguration * @see AWS API Documentation */ @Override public CreateTargetAccountConfigurationResponse createTargetAccountConfiguration( CreateTargetAccountConfigurationRequest createTargetAccountConfigurationRequest) throws ValidationException, ConflictException, ResourceNotFoundException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreateTargetAccountConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createTargetAccountConfigurationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createTargetAccountConfigurationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateTargetAccountConfiguration"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("CreateTargetAccountConfiguration").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(createTargetAccountConfigurationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateTargetAccountConfigurationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Deletes the specified experiment template. *

* * @param deleteExperimentTemplateRequest * @return Result of the DeleteExperimentTemplate operation returned by the service. * @throws ValidationException * The specified input is not valid, or fails to satisfy the constraints for the request. * @throws ResourceNotFoundException * The specified resource cannot be 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 FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.DeleteExperimentTemplate * @see AWS * API Documentation */ @Override public DeleteExperimentTemplateResponse deleteExperimentTemplate( DeleteExperimentTemplateRequest deleteExperimentTemplateRequest) throws ValidationException, ResourceNotFoundException, AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteExperimentTemplateResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteExperimentTemplateRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteExperimentTemplateRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteExperimentTemplate"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteExperimentTemplate").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(deleteExperimentTemplateRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteExperimentTemplateRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Deletes the specified target account configuration of the experiment template. *

* * @param deleteTargetAccountConfigurationRequest * @return Result of the DeleteTargetAccountConfiguration operation returned by the service. * @throws ValidationException * The specified input is not valid, or fails to satisfy the constraints for the request. * @throws ResourceNotFoundException * The specified resource cannot be 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 FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.DeleteTargetAccountConfiguration * @see AWS API Documentation */ @Override public DeleteTargetAccountConfigurationResponse deleteTargetAccountConfiguration( DeleteTargetAccountConfigurationRequest deleteTargetAccountConfigurationRequest) throws ValidationException, ResourceNotFoundException, AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteTargetAccountConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteTargetAccountConfigurationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteTargetAccountConfigurationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteTargetAccountConfiguration"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteTargetAccountConfiguration").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(deleteTargetAccountConfigurationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteTargetAccountConfigurationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Gets information about the specified FIS action. *

* * @param getActionRequest * @return Result of the GetAction operation returned by the service. * @throws ValidationException * The specified input is not valid, or fails to satisfy the constraints for the request. * @throws ResourceNotFoundException * The specified resource cannot be 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 FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.GetAction * @see AWS API * Documentation */ @Override public GetActionResponse getAction(GetActionRequest getActionRequest) throws ValidationException, ResourceNotFoundException, AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetActionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getActionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getActionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetAction"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetAction").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(getActionRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetActionRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Gets information about the specified experiment. *

* * @param getExperimentRequest * @return Result of the GetExperiment operation returned by the service. * @throws ValidationException * The specified input is not valid, or fails to satisfy the constraints for the request. * @throws ResourceNotFoundException * The specified resource cannot be 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 FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.GetExperiment * @see AWS API * Documentation */ @Override public GetExperimentResponse getExperiment(GetExperimentRequest getExperimentRequest) throws ValidationException, ResourceNotFoundException, AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetExperimentResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getExperimentRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getExperimentRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetExperiment"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetExperiment").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getExperimentRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetExperimentRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Gets information about the specified target account configuration of the experiment. *

* * @param getExperimentTargetAccountConfigurationRequest * @return Result of the GetExperimentTargetAccountConfiguration operation returned by the service. * @throws ResourceNotFoundException * The specified resource cannot be found. * @throws ValidationException * The specified input is not valid, or fails to satisfy the constraints for the request. * @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 FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.GetExperimentTargetAccountConfiguration * @see AWS API Documentation */ @Override public GetExperimentTargetAccountConfigurationResponse getExperimentTargetAccountConfiguration( GetExperimentTargetAccountConfigurationRequest getExperimentTargetAccountConfigurationRequest) throws ResourceNotFoundException, ValidationException, AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, GetExperimentTargetAccountConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getExperimentTargetAccountConfigurationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getExperimentTargetAccountConfigurationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetExperimentTargetAccountConfiguration"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("GetExperimentTargetAccountConfiguration").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration) .withInput(getExperimentTargetAccountConfigurationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetExperimentTargetAccountConfigurationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Gets information about the specified experiment template. *

* * @param getExperimentTemplateRequest * @return Result of the GetExperimentTemplate operation returned by the service. * @throws ValidationException * The specified input is not valid, or fails to satisfy the constraints for the request. * @throws ResourceNotFoundException * The specified resource cannot be 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 FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.GetExperimentTemplate * @see AWS API * Documentation */ @Override public GetExperimentTemplateResponse getExperimentTemplate(GetExperimentTemplateRequest getExperimentTemplateRequest) throws ValidationException, ResourceNotFoundException, AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetExperimentTemplateResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getExperimentTemplateRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getExperimentTemplateRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetExperimentTemplate"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetExperimentTemplate").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getExperimentTemplateRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetExperimentTemplateRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Gets information about the specified target account configuration of the experiment template. *

* * @param getTargetAccountConfigurationRequest * @return Result of the GetTargetAccountConfiguration operation returned by the service. * @throws ResourceNotFoundException * The specified resource cannot be found. * @throws ValidationException * The specified input is not valid, or fails to satisfy the constraints for the request. * @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 FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.GetTargetAccountConfiguration * @see AWS API Documentation */ @Override public GetTargetAccountConfigurationResponse getTargetAccountConfiguration( GetTargetAccountConfigurationRequest getTargetAccountConfigurationRequest) throws ResourceNotFoundException, ValidationException, AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetTargetAccountConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getTargetAccountConfigurationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getTargetAccountConfigurationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetTargetAccountConfiguration"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("GetTargetAccountConfiguration").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getTargetAccountConfigurationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetTargetAccountConfigurationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Gets information about the specified resource type. *

* * @param getTargetResourceTypeRequest * @return Result of the GetTargetResourceType operation returned by the service. * @throws ValidationException * The specified input is not valid, or fails to satisfy the constraints for the request. * @throws ResourceNotFoundException * The specified resource cannot be 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 FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.GetTargetResourceType * @see AWS API * Documentation */ @Override public GetTargetResourceTypeResponse getTargetResourceType(GetTargetResourceTypeRequest getTargetResourceTypeRequest) throws ValidationException, ResourceNotFoundException, AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetTargetResourceTypeResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getTargetResourceTypeRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getTargetResourceTypeRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetTargetResourceType"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetTargetResourceType").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getTargetResourceTypeRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetTargetResourceTypeRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the available FIS actions. *

* * @param listActionsRequest * @return Result of the ListActions operation returned by the service. * @throws ValidationException * The specified input is not valid, or fails to satisfy the constraints for the request. * @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 FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.ListActions * @see AWS API * Documentation */ @Override public ListActionsResponse listActions(ListActionsRequest listActionsRequest) throws ValidationException, AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListActionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listActionsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listActionsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListActions"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListActions").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(listActionsRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListActionsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the resolved targets information of the specified experiment. *

* * @param listExperimentResolvedTargetsRequest * @return Result of the ListExperimentResolvedTargets operation returned by the service. * @throws ValidationException * The specified input is not valid, or fails to satisfy the constraints for the request. * @throws ResourceNotFoundException * The specified resource cannot be 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 FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.ListExperimentResolvedTargets * @see AWS API Documentation */ @Override public ListExperimentResolvedTargetsResponse listExperimentResolvedTargets( ListExperimentResolvedTargetsRequest listExperimentResolvedTargetsRequest) throws ValidationException, ResourceNotFoundException, AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListExperimentResolvedTargetsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listExperimentResolvedTargetsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listExperimentResolvedTargetsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListExperimentResolvedTargets"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("ListExperimentResolvedTargets").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listExperimentResolvedTargetsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListExperimentResolvedTargetsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the target account configurations of the specified experiment. *

* * @param listExperimentTargetAccountConfigurationsRequest * @return Result of the ListExperimentTargetAccountConfigurations operation returned by the service. * @throws ValidationException * The specified input is not valid, or fails to satisfy the constraints for the request. * @throws ResourceNotFoundException * The specified resource cannot be 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 FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.ListExperimentTargetAccountConfigurations * @see AWS API Documentation */ @Override public ListExperimentTargetAccountConfigurationsResponse listExperimentTargetAccountConfigurations( ListExperimentTargetAccountConfigurationsRequest listExperimentTargetAccountConfigurationsRequest) throws ValidationException, ResourceNotFoundException, AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, ListExperimentTargetAccountConfigurationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration( listExperimentTargetAccountConfigurationsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listExperimentTargetAccountConfigurationsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListExperimentTargetAccountConfigurations"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("ListExperimentTargetAccountConfigurations") .withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(listExperimentTargetAccountConfigurationsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListExperimentTargetAccountConfigurationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists your experiment templates. *

* * @param listExperimentTemplatesRequest * @return Result of the ListExperimentTemplates operation returned by the service. * @throws ValidationException * The specified input is not valid, or fails to satisfy the constraints for the request. * @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 FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.ListExperimentTemplates * @see AWS * API Documentation */ @Override public ListExperimentTemplatesResponse listExperimentTemplates(ListExperimentTemplatesRequest listExperimentTemplatesRequest) throws ValidationException, AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListExperimentTemplatesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listExperimentTemplatesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listExperimentTemplatesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListExperimentTemplates"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("ListExperimentTemplates").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listExperimentTemplatesRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListExperimentTemplatesRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists your experiments. *

* * @param listExperimentsRequest * @return Result of the ListExperiments operation returned by the service. * @throws ValidationException * The specified input is not valid, or fails to satisfy the constraints for the request. * @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 FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.ListExperiments * @see AWS API * Documentation */ @Override public ListExperimentsResponse listExperiments(ListExperimentsRequest listExperimentsRequest) throws ValidationException, AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListExperimentsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listExperimentsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listExperimentsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListExperiments"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListExperiments").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listExperimentsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListExperimentsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the tags for the specified resource. *

* * @param listTagsForResourceRequest * @return Result of the ListTagsForResource operation returned by the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.ListTagsForResource * @see AWS API * Documentation */ @Override public ListTagsForResourceResponse listTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest) throws AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListTagsForResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listTagsForResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListTagsForResource").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listTagsForResourceRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the target account configurations of the specified experiment template. *

* * @param listTargetAccountConfigurationsRequest * @return Result of the ListTargetAccountConfigurations operation returned by the service. * @throws ValidationException * The specified input is not valid, or fails to satisfy the constraints for the request. * @throws ResourceNotFoundException * The specified resource cannot be 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 FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.ListTargetAccountConfigurations * @see AWS API Documentation */ @Override public ListTargetAccountConfigurationsResponse listTargetAccountConfigurations( ListTargetAccountConfigurationsRequest listTargetAccountConfigurationsRequest) throws ValidationException, ResourceNotFoundException, AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListTargetAccountConfigurationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listTargetAccountConfigurationsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listTargetAccountConfigurationsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTargetAccountConfigurations"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("ListTargetAccountConfigurations").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listTargetAccountConfigurationsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListTargetAccountConfigurationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the target resource types. *

* * @param listTargetResourceTypesRequest * @return Result of the ListTargetResourceTypes operation returned by the service. * @throws ValidationException * The specified input is not valid, or fails to satisfy the constraints for the request. * @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 FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.ListTargetResourceTypes * @see AWS * API Documentation */ @Override public ListTargetResourceTypesResponse listTargetResourceTypes(ListTargetResourceTypesRequest listTargetResourceTypesRequest) throws ValidationException, AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListTargetResourceTypesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listTargetResourceTypesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listTargetResourceTypesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTargetResourceTypes"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("ListTargetResourceTypes").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listTargetResourceTypesRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListTargetResourceTypesRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Starts running an experiment from the specified experiment template. *

* * @param startExperimentRequest * @return Result of the StartExperiment operation returned by the service. * @throws ValidationException * The specified input is not valid, or fails to satisfy the constraints for the request. * @throws ConflictException * The request could not be processed because of a conflict. * @throws ResourceNotFoundException * The specified resource cannot be found. * @throws ServiceQuotaExceededException * You have exceeded your service quota. * @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 FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.StartExperiment * @see AWS API * Documentation */ @Override public StartExperimentResponse startExperiment(StartExperimentRequest startExperimentRequest) throws ValidationException, ConflictException, ResourceNotFoundException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, StartExperimentResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(startExperimentRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, startExperimentRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StartExperiment"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("StartExperiment").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(startExperimentRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new StartExperimentRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Stops the specified experiment. *

* * @param stopExperimentRequest * @return Result of the StopExperiment operation returned by the service. * @throws ValidationException * The specified input is not valid, or fails to satisfy the constraints for the request. * @throws ResourceNotFoundException * The specified resource cannot be 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 FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.StopExperiment * @see AWS API * Documentation */ @Override public StopExperimentResponse stopExperiment(StopExperimentRequest stopExperimentRequest) throws ValidationException, ResourceNotFoundException, AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, StopExperimentResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(stopExperimentRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, stopExperimentRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StopExperiment"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("StopExperiment").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(stopExperimentRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new StopExperimentRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Applies the specified tags to the specified resource. *

* * @param tagResourceRequest * @return Result of the TagResource operation returned by the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.TagResource * @see AWS API * Documentation */ @Override public TagResourceResponse tagResource(TagResourceRequest tagResourceRequest) throws AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, TagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(tagResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, tagResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("TagResource").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(tagResourceRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new TagResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Removes the specified tags from the specified resource. *

* * @param untagResourceRequest * @return Result of the UntagResource operation returned by the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.UntagResource * @see AWS API * Documentation */ @Override public UntagResourceResponse untagResource(UntagResourceRequest untagResourceRequest) throws AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UntagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(untagResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, untagResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UntagResource").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(untagResourceRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UntagResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Updates the specified experiment template. *

* * @param updateExperimentTemplateRequest * @return Result of the UpdateExperimentTemplate operation returned by the service. * @throws ValidationException * The specified input is not valid, or fails to satisfy the constraints for the request. * @throws ResourceNotFoundException * The specified resource cannot be found. * @throws ServiceQuotaExceededException * You have exceeded your service quota. * @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 FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.UpdateExperimentTemplate * @see AWS * API Documentation */ @Override public UpdateExperimentTemplateResponse updateExperimentTemplate( UpdateExperimentTemplateRequest updateExperimentTemplateRequest) throws ValidationException, ResourceNotFoundException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateExperimentTemplateResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateExperimentTemplateRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateExperimentTemplateRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateExperimentTemplate"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateExperimentTemplate").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(updateExperimentTemplateRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateExperimentTemplateRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Updates the target account configuration for the specified experiment template. *

* * @param updateTargetAccountConfigurationRequest * @return Result of the UpdateTargetAccountConfiguration operation returned by the service. * @throws ValidationException * The specified input is not valid, or fails to satisfy the constraints for the request. * @throws ResourceNotFoundException * The specified resource cannot be 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 FisException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample FisClient.UpdateTargetAccountConfiguration * @see AWS API Documentation */ @Override public UpdateTargetAccountConfigurationResponse updateTargetAccountConfiguration( UpdateTargetAccountConfigurationRequest updateTargetAccountConfigurationRequest) throws ValidationException, ResourceNotFoundException, AwsServiceException, SdkClientException, FisException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateTargetAccountConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateTargetAccountConfigurationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateTargetAccountConfigurationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "fis"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateTargetAccountConfiguration"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateTargetAccountConfiguration").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(updateTargetAccountConfigurationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateTargetAccountConfigurationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } @Override public final String serviceName() { return SERVICE_NAME; } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); } if (publishers == null || publishers.isEmpty()) { publishers = clientConfiguration.option(SdkClientOption.METRIC_PUBLISHERS); } if (publishers == null) { publishers = Collections.emptyList(); } return publishers; } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata) { return protocolFactory.createErrorResponseHandler(operationMetadata); } private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, SdkClientConfiguration clientConfiguration) { List plugins = request.overrideConfiguration().map(c -> c.plugins()).orElse(Collections.emptyList()); SdkClientConfiguration.Builder configuration = clientConfiguration.toBuilder(); if (plugins.isEmpty()) { return configuration.build(); } FisServiceClientConfigurationBuilder serviceConfigBuilder = new FisServiceClientConfigurationBuilder(configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } return configuration.build(); } private > T init(T builder) { return builder .clientConfiguration(clientConfiguration) .defaultServiceExceptionSupplier(FisException::builder) .protocol(AwsJsonProtocol.REST_JSON) .protocolVersion("1.1") .registerModeledException( ExceptionMetadata.builder().errorCode("ServiceQuotaExceededException") .exceptionBuilderSupplier(ServiceQuotaExceededException::builder).httpStatusCode(402).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 final FisServiceClientConfiguration serviceClientConfiguration() { return new FisServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build(); } @Override public void close() { clientHandler.close(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy