{-# 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.DocumentDB.CopyDBClusterSnapshot
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Copies a snapshot of a cluster.
--
-- To copy a cluster snapshot from a shared manual cluster snapshot,
-- @SourceDBClusterSnapshotIdentifier@ must be the Amazon Resource Name
-- (ARN) of the shared cluster snapshot. You can only copy a shared DB
-- cluster snapshot, whether encrypted or not, in the same Amazon Web
-- Services Region.
--
-- To cancel the copy operation after it is in progress, delete the target
-- cluster snapshot identified by @TargetDBClusterSnapshotIdentifier@ while
-- that cluster snapshot is in the /copying/ status.
module Amazonka.DocumentDB.CopyDBClusterSnapshot
  ( -- * Creating a Request
    CopyDBClusterSnapshot (..),
    newCopyDBClusterSnapshot,

    -- * Request Lenses
    copyDBClusterSnapshot_copyTags,
    copyDBClusterSnapshot_kmsKeyId,
    copyDBClusterSnapshot_preSignedUrl,
    copyDBClusterSnapshot_tags,
    copyDBClusterSnapshot_sourceDBClusterSnapshotIdentifier,
    copyDBClusterSnapshot_targetDBClusterSnapshotIdentifier,

    -- * Destructuring the Response
    CopyDBClusterSnapshotResponse (..),
    newCopyDBClusterSnapshotResponse,

    -- * Response Lenses
    copyDBClusterSnapshotResponse_dbClusterSnapshot,
    copyDBClusterSnapshotResponse_httpStatus,
  )
where

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

-- | Represents the input to CopyDBClusterSnapshot.
--
-- /See:/ 'newCopyDBClusterSnapshot' smart constructor.
data CopyDBClusterSnapshot = CopyDBClusterSnapshot'
  { -- | Set to @true@ to copy all tags from the source cluster snapshot to the
    -- target cluster snapshot, and otherwise @false@. The default is @false@.
    CopyDBClusterSnapshot -> Maybe Bool
copyTags :: Prelude.Maybe Prelude.Bool,
    -- | The KMS key ID for an encrypted cluster snapshot. The KMS key ID is the
    -- Amazon Resource Name (ARN), KMS key identifier, or the KMS key alias for
    -- the KMS encryption key.
    --
    -- If you copy an encrypted cluster snapshot from your Amazon Web Services
    -- account, you can specify a value for @KmsKeyId@ to encrypt the copy with
    -- a new KMS encryption key. If you don\'t specify a value for @KmsKeyId@,
    -- then the copy of the cluster snapshot is encrypted with the same KMS key
    -- as the source cluster snapshot.
    --
    -- If you copy an encrypted cluster snapshot that is shared from another
    -- Amazon Web Services account, then you must specify a value for
    -- @KmsKeyId@.
    --
    -- To copy an encrypted cluster snapshot to another Amazon Web Services
    -- Region, set @KmsKeyId@ to the KMS key ID that you want to use to encrypt
    -- the copy of the cluster snapshot in the destination Region. KMS
    -- encryption keys are specific to the Amazon Web Services Region that they
    -- are created in, and you can\'t use encryption keys from one Amazon Web
    -- Services Region in another Amazon Web Services Region.
    --
    -- If you copy an unencrypted cluster snapshot and specify a value for the
    -- @KmsKeyId@ parameter, an error is returned.
    CopyDBClusterSnapshot -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | The URL that contains a Signature Version 4 signed request for
    -- the@CopyDBClusterSnapshot@ API action in the Amazon Web Services Region
    -- that contains the source cluster snapshot to copy. You must use the
    -- @PreSignedUrl@ parameter when copying a cluster snapshot from another
    -- Amazon Web Services Region.
    --
    -- If you are using an Amazon Web Services SDK tool or the CLI, you can
    -- specify @SourceRegion@ (or @--source-region@ for the CLI) instead of
    -- specifying @PreSignedUrl@ manually. Specifying @SourceRegion@
    -- autogenerates a pre-signed URL that is a valid request for the operation
    -- that can be executed in the source Amazon Web Services Region.
    --
    -- The presigned URL must be a valid request for the
    -- @CopyDBClusterSnapshot@ API action that can be executed in the source
    -- Amazon Web Services Region that contains the cluster snapshot to be
    -- copied. The presigned URL request must contain the following parameter
    -- values:
    --
    -- -   @SourceRegion@ - The ID of the region that contains the snapshot to
    --     be copied.
    --
    -- -   @SourceDBClusterSnapshotIdentifier@ - The identifier for the the
    --     encrypted cluster snapshot to be copied. This identifier must be in
    --     the Amazon Resource Name (ARN) format for the source Amazon Web
    --     Services Region. For example, if you are copying an encrypted
    --     cluster snapshot from the us-east-1 Amazon Web Services Region, then
    --     your @SourceDBClusterSnapshotIdentifier@ looks something like the
    --     following:
    --     @arn:aws:rds:us-east-1:12345678012:sample-cluster:sample-cluster-snapshot@.
    --
    -- -   @TargetDBClusterSnapshotIdentifier@ - The identifier for the new
    --     cluster snapshot to be created. This parameter isn\'t case
    --     sensitive.
    CopyDBClusterSnapshot -> Maybe Text
preSignedUrl :: Prelude.Maybe Prelude.Text,
    -- | The tags to be assigned to the cluster snapshot.
    CopyDBClusterSnapshot -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The identifier of the cluster snapshot to copy. This parameter is not
    -- case sensitive.
    --
    -- Constraints:
    --
    -- -   Must specify a valid system snapshot in the /available/ state.
    --
    -- -   If the source snapshot is in the same Amazon Web Services Region as
    --     the copy, specify a valid snapshot identifier.
    --
    -- -   If the source snapshot is in a different Amazon Web Services Region
    --     than the copy, specify a valid cluster snapshot ARN.
    --
    -- Example: @my-cluster-snapshot1@
    CopyDBClusterSnapshot -> Text
sourceDBClusterSnapshotIdentifier :: Prelude.Text,
    -- | The identifier of the new cluster snapshot to create from the source
    -- cluster snapshot. This parameter is not case sensitive.
    --
    -- Constraints:
    --
    -- -   Must contain from 1 to 63 letters, numbers, or hyphens.
    --
    -- -   The first character must be a letter.
    --
    -- -   Cannot end with a hyphen or contain two consecutive hyphens.
    --
    -- Example: @my-cluster-snapshot2@
    CopyDBClusterSnapshot -> Text
targetDBClusterSnapshotIdentifier :: Prelude.Text
  }
  deriving (CopyDBClusterSnapshot -> CopyDBClusterSnapshot -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CopyDBClusterSnapshot -> CopyDBClusterSnapshot -> Bool
$c/= :: CopyDBClusterSnapshot -> CopyDBClusterSnapshot -> Bool
== :: CopyDBClusterSnapshot -> CopyDBClusterSnapshot -> Bool
$c== :: CopyDBClusterSnapshot -> CopyDBClusterSnapshot -> Bool
Prelude.Eq, ReadPrec [CopyDBClusterSnapshot]
ReadPrec CopyDBClusterSnapshot
Int -> ReadS CopyDBClusterSnapshot
ReadS [CopyDBClusterSnapshot]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CopyDBClusterSnapshot]
$creadListPrec :: ReadPrec [CopyDBClusterSnapshot]
readPrec :: ReadPrec CopyDBClusterSnapshot
$creadPrec :: ReadPrec CopyDBClusterSnapshot
readList :: ReadS [CopyDBClusterSnapshot]
$creadList :: ReadS [CopyDBClusterSnapshot]
readsPrec :: Int -> ReadS CopyDBClusterSnapshot
$creadsPrec :: Int -> ReadS CopyDBClusterSnapshot
Prelude.Read, Int -> CopyDBClusterSnapshot -> ShowS
[CopyDBClusterSnapshot] -> ShowS
CopyDBClusterSnapshot -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CopyDBClusterSnapshot] -> ShowS
$cshowList :: [CopyDBClusterSnapshot] -> ShowS
show :: CopyDBClusterSnapshot -> String
$cshow :: CopyDBClusterSnapshot -> String
showsPrec :: Int -> CopyDBClusterSnapshot -> ShowS
$cshowsPrec :: Int -> CopyDBClusterSnapshot -> ShowS
Prelude.Show, forall x. Rep CopyDBClusterSnapshot x -> CopyDBClusterSnapshot
forall x. CopyDBClusterSnapshot -> Rep CopyDBClusterSnapshot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CopyDBClusterSnapshot x -> CopyDBClusterSnapshot
$cfrom :: forall x. CopyDBClusterSnapshot -> Rep CopyDBClusterSnapshot x
Prelude.Generic)

