{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SecretsManager.CreateSecret
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a new secret. A /secret/ can be a password, a set of credentials
-- such as a user name and password, an OAuth token, or other secret
-- information that you store in an encrypted form in Secrets Manager. The
-- secret also includes the connection information to access a database or
-- other service, which Secrets Manager doesn\'t encrypt. A secret in
-- Secrets Manager consists of both the protected secret data and the
-- important information needed to manage the secret.
--
-- For information about creating a secret in the console, see
-- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/manage_create-basic-secret.html Create a secret>.
--
-- To create a secret, you can provide the secret value to be encrypted in
-- either the @SecretString@ parameter or the @SecretBinary@ parameter, but
-- not both. If you include @SecretString@ or @SecretBinary@ then Secrets
-- Manager creates an initial secret version and automatically attaches the
-- staging label @AWSCURRENT@ to it.
--
-- For database credentials you want to rotate, for Secrets Manager to be
-- able to rotate the secret, you must make sure the JSON you store in the
-- @SecretString@ matches the
-- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_secret_json_structure.html JSON structure of a database secret>.
--
-- If you don\'t specify an KMS encryption key, Secrets Manager uses the
-- Amazon Web Services managed key @aws\/secretsmanager@. If this key
-- doesn\'t already exist in your account, then Secrets Manager creates it
-- for you automatically. All users and roles in the Amazon Web Services
-- account automatically have access to use @aws\/secretsmanager@. Creating
-- @aws\/secretsmanager@ can result in a one-time significant delay in
-- returning the result.
--
-- If the secret is in a different Amazon Web Services account from the
-- credentials calling the API, then you can\'t use @aws\/secretsmanager@
-- to encrypt the secret, and you must create and use a customer managed
-- KMS key.
--
-- Secrets Manager generates a CloudTrail log entry when you call this
-- action. Do not include sensitive information in request parameters
-- except @SecretBinary@ or @SecretString@ because it might be logged. For
-- more information, see
-- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html Logging Secrets Manager events with CloudTrail>.
--
-- __Required permissions:__ @secretsmanager:CreateSecret@. If you include
-- tags in the secret, you also need @secretsmanager:TagResource@. For more
-- information, see
-- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions IAM policy actions for Secrets Manager>
-- and
-- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html Authentication and access control in Secrets Manager>.
--
-- To encrypt the secret with a KMS key other than @aws\/secretsmanager@,
-- you need @kms:GenerateDataKey@ and @kms:Decrypt@ permission to the key.
module Amazonka.SecretsManager.CreateSecret
  ( -- * Creating a Request
    CreateSecret (..),
    newCreateSecret,

    -- * Request Lenses
    createSecret_addReplicaRegions,
    createSecret_clientRequestToken,
    createSecret_description,
    createSecret_forceOverwriteReplicaSecret,
    createSecret_kmsKeyId,
    createSecret_secretBinary,
    createSecret_secretString,
    createSecret_tags,
    createSecret_name,

    -- * Destructuring the Response
    CreateSecretResponse (..),
    newCreateSecretResponse,

    -- * Response Lenses
    createSecretResponse_arn,
    createSecretResponse_name,
    createSecretResponse_replicationStatus,
    createSecretResponse_versionId,
    createSecretResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SecretsManager.Types

-- | /See:/ 'newCreateSecret' smart constructor.
data CreateSecret = CreateSecret'
  { -- | A list of Regions and KMS keys to replicate secrets.
    CreateSecret -> Maybe (NonEmpty ReplicaRegionType)
addReplicaRegions :: Prelude.Maybe (Prelude.NonEmpty ReplicaRegionType),
    -- | If you include @SecretString@ or @SecretBinary@, then Secrets Manager
    -- creates an initial version for the secret, and this parameter specifies
    -- the unique identifier for the new version.
    --
    -- If you use the Amazon Web Services CLI or one of the Amazon Web Services
    -- SDKs to call this operation, then you can leave this parameter empty.
    -- The CLI or SDK generates a random UUID for you and includes it as the
    -- value for this parameter in the request. 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 the
    -- new version and include the value in the request.
    --
    -- 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 a rotation. We recommend that you generate a
    -- <https://wikipedia.org/wiki/Universally_unique_identifier UUID-type>
    -- value to ensure uniqueness of your versions 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 the version
    --     @SecretString@ and @SecretBinary@ values are the same as those in
    --     the request, then the request is ignored.
    --
    -- -   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 version. Instead, use PutSecretValue to create a new
    --     version.
    --
    -- This value becomes the @VersionId@ of the new version.
    CreateSecret -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
    -- | The description of the secret.
    CreateSecret -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether to overwrite a secret with the same name in the
    -- destination Region.
    CreateSecret -> Maybe Bool
forceOverwriteReplicaSecret :: Prelude.Maybe Prelude.Bool,
    -- | The ARN, key ID, or alias of the KMS key that Secrets Manager uses to
    -- encrypt the secret value in the secret. An alias is always prefixed by
    -- @alias\/@, for example @alias\/aws\/secretsmanager@. For more
    -- information, see
    -- <https://docs.aws.amazon.com/kms/latest/developerguide/alias-about.html About aliases>.
    --
    -- To use a KMS key in a different account, use the key ARN or the alias
    -- ARN.
    --
    -- If you don\'t specify this value, then Secrets Manager uses the key
    -- @aws\/secretsmanager@. If that key doesn\'t yet exist, then Secrets
    -- Manager creates it for you automatically the first time it encrypts the
    -- secret value.
    --
    -- If the secret is in a different Amazon Web Services account from the
    -- credentials calling the API, then you can\'t use @aws\/secretsmanager@
    -- to encrypt the secret, and you must create and use a customer managed
    -- KMS key.
    CreateSecret -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | The binary data to encrypt and store in the new version of the secret.
    -- We recommend that you store your binary data in a file and then pass the
    -- contents of the file as a parameter.
    --
    -- Either @SecretString@ or @SecretBinary@ must have a value, but not both.
    --
    -- This parameter is not available in the Secrets Manager console.
    CreateSecret -> Maybe (Sensitive Base64)
secretBinary :: Prelude.Maybe (Data.Sensitive Data.Base64),
    -- | The text data to encrypt and store in this new version of the secret. We
    -- recommend you use a JSON structure of key\/value pairs for your secret
    -- value.
    --
    -- Either @SecretString@ or @SecretBinary@ must have a value, but not both.
    --
    -- If you create a 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 key\/value pairs that a Lambda rotation function can parse.
    CreateSecret -> Maybe (Sensitive Text)
secretString :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | A list of tags to attach to the secret. Each tag is a key and value pair
    -- of strings in a JSON text string, for example:
    --
    -- @[{\"Key\":\"CostCenter\",\"Value\":\"12345\"},{\"Key\":\"environment\",\"Value\":\"production\"}]@
    --
    -- Secrets Manager tag key names are case sensitive. A tag with the key
    -- \"ABC\" is a different tag from one with key \"abc\".
    --
    -- If you check tags in permissions policies as part of your security
    -- strategy, then adding or removing a tag can change permissions. If the
    -- completion of this operation would result in you losing your permissions
    -- for this secret, then Secrets Manager blocks the operation and returns
    -- an @Access Denied@ error. For more information, see
    -- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#tag-secrets-abac Control access to secrets using tags>
    -- and
    -- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#auth-and-access_tags2 Limit access to identities with tags that match secrets\' tags>.
    --
    -- For information about how to format a JSON parameter for the various
    -- command line tool environments, see
    -- <https://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json Using JSON for Parameters>.
    -- If your command-line tool or SDK requires quotation marks around the
    -- parameter, you should use single quotes to avoid confusion with the
    -- double quotes required in the JSON text.
    --
    -- The following restrictions apply to tags:
    --
    -- -   Maximum number of tags per secret: 50
    --
    -- -   Maximum key length: 127 Unicode characters in UTF-8
    --
    -- -   Maximum value length: 255 Unicode characters in UTF-8
    --
    -- -   Tag keys and values are case sensitive.
    --
    -- -   Do not use the @aws:@ prefix in your tag names or values because
    --     Amazon Web Services reserves it for Amazon Web Services use. You
    --     can\'t edit or delete tag names or values with this prefix. Tags
    --     with this prefix do not count against your tags per secret limit.
    --
    -- -   If you use your tagging schema across multiple services and
    --     resources, other services might have restrictions on allowed
    --     characters. Generally allowed characters: letters, spaces, and
    --     numbers representable in UTF-8, plus the following special
    --     characters: + - = . _ : \/ \@.
    CreateSecret -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The name of the new secret.
    --
    -- The secret name can contain ASCII letters, numbers, and the following
    -- characters: \/_+=.\@-
    --
    -- Do not end your secret name with a hyphen followed by six characters. If
    -- you do so, you risk confusion and unexpected results when searching for
    -- a secret by partial ARN. Secrets Manager automatically adds a hyphen and
    -- six random characters after the secret name at the end of the ARN.
    CreateSecret -> Text
name :: Prelude.Text
  }
  deriving (CreateSecret -> CreateSecret -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSecret -> CreateSecret -> Bool
$c/= :: CreateSecret -> CreateSecret -> Bool
== :: CreateSecret -> CreateSecret -> Bool
$c== :: CreateSecret -> CreateSecret -> Bool
Prelude.Eq, Int -> CreateSecret -> ShowS
[CreateSecret] -> ShowS
CreateSecret -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSecret] -> ShowS
$cshowList :: [CreateSecret] -> ShowS
show :: CreateSecret -> String
$cshow :: CreateSecret -> String
showsPrec :: Int -> CreateSecret -> ShowS
$cshowsPrec :: Int -> CreateSecret -> ShowS
Prelude.Show, forall x. Rep CreateSecret x -> CreateSecret
forall x. CreateSecret -> Rep CreateSecret x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateSecret x -> CreateSecret
$cfrom :: forall x. CreateSecret -> Rep CreateSecret x
Prelude.Generic)

-- |
-- Create a value of 'CreateSecret' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'addReplicaRegions', 'createSecret_addReplicaRegions' - A list of Regions and KMS keys to replicate secrets.
--
-- 'clientRequestToken', 'createSecret_clientRequestToken' - If you include @SecretString@ or @SecretBinary@, then Secrets Manager
-- creates an initial version for the secret, and this parameter specifies
-- the unique identifier for the new version.
--
-- If you use the Amazon Web Services CLI or one of the Amazon Web Services
-- SDKs to call this operation, then you can leave this parameter empty.
-- The CLI or SDK generates a random UUID for you and includes it as the
-- value for this parameter in the request. 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 the
-- new version and include the value in the request.
--
-- 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 a rotation. We recommend that you generate a
-- <https://wikipedia.org/wiki/Universally_unique_identifier UUID-type>
-- value to ensure uniqueness of your versions 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 the version
--     @SecretString@ and @SecretBinary@ values are the same as those in
--     the request, then the request is ignored.
--
-- -   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 version. Instead, use PutSecretValue to create a new
--     version.
--
-- This value becomes the @VersionId@ of the new version.
--
-- 'description', 'createSecret_description' - The description of the secret.
--
-- 'forceOverwriteReplicaSecret', 'createSecret_forceOverwriteReplicaSecret' - Specifies whether to overwrite a secret with the same name in the
-- destination Region.
--
-- 'kmsKeyId', 'createSecret_kmsKeyId' - The ARN, key ID, or alias of the KMS key that Secrets Manager uses to
-- encrypt the secret value in the secret. An alias is always prefixed by
-- @alias\/@, for example @alias\/aws\/secretsmanager@. For more
-- information, see
-- <https://docs.aws.amazon.com/kms/latest/developerguide/alias-about.html About aliases>.
--
-- To use a KMS key in a different account, use the key ARN or the alias
-- ARN.
--
-- If you don\'t specify this value, then Secrets Manager uses the key
-- @aws\/secretsmanager@. If that key doesn\'t yet exist, then Secrets
-- Manager creates it for you automatically the first time it encrypts the
-- secret value.
--
-- If the secret is in a different Amazon Web Services account from the
-- credentials calling the API, then you can\'t use @aws\/secretsmanager@
-- to encrypt the secret, and you must create and use a customer managed
-- KMS key.
--
-- 'secretBinary', 'createSecret_secretBinary' - The binary data to encrypt and store in the new version of the secret.
-- We recommend that you store your binary data in a file and then pass the
-- contents of the file as a parameter.
--
-- Either @SecretString@ or @SecretBinary@ must have a value, but not both.
--
-- This parameter is not available in 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.
--
-- 'secretString', 'createSecret_secretString' - The text data to encrypt and store in this new version of the secret. We
-- recommend you use a JSON structure of key\/value pairs for your secret
-- value.
--
-- Either @SecretString@ or @SecretBinary@ must have a value, but not both.
--
-- If you create a 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 key\/value pairs that a Lambda rotation function can parse.
--
-- 'tags', 'createSecret_tags' - A list of tags to attach to the secret. Each tag is a key and value pair
-- of strings in a JSON text string, for example:
--
-- @[{\"Key\":\"CostCenter\",\"Value\":\"12345\"},{\"Key\":\"environment\",\"Value\":\"production\"}]@
--
-- Secrets Manager tag key names are case sensitive. A tag with the key
-- \"ABC\" is a different tag from one with key \"abc\".
--
-- If you check tags in permissions policies as part of your security
-- strategy, then adding or removing a tag can change permissions. If the
-- completion of this operation would result in you losing your permissions
-- for this secret, then Secrets Manager blocks the operation and returns
-- an @Access Denied@ error. For more information, see
-- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#tag-secrets-abac Control access to secrets using tags>
-- and
-- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#auth-and-access_tags2 Limit access to identities with tags that match secrets\' tags>.
--
-- For information about how to format a JSON parameter for the various
-- command line tool environments, see
-- <https://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json Using JSON for Parameters>.
-- If your command-line tool or SDK requires quotation marks around the
-- parameter, you should use single quotes to avoid confusion with the
-- double quotes required in the JSON text.
--
-- The following restrictions apply to tags:
--
-- -   Maximum number of tags per secret: 50
--
-- -   Maximum key length: 127 Unicode characters in UTF-8
--
-- -   Maximum value length: 255 Unicode characters in UTF-8
--
-- -   Tag keys and values are case sensitive.
--
-- -   Do not use the @aws:@ prefix in your tag names or values because
--     Amazon Web Services reserves it for Amazon Web Services use. You
--     can\'t edit or delete tag names or values with this prefix. Tags
--     with this prefix do not count against your tags per secret limit.
--
-- -   If you use your tagging schema across multiple services and
--     resources, other services might have restrictions on allowed
--     characters. Generally allowed characters: letters, spaces, and
--     numbers representable in UTF-8, plus the following special
--     characters: + - = . _ : \/ \@.
--
-- 'name', 'createSecret_name' - The name of the new secret.
--
-- The secret name can contain ASCII letters, numbers, and the following
-- characters: \/_+=.\@-
--
-- Do not end your secret name with a hyphen followed by six characters. If
-- you do so, you risk confusion and unexpected results when searching for
-- a secret by partial ARN. Secrets Manager automatically adds a hyphen and
-- six random characters after the secret name at the end of the ARN.
newCreateSecret ::
  -- | 'name'
  Prelude.Text ->
  CreateSecret
newCreateSecret :: Text -> CreateSecret
newCreateSecret Text
pName_ =
  CreateSecret'
    { $sel:addReplicaRegions:CreateSecret' :: Maybe (NonEmpty ReplicaRegionType)
addReplicaRegions = forall a. Maybe a
Prelude.Nothing,
      $sel:clientRequestToken:CreateSecret' :: Maybe Text
clientRequestToken = forall a. Maybe a
Prelude.Nothing,
      $sel:description:CreateSecret' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:forceOverwriteReplicaSecret:CreateSecret' :: Maybe Bool
forceOverwriteReplicaSecret = forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyId:CreateSecret' :: Maybe Text
kmsKeyId = forall a. Maybe a
Prelude.Nothing,
      $sel:secretBinary:CreateSecret' :: Maybe (Sensitive Base64)
secretBinary = forall a. Maybe a
Prelude.Nothing,
      $sel:secretString:CreateSecret' :: Maybe (Sensitive Text)
secretString = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateSecret' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateSecret' :: Text
name = Text
pName_
    }

-- | A list of Regions and KMS keys to replicate secrets.
createSecret_addReplicaRegions :: Lens.Lens' CreateSecret (Prelude.Maybe (Prelude.NonEmpty ReplicaRegionType))
createSecret_addReplicaRegions :: Lens' CreateSecret (Maybe (NonEmpty ReplicaRegionType))
createSecret_addReplicaRegions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecret' {Maybe (NonEmpty ReplicaRegionType)
addReplicaRegions :: Maybe (NonEmpty ReplicaRegionType)
$sel:addReplicaRegions:CreateSecret' :: CreateSecret -> Maybe (NonEmpty ReplicaRegionType)
addReplicaRegions} -> Maybe (NonEmpty ReplicaRegionType)
addReplicaRegions) (\s :: CreateSecret
s@CreateSecret' {} Maybe (NonEmpty ReplicaRegionType)
a -> CreateSecret
s {$sel:addReplicaRegions:CreateSecret' :: Maybe (NonEmpty ReplicaRegionType)
addReplicaRegions = Maybe (NonEmpty ReplicaRegionType)
a} :: CreateSecret) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If you include @SecretString@ or @SecretBinary@, then Secrets Manager
-- creates an initial version for the secret, and this parameter specifies
-- the unique identifier for the new version.
--
-- If you use the Amazon Web Services CLI or one of the Amazon Web Services
-- SDKs to call this operation, then you can leave this parameter empty.
-- The CLI or SDK generates a random UUID for you and includes it as the
-- value for this parameter in the request. 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 the
-- new version and include the value in the request.
--
-- 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 a rotation. We recommend that you generate a
-- <https://wikipedia.org/wiki/Universally_unique_identifier UUID-type>
-- value to ensure uniqueness of your versions 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 the version
--     @SecretString@ and @SecretBinary@ values are the same as those in
--     the request, then the request is ignored.
--
-- -   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 version. Instead, use PutSecretValue to create a new
--     version.
--
-- This value becomes the @VersionId@ of the new version.
createSecret_clientRequestToken :: Lens.Lens' CreateSecret (Prelude.Maybe Prelude.Text)
createSecret_clientRequestToken :: Lens' CreateSecret (Maybe Text)
createSecret_clientRequestToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecret' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:CreateSecret' :: CreateSecret -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: CreateSecret
s@CreateSecret' {} Maybe Text
a -> CreateSecret
s {$sel:clientRequestToken:CreateSecret' :: Maybe Text
clientRequestToken = Maybe Text
a} :: CreateSecret)

-- | The description of the secret.
createSecret_description :: Lens.Lens' CreateSecret (Prelude.Maybe Prelude.Text)
createSecret_description :: Lens' CreateSecret (Maybe Text)
createSecret_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecret' {Maybe Text
description :: Maybe Text
$sel:description:CreateSecret' :: CreateSecret -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateSecret
s@CreateSecret' {} Maybe Text
a -> CreateSecret
s {$sel:description:CreateSecret' :: Maybe Text
description = Maybe Text
a} :: CreateSecret)

-- | Specifies whether to overwrite a secret with the same name in the
-- destination Region.
createSecret_forceOverwriteReplicaSecret :: Lens.Lens' CreateSecret (Prelude.Maybe Prelude.Bool)
createSecret_forceOverwriteReplicaSecret :: Lens' CreateSecret (Maybe Bool)
createSecret_forceOverwriteReplicaSecret = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecret' {Maybe Bool
forceOverwriteReplicaSecret :: Maybe Bool
$sel:forceOverwriteReplicaSecret:CreateSecret' :: CreateSecret -> Maybe Bool
forceOverwriteReplicaSecret} -> Maybe Bool
forceOverwriteReplicaSecret) (\s :: CreateSecret
s@CreateSecret' {} Maybe Bool
a -> CreateSecret
s {$sel:forceOverwriteReplicaSecret:CreateSecret' :: Maybe Bool
forceOverwriteReplicaSecret = Maybe Bool
a} :: CreateSecret)

