software.amazon.awssdk.services.amp.DefaultAmpClient Maven / Gradle / Ivy
Show all versions of amp Show documentation
/*
* 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.amp;
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.amp.internal.AmpServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.amp.model.AccessDeniedException;
import software.amazon.awssdk.services.amp.model.AmpException;
import software.amazon.awssdk.services.amp.model.ConflictException;
import software.amazon.awssdk.services.amp.model.CreateAlertManagerDefinitionRequest;
import software.amazon.awssdk.services.amp.model.CreateAlertManagerDefinitionResponse;
import software.amazon.awssdk.services.amp.model.CreateLoggingConfigurationRequest;
import software.amazon.awssdk.services.amp.model.CreateLoggingConfigurationResponse;
import software.amazon.awssdk.services.amp.model.CreateRuleGroupsNamespaceRequest;
import software.amazon.awssdk.services.amp.model.CreateRuleGroupsNamespaceResponse;
import software.amazon.awssdk.services.amp.model.CreateScraperRequest;
import software.amazon.awssdk.services.amp.model.CreateScraperResponse;
import software.amazon.awssdk.services.amp.model.CreateWorkspaceRequest;
import software.amazon.awssdk.services.amp.model.CreateWorkspaceResponse;
import software.amazon.awssdk.services.amp.model.DeleteAlertManagerDefinitionRequest;
import software.amazon.awssdk.services.amp.model.DeleteAlertManagerDefinitionResponse;
import software.amazon.awssdk.services.amp.model.DeleteLoggingConfigurationRequest;
import software.amazon.awssdk.services.amp.model.DeleteLoggingConfigurationResponse;
import software.amazon.awssdk.services.amp.model.DeleteRuleGroupsNamespaceRequest;
import software.amazon.awssdk.services.amp.model.DeleteRuleGroupsNamespaceResponse;
import software.amazon.awssdk.services.amp.model.DeleteScraperRequest;
import software.amazon.awssdk.services.amp.model.DeleteScraperResponse;
import software.amazon.awssdk.services.amp.model.DeleteWorkspaceRequest;
import software.amazon.awssdk.services.amp.model.DeleteWorkspaceResponse;
import software.amazon.awssdk.services.amp.model.DescribeAlertManagerDefinitionRequest;
import software.amazon.awssdk.services.amp.model.DescribeAlertManagerDefinitionResponse;
import software.amazon.awssdk.services.amp.model.DescribeLoggingConfigurationRequest;
import software.amazon.awssdk.services.amp.model.DescribeLoggingConfigurationResponse;
import software.amazon.awssdk.services.amp.model.DescribeRuleGroupsNamespaceRequest;
import software.amazon.awssdk.services.amp.model.DescribeRuleGroupsNamespaceResponse;
import software.amazon.awssdk.services.amp.model.DescribeScraperRequest;
import software.amazon.awssdk.services.amp.model.DescribeScraperResponse;
import software.amazon.awssdk.services.amp.model.DescribeWorkspaceRequest;
import software.amazon.awssdk.services.amp.model.DescribeWorkspaceResponse;
import software.amazon.awssdk.services.amp.model.GetDefaultScraperConfigurationRequest;
import software.amazon.awssdk.services.amp.model.GetDefaultScraperConfigurationResponse;
import software.amazon.awssdk.services.amp.model.InternalServerException;
import software.amazon.awssdk.services.amp.model.ListRuleGroupsNamespacesRequest;
import software.amazon.awssdk.services.amp.model.ListRuleGroupsNamespacesResponse;
import software.amazon.awssdk.services.amp.model.ListScrapersRequest;
import software.amazon.awssdk.services.amp.model.ListScrapersResponse;
import software.amazon.awssdk.services.amp.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.amp.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.amp.model.ListWorkspacesRequest;
import software.amazon.awssdk.services.amp.model.ListWorkspacesResponse;
import software.amazon.awssdk.services.amp.model.PutAlertManagerDefinitionRequest;
import software.amazon.awssdk.services.amp.model.PutAlertManagerDefinitionResponse;
import software.amazon.awssdk.services.amp.model.PutRuleGroupsNamespaceRequest;
import software.amazon.awssdk.services.amp.model.PutRuleGroupsNamespaceResponse;
import software.amazon.awssdk.services.amp.model.ResourceNotFoundException;
import software.amazon.awssdk.services.amp.model.ServiceQuotaExceededException;
import software.amazon.awssdk.services.amp.model.TagResourceRequest;
import software.amazon.awssdk.services.amp.model.TagResourceResponse;
import software.amazon.awssdk.services.amp.model.ThrottlingException;
import software.amazon.awssdk.services.amp.model.UntagResourceRequest;
import software.amazon.awssdk.services.amp.model.UntagResourceResponse;
import software.amazon.awssdk.services.amp.model.UpdateLoggingConfigurationRequest;
import software.amazon.awssdk.services.amp.model.UpdateLoggingConfigurationResponse;
import software.amazon.awssdk.services.amp.model.UpdateWorkspaceAliasRequest;
import software.amazon.awssdk.services.amp.model.UpdateWorkspaceAliasResponse;
import software.amazon.awssdk.services.amp.model.ValidationException;
import software.amazon.awssdk.services.amp.transform.CreateAlertManagerDefinitionRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.CreateLoggingConfigurationRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.CreateRuleGroupsNamespaceRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.CreateScraperRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.CreateWorkspaceRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.DeleteAlertManagerDefinitionRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.DeleteLoggingConfigurationRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.DeleteRuleGroupsNamespaceRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.DeleteScraperRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.DeleteWorkspaceRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.DescribeAlertManagerDefinitionRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.DescribeLoggingConfigurationRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.DescribeRuleGroupsNamespaceRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.DescribeScraperRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.DescribeWorkspaceRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.GetDefaultScraperConfigurationRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.ListRuleGroupsNamespacesRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.ListScrapersRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.ListWorkspacesRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.PutAlertManagerDefinitionRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.PutRuleGroupsNamespaceRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.UpdateLoggingConfigurationRequestMarshaller;
import software.amazon.awssdk.services.amp.transform.UpdateWorkspaceAliasRequestMarshaller;
import software.amazon.awssdk.services.amp.waiters.AmpWaiter;
import software.amazon.awssdk.utils.Logger;
/**
* Internal implementation of {@link AmpClient}.
*
* @see AmpClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultAmpClient implements AmpClient {
private static final Logger log = Logger.loggerFor(DefaultAmpClient.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 DefaultAmpClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
/**
*
* The CreateAlertManagerDefinition
operation creates the alert manager definition in a workspace. If a
* workspace already has an alert manager definition, don't use this operation to update it. Instead, use
* PutAlertManagerDefinition
.
*
*
* @param createAlertManagerDefinitionRequest
* Represents the input of a CreateAlertManagerDefinition
operation.
* @return Result of the CreateAlertManagerDefinition operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws ConflictException
* The request would cause an inconsistent state.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws ResourceNotFoundException
* The request references a resources that doesn't exist.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws ServiceQuotaExceededException
* Completing 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.CreateAlertManagerDefinition
* @see AWS API Documentation
*/
@Override
public CreateAlertManagerDefinitionResponse createAlertManagerDefinition(
CreateAlertManagerDefinitionRequest createAlertManagerDefinitionRequest) throws ThrottlingException,
ConflictException, ValidationException, ResourceNotFoundException, AccessDeniedException, InternalServerException,
ServiceQuotaExceededException, AwsServiceException, SdkClientException, AmpException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateAlertManagerDefinitionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createAlertManagerDefinitionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createAlertManagerDefinitionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "amp");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateAlertManagerDefinition");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateAlertManagerDefinition").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(createAlertManagerDefinitionRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateAlertManagerDefinitionRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* The CreateLoggingConfiguration
operation creates a logging configuration for the workspace. Use this
* operation to set the CloudWatch log group to which the logs will be published to.
*
*
* @param createLoggingConfigurationRequest
* Represents the input of a CreateLoggingConfiguration
operation.
* @return Result of the CreateLoggingConfiguration operation returned by the service.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws ResourceNotFoundException
* The request references a resources that doesn't exist.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.CreateLoggingConfiguration
* @see AWS API Documentation
*/
@Override
public CreateLoggingConfigurationResponse createLoggingConfiguration(
CreateLoggingConfigurationRequest createLoggingConfigurationRequest) throws ValidationException,
ResourceNotFoundException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException,
AmpException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateLoggingConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createLoggingConfigurationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createLoggingConfigurationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "amp");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateLoggingConfiguration");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateLoggingConfiguration").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(createLoggingConfigurationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateLoggingConfigurationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* The CreateRuleGroupsNamespace
operation creates a rule groups namespace within a workspace. A rule
* groups namespace is associated with exactly one rules file. A workspace can have multiple rule groups namespaces.
*
*
* Use this operation only to create new rule groups namespaces. To update an existing rule groups namespace, use
* PutRuleGroupsNamespace
.
*
*
* @param createRuleGroupsNamespaceRequest
* Represents the input of a CreateRuleGroupsNamespace
operation.
* @return Result of the CreateRuleGroupsNamespace operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws ConflictException
* The request would cause an inconsistent state.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws ResourceNotFoundException
* The request references a resources that doesn't exist.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws ServiceQuotaExceededException
* Completing 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.CreateRuleGroupsNamespace
* @see AWS
* API Documentation
*/
@Override
public CreateRuleGroupsNamespaceResponse createRuleGroupsNamespace(
CreateRuleGroupsNamespaceRequest createRuleGroupsNamespaceRequest) throws ThrottlingException, ConflictException,
ValidationException, ResourceNotFoundException, AccessDeniedException, InternalServerException,
ServiceQuotaExceededException, AwsServiceException, SdkClientException, AmpException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateRuleGroupsNamespaceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createRuleGroupsNamespaceRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createRuleGroupsNamespaceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "amp");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateRuleGroupsNamespace");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateRuleGroupsNamespace").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(createRuleGroupsNamespaceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateRuleGroupsNamespaceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* The CreateScraper
operation creates a scraper to collect metrics. A scraper pulls metrics from
* Prometheus-compatible sources within an Amazon EKS cluster, and sends them to your Amazon Managed Service for
* Prometheus workspace. You can configure the scraper to control what metrics are collected, and what
* transformations are applied prior to sending them to your workspace.
*
*
* If needed, an IAM role will be created for you that gives Amazon Managed Service for Prometheus access to the
* metrics in your cluster. For more information, see Using roles for scraping metrics from EKS in the Amazon Managed Service for Prometheus User Guide.
*
*
* You cannot update a scraper. If you want to change the configuration of the scraper, create a new scraper and
* delete the old one.
*
*
* The scrapeConfiguration
parameter contains the base64-encoded version of the YAML configuration
* file.
*
*
*
* For more information about collectors, including what metrics are collected, and how to configure the scraper,
* see Amazon Web Services
* managed collectors in the Amazon Managed Service for Prometheus User Guide.
*
*
*
* @param createScraperRequest
* Represents the input of a CreateScraper
operation.
* @return Result of the CreateScraper operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws ConflictException
* The request would cause an inconsistent state.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws ResourceNotFoundException
* The request references a resources that doesn't exist.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws ServiceQuotaExceededException
* Completing 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.CreateScraper
* @see AWS API
* Documentation
*/
@Override
public CreateScraperResponse createScraper(CreateScraperRequest createScraperRequest) throws ThrottlingException,
ConflictException, ValidationException, ResourceNotFoundException, AccessDeniedException, InternalServerException,
ServiceQuotaExceededException, AwsServiceException, SdkClientException, AmpException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateScraperResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createScraperRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createScraperRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "amp");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateScraper");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateScraper").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(createScraperRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateScraperRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a Prometheus workspace. A workspace is a logical space dedicated to the storage and querying of
* Prometheus metrics. You can have one or more workspaces in each Region in your account.
*
*
* @param createWorkspaceRequest
* Represents the input of a CreateWorkspace
operation.
* @return Result of the CreateWorkspace operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws ConflictException
* The request would cause an inconsistent state.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws ServiceQuotaExceededException
* Completing 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.CreateWorkspace
* @see AWS API
* Documentation
*/
@Override
public CreateWorkspaceResponse createWorkspace(CreateWorkspaceRequest createWorkspaceRequest) throws ThrottlingException,
ConflictException, ValidationException, AccessDeniedException, InternalServerException,
ServiceQuotaExceededException, AwsServiceException, SdkClientException, AmpException {
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, "amp");
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()));
}
}
/**
*
* Deletes the alert manager definition from a workspace.
*
*
* @param deleteAlertManagerDefinitionRequest
* Represents the input of a DeleteAlertManagerDefinition
operation.
* @return Result of the DeleteAlertManagerDefinition operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws ConflictException
* The request would cause an inconsistent state.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws ResourceNotFoundException
* The request references a resources that doesn't exist.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.DeleteAlertManagerDefinition
* @see AWS API Documentation
*/
@Override
public DeleteAlertManagerDefinitionResponse deleteAlertManagerDefinition(
DeleteAlertManagerDefinitionRequest deleteAlertManagerDefinitionRequest) throws ThrottlingException,
ConflictException, ValidationException, ResourceNotFoundException, AccessDeniedException, InternalServerException,
AwsServiceException, SdkClientException, AmpException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteAlertManagerDefinitionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteAlertManagerDefinitionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteAlertManagerDefinitionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "amp");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteAlertManagerDefinition");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteAlertManagerDefinition").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(deleteAlertManagerDefinitionRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteAlertManagerDefinitionRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes the logging configuration for a workspace.
*
*
* @param deleteLoggingConfigurationRequest
* Represents the input of a DeleteLoggingConfiguration
operation.
* @return Result of the DeleteLoggingConfiguration operation returned by the service.
* @throws ConflictException
* The request would cause an inconsistent state.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws ResourceNotFoundException
* The request references a resources that doesn't exist.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.DeleteLoggingConfiguration
* @see AWS API Documentation
*/
@Override
public DeleteLoggingConfigurationResponse deleteLoggingConfiguration(
DeleteLoggingConfigurationRequest deleteLoggingConfigurationRequest) throws ConflictException, ValidationException,
ResourceNotFoundException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException,
AmpException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteLoggingConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteLoggingConfigurationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteLoggingConfigurationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "amp");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteLoggingConfiguration");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteLoggingConfiguration").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(deleteLoggingConfigurationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteLoggingConfigurationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes one rule groups namespace and its associated rule groups definition.
*
*
* @param deleteRuleGroupsNamespaceRequest
* Represents the input of a DeleteRuleGroupsNamespace
operation.
* @return Result of the DeleteRuleGroupsNamespace operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws ConflictException
* The request would cause an inconsistent state.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws ResourceNotFoundException
* The request references a resources that doesn't exist.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.DeleteRuleGroupsNamespace
* @see AWS
* API Documentation
*/
@Override
public DeleteRuleGroupsNamespaceResponse deleteRuleGroupsNamespace(
DeleteRuleGroupsNamespaceRequest deleteRuleGroupsNamespaceRequest) throws ThrottlingException, ConflictException,
ValidationException, ResourceNotFoundException, AccessDeniedException, InternalServerException, AwsServiceException,
SdkClientException, AmpException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteRuleGroupsNamespaceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteRuleGroupsNamespaceRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteRuleGroupsNamespaceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "amp");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteRuleGroupsNamespace");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteRuleGroupsNamespace").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(deleteRuleGroupsNamespaceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteRuleGroupsNamespaceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* The DeleteScraper
operation deletes one scraper, and stops any metrics collection that the scraper
* performs.
*
*
* @param deleteScraperRequest
* Represents the input of a DeleteScraper
operation.
* @return Result of the DeleteScraper operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws ConflictException
* The request would cause an inconsistent state.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws ResourceNotFoundException
* The request references a resources that doesn't exist.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.DeleteScraper
* @see AWS API
* Documentation
*/
@Override
public DeleteScraperResponse deleteScraper(DeleteScraperRequest deleteScraperRequest) throws ThrottlingException,
ConflictException, ValidationException, ResourceNotFoundException, AccessDeniedException, InternalServerException,
AwsServiceException, SdkClientException, AmpException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteScraperResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteScraperRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteScraperRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "amp");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteScraper");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteScraper").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(deleteScraperRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteScraperRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes an existing workspace.
*
*
*
* When you delete a workspace, the data that has been ingested into it is not immediately deleted. It will be
* permanently deleted within one month.
*
*
*
* @param deleteWorkspaceRequest
* Represents the input of a DeleteWorkspace
operation.
* @return Result of the DeleteWorkspace operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws ConflictException
* The request would cause an inconsistent state.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws ResourceNotFoundException
* The request references a resources that doesn't exist.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.DeleteWorkspace
* @see AWS API
* Documentation
*/
@Override
public DeleteWorkspaceResponse deleteWorkspace(DeleteWorkspaceRequest deleteWorkspaceRequest) throws ThrottlingException,
ConflictException, ValidationException, ResourceNotFoundException, AccessDeniedException, InternalServerException,
AwsServiceException, SdkClientException, AmpException {
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, "amp");
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()));
}
}
/**
*
* Retrieves the full information about the alert manager definition for a workspace.
*
*
* @param describeAlertManagerDefinitionRequest
* Represents the input of a DescribeAlertManagerDefinition
operation.
* @return Result of the DescribeAlertManagerDefinition operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws ResourceNotFoundException
* The request references a resources that doesn't exist.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.DescribeAlertManagerDefinition
* @see AWS API Documentation
*/
@Override
public DescribeAlertManagerDefinitionResponse describeAlertManagerDefinition(
DescribeAlertManagerDefinitionRequest describeAlertManagerDefinitionRequest) throws ThrottlingException,
ValidationException, ResourceNotFoundException, AccessDeniedException, InternalServerException, AwsServiceException,
SdkClientException, AmpException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeAlertManagerDefinitionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeAlertManagerDefinitionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
describeAlertManagerDefinitionRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "amp");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeAlertManagerDefinition");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeAlertManagerDefinition").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(describeAlertManagerDefinitionRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribeAlertManagerDefinitionRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns complete information about the current logging configuration of the workspace.
*
*
* @param describeLoggingConfigurationRequest
* Represents the input of a DescribeLoggingConfiguration
operation.
* @return Result of the DescribeLoggingConfiguration operation returned by the service.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws ResourceNotFoundException
* The request references a resources that doesn't exist.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.DescribeLoggingConfiguration
* @see AWS API Documentation
*/
@Override
public DescribeLoggingConfigurationResponse describeLoggingConfiguration(
DescribeLoggingConfigurationRequest describeLoggingConfigurationRequest) throws ValidationException,
ResourceNotFoundException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException,
AmpException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeLoggingConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeLoggingConfigurationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeLoggingConfigurationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "amp");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeLoggingConfiguration");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeLoggingConfiguration").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(describeLoggingConfigurationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribeLoggingConfigurationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns complete information about one rule groups namespace. To retrieve a list of rule groups namespaces, use
* ListRuleGroupsNamespaces
.
*
*
* @param describeRuleGroupsNamespaceRequest
* Represents the input of a DescribeRuleGroupsNamespace
operation.
* @return Result of the DescribeRuleGroupsNamespace operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws ResourceNotFoundException
* The request references a resources that doesn't exist.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.DescribeRuleGroupsNamespace
* @see AWS API Documentation
*/
@Override
public DescribeRuleGroupsNamespaceResponse describeRuleGroupsNamespace(
DescribeRuleGroupsNamespaceRequest describeRuleGroupsNamespaceRequest) throws ThrottlingException,
ValidationException, ResourceNotFoundException, AccessDeniedException, InternalServerException, AwsServiceException,
SdkClientException, AmpException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeRuleGroupsNamespaceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeRuleGroupsNamespaceRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeRuleGroupsNamespaceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "amp");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeRuleGroupsNamespace");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeRuleGroupsNamespace").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(describeRuleGroupsNamespaceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribeRuleGroupsNamespaceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* The DescribeScraper
operation displays information about an existing scraper.
*
*
* @param describeScraperRequest
* Represents the input of a DescribeScraper
operation.
* @return Result of the DescribeScraper operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws ResourceNotFoundException
* The request references a resources that doesn't exist.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.DescribeScraper
* @see AWS API
* Documentation
*/
@Override
public DescribeScraperResponse describeScraper(DescribeScraperRequest describeScraperRequest) throws ThrottlingException,
ValidationException, ResourceNotFoundException, AccessDeniedException, InternalServerException, AwsServiceException,
SdkClientException, AmpException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DescribeScraperResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeScraperRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeScraperRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "amp");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeScraper");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeScraper").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(describeScraperRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DescribeScraperRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns information about an existing workspace.
*
*
* @param describeWorkspaceRequest
* Represents the input of a DescribeWorkspace
operation.
* @return Result of the DescribeWorkspace operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws ResourceNotFoundException
* The request references a resources that doesn't exist.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.DescribeWorkspace
* @see AWS API
* Documentation
*/
@Override
public DescribeWorkspaceResponse describeWorkspace(DescribeWorkspaceRequest describeWorkspaceRequest)
throws ThrottlingException, ValidationException, ResourceNotFoundException, AccessDeniedException,
InternalServerException, AwsServiceException, SdkClientException, AmpException {
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, "amp");
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()));
}
}
/**
*
* The GetDefaultScraperConfiguration
operation returns the default scraper configuration used when
* Amazon EKS creates a scraper for you.
*
*
* @param getDefaultScraperConfigurationRequest
* Represents the input of a GetDefaultScraperConfiguration
operation.
* @return Result of the GetDefaultScraperConfiguration operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.GetDefaultScraperConfiguration
* @see AWS API Documentation
*/
@Override
public GetDefaultScraperConfigurationResponse getDefaultScraperConfiguration(
GetDefaultScraperConfigurationRequest getDefaultScraperConfigurationRequest) throws ThrottlingException,
AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException, AmpException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetDefaultScraperConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getDefaultScraperConfigurationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
getDefaultScraperConfigurationRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "amp");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetDefaultScraperConfiguration");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("GetDefaultScraperConfiguration").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(getDefaultScraperConfigurationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetDefaultScraperConfigurationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns a list of rule groups namespaces in a workspace.
*
*
* @param listRuleGroupsNamespacesRequest
* Represents the input of a ListRuleGroupsNamespaces
operation.
* @return Result of the ListRuleGroupsNamespaces operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws ResourceNotFoundException
* The request references a resources that doesn't exist.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.ListRuleGroupsNamespaces
* @see AWS
* API Documentation
*/
@Override
public ListRuleGroupsNamespacesResponse listRuleGroupsNamespaces(
ListRuleGroupsNamespacesRequest listRuleGroupsNamespacesRequest) throws ThrottlingException, ValidationException,
ResourceNotFoundException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException,
AmpException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListRuleGroupsNamespacesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listRuleGroupsNamespacesRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listRuleGroupsNamespacesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "amp");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListRuleGroupsNamespaces");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListRuleGroupsNamespaces").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listRuleGroupsNamespacesRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListRuleGroupsNamespacesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* The ListScrapers
operation lists all of the scrapers in your account. This includes scrapers being
* created or deleted. You can optionally filter the returned list.
*
*
* @param listScrapersRequest
* Represents the input of a ListScrapers
operation.
* @return Result of the ListScrapers operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.ListScrapers
* @see AWS API
* Documentation
*/
@Override
public ListScrapersResponse listScrapers(ListScrapersRequest listScrapersRequest) throws ThrottlingException,
ValidationException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException,
AmpException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListScrapersResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listScrapersRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listScrapersRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "amp");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListScrapers");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListScrapers").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listScrapersRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListScrapersRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* The ListTagsForResource
operation returns the tags that are associated with an Amazon Managed
* Service for Prometheus resource. Currently, the only resources that can be tagged are workspaces and rule groups
* namespaces.
*
*
* @param listTagsForResourceRequest
* @return Result of the ListTagsForResource operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws ResourceNotFoundException
* The request references a resources that doesn't exist.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.ListTagsForResource
* @see AWS API
* Documentation
*/
@Override
public ListTagsForResourceResponse listTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest)
throws ThrottlingException, ValidationException, ResourceNotFoundException, AccessDeniedException,
InternalServerException, AwsServiceException, SdkClientException, AmpException {
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, "amp");
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 all of the Amazon Managed Service for Prometheus workspaces in your account. This includes workspaces being
* created or deleted.
*
*
* @param listWorkspacesRequest
* Represents the input of a ListWorkspaces
operation.
* @return Result of the ListWorkspaces operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.ListWorkspaces
* @see AWS API
* Documentation
*/
@Override
public ListWorkspacesResponse listWorkspaces(ListWorkspacesRequest listWorkspacesRequest) throws ThrottlingException,
ValidationException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException,
AmpException {
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, "amp");
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()));
}
}
/**
*
* Updates an existing alert manager definition in a workspace. If the workspace does not already have an alert
* manager definition, don't use this operation to create it. Instead, use CreateAlertManagerDefinition
* .
*
*
* @param putAlertManagerDefinitionRequest
* Represents the input of a PutAlertManagerDefinition
operation.
* @return Result of the PutAlertManagerDefinition operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws ConflictException
* The request would cause an inconsistent state.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws ResourceNotFoundException
* The request references a resources that doesn't exist.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws ServiceQuotaExceededException
* Completing 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.PutAlertManagerDefinition
* @see AWS
* API Documentation
*/
@Override
public PutAlertManagerDefinitionResponse putAlertManagerDefinition(
PutAlertManagerDefinitionRequest putAlertManagerDefinitionRequest) throws ThrottlingException, ConflictException,
ValidationException, ResourceNotFoundException, AccessDeniedException, InternalServerException,
ServiceQuotaExceededException, AwsServiceException, SdkClientException, AmpException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, PutAlertManagerDefinitionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putAlertManagerDefinitionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, putAlertManagerDefinitionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "amp");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutAlertManagerDefinition");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("PutAlertManagerDefinition").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(putAlertManagerDefinitionRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new PutAlertManagerDefinitionRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates an existing rule groups namespace within a workspace. A rule groups namespace is associated with exactly
* one rules file. A workspace can have multiple rule groups namespaces.
*
*
* Use this operation only to update existing rule groups namespaces. To create a new rule groups namespace, use
* CreateRuleGroupsNamespace
.
*
*
* You can't use this operation to add tags to an existing rule groups namespace. Instead, use
* TagResource
.
*
*
* @param putRuleGroupsNamespaceRequest
* Represents the input of a PutRuleGroupsNamespace
operation.
* @return Result of the PutRuleGroupsNamespace operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws ConflictException
* The request would cause an inconsistent state.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws ResourceNotFoundException
* The request references a resources that doesn't exist.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws ServiceQuotaExceededException
* Completing 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.PutRuleGroupsNamespace
* @see AWS
* API Documentation
*/
@Override
public PutRuleGroupsNamespaceResponse putRuleGroupsNamespace(PutRuleGroupsNamespaceRequest putRuleGroupsNamespaceRequest)
throws ThrottlingException, ConflictException, ValidationException, ResourceNotFoundException, AccessDeniedException,
InternalServerException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, AmpException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, PutRuleGroupsNamespaceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putRuleGroupsNamespaceRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, putRuleGroupsNamespaceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "amp");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutRuleGroupsNamespace");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("PutRuleGroupsNamespace").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(putRuleGroupsNamespaceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new PutRuleGroupsNamespaceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* The TagResource
operation associates tags with an Amazon Managed Service for Prometheus resource.
* The only resources that can be tagged are workspaces and rule groups namespaces.
*
*
* 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 ThrottlingException
* The request was denied due to request throttling.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws ResourceNotFoundException
* The request references a resources that doesn't exist.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.TagResource
* @see AWS API
* Documentation
*/
@Override
public TagResourceResponse tagResource(TagResourceRequest tagResourceRequest) throws ThrottlingException,
ValidationException, ResourceNotFoundException, AccessDeniedException, InternalServerException, AwsServiceException,
SdkClientException, AmpException {
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, "amp");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("TagResource").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(tagResourceRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new TagResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Removes the specified tags from an Amazon Managed Service for Prometheus resource. The only resources that can be
* tagged are workspaces and rule groups namespaces.
*
*
* @param untagResourceRequest
* @return Result of the UntagResource operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws ResourceNotFoundException
* The request references a resources that doesn't exist.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.UntagResource
* @see AWS API
* Documentation
*/
@Override
public UntagResourceResponse untagResource(UntagResourceRequest untagResourceRequest) throws ThrottlingException,
ValidationException, ResourceNotFoundException, AccessDeniedException, InternalServerException, AwsServiceException,
SdkClientException, AmpException {
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, "amp");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagResource");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UntagResource").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(untagResourceRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UntagResourceRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates the log group ARN or the workspace ID of the current logging configuration.
*
*
* @param updateLoggingConfigurationRequest
* Represents the input of an UpdateLoggingConfiguration
operation.
* @return Result of the UpdateLoggingConfiguration operation returned by the service.
* @throws ConflictException
* The request would cause an inconsistent state.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws ResourceNotFoundException
* The request references a resources that doesn't exist.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.UpdateLoggingConfiguration
* @see AWS API Documentation
*/
@Override
public UpdateLoggingConfigurationResponse updateLoggingConfiguration(
UpdateLoggingConfigurationRequest updateLoggingConfigurationRequest) throws ConflictException, ValidationException,
ResourceNotFoundException, AccessDeniedException, InternalServerException, AwsServiceException, SdkClientException,
AmpException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateLoggingConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateLoggingConfigurationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateLoggingConfigurationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "amp");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateLoggingConfiguration");
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateLoggingConfiguration").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(updateLoggingConfigurationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateLoggingConfigurationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates the alias of an existing workspace.
*
*
* @param updateWorkspaceAliasRequest
* Represents the input of an UpdateWorkspaceAlias
operation.
* @return Result of the UpdateWorkspaceAlias operation returned by the service.
* @throws ThrottlingException
* The request was denied due to request throttling.
* @throws ConflictException
* The request would cause an inconsistent state.
* @throws ValidationException
* The input fails to satisfy the constraints specified by an Amazon Web Services service.
* @throws ResourceNotFoundException
* The request references a resources that doesn't exist.
* @throws AccessDeniedException
* You do not have sufficient access to perform this action.
* @throws InternalServerException
* An unexpected error occurred during the processing of the request.
* @throws ServiceQuotaExceededException
* Completing 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 AmpException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample AmpClient.UpdateWorkspaceAlias
* @see AWS API
* Documentation
*/
@Override
public UpdateWorkspaceAliasResponse updateWorkspaceAlias(UpdateWorkspaceAliasRequest updateWorkspaceAliasRequest)
throws ThrottlingException, ConflictException, ValidationException, ResourceNotFoundException, AccessDeniedException,
InternalServerException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, AmpException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateWorkspaceAliasResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateWorkspaceAliasRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateWorkspaceAliasRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "amp");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateWorkspaceAlias");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateWorkspaceAlias").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(updateWorkspaceAliasRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateWorkspaceAliasRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
* Create an instance of {@link AmpWaiter} using this client.
*
* Waiters created via this method are managed by the SDK and resources will be released when the service client is
* closed.
*
* @return an instance of {@link AmpWaiter}
*/
@Override
public AmpWaiter waiter() {
return AmpWaiter.builder().client(this).build();
}
@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();
}
AmpServiceClientConfigurationBuilder serviceConfigBuilder = new AmpServiceClientConfigurationBuilder(configuration);
for (SdkPlugin plugin : plugins) {
plugin.configureClient(serviceConfigBuilder);
}
return configuration.build();
}
private > T init(T builder) {
return builder
.clientConfiguration(clientConfiguration)
.defaultServiceExceptionSupplier(AmpException::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 AmpServiceClientConfiguration serviceClientConfiguration() {
return new AmpServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build();
}
@Override
public void close() {
clientHandler.close();
}
}