software.amazon.awssdk.services.resourcegroups.DefaultResourceGroupsClient Maven / Gradle / Ivy
Show all versions of resourcegroups 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.resourcegroups;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
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.awscore.retry.AwsRetryStrategy;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkPlugin;
import software.amazon.awssdk.core.SdkRequest;
import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientOption;
import software.amazon.awssdk.core.client.handler.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.core.retry.RetryMode;
import software.amazon.awssdk.metrics.MetricCollector;
import software.amazon.awssdk.metrics.MetricPublisher;
import software.amazon.awssdk.metrics.NoOpMetricCollector;
import software.amazon.awssdk.protocols.core.ExceptionMetadata;
import software.amazon.awssdk.protocols.json.AwsJsonProtocol;
import software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.resourcegroups.internal.ResourceGroupsServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.resourcegroups.model.BadRequestException;
import software.amazon.awssdk.services.resourcegroups.model.CancelTagSyncTaskRequest;
import software.amazon.awssdk.services.resourcegroups.model.CancelTagSyncTaskResponse;
import software.amazon.awssdk.services.resourcegroups.model.CreateGroupRequest;
import software.amazon.awssdk.services.resourcegroups.model.CreateGroupResponse;
import software.amazon.awssdk.services.resourcegroups.model.DeleteGroupRequest;
import software.amazon.awssdk.services.resourcegroups.model.DeleteGroupResponse;
import software.amazon.awssdk.services.resourcegroups.model.ForbiddenException;
import software.amazon.awssdk.services.resourcegroups.model.GetAccountSettingsRequest;
import software.amazon.awssdk.services.resourcegroups.model.GetAccountSettingsResponse;
import software.amazon.awssdk.services.resourcegroups.model.GetGroupConfigurationRequest;
import software.amazon.awssdk.services.resourcegroups.model.GetGroupConfigurationResponse;
import software.amazon.awssdk.services.resourcegroups.model.GetGroupQueryRequest;
import software.amazon.awssdk.services.resourcegroups.model.GetGroupQueryResponse;
import software.amazon.awssdk.services.resourcegroups.model.GetGroupRequest;
import software.amazon.awssdk.services.resourcegroups.model.GetGroupResponse;
import software.amazon.awssdk.services.resourcegroups.model.GetTagSyncTaskRequest;
import software.amazon.awssdk.services.resourcegroups.model.GetTagSyncTaskResponse;
import software.amazon.awssdk.services.resourcegroups.model.GetTagsRequest;
import software.amazon.awssdk.services.resourcegroups.model.GetTagsResponse;
import software.amazon.awssdk.services.resourcegroups.model.GroupResourcesRequest;
import software.amazon.awssdk.services.resourcegroups.model.GroupResourcesResponse;
import software.amazon.awssdk.services.resourcegroups.model.InternalServerErrorException;
import software.amazon.awssdk.services.resourcegroups.model.ListGroupResourcesRequest;
import software.amazon.awssdk.services.resourcegroups.model.ListGroupResourcesResponse;
import software.amazon.awssdk.services.resourcegroups.model.ListGroupingStatusesRequest;
import software.amazon.awssdk.services.resourcegroups.model.ListGroupingStatusesResponse;
import software.amazon.awssdk.services.resourcegroups.model.ListGroupsRequest;
import software.amazon.awssdk.services.resourcegroups.model.ListGroupsResponse;
import software.amazon.awssdk.services.resourcegroups.model.ListTagSyncTasksRequest;
import software.amazon.awssdk.services.resourcegroups.model.ListTagSyncTasksResponse;
import software.amazon.awssdk.services.resourcegroups.model.MethodNotAllowedException;
import software.amazon.awssdk.services.resourcegroups.model.NotFoundException;
import software.amazon.awssdk.services.resourcegroups.model.PutGroupConfigurationRequest;
import software.amazon.awssdk.services.resourcegroups.model.PutGroupConfigurationResponse;
import software.amazon.awssdk.services.resourcegroups.model.ResourceGroupsException;
import software.amazon.awssdk.services.resourcegroups.model.SearchResourcesRequest;
import software.amazon.awssdk.services.resourcegroups.model.SearchResourcesResponse;
import software.amazon.awssdk.services.resourcegroups.model.StartTagSyncTaskRequest;
import software.amazon.awssdk.services.resourcegroups.model.StartTagSyncTaskResponse;
import software.amazon.awssdk.services.resourcegroups.model.TagRequest;
import software.amazon.awssdk.services.resourcegroups.model.TagResponse;
import software.amazon.awssdk.services.resourcegroups.model.TooManyRequestsException;
import software.amazon.awssdk.services.resourcegroups.model.UnauthorizedException;
import software.amazon.awssdk.services.resourcegroups.model.UngroupResourcesRequest;
import software.amazon.awssdk.services.resourcegroups.model.UngroupResourcesResponse;
import software.amazon.awssdk.services.resourcegroups.model.UntagRequest;
import software.amazon.awssdk.services.resourcegroups.model.UntagResponse;
import software.amazon.awssdk.services.resourcegroups.model.UpdateAccountSettingsRequest;
import software.amazon.awssdk.services.resourcegroups.model.UpdateAccountSettingsResponse;
import software.amazon.awssdk.services.resourcegroups.model.UpdateGroupQueryRequest;
import software.amazon.awssdk.services.resourcegroups.model.UpdateGroupQueryResponse;
import software.amazon.awssdk.services.resourcegroups.model.UpdateGroupRequest;
import software.amazon.awssdk.services.resourcegroups.model.UpdateGroupResponse;
import software.amazon.awssdk.services.resourcegroups.transform.CancelTagSyncTaskRequestMarshaller;
import software.amazon.awssdk.services.resourcegroups.transform.CreateGroupRequestMarshaller;
import software.amazon.awssdk.services.resourcegroups.transform.DeleteGroupRequestMarshaller;
import software.amazon.awssdk.services.resourcegroups.transform.GetAccountSettingsRequestMarshaller;
import software.amazon.awssdk.services.resourcegroups.transform.GetGroupConfigurationRequestMarshaller;
import software.amazon.awssdk.services.resourcegroups.transform.GetGroupQueryRequestMarshaller;
import software.amazon.awssdk.services.resourcegroups.transform.GetGroupRequestMarshaller;
import software.amazon.awssdk.services.resourcegroups.transform.GetTagSyncTaskRequestMarshaller;
import software.amazon.awssdk.services.resourcegroups.transform.GetTagsRequestMarshaller;
import software.amazon.awssdk.services.resourcegroups.transform.GroupResourcesRequestMarshaller;
import software.amazon.awssdk.services.resourcegroups.transform.ListGroupResourcesRequestMarshaller;
import software.amazon.awssdk.services.resourcegroups.transform.ListGroupingStatusesRequestMarshaller;
import software.amazon.awssdk.services.resourcegroups.transform.ListGroupsRequestMarshaller;
import software.amazon.awssdk.services.resourcegroups.transform.ListTagSyncTasksRequestMarshaller;
import software.amazon.awssdk.services.resourcegroups.transform.PutGroupConfigurationRequestMarshaller;
import software.amazon.awssdk.services.resourcegroups.transform.SearchResourcesRequestMarshaller;
import software.amazon.awssdk.services.resourcegroups.transform.StartTagSyncTaskRequestMarshaller;
import software.amazon.awssdk.services.resourcegroups.transform.TagRequestMarshaller;
import software.amazon.awssdk.services.resourcegroups.transform.UngroupResourcesRequestMarshaller;
import software.amazon.awssdk.services.resourcegroups.transform.UntagRequestMarshaller;
import software.amazon.awssdk.services.resourcegroups.transform.UpdateAccountSettingsRequestMarshaller;
import software.amazon.awssdk.services.resourcegroups.transform.UpdateGroupQueryRequestMarshaller;
import software.amazon.awssdk.services.resourcegroups.transform.UpdateGroupRequestMarshaller;
import software.amazon.awssdk.utils.Logger;
/**
* Internal implementation of {@link ResourceGroupsClient}.
*
* @see ResourceGroupsClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultResourceGroupsClient implements ResourceGroupsClient {
private static final Logger log = Logger.loggerFor(DefaultResourceGroupsClient.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 DefaultResourceGroupsClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
/**
*
* Cancels the specified tag-sync task.
*
*
* Minimum permissions
*
*
* To run this command, you must have the following permissions:
*
*
* -
*
* resource-groups:CancelTagSyncTask
on the application group
*
*
* -
*
* resource-groups:DeleteGroup
*
*
*
*
* @param cancelTagSyncTaskRequest
* @return Result of the CancelTagSyncTask operation returned by the service.
* @throws UnauthorizedException
* The request was rejected because it doesn't have valid credentials for the target resource.
* @throws BadRequestException
* The request includes one or more parameters that violate validation rules.
* @throws ForbiddenException
* The caller isn't authorized to make the request. Check permissions.
* @throws MethodNotAllowedException
* The request uses an HTTP method that isn't allowed for the specified resource.
* @throws TooManyRequestsException
* You've exceeded throttling limits by making too many requests in a period of time.
* @throws InternalServerErrorException
* An internal error occurred while processing the request. Try again later.
* @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 ResourceGroupsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ResourceGroupsClient.CancelTagSyncTask
* @see AWS API Documentation
*/
@Override
public CancelTagSyncTaskResponse cancelTagSyncTask(CancelTagSyncTaskRequest cancelTagSyncTaskRequest)
throws UnauthorizedException, BadRequestException, ForbiddenException, MethodNotAllowedException,
TooManyRequestsException, InternalServerErrorException, AwsServiceException, SdkClientException,
ResourceGroupsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CancelTagSyncTaskResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(cancelTagSyncTaskRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, cancelTagSyncTaskRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Resource Groups");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CancelTagSyncTask");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CancelTagSyncTask").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(cancelTagSyncTaskRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CancelTagSyncTaskRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a resource group with the specified name and description. You can optionally include either a resource
* query or a service configuration. For more information about constructing a resource query, see Build queries and groups in
* Resource Groups in the Resource Groups User Guide. For more information about service-linked groups
* and service configurations, see Service configurations for Resource
* Groups.
*
*
* Minimum permissions
*
*
* To run this command, you must have the following permissions:
*
*
* -
*
* resource-groups:CreateGroup
*
*
*
*
* @param createGroupRequest
* @return Result of the CreateGroup operation returned by the service.
* @throws BadRequestException
* The request includes one or more parameters that violate validation rules.
* @throws ForbiddenException
* The caller isn't authorized to make the request. Check permissions.
* @throws MethodNotAllowedException
* The request uses an HTTP method that isn't allowed for the specified resource.
* @throws TooManyRequestsException
* You've exceeded throttling limits by making too many requests in a period of time.
* @throws InternalServerErrorException
* An internal error occurred while processing the request. Try again later.
* @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 ResourceGroupsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ResourceGroupsClient.CreateGroup
* @see AWS
* API Documentation
*/
@Override
public CreateGroupResponse createGroup(CreateGroupRequest createGroupRequest) throws BadRequestException, ForbiddenException,
MethodNotAllowedException, TooManyRequestsException, InternalServerErrorException, AwsServiceException,
SdkClientException, ResourceGroupsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createGroupRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Resource Groups");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateGroup");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateGroup").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(createGroupRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new CreateGroupRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes the specified resource group. Deleting a resource group does not delete any resources that are members of
* the group; it only deletes the group structure.
*
*
* Minimum permissions
*
*
* To run this command, you must have the following permissions:
*
*
* -
*
* resource-groups:DeleteGroup
*
*
*
*
* @param deleteGroupRequest
* @return Result of the DeleteGroup operation returned by the service.
* @throws BadRequestException
* The request includes one or more parameters that violate validation rules.
* @throws ForbiddenException
* The caller isn't authorized to make the request. Check permissions.
* @throws NotFoundException
* One or more of the specified resources don't exist.
* @throws MethodNotAllowedException
* The request uses an HTTP method that isn't allowed for the specified resource.
* @throws TooManyRequestsException
* You've exceeded throttling limits by making too many requests in a period of time.
* @throws InternalServerErrorException
* An internal error occurred while processing the request. Try again later.
* @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 ResourceGroupsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ResourceGroupsClient.DeleteGroup
* @see AWS
* API Documentation
*/
@Override
public DeleteGroupResponse deleteGroup(DeleteGroupRequest deleteGroupRequest) throws BadRequestException, ForbiddenException,
NotFoundException, MethodNotAllowedException, TooManyRequestsException, InternalServerErrorException,
AwsServiceException, SdkClientException, ResourceGroupsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteGroupRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Resource Groups");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteGroup");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteGroup").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(deleteGroupRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new DeleteGroupRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Retrieves the current status of optional features in Resource Groups.
*
*
* @param getAccountSettingsRequest
* @return Result of the GetAccountSettings operation returned by the service.
* @throws BadRequestException
* The request includes one or more parameters that violate validation rules.
* @throws ForbiddenException
* The caller isn't authorized to make the request. Check permissions.
* @throws MethodNotAllowedException
* The request uses an HTTP method that isn't allowed for the specified resource.
* @throws TooManyRequestsException
* You've exceeded throttling limits by making too many requests in a period of time.
* @throws InternalServerErrorException
* An internal error occurred while processing the request. Try again later.
* @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 ResourceGroupsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ResourceGroupsClient.GetAccountSettings
* @see AWS API Documentation
*/
@Override
public GetAccountSettingsResponse getAccountSettings(GetAccountSettingsRequest getAccountSettingsRequest)
throws BadRequestException, ForbiddenException, MethodNotAllowedException, TooManyRequestsException,
InternalServerErrorException, AwsServiceException, SdkClientException, ResourceGroupsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetAccountSettingsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getAccountSettingsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getAccountSettingsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Resource Groups");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetAccountSettings");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetAccountSettings").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(getAccountSettingsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetAccountSettingsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns information about a specified resource group.
*
*
* Minimum permissions
*
*
* To run this command, you must have the following permissions:
*
*
* -
*
* resource-groups:GetGroup
*
*
*
*
* @param getGroupRequest
* @return Result of the GetGroup operation returned by the service.
* @throws BadRequestException
* The request includes one or more parameters that violate validation rules.
* @throws ForbiddenException
* The caller isn't authorized to make the request. Check permissions.
* @throws NotFoundException
* One or more of the specified resources don't exist.
* @throws MethodNotAllowedException
* The request uses an HTTP method that isn't allowed for the specified resource.
* @throws TooManyRequestsException
* You've exceeded throttling limits by making too many requests in a period of time.
* @throws InternalServerErrorException
* An internal error occurred while processing the request. Try again later.
* @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 ResourceGroupsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ResourceGroupsClient.GetGroup
* @see AWS API
* Documentation
*/
@Override
public GetGroupResponse getGroup(GetGroupRequest getGroupRequest) throws BadRequestException, ForbiddenException,
NotFoundException, MethodNotAllowedException, TooManyRequestsException, InternalServerErrorException,
AwsServiceException, SdkClientException, ResourceGroupsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getGroupRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Resource Groups");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetGroup");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetGroup").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(getGroupRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetGroupRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Retrieves the service configuration associated with the specified resource group. For details about the service
* configuration syntax, see Service
* configurations for Resource Groups.
*
*
* Minimum permissions
*
*
* To run this command, you must have the following permissions:
*
*
* -
*
* resource-groups:GetGroupConfiguration
*
*
*
*
* @param getGroupConfigurationRequest
* @return Result of the GetGroupConfiguration operation returned by the service.
* @throws BadRequestException
* The request includes one or more parameters that violate validation rules.
* @throws ForbiddenException
* The caller isn't authorized to make the request. Check permissions.
* @throws NotFoundException
* One or more of the specified resources don't exist.
* @throws MethodNotAllowedException
* The request uses an HTTP method that isn't allowed for the specified resource.
* @throws TooManyRequestsException
* You've exceeded throttling limits by making too many requests in a period of time.
* @throws InternalServerErrorException
* An internal error occurred while processing the request. Try again later.
* @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 ResourceGroupsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ResourceGroupsClient.GetGroupConfiguration
* @see AWS API Documentation
*/
@Override
public GetGroupConfigurationResponse getGroupConfiguration(GetGroupConfigurationRequest getGroupConfigurationRequest)
throws BadRequestException, ForbiddenException, NotFoundException, MethodNotAllowedException,
TooManyRequestsException, InternalServerErrorException, AwsServiceException, SdkClientException,
ResourceGroupsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetGroupConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getGroupConfigurationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getGroupConfigurationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Resource Groups");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetGroupConfiguration");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetGroupConfiguration").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(getGroupConfigurationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetGroupConfigurationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Retrieves the resource query associated with the specified resource group. For more information about resource
* queries, see Create a tag-based group in Resource Groups.
*
*
* Minimum permissions
*
*
* To run this command, you must have the following permissions:
*
*
* -
*
* resource-groups:GetGroupQuery
*
*
*
*
* @param getGroupQueryRequest
* @return Result of the GetGroupQuery operation returned by the service.
* @throws BadRequestException
* The request includes one or more parameters that violate validation rules.
* @throws ForbiddenException
* The caller isn't authorized to make the request. Check permissions.
* @throws NotFoundException
* One or more of the specified resources don't exist.
* @throws MethodNotAllowedException
* The request uses an HTTP method that isn't allowed for the specified resource.
* @throws TooManyRequestsException
* You've exceeded throttling limits by making too many requests in a period of time.
* @throws InternalServerErrorException
* An internal error occurred while processing the request. Try again later.
* @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 ResourceGroupsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ResourceGroupsClient.GetGroupQuery
* @see AWS
* API Documentation
*/
@Override
public GetGroupQueryResponse getGroupQuery(GetGroupQueryRequest getGroupQueryRequest) throws BadRequestException,
ForbiddenException, NotFoundException, MethodNotAllowedException, TooManyRequestsException,
InternalServerErrorException, AwsServiceException, SdkClientException, ResourceGroupsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetGroupQueryResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getGroupQueryRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getGroupQueryRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Resource Groups");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetGroupQuery");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetGroupQuery").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(getGroupQueryRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetGroupQueryRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns information about a specified tag-sync task.
*
*
* Minimum permissions
*
*
* To run this command, you must have the following permissions:
*
*
* -
*
* resource-groups:GetTagSyncTask
on the application group
*
*
*
*
* @param getTagSyncTaskRequest
* @return Result of the GetTagSyncTask operation returned by the service.
* @throws UnauthorizedException
* The request was rejected because it doesn't have valid credentials for the target resource.
* @throws BadRequestException
* The request includes one or more parameters that violate validation rules.
* @throws ForbiddenException
* The caller isn't authorized to make the request. Check permissions.
* @throws NotFoundException
* One or more of the specified resources don't exist.
* @throws MethodNotAllowedException
* The request uses an HTTP method that isn't allowed for the specified resource.
* @throws TooManyRequestsException
* You've exceeded throttling limits by making too many requests in a period of time.
* @throws InternalServerErrorException
* An internal error occurred while processing the request. Try again later.
* @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 ResourceGroupsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ResourceGroupsClient.GetTagSyncTask
* @see AWS API Documentation
*/
@Override
public GetTagSyncTaskResponse getTagSyncTask(GetTagSyncTaskRequest getTagSyncTaskRequest) throws UnauthorizedException,
BadRequestException, ForbiddenException, NotFoundException, MethodNotAllowedException, TooManyRequestsException,
InternalServerErrorException, AwsServiceException, SdkClientException, ResourceGroupsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetTagSyncTaskResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getTagSyncTaskRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getTagSyncTaskRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Resource Groups");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetTagSyncTask");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetTagSyncTask").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(getTagSyncTaskRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetTagSyncTaskRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns a list of tags that are associated with a resource group, specified by an Amazon resource name (ARN).
*
*
* Minimum permissions
*
*
* To run this command, you must have the following permissions:
*
*
* -
*
* resource-groups:GetTags
*
*
*
*
* @param getTagsRequest
* @return Result of the GetTags operation returned by the service.
* @throws BadRequestException
* The request includes one or more parameters that violate validation rules.
* @throws ForbiddenException
* The caller isn't authorized to make the request. Check permissions.
* @throws NotFoundException
* One or more of the specified resources don't exist.
* @throws MethodNotAllowedException
* The request uses an HTTP method that isn't allowed for the specified resource.
* @throws TooManyRequestsException
* You've exceeded throttling limits by making too many requests in a period of time.
* @throws InternalServerErrorException
* An internal error occurred while processing the request. Try again later.
* @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 ResourceGroupsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ResourceGroupsClient.GetTags
* @see AWS API
* Documentation
*/
@Override
public GetTagsResponse getTags(GetTagsRequest getTagsRequest) throws BadRequestException, ForbiddenException,
NotFoundException, MethodNotAllowedException, TooManyRequestsException, InternalServerErrorException,
AwsServiceException, SdkClientException, ResourceGroupsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GetTagsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getTagsRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, getTagsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Resource Groups");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetTags");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetTags").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(getTagsRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GetTagsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Adds the specified resources to the specified group.
*
*
*
* You can only use this operation with the following groups:
*
*
* -
*
* AWS::EC2::HostManagement
*
*
* -
*
* AWS::EC2::CapacityReservationPool
*
*
* -
*
* AWS::ResourceGroups::ApplicationGroup
*
*
*
*
* Other resource group types and resource types are not currently supported by this operation.
*
*
*
* Minimum permissions
*
*
* To run this command, you must have the following permissions:
*
*
* -
*
* resource-groups:GroupResources
*
*
*
*
* @param groupResourcesRequest
* @return Result of the GroupResources operation returned by the service.
* @throws BadRequestException
* The request includes one or more parameters that violate validation rules.
* @throws ForbiddenException
* The caller isn't authorized to make the request. Check permissions.
* @throws NotFoundException
* One or more of the specified resources don't exist.
* @throws MethodNotAllowedException
* The request uses an HTTP method that isn't allowed for the specified resource.
* @throws TooManyRequestsException
* You've exceeded throttling limits by making too many requests in a period of time.
* @throws InternalServerErrorException
* An internal error occurred while processing the request. Try again later.
* @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 ResourceGroupsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ResourceGroupsClient.GroupResources
* @see AWS API Documentation
*/
@Override
public GroupResourcesResponse groupResources(GroupResourcesRequest groupResourcesRequest) throws BadRequestException,
ForbiddenException, NotFoundException, MethodNotAllowedException, TooManyRequestsException,
InternalServerErrorException, AwsServiceException, SdkClientException, ResourceGroupsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
GroupResourcesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(groupResourcesRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, groupResourcesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Resource Groups");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GroupResources");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GroupResources").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(groupResourcesRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new GroupResourcesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns a list of Amazon resource names (ARNs) of the resources that are members of a specified resource group.
*
*
* Minimum permissions
*
*
* To run this command, you must have the following permissions:
*
*
* -
*
* resource-groups:ListGroupResources
*
*
* -
*
* cloudformation:DescribeStacks
*
*
* -
*
* cloudformation:ListStackResources
*
*
* -
*
* tag:GetResources
*
*
*
*
* @param listGroupResourcesRequest
* @return Result of the ListGroupResources operation returned by the service.
* @throws UnauthorizedException
* The request was rejected because it doesn't have valid credentials for the target resource.
* @throws BadRequestException
* The request includes one or more parameters that violate validation rules.
* @throws ForbiddenException
* The caller isn't authorized to make the request. Check permissions.
* @throws NotFoundException
* One or more of the specified resources don't exist.
* @throws MethodNotAllowedException
* The request uses an HTTP method that isn't allowed for the specified resource.
* @throws TooManyRequestsException
* You've exceeded throttling limits by making too many requests in a period of time.
* @throws InternalServerErrorException
* An internal error occurred while processing the request. Try again later.
* @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 ResourceGroupsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ResourceGroupsClient.ListGroupResources
* @see AWS API Documentation
*/
@Override
public ListGroupResourcesResponse listGroupResources(ListGroupResourcesRequest listGroupResourcesRequest)
throws UnauthorizedException, BadRequestException, ForbiddenException, NotFoundException, MethodNotAllowedException,
TooManyRequestsException, InternalServerErrorException, AwsServiceException, SdkClientException,
ResourceGroupsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListGroupResourcesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listGroupResourcesRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listGroupResourcesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Resource Groups");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListGroupResources");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListGroupResources").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listGroupResourcesRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListGroupResourcesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns the status of the last grouping or ungrouping action for each resource in the specified application
* group.
*
*
* @param listGroupingStatusesRequest
* @return Result of the ListGroupingStatuses operation returned by the service.
* @throws BadRequestException
* The request includes one or more parameters that violate validation rules.
* @throws ForbiddenException
* The caller isn't authorized to make the request. Check permissions.
* @throws MethodNotAllowedException
* The request uses an HTTP method that isn't allowed for the specified resource.
* @throws TooManyRequestsException
* You've exceeded throttling limits by making too many requests in a period of time.
* @throws InternalServerErrorException
* An internal error occurred while processing the request. Try again later.
* @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 ResourceGroupsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ResourceGroupsClient.ListGroupingStatuses
* @see AWS API Documentation
*/
@Override
public ListGroupingStatusesResponse listGroupingStatuses(ListGroupingStatusesRequest listGroupingStatusesRequest)
throws BadRequestException, ForbiddenException, MethodNotAllowedException, TooManyRequestsException,
InternalServerErrorException, AwsServiceException, SdkClientException, ResourceGroupsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, ListGroupingStatusesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listGroupingStatusesRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listGroupingStatusesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Resource Groups");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListGroupingStatuses");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListGroupingStatuses").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listGroupingStatusesRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListGroupingStatusesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns a list of existing Resource Groups in your account.
*
*
* Minimum permissions
*
*
* To run this command, you must have the following permissions:
*
*
* -
*
* resource-groups:ListGroups
*
*
*
*
* @param listGroupsRequest
* @return Result of the ListGroups operation returned by the service.
* @throws BadRequestException
* The request includes one or more parameters that violate validation rules.
* @throws ForbiddenException
* The caller isn't authorized to make the request. Check permissions.
* @throws MethodNotAllowedException
* The request uses an HTTP method that isn't allowed for the specified resource.
* @throws TooManyRequestsException
* You've exceeded throttling limits by making too many requests in a period of time.
* @throws InternalServerErrorException
* An internal error occurred while processing the request. Try again later.
* @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 ResourceGroupsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ResourceGroupsClient.ListGroups
* @see AWS
* API Documentation
*/
@Override
public ListGroupsResponse listGroups(ListGroupsRequest listGroupsRequest) throws BadRequestException, ForbiddenException,
MethodNotAllowedException, TooManyRequestsException, InternalServerErrorException, AwsServiceException,
SdkClientException, ResourceGroupsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListGroupsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listGroupsRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listGroupsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Resource Groups");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListGroups");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListGroups").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(listGroupsRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListGroupsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns a list of tag-sync tasks.
*
*
* Minimum permissions
*
*
* To run this command, you must have the following permissions:
*
*
* -
*
* resource-groups:ListTagSyncTasks
with the group passed in the filters as the resource or * if using
* no filters
*
*
*
*
* @param listTagSyncTasksRequest
* @return Result of the ListTagSyncTasks operation returned by the service.
* @throws UnauthorizedException
* The request was rejected because it doesn't have valid credentials for the target resource.
* @throws BadRequestException
* The request includes one or more parameters that violate validation rules.
* @throws ForbiddenException
* The caller isn't authorized to make the request. Check permissions.
* @throws MethodNotAllowedException
* The request uses an HTTP method that isn't allowed for the specified resource.
* @throws TooManyRequestsException
* You've exceeded throttling limits by making too many requests in a period of time.
* @throws InternalServerErrorException
* An internal error occurred while processing the request. Try again later.
* @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 ResourceGroupsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ResourceGroupsClient.ListTagSyncTasks
* @see AWS API Documentation
*/
@Override
public ListTagSyncTasksResponse listTagSyncTasks(ListTagSyncTasksRequest listTagSyncTasksRequest)
throws UnauthorizedException, BadRequestException, ForbiddenException, MethodNotAllowedException,
TooManyRequestsException, InternalServerErrorException, AwsServiceException, SdkClientException,
ResourceGroupsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListTagSyncTasksResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listTagSyncTasksRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagSyncTasksRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Resource Groups");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagSyncTasks");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListTagSyncTasks").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(listTagSyncTasksRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new ListTagSyncTasksRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Attaches a service configuration to the specified group. This occurs asynchronously, and can take time to
* complete. You can use GetGroupConfiguration to check the status of the update.
*
*
* Minimum permissions
*
*
* To run this command, you must have the following permissions:
*
*
* -
*
* resource-groups:PutGroupConfiguration
*
*
*
*
* @param putGroupConfigurationRequest
* @return Result of the PutGroupConfiguration operation returned by the service.
* @throws BadRequestException
* The request includes one or more parameters that violate validation rules.
* @throws ForbiddenException
* The caller isn't authorized to make the request. Check permissions.
* @throws NotFoundException
* One or more of the specified resources don't exist.
* @throws MethodNotAllowedException
* The request uses an HTTP method that isn't allowed for the specified resource.
* @throws TooManyRequestsException
* You've exceeded throttling limits by making too many requests in a period of time.
* @throws InternalServerErrorException
* An internal error occurred while processing the request. Try again later.
* @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 ResourceGroupsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ResourceGroupsClient.PutGroupConfiguration
* @see AWS API Documentation
*/
@Override
public PutGroupConfigurationResponse putGroupConfiguration(PutGroupConfigurationRequest putGroupConfigurationRequest)
throws BadRequestException, ForbiddenException, NotFoundException, MethodNotAllowedException,
TooManyRequestsException, InternalServerErrorException, AwsServiceException, SdkClientException,
ResourceGroupsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, PutGroupConfigurationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putGroupConfigurationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, putGroupConfigurationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Resource Groups");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutGroupConfiguration");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("PutGroupConfiguration").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(putGroupConfigurationRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new PutGroupConfigurationRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Returns a list of Amazon Web Services resource identifiers that matches the specified query. The query uses the
* same format as a resource query in a CreateGroup or UpdateGroupQuery operation.
*
*
* Minimum permissions
*
*
* To run this command, you must have the following permissions:
*
*
* -
*
* resource-groups:SearchResources
*
*
* -
*
* cloudformation:DescribeStacks
*
*
* -
*
* cloudformation:ListStackResources
*
*
* -
*
* tag:GetResources
*
*
*
*
* @param searchResourcesRequest
* @return Result of the SearchResources operation returned by the service.
* @throws UnauthorizedException
* The request was rejected because it doesn't have valid credentials for the target resource.
* @throws BadRequestException
* The request includes one or more parameters that violate validation rules.
* @throws ForbiddenException
* The caller isn't authorized to make the request. Check permissions.
* @throws MethodNotAllowedException
* The request uses an HTTP method that isn't allowed for the specified resource.
* @throws TooManyRequestsException
* You've exceeded throttling limits by making too many requests in a period of time.
* @throws InternalServerErrorException
* An internal error occurred while processing the request. Try again later.
* @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 ResourceGroupsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ResourceGroupsClient.SearchResources
* @see AWS API Documentation
*/
@Override
public SearchResourcesResponse searchResources(SearchResourcesRequest searchResourcesRequest) throws UnauthorizedException,
BadRequestException, ForbiddenException, MethodNotAllowedException, TooManyRequestsException,
InternalServerErrorException, AwsServiceException, SdkClientException, ResourceGroupsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
SearchResourcesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(searchResourcesRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, searchResourcesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Resource Groups");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "SearchResources");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("SearchResources").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(searchResourcesRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new SearchResourcesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Creates a new tag-sync task to onboard and sync resources tagged with a specific tag key-value pair to an
* application.
*
*
* Minimum permissions
*
*
* To run this command, you must have the following permissions:
*
*
* -
*
* resource-groups:StartTagSyncTask
on the application group
*
*
* -
*
* resource-groups:CreateGroup
*
*
* -
*
* iam:PassRole
on the role provided in the request
*
*
*
*
* @param startTagSyncTaskRequest
* @return Result of the StartTagSyncTask operation returned by the service.
* @throws UnauthorizedException
* The request was rejected because it doesn't have valid credentials for the target resource.
* @throws BadRequestException
* The request includes one or more parameters that violate validation rules.
* @throws ForbiddenException
* The caller isn't authorized to make the request. Check permissions.
* @throws NotFoundException
* One or more of the specified resources don't exist.
* @throws MethodNotAllowedException
* The request uses an HTTP method that isn't allowed for the specified resource.
* @throws TooManyRequestsException
* You've exceeded throttling limits by making too many requests in a period of time.
* @throws InternalServerErrorException
* An internal error occurred while processing the request. Try again later.
* @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 ResourceGroupsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ResourceGroupsClient.StartTagSyncTask
* @see AWS API Documentation
*/
@Override
public StartTagSyncTaskResponse startTagSyncTask(StartTagSyncTaskRequest startTagSyncTaskRequest)
throws UnauthorizedException, BadRequestException, ForbiddenException, NotFoundException, MethodNotAllowedException,
TooManyRequestsException, InternalServerErrorException, AwsServiceException, SdkClientException,
ResourceGroupsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
StartTagSyncTaskResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(startTagSyncTaskRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, startTagSyncTaskRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Resource Groups");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StartTagSyncTask");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("StartTagSyncTask").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(startTagSyncTaskRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new StartTagSyncTaskRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Adds tags to a resource group with the specified Amazon resource name (ARN). Existing tags on a resource group
* are not changed if they are not specified in the request parameters.
*
*
*
* Do not store personally identifiable information (PII) or other confidential or sensitive information in tags. We
* use tags to provide you with billing and administration services. Tags are not intended to be used for private or
* sensitive data.
*
*
*
* Minimum permissions
*
*
* To run this command, you must have the following permissions:
*
*
* -
*
* resource-groups:Tag
*
*
*
*
* @param tagRequest
* @return Result of the Tag operation returned by the service.
* @throws BadRequestException
* The request includes one or more parameters that violate validation rules.
* @throws ForbiddenException
* The caller isn't authorized to make the request. Check permissions.
* @throws NotFoundException
* One or more of the specified resources don't exist.
* @throws MethodNotAllowedException
* The request uses an HTTP method that isn't allowed for the specified resource.
* @throws TooManyRequestsException
* You've exceeded throttling limits by making too many requests in a period of time.
* @throws InternalServerErrorException
* An internal error occurred while processing the request. Try again later.
* @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 ResourceGroupsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ResourceGroupsClient.Tag
* @see AWS API
* Documentation
*/
@Override
public TagResponse tag(TagRequest tagRequest) throws BadRequestException, ForbiddenException, NotFoundException,
MethodNotAllowedException, TooManyRequestsException, InternalServerErrorException, AwsServiceException,
SdkClientException, ResourceGroupsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
TagResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(tagRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, tagRequest.overrideConfiguration()
.orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Resource Groups");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "Tag");
return clientHandler.execute(new ClientExecutionParams().withOperationName("Tag")
.withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(tagRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new TagRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Removes the specified resources from the specified group. This operation works only with static groups that you
* populated using the GroupResources operation. It doesn't work with any resource groups that are
* automatically populated by tag-based or CloudFormation stack-based queries.
*
*
* Minimum permissions
*
*
* To run this command, you must have the following permissions:
*
*
* -
*
* resource-groups:UngroupResources
*
*
*
*
* @param ungroupResourcesRequest
* @return Result of the UngroupResources operation returned by the service.
* @throws BadRequestException
* The request includes one or more parameters that violate validation rules.
* @throws ForbiddenException
* The caller isn't authorized to make the request. Check permissions.
* @throws NotFoundException
* One or more of the specified resources don't exist.
* @throws MethodNotAllowedException
* The request uses an HTTP method that isn't allowed for the specified resource.
* @throws TooManyRequestsException
* You've exceeded throttling limits by making too many requests in a period of time.
* @throws InternalServerErrorException
* An internal error occurred while processing the request. Try again later.
* @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 ResourceGroupsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ResourceGroupsClient.UngroupResources
* @see AWS API Documentation
*/
@Override
public UngroupResourcesResponse ungroupResources(UngroupResourcesRequest ungroupResourcesRequest) throws BadRequestException,
ForbiddenException, NotFoundException, MethodNotAllowedException, TooManyRequestsException,
InternalServerErrorException, AwsServiceException, SdkClientException, ResourceGroupsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UngroupResourcesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(ungroupResourcesRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, ungroupResourcesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Resource Groups");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UngroupResources");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UngroupResources").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(ungroupResourcesRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UngroupResourcesRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Deletes tags from a specified resource group.
*
*
* Minimum permissions
*
*
* To run this command, you must have the following permissions:
*
*
* -
*
* resource-groups:Untag
*
*
*
*
* @param untagRequest
* @return Result of the Untag operation returned by the service.
* @throws BadRequestException
* The request includes one or more parameters that violate validation rules.
* @throws ForbiddenException
* The caller isn't authorized to make the request. Check permissions.
* @throws NotFoundException
* One or more of the specified resources don't exist.
* @throws MethodNotAllowedException
* The request uses an HTTP method that isn't allowed for the specified resource.
* @throws TooManyRequestsException
* You've exceeded throttling limits by making too many requests in a period of time.
* @throws InternalServerErrorException
* An internal error occurred while processing the request. Try again later.
* @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 ResourceGroupsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ResourceGroupsClient.Untag
* @see AWS API
* Documentation
*/
@Override
public UntagResponse untag(UntagRequest untagRequest) throws BadRequestException, ForbiddenException, NotFoundException,
MethodNotAllowedException, TooManyRequestsException, InternalServerErrorException, AwsServiceException,
SdkClientException, ResourceGroupsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UntagResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(untagRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, untagRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Resource Groups");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "Untag");
return clientHandler.execute(new ClientExecutionParams().withOperationName("Untag")
.withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(untagRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UntagRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Turns on or turns off optional features in Resource Groups.
*
*
* The preceding example shows that the request to turn on group lifecycle events is IN_PROGRESS
. You
* can call the GetAccountSettings operation to check for completion by looking for
* GroupLifecycleEventsStatus
to change to ACTIVE
.
*
*
* @param updateAccountSettingsRequest
* @return Result of the UpdateAccountSettings operation returned by the service.
* @throws BadRequestException
* The request includes one or more parameters that violate validation rules.
* @throws ForbiddenException
* The caller isn't authorized to make the request. Check permissions.
* @throws MethodNotAllowedException
* The request uses an HTTP method that isn't allowed for the specified resource.
* @throws TooManyRequestsException
* You've exceeded throttling limits by making too many requests in a period of time.
* @throws InternalServerErrorException
* An internal error occurred while processing the request. Try again later.
* @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 ResourceGroupsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ResourceGroupsClient.UpdateAccountSettings
* @see AWS API Documentation
*/
@Override
public UpdateAccountSettingsResponse updateAccountSettings(UpdateAccountSettingsRequest updateAccountSettingsRequest)
throws BadRequestException, ForbiddenException, MethodNotAllowedException, TooManyRequestsException,
InternalServerErrorException, AwsServiceException, SdkClientException, ResourceGroupsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateAccountSettingsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateAccountSettingsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateAccountSettingsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Resource Groups");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateAccountSettings");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateAccountSettings").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(updateAccountSettingsRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateAccountSettingsRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates the description for an existing group. You cannot update the name of a resource group.
*
*
* Minimum permissions
*
*
* To run this command, you must have the following permissions:
*
*
* -
*
* resource-groups:UpdateGroup
*
*
*
*
* @param updateGroupRequest
* @return Result of the UpdateGroup operation returned by the service.
* @throws BadRequestException
* The request includes one or more parameters that violate validation rules.
* @throws ForbiddenException
* The caller isn't authorized to make the request. Check permissions.
* @throws NotFoundException
* One or more of the specified resources don't exist.
* @throws MethodNotAllowedException
* The request uses an HTTP method that isn't allowed for the specified resource.
* @throws TooManyRequestsException
* You've exceeded throttling limits by making too many requests in a period of time.
* @throws InternalServerErrorException
* An internal error occurred while processing the request. Try again later.
* @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 ResourceGroupsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ResourceGroupsClient.UpdateGroup
* @see AWS
* API Documentation
*/
@Override
public UpdateGroupResponse updateGroup(UpdateGroupRequest updateGroupRequest) throws BadRequestException, ForbiddenException,
NotFoundException, MethodNotAllowedException, TooManyRequestsException, InternalServerErrorException,
AwsServiceException, SdkClientException, ResourceGroupsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateGroupRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Resource Groups");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateGroup");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateGroup").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration)
.withInput(updateGroupRequest).withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateGroupRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
/**
*
* Updates the resource query of a group. For more information about resource queries, see Create a tag-based group in Resource Groups.
*
*
* Minimum permissions
*
*
* To run this command, you must have the following permissions:
*
*
* -
*
* resource-groups:UpdateGroupQuery
*
*
*
*
* @param updateGroupQueryRequest
* @return Result of the UpdateGroupQuery operation returned by the service.
* @throws BadRequestException
* The request includes one or more parameters that violate validation rules.
* @throws ForbiddenException
* The caller isn't authorized to make the request. Check permissions.
* @throws NotFoundException
* One or more of the specified resources don't exist.
* @throws MethodNotAllowedException
* The request uses an HTTP method that isn't allowed for the specified resource.
* @throws TooManyRequestsException
* You've exceeded throttling limits by making too many requests in a period of time.
* @throws InternalServerErrorException
* An internal error occurred while processing the request. Try again later.
* @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 ResourceGroupsException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ResourceGroupsClient.UpdateGroupQuery
* @see AWS API Documentation
*/
@Override
public UpdateGroupQueryResponse updateGroupQuery(UpdateGroupQueryRequest updateGroupQueryRequest) throws BadRequestException,
ForbiddenException, NotFoundException, MethodNotAllowedException, TooManyRequestsException,
InternalServerErrorException, AwsServiceException, SdkClientException, ResourceGroupsException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
UpdateGroupQueryResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateGroupQueryRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateGroupQueryRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Resource Groups");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateGroupQuery");
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateGroupQuery").withProtocolMetadata(protocolMetadata)
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withInput(updateGroupQueryRequest)
.withMetricCollector(apiCallMetricCollector)
.withMarshaller(new UpdateGroupQueryRequestMarshaller(protocolFactory)));
} finally {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
}
}
@Override
public final String serviceName() {
return SERVICE_NAME;
}
private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration,
RequestOverrideConfiguration requestOverrideConfiguration) {
List publishers = null;
if (requestOverrideConfiguration != null) {
publishers = requestOverrideConfiguration.metricPublishers();
}
if (publishers == null || publishers.isEmpty()) {
publishers = clientConfiguration.option(SdkClientOption.METRIC_PUBLISHERS);
}
if (publishers == null) {
publishers = Collections.emptyList();
}
return publishers;
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
JsonOperationMetadata operationMetadata) {
return protocolFactory.createErrorResponseHandler(operationMetadata);
}
private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) {
ClientOverrideConfiguration.Builder builder = configuration.asOverrideConfigurationBuilder();
RetryMode retryMode = builder.retryMode();
if (retryMode != null) {
configuration.option(SdkClientOption.RETRY_STRATEGY, AwsRetryStrategy.forRetryMode(retryMode));
} else {
Consumer> configurator = builder.retryStrategyConfigurator();
if (configurator != null) {
RetryStrategy.Builder, ?> defaultBuilder = AwsRetryStrategy.defaultRetryStrategy().toBuilder();
configurator.accept(defaultBuilder);
configuration.option(SdkClientOption.RETRY_STRATEGY, defaultBuilder.build());
} else {
RetryStrategy retryStrategy = builder.retryStrategy();
if (retryStrategy != null) {
configuration.option(SdkClientOption.RETRY_STRATEGY, retryStrategy);
}
}
}
configuration.option(SdkClientOption.CONFIGURED_RETRY_MODE, null);
configuration.option(SdkClientOption.CONFIGURED_RETRY_STRATEGY, null);
configuration.option(SdkClientOption.CONFIGURED_RETRY_CONFIGURATOR, null);
}
private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, SdkClientConfiguration clientConfiguration) {
List plugins = request.overrideConfiguration().map(c -> c.plugins()).orElse(Collections.emptyList());
SdkClientConfiguration.Builder configuration = clientConfiguration.toBuilder();
if (plugins.isEmpty()) {
return configuration.build();
}
ResourceGroupsServiceClientConfigurationBuilder serviceConfigBuilder = new ResourceGroupsServiceClientConfigurationBuilder(
configuration);
for (SdkPlugin plugin : plugins) {
plugin.configureClient(serviceConfigBuilder);
}
updateRetryStrategyClientConfiguration(configuration);
return configuration.build();
}
private > T init(T builder) {
return builder
.clientConfiguration(clientConfiguration)
.defaultServiceExceptionSupplier(ResourceGroupsException::builder)
.protocol(AwsJsonProtocol.REST_JSON)
.protocolVersion("1.1")
.registerModeledException(
ExceptionMetadata.builder().errorCode("NotFoundException")
.exceptionBuilderSupplier(NotFoundException::builder).httpStatusCode(404).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("UnauthorizedException")
.exceptionBuilderSupplier(UnauthorizedException::builder).httpStatusCode(401).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ForbiddenException")
.exceptionBuilderSupplier(ForbiddenException::builder).httpStatusCode(403).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("MethodNotAllowedException")
.exceptionBuilderSupplier(MethodNotAllowedException::builder).httpStatusCode(405).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("TooManyRequestsException")
.exceptionBuilderSupplier(TooManyRequestsException::builder).httpStatusCode(429).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("BadRequestException")
.exceptionBuilderSupplier(BadRequestException::builder).httpStatusCode(400).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InternalServerErrorException")
.exceptionBuilderSupplier(InternalServerErrorException::builder).httpStatusCode(500).build());
}
@Override
public final ResourceGroupsServiceClientConfiguration serviceClientConfiguration() {
return new ResourceGroupsServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build();
}
@Override
public void close() {
clientHandler.close();
}
}