/* * Copyright 2018-2023 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 com.amazonaws.services.secretsmanager; import org.w3c.dom.*; import java.net.*; import java.util.*; import javax.annotation.Generated; import org.apache.commons.logging.*; import com.amazonaws.*; import com.amazonaws.annotation.SdkInternalApi; import com.amazonaws.auth.*; import com.amazonaws.handlers.*; import com.amazonaws.http.*; import com.amazonaws.internal.*; import com.amazonaws.internal.auth.*; import com.amazonaws.metrics.*; import com.amazonaws.regions.*; import com.amazonaws.transform.*; import com.amazonaws.util.*; import com.amazonaws.protocol.json.*; import com.amazonaws.util.AWSRequestMetrics.Field; import com.amazonaws.annotation.ThreadSafe; import com.amazonaws.client.AwsSyncClientParams; import com.amazonaws.client.builder.AdvancedConfig; import com.amazonaws.services.secretsmanager.AWSSecretsManagerClientBuilder; import com.amazonaws.AmazonServiceException; import com.amazonaws.services.secretsmanager.model.*; import com.amazonaws.services.secretsmanager.model.transform.*; /** * Client for accessing AWS Secrets Manager. All service calls made using this client are blocking, and will not return * until the service call completes. *

* Amazon Web Services Secrets Manager *

* Amazon Web Services Secrets Manager provides a service to enable you to store, manage, and retrieve, secrets. *

*

* This guide provides descriptions of the Secrets Manager API. For more information about using this service, see the * Amazon Web Services Secrets * Manager User Guide. *

*

* API Version *

*

* This version of the Secrets Manager API Reference documents the Secrets Manager API version 2017-10-17. *

*

* For a list of endpoints, see Amazon Web Services * Secrets Manager endpoints. *

*

* Support and Feedback for Amazon Web Services Secrets Manager *

*

* We welcome your feedback. Send your comments to awssecretsmanager-feedback@amazon.com, or post your feedback * and questions in the Amazon Web Services Secrets * Manager Discussion Forum. For more information about the Amazon Web Services Discussion Forums, see Forums Help. *

*

* Logging API Requests *

*

* Amazon Web Services Secrets Manager supports Amazon Web Services CloudTrail, a service that records Amazon Web * Services API calls for your Amazon Web Services account and delivers log files to an Amazon S3 bucket. By using * information that's collected by Amazon Web Services CloudTrail, you can determine the requests successfully made to * Secrets Manager, who made the request, when it was made, and so on. For more about Amazon Web Services Secrets * Manager and support for Amazon Web Services CloudTrail, see Logging * Amazon Web Services Secrets Manager Events with Amazon Web Services CloudTrail in the Amazon Web Services * Secrets Manager User Guide. To learn more about CloudTrail, including enabling it and find your log files, see * the Amazon * Web Services CloudTrail User Guide. *

*/ @ThreadSafe @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AWSSecretsManagerClient extends AmazonWebServiceClient implements AWSSecretsManager { /** Provider for AWS credentials. */ private final AWSCredentialsProvider awsCredentialsProvider; private static final Log log = LogFactory.getLog(AWSSecretsManager.class); /** Default signing name for the service. */ private static final String DEFAULT_SIGNING_NAME = "secretsmanager"; /** Client configuration factory providing ClientConfigurations tailored to this client */ protected static final ClientConfigurationFactory configFactory = new ClientConfigurationFactory(); private final AdvancedConfig advancedConfig; private static final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory = new com.amazonaws.protocol.json.SdkJsonProtocolFactory( new JsonClientMetadata() .withProtocolVersion("1.1") .withSupportsCbor(false) .withSupportsIon(false) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("EncryptionFailure").withExceptionUnmarshaller( com.amazonaws.services.secretsmanager.model.transform.EncryptionFailureExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InvalidParameterException").withExceptionUnmarshaller( com.amazonaws.services.secretsmanager.model.transform.InvalidParameterExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("PublicPolicyException").withExceptionUnmarshaller( com.amazonaws.services.secretsmanager.model.transform.PublicPolicyExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("MalformedPolicyDocumentException").withExceptionUnmarshaller( com.amazonaws.services.secretsmanager.model.transform.MalformedPolicyDocumentExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("DecryptionFailure").withExceptionUnmarshaller( com.amazonaws.services.secretsmanager.model.transform.DecryptionFailureExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InvalidRequestException").withExceptionUnmarshaller( com.amazonaws.services.secretsmanager.model.transform.InvalidRequestExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ResourceNotFoundException").withExceptionUnmarshaller( com.amazonaws.services.secretsmanager.model.transform.ResourceNotFoundExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InternalServiceError").withExceptionUnmarshaller( com.amazonaws.services.secretsmanager.model.transform.InternalServiceErrorExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ResourceExistsException").withExceptionUnmarshaller( com.amazonaws.services.secretsmanager.model.transform.ResourceExistsExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InvalidNextTokenException").withExceptionUnmarshaller( com.amazonaws.services.secretsmanager.model.transform.InvalidNextTokenExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("LimitExceededException").withExceptionUnmarshaller( com.amazonaws.services.secretsmanager.model.transform.LimitExceededExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("PreconditionNotMetException").withExceptionUnmarshaller( com.amazonaws.services.secretsmanager.model.transform.PreconditionNotMetExceptionUnmarshaller.getInstance())) .withBaseServiceExceptionClass(com.amazonaws.services.secretsmanager.model.AWSSecretsManagerException.class)); public static AWSSecretsManagerClientBuilder builder() { return AWSSecretsManagerClientBuilder.standard(); } /** * Constructs a new client to invoke service methods on AWS Secrets Manager using the specified parameters. * *

* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param clientParams * Object providing client parameters. */ AWSSecretsManagerClient(AwsSyncClientParams clientParams) { this(clientParams, false); } /** * Constructs a new client to invoke service methods on AWS Secrets Manager using the specified parameters. * *

* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param clientParams * Object providing client parameters. */ AWSSecretsManagerClient(AwsSyncClientParams clientParams, boolean endpointDiscoveryEnabled) { super(clientParams); this.awsCredentialsProvider = clientParams.getCredentialsProvider(); this.advancedConfig = clientParams.getAdvancedConfig(); init(); } private void init() { setServiceNameIntern(DEFAULT_SIGNING_NAME); setEndpointPrefix(ENDPOINT_PREFIX); // calling this.setEndPoint(...) will also modify the signer accordingly setEndpoint("secretsmanager.us-east-1.amazonaws.com"); HandlerChainFactory chainFactory = new HandlerChainFactory(); requestHandler2s.addAll(chainFactory.newRequestHandlerChain("/com/amazonaws/services/secretsmanager/request.handlers")); requestHandler2s.addAll(chainFactory.newRequestHandler2Chain("/com/amazonaws/services/secretsmanager/request.handler2s")); requestHandler2s.addAll(chainFactory.getGlobalHandlers()); } /** *

* Turns off automatic rotation, and if a rotation is currently in progress, cancels the rotation. *

*

* If you cancel a rotation in progress, it can leave the VersionStage labels in an unexpected state. * You might need to remove the staging label AWSPENDING from the partially created version. You also * need to determine whether to roll back to the previous version of the secret by moving the staging label * AWSCURRENT to the version that has AWSPENDING. To determine which version has a * specific staging label, call ListSecretVersionIds. Then use UpdateSecretVersionStage to change * staging labels. For more information, see How rotation * works. *

*

* To turn on automatic rotation again, call RotateSecret. *

*

* Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information * in request parameters because it might be logged. For more information, see Logging Secrets * Manager events with CloudTrail. *

*

* Required permissions: secretsmanager:CancelRotateSecret. For more information, see IAM policy actions for Secrets Manager and Authentication and access * control in Secrets Manager. *

* * @param cancelRotateSecretRequest * @return Result of the CancelRotateSecret operation returned by the service. * @throws ResourceNotFoundException * Secrets Manager can't find the resource that you asked for. * @throws InvalidParameterException * The parameter name or value is invalid. * @throws InternalServiceErrorException * An error occurred on the server side. * @throws InvalidRequestException * A parameter value is not valid for the current state of the resource.

*

* Possible causes: *

*