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

software.amazon.awssdk.services.grafana.DefaultGrafanaAsyncClient Maven / Gradle / Ivy

/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.grafana;

import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
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.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.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.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.grafana.internal.GrafanaServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.grafana.model.AccessDeniedException;
import software.amazon.awssdk.services.grafana.model.AssociateLicenseRequest;
import software.amazon.awssdk.services.grafana.model.AssociateLicenseResponse;
import software.amazon.awssdk.services.grafana.model.ConflictException;
import software.amazon.awssdk.services.grafana.model.CreateWorkspaceApiKeyRequest;
import software.amazon.awssdk.services.grafana.model.CreateWorkspaceApiKeyResponse;
import software.amazon.awssdk.services.grafana.model.CreateWorkspaceRequest;
import software.amazon.awssdk.services.grafana.model.CreateWorkspaceResponse;
import software.amazon.awssdk.services.grafana.model.DeleteWorkspaceApiKeyRequest;
import software.amazon.awssdk.services.grafana.model.DeleteWorkspaceApiKeyResponse;
import software.amazon.awssdk.services.grafana.model.DeleteWorkspaceRequest;
import software.amazon.awssdk.services.grafana.model.DeleteWorkspaceResponse;
import software.amazon.awssdk.services.grafana.model.DescribeWorkspaceAuthenticationRequest;
import software.amazon.awssdk.services.grafana.model.DescribeWorkspaceAuthenticationResponse;
import software.amazon.awssdk.services.grafana.model.DescribeWorkspaceConfigurationRequest;
import software.amazon.awssdk.services.grafana.model.DescribeWorkspaceConfigurationResponse;
import software.amazon.awssdk.services.grafana.model.DescribeWorkspaceRequest;
import software.amazon.awssdk.services.grafana.model.DescribeWorkspaceResponse;
import software.amazon.awssdk.services.grafana.model.DisassociateLicenseRequest;
import software.amazon.awssdk.services.grafana.model.DisassociateLicenseResponse;
import software.amazon.awssdk.services.grafana.model.GrafanaException;
import software.amazon.awssdk.services.grafana.model.InternalServerException;
import software.amazon.awssdk.services.grafana.model.ListPermissionsRequest;
import software.amazon.awssdk.services.grafana.model.ListPermissionsResponse;
import software.amazon.awssdk.services.grafana.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.grafana.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.grafana.model.ListVersionsRequest;
import software.amazon.awssdk.services.grafana.model.ListVersionsResponse;
import software.amazon.awssdk.services.grafana.model.ListWorkspacesRequest;
import software.amazon.awssdk.services.grafana.model.ListWorkspacesResponse;
import software.amazon.awssdk.services.grafana.model.ResourceNotFoundException;
import software.amazon.awssdk.services.grafana.model.ServiceQuotaExceededException;
import software.amazon.awssdk.services.grafana.model.TagResourceRequest;
import software.amazon.awssdk.services.grafana.model.TagResourceResponse;
import software.amazon.awssdk.services.grafana.model.ThrottlingException;
import software.amazon.awssdk.services.grafana.model.UntagResourceRequest;
import software.amazon.awssdk.services.grafana.model.UntagResourceResponse;
import software.amazon.awssdk.services.grafana.model.UpdatePermissionsRequest;
import software.amazon.awssdk.services.grafana.model.UpdatePermissionsResponse;
import software.amazon.awssdk.services.grafana.model.UpdateWorkspaceAuthenticationRequest;
import software.amazon.awssdk.services.grafana.model.UpdateWorkspaceAuthenticationResponse;
import software.amazon.awssdk.services.grafana.model.UpdateWorkspaceConfigurationRequest;
import software.amazon.awssdk.services.grafana.model.UpdateWorkspaceConfigurationResponse;
import software.amazon.awssdk.services.grafana.model.UpdateWorkspaceRequest;
import software.amazon.awssdk.services.grafana.model.UpdateWorkspaceResponse;
import software.amazon.awssdk.services.grafana.model.ValidationException;
import software.amazon.awssdk.services.grafana.transform.AssociateLicenseRequestMarshaller;
import software.amazon.awssdk.services.grafana.transform.CreateWorkspaceApiKeyRequestMarshaller;
import software.amazon.awssdk.services.grafana.transform.CreateWorkspaceRequestMarshaller;
import software.amazon.awssdk.services.grafana.transform.DeleteWorkspaceApiKeyRequestMarshaller;
import software.amazon.awssdk.services.grafana.transform.DeleteWorkspaceRequestMarshaller;
import software.amazon.awssdk.services.grafana.transform.DescribeWorkspaceAuthenticationRequestMarshaller;
import software.amazon.awssdk.services.grafana.transform.DescribeWorkspaceConfigurationRequestMarshaller;
import software.amazon.awssdk.services.grafana.transform.DescribeWorkspaceRequestMarshaller;
import software.amazon.awssdk.services.grafana.transform.DisassociateLicenseRequestMarshaller;
import software.amazon.awssdk.services.grafana.transform.ListPermissionsRequestMarshaller;
import software.amazon.awssdk.services.grafana.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.grafana.transform.ListVersionsRequestMarshaller;
import software.amazon.awssdk.services.grafana.transform.ListWorkspacesRequestMarshaller;
import software.amazon.awssdk.services.grafana.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.grafana.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.grafana.transform.UpdatePermissionsRequestMarshaller;
import software.amazon.awssdk.services.grafana.transform.UpdateWorkspaceAuthenticationRequestMarshaller;
import software.amazon.awssdk.services.grafana.transform.UpdateWorkspaceConfigurationRequestMarshaller;
import software.amazon.awssdk.services.grafana.transform.UpdateWorkspaceRequestMarshaller;
import software.amazon.awssdk.utils.CompletableFutureUtils;

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

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

    private final AsyncClientHandler clientHandler;

    private final AwsJsonProtocolFactory protocolFactory;

    private final SdkClientConfiguration clientConfiguration;

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

    /**
     * 

* Assigns a Grafana Enterprise license to a workspace. Upgrading to Grafana Enterprise incurs additional fees. For * more information, see Upgrade a * workspace to Grafana Enterprise. *

* * @param associateLicenseRequest * @return A Java Future containing the result of the AssociateLicense operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The request references a resource that does not exist.
  • *
  • ThrottlingException The request was denied because of request throttling. Retry the request.
  • *
  • ValidationException The value of a parameter in the request caused an error.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action.
  • *
  • InternalServerException Unexpected error while processing the request. Retry the request.
  • *
  • 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.
  • *
  • GrafanaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample GrafanaAsyncClient.AssociateLicense * @see AWS API * Documentation */ @Override public CompletableFuture associateLicense(AssociateLicenseRequest associateLicenseRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(associateLicenseRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, associateLicenseRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "grafana"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AssociateLicense"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, AssociateLicenseResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("AssociateLicense").withProtocolMetadata(protocolMetadata) .withMarshaller(new AssociateLicenseRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(associateLicenseRequest)); 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); } } /** *

* Creates a workspace. In a workspace, you can create Grafana dashboards and visualizations to analyze your * metrics, logs, and traces. You don't have to build, package, or deploy any hardware to run the Grafana server. *

*

* Don't use CreateWorkspace to modify an existing workspace. Instead, use UpdateWorkspace. *

* * @param createWorkspaceRequest * @return A Java Future containing the result of the CreateWorkspace operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ThrottlingException The request was denied because of request throttling. Retry the request.
  • *
  • ConflictException A resource was in an inconsistent state during an update or a deletion.
  • *
  • ValidationException The value of a parameter in the request caused an error.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action.
  • *
  • InternalServerException Unexpected error while processing the request. Retry the request.
  • *
  • ServiceQuotaExceededException The request would cause a service quota to be exceeded.
  • *
  • 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.
  • *
  • GrafanaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample GrafanaAsyncClient.CreateWorkspace * @see AWS API * Documentation */ @Override public CompletableFuture createWorkspace(CreateWorkspaceRequest createWorkspaceRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createWorkspaceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createWorkspaceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "grafana"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateWorkspace"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreateWorkspaceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("CreateWorkspace").withProtocolMetadata(protocolMetadata) .withMarshaller(new CreateWorkspaceRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(createWorkspaceRequest)); 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); } } /** *

* Creates a Grafana API key for the workspace. This key can be used to authenticate requests sent to the * workspace's HTTP API. See https * ://docs.aws.amazon.com/grafana/latest/userguide/Using-Grafana-APIs.html for available APIs and example * requests. *

* * @param createWorkspaceApiKeyRequest * @return A Java Future containing the result of the CreateWorkspaceApiKey operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The request references a resource that does not exist.
  • *
  • ThrottlingException The request was denied because of request throttling. Retry the request.
  • *
  • ConflictException A resource was in an inconsistent state during an update or a deletion.
  • *
  • ValidationException The value of a parameter in the request caused an error.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action.
  • *
  • InternalServerException Unexpected error while processing the request. Retry the request.
  • *
  • ServiceQuotaExceededException The request would cause a service quota to be exceeded.
  • *
  • 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.
  • *
  • GrafanaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample GrafanaAsyncClient.CreateWorkspaceApiKey * @see AWS * API Documentation */ @Override public CompletableFuture createWorkspaceApiKey( CreateWorkspaceApiKeyRequest createWorkspaceApiKeyRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createWorkspaceApiKeyRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createWorkspaceApiKeyRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "grafana"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateWorkspaceApiKey"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreateWorkspaceApiKeyResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("CreateWorkspaceApiKey").withProtocolMetadata(protocolMetadata) .withMarshaller(new CreateWorkspaceApiKeyRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(createWorkspaceApiKeyRequest)); 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); } } /** *

* Deletes an Amazon Managed Grafana workspace. *

* * @param deleteWorkspaceRequest * @return A Java Future containing the result of the DeleteWorkspace operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The request references a resource that does not exist.
  • *
  • ThrottlingException The request was denied because of request throttling. Retry the request.
  • *
  • ConflictException A resource was in an inconsistent state during an update or a deletion.
  • *
  • ValidationException The value of a parameter in the request caused an error.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action.
  • *
  • InternalServerException Unexpected error while processing the request. Retry the request.
  • *
  • 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.
  • *
  • GrafanaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample GrafanaAsyncClient.DeleteWorkspace * @see AWS API * Documentation */ @Override public CompletableFuture deleteWorkspace(DeleteWorkspaceRequest deleteWorkspaceRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteWorkspaceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteWorkspaceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "grafana"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteWorkspace"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteWorkspaceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteWorkspace").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteWorkspaceRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteWorkspaceRequest)); 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); } } /** *

* Deletes a Grafana API key for the workspace. *

* * @param deleteWorkspaceApiKeyRequest * @return A Java Future containing the result of the DeleteWorkspaceApiKey operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The request references a resource that does not exist.
  • *
  • ThrottlingException The request was denied because of request throttling. Retry the request.
  • *
  • ConflictException A resource was in an inconsistent state during an update or a deletion.
  • *
  • ValidationException The value of a parameter in the request caused an error.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action.
  • *
  • InternalServerException Unexpected error while processing the request. Retry the request.
  • *
  • 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.
  • *
  • GrafanaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample GrafanaAsyncClient.DeleteWorkspaceApiKey * @see AWS * API Documentation */ @Override public CompletableFuture deleteWorkspaceApiKey( DeleteWorkspaceApiKeyRequest deleteWorkspaceApiKeyRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteWorkspaceApiKeyRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteWorkspaceApiKeyRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "grafana"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteWorkspaceApiKey"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteWorkspaceApiKeyResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteWorkspaceApiKey").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteWorkspaceApiKeyRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteWorkspaceApiKeyRequest)); 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); } } /** *

* Displays information about one Amazon Managed Grafana workspace. *

* * @param describeWorkspaceRequest * @return A Java Future containing the result of the DescribeWorkspace operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The request references a resource that does not exist.
  • *
  • ThrottlingException The request was denied because of request throttling. Retry the request.
  • *
  • ValidationException The value of a parameter in the request caused an error.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action.
  • *
  • InternalServerException Unexpected error while processing the request. Retry the request.
  • *
  • 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.
  • *
  • GrafanaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample GrafanaAsyncClient.DescribeWorkspace * @see AWS API * Documentation */ @Override public CompletableFuture describeWorkspace(DescribeWorkspaceRequest describeWorkspaceRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeWorkspaceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeWorkspaceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "grafana"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeWorkspace"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeWorkspaceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeWorkspace").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeWorkspaceRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeWorkspaceRequest)); 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); } } /** *

* Displays information about the authentication methods used in one Amazon Managed Grafana workspace. *

* * @param describeWorkspaceAuthenticationRequest * @return A Java Future containing the result of the DescribeWorkspaceAuthentication operation returned by the * service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The request references a resource that does not exist.
  • *
  • ThrottlingException The request was denied because of request throttling. Retry the request.
  • *
  • ValidationException The value of a parameter in the request caused an error.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action.
  • *
  • InternalServerException Unexpected error while processing the request. Retry the request.
  • *
  • 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.
  • *
  • GrafanaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample GrafanaAsyncClient.DescribeWorkspaceAuthentication * @see AWS API Documentation */ @Override public CompletableFuture describeWorkspaceAuthentication( DescribeWorkspaceAuthenticationRequest describeWorkspaceAuthenticationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeWorkspaceAuthenticationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeWorkspaceAuthenticationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "grafana"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeWorkspaceAuthentication"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeWorkspaceAuthenticationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeWorkspaceAuthentication").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeWorkspaceAuthenticationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeWorkspaceAuthenticationRequest)); 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); } } /** *

* Gets the current configuration string for the given workspace. *

* * @param describeWorkspaceConfigurationRequest * @return A Java Future containing the result of the DescribeWorkspaceConfiguration operation returned by the * service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The request references a resource that does not exist.
  • *
  • ThrottlingException The request was denied because of request throttling. Retry the request.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action.
  • *
  • InternalServerException Unexpected error while processing the request. Retry the request.
  • *
  • 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.
  • *
  • GrafanaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample GrafanaAsyncClient.DescribeWorkspaceConfiguration * @see AWS API Documentation */ @Override public CompletableFuture describeWorkspaceConfiguration( DescribeWorkspaceConfigurationRequest describeWorkspaceConfigurationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeWorkspaceConfigurationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeWorkspaceConfigurationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "grafana"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeWorkspaceConfiguration"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeWorkspaceConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeWorkspaceConfiguration").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeWorkspaceConfigurationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeWorkspaceConfigurationRequest)); 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); } } /** *

* Removes the Grafana Enterprise license from a workspace. *

* * @param disassociateLicenseRequest * @return A Java Future containing the result of the DisassociateLicense operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The request references a resource that does not exist.
  • *
  • ThrottlingException The request was denied because of request throttling. Retry the request.
  • *
  • ValidationException The value of a parameter in the request caused an error.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action.
  • *
  • InternalServerException Unexpected error while processing the request. Retry the request.
  • *
  • 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.
  • *
  • GrafanaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample GrafanaAsyncClient.DisassociateLicense * @see AWS * API Documentation */ @Override public CompletableFuture disassociateLicense( DisassociateLicenseRequest disassociateLicenseRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(disassociateLicenseRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, disassociateLicenseRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "grafana"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DisassociateLicense"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DisassociateLicenseResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DisassociateLicense").withProtocolMetadata(protocolMetadata) .withMarshaller(new DisassociateLicenseRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(disassociateLicenseRequest)); 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); } } /** *

* Lists the users and groups who have the Grafana Admin and Editor roles in this * workspace. If you use this operation without specifying userId or groupId, the * operation returns the roles of all users and groups. If you specify a userId or a * groupId, only the roles for that user or group are returned. If you do this, you can specify only * one userId or one groupId. *

* * @param listPermissionsRequest * @return A Java Future containing the result of the ListPermissions operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The request references a resource that does not exist.
  • *
  • ThrottlingException The request was denied because of request throttling. Retry the request.
  • *
  • ValidationException The value of a parameter in the request caused an error.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action.
  • *
  • InternalServerException Unexpected error while processing the request. Retry the request.
  • *
  • 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.
  • *
  • GrafanaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample GrafanaAsyncClient.ListPermissions * @see AWS API * Documentation */ @Override public CompletableFuture listPermissions(ListPermissionsRequest listPermissionsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listPermissionsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listPermissionsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "grafana"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListPermissions"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListPermissionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListPermissions").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListPermissionsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listPermissionsRequest)); 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); } } /** *

* The ListTagsForResource operation returns the tags that are associated with the Amazon Managed * Service for Grafana resource specified by the resourceArn. Currently, the only resource that can be * tagged is a workspace. *

* * @param listTagsForResourceRequest * @return A Java Future containing the result of the ListTagsForResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The request references a resource that does not exist.
  • *
  • ThrottlingException The request was denied because of request throttling. Retry the request.
  • *
  • ValidationException The value of a parameter in the request caused an error.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action.
  • *
  • InternalServerException Unexpected error while processing the request. Retry the request.
  • *
  • 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.
  • *
  • GrafanaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample GrafanaAsyncClient.ListTagsForResource * @see AWS * API Documentation */ @Override public CompletableFuture listTagsForResource( ListTagsForResourceRequest listTagsForResourceRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listTagsForResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "grafana"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForResource"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListTagsForResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListTagsForResource").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listTagsForResourceRequest)); 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); } } /** *

* Lists available versions of Grafana. These are available when calling CreateWorkspace. Optionally, * include a workspace to list the versions to which it can be upgraded. *

* * @param listVersionsRequest * @return A Java Future containing the result of the ListVersions operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The request references a resource that does not exist.
  • *
  • ThrottlingException The request was denied because of request throttling. Retry the request.
  • *
  • ValidationException The value of a parameter in the request caused an error.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action.
  • *
  • InternalServerException Unexpected error while processing the request. Retry the request.
  • *
  • 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.
  • *
  • GrafanaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample GrafanaAsyncClient.ListVersions * @see AWS API * Documentation */ @Override public CompletableFuture listVersions(ListVersionsRequest listVersionsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listVersionsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listVersionsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "grafana"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListVersions"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListVersionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListVersions").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListVersionsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listVersionsRequest)); 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 Amazon Managed Grafana workspaces in the account, with some information about each workspace. * For more complete information about one workspace, use DescribeWorkspace. *

