software.amazon.awssdk.services.shield.DefaultShieldClient Maven / Gradle / Ivy
Show all versions of shield Show documentation
/*
* Copyright 2014-2019 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.shield;
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.core.client.config.SdkClientConfiguration;
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.protocols.core.ExceptionMetadata;
import software.amazon.awssdk.protocols.json.AwsJsonProtocol;
import software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.services.shield.model.AccessDeniedException;
import software.amazon.awssdk.services.shield.model.AccessDeniedForDependencyException;
import software.amazon.awssdk.services.shield.model.AssociateDrtLogBucketRequest;
import software.amazon.awssdk.services.shield.model.AssociateDrtLogBucketResponse;
import software.amazon.awssdk.services.shield.model.AssociateDrtRoleRequest;
import software.amazon.awssdk.services.shield.model.AssociateDrtRoleResponse;
import software.amazon.awssdk.services.shield.model.CreateProtectionRequest;
import software.amazon.awssdk.services.shield.model.CreateProtectionResponse;
import software.amazon.awssdk.services.shield.model.CreateSubscriptionRequest;
import software.amazon.awssdk.services.shield.model.CreateSubscriptionResponse;
import software.amazon.awssdk.services.shield.model.DeleteProtectionRequest;
import software.amazon.awssdk.services.shield.model.DeleteProtectionResponse;
import software.amazon.awssdk.services.shield.model.DescribeAttackRequest;
import software.amazon.awssdk.services.shield.model.DescribeAttackResponse;
import software.amazon.awssdk.services.shield.model.DescribeDrtAccessRequest;
import software.amazon.awssdk.services.shield.model.DescribeDrtAccessResponse;
import software.amazon.awssdk.services.shield.model.DescribeEmergencyContactSettingsRequest;
import software.amazon.awssdk.services.shield.model.DescribeEmergencyContactSettingsResponse;
import software.amazon.awssdk.services.shield.model.DescribeProtectionRequest;
import software.amazon.awssdk.services.shield.model.DescribeProtectionResponse;
import software.amazon.awssdk.services.shield.model.DescribeSubscriptionRequest;
import software.amazon.awssdk.services.shield.model.DescribeSubscriptionResponse;
import software.amazon.awssdk.services.shield.model.DisassociateDrtLogBucketRequest;
import software.amazon.awssdk.services.shield.model.DisassociateDrtLogBucketResponse;
import software.amazon.awssdk.services.shield.model.DisassociateDrtRoleRequest;
import software.amazon.awssdk.services.shield.model.DisassociateDrtRoleResponse;
import software.amazon.awssdk.services.shield.model.GetSubscriptionStateRequest;
import software.amazon.awssdk.services.shield.model.GetSubscriptionStateResponse;
import software.amazon.awssdk.services.shield.model.InternalErrorException;
import software.amazon.awssdk.services.shield.model.InvalidOperationException;
import software.amazon.awssdk.services.shield.model.InvalidPaginationTokenException;
import software.amazon.awssdk.services.shield.model.InvalidParameterException;
import software.amazon.awssdk.services.shield.model.InvalidResourceException;
import software.amazon.awssdk.services.shield.model.LimitsExceededException;
import software.amazon.awssdk.services.shield.model.ListAttacksRequest;
import software.amazon.awssdk.services.shield.model.ListAttacksResponse;
import software.amazon.awssdk.services.shield.model.ListProtectionsRequest;
import software.amazon.awssdk.services.shield.model.ListProtectionsResponse;
import software.amazon.awssdk.services.shield.model.LockedSubscriptionException;
import software.amazon.awssdk.services.shield.model.NoAssociatedRoleException;
import software.amazon.awssdk.services.shield.model.OptimisticLockException;
import software.amazon.awssdk.services.shield.model.ResourceAlreadyExistsException;
import software.amazon.awssdk.services.shield.model.ResourceNotFoundException;
import software.amazon.awssdk.services.shield.model.ShieldException;
import software.amazon.awssdk.services.shield.model.UpdateEmergencyContactSettingsRequest;
import software.amazon.awssdk.services.shield.model.UpdateEmergencyContactSettingsResponse;
import software.amazon.awssdk.services.shield.model.UpdateSubscriptionRequest;
import software.amazon.awssdk.services.shield.model.UpdateSubscriptionResponse;
import software.amazon.awssdk.services.shield.transform.AssociateDrtLogBucketRequestMarshaller;
import software.amazon.awssdk.services.shield.transform.AssociateDrtRoleRequestMarshaller;
import software.amazon.awssdk.services.shield.transform.CreateProtectionRequestMarshaller;
import software.amazon.awssdk.services.shield.transform.CreateSubscriptionRequestMarshaller;
import software.amazon.awssdk.services.shield.transform.DeleteProtectionRequestMarshaller;
import software.amazon.awssdk.services.shield.transform.DescribeAttackRequestMarshaller;
import software.amazon.awssdk.services.shield.transform.DescribeDrtAccessRequestMarshaller;
import software.amazon.awssdk.services.shield.transform.DescribeEmergencyContactSettingsRequestMarshaller;
import software.amazon.awssdk.services.shield.transform.DescribeProtectionRequestMarshaller;
import software.amazon.awssdk.services.shield.transform.DescribeSubscriptionRequestMarshaller;
import software.amazon.awssdk.services.shield.transform.DisassociateDrtLogBucketRequestMarshaller;
import software.amazon.awssdk.services.shield.transform.DisassociateDrtRoleRequestMarshaller;
import software.amazon.awssdk.services.shield.transform.GetSubscriptionStateRequestMarshaller;
import software.amazon.awssdk.services.shield.transform.ListAttacksRequestMarshaller;
import software.amazon.awssdk.services.shield.transform.ListProtectionsRequestMarshaller;
import software.amazon.awssdk.services.shield.transform.UpdateEmergencyContactSettingsRequestMarshaller;
import software.amazon.awssdk.services.shield.transform.UpdateSubscriptionRequestMarshaller;
/**
* Internal implementation of {@link ShieldClient}.
*
* @see ShieldClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultShieldClient implements ShieldClient {
private final SyncClientHandler clientHandler;
private final AwsJsonProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
protected DefaultShieldClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration;
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
}
@Override
public final String serviceName() {
return SERVICE_NAME;
}
/**
*
* Authorizes the DDoS Response team (DRT) to access the specified Amazon S3 bucket containing your flow logs. You
* can associate up to 10 Amazon S3 buckets with your subscription.
*
*
* To use the services of the DRT and make an AssociateDRTLogBucket
request, you must be subscribed to
* the Business Support plan or the Enterprise Support plan.
*
*
* @param associateDrtLogBucketRequest
* @return Result of the AssociateDRTLogBucket operation returned by the service.
* @throws InternalErrorException
* Exception that indicates that a problem occurred with the service infrastructure. You can retry the
* request.
* @throws InvalidOperationException
* Exception that indicates that the operation would not cause any change to occur.
* @throws NoAssociatedRoleException
* The ARN of the role that you specifed does not exist.
* @throws LimitsExceededException
* Exception that indicates that the operation would exceed a limit.
*
* Type
is the type of limit that would be exceeded.
*
*
* Limit
is the threshold that would be exceeded.
* @throws InvalidParameterException
* Exception that indicates that the parameters passed to the API are invalid.
* @throws AccessDeniedForDependencyException
* In order to grant the necessary access to the DDoS Response Team, the user submitting
* AssociateDRTRole
must have the iam:PassRole
permission. This error indicates
* the user did not have the appropriate permissions. For more information, see Granting a User
* Permissions to Pass a Role to an AWS Service.
* @throws OptimisticLockException
* Exception that indicates that the protection state has been modified by another client. You can retry the
* request.
* @throws ResourceNotFoundException
* Exception indicating the specified resource does not exist.
* @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 ShieldException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ShieldClient.AssociateDRTLogBucket
* @see AWS
* API Documentation
*/
@Override
public AssociateDrtLogBucketResponse associateDRTLogBucket(AssociateDrtLogBucketRequest associateDrtLogBucketRequest)
throws InternalErrorException, InvalidOperationException, NoAssociatedRoleException, LimitsExceededException,
InvalidParameterException, AccessDeniedForDependencyException, OptimisticLockException, ResourceNotFoundException,
AwsServiceException, SdkClientException, ShieldException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AssociateDrtLogBucketResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("AssociateDRTLogBucket").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(associateDrtLogBucketRequest)
.withMarshaller(new AssociateDrtLogBucketRequestMarshaller(protocolFactory)));
}
/**
*
* Authorizes the DDoS Response team (DRT), using the specified role, to access your AWS account to assist with DDoS
* attack mitigation during potential attacks. This enables the DRT to inspect your AWS WAF configuration and create
* or update AWS WAF rules and web ACLs.
*
*
* You can associate only one RoleArn
with your subscription. If you submit an
* AssociateDRTRole
request for an account that already has an associated role, the new
* RoleArn
will replace the existing RoleArn
.
*
*
* Prior to making the AssociateDRTRole
request, you must attach the AWSShieldDRTAccessPolicy managed policy to the role you will specify in the request. For more information
* see Attaching and
* Detaching IAM Policies. The role must also trust the service principal drt.shield.amazonaws.com
* . For more information, see IAM JSON
* Policy Elements: Principal.
*
*
* The DRT will have access only to your AWS WAF and Shield resources. By submitting this request, you authorize the
* DRT to inspect your AWS WAF and Shield configuration and create and update AWS WAF rules and web ACLs on your
* behalf. The DRT takes these actions only if explicitly authorized by you.
*
*
* You must have the iam:PassRole
permission to make an AssociateDRTRole
request. For more
* information, see Granting a
* User Permissions to Pass a Role to an AWS Service.
*
*
* To use the services of the DRT and make an AssociateDRTRole
request, you must be subscribed to the
* Business Support plan or the Enterprise Support plan.
*
*
* @param associateDrtRoleRequest
* @return Result of the AssociateDRTRole operation returned by the service.
* @throws InternalErrorException
* Exception that indicates that a problem occurred with the service infrastructure. You can retry the
* request.
* @throws InvalidOperationException
* Exception that indicates that the operation would not cause any change to occur.
* @throws InvalidParameterException
* Exception that indicates that the parameters passed to the API are invalid.
* @throws AccessDeniedForDependencyException
* In order to grant the necessary access to the DDoS Response Team, the user submitting
* AssociateDRTRole
must have the iam:PassRole
permission. This error indicates
* the user did not have the appropriate permissions. For more information, see Granting a User
* Permissions to Pass a Role to an AWS Service.
* @throws OptimisticLockException
* Exception that indicates that the protection state has been modified by another client. You can retry the
* request.
* @throws ResourceNotFoundException
* Exception indicating the specified resource does not exist.
* @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 ShieldException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ShieldClient.AssociateDRTRole
* @see AWS API
* Documentation
*/
@Override
public AssociateDrtRoleResponse associateDRTRole(AssociateDrtRoleRequest associateDrtRoleRequest)
throws InternalErrorException, InvalidOperationException, InvalidParameterException,
AccessDeniedForDependencyException, OptimisticLockException, ResourceNotFoundException, AwsServiceException,
SdkClientException, ShieldException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
AssociateDrtRoleResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("AssociateDRTRole").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(associateDrtRoleRequest)
.withMarshaller(new AssociateDrtRoleRequestMarshaller(protocolFactory)));
}
/**
*
* Enables AWS Shield Advanced for a specific AWS resource. The resource can be an Amazon CloudFront distribution,
* Elastic Load Balancing load balancer, AWS Global Accelerator accelerator, Elastic IP Address, or an Amazon Route
* 53 hosted zone.
*
*
* You can add protection to only a single resource with each CreateProtection request. If you want to add
* protection to multiple resources at once, use the AWS WAF
* console. For more information see Getting Started with AWS
* Shield Advanced and Add AWS Shield
* Advanced Protection to more AWS Resources.
*
*
* @param createProtectionRequest
* @return Result of the CreateProtection operation returned by the service.
* @throws InternalErrorException
* Exception that indicates that a problem occurred with the service infrastructure. You can retry the
* request.
* @throws InvalidResourceException
* Exception that indicates that the resource is invalid. You might not have access to the resource, or the
* resource might not exist.
* @throws InvalidOperationException
* Exception that indicates that the operation would not cause any change to occur.
* @throws LimitsExceededException
* Exception that indicates that the operation would exceed a limit.
*
* Type
is the type of limit that would be exceeded.
*
*
* Limit
is the threshold that would be exceeded.
* @throws ResourceAlreadyExistsException
* Exception indicating the specified resource already exists.
* @throws OptimisticLockException
* Exception that indicates that the protection state has been modified by another client. You can retry the
* request.
* @throws ResourceNotFoundException
* Exception indicating the specified resource does not exist.
* @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 ShieldException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ShieldClient.CreateProtection
* @see AWS API
* Documentation
*/
@Override
public CreateProtectionResponse createProtection(CreateProtectionRequest createProtectionRequest)
throws InternalErrorException, InvalidResourceException, InvalidOperationException, LimitsExceededException,
ResourceAlreadyExistsException, OptimisticLockException, ResourceNotFoundException, AwsServiceException,
SdkClientException, ShieldException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
CreateProtectionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateProtection").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createProtectionRequest)
.withMarshaller(new CreateProtectionRequestMarshaller(protocolFactory)));
}
/**
*
* Activates AWS Shield Advanced for an account.
*
*
* As part of this request you can specify EmergencySettings
that automaticaly grant the DDoS response
* team (DRT) needed permissions to assist you during a suspected DDoS attack. For more information see Authorize the DDoS Response Team
* to Create Rules and Web ACLs on Your Behalf.
*
*
* When you initally create a subscription, your subscription is set to be automatically renewed at the end of the
* existing subscription period. You can change this by submitting an UpdateSubscription
request.
*
*
* @param createSubscriptionRequest
* @return Result of the CreateSubscription operation returned by the service.
* @throws InternalErrorException
* Exception that indicates that a problem occurred with the service infrastructure. You can retry the
* request.
* @throws ResourceAlreadyExistsException
* Exception indicating the specified resource already exists.
* @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 ShieldException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ShieldClient.CreateSubscription
* @see AWS API
* Documentation
*/
@Override
public CreateSubscriptionResponse createSubscription(CreateSubscriptionRequest createSubscriptionRequest)
throws InternalErrorException, ResourceAlreadyExistsException, AwsServiceException, SdkClientException,
ShieldException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateSubscriptionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("CreateSubscription").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(createSubscriptionRequest)
.withMarshaller(new CreateSubscriptionRequestMarshaller(protocolFactory)));
}
/**
*
* Deletes an AWS Shield Advanced Protection.
*
*
* @param deleteProtectionRequest
* @return Result of the DeleteProtection operation returned by the service.
* @throws InternalErrorException
* Exception that indicates that a problem occurred with the service infrastructure. You can retry the
* request.
* @throws ResourceNotFoundException
* Exception indicating the specified resource does not exist.
* @throws OptimisticLockException
* Exception that indicates that the protection state has been modified by another client. You can retry the
* request.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ShieldException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ShieldClient.DeleteProtection
* @see AWS API
* Documentation
*/
@Override
public DeleteProtectionResponse deleteProtection(DeleteProtectionRequest deleteProtectionRequest)
throws InternalErrorException, ResourceNotFoundException, OptimisticLockException, AwsServiceException,
SdkClientException, ShieldException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DeleteProtectionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DeleteProtection").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(deleteProtectionRequest)
.withMarshaller(new DeleteProtectionRequestMarshaller(protocolFactory)));
}
/**
*
* Describes the details of a DDoS attack.
*
*
* @param describeAttackRequest
* @return Result of the DescribeAttack operation returned by the service.
* @throws InternalErrorException
* Exception that indicates that a problem occurred with the service infrastructure. You can retry the
* request.
* @throws AccessDeniedException
* Exception that indicates the specified AttackId
does not exist, or the requester does not
* have the appropriate permissions to access the AttackId
.
* @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 ShieldException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ShieldClient.DescribeAttack
* @see AWS API
* Documentation
*/
@Override
public DescribeAttackResponse describeAttack(DescribeAttackRequest describeAttackRequest) throws InternalErrorException,
AccessDeniedException, AwsServiceException, SdkClientException, ShieldException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DescribeAttackResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeAttack").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(describeAttackRequest)
.withMarshaller(new DescribeAttackRequestMarshaller(protocolFactory)));
}
/**
*
* Returns the current role and list of Amazon S3 log buckets used by the DDoS Response team (DRT) to access your
* AWS account while assisting with attack mitigation.
*
*
* @param describeDrtAccessRequest
* @return Result of the DescribeDRTAccess operation returned by the service.
* @throws InternalErrorException
* Exception that indicates that a problem occurred with the service infrastructure. You can retry the
* request.
* @throws ResourceNotFoundException
* Exception indicating the specified resource does not exist.
* @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 ShieldException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ShieldClient.DescribeDRTAccess
* @see AWS API
* Documentation
*/
@Override
public DescribeDrtAccessResponse describeDRTAccess(DescribeDrtAccessRequest describeDrtAccessRequest)
throws InternalErrorException, ResourceNotFoundException, AwsServiceException, SdkClientException, ShieldException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
DescribeDrtAccessResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeDRTAccess").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(describeDrtAccessRequest)
.withMarshaller(new DescribeDrtAccessRequestMarshaller(protocolFactory)));
}
/**
*
* Lists the email addresses that the DRT can use to contact you during a suspected attack.
*
*
* @param describeEmergencyContactSettingsRequest
* @return Result of the DescribeEmergencyContactSettings operation returned by the service.
* @throws InternalErrorException
* Exception that indicates that a problem occurred with the service infrastructure. You can retry the
* request.
* @throws ResourceNotFoundException
* Exception indicating the specified resource does not exist.
* @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 ShieldException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ShieldClient.DescribeEmergencyContactSettings
* @see AWS API Documentation
*/
@Override
public DescribeEmergencyContactSettingsResponse describeEmergencyContactSettings(
DescribeEmergencyContactSettingsRequest describeEmergencyContactSettingsRequest) throws InternalErrorException,
ResourceNotFoundException, AwsServiceException, SdkClientException, ShieldException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeEmergencyContactSettingsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeEmergencyContactSettings").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(describeEmergencyContactSettingsRequest)
.withMarshaller(new DescribeEmergencyContactSettingsRequestMarshaller(protocolFactory)));
}
/**
*
* Lists the details of a Protection object.
*
*
* @param describeProtectionRequest
* @return Result of the DescribeProtection operation returned by the service.
* @throws InternalErrorException
* Exception that indicates that a problem occurred with the service infrastructure. You can retry the
* request.
* @throws InvalidParameterException
* Exception that indicates that the parameters passed to the API are invalid.
* @throws ResourceNotFoundException
* Exception indicating the specified resource does not exist.
* @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 ShieldException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ShieldClient.DescribeProtection
* @see AWS API
* Documentation
*/
@Override
public DescribeProtectionResponse describeProtection(DescribeProtectionRequest describeProtectionRequest)
throws InternalErrorException, InvalidParameterException, ResourceNotFoundException, AwsServiceException,
SdkClientException, ShieldException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeProtectionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeProtection").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(describeProtectionRequest)
.withMarshaller(new DescribeProtectionRequestMarshaller(protocolFactory)));
}
/**
*
* Provides details about the AWS Shield Advanced subscription for an account.
*
*
* @param describeSubscriptionRequest
* @return Result of the DescribeSubscription operation returned by the service.
* @throws InternalErrorException
* Exception that indicates that a problem occurred with the service infrastructure. You can retry the
* request.
* @throws ResourceNotFoundException
* Exception indicating the specified resource does not exist.
* @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 ShieldException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ShieldClient.DescribeSubscription
* @see AWS
* API Documentation
*/
@Override
public DescribeSubscriptionResponse describeSubscription(DescribeSubscriptionRequest describeSubscriptionRequest)
throws InternalErrorException, ResourceNotFoundException, AwsServiceException, SdkClientException, ShieldException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeSubscriptionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DescribeSubscription").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(describeSubscriptionRequest)
.withMarshaller(new DescribeSubscriptionRequestMarshaller(protocolFactory)));
}
/**
*
* Removes the DDoS Response team's (DRT) access to the specified Amazon S3 bucket containing your flow logs.
*
*
* To make a DisassociateDRTLogBucket
request, you must be subscribed to the Business Support plan or the Enterprise Support plan. However, if you are
* not subscribed to one of these support plans, but had been previously and had granted the DRT access to your
* account, you can submit a DisassociateDRTLogBucket
request to remove this access.
*
*
* @param disassociateDrtLogBucketRequest
* @return Result of the DisassociateDRTLogBucket operation returned by the service.
* @throws InternalErrorException
* Exception that indicates that a problem occurred with the service infrastructure. You can retry the
* request.
* @throws InvalidOperationException
* Exception that indicates that the operation would not cause any change to occur.
* @throws NoAssociatedRoleException
* The ARN of the role that you specifed does not exist.
* @throws AccessDeniedForDependencyException
* In order to grant the necessary access to the DDoS Response Team, the user submitting
* AssociateDRTRole
must have the iam:PassRole
permission. This error indicates
* the user did not have the appropriate permissions. For more information, see Granting a User
* Permissions to Pass a Role to an AWS Service.
* @throws OptimisticLockException
* Exception that indicates that the protection state has been modified by another client. You can retry the
* request.
* @throws ResourceNotFoundException
* Exception indicating the specified resource does not exist.
* @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 ShieldException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ShieldClient.DisassociateDRTLogBucket
* @see AWS API Documentation
*/
@Override
public DisassociateDrtLogBucketResponse disassociateDRTLogBucket(
DisassociateDrtLogBucketRequest disassociateDrtLogBucketRequest) throws InternalErrorException,
InvalidOperationException, NoAssociatedRoleException, AccessDeniedForDependencyException, OptimisticLockException,
ResourceNotFoundException, AwsServiceException, SdkClientException, ShieldException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DisassociateDrtLogBucketResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DisassociateDRTLogBucket").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(disassociateDrtLogBucketRequest)
.withMarshaller(new DisassociateDrtLogBucketRequestMarshaller(protocolFactory)));
}
/**
*
* Removes the DDoS Response team's (DRT) access to your AWS account.
*
*
* To make a DisassociateDRTRole
request, you must be subscribed to the Business Support plan or the Enterprise Support plan. However, if you are
* not subscribed to one of these support plans, but had been previously and had granted the DRT access to your
* account, you can submit a DisassociateDRTRole
request to remove this access.
*
*
* @param disassociateDrtRoleRequest
* @return Result of the DisassociateDRTRole operation returned by the service.
* @throws InternalErrorException
* Exception that indicates that a problem occurred with the service infrastructure. You can retry the
* request.
* @throws InvalidOperationException
* Exception that indicates that the operation would not cause any change to occur.
* @throws OptimisticLockException
* Exception that indicates that the protection state has been modified by another client. You can retry the
* request.
* @throws ResourceNotFoundException
* Exception indicating the specified resource does not exist.
* @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 ShieldException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ShieldClient.DisassociateDRTRole
* @see AWS API
* Documentation
*/
@Override
public DisassociateDrtRoleResponse disassociateDRTRole(DisassociateDrtRoleRequest disassociateDrtRoleRequest)
throws InternalErrorException, InvalidOperationException, OptimisticLockException, ResourceNotFoundException,
AwsServiceException, SdkClientException, ShieldException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DisassociateDrtRoleResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("DisassociateDRTRole").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(disassociateDrtRoleRequest)
.withMarshaller(new DisassociateDrtRoleRequestMarshaller(protocolFactory)));
}
/**
*
* Returns the SubscriptionState
, either Active
or Inactive
.
*
*
* @param getSubscriptionStateRequest
* @return Result of the GetSubscriptionState operation returned by the service.
* @throws InternalErrorException
* Exception that indicates that a problem occurred with the service infrastructure. You can retry the
* request.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ShieldException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ShieldClient.GetSubscriptionState
* @see AWS
* API Documentation
*/
@Override
public GetSubscriptionStateResponse getSubscriptionState(GetSubscriptionStateRequest getSubscriptionStateRequest)
throws InternalErrorException, AwsServiceException, SdkClientException, ShieldException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, GetSubscriptionStateResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("GetSubscriptionState").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(getSubscriptionStateRequest)
.withMarshaller(new GetSubscriptionStateRequestMarshaller(protocolFactory)));
}
/**
*
* Returns all ongoing DDoS attacks or all DDoS attacks during a specified time period.
*
*
* @param listAttacksRequest
* @return Result of the ListAttacks operation returned by the service.
* @throws InternalErrorException
* Exception that indicates that a problem occurred with the service infrastructure. You can retry the
* request.
* @throws InvalidParameterException
* Exception that indicates that the parameters passed to the API are invalid.
* @throws InvalidOperationException
* Exception that indicates that the operation would not cause any change to occur.
* @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 ShieldException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ShieldClient.ListAttacks
* @see AWS API
* Documentation
*/
@Override
public ListAttacksResponse listAttacks(ListAttacksRequest listAttacksRequest) throws InternalErrorException,
InvalidParameterException, InvalidOperationException, AwsServiceException, SdkClientException, ShieldException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListAttacksResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListAttacks").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listAttacksRequest)
.withMarshaller(new ListAttacksRequestMarshaller(protocolFactory)));
}
/**
*
* Lists all Protection objects for the account.
*
*
* @param listProtectionsRequest
* @return Result of the ListProtections operation returned by the service.
* @throws InternalErrorException
* Exception that indicates that a problem occurred with the service infrastructure. You can retry the
* request.
* @throws ResourceNotFoundException
* Exception indicating the specified resource does not exist.
* @throws InvalidPaginationTokenException
* Exception that indicates that the NextToken specified in the request is invalid. Submit the request using
* the NextToken value that was returned in the response.
* @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 ShieldException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ShieldClient.ListProtections
* @see AWS API
* Documentation
*/
@Override
public ListProtectionsResponse listProtections(ListProtectionsRequest listProtectionsRequest) throws InternalErrorException,
ResourceNotFoundException, InvalidPaginationTokenException, AwsServiceException, SdkClientException, ShieldException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata,
ListProtectionsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("ListProtections").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(listProtectionsRequest)
.withMarshaller(new ListProtectionsRequestMarshaller(protocolFactory)));
}
/**
*
* Updates the details of the list of email addresses that the DRT can use to contact you during a suspected attack.
*
*
* @param updateEmergencyContactSettingsRequest
* @return Result of the UpdateEmergencyContactSettings operation returned by the service.
* @throws InternalErrorException
* Exception that indicates that a problem occurred with the service infrastructure. You can retry the
* request.
* @throws InvalidParameterException
* Exception that indicates that the parameters passed to the API are invalid.
* @throws OptimisticLockException
* Exception that indicates that the protection state has been modified by another client. You can retry the
* request.
* @throws ResourceNotFoundException
* Exception indicating the specified resource does not exist.
* @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 ShieldException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ShieldClient.UpdateEmergencyContactSettings
* @see AWS API Documentation
*/
@Override
public UpdateEmergencyContactSettingsResponse updateEmergencyContactSettings(
UpdateEmergencyContactSettingsRequest updateEmergencyContactSettingsRequest) throws InternalErrorException,
InvalidParameterException, OptimisticLockException, ResourceNotFoundException, AwsServiceException,
SdkClientException, ShieldException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateEmergencyContactSettingsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateEmergencyContactSettings").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(updateEmergencyContactSettingsRequest)
.withMarshaller(new UpdateEmergencyContactSettingsRequestMarshaller(protocolFactory)));
}
/**
*
* Updates the details of an existing subscription. Only enter values for parameters you want to change. Empty
* parameters are not updated.
*
*
* @param updateSubscriptionRequest
* @return Result of the UpdateSubscription operation returned by the service.
* @throws InternalErrorException
* Exception that indicates that a problem occurred with the service infrastructure. You can retry the
* request.
* @throws LockedSubscriptionException
* You are trying to update a subscription that has not yet completed the 1-year commitment. You can change
* the AutoRenew
parameter during the last 30 days of your subscription. This exception
* indicates that you are attempting to change AutoRenew
prior to that period.
* @throws ResourceNotFoundException
* Exception indicating the specified resource does not exist.
* @throws InvalidParameterException
* Exception that indicates that the parameters passed to the API are invalid.
* @throws OptimisticLockException
* Exception that indicates that the protection state has been modified by another client. You can retry the
* request.
* @throws SdkException
* Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
* catch all scenarios.
* @throws SdkClientException
* If any client side error occurs such as an IO related failure, failure to get credentials, etc.
* @throws ShieldException
* Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
* @sample ShieldClient.UpdateSubscription
* @see AWS API
* Documentation
*/
@Override
public UpdateSubscriptionResponse updateSubscription(UpdateSubscriptionRequest updateSubscriptionRequest)
throws InternalErrorException, LockedSubscriptionException, ResourceNotFoundException, InvalidParameterException,
OptimisticLockException, AwsServiceException, SdkClientException, ShieldException {
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, UpdateSubscriptionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
return clientHandler.execute(new ClientExecutionParams()
.withOperationName("UpdateSubscription").withResponseHandler(responseHandler)
.withErrorResponseHandler(errorResponseHandler).withInput(updateSubscriptionRequest)
.withMarshaller(new UpdateSubscriptionRequestMarshaller(protocolFactory)));
}
private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory,
JsonOperationMetadata operationMetadata) {
return protocolFactory.createErrorResponseHandler(operationMetadata);
}
private > T init(T builder) {
return builder
.clientConfiguration(clientConfiguration)
.defaultServiceExceptionSupplier(ShieldException::builder)
.protocol(AwsJsonProtocol.AWS_JSON)
.protocolVersion("1.1")
.registerModeledException(
ExceptionMetadata.builder().errorCode("AccessDeniedException")
.exceptionBuilderSupplier(AccessDeniedException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("OptimisticLockException")
.exceptionBuilderSupplier(OptimisticLockException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("LockedSubscriptionException")
.exceptionBuilderSupplier(LockedSubscriptionException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidResourceException")
.exceptionBuilderSupplier(InvalidResourceException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidParameterException")
.exceptionBuilderSupplier(InvalidParameterException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidOperationException")
.exceptionBuilderSupplier(InvalidOperationException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ResourceNotFoundException")
.exceptionBuilderSupplier(ResourceNotFoundException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ResourceAlreadyExistsException")
.exceptionBuilderSupplier(ResourceAlreadyExistsException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InternalErrorException")
.exceptionBuilderSupplier(InternalErrorException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidPaginationTokenException")
.exceptionBuilderSupplier(InvalidPaginationTokenException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("LimitsExceededException")
.exceptionBuilderSupplier(LimitsExceededException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("NoAssociatedRoleException")
.exceptionBuilderSupplier(NoAssociatedRoleException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("AccessDeniedForDependencyException")
.exceptionBuilderSupplier(AccessDeniedForDependencyException::builder).build());
}
@Override
public void close() {
clientHandler.close();
}
}