-- | The ARN, key ID, or alias of the KMS key that Secrets Manager uses to
-- encrypt the secret value in the secret. An alias is always prefixed by
-- @alias\/@, for example @alias\/aws\/secretsmanager@. For more
-- information, see
-- <https://docs.aws.amazon.com/kms/latest/developerguide/alias-about.html About aliases>.
--
-- To use a KMS key in a different account, use the key ARN or the alias
-- ARN.
--
-- If you don\'t specify this value, then Secrets Manager uses the key
-- @aws\/secretsmanager@. If that key doesn\'t yet exist, then Secrets
-- Manager creates it for you automatically the first time it encrypts the
-- secret value.
--
-- If the secret is in a different Amazon Web Services account from the
-- credentials calling the API, then you can\'t use @aws\/secretsmanager@
-- to encrypt the secret, and you must create and use a customer managed
-- KMS key.
createSecret_kmsKeyId :: Lens.Lens' CreateSecret (Prelude.Maybe Prelude.Text)
createSecret_kmsKeyId :: Lens' CreateSecret (Maybe Text)
createSecret_kmsKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecret' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:CreateSecret' :: CreateSecret -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: CreateSecret
s@CreateSecret' {} Maybe Text
a -> CreateSecret
s {$sel:kmsKeyId:CreateSecret' :: Maybe Text
kmsKeyId = Maybe Text
a} :: CreateSecret)

-- | The binary data to encrypt and store in the new version of the secret.
-- We recommend that you store your binary data in a file and then pass the
-- contents of the file as a parameter.
--
-- Either @SecretString@ or @SecretBinary@ must have a value, but not both.
--
-- This parameter is not available in 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.
createSecret_secretBinary :: Lens.Lens' CreateSecret (Prelude.Maybe Prelude.ByteString)
createSecret_secretBinary :: Lens' CreateSecret (Maybe ByteString)
createSecret_secretBinary = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecret' {Maybe (Sensitive Base64)
secretBinary :: Maybe (Sensitive Base64)
$sel:secretBinary:CreateSecret' :: CreateSecret -> Maybe (Sensitive Base64)
secretBinary} -> Maybe (Sensitive Base64)
secretBinary) (\s :: CreateSecret
s@CreateSecret' {} Maybe (Sensitive Base64)
a -> CreateSecret
s {$sel:secretBinary:CreateSecret' :: Maybe (Sensitive Base64)
secretBinary = Maybe (Sensitive Base64)
a} :: CreateSecret) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping (forall a. Iso' (Sensitive a) a
Data._Sensitive forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Iso' Base64 ByteString
Data._Base64)

-- | The text data to encrypt and store in this new version of the secret. We
-- recommend you use a JSON structure of key\/value pairs for your secret
-- value.
--
-- Either @SecretString@ or @SecretBinary@ must have a value, but not both.
--
-- If you create a 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 key\/value pairs that a Lambda rotation function can parse.
createSecret_secretString :: Lens.Lens' CreateSecret (Prelude.Maybe Prelude.Text)
createSecret_secretString :: Lens' CreateSecret (Maybe Text)
createSecret_secretString = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecret' {Maybe (Sensitive Text)
secretString :: Maybe (Sensitive Text)
$sel:secretString:CreateSecret' :: CreateSecret -> Maybe (Sensitive Text)
secretString} -> Maybe (Sensitive Text)
secretString) (\s :: CreateSecret
s@CreateSecret' {} Maybe (Sensitive Text)
a -> CreateSecret
s {$sel:secretString:CreateSecret' :: Maybe (Sensitive Text)
secretString = Maybe (Sensitive Text)
a} :: CreateSecret) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | A list of tags to attach to the secret. Each tag is a key and value pair
-- of strings in a JSON text string, for example:
--
-- @[{\"Key\":\"CostCenter\",\"Value\":\"12345\"},{\"Key\":\"environment\",\"Value\":\"production\"}]@
--
-- Secrets Manager tag key names are case sensitive. A tag with the key
-- \"ABC\" is a different tag from one with key \"abc\".
--
-- If you check tags in permissions policies as part of your security
-- strategy, then adding or removing a tag can change permissions. If the
-- completion of this operation would result in you losing your permissions
-- for this secret, then Secrets Manager blocks the operation and returns
-- an @Access Denied@ error. For more information, see
-- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#tag-secrets-abac Control access to secrets using tags>
-- and
-- <https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html#auth-and-access_tags2 Limit access to identities with tags that match secrets\' tags>.
--
-- For information about how to format a JSON parameter for the various
-- command line tool environments, see
-- <https://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json Using JSON for Parameters>.
-- If your command-line tool or SDK requires quotation marks around the
-- parameter, you should use single quotes to avoid confusion with the
-- double quotes required in the JSON text.
--
-- The following restrictions apply to tags:
--
-- -   Maximum number of tags per secret: 50
--
-- -   Maximum key length: 127 Unicode characters in UTF-8
--
-- -   Maximum value length: 255 Unicode characters in UTF-8
--
-- -   Tag keys and values are case sensitive.
--
-- -   Do not use the @aws:@ prefix in your tag names or values because
--     Amazon Web Services reserves it for Amazon Web Services use. You
--     can\'t edit or delete tag names or values with this prefix. Tags
--     with this prefix do not count against your tags per secret limit.
--
-- -   If you use your tagging schema across multiple services and
--     resources, other services might have restrictions on allowed
--     characters. Generally allowed characters: letters, spaces, and
--     numbers representable in UTF-8, plus the following special
--     characters: + - = . _ : \/ \@.
createSecret_tags :: Lens.Lens' CreateSecret (Prelude.Maybe [Tag])
createSecret_tags :: Lens' CreateSecret (Maybe [Tag])
createSecret_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecret' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateSecret' :: CreateSecret -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateSecret
s@CreateSecret' {} Maybe [Tag]
a -> CreateSecret
s {$sel:tags:CreateSecret' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateSecret) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the new secret.
--
-- The secret name can contain ASCII letters, numbers, and the following
-- characters: \/_+=.\@-
--
-- Do not end your secret name with a hyphen followed by six characters. If
-- you do so, you risk confusion and unexpected results when searching for
-- a secret by partial ARN. Secrets Manager automatically adds a hyphen and
-- six random characters after the secret name at the end of the ARN.
createSecret_name :: Lens.Lens' CreateSecret Prelude.Text
createSecret_name :: Lens' CreateSecret Text
createSecret_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecret' {Text
name :: Text
$sel:name:CreateSecret' :: CreateSecret -> Text
name} -> Text
name) (\s :: CreateSecret
s@CreateSecret' {} Text
a -> CreateSecret
s {$sel:name:CreateSecret' :: Text
name = Text
a} :: CreateSecret)

instance Core.AWSRequest CreateSecret where
  type AWSResponse CreateSecret = CreateSecretResponse
  request :: (Service -> Service) -> CreateSecret -> Request CreateSecret
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateSecret
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateSecret)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe [ReplicationStatusType]
-> Maybe Text
-> Int
-> CreateSecretResponse
CreateSecretResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ARN")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ReplicationStatus"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"VersionId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateSecret where
  hashWithSalt :: Int -> CreateSecret -> Int
hashWithSalt Int
_salt CreateSecret' {Maybe Bool
Maybe [Tag]
Maybe (NonEmpty ReplicaRegionType)
Maybe Text
Maybe (Sensitive Text)
Maybe (Sensitive Base64)
Text
name :: Text
tags :: Maybe [Tag]
secretString :: Maybe (Sensitive Text)
secretBinary :: Maybe (Sensitive Base64)
kmsKeyId :: Maybe Text
forceOverwriteReplicaSecret :: Maybe Bool
description :: Maybe Text
clientRequestToken :: Maybe Text
addReplicaRegions :: Maybe (NonEmpty ReplicaRegionType)
$sel:name:CreateSecret' :: CreateSecret -> Text
$sel:tags:CreateSecret' :: CreateSecret -> Maybe [Tag]
$sel:secretString:CreateSecret' :: CreateSecret -> Maybe (Sensitive Text)
$sel:secretBinary:CreateSecret' :: CreateSecret -> Maybe (Sensitive Base64)
$sel:kmsKeyId:CreateSecret' :: CreateSecret -> Maybe Text
$sel:forceOverwriteReplicaSecret:CreateSecret' :: CreateSecret -> Maybe Bool
$sel:description:CreateSecret' :: CreateSecret -> Maybe Text
$sel:clientRequestToken:CreateSecret' :: CreateSecret -> Maybe Text
$sel:addReplicaRegions:CreateSecret' :: CreateSecret -> Maybe (NonEmpty ReplicaRegionType)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty ReplicaRegionType)
addReplicaRegions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientRequestToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
forceOverwriteReplicaSecret
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
kmsKeyId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Base64)
secretBinary
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
secretString
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData CreateSecret where
  rnf :: CreateSecret -> ()
rnf CreateSecret' {Maybe Bool
Maybe [Tag]
Maybe (NonEmpty ReplicaRegionType)
Maybe Text
Maybe (Sensitive Text)
Maybe (Sensitive Base64)
Text
name :: Text
tags :: Maybe [Tag]
secretString :: Maybe (Sensitive Text)
secretBinary :: Maybe (Sensitive Base64)
kmsKeyId :: Maybe Text
forceOverwriteReplicaSecret :: Maybe Bool
description :: Maybe Text
clientRequestToken :: Maybe Text
addReplicaRegions :: Maybe (NonEmpty ReplicaRegionType)
$sel:name:CreateSecret' :: CreateSecret -> Text
$sel:tags:CreateSecret' :: CreateSecret -> Maybe [Tag]
$sel:secretString:CreateSecret' :: CreateSecret -> Maybe (Sensitive Text)
$sel:secretBinary:CreateSecret' :: CreateSecret -> Maybe (Sensitive Base64)
$sel:kmsKeyId:CreateSecret' :: CreateSecret -> Maybe Text
$sel:forceOverwriteReplicaSecret:CreateSecret' :: CreateSecret -> Maybe Bool
$sel:description:CreateSecret' :: CreateSecret -> Maybe Text
$sel:clientRequestToken:CreateSecret' :: CreateSecret -> Maybe Text
$sel:addReplicaRegions:CreateSecret' :: CreateSecret -> Maybe (NonEmpty ReplicaRegionType)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty ReplicaRegionType)
addReplicaRegions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientRequestToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
forceOverwriteReplicaSecret
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
kmsKeyId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Base64)
secretBinary
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
secretString
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name

instance Data.ToHeaders CreateSecret where
  toHeaders :: CreateSecret -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"secretsmanager.CreateSecret" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON CreateSecret where
  toJSON :: CreateSecret -> Value
toJSON CreateSecret' {Maybe Bool
Maybe [Tag]
Maybe (NonEmpty ReplicaRegionType)
Maybe Text
Maybe (Sensitive Text)
Maybe (Sensitive Base64)
Text
name :: Text
tags :: Maybe [Tag]
secretString :: Maybe (Sensitive Text)
secretBinary :: Maybe (Sensitive Base64)
kmsKeyId :: Maybe Text
forceOverwriteReplicaSecret :: Maybe Bool
description :: Maybe Text
clientRequestToken :: Maybe Text
addReplicaRegions :: Maybe (NonEmpty ReplicaRegionType)
$sel:name:CreateSecret' :: CreateSecret -> Text
$sel:tags:CreateSecret' :: CreateSecret -> Maybe [Tag]
$sel:secretString:CreateSecret' :: CreateSecret -> Maybe (Sensitive Text)
$sel:secretBinary:CreateSecret' :: CreateSecret -> Maybe (Sensitive Base64)
$sel:kmsKeyId:CreateSecret' :: CreateSecret -> Maybe Text
$sel:forceOverwriteReplicaSecret:CreateSecret' :: CreateSecret -> Maybe Bool
$sel:description:CreateSecret' :: CreateSecret -> Maybe Text
$sel:clientRequestToken:CreateSecret' :: CreateSecret -> Maybe Text
$sel:addReplicaRegions:CreateSecret' :: CreateSecret -> Maybe (NonEmpty ReplicaRegionType)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AddReplicaRegions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty ReplicaRegionType)
addReplicaRegions,
            (Key
"ClientRequestToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientRequestToken,
            (Key
"Description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Key
"ForceOverwriteReplicaSecret" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
forceOverwriteReplicaSecret,
            (Key
"KmsKeyId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKeyId,
            (Key
"SecretBinary" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Base64)
secretBinary,
            (Key
"SecretString" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
secretString,
            (Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)
          ]
      )

instance Data.ToPath CreateSecret where
  toPath :: CreateSecret -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery CreateSecret where
  toQuery :: CreateSecret -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateSecretResponse' smart constructor.
data CreateSecretResponse = CreateSecretResponse'
  { -- | The ARN of the new secret. The ARN includes the name of the secret
    -- followed by six random characters. This ensures that if you create a new
    -- secret with the same name as a deleted secret, then users with access to
    -- the old secret don\'t get access to the new secret because the ARNs are
    -- different.
    CreateSecretResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The name of the new secret.
    CreateSecretResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | A list of the replicas of this secret and their status:
    --
    -- -   @Failed@, which indicates that the replica was not created.
    --
    -- -   @InProgress@, which indicates that Secrets Manager is in the process
    --     of creating the replica.
    --
    -- -   @InSync@, which indicates that the replica was created.
    CreateSecretResponse -> Maybe [ReplicationStatusType]
replicationStatus :: Prelude.Maybe [ReplicationStatusType],
    -- | The unique identifier associated with the version of the new secret.
    CreateSecretResponse -> Maybe Text
versionId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateSecretResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateSecretResponse -> CreateSecretResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSecretResponse -> CreateSecretResponse -> Bool
$c/= :: CreateSecretResponse -> CreateSecretResponse -> Bool
== :: CreateSecretResponse -> CreateSecretResponse -> Bool
$c== :: CreateSecretResponse -> CreateSecretResponse -> Bool
Prelude.Eq, ReadPrec [CreateSecretResponse]
ReadPrec CreateSecretResponse
Int -> ReadS CreateSecretResponse
ReadS [CreateSecretResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSecretResponse]
$creadListPrec :: ReadPrec [CreateSecretResponse]
readPrec :: ReadPrec CreateSecretResponse
$creadPrec :: ReadPrec CreateSecretResponse
readList :: ReadS [CreateSecretResponse]
$creadList :: ReadS [CreateSecretResponse]
readsPrec :: Int -> ReadS CreateSecretResponse
$creadsPrec :: Int -> ReadS CreateSecretResponse
Prelude.Read, Int -> CreateSecretResponse -> ShowS
[CreateSecretResponse] -> ShowS
CreateSecretResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSecretResponse] -> ShowS
$cshowList :: [CreateSecretResponse] -> ShowS
show :: CreateSecretResponse -> String
$cshow :: CreateSecretResponse -> String
showsPrec :: Int -> CreateSecretResponse -> ShowS
$cshowsPrec :: Int -> CreateSecretResponse -> ShowS
Prelude.Show, forall x. Rep CreateSecretResponse x -> CreateSecretResponse
forall x. CreateSecretResponse -> Rep CreateSecretResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateSecretResponse x -> CreateSecretResponse
$cfrom :: forall x. CreateSecretResponse -> Rep CreateSecretResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateSecretResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'arn', 'createSecretResponse_arn' - The ARN of the new secret. The ARN includes the name of the secret
-- followed by six random characters. This ensures that if you create a new
-- secret with the same name as a deleted secret, then users with access to
-- the old secret don\'t get access to the new secret because the ARNs are
-- different.
--
-- 'name', 'createSecretResponse_name' - The name of the new secret.
--
-- 'replicationStatus', 'createSecretResponse_replicationStatus' - A list of the replicas of this secret and their status:
--
-- -   @Failed@, which indicates that the replica was not created.
--
-- -   @InProgress@, which indicates that Secrets Manager is in the process
--     of creating the replica.
--
-- -   @InSync@, which indicates that the replica was created.
--
-- 'versionId', 'createSecretResponse_versionId' - The unique identifier associated with the version of the new secret.
--
-- 'httpStatus', 'createSecretResponse_httpStatus' - The response's http status code.
newCreateSecretResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateSecretResponse
newCreateSecretResponse :: Int -> CreateSecretResponse
newCreateSecretResponse Int
pHttpStatus_ =
  CreateSecretResponse'
    { $sel:arn:CreateSecretResponse' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateSecretResponse' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:replicationStatus:CreateSecretResponse' :: Maybe [ReplicationStatusType]
replicationStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:versionId:CreateSecretResponse' :: Maybe Text
versionId = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateSecretResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ARN of the new secret. The ARN includes the name of the secret
-- followed by six random characters. This ensures that if you create a new
-- secret with the same name as a deleted secret, then users with access to
-- the old secret don\'t get access to the new secret because the ARNs are
-- different.
createSecretResponse_arn :: Lens.Lens' CreateSecretResponse (Prelude.Maybe Prelude.Text)
createSecretResponse_arn :: Lens' CreateSecretResponse (Maybe Text)
createSecretResponse_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecretResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:CreateSecretResponse' :: CreateSecretResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CreateSecretResponse
s@CreateSecretResponse' {} Maybe Text
a -> CreateSecretResponse
s {$sel:arn:CreateSecretResponse' :: Maybe Text
arn = Maybe Text
a} :: CreateSecretResponse)

-- | The name of the new secret.
createSecretResponse_name :: Lens.Lens' CreateSecretResponse (Prelude.Maybe Prelude.Text)
createSecretResponse_name :: Lens' CreateSecretResponse (Maybe Text)
createSecretResponse_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecretResponse' {Maybe Text
name :: Maybe Text
$sel:name:CreateSecretResponse' :: CreateSecretResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: CreateSecretResponse
s@CreateSecretResponse' {} Maybe Text
a -> CreateSecretResponse
s {$sel:name:CreateSecretResponse' :: Maybe Text
name = Maybe Text
a} :: CreateSecretResponse)

-- | A list of the replicas of this secret and their status:
--
-- -   @Failed@, which indicates that the replica was not created.
--
-- -   @InProgress@, which indicates that Secrets Manager is in the process
--     of creating the replica.
--
-- -   @InSync@, which indicates that the replica was created.
createSecretResponse_replicationStatus :: Lens.Lens' CreateSecretResponse (Prelude.Maybe [ReplicationStatusType])
createSecretResponse_replicationStatus :: Lens' CreateSecretResponse (Maybe [ReplicationStatusType])
createSecretResponse_replicationStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecretResponse' {Maybe [ReplicationStatusType]
replicationStatus :: Maybe [ReplicationStatusType]
$sel:replicationStatus:CreateSecretResponse' :: CreateSecretResponse -> Maybe [ReplicationStatusType]
replicationStatus} -> Maybe [ReplicationStatusType]
replicationStatus) (\s :: CreateSecretResponse
s@CreateSecretResponse' {} Maybe [ReplicationStatusType]
a -> CreateSecretResponse
s {$sel:replicationStatus:CreateSecretResponse' :: Maybe [ReplicationStatusType]
replicationStatus = Maybe [ReplicationStatusType]
a} :: CreateSecretResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The unique identifier associated with the version of the new secret.
createSecretResponse_versionId :: Lens.Lens' CreateSecretResponse (Prelude.Maybe Prelude.Text)
createSecretResponse_versionId :: Lens' CreateSecretResponse (Maybe Text)
createSecretResponse_versionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecretResponse' {Maybe Text
versionId :: Maybe Text
$sel:versionId:CreateSecretResponse' :: CreateSecretResponse -> Maybe Text
versionId} -> Maybe Text
versionId) (\s :: CreateSecretResponse
s@CreateSecretResponse' {} Maybe Text
a -> CreateSecretResponse
s {$sel:versionId:CreateSecretResponse' :: Maybe Text
versionId = Maybe Text
a} :: CreateSecretResponse)

-- | The response's http status code.
createSecretResponse_httpStatus :: Lens.Lens' CreateSecretResponse Prelude.Int
createSecretResponse_httpStatus :: Lens' CreateSecretResponse Int
createSecretResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecretResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateSecretResponse' :: CreateSecretResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateSecretResponse
s@CreateSecretResponse' {} Int
a -> CreateSecretResponse
s {$sel:httpStatus:CreateSecretResponse' :: Int
httpStatus = Int
a} :: CreateSecretResponse)

instance Prelude.NFData CreateSecretResponse where
  rnf :: CreateSecretResponse -> ()
rnf CreateSecretResponse' {Int
Maybe [ReplicationStatusType]
Maybe Text
httpStatus :: Int
versionId :: Maybe Text
replicationStatus :: Maybe [ReplicationStatusType]
name :: Maybe Text
arn :: Maybe Text
$sel:httpStatus:CreateSecretResponse' :: CreateSecretResponse -> Int
$sel:versionId:CreateSecretResponse' :: CreateSecretResponse -> Maybe Text
$sel:replicationStatus:CreateSecretResponse' :: CreateSecretResponse -> Maybe [ReplicationStatusType]
$sel:name:CreateSecretResponse' :: CreateSecretResponse -> Maybe Text
$sel:arn:CreateSecretResponse' :: CreateSecretResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ReplicationStatusType]
replicationStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
versionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus