amazonka-secretsmanager-1.6.1: 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.PutSecretValue

Contents

Description

Stores a new encrypted secret value in the specified secret. To do this, the operation creates a new version and attaches it to the secret. The version can contain a new SecretString value or a new SecretBinary value. You can also specify the staging labels that are initially attached to the new version.

  • If this operation creates the first version for the secret then Secrets Manager automatically attaches the staging label AWSCURRENT to the new version.
  • If another version of this secret already exists, then this operation does not automatically move any staging labels other than those that you explicitly specify in the VersionStages parameter.
  • If this operation moves the staging label AWSCURRENT from another version to this version (because you included it in the StagingLabels parameter) then Secrets Manager also automatically moves the staging label AWSPREVIOUS to the version that AWSCURRENT was removed from.
  • This operation is idempotent. If a version with a SecretVersionId with the same value as the ClientRequestToken parameter already exists and you specify the same secret data, the operation succeeds but does nothing. However, if the secret data is different, then the operation fails because you cannot modify an existing version; you can only create new ones.

Minimum permissions

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

  • secretsmanager:PutSecretValue
  • kms:GenerateDataKey - needed only if you use a customer-created KMS key to encrypt the secret. You do not need this permission to use the account's AWS managed CMK for Secrets Manager.
  • kms:Encrypt - needed only if you use a customer-created KMS key to encrypt the secret. You do not need this permission to use the account's AWS managed CMK for Secrets Manager.

Related operations

  • To retrieve the encrypted value you store in the version of a secret, use GetSecretValue .
  • To create a secret, use CreateSecret .
  • To get the details for a secret, use DescribeSecret .
  • To list the versions attached to a secret, use ListSecretVersionIds .
Synopsis

Creating a Request

putSecretValue Source #

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

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

  • psvVersionStages - (Optional) Specifies a list of staging labels that are attached to this version of the secret. These staging labels are used to track the versions through the rotation process by the Lambda rotation function. A staging label must be unique to a single version of the secret. If you specify a staging label that's already associated with a different version of the same secret then that staging label is automatically removed from the other version and attached to this version. If you do not specify a value for VersionStages then Secrets Manager automatically moves the staging label AWSCURRENT to this new version.
  • psvSecretBinary - (Optional) Specifies binary data that you want to encrypt and store in the new version of the secret. To use this parameter in the command-line tools, we recommend that you store your binary data in a file and then use the appropriate technique for your tool to pass the contents of the file as a parameter. Either SecretBinary or SecretString must have a value, but not both. They cannot both be empty. This parameter is not accessible if the secret using the Secrets Manager console.-- Note: This Lens automatically encodes and decodes Base64 data. The underlying isomorphism will encode to Base64 representation during serialisation, and decode from Base64 representation during deserialisation. This Lens accepts and returns only raw unencoded data.
  • psvSecretString - (Optional) Specifies text data that you want to encrypt and store in this new version of the secret. Either SecretString or SecretBinary must have a value, but not both. They cannot both be empty. If you create this secret by using the Secrets Manager console then Secrets Manager puts the protected secret text in only the SecretString parameter. The Secrets Manager console stores the information as a JSON structure of keyvalue pairs that the default Lambda rotation function knows how to parse. For storing multiple values, we recommend that you use a JSON text string argument and specify keyvalue pairs. For information on how to format a JSON parameter for the various command line tool environments, see Using JSON for Parameters in the AWS CLI User Guide .
  • psvClientRequestToken - (Optional) Specifies a unique identifier for the new version of the secret. This value helps ensure idempotency. Secrets Manager uses this value to prevent the accidental creation of duplicate versions if there are failures and retries during the Lambda rotation function's processing. We recommend that you generate a UUID-type value to ensure uniqueness within the specified secret. * 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 or SecretBinary values are the same as those in 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 those in the request then the request fails because you cannot modify an existing secret version. You can only create new versions to store new secret values. This value becomes the SecretVersionId of the new version.
  • psvSecretId - Specifies the secret to which you want to add a new version. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret. The secret must already exist.

data PutSecretValue Source #

See: putSecretValue smart constructor.

Instances
Eq PutSecretValue Source # 
Instance details

