amazonka-secretsmanager-1.6.0: Amazon Secrets Manager SDK.

Copyright(c) 2013-2018 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay <brendan.g.hay+amazonka@gmail.com>
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Network.AWS.SecretsManager.RotateSecret

Contents

Description

Configures and starts the asynchronous process of rotating this secret. If you include the configuration parameters, the operation sets those values for the secret and then immediately starts a rotation. If you do not include the configuration parameters, the operation starts a rotation with the values already stored in the secret. After the rotation completes, the protected service and its clients all use the new version of the secret.

This required configuration information includes the ARN of an AWS Lambda function and the time between scheduled rotations. The Lambda rotation function creates a new version of the secret and creates or updates the credentials on the protected service to match. After testing the new credentials, the function marks the new secret with the staging label AWSCURRENT so that your clients all immediately begin to use the new version. For more information about rotating secrets and how to configure a Lambda function to rotate the secrets for your protected service, see Rotating Secrets in AWS Secrets Manager in the AWS Secrets Manager User Guide .

The rotation function must end with the versions of the secret in one of two states:

  • The AWSPENDING and AWSCURRENT staging labels are attached to the same version of the secret, or
  • The AWSPENDING staging label is not attached to any version of the secret.

If instead the AWSPENDING staging label is present but is not attached to the same version as AWSCURRENT then any later invocation of RotateSecret assumes that a previous rotation request is still in progress and returns an error.

Minimum permissions

To run this command, you must have the following permissions:

  • secretsmanager:RotateSecret
  • lambda:InvokeFunction (on the function specified in the secret's metadata)

Related operations

  • To list the secrets in your account, use ListSecrets .
  • To get the details for a version of a secret, use DescribeSecret .
  • To create a new version of a secret, use CreateSecret .
  • To attach staging labels to or remove staging labels from a version of a secret, use UpdateSecretVersionStage .

Synopsis

Creating a Request

rotateSecret Source #

Creates a value of RotateSecret with the minimum fields required to make a request.

Use one of the following lenses to modify other fields as desired:

  • rsRotationRules - A structure that defines the rotation configuration for this secret.
  • rsClientRequestToken - (Optional) Specifies a unique identifier for the new version of the secret that helps ensure idempotency. If you use the AWS CLI or one of the AWS SDK to call this operation, then you can leave this parameter empty. The CLI or SDK generates a random UUID for you and includes that in the request for this parameter. If you don't use the SDK and instead generate a raw HTTP request to the Secrets Manager service endpoint, then you must generate a ClientRequestToken yourself for new versions and include that value in the request. You only need to specify your own value if you are implementing your own retry logic and want to ensure that a given secret is not created twice. We recommend that you generate a UUID-type value to ensure uniqueness within the specified secret. Secrets Manager uses this value to prevent the accidental creation of duplicate versions if there are failures and retries during the function's processing. * If the ClientRequestToken value isn't already associated with a version of the secret then a new version of the secret is created. * If a version with this value already exists and that version's SecretString and SecretBinary values are the same as the request, then the request is ignored (the operation is idempotent). * If a version with this value already exists and that version's SecretString and SecretBinary values are different from the request then an error occurs because you cannot modify an existing secret value. This value becomes the SecretVersionId of the new version.
  • rsRotationLambdaARN - (Optional) Specifies the ARN of the Lambda function that can rotate the secret.
  • rsSecretId - Specifies the secret that you want to rotate. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret.

data RotateSecret Source #

See: rotateSecret smart constructor.

Instances

Eq RotateSecret Source # 
Data RotateSecret Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> RotateSecret -> c RotateSecret #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c RotateSecret #

toConstr :: RotateSecret -> Constr #

dataTypeOf :: RotateSecret -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c RotateSecret) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RotateSecret) #

gmapT :: (forall b. Data b => b -> b) -> RotateSecret -> RotateSecret #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RotateSecret -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RotateSecret -> r #

gmapQ :: (forall d. Data d => d -> u) -> RotateSecret -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> RotateSecret -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> RotateSecret -> m RotateSecret #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> RotateSecret -> m RotateSecret #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> RotateSecret -> m RotateSecret #

Read RotateSecret Source # 
Show RotateSecret Source # 
Generic RotateSecret Source # 

Associated Types

type Rep RotateSecret :: * -> * #

Hashable RotateSecret Source # 
ToJSON RotateSecret Source # 
NFData RotateSecret Source # 

Methods

rnf :: RotateSecret -> () #