-- |
-- Create a value of 'CopyDBClusterSnapshot' 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:
--
-- 'copyTags', 'copyDBClusterSnapshot_copyTags' - Set to @true@ to copy all tags from the source cluster snapshot to the
-- target cluster snapshot, and otherwise @false@. The default is @false@.
--
-- 'kmsKeyId', 'copyDBClusterSnapshot_kmsKeyId' - The KMS key ID for an encrypted cluster snapshot. The KMS key ID is the
-- Amazon Resource Name (ARN), KMS key identifier, or the KMS key alias for
-- the KMS encryption key.
--
-- If you copy an encrypted cluster snapshot from your Amazon Web Services
-- account, you can specify a value for @KmsKeyId@ to encrypt the copy with
-- a new KMS encryption key. If you don\'t specify a value for @KmsKeyId@,
-- then the copy of the cluster snapshot is encrypted with the same KMS key
-- as the source cluster snapshot.
--
-- If you copy an encrypted cluster snapshot that is shared from another
-- Amazon Web Services account, then you must specify a value for
-- @KmsKeyId@.
--
-- To copy an encrypted cluster snapshot to another Amazon Web Services
-- Region, set @KmsKeyId@ to the KMS key ID that you want to use to encrypt
-- the copy of the cluster snapshot in the destination Region. KMS
-- encryption keys are specific to the Amazon Web Services Region that they
-- are created in, and you can\'t use encryption keys from one Amazon Web
-- Services Region in another Amazon Web Services Region.
--
-- If you copy an unencrypted cluster snapshot and specify a value for the
-- @KmsKeyId@ parameter, an error is returned.
--
-- 'preSignedUrl', 'copyDBClusterSnapshot_preSignedUrl' - The URL that contains a Signature Version 4 signed request for
-- the@CopyDBClusterSnapshot@ API action in the Amazon Web Services Region
-- that contains the source cluster snapshot to copy. You must use the
-- @PreSignedUrl@ parameter when copying a cluster snapshot from another
-- Amazon Web Services Region.
--
-- If you are using an Amazon Web Services SDK tool or the CLI, you can
-- specify @SourceRegion@ (or @--source-region@ for the CLI) instead of
-- specifying @PreSignedUrl@ manually. Specifying @SourceRegion@
-- autogenerates a pre-signed URL that is a valid request for the operation
-- that can be executed in the source Amazon Web Services Region.
--
-- The presigned URL must be a valid request for the
-- @CopyDBClusterSnapshot@ API action that can be executed in the source
-- Amazon Web Services Region that contains the cluster snapshot to be
-- copied. The presigned URL request must contain the following parameter
-- values:
--
-- -   @SourceRegion@ - The ID of the region that contains the snapshot to
--     be copied.
--
-- -   @SourceDBClusterSnapshotIdentifier@ - The identifier for the the
--     encrypted cluster snapshot to be copied. This identifier must be in
--     the Amazon Resource Name (ARN) format for the source Amazon Web
--     Services Region. For example, if you are copying an encrypted
--     cluster snapshot from the us-east-1 Amazon Web Services Region, then
--     your @SourceDBClusterSnapshotIdentifier@ looks something like the
--     following:
--     @arn:aws:rds:us-east-1:12345678012:sample-cluster:sample-cluster-snapshot@.
--
-- -   @TargetDBClusterSnapshotIdentifier@ - The identifier for the new
--     cluster snapshot to be created. This parameter isn\'t case
--     sensitive.
--
-- 'tags', 'copyDBClusterSnapshot_tags' - The tags to be assigned to the cluster snapshot.
--
-- 'sourceDBClusterSnapshotIdentifier', 'copyDBClusterSnapshot_sourceDBClusterSnapshotIdentifier' - The identifier of the cluster snapshot to copy. This parameter is not
-- case sensitive.
--
-- Constraints:
--
-- -   Must specify a valid system snapshot in the /available/ state.
--
-- -   If the source snapshot is in the same Amazon Web Services Region as
--     the copy, specify a valid snapshot identifier.
--
-- -   If the source snapshot is in a different Amazon Web Services Region
--     than the copy, specify a valid cluster snapshot ARN.
--
-- Example: @my-cluster-snapshot1@
--
-- 'targetDBClusterSnapshotIdentifier', 'copyDBClusterSnapshot_targetDBClusterSnapshotIdentifier' - The identifier of the new cluster snapshot to create from the source
-- cluster snapshot. This parameter is not case sensitive.
--
-- Constraints:
--
-- -   Must contain from 1 to 63 letters, numbers, or hyphens.
--
-- -   The first character must be a letter.
--
-- -   Cannot end with a hyphen or contain two consecutive hyphens.
--
-- Example: @my-cluster-snapshot2@
newCopyDBClusterSnapshot ::
  -- | 'sourceDBClusterSnapshotIdentifier'
  Prelude.Text ->
  -- | 'targetDBClusterSnapshotIdentifier'
  Prelude.Text ->
  CopyDBClusterSnapshot
newCopyDBClusterSnapshot :: Text -> Text -> CopyDBClusterSnapshot
newCopyDBClusterSnapshot
  Text
pSourceDBClusterSnapshotIdentifier_
  Text
pTargetDBClusterSnapshotIdentifier_ =
    CopyDBClusterSnapshot'
      { $sel:copyTags:CopyDBClusterSnapshot' :: Maybe Bool
copyTags = forall a. Maybe a
Prelude.Nothing,
        $sel:kmsKeyId:CopyDBClusterSnapshot' :: Maybe Text
kmsKeyId = forall a. Maybe a
Prelude.Nothing,
        $sel:preSignedUrl:CopyDBClusterSnapshot' :: Maybe Text
preSignedUrl = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CopyDBClusterSnapshot' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:sourceDBClusterSnapshotIdentifier:CopyDBClusterSnapshot' :: Text
sourceDBClusterSnapshotIdentifier =
          Text
pSourceDBClusterSnapshotIdentifier_,
        $sel:targetDBClusterSnapshotIdentifier:CopyDBClusterSnapshot' :: Text
targetDBClusterSnapshotIdentifier =
          Text
pTargetDBClusterSnapshotIdentifier_
      }

-- | Set to @true@ to copy all tags from the source cluster snapshot to the
-- target cluster snapshot, and otherwise @false@. The default is @false@.
copyDBClusterSnapshot_copyTags :: Lens.Lens' CopyDBClusterSnapshot (Prelude.Maybe Prelude.Bool)
copyDBClusterSnapshot_copyTags :: Lens' CopyDBClusterSnapshot (Maybe Bool)
copyDBClusterSnapshot_copyTags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyDBClusterSnapshot' {Maybe Bool
copyTags :: Maybe Bool
$sel:copyTags:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Maybe Bool
copyTags} -> Maybe Bool
copyTags) (\s :: CopyDBClusterSnapshot
s@CopyDBClusterSnapshot' {} Maybe Bool
a -> CopyDBClusterSnapshot
s {$sel:copyTags:CopyDBClusterSnapshot' :: Maybe Bool
copyTags = Maybe Bool
a} :: CopyDBClusterSnapshot)

-- | The KMS key ID for an encrypted cluster snapshot. The KMS key ID is the
-- Amazon Resource Name (ARN), KMS key identifier, or the KMS key alias for
-- the KMS encryption key.
--
-- If you copy an encrypted cluster snapshot from your Amazon Web Services
-- account, you can specify a value for @KmsKeyId@ to encrypt the copy with
-- a new KMS encryption key. If you don\'t specify a value for @KmsKeyId@,
-- then the copy of the cluster snapshot is encrypted with the same KMS key
-- as the source cluster snapshot.
--
-- If you copy an encrypted cluster snapshot that is shared from another
-- Amazon Web Services account, then you must specify a value for
-- @KmsKeyId@.
--
-- To copy an encrypted cluster snapshot to another Amazon Web Services
-- Region, set @KmsKeyId@ to the KMS key ID that you want to use to encrypt
-- the copy of the cluster snapshot in the destination Region. KMS
-- encryption keys are specific to the Amazon Web Services Region that they
-- are created in, and you can\'t use encryption keys from one Amazon Web
-- Services Region in another Amazon Web Services Region.
--
-- If you copy an unencrypted cluster snapshot and specify a value for the
-- @KmsKeyId@ parameter, an error is returned.
copyDBClusterSnapshot_kmsKeyId :: Lens.Lens' CopyDBClusterSnapshot (Prelude.Maybe Prelude.Text)
copyDBClusterSnapshot_kmsKeyId :: Lens' CopyDBClusterSnapshot (Maybe Text)
copyDBClusterSnapshot_kmsKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyDBClusterSnapshot' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: CopyDBClusterSnapshot
s@CopyDBClusterSnapshot' {} Maybe Text
a -> CopyDBClusterSnapshot
s {$sel:kmsKeyId:CopyDBClusterSnapshot' :: Maybe Text
kmsKeyId = Maybe Text
a} :: CopyDBClusterSnapshot)

-- | The URL that contains a Signature Version 4 signed request for
-- the@CopyDBClusterSnapshot@ API action in the Amazon Web Services Region
-- that contains the source cluster snapshot to copy. You must use the
-- @PreSignedUrl@ parameter when copying a cluster snapshot from another
-- Amazon Web Services Region.
--
-- If you are using an Amazon Web Services SDK tool or the CLI, you can
-- specify @SourceRegion@ (or @--source-region@ for the CLI) instead of
-- specifying @PreSignedUrl@ manually. Specifying @SourceRegion@
-- autogenerates a pre-signed URL that is a valid request for the operation
-- that can be executed in the source Amazon Web Services Region.
--
-- The presigned URL must be a valid request for the
-- @CopyDBClusterSnapshot@ API action that can be executed in the source
-- Amazon Web Services Region that contains the cluster snapshot to be
-- copied. The presigned URL request must contain the following parameter
-- values:
--
-- -   @SourceRegion@ - The ID of the region that contains the snapshot to
--     be copied.
--
-- -   @SourceDBClusterSnapshotIdentifier@ - The identifier for the the
--     encrypted cluster snapshot to be copied. This identifier must be in
--     the Amazon Resource Name (ARN) format for the source Amazon Web
--     Services Region. For example, if you are copying an encrypted
--     cluster snapshot from the us-east-1 Amazon Web Services Region, then
--     your @SourceDBClusterSnapshotIdentifier@ looks something like the
--     following:
--     @arn:aws:rds:us-east-1:12345678012:sample-cluster:sample-cluster-snapshot@.
--
-- -   @TargetDBClusterSnapshotIdentifier@ - The identifier for the new
--     cluster snapshot to be created. This parameter isn\'t case
--     sensitive.
copyDBClusterSnapshot_preSignedUrl :: Lens.Lens' CopyDBClusterSnapshot (Prelude.Maybe Prelude.Text)
copyDBClusterSnapshot_preSignedUrl :: Lens' CopyDBClusterSnapshot (Maybe Text)
copyDBClusterSnapshot_preSignedUrl = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyDBClusterSnapshot' {Maybe Text
preSignedUrl :: Maybe Text
$sel:preSignedUrl:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Maybe Text
preSignedUrl} -> Maybe Text
preSignedUrl) (\s :: CopyDBClusterSnapshot
s@CopyDBClusterSnapshot' {} Maybe Text
a -> CopyDBClusterSnapshot
s {$sel:preSignedUrl:CopyDBClusterSnapshot' :: Maybe Text
preSignedUrl = Maybe Text
a} :: CopyDBClusterSnapshot)

-- | The tags to be assigned to the cluster snapshot.
copyDBClusterSnapshot_tags :: Lens.Lens' CopyDBClusterSnapshot (Prelude.Maybe [Tag])
copyDBClusterSnapshot_tags :: Lens' CopyDBClusterSnapshot (Maybe [Tag])
copyDBClusterSnapshot_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyDBClusterSnapshot' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CopyDBClusterSnapshot
s@CopyDBClusterSnapshot' {} Maybe [Tag]
a -> CopyDBClusterSnapshot
s {$sel:tags:CopyDBClusterSnapshot' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CopyDBClusterSnapshot) 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 identifier of the cluster snapshot to copy. This parameter is not
-- case sensitive.
--
-- Constraints:
--
-- -   Must specify a valid system snapshot in the /available/ state.
--
-- -   If the source snapshot is in the same Amazon Web Services Region as
--     the copy, specify a valid snapshot identifier.
--
-- -   If the source snapshot is in a different Amazon Web Services Region
--     than the copy, specify a valid cluster snapshot ARN.
--
-- Example: @my-cluster-snapshot1@
copyDBClusterSnapshot_sourceDBClusterSnapshotIdentifier :: Lens.Lens' CopyDBClusterSnapshot Prelude.Text
copyDBClusterSnapshot_sourceDBClusterSnapshotIdentifier :: Lens' CopyDBClusterSnapshot Text
copyDBClusterSnapshot_sourceDBClusterSnapshotIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyDBClusterSnapshot' {Text
sourceDBClusterSnapshotIdentifier :: Text
$sel:sourceDBClusterSnapshotIdentifier:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Text
sourceDBClusterSnapshotIdentifier} -> Text
sourceDBClusterSnapshotIdentifier) (\s :: CopyDBClusterSnapshot
s@CopyDBClusterSnapshot' {} Text
a -> CopyDBClusterSnapshot
s {$sel:sourceDBClusterSnapshotIdentifier:CopyDBClusterSnapshot' :: Text
sourceDBClusterSnapshotIdentifier = Text
a} :: CopyDBClusterSnapshot)

-- | The identifier of the new cluster snapshot to create from the source
-- cluster snapshot. This parameter is not case sensitive.
--
-- Constraints:
--
-- -   Must contain from 1 to 63 letters, numbers, or hyphens.
--
-- -   The first character must be a letter.
--
-- -   Cannot end with a hyphen or contain two consecutive hyphens.
--
-- Example: @my-cluster-snapshot2@
copyDBClusterSnapshot_targetDBClusterSnapshotIdentifier :: Lens.Lens' CopyDBClusterSnapshot Prelude.Text
copyDBClusterSnapshot_targetDBClusterSnapshotIdentifier :: Lens' CopyDBClusterSnapshot Text
copyDBClusterSnapshot_targetDBClusterSnapshotIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyDBClusterSnapshot' {Text
targetDBClusterSnapshotIdentifier :: Text
$sel:targetDBClusterSnapshotIdentifier:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Text
targetDBClusterSnapshotIdentifier} -> Text
targetDBClusterSnapshotIdentifier) (\s :: CopyDBClusterSnapshot
s@CopyDBClusterSnapshot' {} Text
a -> CopyDBClusterSnapshot
s {$sel:targetDBClusterSnapshotIdentifier:CopyDBClusterSnapshot' :: Text
targetDBClusterSnapshotIdentifier = Text
a} :: CopyDBClusterSnapshot)

instance Core.AWSRequest CopyDBClusterSnapshot where
  type
    AWSResponse CopyDBClusterSnapshot =
      CopyDBClusterSnapshotResponse
  request :: (Service -> Service)
-> CopyDBClusterSnapshot -> Request CopyDBClusterSnapshot
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CopyDBClusterSnapshot
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CopyDBClusterSnapshot)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"CopyDBClusterSnapshotResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe DBClusterSnapshot -> Int -> CopyDBClusterSnapshotResponse
CopyDBClusterSnapshotResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"DBClusterSnapshot")
            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 CopyDBClusterSnapshot where
  hashWithSalt :: Int -> CopyDBClusterSnapshot -> Int
hashWithSalt Int
_salt CopyDBClusterSnapshot' {Maybe Bool
Maybe [Tag]
Maybe Text
Text
targetDBClusterSnapshotIdentifier :: Text
sourceDBClusterSnapshotIdentifier :: Text
tags :: Maybe [Tag]
preSignedUrl :: Maybe Text
kmsKeyId :: Maybe Text
copyTags :: Maybe Bool
$sel:targetDBClusterSnapshotIdentifier:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Text
$sel:sourceDBClusterSnapshotIdentifier:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Text
$sel:tags:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Maybe [Tag]
$sel:preSignedUrl:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Maybe Text
$sel:kmsKeyId:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Maybe Text
$sel:copyTags:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
copyTags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
kmsKeyId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
preSignedUrl
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sourceDBClusterSnapshotIdentifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
targetDBClusterSnapshotIdentifier

instance Prelude.NFData CopyDBClusterSnapshot where
  rnf :: CopyDBClusterSnapshot -> ()
rnf CopyDBClusterSnapshot' {Maybe Bool
Maybe [Tag]
Maybe Text
Text
targetDBClusterSnapshotIdentifier :: Text
sourceDBClusterSnapshotIdentifier :: Text
tags :: Maybe [Tag]
preSignedUrl :: Maybe Text
kmsKeyId :: Maybe Text
copyTags :: Maybe Bool
$sel:targetDBClusterSnapshotIdentifier:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Text
$sel:sourceDBClusterSnapshotIdentifier:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Text
$sel:tags:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Maybe [Tag]
$sel:preSignedUrl:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Maybe Text
$sel:kmsKeyId:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Maybe Text
$sel:copyTags:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
copyTags
      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 Text
preSignedUrl
      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
sourceDBClusterSnapshotIdentifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
targetDBClusterSnapshotIdentifier

instance Data.ToHeaders CopyDBClusterSnapshot where
  toHeaders :: CopyDBClusterSnapshot -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

instance Data.ToQuery CopyDBClusterSnapshot where
  toQuery :: CopyDBClusterSnapshot -> QueryString
toQuery CopyDBClusterSnapshot' {Maybe Bool
Maybe [Tag]
Maybe Text
Text
targetDBClusterSnapshotIdentifier :: Text
sourceDBClusterSnapshotIdentifier :: Text
tags :: Maybe [Tag]
preSignedUrl :: Maybe Text
kmsKeyId :: Maybe Text
copyTags :: Maybe Bool
$sel:targetDBClusterSnapshotIdentifier:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Text
$sel:sourceDBClusterSnapshotIdentifier:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Text
$sel:tags:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Maybe [Tag]
$sel:preSignedUrl:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Maybe Text
$sel:kmsKeyId:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Maybe Text
$sel:copyTags:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"CopyDBClusterSnapshot" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"CopyTags" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
copyTags,
        ByteString
"KmsKeyId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
kmsKeyId,
        ByteString
"PreSignedUrl" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
preSignedUrl,
        ByteString
"Tags"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a. ToQuery a => a -> QueryString
Data.toQuery
            (forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"Tag" forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags),
        ByteString
"SourceDBClusterSnapshotIdentifier"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
sourceDBClusterSnapshotIdentifier,
        ByteString
"TargetDBClusterSnapshotIdentifier"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
targetDBClusterSnapshotIdentifier
      ]

-- | /See:/ 'newCopyDBClusterSnapshotResponse' smart constructor.
data CopyDBClusterSnapshotResponse = CopyDBClusterSnapshotResponse'
  { CopyDBClusterSnapshotResponse -> Maybe DBClusterSnapshot
dbClusterSnapshot :: Prelude.Maybe DBClusterSnapshot,
    -- | The response's http status code.
    CopyDBClusterSnapshotResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CopyDBClusterSnapshotResponse
-> CopyDBClusterSnapshotResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CopyDBClusterSnapshotResponse
-> CopyDBClusterSnapshotResponse -> Bool
$c/= :: CopyDBClusterSnapshotResponse
-> CopyDBClusterSnapshotResponse -> Bool
== :: CopyDBClusterSnapshotResponse
-> CopyDBClusterSnapshotResponse -> Bool
$c== :: CopyDBClusterSnapshotResponse
-> CopyDBClusterSnapshotResponse -> Bool
Prelude.Eq, ReadPrec [CopyDBClusterSnapshotResponse]
ReadPrec CopyDBClusterSnapshotResponse
Int -> ReadS CopyDBClusterSnapshotResponse
ReadS [CopyDBClusterSnapshotResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CopyDBClusterSnapshotResponse]
$creadListPrec :: ReadPrec [CopyDBClusterSnapshotResponse]
readPrec :: ReadPrec CopyDBClusterSnapshotResponse
$creadPrec :: ReadPrec CopyDBClusterSnapshotResponse
readList :: ReadS [CopyDBClusterSnapshotResponse]
$creadList :: ReadS [CopyDBClusterSnapshotResponse]
readsPrec :: Int -> ReadS CopyDBClusterSnapshotResponse
$creadsPrec :: Int -> ReadS CopyDBClusterSnapshotResponse
Prelude.Read, Int -> CopyDBClusterSnapshotResponse -> ShowS
[CopyDBClusterSnapshotResponse] -> ShowS
CopyDBClusterSnapshotResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CopyDBClusterSnapshotResponse] -> ShowS
$cshowList :: [CopyDBClusterSnapshotResponse] -> ShowS
show :: CopyDBClusterSnapshotResponse -> String
$cshow :: CopyDBClusterSnapshotResponse -> String
showsPrec :: Int -> CopyDBClusterSnapshotResponse -> ShowS
$cshowsPrec :: Int -> CopyDBClusterSnapshotResponse -> ShowS
Prelude.Show, forall x.
Rep CopyDBClusterSnapshotResponse x
-> CopyDBClusterSnapshotResponse
forall x.
CopyDBClusterSnapshotResponse
-> Rep CopyDBClusterSnapshotResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CopyDBClusterSnapshotResponse x
-> CopyDBClusterSnapshotResponse
$cfrom :: forall x.
CopyDBClusterSnapshotResponse
-> Rep CopyDBClusterSnapshotResponse x
Prelude.Generic)

-- |
-- Create a value of 'CopyDBClusterSnapshotResponse' 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:
--
-- 'dbClusterSnapshot', 'copyDBClusterSnapshotResponse_dbClusterSnapshot' - Undocumented member.
--
-- 'httpStatus', 'copyDBClusterSnapshotResponse_httpStatus' - The response's http status code.
newCopyDBClusterSnapshotResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CopyDBClusterSnapshotResponse
newCopyDBClusterSnapshotResponse :: Int -> CopyDBClusterSnapshotResponse
newCopyDBClusterSnapshotResponse Int
pHttpStatus_ =
  CopyDBClusterSnapshotResponse'
    { $sel:dbClusterSnapshot:CopyDBClusterSnapshotResponse' :: Maybe DBClusterSnapshot
dbClusterSnapshot =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CopyDBClusterSnapshotResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
copyDBClusterSnapshotResponse_dbClusterSnapshot :: Lens.Lens' CopyDBClusterSnapshotResponse (Prelude.Maybe DBClusterSnapshot)
copyDBClusterSnapshotResponse_dbClusterSnapshot :: Lens' CopyDBClusterSnapshotResponse (Maybe DBClusterSnapshot)
copyDBClusterSnapshotResponse_dbClusterSnapshot = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyDBClusterSnapshotResponse' {Maybe DBClusterSnapshot
dbClusterSnapshot :: Maybe DBClusterSnapshot
$sel:dbClusterSnapshot:CopyDBClusterSnapshotResponse' :: CopyDBClusterSnapshotResponse -> Maybe DBClusterSnapshot
dbClusterSnapshot} -> Maybe DBClusterSnapshot
dbClusterSnapshot) (\s :: CopyDBClusterSnapshotResponse
s@CopyDBClusterSnapshotResponse' {} Maybe DBClusterSnapshot
a -> CopyDBClusterSnapshotResponse
s {$sel:dbClusterSnapshot:CopyDBClusterSnapshotResponse' :: Maybe DBClusterSnapshot
dbClusterSnapshot = Maybe DBClusterSnapshot
a} :: CopyDBClusterSnapshotResponse)

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

instance Prelude.NFData CopyDBClusterSnapshotResponse where
  rnf :: CopyDBClusterSnapshotResponse -> ()
rnf CopyDBClusterSnapshotResponse' {Int
Maybe DBClusterSnapshot
httpStatus :: Int
dbClusterSnapshot :: Maybe DBClusterSnapshot
$sel:httpStatus:CopyDBClusterSnapshotResponse' :: CopyDBClusterSnapshotResponse -> Int
$sel:dbClusterSnapshot:CopyDBClusterSnapshotResponse' :: CopyDBClusterSnapshotResponse -> Maybe DBClusterSnapshot
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe DBClusterSnapshot
dbClusterSnapshot
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus