@Generated(value="software.amazon.awssdk:codegen") @ThreadSafe public interface ControlTowerClient extends AwsClient
builder() method.
These interfaces allow you to apply the AWS library of pre-defined controls to your organizational units, programmatically. In this context, controls are the same as AWS Control Tower guardrails.
To call these APIs, you'll need to know:
the ControlARN for the control--that is, the guardrail--you are targeting,
and the ARN associated with the target organizational unit (OU).
To get the ControlARN for your AWS Control Tower guardrail:
The ControlARN contains the control name which is specified in each guardrail. For a list of control
names for Strongly recommended and Elective guardrails, see Resource identifiers
for APIs and guardrails in the Automating tasks section
of the AWS Control Tower User Guide. Remember that Mandatory guardrails cannot be added or removed.
ARN format: arn:aws:controltower:{REGION}::control/{CONTROL_NAME}
Example:
arn:aws:controltower:us-west-2::control/AWS-GR_AUTOSCALING_LAUNCH_CONFIG_PUBLIC_IP_DISABLED
To get the ARN for an OU:
In the AWS Organizations console, you can find the ARN for the OU on the Organizational unit details page associated with that OU.
OU ARN format:
arn:${Partition}:organizations::${MasterAccountId}:ou/o-${OrganizationId}/ou-${OrganizationalUnitId}
Details and examples
To view the open source resource repository on GitHub, see aws-cloudformation/aws-cloudformation-resource-providers-controltower
Recording API Requests
AWS Control Tower supports AWS CloudTrail, a service that records AWS API calls for your AWS account and delivers log files to an Amazon S3 bucket. By using information collected by CloudTrail, you can determine which requests the AWS Control Tower service received, who made the request and when, and so on. For more about AWS Control Tower and its support for CloudTrail, see Logging AWS Control Tower Actions with AWS CloudTrail in the AWS Control Tower User Guide. To learn more about CloudTrail, including how to turn it on and find your log files, see the AWS CloudTrail User Guide.
| Modifier and Type | Field and Description |
|---|---|
static String |
SERVICE_METADATA_ID
Value for looking up the service's metadata from the
ServiceMetadataProvider. |
static String |
SERVICE_NAME |
| Modifier and Type | Method and Description |
|---|---|
static ControlTowerClientBuilder |
builder()
Create a builder that can be used to configure and create a
ControlTowerClient. |
static ControlTowerClient |
create()
Create a
ControlTowerClient with the region loaded from the
DefaultAwsRegionProviderChain and credentials loaded from the
DefaultCredentialsProvider. |
default DisableControlResponse |
disableControl(Consumer<DisableControlRequest.Builder> disableControlRequest)
This API call turns off a control.
|
default DisableControlResponse |
disableControl(DisableControlRequest disableControlRequest)
This API call turns off a control.
|
default EnableControlResponse |
enableControl(Consumer<EnableControlRequest.Builder> enableControlRequest)
This API call activates a control.
|
default EnableControlResponse |
enableControl(EnableControlRequest enableControlRequest)
This API call activates a control.
|
default GetControlOperationResponse |
getControlOperation(Consumer<GetControlOperationRequest.Builder> getControlOperationRequest)
Returns the status of a particular
EnableControl or DisableControl operation. |
default GetControlOperationResponse |
getControlOperation(GetControlOperationRequest getControlOperationRequest)
Returns the status of a particular
EnableControl or DisableControl operation. |
default ListEnabledControlsResponse |
listEnabledControls(Consumer<ListEnabledControlsRequest.Builder> listEnabledControlsRequest)
Lists the controls enabled by AWS Control Tower on the specified organizational unit and the accounts it
contains.
|
default ListEnabledControlsResponse |
listEnabledControls(ListEnabledControlsRequest listEnabledControlsRequest)
Lists the controls enabled by AWS Control Tower on the specified organizational unit and the accounts it
contains.
|
default ListEnabledControlsIterable |
listEnabledControlsPaginator(Consumer<ListEnabledControlsRequest.Builder> listEnabledControlsRequest)
Lists the controls enabled by AWS Control Tower on the specified organizational unit and the accounts it
contains.
|
default ListEnabledControlsIterable |
listEnabledControlsPaginator(ListEnabledControlsRequest listEnabledControlsRequest)
Lists the controls enabled by AWS Control Tower on the specified organizational unit and the accounts it
contains.
|
default ControlTowerServiceClientConfiguration |
serviceClientConfiguration() |
static ServiceMetadata |
serviceMetadata() |
serviceNameclosestatic final String SERVICE_NAME
static final String SERVICE_METADATA_ID
ServiceMetadataProvider.default DisableControlResponse disableControl(DisableControlRequest disableControlRequest) throws ValidationException, ConflictException, ServiceQuotaExceededException, InternalServerException, AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException, SdkClientException, ControlTowerException
This API call turns off a control. It starts an asynchronous operation that deletes AWS resources on the specified organizational unit and the accounts it contains. The resources will vary according to the control that you specify.
disableControlRequest - ValidationException - The input fails to satisfy the constraints specified by an AWS service.ConflictException - Updating or deleting a resource can cause an inconsistent state.ServiceQuotaExceededException - Request would cause a service quota to be exceeded. The limit is 10 concurrent operations.InternalServerException - Unexpected error during processing of request.AccessDeniedException - User does not have sufficient access to perform this action.ThrottlingException - Request was denied due to request throttling.ResourceNotFoundException - Request references a resource which does not exist.SdkException - Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
catch all scenarios.SdkClientException - If any client side error occurs such as an IO related failure, failure to get credentials, etc.ControlTowerException - Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceExceptiondefault DisableControlResponse disableControl(Consumer<DisableControlRequest.Builder> disableControlRequest) throws ValidationException, ConflictException, ServiceQuotaExceededException, InternalServerException, AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException, SdkClientException, ControlTowerException
This API call turns off a control. It starts an asynchronous operation that deletes AWS resources on the specified organizational unit and the accounts it contains. The resources will vary according to the control that you specify.
This is a convenience which creates an instance of the DisableControlRequest.Builder avoiding the need to
create one manually via DisableControlRequest.builder()
disableControlRequest - A Consumer that will call methods on DisableControlInput.Builder to create a request.ValidationException - The input fails to satisfy the constraints specified by an AWS service.ConflictException - Updating or deleting a resource can cause an inconsistent state.ServiceQuotaExceededException - Request would cause a service quota to be exceeded. The limit is 10 concurrent operations.InternalServerException - Unexpected error during processing of request.AccessDeniedException - User does not have sufficient access to perform this action.ThrottlingException - Request was denied due to request throttling.ResourceNotFoundException - Request references a resource which does not exist.SdkException - Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
catch all scenarios.SdkClientException - If any client side error occurs such as an IO related failure, failure to get credentials, etc.ControlTowerException - Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceExceptiondefault EnableControlResponse enableControl(EnableControlRequest enableControlRequest) throws ValidationException, ConflictException, ServiceQuotaExceededException, InternalServerException, AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException, SdkClientException, ControlTowerException
This API call activates a control. It starts an asynchronous operation that creates AWS resources on the specified organizational unit and the accounts it contains. The resources created will vary according to the control that you specify.
enableControlRequest - ValidationException - The input fails to satisfy the constraints specified by an AWS service.ConflictException - Updating or deleting a resource can cause an inconsistent state.ServiceQuotaExceededException - Request would cause a service quota to be exceeded. The limit is 10 concurrent operations.InternalServerException - Unexpected error during processing of request.AccessDeniedException - User does not have sufficient access to perform this action.ThrottlingException - Request was denied due to request throttling.ResourceNotFoundException - Request references a resource which does not exist.SdkException - Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
catch all scenarios.SdkClientException - If any client side error occurs such as an IO related failure, failure to get credentials, etc.ControlTowerException - Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceExceptiondefault EnableControlResponse enableControl(Consumer<EnableControlRequest.Builder> enableControlRequest) throws ValidationException, ConflictException, ServiceQuotaExceededException, InternalServerException, AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException, SdkClientException, ControlTowerException
This API call activates a control. It starts an asynchronous operation that creates AWS resources on the specified organizational unit and the accounts it contains. The resources created will vary according to the control that you specify.
This is a convenience which creates an instance of the EnableControlRequest.Builder avoiding the need to
create one manually via EnableControlRequest.builder()
enableControlRequest - A Consumer that will call methods on EnableControlInput.Builder to create a request.ValidationException - The input fails to satisfy the constraints specified by an AWS service.ConflictException - Updating or deleting a resource can cause an inconsistent state.ServiceQuotaExceededException - Request would cause a service quota to be exceeded. The limit is 10 concurrent operations.InternalServerException - Unexpected error during processing of request.AccessDeniedException - User does not have sufficient access to perform this action.ThrottlingException - Request was denied due to request throttling.ResourceNotFoundException - Request references a resource which does not exist.SdkException - Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
catch all scenarios.SdkClientException - If any client side error occurs such as an IO related failure, failure to get credentials, etc.ControlTowerException - Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceExceptiondefault GetControlOperationResponse getControlOperation(GetControlOperationRequest getControlOperationRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException, SdkClientException, ControlTowerException
Returns the status of a particular EnableControl or DisableControl operation. Displays
a message in case of error. Details for an operation are available for 90 days.
getControlOperationRequest - ValidationException - The input fails to satisfy the constraints specified by an AWS service.InternalServerException - Unexpected error during processing of request.AccessDeniedException - User does not have sufficient access to perform this action.ThrottlingException - Request was denied due to request throttling.ResourceNotFoundException - Request references a resource which does not exist.SdkException - Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
catch all scenarios.SdkClientException - If any client side error occurs such as an IO related failure, failure to get credentials, etc.ControlTowerException - Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceExceptiondefault GetControlOperationResponse getControlOperation(Consumer<GetControlOperationRequest.Builder> getControlOperationRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException, SdkClientException, ControlTowerException
Returns the status of a particular EnableControl or DisableControl operation. Displays
a message in case of error. Details for an operation are available for 90 days.
This is a convenience which creates an instance of the GetControlOperationRequest.Builder avoiding the
need to create one manually via GetControlOperationRequest.builder()
getControlOperationRequest - A Consumer that will call methods on GetControlOperationInput.Builder to create a request.ValidationException - The input fails to satisfy the constraints specified by an AWS service.InternalServerException - Unexpected error during processing of request.AccessDeniedException - User does not have sufficient access to perform this action.ThrottlingException - Request was denied due to request throttling.ResourceNotFoundException - Request references a resource which does not exist.SdkException - Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
catch all scenarios.SdkClientException - If any client side error occurs such as an IO related failure, failure to get credentials, etc.ControlTowerException - Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceExceptiondefault ListEnabledControlsResponse listEnabledControls(ListEnabledControlsRequest listEnabledControlsRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException, SdkClientException, ControlTowerException
Lists the controls enabled by AWS Control Tower on the specified organizational unit and the accounts it contains.
listEnabledControlsRequest - ValidationException - The input fails to satisfy the constraints specified by an AWS service.InternalServerException - Unexpected error during processing of request.AccessDeniedException - User does not have sufficient access to perform this action.ThrottlingException - Request was denied due to request throttling.ResourceNotFoundException - Request references a resource which does not exist.SdkException - Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
catch all scenarios.SdkClientException - If any client side error occurs such as an IO related failure, failure to get credentials, etc.ControlTowerException - Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceExceptiondefault ListEnabledControlsResponse listEnabledControls(Consumer<ListEnabledControlsRequest.Builder> listEnabledControlsRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException, SdkClientException, ControlTowerException
Lists the controls enabled by AWS Control Tower on the specified organizational unit and the accounts it contains.
This is a convenience which creates an instance of the ListEnabledControlsRequest.Builder avoiding the
need to create one manually via ListEnabledControlsRequest.builder()
listEnabledControlsRequest - A Consumer that will call methods on ListEnabledControlsInput.Builder to create a request.ValidationException - The input fails to satisfy the constraints specified by an AWS service.InternalServerException - Unexpected error during processing of request.AccessDeniedException - User does not have sufficient access to perform this action.ThrottlingException - Request was denied due to request throttling.ResourceNotFoundException - Request references a resource which does not exist.SdkException - Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
catch all scenarios.SdkClientException - If any client side error occurs such as an IO related failure, failure to get credentials, etc.ControlTowerException - Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceExceptiondefault ListEnabledControlsIterable listEnabledControlsPaginator(ListEnabledControlsRequest listEnabledControlsRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException, SdkClientException, ControlTowerException
Lists the controls enabled by AWS Control Tower on the specified organizational unit and the accounts it contains.
This is a variant of
listEnabledControls(software.amazon.awssdk.services.controltower.model.ListEnabledControlsRequest)
operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
internally handle making service calls for you.
When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response pages by making service calls until there are no pages left or your iteration stops. If there are errors in your request, you will see the failures only after you start iterating through the iterable.
The following are few ways to iterate through the response pages:
1) Using a Stream
software.amazon.awssdk.services.controltower.paginators.ListEnabledControlsIterable responses = client.listEnabledControlsPaginator(request);
responses.stream().forEach(....);
2) Using For loop
{
@code
software.amazon.awssdk.services.controltower.paginators.ListEnabledControlsIterable responses = client
.listEnabledControlsPaginator(request);
for (software.amazon.awssdk.services.controltower.model.ListEnabledControlsResponse response : responses) {
// do something;
}
}
3) Use iterator directly
software.amazon.awssdk.services.controltower.paginators.ListEnabledControlsIterable responses = client.listEnabledControlsPaginator(request);
responses.iterator().forEachRemaining(....);
Please notice that the configuration of maxResults won't limit the number of results you get with the paginator. It only limits the number of results in each page.
Note: If you prefer to have control on service calls, use the
listEnabledControls(software.amazon.awssdk.services.controltower.model.ListEnabledControlsRequest)
operation.
listEnabledControlsRequest - ValidationException - The input fails to satisfy the constraints specified by an AWS service.InternalServerException - Unexpected error during processing of request.AccessDeniedException - User does not have sufficient access to perform this action.ThrottlingException - Request was denied due to request throttling.ResourceNotFoundException - Request references a resource which does not exist.SdkException - Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
catch all scenarios.SdkClientException - If any client side error occurs such as an IO related failure, failure to get credentials, etc.ControlTowerException - Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceExceptiondefault ListEnabledControlsIterable listEnabledControlsPaginator(Consumer<ListEnabledControlsRequest.Builder> listEnabledControlsRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, ResourceNotFoundException, AwsServiceException, SdkClientException, ControlTowerException
Lists the controls enabled by AWS Control Tower on the specified organizational unit and the accounts it contains.
This is a variant of
listEnabledControls(software.amazon.awssdk.services.controltower.model.ListEnabledControlsRequest)
operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will
internally handle making service calls for you.
When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response pages by making service calls until there are no pages left or your iteration stops. If there are errors in your request, you will see the failures only after you start iterating through the iterable.
The following are few ways to iterate through the response pages:
1) Using a Stream
software.amazon.awssdk.services.controltower.paginators.ListEnabledControlsIterable responses = client.listEnabledControlsPaginator(request);
responses.stream().forEach(....);
2) Using For loop
{
@code
software.amazon.awssdk.services.controltower.paginators.ListEnabledControlsIterable responses = client
.listEnabledControlsPaginator(request);
for (software.amazon.awssdk.services.controltower.model.ListEnabledControlsResponse response : responses) {
// do something;
}
}
3) Use iterator directly
software.amazon.awssdk.services.controltower.paginators.ListEnabledControlsIterable responses = client.listEnabledControlsPaginator(request);
responses.iterator().forEachRemaining(....);
Please notice that the configuration of maxResults won't limit the number of results you get with the paginator. It only limits the number of results in each page.
Note: If you prefer to have control on service calls, use the
listEnabledControls(software.amazon.awssdk.services.controltower.model.ListEnabledControlsRequest)
operation.
This is a convenience which creates an instance of the ListEnabledControlsRequest.Builder avoiding the
need to create one manually via ListEnabledControlsRequest.builder()
listEnabledControlsRequest - A Consumer that will call methods on ListEnabledControlsInput.Builder to create a request.ValidationException - The input fails to satisfy the constraints specified by an AWS service.InternalServerException - Unexpected error during processing of request.AccessDeniedException - User does not have sufficient access to perform this action.ThrottlingException - Request was denied due to request throttling.ResourceNotFoundException - Request references a resource which does not exist.SdkException - Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
catch all scenarios.SdkClientException - If any client side error occurs such as an IO related failure, failure to get credentials, etc.ControlTowerException - Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceExceptionstatic ControlTowerClient create()
ControlTowerClient with the region loaded from the
DefaultAwsRegionProviderChain and credentials loaded from the
DefaultCredentialsProvider.static ControlTowerClientBuilder builder()
ControlTowerClient.static ServiceMetadata serviceMetadata()
default ControlTowerServiceClientConfiguration serviceClientConfiguration()
serviceClientConfiguration in interface AwsClientserviceClientConfiguration in interface SdkClientCopyright © 2023. All rights reserved.