AWSRequest RotateSecret Source # 
ToHeaders RotateSecret Source # 
ToPath RotateSecret Source # 
ToQuery RotateSecret Source # 
type Rep RotateSecret Source # 
type Rep RotateSecret = D1 * (MetaData "RotateSecret" "Network.AWS.SecretsManager.RotateSecret" "amazonka-secretsmanager-1.6.0-K7nD2j5oEj0GsgMw0kPUxD" False) (C1 * (MetaCons "RotateSecret'" PrefixI True) ((:*:) * ((:*:) * (S1 * (MetaSel (Just Symbol "_rsRotationRules") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * (Maybe RotationRulesType))) (S1 * (MetaSel (Just Symbol "_rsClientRequestToken") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * (Maybe Text)))) ((:*:) * (S1 * (MetaSel (Just Symbol "_rsRotationLambdaARN") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * (Maybe Text))) (S1 * (MetaSel (Just Symbol "_rsSecretId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * Text)))))
type Rs RotateSecret Source # 

Request Lenses

rsRotationRules :: Lens' RotateSecret (Maybe RotationRulesType) Source #

A structure that defines the rotation configuration for this secret.

rsClientRequestToken :: Lens' RotateSecret (Maybe Text) Source #

(Optional) Specifies a unique identifier for the new version of the secret that helps ensure idempotency. If you use the AWS CLI or one of the AWS SDK to call this operation, then you can leave this parameter empty. The CLI or SDK generates a random UUID for you and includes that in the request for this parameter. If you don't use the SDK and instead generate a raw HTTP request to the Secrets Manager service endpoint, then you must generate a ClientRequestToken yourself for new versions and include that value in the request. You only need to specify your own value if you are implementing your own retry logic and want to ensure that a given secret is not created twice. We recommend that you generate a UUID-type value to ensure uniqueness within the specified secret. Secrets Manager uses this value to prevent the accidental creation of duplicate versions if there are failures and retries during the function's processing. * If the ClientRequestToken value isn't already associated with a version of the secret then a new version of the secret is created. * If a version with this value already exists and that version's SecretString and SecretBinary values are the same as the request, then the request is ignored (the operation is idempotent). * If a version with this value already exists and that version's SecretString and SecretBinary values are different from the request then an error occurs because you cannot modify an existing secret value. This value becomes the SecretVersionId of the new version.

rsRotationLambdaARN :: Lens' RotateSecret (Maybe Text) Source #

(Optional) Specifies the ARN of the Lambda function that can rotate the secret.

rsSecretId :: Lens' RotateSecret Text Source #

Specifies the secret that you want to rotate. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret.

Destructuring the Response

rotateSecretResponse Source #

Creates a value of RotateSecretResponse with the minimum fields required to make a request.

Use one of the following lenses to modify other fields as desired:

  • rsrsVersionId - The ID of the new version of the secret created by the rotation started by this request.
  • rsrsARN - The ARN of the secret.
  • rsrsName - The friendly name of the secret.
  • rsrsResponseStatus - -- | The response status code.

data RotateSecretResponse Source #

See: rotateSecretResponse smart constructor.

Instances

Eq RotateSecretResponse Source # 
Data RotateSecretResponse Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> RotateSecretResponse -> c RotateSecretResponse #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c RotateSecretResponse #

toConstr :: RotateSecretResponse -> Constr #

dataTypeOf :: RotateSecretResponse -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c RotateSecretResponse) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RotateSecretResponse) #

gmapT :: (forall b. Data b => b -> b) -> RotateSecretResponse -> RotateSecretResponse #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RotateSecretResponse -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RotateSecretResponse -> r #

gmapQ :: (forall d. Data d => d -> u) -> RotateSecretResponse -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> RotateSecretResponse -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> RotateSecretResponse -> m RotateSecretResponse #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> RotateSecretResponse -> m RotateSecretResponse #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> RotateSecretResponse -> m RotateSecretResponse #

Read RotateSecretResponse Source # 
Show RotateSecretResponse Source # 
Generic RotateSecretResponse Source # 
NFData RotateSecretResponse Source # 

Methods

rnf :: RotateSecretResponse -> () #

type Rep RotateSecretResponse Source # 
type Rep RotateSecretResponse = D1 * (MetaData "RotateSecretResponse" "Network.AWS.SecretsManager.RotateSecret" "amazonka-secretsmanager-1.6.0-K7nD2j5oEj0GsgMw0kPUxD" False) (C1 * (MetaCons "RotateSecretResponse'" PrefixI True) ((:*:) * ((:*:) * (S1 * (MetaSel (Just Symbol "_rsrsVersionId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * (Maybe Text))) (S1 * (MetaSel (Just Symbol "_rsrsARN") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * (Maybe Text)))) ((:*:) * (S1 * (MetaSel (Just Symbol "_rsrsName") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * (Maybe Text))) (S1 * (MetaSel (Just Symbol "_rsrsResponseStatus") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * Int)))))

Response Lenses

rsrsVersionId :: Lens' RotateSecretResponse (Maybe Text) Source #

The ID of the new version of the secret created by the rotation started by this request.

rsrsARN :: Lens' RotateSecretResponse (Maybe Text) Source #

The ARN of the secret.

rsrsName :: Lens' RotateSecretResponse (Maybe Text) Source #

The friendly name of the secret.

rsrsResponseStatus :: Lens' RotateSecretResponse Int Source #

  • - | The response status code.