Defined in Network.AWS.SecretsManager.PutSecretValue

Data PutSecretValue Source # 
Instance details

Defined in Network.AWS.SecretsManager.PutSecretValue

Methods

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

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

toConstr :: PutSecretValue -> Constr #

dataTypeOf :: PutSecretValue -> DataType #

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

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

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

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

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

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

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

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

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

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

Show PutSecretValue Source # 
Instance details

Defined in Network.AWS.SecretsManager.PutSecretValue

Generic PutSecretValue Source # 
Instance details

Defined in Network.AWS.SecretsManager.PutSecretValue

Associated Types

type Rep PutSecretValue :: Type -> Type #

Hashable PutSecretValue Source # 
Instance details

Defined in Network.AWS.SecretsManager.PutSecretValue

ToJSON PutSecretValue Source # 
Instance details

Defined in Network.AWS.SecretsManager.PutSecretValue

AWSRequest PutSecretValue Source # 
Instance details

Defined in Network.AWS.SecretsManager.PutSecretValue

Associated Types

type Rs PutSecretValue :: Type #

ToHeaders PutSecretValue Source # 
Instance details

Defined in Network.AWS.SecretsManager.PutSecretValue

ToPath PutSecretValue Source # 
Instance details

Defined in Network.AWS.SecretsManager.PutSecretValue

ToQuery PutSecretValue Source # 
Instance details

Defined in Network.AWS.SecretsManager.PutSecretValue

NFData PutSecretValue Source # 
Instance details

Defined in Network.AWS.SecretsManager.PutSecretValue

Methods

rnf :: PutSecretValue -> () #

type Rep PutSecretValue Source # 
Instance details

Defined in Network.AWS.SecretsManager.PutSecretValue

type Rep PutSecretValue = D1 (MetaData "PutSecretValue" "Network.AWS.SecretsManager.PutSecretValue" "amazonka-secretsmanager-1.6.1-6zeL5AAjwvS5hEyIAnn7A2" False) (C1 (MetaCons "PutSecretValue'" PrefixI True) ((S1 (MetaSel (Just "_psvVersionStages") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe (List1 Text))) :*: S1 (MetaSel (Just "_psvSecretBinary") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe (Sensitive Base64)))) :*: (S1 (MetaSel (Just "_psvSecretString") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe (Sensitive Text))) :*: (S1 (MetaSel (Just "_psvClientRequestToken") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Text)) :*: S1 (MetaSel (Just "_psvSecretId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Text)))))
type Rs PutSecretValue Source # 
Instance details

Defined in Network.AWS.SecretsManager.PutSecretValue

Request Lenses

psvVersionStages :: Lens' PutSecretValue (Maybe (NonEmpty Text)) Source #

(Optional) Specifies a list of staging labels that are attached to this version of the secret. These staging labels are used to track the versions through the rotation process by the Lambda rotation function. A staging label must be unique to a single version of the secret. If you specify a staging label that's already associated with a different version of the same secret then that staging label is automatically removed from the other version and attached to this version. If you do not specify a value for VersionStages then Secrets Manager automatically moves the staging label AWSCURRENT to this new version.

psvSecretBinary :: Lens' PutSecretValue (Maybe ByteString) Source #

(Optional) Specifies binary data that you want to encrypt and store in the new version of the secret. To use this parameter in the command-line tools, we recommend that you store your binary data in a file and then use the appropriate technique for your tool to pass the contents of the file as a parameter. Either SecretBinary or SecretString must have a value, but not both. They cannot both be empty. This parameter is not accessible if the secret using the Secrets Manager console.-- Note: This Lens automatically encodes and decodes Base64 data. The underlying isomorphism will encode to Base64 representation during serialisation, and decode from Base64 representation during deserialisation. This Lens accepts and returns only raw unencoded data.

psvSecretString :: Lens' PutSecretValue (Maybe Text) Source #

(Optional) Specifies text data that you want to encrypt and store in this new version of the secret. Either SecretString or SecretBinary must have a value, but not both. They cannot both be empty. If you create this secret by using the Secrets Manager console then Secrets Manager puts the protected secret text in only the SecretString parameter. The Secrets Manager console stores the information as a JSON structure of keyvalue pairs that the default Lambda rotation function knows how to parse. For storing multiple values, we recommend that you use a JSON text string argument and specify keyvalue pairs. For information on how to format a JSON parameter for the various command line tool environments, see Using JSON for Parameters in the AWS CLI User Guide .

psvClientRequestToken :: Lens' PutSecretValue (Maybe Text) Source #

(Optional) Specifies a unique identifier for the new version of the secret. This value helps ensure idempotency. Secrets Manager uses this value to prevent the accidental creation of duplicate versions if there are failures and retries during the Lambda rotation function's processing. We recommend that you generate a UUID-type value to ensure uniqueness within the specified secret. * 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 or SecretBinary values are the same as those in 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 those in the request then the request fails because you cannot modify an existing secret version. You can only create new versions to store new secret values. This value becomes the SecretVersionId of the new version.

psvSecretId :: Lens' PutSecretValue Text Source #

Specifies the secret to which you want to add a new version. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret. The secret must already exist.

Destructuring the Response

putSecretValueResponse Source #

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

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

  • psvrsVersionId - The unique identifier of the version of the secret you just created or updated.
  • psvrsARN - The Amazon Resource Name (ARN) for the secret for which you just created a version.
  • psvrsVersionStages - The list of staging labels that are currently attached to this version of the secret. Staging labels are used to track a version as it progresses through the secret rotation process.
  • psvrsName - The friendly name of the secret for which you just created or updated a version.
  • psvrsResponseStatus - -- | The response status code.

data PutSecretValueResponse Source #

See: putSecretValueResponse smart constructor.

Instances
Eq PutSecretValueResponse Source # 
Instance details

Defined in Network.AWS.SecretsManager.PutSecretValue

Data PutSecretValueResponse Source # 
Instance details

Defined in Network.AWS.SecretsManager.PutSecretValue

Methods

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

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

toConstr :: PutSecretValueResponse -> Constr #

dataTypeOf :: PutSecretValueResponse -> DataType #

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

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

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

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

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

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

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

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

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

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

Read PutSecretValueResponse Source # 
Instance details

Defined in Network.AWS.SecretsManager.PutSecretValue

Show PutSecretValueResponse Source # 
Instance details

Defined in Network.AWS.SecretsManager.PutSecretValue

Generic PutSecretValueResponse Source # 
Instance details

Defined in Network.AWS.SecretsManager.PutSecretValue

Associated Types

type Rep PutSecretValueResponse :: Type -> Type #

NFData PutSecretValueResponse Source # 
Instance details

Defined in Network.AWS.SecretsManager.PutSecretValue

Methods

rnf :: PutSecretValueResponse -> () #

type Rep PutSecretValueResponse Source # 
Instance details

Defined in Network.AWS.SecretsManager.PutSecretValue

type Rep PutSecretValueResponse = D1 (MetaData "PutSecretValueResponse" "Network.AWS.SecretsManager.PutSecretValue" "amazonka-secretsmanager-1.6.1-6zeL5AAjwvS5hEyIAnn7A2" False) (C1 (MetaCons "PutSecretValueResponse'" PrefixI True) ((S1 (MetaSel (Just "_psvrsVersionId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Text)) :*: S1 (MetaSel (Just "_psvrsARN") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Text))) :*: (S1 (MetaSel (Just "_psvrsVersionStages") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe (List1 Text))) :*: (S1 (MetaSel (Just "_psvrsName") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Text)) :*: S1 (MetaSel (Just "_psvrsResponseStatus") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Int)))))

Response Lenses

psvrsVersionId :: Lens' PutSecretValueResponse (Maybe Text) Source #

The unique identifier of the version of the secret you just created or updated.

psvrsARN :: Lens' PutSecretValueResponse (Maybe Text) Source #

The Amazon Resource Name (ARN) for the secret for which you just created a version.

psvrsVersionStages :: Lens' PutSecretValueResponse (Maybe (NonEmpty Text)) Source #

The list of staging labels that are currently attached to this version of the secret. Staging labels are used to track a version as it progresses through the secret rotation process.

psvrsName :: Lens' PutSecretValueResponse (Maybe Text) Source #

The friendly name of the secret for which you just created or updated a version.