* * @param listWorkspacesRequest * @return A Java Future containing the result of the ListWorkspaces operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ThrottlingException The request was denied because of request throttling. Retry the request.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action.
  • *
  • InternalServerException Unexpected error while processing the request. Retry the request.
  • *
  • 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.
  • *
  • GrafanaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample GrafanaAsyncClient.ListWorkspaces * @see AWS API * Documentation */ @Override public CompletableFuture listWorkspaces(ListWorkspacesRequest listWorkspacesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listWorkspacesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listWorkspacesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "grafana"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListWorkspaces"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListWorkspacesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListWorkspaces").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListWorkspacesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listWorkspacesRequest)); 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); } } /** *

* The TagResource operation associates tags with an Amazon Managed Grafana resource. Currently, the * only resource that can be tagged is workspaces. *

*

* If you specify a new tag key for the resource, this tag is appended to the list of tags associated with the * resource. If you specify a tag key that is already associated with the resource, the new tag value that you * specify replaces the previous value for that tag. *

* * @param tagResourceRequest * @return A Java Future containing the result of the TagResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The request references a resource that does not exist.
  • *
  • ThrottlingException The request was denied because of request throttling. Retry the request.
  • *
  • ValidationException The value of a parameter in the request caused an error.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action.
  • *
  • InternalServerException Unexpected error while processing the request. Retry the request.
  • *
  • 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.
  • *
  • GrafanaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample GrafanaAsyncClient.TagResource * @see AWS API * Documentation */ @Override public CompletableFuture tagResource(TagResourceRequest tagResourceRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(tagResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, tagResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "grafana"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagResource"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, TagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("TagResource").withProtocolMetadata(protocolMetadata) .withMarshaller(new TagResourceRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(tagResourceRequest)); 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); } } /** *

* The UntagResource operation removes the association of the tag with the Amazon Managed Grafana * resource. *

* * @param untagResourceRequest * @return A Java Future containing the result of the UntagResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The request references a resource that does not exist.
  • *
  • ThrottlingException The request was denied because of request throttling. Retry the request.
  • *
  • ValidationException The value of a parameter in the request caused an error.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action.
  • *
  • InternalServerException Unexpected error while processing the request. Retry the request.
  • *
  • 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.
  • *
  • GrafanaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample GrafanaAsyncClient.UntagResource * @see AWS API * Documentation */ @Override public CompletableFuture untagResource(UntagResourceRequest untagResourceRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(untagResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, untagResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "grafana"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagResource"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UntagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UntagResource").withProtocolMetadata(protocolMetadata) .withMarshaller(new UntagResourceRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(untagResourceRequest)); 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); } } /** *

* Updates which users in a workspace have the Grafana Admin or Editor roles. *

* * @param updatePermissionsRequest * @return A Java Future containing the result of the UpdatePermissions operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The request references a resource that does not exist.
  • *
  • ThrottlingException The request was denied because of request throttling. Retry the request.
  • *
  • ValidationException The value of a parameter in the request caused an error.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action.
  • *
  • InternalServerException Unexpected error while processing the request. Retry the request.
  • *
  • 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.
  • *
  • GrafanaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample GrafanaAsyncClient.UpdatePermissions * @see AWS API * Documentation */ @Override public CompletableFuture updatePermissions(UpdatePermissionsRequest updatePermissionsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updatePermissionsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updatePermissionsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "grafana"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdatePermissions"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdatePermissionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdatePermissions").withProtocolMetadata(protocolMetadata) .withMarshaller(new UpdatePermissionsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(updatePermissionsRequest)); 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); } } /** *

* Modifies an existing Amazon Managed Grafana workspace. If you use this operation and omit any optional * parameters, the existing values of those parameters are not changed. *

*

* To modify the user authentication methods that the workspace uses, such as SAML or IAM Identity Center, use * UpdateWorkspaceAuthentication. *

*

* To modify which users in the workspace have the Admin and Editor Grafana roles, use UpdatePermissions. *

* * @param updateWorkspaceRequest * @return A Java Future containing the result of the UpdateWorkspace operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The request references a resource that does not exist.
  • *
  • ThrottlingException The request was denied because of request throttling. Retry the request.
  • *
  • ConflictException A resource was in an inconsistent state during an update or a deletion.
  • *
  • ValidationException The value of a parameter in the request caused an error.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action.
  • *
  • InternalServerException Unexpected error while processing the request. Retry the request.
  • *
  • 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.
  • *
  • GrafanaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample GrafanaAsyncClient.UpdateWorkspace * @see AWS API * Documentation */ @Override public CompletableFuture updateWorkspace(UpdateWorkspaceRequest updateWorkspaceRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateWorkspaceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateWorkspaceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "grafana"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateWorkspace"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateWorkspaceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateWorkspace").withProtocolMetadata(protocolMetadata) .withMarshaller(new UpdateWorkspaceRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(updateWorkspaceRequest)); 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); } } /** *

* Use this operation to define the identity provider (IdP) that this workspace authenticates users from, using * SAML. You can also map SAML assertion attributes to workspace user information and define which groups in the * assertion attribute are to have the Admin and Editor roles in the workspace. *

* *

* Changes to the authentication method for a workspace may take a few minutes to take effect. *

*
* * @param updateWorkspaceAuthenticationRequest * @return A Java Future containing the result of the UpdateWorkspaceAuthentication operation returned by the * service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The request references a resource that does not exist.
  • *
  • ThrottlingException The request was denied because of request throttling. Retry the request.
  • *
  • ConflictException A resource was in an inconsistent state during an update or a deletion.
  • *
  • ValidationException The value of a parameter in the request caused an error.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action.
  • *
  • InternalServerException Unexpected error while processing the request. Retry the request.
  • *
  • 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.
  • *
  • GrafanaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample GrafanaAsyncClient.UpdateWorkspaceAuthentication * @see AWS API Documentation */ @Override public CompletableFuture updateWorkspaceAuthentication( UpdateWorkspaceAuthenticationRequest updateWorkspaceAuthenticationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateWorkspaceAuthenticationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateWorkspaceAuthenticationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "grafana"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateWorkspaceAuthentication"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateWorkspaceAuthenticationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateWorkspaceAuthentication").withProtocolMetadata(protocolMetadata) .withMarshaller(new UpdateWorkspaceAuthenticationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(updateWorkspaceAuthenticationRequest)); 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); } } /** *

* Updates the configuration string for the given workspace *

* * @param updateWorkspaceConfigurationRequest * @return A Java Future containing the result of the UpdateWorkspaceConfiguration operation returned by the * service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. *
    *
  • ResourceNotFoundException The request references a resource that does not exist.
  • *
  • ThrottlingException The request was denied because of request throttling. Retry the request.
  • *
  • ConflictException A resource was in an inconsistent state during an update or a deletion.
  • *
  • ValidationException The value of a parameter in the request caused an error.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action.
  • *
  • InternalServerException Unexpected error while processing the request. Retry the request.
  • *
  • 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.
  • *
  • GrafanaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample GrafanaAsyncClient.UpdateWorkspaceConfiguration * @see AWS API Documentation */ @Override public CompletableFuture updateWorkspaceConfiguration( UpdateWorkspaceConfigurationRequest updateWorkspaceConfigurationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateWorkspaceConfigurationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateWorkspaceConfigurationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "grafana"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateWorkspaceConfiguration"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateWorkspaceConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateWorkspaceConfiguration").withProtocolMetadata(protocolMetadata) .withMarshaller(new UpdateWorkspaceConfigurationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(updateWorkspaceConfigurationRequest)); 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 GrafanaServiceClientConfiguration serviceClientConfiguration() { return new GrafanaServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build(); } @Override public final String serviceName() { return SERVICE_NAME; } private > T init(T builder) { return builder .clientConfiguration(clientConfiguration) .defaultServiceExceptionSupplier(GrafanaException::builder) .protocol(AwsJsonProtocol.REST_JSON) .protocolVersion("1.1") .registerModeledException( ExceptionMetadata.builder().errorCode("AccessDeniedException") .exceptionBuilderSupplier(AccessDeniedException::builder).httpStatusCode(403).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ConflictException") .exceptionBuilderSupplier(ConflictException::builder).httpStatusCode(409).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ResourceNotFoundException") .exceptionBuilderSupplier(ResourceNotFoundException::builder).httpStatusCode(404).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ThrottlingException") .exceptionBuilderSupplier(ThrottlingException::builder).httpStatusCode(429).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ValidationException") .exceptionBuilderSupplier(ValidationException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ServiceQuotaExceededException") .exceptionBuilderSupplier(ServiceQuotaExceededException::builder).httpStatusCode(402).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InternalServerException") .exceptionBuilderSupplier(InternalServerException::builder).httpStatusCode(500).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 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(); } GrafanaServiceClientConfigurationBuilder serviceConfigBuilder = new GrafanaServiceClientConfigurationBuilder( configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } return configuration.build(); } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata) { return protocolFactory.createErrorResponseHandler(operationMetadata); } @Override public void close() { clientHandler.close(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy