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

software.amazon.awssdk.services.mq.DefaultMqClient Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AmazonMQ module holds the client classes that are used for communicating with AmazonMQ Service

There is a newer version: 2.28.4
Show newest version
/*
 * 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.mq;

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.mq.internal.MqServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.mq.model.BadRequestException;
import software.amazon.awssdk.services.mq.model.ConflictException;
import software.amazon.awssdk.services.mq.model.CreateBrokerRequest;
import software.amazon.awssdk.services.mq.model.CreateBrokerResponse;
import software.amazon.awssdk.services.mq.model.CreateConfigurationRequest;
import software.amazon.awssdk.services.mq.model.CreateConfigurationResponse;
import software.amazon.awssdk.services.mq.model.CreateTagsRequest;
import software.amazon.awssdk.services.mq.model.CreateTagsResponse;
import software.amazon.awssdk.services.mq.model.CreateUserRequest;
import software.amazon.awssdk.services.mq.model.CreateUserResponse;
import software.amazon.awssdk.services.mq.model.DeleteBrokerRequest;
import software.amazon.awssdk.services.mq.model.DeleteBrokerResponse;
import software.amazon.awssdk.services.mq.model.DeleteTagsRequest;
import software.amazon.awssdk.services.mq.model.DeleteTagsResponse;
import software.amazon.awssdk.services.mq.model.DeleteUserRequest;
import software.amazon.awssdk.services.mq.model.DeleteUserResponse;
import software.amazon.awssdk.services.mq.model.DescribeBrokerEngineTypesRequest;
import software.amazon.awssdk.services.mq.model.DescribeBrokerEngineTypesResponse;
import software.amazon.awssdk.services.mq.model.DescribeBrokerInstanceOptionsRequest;
import software.amazon.awssdk.services.mq.model.DescribeBrokerInstanceOptionsResponse;
import software.amazon.awssdk.services.mq.model.DescribeBrokerRequest;
import software.amazon.awssdk.services.mq.model.DescribeBrokerResponse;
import software.amazon.awssdk.services.mq.model.DescribeConfigurationRequest;
import software.amazon.awssdk.services.mq.model.DescribeConfigurationResponse;
import software.amazon.awssdk.services.mq.model.DescribeConfigurationRevisionRequest;
import software.amazon.awssdk.services.mq.model.DescribeConfigurationRevisionResponse;
import software.amazon.awssdk.services.mq.model.DescribeUserRequest;
import software.amazon.awssdk.services.mq.model.DescribeUserResponse;
import software.amazon.awssdk.services.mq.model.ForbiddenException;
import software.amazon.awssdk.services.mq.model.InternalServerErrorException;
import software.amazon.awssdk.services.mq.model.ListBrokersRequest;
import software.amazon.awssdk.services.mq.model.ListBrokersResponse;
import software.amazon.awssdk.services.mq.model.ListConfigurationRevisionsRequest;
import software.amazon.awssdk.services.mq.model.ListConfigurationRevisionsResponse;
import software.amazon.awssdk.services.mq.model.ListConfigurationsRequest;
import software.amazon.awssdk.services.mq.model.ListConfigurationsResponse;
import software.amazon.awssdk.services.mq.model.ListTagsRequest;
import software.amazon.awssdk.services.mq.model.ListTagsResponse;
import software.amazon.awssdk.services.mq.model.ListUsersRequest;
import software.amazon.awssdk.services.mq.model.ListUsersResponse;
import software.amazon.awssdk.services.mq.model.MqException;
import software.amazon.awssdk.services.mq.model.NotFoundException;
import software.amazon.awssdk.services.mq.model.PromoteRequest;
import software.amazon.awssdk.services.mq.model.PromoteResponse;
import software.amazon.awssdk.services.mq.model.RebootBrokerRequest;
import software.amazon.awssdk.services.mq.model.RebootBrokerResponse;
import software.amazon.awssdk.services.mq.model.UnauthorizedException;
import software.amazon.awssdk.services.mq.model.UpdateBrokerRequest;
import software.amazon.awssdk.services.mq.model.UpdateBrokerResponse;
import software.amazon.awssdk.services.mq.model.UpdateConfigurationRequest;
import software.amazon.awssdk.services.mq.model.UpdateConfigurationResponse;
import software.amazon.awssdk.services.mq.model.UpdateUserRequest;
import software.amazon.awssdk.services.mq.model.UpdateUserResponse;
import software.amazon.awssdk.services.mq.transform.CreateBrokerRequestMarshaller;
import software.amazon.awssdk.services.mq.transform.CreateConfigurationRequestMarshaller;
import software.amazon.awssdk.services.mq.transform.CreateTagsRequestMarshaller;
import software.amazon.awssdk.services.mq.transform.CreateUserRequestMarshaller;
import software.amazon.awssdk.services.mq.transform.DeleteBrokerRequestMarshaller;
import software.amazon.awssdk.services.mq.transform.DeleteTagsRequestMarshaller;
import software.amazon.awssdk.services.mq.transform.DeleteUserRequestMarshaller;
import software.amazon.awssdk.services.mq.transform.DescribeBrokerEngineTypesRequestMarshaller;
import software.amazon.awssdk.services.mq.transform.DescribeBrokerInstanceOptionsRequestMarshaller;
import software.amazon.awssdk.services.mq.transform.DescribeBrokerRequestMarshaller;
import software.amazon.awssdk.services.mq.transform.DescribeConfigurationRequestMarshaller;
import software.amazon.awssdk.services.mq.transform.DescribeConfigurationRevisionRequestMarshaller;
import software.amazon.awssdk.services.mq.transform.DescribeUserRequestMarshaller;
import software.amazon.awssdk.services.mq.transform.ListBrokersRequestMarshaller;
import software.amazon.awssdk.services.mq.transform.ListConfigurationRevisionsRequestMarshaller;
import software.amazon.awssdk.services.mq.transform.ListConfigurationsRequestMarshaller;
import software.amazon.awssdk.services.mq.transform.ListTagsRequestMarshaller;
import software.amazon.awssdk.services.mq.transform.ListUsersRequestMarshaller;
import software.amazon.awssdk.services.mq.transform.PromoteRequestMarshaller;
import software.amazon.awssdk.services.mq.transform.RebootBrokerRequestMarshaller;
import software.amazon.awssdk.services.mq.transform.UpdateBrokerRequestMarshaller;
import software.amazon.awssdk.services.mq.transform.UpdateConfigurationRequestMarshaller;
import software.amazon.awssdk.services.mq.transform.UpdateUserRequestMarshaller;
import software.amazon.awssdk.utils.Logger;

/**
 * Internal implementation of {@link MqClient}.
 *
 * @see MqClient#builder()
 */
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultMqClient implements MqClient {
    private static final Logger log = Logger.loggerFor(DefaultMqClient.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 DefaultMqClient(SdkClientConfiguration clientConfiguration) {
        this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
        this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
        this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
    }

    /**
     * 

* Creates a broker. Note: This API is asynchronous. *

*

* To create a broker, you must either use the AmazonMQFullAccess IAM policy or include the following EC2 * permissions in your IAM policy. *

*
    *
  • *

    * ec2:CreateNetworkInterface *

    *

    * This permission is required to allow Amazon MQ to create an elastic network interface (ENI) on behalf of your * account. *

    *
  • *
  • *

    * ec2:CreateNetworkInterfacePermission *

    *

    * This permission is required to attach the ENI to the broker instance. *

    *
  • *
  • *

    * ec2:DeleteNetworkInterface *

    *
  • *
  • *

    * ec2:DeleteNetworkInterfacePermission *

    *
  • *
  • *

    * ec2:DetachNetworkInterface *

    *
  • *
  • *

    * ec2:DescribeInternetGateways *

    *
  • *
  • *

    * ec2:DescribeNetworkInterfaces *

    *
  • *
  • *

    * ec2:DescribeNetworkInterfacePermissions *

    *
  • *
  • *

    * ec2:DescribeRouteTables *

    *
  • *
  • *

    * ec2:DescribeSecurityGroups *

    *
  • *
  • *

    * ec2:DescribeSubnets *

    *
  • *
  • *

    * ec2:DescribeVpcs *

    *
  • *
*

* For more information, see Create an IAM User and Get Your Amazon Web Services Credentials and Never Modify or Delete the Amazon MQ Elastic Network Interface in the Amazon MQ Developer Guide. *

* * @param createBrokerRequest * Creates a broker using the specified properties. * @return Result of the CreateBroker operation returned by the service. * @throws BadRequestException * HTTP Status Code 400: Bad request due to incorrect input. Correct your request and then retry it. * @throws UnauthorizedException * HTTP Status Code 401: Unauthorized request. The provided credentials couldn't be validated. * @throws InternalServerErrorException * HTTP Status Code 500: Unexpected internal server error. Retrying your request might resolve the issue. * @throws ConflictException * HTTP Status Code 409: Conflict. This broker name already exists. Retry your request with another name. * @throws ForbiddenException * HTTP Status Code 403: Access forbidden. Correct your credentials and then retry your 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 MqException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample MqClient.CreateBroker * @see AWS API * Documentation */ @Override public CreateBrokerResponse createBroker(CreateBrokerRequest createBrokerRequest) throws BadRequestException, UnauthorizedException, InternalServerErrorException, ConflictException, ForbiddenException, AwsServiceException, SdkClientException, MqException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, CreateBrokerResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createBrokerRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createBrokerRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "mq"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateBroker"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateBroker").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(createBrokerRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateBrokerRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Creates a new configuration for the specified configuration name. Amazon MQ uses the default configuration (the * engine type and version). *

* * @param createConfigurationRequest * Creates a new configuration for the specified configuration name. Amazon MQ uses the default configuration * (the engine type and version). * @return Result of the CreateConfiguration operation returned by the service. * @throws BadRequestException * HTTP Status Code 400: Bad request due to incorrect input. Correct your request and then retry it. * @throws InternalServerErrorException * HTTP Status Code 500: Unexpected internal server error. Retrying your request might resolve the issue. * @throws ConflictException * HTTP Status Code 409: Conflict. This broker name already exists. Retry your request with another name. * @throws ForbiddenException * HTTP Status Code 403: Access forbidden. Correct your credentials and then retry your 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 MqException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample MqClient.CreateConfiguration * @see AWS API * Documentation */ @Override public CreateConfigurationResponse createConfiguration(CreateConfigurationRequest createConfigurationRequest) throws BadRequestException, InternalServerErrorException, ConflictException, ForbiddenException, AwsServiceException, SdkClientException, MqException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreateConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createConfigurationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createConfigurationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "mq"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateConfiguration"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateConfiguration").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(createConfigurationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateConfigurationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Add a tag to a resource. *

* * @param createTagsRequest * A map of the key-value pairs for the resource tag. * @return Result of the CreateTags operation returned by the service. * @throws NotFoundException * HTTP Status Code 404: Resource not found due to incorrect input. Correct your request and then retry it. * @throws BadRequestException * HTTP Status Code 400: Bad request due to incorrect input. Correct your request and then retry it. * @throws InternalServerErrorException * HTTP Status Code 500: Unexpected internal server error. Retrying your request might resolve the issue. * @throws ForbiddenException * HTTP Status Code 403: Access forbidden. Correct your credentials and then retry your 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 MqException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample MqClient.CreateTags * @see AWS API * Documentation */ @Override public CreateTagsResponse createTags(CreateTagsRequest createTagsRequest) throws NotFoundException, BadRequestException, InternalServerErrorException, ForbiddenException, AwsServiceException, SdkClientException, MqException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, CreateTagsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createTagsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createTagsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "mq"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateTags"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateTags").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(createTagsRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateTagsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Creates an ActiveMQ user. *

* *

* Do not add personally identifiable information (PII) or other confidential or sensitive information in broker * usernames. Broker usernames are accessible to other Amazon Web Services services, including CloudWatch Logs. * Broker usernames are not intended to be used for private or sensitive data. *

*
* * @param createUserRequest * Creates a new ActiveMQ user. * @return Result of the CreateUser operation returned by the service. * @throws NotFoundException * HTTP Status Code 404: Resource not found due to incorrect input. Correct your request and then retry it. * @throws BadRequestException * HTTP Status Code 400: Bad request due to incorrect input. Correct your request and then retry it. * @throws InternalServerErrorException * HTTP Status Code 500: Unexpected internal server error. Retrying your request might resolve the issue. * @throws ConflictException * HTTP Status Code 409: Conflict. This broker name already exists. Retry your request with another name. * @throws ForbiddenException * HTTP Status Code 403: Access forbidden. Correct your credentials and then retry your 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 MqException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample MqClient.CreateUser * @see AWS API * Documentation */ @Override public CreateUserResponse createUser(CreateUserRequest createUserRequest) throws NotFoundException, BadRequestException, InternalServerErrorException, ConflictException, ForbiddenException, AwsServiceException, SdkClientException, MqException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, CreateUserResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createUserRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createUserRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "mq"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateUser"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateUser").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(createUserRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateUserRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Deletes a broker. Note: This API is asynchronous. *

* * @param deleteBrokerRequest * @return Result of the DeleteBroker operation returned by the service. * @throws NotFoundException * HTTP Status Code 404: Resource not found due to incorrect input. Correct your request and then retry it. * @throws BadRequestException * HTTP Status Code 400: Bad request due to incorrect input. Correct your request and then retry it. * @throws InternalServerErrorException * HTTP Status Code 500: Unexpected internal server error. Retrying your request might resolve the issue. * @throws ForbiddenException * HTTP Status Code 403: Access forbidden. Correct your credentials and then retry your 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 MqException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample MqClient.DeleteBroker * @see AWS API * Documentation */ @Override public DeleteBrokerResponse deleteBroker(DeleteBrokerRequest deleteBrokerRequest) throws NotFoundException, BadRequestException, InternalServerErrorException, ForbiddenException, AwsServiceException, SdkClientException, MqException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteBrokerResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteBrokerRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteBrokerRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "mq"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteBroker"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteBroker").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(deleteBrokerRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteBrokerRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Removes a tag from a resource. *

* * @param deleteTagsRequest * @return Result of the DeleteTags operation returned by the service. * @throws NotFoundException * HTTP Status Code 404: Resource not found due to incorrect input. Correct your request and then retry it. * @throws BadRequestException * HTTP Status Code 400: Bad request due to incorrect input. Correct your request and then retry it. * @throws InternalServerErrorException * HTTP Status Code 500: Unexpected internal server error. Retrying your request might resolve the issue. * @throws ForbiddenException * HTTP Status Code 403: Access forbidden. Correct your credentials and then retry your 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 MqException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample MqClient.DeleteTags * @see AWS API * Documentation */ @Override public DeleteTagsResponse deleteTags(DeleteTagsRequest deleteTagsRequest) throws NotFoundException, BadRequestException, InternalServerErrorException, ForbiddenException, AwsServiceException, SdkClientException, MqException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteTagsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteTagsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteTagsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "mq"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteTags"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteTags").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(deleteTagsRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteTagsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Deletes an ActiveMQ user. *

* * @param deleteUserRequest * @return Result of the DeleteUser operation returned by the service. * @throws NotFoundException * HTTP Status Code 404: Resource not found due to incorrect input. Correct your request and then retry it. * @throws BadRequestException * HTTP Status Code 400: Bad request due to incorrect input. Correct your request and then retry it. * @throws InternalServerErrorException * HTTP Status Code 500: Unexpected internal server error. Retrying your request might resolve the issue. * @throws ForbiddenException * HTTP Status Code 403: Access forbidden. Correct your credentials and then retry your 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 MqException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample MqClient.DeleteUser * @see AWS API * Documentation */ @Override public DeleteUserResponse deleteUser(DeleteUserRequest deleteUserRequest) throws NotFoundException, BadRequestException, InternalServerErrorException, ForbiddenException, AwsServiceException, SdkClientException, MqException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteUserResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteUserRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteUserRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "mq"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteUser"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteUser").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(deleteUserRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteUserRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns information about the specified broker. *

* * @param describeBrokerRequest * @return Result of the DescribeBroker operation returned by the service. * @throws NotFoundException * HTTP Status Code 404: Resource not found due to incorrect input. Correct your request and then retry it. * @throws BadRequestException * HTTP Status Code 400: Bad request due to incorrect input. Correct your request and then retry it. * @throws InternalServerErrorException * HTTP Status Code 500: Unexpected internal server error. Retrying your request might resolve the issue. * @throws ForbiddenException * HTTP Status Code 403: Access forbidden. Correct your credentials and then retry your 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 MqException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample MqClient.DescribeBroker * @see AWS API * Documentation */ @Override public DescribeBrokerResponse describeBroker(DescribeBrokerRequest describeBrokerRequest) throws NotFoundException, BadRequestException, InternalServerErrorException, ForbiddenException, AwsServiceException, SdkClientException, MqException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DescribeBrokerResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeBrokerRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeBrokerRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "mq"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeBroker"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DescribeBroker").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(describeBrokerRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeBrokerRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describe available engine types and versions. *

* * @param describeBrokerEngineTypesRequest * @return Result of the DescribeBrokerEngineTypes operation returned by the service. * @throws BadRequestException * HTTP Status Code 400: Bad request due to incorrect input. Correct your request and then retry it. * @throws InternalServerErrorException * HTTP Status Code 500: Unexpected internal server error. Retrying your request might resolve the issue. * @throws ForbiddenException * HTTP Status Code 403: Access forbidden. Correct your credentials and then retry your 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 MqException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample MqClient.DescribeBrokerEngineTypes * @see AWS * API Documentation */ @Override public DescribeBrokerEngineTypesResponse describeBrokerEngineTypes( DescribeBrokerEngineTypesRequest describeBrokerEngineTypesRequest) throws BadRequestException, InternalServerErrorException, ForbiddenException, AwsServiceException, SdkClientException, MqException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeBrokerEngineTypesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeBrokerEngineTypesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeBrokerEngineTypesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "mq"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeBrokerEngineTypes"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeBrokerEngineTypes").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(describeBrokerEngineTypesRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeBrokerEngineTypesRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describe available broker instance options. *

* * @param describeBrokerInstanceOptionsRequest * @return Result of the DescribeBrokerInstanceOptions operation returned by the service. * @throws BadRequestException * HTTP Status Code 400: Bad request due to incorrect input. Correct your request and then retry it. * @throws InternalServerErrorException * HTTP Status Code 500: Unexpected internal server error. Retrying your request might resolve the issue. * @throws ForbiddenException * HTTP Status Code 403: Access forbidden. Correct your credentials and then retry your 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 MqException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample MqClient.DescribeBrokerInstanceOptions * @see AWS API Documentation */ @Override public DescribeBrokerInstanceOptionsResponse describeBrokerInstanceOptions( DescribeBrokerInstanceOptionsRequest describeBrokerInstanceOptionsRequest) throws BadRequestException, InternalServerErrorException, ForbiddenException, AwsServiceException, SdkClientException, MqException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeBrokerInstanceOptionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeBrokerInstanceOptionsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeBrokerInstanceOptionsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "mq"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeBrokerInstanceOptions"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeBrokerInstanceOptions").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(describeBrokerInstanceOptionsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeBrokerInstanceOptionsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns information about the specified configuration. *

* * @param describeConfigurationRequest * @return Result of the DescribeConfiguration operation returned by the service. * @throws NotFoundException * HTTP Status Code 404: Resource not found due to incorrect input. Correct your request and then retry it. * @throws BadRequestException * HTTP Status Code 400: Bad request due to incorrect input. Correct your request and then retry it. * @throws InternalServerErrorException * HTTP Status Code 500: Unexpected internal server error. Retrying your request might resolve the issue. * @throws ForbiddenException * HTTP Status Code 403: Access forbidden. Correct your credentials and then retry your 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 MqException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample MqClient.DescribeConfiguration * @see AWS API * Documentation */ @Override public DescribeConfigurationResponse describeConfiguration(DescribeConfigurationRequest describeConfigurationRequest) throws NotFoundException, BadRequestException, InternalServerErrorException, ForbiddenException, AwsServiceException, SdkClientException, MqException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeConfigurationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeConfigurationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "mq"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeConfiguration"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DescribeConfiguration").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(describeConfigurationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeConfigurationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns the specified configuration revision for the specified configuration. *

* * @param describeConfigurationRevisionRequest * @return Result of the DescribeConfigurationRevision operation returned by the service. * @throws NotFoundException * HTTP Status Code 404: Resource not found due to incorrect input. Correct your request and then retry it. * @throws BadRequestException * HTTP Status Code 400: Bad request due to incorrect input. Correct your request and then retry it. * @throws InternalServerErrorException * HTTP Status Code 500: Unexpected internal server error. Retrying your request might resolve the issue. * @throws ForbiddenException * HTTP Status Code 403: Access forbidden. Correct your credentials and then retry your 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 MqException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample MqClient.DescribeConfigurationRevision * @see AWS API Documentation */ @Override public DescribeConfigurationRevisionResponse describeConfigurationRevision( DescribeConfigurationRevisionRequest describeConfigurationRevisionRequest) throws NotFoundException, BadRequestException, InternalServerErrorException, ForbiddenException, AwsServiceException, SdkClientException, MqException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeConfigurationRevisionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeConfigurationRevisionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeConfigurationRevisionRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "mq"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeConfigurationRevision"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeConfigurationRevision").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(describeConfigurationRevisionRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeConfigurationRevisionRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns information about an ActiveMQ user. *

* * @param describeUserRequest * @return Result of the DescribeUser operation returned by the service. * @throws NotFoundException * HTTP Status Code 404: Resource not found due to incorrect input. Correct your request and then retry it. * @throws BadRequestException * HTTP Status Code 400: Bad request due to incorrect input. Correct your request and then retry it. * @throws InternalServerErrorException * HTTP Status Code 500: Unexpected internal server error. Retrying your request might resolve the issue. * @throws ForbiddenException * HTTP Status Code 403: Access forbidden. Correct your credentials and then retry your 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 MqException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample MqClient.DescribeUser * @see AWS API * Documentation */ @Override public DescribeUserResponse describeUser(DescribeUserRequest describeUserRequest) throws NotFoundException, BadRequestException, InternalServerErrorException, ForbiddenException, AwsServiceException, SdkClientException, MqException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DescribeUserResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeUserRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeUserRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "mq"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeUser"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DescribeUser").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(describeUserRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeUserRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns a list of all brokers. *

* * @param listBrokersRequest * @return Result of the ListBrokers operation returned by the service. * @throws BadRequestException * HTTP Status Code 400: Bad request due to incorrect input. Correct your request and then retry it. * @throws InternalServerErrorException * HTTP Status Code 500: Unexpected internal server error. Retrying your request might resolve the issue. * @throws ForbiddenException * HTTP Status Code 403: Access forbidden. Correct your credentials and then retry your 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 MqException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample MqClient.ListBrokers * @see AWS API * Documentation */ @Override public ListBrokersResponse listBrokers(ListBrokersRequest listBrokersRequest) throws BadRequestException, InternalServerErrorException, ForbiddenException, AwsServiceException, SdkClientException, MqException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListBrokersResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listBrokersRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listBrokersRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "mq"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListBrokers"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListBrokers").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(listBrokersRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListBrokersRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns a list of all revisions for the specified configuration. *

* * @param listConfigurationRevisionsRequest * @return Result of the ListConfigurationRevisions operation returned by the service. * @throws NotFoundException * HTTP Status Code 404: Resource not found due to incorrect input. Correct your request and then retry it. * @throws BadRequestException * HTTP Status Code 400: Bad request due to incorrect input. Correct your request and then retry it. * @throws InternalServerErrorException * HTTP Status Code 500: Unexpected internal server error. Retrying your request might resolve the issue. * @throws ForbiddenException * HTTP Status Code 403: Access forbidden. Correct your credentials and then retry your 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 MqException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample MqClient.ListConfigurationRevisions * @see AWS * API Documentation */ @Override public ListConfigurationRevisionsResponse listConfigurationRevisions( ListConfigurationRevisionsRequest listConfigurationRevisionsRequest) throws NotFoundException, BadRequestException, InternalServerErrorException, ForbiddenException, AwsServiceException, SdkClientException, MqException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListConfigurationRevisionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listConfigurationRevisionsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listConfigurationRevisionsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "mq"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListConfigurationRevisions"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("ListConfigurationRevisions").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listConfigurationRevisionsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListConfigurationRevisionsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns a list of all configurations. *

* * @param listConfigurationsRequest * @return Result of the ListConfigurations operation returned by the service. * @throws BadRequestException * HTTP Status Code 400: Bad request due to incorrect input. Correct your request and then retry it. * @throws InternalServerErrorException * HTTP Status Code 500: Unexpected internal server error. Retrying your request might resolve the issue. * @throws ForbiddenException * HTTP Status Code 403: Access forbidden. Correct your credentials and then retry your 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 MqException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample MqClient.ListConfigurations * @see AWS API * Documentation */ @Override public ListConfigurationsResponse listConfigurations(ListConfigurationsRequest listConfigurationsRequest) throws BadRequestException, InternalServerErrorException, ForbiddenException, AwsServiceException, SdkClientException, MqException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListConfigurationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listConfigurationsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listConfigurationsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "mq"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListConfigurations"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListConfigurations").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listConfigurationsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListConfigurationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists tags for a resource. *

* * @param listTagsRequest * @return Result of the ListTags operation returned by the service. * @throws NotFoundException * HTTP Status Code 404: Resource not found due to incorrect input. Correct your request and then retry it. * @throws BadRequestException * HTTP Status Code 400: Bad request due to incorrect input. Correct your request and then retry it. * @throws InternalServerErrorException * HTTP Status Code 500: Unexpected internal server error. Retrying your request might resolve the issue. * @throws ForbiddenException * HTTP Status Code 403: Access forbidden. Correct your credentials and then retry your 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 MqException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample MqClient.ListTags * @see AWS API * Documentation */ @Override public ListTagsResponse listTags(ListTagsRequest listTagsRequest) throws NotFoundException, BadRequestException, InternalServerErrorException, ForbiddenException, AwsServiceException, SdkClientException, MqException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListTagsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listTagsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "mq"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTags"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListTags").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(listTagsRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListTagsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns a list of all ActiveMQ users. *

* * @param listUsersRequest * @return Result of the ListUsers operation returned by the service. * @throws NotFoundException * HTTP Status Code 404: Resource not found due to incorrect input. Correct your request and then retry it. * @throws BadRequestException * HTTP Status Code 400: Bad request due to incorrect input. Correct your request and then retry it. * @throws InternalServerErrorException * HTTP Status Code 500: Unexpected internal server error. Retrying your request might resolve the issue. * @throws ForbiddenException * HTTP Status Code 403: Access forbidden. Correct your credentials and then retry your 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 MqException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample MqClient.ListUsers * @see AWS API * Documentation */ @Override public ListUsersResponse listUsers(ListUsersRequest listUsersRequest) throws NotFoundException, BadRequestException, InternalServerErrorException, ForbiddenException, AwsServiceException, SdkClientException, MqException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListUsersResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listUsersRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listUsersRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "mq"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListUsers"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListUsers").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(listUsersRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListUsersRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Promotes a data replication replica broker to the primary broker role. *

* * @param promoteRequest * Promotes a data replication replica broker to the primary broker role. * @return Result of the Promote operation returned by the service. * @throws NotFoundException * HTTP Status Code 404: Resource not found due to incorrect input. Correct your request and then retry it. * @throws BadRequestException * HTTP Status Code 400: Bad request due to incorrect input. Correct your request and then retry it. * @throws InternalServerErrorException * HTTP Status Code 500: Unexpected internal server error. Retrying your request might resolve the issue. * @throws ForbiddenException * HTTP Status Code 403: Access forbidden. Correct your credentials and then retry your 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 MqException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample MqClient.Promote * @see AWS API * Documentation */ @Override public PromoteResponse promote(PromoteRequest promoteRequest) throws NotFoundException, BadRequestException, InternalServerErrorException, ForbiddenException, AwsServiceException, SdkClientException, MqException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, PromoteResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(promoteRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, promoteRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "mq"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "Promote"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("Promote").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(promoteRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new PromoteRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Reboots a broker. Note: This API is asynchronous. *

* * @param rebootBrokerRequest * @return Result of the RebootBroker operation returned by the service. * @throws NotFoundException * HTTP Status Code 404: Resource not found due to incorrect input. Correct your request and then retry it. * @throws BadRequestException * HTTP Status Code 400: Bad request due to incorrect input. Correct your request and then retry it. * @throws InternalServerErrorException * HTTP Status Code 500: Unexpected internal server error. Retrying your request might resolve the issue. * @throws ForbiddenException * HTTP Status Code 403: Access forbidden. Correct your credentials and then retry your 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 MqException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample MqClient.RebootBroker * @see AWS API * Documentation */ @Override public RebootBrokerResponse rebootBroker(RebootBrokerRequest rebootBrokerRequest) throws NotFoundException, BadRequestException, InternalServerErrorException, ForbiddenException, AwsServiceException, SdkClientException, MqException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, RebootBrokerResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(rebootBrokerRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, rebootBrokerRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "mq"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RebootBroker"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("RebootBroker").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(rebootBrokerRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new RebootBrokerRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Adds a pending configuration change to a broker. *

* * @param updateBrokerRequest * Updates the broker using the specified properties. * @return Result of the UpdateBroker operation returned by the service. * @throws NotFoundException * HTTP Status Code 404: Resource not found due to incorrect input. Correct your request and then retry it. * @throws BadRequestException * HTTP Status Code 400: Bad request due to incorrect input. Correct your request and then retry it. * @throws InternalServerErrorException * HTTP Status Code 500: Unexpected internal server error. Retrying your request might resolve the issue. * @throws ConflictException * HTTP Status Code 409: Conflict. This broker name already exists. Retry your request with another name. * @throws ForbiddenException * HTTP Status Code 403: Access forbidden. Correct your credentials and then retry your 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 MqException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample MqClient.UpdateBroker * @see AWS API * Documentation */ @Override public UpdateBrokerResponse updateBroker(UpdateBrokerRequest updateBrokerRequest) throws NotFoundException, BadRequestException, InternalServerErrorException, ConflictException, ForbiddenException, AwsServiceException, SdkClientException, MqException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UpdateBrokerResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateBrokerRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateBrokerRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "mq"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateBroker"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UpdateBroker").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(updateBrokerRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateBrokerRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Updates the specified configuration. *

* * @param updateConfigurationRequest * Updates the specified configuration. * @return Result of the UpdateConfiguration operation returned by the service. * @throws NotFoundException * HTTP Status Code 404: Resource not found due to incorrect input. Correct your request and then retry it. * @throws BadRequestException * HTTP Status Code 400: Bad request due to incorrect input. Correct your request and then retry it. * @throws InternalServerErrorException * HTTP Status Code 500: Unexpected internal server error. Retrying your request might resolve the issue. * @throws ConflictException * HTTP Status Code 409: Conflict. This broker name already exists. Retry your request with another name. * @throws ForbiddenException * HTTP Status Code 403: Access forbidden. Correct your credentials and then retry your 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 MqException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample MqClient.UpdateConfiguration * @see AWS API * Documentation */ @Override public UpdateConfigurationResponse updateConfiguration(UpdateConfigurationRequest updateConfigurationRequest) throws NotFoundException, BadRequestException, InternalServerErrorException, ConflictException, ForbiddenException, AwsServiceException, SdkClientException, MqException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateConfigurationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateConfigurationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "mq"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateConfiguration"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UpdateConfiguration").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(updateConfigurationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateConfigurationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Updates the information for an ActiveMQ user. *

* * @param updateUserRequest * Updates the information for an ActiveMQ user. * @return Result of the UpdateUser operation returned by the service. * @throws NotFoundException * HTTP Status Code 404: Resource not found due to incorrect input. Correct your request and then retry it. * @throws BadRequestException * HTTP Status Code 400: Bad request due to incorrect input. Correct your request and then retry it. * @throws InternalServerErrorException * HTTP Status Code 500: Unexpected internal server error. Retrying your request might resolve the issue. * @throws ConflictException * HTTP Status Code 409: Conflict. This broker name already exists. Retry your request with another name. * @throws ForbiddenException * HTTP Status Code 403: Access forbidden. Correct your credentials and then retry your 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 MqException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample MqClient.UpdateUser * @see AWS API * Documentation */ @Override public UpdateUserResponse updateUser(UpdateUserRequest updateUserRequest) throws NotFoundException, BadRequestException, InternalServerErrorException, ConflictException, ForbiddenException, AwsServiceException, SdkClientException, MqException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UpdateUserResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateUserRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateUserRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "mq"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateUser"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UpdateUser").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(updateUserRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateUserRequestMarshaller(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(); } MqServiceClientConfigurationBuilder serviceConfigBuilder = new MqServiceClientConfigurationBuilder(configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } return configuration.build(); } private > T init(T builder) { return builder .clientConfiguration(clientConfiguration) .defaultServiceExceptionSupplier(MqException::builder) .protocol(AwsJsonProtocol.REST_JSON) .protocolVersion("1.1") .registerModeledException( ExceptionMetadata.builder().errorCode("ConflictException") .exceptionBuilderSupplier(ConflictException::builder).httpStatusCode(409).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("NotFoundException") .exceptionBuilderSupplier(NotFoundException::builder).httpStatusCode(404).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("UnauthorizedException") .exceptionBuilderSupplier(UnauthorizedException::builder).httpStatusCode(401).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ForbiddenException") .exceptionBuilderSupplier(ForbiddenException::builder).httpStatusCode(403).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("BadRequestException") .exceptionBuilderSupplier(BadRequestException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InternalServerErrorException") .exceptionBuilderSupplier(InternalServerErrorException::builder).httpStatusCode(500).build()); } @Override public final MqServiceClientConfiguration serviceClientConfiguration() { return new MqServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build(); } @Override public void close() { clientHandler.close(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy