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

software.amazon.awssdk.services.grafana.DefaultGrafanaClient 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 software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.awscore.internal.AwsProtocolMetadata;
import software.amazon.awssdk.awscore.internal.AwsServiceProtocol;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkPlugin;
import software.amazon.awssdk.core.SdkRequest;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientOption;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
import software.amazon.awssdk.core.client.handler.SyncClientHandler;
import software.amazon.awssdk.core.exception.SdkClientException;
import software.amazon.awssdk.core.http.HttpResponseHandler;
import software.amazon.awssdk.core.metrics.CoreMetric;
import software.amazon.awssdk.metrics.MetricCollector;
import software.amazon.awssdk.metrics.MetricPublisher;
import software.amazon.awssdk.metrics.NoOpMetricCollector;
import software.amazon.awssdk.protocols.core.ExceptionMetadata;
import software.amazon.awssdk.protocols.json.AwsJsonProtocol;
import software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.services.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.Logger;

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

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

    private final SyncClientHandler clientHandler;

    private final AwsJsonProtocolFactory protocolFactory;

    private final SdkClientConfiguration clientConfiguration;

    protected DefaultGrafanaClient(SdkClientConfiguration clientConfiguration) {
        this.clientHandler = new AwsSyncClientHandler(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 Result of the AssociateLicense operation returned by the service. * @throws ResourceNotFoundException * The request references a resource that does not exist. * @throws ThrottlingException * The request was denied because of request throttling. Retry the request. * @throws ValidationException * The value of a parameter in the request caused an error. * @throws AccessDeniedException * You do not have sufficient permissions to perform this action. * @throws InternalServerException * Unexpected error while processing the request. Retry the request. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GrafanaException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GrafanaClient.AssociateLicense * @see AWS API * Documentation */ @Override public AssociateLicenseResponse associateLicense(AssociateLicenseRequest associateLicenseRequest) throws ResourceNotFoundException, ThrottlingException, ValidationException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException, GrafanaException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, AssociateLicenseResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); 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"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("AssociateLicense").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(associateLicenseRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new AssociateLicenseRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* 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 Result of the CreateWorkspace operation returned by the service. * @throws ThrottlingException * The request was denied because of request throttling. Retry the request. * @throws ConflictException * A resource was in an inconsistent state during an update or a deletion. * @throws ValidationException * The value of a parameter in the request caused an error. * @throws AccessDeniedException * You do not have sufficient permissions to perform this action. * @throws InternalServerException * Unexpected error while processing the request. Retry the request. * @throws ServiceQuotaExceededException * The request would cause a service quota to be exceeded. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GrafanaException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GrafanaClient.CreateWorkspace * @see AWS API * Documentation */ @Override public CreateWorkspaceResponse createWorkspace(CreateWorkspaceRequest createWorkspaceRequest) throws ThrottlingException, ConflictException, ValidationException, AccessDeniedException, InternalServerException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, GrafanaException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, CreateWorkspaceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); 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"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateWorkspace").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(createWorkspaceRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateWorkspaceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* 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 Result of the CreateWorkspaceApiKey operation returned by the service. * @throws ResourceNotFoundException * The request references a resource that does not exist. * @throws ThrottlingException * The request was denied because of request throttling. Retry the request. * @throws ConflictException * A resource was in an inconsistent state during an update or a deletion. * @throws ValidationException * The value of a parameter in the request caused an error. * @throws AccessDeniedException * You do not have sufficient permissions to perform this action. * @throws InternalServerException * Unexpected error while processing the request. Retry the request. * @throws ServiceQuotaExceededException * The request would cause a service quota to be exceeded. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GrafanaException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GrafanaClient.CreateWorkspaceApiKey * @see AWS * API Documentation */ @Override public CreateWorkspaceApiKeyResponse createWorkspaceApiKey(CreateWorkspaceApiKeyRequest createWorkspaceApiKeyRequest) throws ResourceNotFoundException, ThrottlingException, ConflictException, ValidationException, AccessDeniedException, InternalServerException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, GrafanaException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreateWorkspaceApiKeyResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); 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"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateWorkspaceApiKey").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(createWorkspaceApiKeyRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateWorkspaceApiKeyRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Deletes an Amazon Managed Grafana workspace. *

* * @param deleteWorkspaceRequest * @return Result of the DeleteWorkspace operation returned by the service. * @throws ResourceNotFoundException * The request references a resource that does not exist. * @throws ThrottlingException * The request was denied because of request throttling. Retry the request. * @throws ConflictException * A resource was in an inconsistent state during an update or a deletion. * @throws ValidationException * The value of a parameter in the request caused an error. * @throws AccessDeniedException * You do not have sufficient permissions to perform this action. * @throws InternalServerException * Unexpected error while processing the request. Retry the request. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GrafanaException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GrafanaClient.DeleteWorkspace * @see AWS API * Documentation */ @Override public DeleteWorkspaceResponse deleteWorkspace(DeleteWorkspaceRequest deleteWorkspaceRequest) throws ResourceNotFoundException, ThrottlingException, ConflictException, ValidationException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException, GrafanaException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteWorkspaceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); 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"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteWorkspace").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(deleteWorkspaceRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteWorkspaceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Deletes a Grafana API key for the workspace. *

* * @param deleteWorkspaceApiKeyRequest * @return Result of the DeleteWorkspaceApiKey operation returned by the service. * @throws ResourceNotFoundException * The request references a resource that does not exist. * @throws ThrottlingException * The request was denied because of request throttling. Retry the request. * @throws ConflictException * A resource was in an inconsistent state during an update or a deletion. * @throws ValidationException * The value of a parameter in the request caused an error. * @throws AccessDeniedException * You do not have sufficient permissions to perform this action. * @throws InternalServerException * Unexpected error while processing the request. Retry the request. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GrafanaException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GrafanaClient.DeleteWorkspaceApiKey * @see AWS * API Documentation */ @Override public DeleteWorkspaceApiKeyResponse deleteWorkspaceApiKey(DeleteWorkspaceApiKeyRequest deleteWorkspaceApiKeyRequest) throws ResourceNotFoundException, ThrottlingException, ConflictException, ValidationException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException, GrafanaException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteWorkspaceApiKeyResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); 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"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteWorkspaceApiKey").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(deleteWorkspaceApiKeyRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteWorkspaceApiKeyRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Displays information about one Amazon Managed Grafana workspace. *

* * @param describeWorkspaceRequest * @return Result of the DescribeWorkspace operation returned by the service. * @throws ResourceNotFoundException * The request references a resource that does not exist. * @throws ThrottlingException * The request was denied because of request throttling. Retry the request. * @throws ValidationException * The value of a parameter in the request caused an error. * @throws AccessDeniedException * You do not have sufficient permissions to perform this action. * @throws InternalServerException * Unexpected error while processing the request. Retry the request. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GrafanaException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GrafanaClient.DescribeWorkspace * @see AWS API * Documentation */ @Override public DescribeWorkspaceResponse describeWorkspace(DescribeWorkspaceRequest describeWorkspaceRequest) throws ResourceNotFoundException, ThrottlingException, ValidationException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException, GrafanaException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DescribeWorkspaceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); 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"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DescribeWorkspace").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(describeWorkspaceRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeWorkspaceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

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

* * @param describeWorkspaceAuthenticationRequest * @return Result of the DescribeWorkspaceAuthentication operation returned by the service. * @throws ResourceNotFoundException * The request references a resource that does not exist. * @throws ThrottlingException * The request was denied because of request throttling. Retry the request. * @throws ValidationException * The value of a parameter in the request caused an error. * @throws AccessDeniedException * You do not have sufficient permissions to perform this action. * @throws InternalServerException * Unexpected error while processing the request. Retry the request. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GrafanaException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GrafanaClient.DescribeWorkspaceAuthentication * @see AWS API Documentation */ @Override public DescribeWorkspaceAuthenticationResponse describeWorkspaceAuthentication( DescribeWorkspaceAuthenticationRequest describeWorkspaceAuthenticationRequest) throws ResourceNotFoundException, ThrottlingException, ValidationException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException, GrafanaException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeWorkspaceAuthenticationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); 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"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeWorkspaceAuthentication").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(describeWorkspaceAuthenticationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeWorkspaceAuthenticationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

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

* * @param describeWorkspaceConfigurationRequest * @return Result of the DescribeWorkspaceConfiguration operation returned by the service. * @throws ResourceNotFoundException * The request references a resource that does not exist. * @throws ThrottlingException * The request was denied because of request throttling. Retry the request. * @throws AccessDeniedException * You do not have sufficient permissions to perform this action. * @throws InternalServerException * Unexpected error while processing the request. Retry the request. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GrafanaException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GrafanaClient.DescribeWorkspaceConfiguration * @see AWS API Documentation */ @Override public DescribeWorkspaceConfigurationResponse describeWorkspaceConfiguration( DescribeWorkspaceConfigurationRequest describeWorkspaceConfigurationRequest) throws ResourceNotFoundException, ThrottlingException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException, GrafanaException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeWorkspaceConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); 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"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeWorkspaceConfiguration").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(describeWorkspaceConfigurationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeWorkspaceConfigurationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Removes the Grafana Enterprise license from a workspace. *

* * @param disassociateLicenseRequest * @return Result of the DisassociateLicense operation returned by the service. * @throws ResourceNotFoundException * The request references a resource that does not exist. * @throws ThrottlingException * The request was denied because of request throttling. Retry the request. * @throws ValidationException * The value of a parameter in the request caused an error. * @throws AccessDeniedException * You do not have sufficient permissions to perform this action. * @throws InternalServerException * Unexpected error while processing the request. Retry the request. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GrafanaException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GrafanaClient.DisassociateLicense * @see AWS * API Documentation */ @Override public DisassociateLicenseResponse disassociateLicense(DisassociateLicenseRequest disassociateLicenseRequest) throws ResourceNotFoundException, ThrottlingException, ValidationException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException, GrafanaException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DisassociateLicenseResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); 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"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DisassociateLicense").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(disassociateLicenseRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DisassociateLicenseRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* 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 Result of the ListPermissions operation returned by the service. * @throws ResourceNotFoundException * The request references a resource that does not exist. * @throws ThrottlingException * The request was denied because of request throttling. Retry the request. * @throws ValidationException * The value of a parameter in the request caused an error. * @throws AccessDeniedException * You do not have sufficient permissions to perform this action. * @throws InternalServerException * Unexpected error while processing the request. Retry the request. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GrafanaException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GrafanaClient.ListPermissions * @see AWS API * Documentation */ @Override public ListPermissionsResponse listPermissions(ListPermissionsRequest listPermissionsRequest) throws ResourceNotFoundException, ThrottlingException, ValidationException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException, GrafanaException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListPermissionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); 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"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListPermissions").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listPermissionsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListPermissionsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* 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 Result of the ListTagsForResource operation returned by the service. * @throws ResourceNotFoundException * The request references a resource that does not exist. * @throws ThrottlingException * The request was denied because of request throttling. Retry the request. * @throws ValidationException * The value of a parameter in the request caused an error. * @throws AccessDeniedException * You do not have sufficient permissions to perform this action. * @throws InternalServerException * Unexpected error while processing the request. Retry the request. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GrafanaException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GrafanaClient.ListTagsForResource * @see AWS * API Documentation */ @Override public ListTagsForResourceResponse listTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest) throws ResourceNotFoundException, ThrottlingException, ValidationException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException, GrafanaException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListTagsForResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listTagsForResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "grafana"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListTagsForResource").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listTagsForResourceRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists 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 Result of the ListVersions operation returned by the service. * @throws ResourceNotFoundException * The request references a resource that does not exist. * @throws ThrottlingException * The request was denied because of request throttling. Retry the request. * @throws ValidationException * The value of a parameter in the request caused an error. * @throws AccessDeniedException * You do not have sufficient permissions to perform this action. * @throws InternalServerException * Unexpected error while processing the request. Retry the request. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GrafanaException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GrafanaClient.ListVersions * @see AWS API * Documentation */ @Override public ListVersionsResponse listVersions(ListVersionsRequest listVersionsRequest) throws ResourceNotFoundException, ThrottlingException, ValidationException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException, GrafanaException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListVersionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); 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"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListVersions").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listVersionsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListVersionsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* 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 Result of the ListWorkspaces operation returned by the service. * @throws ThrottlingException * The request was denied because of request throttling. Retry the request. * @throws AccessDeniedException * You do not have sufficient permissions to perform this action. * @throws InternalServerException * Unexpected error while processing the request. Retry the request. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GrafanaException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GrafanaClient.ListWorkspaces * @see AWS API * Documentation */ @Override public ListWorkspacesResponse listWorkspaces(ListWorkspacesRequest listWorkspacesRequest) throws ThrottlingException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException, GrafanaException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListWorkspacesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); 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"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListWorkspaces").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listWorkspacesRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListWorkspacesRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* 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 Result of the TagResource operation returned by the service. * @throws ResourceNotFoundException * The request references a resource that does not exist. * @throws ThrottlingException * The request was denied because of request throttling. Retry the request. * @throws ValidationException * The value of a parameter in the request caused an error. * @throws AccessDeniedException * You do not have sufficient permissions to perform this action. * @throws InternalServerException * Unexpected error while processing the request. Retry the request. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GrafanaException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GrafanaClient.TagResource * @see AWS API * Documentation */ @Override public TagResourceResponse tagResource(TagResourceRequest tagResourceRequest) throws ResourceNotFoundException, ThrottlingException, ValidationException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException, GrafanaException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, TagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(tagResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, tagResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "grafana"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("TagResource").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(tagResourceRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new TagResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

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

* * @param untagResourceRequest * @return Result of the UntagResource operation returned by the service. * @throws ResourceNotFoundException * The request references a resource that does not exist. * @throws ThrottlingException * The request was denied because of request throttling. Retry the request. * @throws ValidationException * The value of a parameter in the request caused an error. * @throws AccessDeniedException * You do not have sufficient permissions to perform this action. * @throws InternalServerException * Unexpected error while processing the request. Retry the request. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GrafanaException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GrafanaClient.UntagResource * @see AWS API * Documentation */ @Override public UntagResourceResponse untagResource(UntagResourceRequest untagResourceRequest) throws ResourceNotFoundException, ThrottlingException, ValidationException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException, GrafanaException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UntagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(untagResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, untagResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "grafana"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UntagResource").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(untagResourceRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UntagResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

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

* * @param updatePermissionsRequest * @return Result of the UpdatePermissions operation returned by the service. * @throws ResourceNotFoundException * The request references a resource that does not exist. * @throws ThrottlingException * The request was denied because of request throttling. Retry the request. * @throws ValidationException * The value of a parameter in the request caused an error. * @throws AccessDeniedException * You do not have sufficient permissions to perform this action. * @throws InternalServerException * Unexpected error while processing the request. Retry the request. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GrafanaException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GrafanaClient.UpdatePermissions * @see AWS API * Documentation */ @Override public UpdatePermissionsResponse updatePermissions(UpdatePermissionsRequest updatePermissionsRequest) throws ResourceNotFoundException, ThrottlingException, ValidationException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException, GrafanaException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UpdatePermissionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); 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"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UpdatePermissions").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(updatePermissionsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdatePermissionsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* 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 Result of the UpdateWorkspace operation returned by the service. * @throws ResourceNotFoundException * The request references a resource that does not exist. * @throws ThrottlingException * The request was denied because of request throttling. Retry the request. * @throws ConflictException * A resource was in an inconsistent state during an update or a deletion. * @throws ValidationException * The value of a parameter in the request caused an error. * @throws AccessDeniedException * You do not have sufficient permissions to perform this action. * @throws InternalServerException * Unexpected error while processing the request. Retry the request. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GrafanaException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GrafanaClient.UpdateWorkspace * @see AWS API * Documentation */ @Override public UpdateWorkspaceResponse updateWorkspace(UpdateWorkspaceRequest updateWorkspaceRequest) throws ResourceNotFoundException, ThrottlingException, ConflictException, ValidationException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException, GrafanaException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UpdateWorkspaceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); 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"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UpdateWorkspace").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(updateWorkspaceRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateWorkspaceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* 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 Result of the UpdateWorkspaceAuthentication operation returned by the service. * @throws ResourceNotFoundException * The request references a resource that does not exist. * @throws ThrottlingException * The request was denied because of request throttling. Retry the request. * @throws ConflictException * A resource was in an inconsistent state during an update or a deletion. * @throws ValidationException * The value of a parameter in the request caused an error. * @throws AccessDeniedException * You do not have sufficient permissions to perform this action. * @throws InternalServerException * Unexpected error while processing the request. Retry the request. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GrafanaException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GrafanaClient.UpdateWorkspaceAuthentication * @see AWS API Documentation */ @Override public UpdateWorkspaceAuthenticationResponse updateWorkspaceAuthentication( UpdateWorkspaceAuthenticationRequest updateWorkspaceAuthenticationRequest) throws ResourceNotFoundException, ThrottlingException, ConflictException, ValidationException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException, GrafanaException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateWorkspaceAuthenticationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); 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"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateWorkspaceAuthentication").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(updateWorkspaceAuthenticationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateWorkspaceAuthenticationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Updates the configuration string for the given workspace *

* * @param updateWorkspaceConfigurationRequest * @return Result of the UpdateWorkspaceConfiguration operation returned by the service. * @throws ResourceNotFoundException * The request references a resource that does not exist. * @throws ThrottlingException * The request was denied because of request throttling. Retry the request. * @throws ConflictException * A resource was in an inconsistent state during an update or a deletion. * @throws ValidationException * The value of a parameter in the request caused an error. * @throws AccessDeniedException * You do not have sufficient permissions to perform this action. * @throws InternalServerException * Unexpected error while processing the request. Retry the request. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws GrafanaException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample GrafanaClient.UpdateWorkspaceConfiguration * @see AWS API Documentation */ @Override public UpdateWorkspaceConfigurationResponse updateWorkspaceConfiguration( UpdateWorkspaceConfigurationRequest updateWorkspaceConfigurationRequest) throws ResourceNotFoundException, ThrottlingException, ConflictException, ValidationException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException, GrafanaException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateWorkspaceConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); 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"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateWorkspaceConfiguration").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(updateWorkspaceConfigurationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateWorkspaceConfigurationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } @Override public final String serviceName() { return SERVICE_NAME; } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); } if (publishers == null || publishers.isEmpty()) { publishers = clientConfiguration.option(SdkClientOption.METRIC_PUBLISHERS); } if (publishers == null) { publishers = Collections.emptyList(); } return publishers; } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata) { return protocolFactory.createErrorResponseHandler(operationMetadata); } private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, SdkClientConfiguration clientConfiguration) { List plugins = request.overrideConfiguration().map(c -> c.plugins()).orElse(Collections.emptyList()); SdkClientConfiguration.Builder configuration = clientConfiguration.toBuilder(); if (plugins.isEmpty()) { return configuration.build(); } GrafanaServiceClientConfigurationBuilder serviceConfigBuilder = new GrafanaServiceClientConfigurationBuilder( configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } return configuration.build(); } 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()); } @Override public final GrafanaServiceClientConfiguration serviceClientConfiguration() { return new GrafanaServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build(); } @Override public void close() { clientHandler.close(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy