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

software.amazon.awssdk.services.health.DefaultHealthAsyncClient Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Health APIs and Notifications module holds the client classes that are used for communicating with AWS Health APIs and Notifications service.

There is a newer version: 2.29.15
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.health;

import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler;
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.awscore.retry.AwsRetryStrategy;
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.ClientOverrideConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientOption;
import software.amazon.awssdk.core.client.handler.AsyncClientHandler;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
import software.amazon.awssdk.core.http.HttpResponseHandler;
import software.amazon.awssdk.core.metrics.CoreMetric;
import software.amazon.awssdk.core.retry.RetryMode;
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.retries.api.RetryStrategy;
import software.amazon.awssdk.services.health.internal.HealthServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.health.model.ConcurrentModificationException;
import software.amazon.awssdk.services.health.model.DescribeAffectedAccountsForOrganizationRequest;
import software.amazon.awssdk.services.health.model.DescribeAffectedAccountsForOrganizationResponse;
import software.amazon.awssdk.services.health.model.DescribeAffectedEntitiesForOrganizationRequest;
import software.amazon.awssdk.services.health.model.DescribeAffectedEntitiesForOrganizationResponse;
import software.amazon.awssdk.services.health.model.DescribeAffectedEntitiesRequest;
import software.amazon.awssdk.services.health.model.DescribeAffectedEntitiesResponse;
import software.amazon.awssdk.services.health.model.DescribeEntityAggregatesForOrganizationRequest;
import software.amazon.awssdk.services.health.model.DescribeEntityAggregatesForOrganizationResponse;
import software.amazon.awssdk.services.health.model.DescribeEntityAggregatesRequest;
import software.amazon.awssdk.services.health.model.DescribeEntityAggregatesResponse;
import software.amazon.awssdk.services.health.model.DescribeEventAggregatesRequest;
import software.amazon.awssdk.services.health.model.DescribeEventAggregatesResponse;
import software.amazon.awssdk.services.health.model.DescribeEventDetailsForOrganizationRequest;
import software.amazon.awssdk.services.health.model.DescribeEventDetailsForOrganizationResponse;
import software.amazon.awssdk.services.health.model.DescribeEventDetailsRequest;
import software.amazon.awssdk.services.health.model.DescribeEventDetailsResponse;
import software.amazon.awssdk.services.health.model.DescribeEventTypesRequest;
import software.amazon.awssdk.services.health.model.DescribeEventTypesResponse;
import software.amazon.awssdk.services.health.model.DescribeEventsForOrganizationRequest;
import software.amazon.awssdk.services.health.model.DescribeEventsForOrganizationResponse;
import software.amazon.awssdk.services.health.model.DescribeEventsRequest;
import software.amazon.awssdk.services.health.model.DescribeEventsResponse;
import software.amazon.awssdk.services.health.model.DescribeHealthServiceStatusForOrganizationRequest;
import software.amazon.awssdk.services.health.model.DescribeHealthServiceStatusForOrganizationResponse;
import software.amazon.awssdk.services.health.model.DisableHealthServiceAccessForOrganizationRequest;
import software.amazon.awssdk.services.health.model.DisableHealthServiceAccessForOrganizationResponse;
import software.amazon.awssdk.services.health.model.EnableHealthServiceAccessForOrganizationRequest;
import software.amazon.awssdk.services.health.model.EnableHealthServiceAccessForOrganizationResponse;
import software.amazon.awssdk.services.health.model.HealthException;
import software.amazon.awssdk.services.health.model.InvalidPaginationTokenException;
import software.amazon.awssdk.services.health.model.UnsupportedLocaleException;
import software.amazon.awssdk.services.health.transform.DescribeAffectedAccountsForOrganizationRequestMarshaller;
import software.amazon.awssdk.services.health.transform.DescribeAffectedEntitiesForOrganizationRequestMarshaller;
import software.amazon.awssdk.services.health.transform.DescribeAffectedEntitiesRequestMarshaller;
import software.amazon.awssdk.services.health.transform.DescribeEntityAggregatesForOrganizationRequestMarshaller;
import software.amazon.awssdk.services.health.transform.DescribeEntityAggregatesRequestMarshaller;
import software.amazon.awssdk.services.health.transform.DescribeEventAggregatesRequestMarshaller;
import software.amazon.awssdk.services.health.transform.DescribeEventDetailsForOrganizationRequestMarshaller;
import software.amazon.awssdk.services.health.transform.DescribeEventDetailsRequestMarshaller;
import software.amazon.awssdk.services.health.transform.DescribeEventTypesRequestMarshaller;
import software.amazon.awssdk.services.health.transform.DescribeEventsForOrganizationRequestMarshaller;
import software.amazon.awssdk.services.health.transform.DescribeEventsRequestMarshaller;
import software.amazon.awssdk.services.health.transform.DescribeHealthServiceStatusForOrganizationRequestMarshaller;
import software.amazon.awssdk.services.health.transform.DisableHealthServiceAccessForOrganizationRequestMarshaller;
import software.amazon.awssdk.services.health.transform.EnableHealthServiceAccessForOrganizationRequestMarshaller;
import software.amazon.awssdk.utils.CompletableFutureUtils;

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

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

    private final AsyncClientHandler clientHandler;

    private final AwsJsonProtocolFactory protocolFactory;

    private final SdkClientConfiguration clientConfiguration;

    protected DefaultHealthAsyncClient(SdkClientConfiguration clientConfiguration) {
        this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
        this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
        this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
    }

    /**
     * 

* Returns a list of accounts in the organization from Organizations that are affected by the provided event. For * more information about the different types of Health events, see Event. *

*

* Before you can call this operation, you must first enable Health to work with Organizations. To do this, call the * EnableHealthServiceAccessForOrganization operation from your organization's management account. *

* *

* This API operation uses pagination. Specify the nextToken parameter in the next request to return * more results. *

*
* * @param describeAffectedAccountsForOrganizationRequest * @return A Java Future containing the result of the DescribeAffectedAccountsForOrganization operation returned by * the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InvalidPaginationTokenException The specified pagination token (nextToken) is not valid. *
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • HealthException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample HealthAsyncClient.DescribeAffectedAccountsForOrganization * @see AWS API Documentation */ @Override public CompletableFuture describeAffectedAccountsForOrganization( DescribeAffectedAccountsForOrganizationRequest describeAffectedAccountsForOrganizationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeAffectedAccountsForOrganizationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeAffectedAccountsForOrganizationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Health"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeAffectedAccountsForOrganization"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, DescribeAffectedAccountsForOrganizationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeAffectedAccountsForOrganization").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeAffectedAccountsForOrganizationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeAffectedAccountsForOrganizationRequest)); CompletableFuture whenCompleted = executeFuture .whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns a list of entities that have been affected by the specified events, based on the specified filter * criteria. Entities can refer to individual customer resources, groups of customer resources, or any other * construct, depending on the Amazon Web Service. Events that have impact beyond that of the affected entities, or * where the extent of impact is unknown, include at least one entity indicating this. *

*

* At least one event ARN is required. *

* *
    *
  • *

    * This API operation uses pagination. Specify the nextToken parameter in the next request to return * more results. *

    *
  • *
  • *

    * This operation supports resource-level permissions. You can use this operation to allow or deny access to * specific Health events. For more information, see Resource- and action-based conditions in the Health User Guide. *

    *
  • *
*
* * @param describeAffectedEntitiesRequest * @return A Java Future containing the result of the DescribeAffectedEntities operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InvalidPaginationTokenException The specified pagination token (nextToken) is not valid. *
  • *
  • UnsupportedLocaleException The specified locale is not supported.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • HealthException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample HealthAsyncClient.DescribeAffectedEntities * @see AWS API Documentation */ @Override public CompletableFuture describeAffectedEntities( DescribeAffectedEntitiesRequest describeAffectedEntitiesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeAffectedEntitiesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeAffectedEntitiesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Health"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeAffectedEntities"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeAffectedEntitiesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeAffectedEntities").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeAffectedEntitiesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeAffectedEntitiesRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns a list of entities that have been affected by one or more events for one or more accounts in your * organization in Organizations, based on the filter criteria. Entities can refer to individual customer resources, * groups of customer resources, or any other construct, depending on the Amazon Web Service. *

*

* At least one event Amazon Resource Name (ARN) and account ID are required. *

*

* Before you can call this operation, you must first enable Health to work with Organizations. To do this, call the * EnableHealthServiceAccessForOrganization operation from your organization's management account. *

* *
    *
  • *

    * This API operation uses pagination. Specify the nextToken parameter in the next request to return * more results. *

    *
  • *
  • *

    * This operation doesn't support resource-level permissions. You can't use this operation to allow or deny access * to specific Health events. For more information, see Resource- and action-based conditions in the Health User Guide. *

    *
  • *
*
* * @param describeAffectedEntitiesForOrganizationRequest * @return A Java Future containing the result of the DescribeAffectedEntitiesForOrganization operation returned by * the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InvalidPaginationTokenException The specified pagination token (nextToken) is not valid. *
  • *
  • UnsupportedLocaleException The specified locale is not supported.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • HealthException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample HealthAsyncClient.DescribeAffectedEntitiesForOrganization * @see AWS API Documentation */ @Override public CompletableFuture describeAffectedEntitiesForOrganization( DescribeAffectedEntitiesForOrganizationRequest describeAffectedEntitiesForOrganizationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeAffectedEntitiesForOrganizationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeAffectedEntitiesForOrganizationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Health"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeAffectedEntitiesForOrganization"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, DescribeAffectedEntitiesForOrganizationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeAffectedEntitiesForOrganization").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeAffectedEntitiesForOrganizationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeAffectedEntitiesForOrganizationRequest)); CompletableFuture whenCompleted = executeFuture .whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns the number of entities that are affected by each of the specified events. *

* * @param describeEntityAggregatesRequest * @return A Java Future containing the result of the DescribeEntityAggregates operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • HealthException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample HealthAsyncClient.DescribeEntityAggregates * @see AWS API Documentation */ @Override public CompletableFuture describeEntityAggregates( DescribeEntityAggregatesRequest describeEntityAggregatesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeEntityAggregatesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeEntityAggregatesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Health"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeEntityAggregates"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeEntityAggregatesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeEntityAggregates").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeEntityAggregatesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeEntityAggregatesRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns a list of entity aggregates for your Organizations that are affected by each of the specified events. *

* * @param describeEntityAggregatesForOrganizationRequest * @return A Java Future containing the result of the DescribeEntityAggregatesForOrganization operation returned by * the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • HealthException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample HealthAsyncClient.DescribeEntityAggregatesForOrganization * @see AWS API Documentation */ @Override public CompletableFuture describeEntityAggregatesForOrganization( DescribeEntityAggregatesForOrganizationRequest describeEntityAggregatesForOrganizationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeEntityAggregatesForOrganizationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeEntityAggregatesForOrganizationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Health"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeEntityAggregatesForOrganization"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, DescribeEntityAggregatesForOrganizationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeEntityAggregatesForOrganization").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeEntityAggregatesForOrganizationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeEntityAggregatesForOrganizationRequest)); CompletableFuture whenCompleted = executeFuture .whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns the number of events of each event type (issue, scheduled change, and account notification). If no filter * is specified, the counts of all events in each category are returned. *

* *

* This API operation uses pagination. Specify the nextToken parameter in the next request to return * more results. *

*
* * @param describeEventAggregatesRequest * @return A Java Future containing the result of the DescribeEventAggregates operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InvalidPaginationTokenException The specified pagination token (nextToken) is not valid. *
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • HealthException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample HealthAsyncClient.DescribeEventAggregates * @see AWS API Documentation */ @Override public CompletableFuture describeEventAggregates( DescribeEventAggregatesRequest describeEventAggregatesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeEventAggregatesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeEventAggregatesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Health"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeEventAggregates"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeEventAggregatesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeEventAggregates").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeEventAggregatesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeEventAggregatesRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns detailed information about one or more specified events. Information includes standard event data (Amazon * Web Services Region, service, and so on, as returned by DescribeEvents), a * detailed event description, and possible additional metadata that depends upon the nature of the event. Affected * entities are not included. To retrieve the entities, use the DescribeAffectedEntities operation. *

*

* If a specified event can't be retrieved, an error message is returned for that event. *

* *

* This operation supports resource-level permissions. You can use this operation to allow or deny access to * specific Health events. For more information, see Resource- and action-based conditions in the Health User Guide. *

*
* * @param describeEventDetailsRequest * @return A Java Future containing the result of the DescribeEventDetails operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • UnsupportedLocaleException The specified locale is not supported.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • HealthException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample HealthAsyncClient.DescribeEventDetails * @see AWS * API Documentation */ @Override public CompletableFuture describeEventDetails( DescribeEventDetailsRequest describeEventDetailsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeEventDetailsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeEventDetailsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Health"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeEventDetails"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeEventDetailsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeEventDetails").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeEventDetailsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeEventDetailsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns detailed information about one or more specified events for one or more Amazon Web Services accounts in * your organization. This information includes standard event data (such as the Amazon Web Services Region and * service), an event description, and (depending on the event) possible metadata. This operation doesn't return * affected entities, such as the resources related to the event. To return affected entities, use the DescribeAffectedEntitiesForOrganization operation. *

* *

* Before you can call this operation, you must first enable Health to work with Organizations. To do this, call the * EnableHealthServiceAccessForOrganization operation from your organization's management account. *

*
*

* When you call the DescribeEventDetailsForOrganization operation, specify the * organizationEventDetailFilters object in the request. Depending on the Health event type, note the * following differences: *

*
    *
  • *

    * To return event details for a public event, you must specify a null value for the awsAccountId * parameter. If you specify an account ID for a public event, Health returns an error message because public events * aren't specific to an account. *

    *
  • *
  • *

    * To return event details for an event that is specific to an account in your organization, you must specify the * awsAccountId parameter in the request. If you don't specify an account ID, Health returns an error * message because the event is specific to an account in your organization. *

    *
  • *
*

* For more information, see Event. *

* *

* This operation doesn't support resource-level permissions. You can't use this operation to allow or deny access * to specific Health events. For more information, see Resource- and action-based conditions in the Health User Guide. *

*
* * @param describeEventDetailsForOrganizationRequest * @return A Java Future containing the result of the DescribeEventDetailsForOrganization operation returned by the * service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • UnsupportedLocaleException The specified locale is not supported.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • HealthException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample HealthAsyncClient.DescribeEventDetailsForOrganization * @see AWS API Documentation */ @Override public CompletableFuture describeEventDetailsForOrganization( DescribeEventDetailsForOrganizationRequest describeEventDetailsForOrganizationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeEventDetailsForOrganizationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeEventDetailsForOrganizationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Health"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeEventDetailsForOrganization"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, DescribeEventDetailsForOrganizationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeEventDetailsForOrganization").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeEventDetailsForOrganizationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeEventDetailsForOrganizationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns the event types that meet the specified filter criteria. You can use this API operation to find * information about the Health event, such as the category, Amazon Web Service, and event code. The metadata for * each event appears in the EventType object. *

*

* If you don't specify a filter criteria, the API operation returns all event types, in no particular order. *

* *

* This API operation uses pagination. Specify the nextToken parameter in the next request to return * more results. *

*
* * @param describeEventTypesRequest * @return A Java Future containing the result of the DescribeEventTypes operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InvalidPaginationTokenException The specified pagination token (nextToken) is not valid. *
  • *
  • UnsupportedLocaleException The specified locale is not supported.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • HealthException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample HealthAsyncClient.DescribeEventTypes * @see AWS API * Documentation */ @Override public CompletableFuture describeEventTypes(DescribeEventTypesRequest describeEventTypesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeEventTypesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeEventTypesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Health"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeEventTypes"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeEventTypesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeEventTypes").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeEventTypesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeEventTypesRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns information about events that meet the specified filter criteria. Events are returned in a summary form * and do not include the detailed description, any additional metadata that depends on the event type, or any * affected resources. To retrieve that information, use the DescribeEventDetails and DescribeAffectedEntities operations. *

*

* If no filter criteria are specified, all events are returned. Results are sorted by lastModifiedTime * , starting with the most recent event. *

* *
    *
  • *

    * When you call the DescribeEvents operation and specify an entity for the entityValues * parameter, Health might return public events that aren't specific to that resource. For example, if you call * DescribeEvents and specify an ID for an Amazon Elastic Compute Cloud (Amazon EC2) instance, Health * might return events that aren't specific to that resource or service. To get events that are specific to a * service, use the services parameter in the filter object. For more information, see Event. *

    *
  • *
  • *

    * This API operation uses pagination. Specify the nextToken parameter in the next request to return * more results. *

    *
  • *
*
* * @param describeEventsRequest * @return A Java Future containing the result of the DescribeEvents operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InvalidPaginationTokenException The specified pagination token (nextToken) is not valid. *
  • *
  • UnsupportedLocaleException The specified locale is not supported.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • HealthException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample HealthAsyncClient.DescribeEvents * @see AWS API * Documentation */ @Override public CompletableFuture describeEvents(DescribeEventsRequest describeEventsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeEventsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeEventsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Health"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeEvents"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeEventsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeEvents").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeEventsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeEventsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns information about events across your organization in Organizations. You can use thefilters * parameter to specify the events that you want to return. Events are returned in a summary form and don't include * the affected accounts, detailed description, any additional metadata that depends on the event type, or any * affected resources. To retrieve that information, use the following operations: *

* *

* If you don't specify a filter, the DescribeEventsForOrganizations returns all events * across your organization. Results are sorted by lastModifiedTime, starting with the most recent * event. *

*

* For more information about the different types of Health events, see Event. *

*

* Before you can call this operation, you must first enable Health to work with Organizations. To do this, call the * EnableHealthServiceAccessForOrganization operation from your organization's management account. *

* *

* This API operation uses pagination. Specify the nextToken parameter in the next request to return * more results. *

*
* * @param describeEventsForOrganizationRequest * @return A Java Future containing the result of the DescribeEventsForOrganization operation returned by the * service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InvalidPaginationTokenException The specified pagination token (nextToken) is not valid. *
  • *
  • UnsupportedLocaleException The specified locale is not supported.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • HealthException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample HealthAsyncClient.DescribeEventsForOrganization * @see AWS API Documentation */ @Override public CompletableFuture describeEventsForOrganization( DescribeEventsForOrganizationRequest describeEventsForOrganizationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeEventsForOrganizationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeEventsForOrganizationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Health"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeEventsForOrganization"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeEventsForOrganizationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeEventsForOrganization").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeEventsForOrganizationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeEventsForOrganizationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* This operation provides status information on enabling or disabling Health to work with your organization. To * call this operation, you must use the organization's management account. *

* * @param describeHealthServiceStatusForOrganizationRequest * @return A Java Future containing the result of the DescribeHealthServiceStatusForOrganization operation returned * by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • HealthException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample HealthAsyncClient.DescribeHealthServiceStatusForOrganization * @see AWS API Documentation */ @Override public CompletableFuture describeHealthServiceStatusForOrganization( DescribeHealthServiceStatusForOrganizationRequest describeHealthServiceStatusForOrganizationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration( describeHealthServiceStatusForOrganizationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeHealthServiceStatusForOrganizationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Health"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeHealthServiceStatusForOrganization"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, DescribeHealthServiceStatusForOrganizationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeHealthServiceStatusForOrganization") .withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeHealthServiceStatusForOrganizationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeHealthServiceStatusForOrganizationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Disables Health from working with Organizations. To call this operation, you must sign in to the organization's * management account. For more information, see Aggregating Health events in the * Health User Guide. *

*

* This operation doesn't remove the service-linked role from the management account in your organization. You must * use the IAM console, API, or Command Line Interface (CLI) to remove the service-linked role. For more * information, see Deleting a Service-Linked Role in the IAM User Guide. *

* *

* You can also disable the organizational feature by using the Organizations DisableAWSServiceAccess API operation. After you call this operation, Health stops aggregating events for * all other Amazon Web Services accounts in your organization. If you call the Health API operations for * organizational view, Health returns an error. Health continues to aggregate health events for your Amazon Web * Services account. *

*
* * @param disableHealthServiceAccessForOrganizationRequest * @return A Java Future containing the result of the DisableHealthServiceAccessForOrganization operation returned * by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ConcurrentModificationException EnableHealthServiceAccessForOrganization is already in progress. Wait for the action to complete * before trying again. To get the current status, use the DescribeHealthServiceStatusForOrganization operation.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • HealthException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample HealthAsyncClient.DisableHealthServiceAccessForOrganization * @see AWS API Documentation */ @Override public CompletableFuture disableHealthServiceAccessForOrganization( DisableHealthServiceAccessForOrganizationRequest disableHealthServiceAccessForOrganizationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration( disableHealthServiceAccessForOrganizationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, disableHealthServiceAccessForOrganizationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Health"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DisableHealthServiceAccessForOrganization"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, DisableHealthServiceAccessForOrganizationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DisableHealthServiceAccessForOrganization") .withProtocolMetadata(protocolMetadata) .withMarshaller(new DisableHealthServiceAccessForOrganizationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(disableHealthServiceAccessForOrganizationRequest)); CompletableFuture whenCompleted = executeFuture .whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Enables Health to work with Organizations. You can use the organizational view feature to aggregate events from * all Amazon Web Services accounts in your organization in a centralized location. *

*

* This operation also creates a service-linked role for the management account in the organization. *

* *

* To call this operation, you must meet the following requirements: *

*
    *
  • *

    * You must have a Business, Enterprise On-Ramp, or Enterprise Support plan from Amazon Web Services Support to use the Health API. If you call * the Health API from an Amazon Web Services account that doesn't have a Business, Enterprise On-Ramp, or * Enterprise Support plan, you receive a SubscriptionRequiredException error. *

    *
  • *
  • *

    * You must have permission to call this operation from the organization's management account. For example IAM * policies, see Health * identity-based policy examples. *

    *
  • *
*
*

* If you don't have the required support plan, you can instead use the Health console to enable the organizational * view feature. For more information, see Aggregating Health events in the * Health User Guide. *

* * @param enableHealthServiceAccessForOrganizationRequest * @return A Java Future containing the result of the EnableHealthServiceAccessForOrganization operation returned by * the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ConcurrentModificationException EnableHealthServiceAccessForOrganization is already in progress. Wait for the action to complete * before trying again. To get the current status, use the DescribeHealthServiceStatusForOrganization operation.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • HealthException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample HealthAsyncClient.EnableHealthServiceAccessForOrganization * @see AWS API Documentation */ @Override public CompletableFuture enableHealthServiceAccessForOrganization( EnableHealthServiceAccessForOrganizationRequest enableHealthServiceAccessForOrganizationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration( enableHealthServiceAccessForOrganizationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, enableHealthServiceAccessForOrganizationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Health"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EnableHealthServiceAccessForOrganization"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, EnableHealthServiceAccessForOrganizationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("EnableHealthServiceAccessForOrganization").withProtocolMetadata(protocolMetadata) .withMarshaller(new EnableHealthServiceAccessForOrganizationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(enableHealthServiceAccessForOrganizationRequest)); CompletableFuture whenCompleted = executeFuture .whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } @Override public final HealthServiceClientConfiguration serviceClientConfiguration() { return new HealthServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build(); } @Override public final String serviceName() { return SERVICE_NAME; } private > T init(T builder) { return builder .clientConfiguration(clientConfiguration) .defaultServiceExceptionSupplier(HealthException::builder) .protocol(AwsJsonProtocol.AWS_JSON) .protocolVersion("1.1") .registerModeledException( ExceptionMetadata.builder().errorCode("ConcurrentModificationException") .exceptionBuilderSupplier(ConcurrentModificationException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("UnsupportedLocale") .exceptionBuilderSupplier(UnsupportedLocaleException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InvalidPaginationToken") .exceptionBuilderSupplier(InvalidPaginationTokenException::builder).httpStatusCode(400).build()); } 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 void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) { ClientOverrideConfiguration.Builder builder = configuration.asOverrideConfigurationBuilder(); RetryMode retryMode = builder.retryMode(); if (retryMode != null) { configuration.option(SdkClientOption.RETRY_STRATEGY, AwsRetryStrategy.forRetryMode(retryMode)); } else { Consumer> configurator = builder.retryStrategyConfigurator(); if (configurator != null) { RetryStrategy.Builder defaultBuilder = AwsRetryStrategy.defaultRetryStrategy().toBuilder(); configurator.accept(defaultBuilder); configuration.option(SdkClientOption.RETRY_STRATEGY, defaultBuilder.build()); } else { RetryStrategy retryStrategy = builder.retryStrategy(); if (retryStrategy != null) { configuration.option(SdkClientOption.RETRY_STRATEGY, retryStrategy); } } } configuration.option(SdkClientOption.CONFIGURED_RETRY_MODE, null); configuration.option(SdkClientOption.CONFIGURED_RETRY_STRATEGY, null); configuration.option(SdkClientOption.CONFIGURED_RETRY_CONFIGURATOR, null); } 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(); } HealthServiceClientConfigurationBuilder serviceConfigBuilder = new HealthServiceClientConfigurationBuilder(configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } updateRetryStrategyClientConfiguration(configuration); return configuration.build(); } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata) { return protocolFactory.createErrorResponseHandler(operationMetadata); } @Override public void close() { clientHandler.close(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy