{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- 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 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_preSignedUrl,
    copyDBClusterSnapshot_copyTags,
    copyDBClusterSnapshot_kmsKeyId,
    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 Amazonka.DocumentDB.Types
import qualified Amazonka.Lens as Lens
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'
  { -- | The URL that contains a Signature Version 4 signed request for
    -- the@CopyDBClusterSnapshot@ API action in the Region that contains the
    -- source cluster snapshot to copy. You must use the @PreSignedUrl@
    -- parameter when copying a cluster snapshot from another 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 Region.
    --
    -- The presigned URL must be a valid request for the
    -- @CopyDBClusterSnapshot@ API action that can be executed in the source
    -- 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 Region. For
    --     example, if you are copying an encrypted cluster snapshot from the
    --     us-east-1 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,
    -- | 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 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
    -- account, then you must specify a value for @KmsKeyId@.
    --
    -- To copy an encrypted cluster snapshot to another 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 Region that they are created in, and you can\'t use
    -- encryption keys from one Region in another 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 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 Region as the copy, specify a
    --     valid snapshot identifier.
    --
    -- -   If the source snapshot is in a different 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
(CopyDBClusterSnapshot -> CopyDBClusterSnapshot -> Bool)
-> (CopyDBClusterSnapshot -> CopyDBClusterSnapshot -> Bool)
-> Eq CopyDBClusterSnapshot
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]
(Int -> ReadS CopyDBClusterSnapshot)
-> ReadS [CopyDBClusterSnapshot]
-> ReadPrec CopyDBClusterSnapshot
-> ReadPrec [CopyDBClusterSnapshot]
-> Read 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
(Int -> CopyDBClusterSnapshot -> ShowS)
-> (CopyDBClusterSnapshot -> String)
-> ([CopyDBClusterSnapshot] -> ShowS)
-> Show CopyDBClusterSnapshot
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. CopyDBClusterSnapshot -> Rep CopyDBClusterSnapshot x)
-> (forall x. Rep CopyDBClusterSnapshot x -> CopyDBClusterSnapshot)
-> Generic CopyDBClusterSnapshot
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:
--
-- 'preSignedUrl', 'copyDBClusterSnapshot_preSignedUrl' - The URL that contains a Signature Version 4 signed request for
-- the@CopyDBClusterSnapshot@ API action in the Region that contains the
-- source cluster snapshot to copy. You must use the @PreSignedUrl@
-- parameter when copying a cluster snapshot from another 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 Region.
--
-- The presigned URL must be a valid request for the
-- @CopyDBClusterSnapshot@ API action that can be executed in the source
-- 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 Region. For
--     example, if you are copying an encrypted cluster snapshot from the
--     us-east-1 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.
--
-- '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 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
-- account, then you must specify a value for @KmsKeyId@.
--
-- To copy an encrypted cluster snapshot to another 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 Region that they are created in, and you can\'t use
-- encryption keys from one Region in another Region.
--
-- If you copy an unencrypted cluster snapshot and specify a value for the
-- @KmsKeyId@ parameter, an error is returned.
--
-- '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 Region as the copy, specify a
--     valid snapshot identifier.
--
-- -   If the source snapshot is in a different 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' :: Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe [Tag]
-> Text
-> Text
-> CopyDBClusterSnapshot
CopyDBClusterSnapshot'
      { $sel:preSignedUrl:CopyDBClusterSnapshot' :: Maybe Text
preSignedUrl =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:copyTags:CopyDBClusterSnapshot' :: Maybe Bool
copyTags = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:kmsKeyId:CopyDBClusterSnapshot' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CopyDBClusterSnapshot' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:sourceDBClusterSnapshotIdentifier:CopyDBClusterSnapshot' :: Text
sourceDBClusterSnapshotIdentifier =
          Text
pSourceDBClusterSnapshotIdentifier_,
        $sel:targetDBClusterSnapshotIdentifier:CopyDBClusterSnapshot' :: Text
targetDBClusterSnapshotIdentifier =
          Text
pTargetDBClusterSnapshotIdentifier_
      }

-- | The URL that contains a Signature Version 4 signed request for
-- the@CopyDBClusterSnapshot@ API action in the Region that contains the
-- source cluster snapshot to copy. You must use the @PreSignedUrl@
-- parameter when copying a cluster snapshot from another 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 Region.
--
-- The presigned URL must be a valid request for the
-- @CopyDBClusterSnapshot@ API action that can be executed in the source
-- 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 Region. For
--     example, if you are copying an encrypted cluster snapshot from the
--     us-east-1 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 :: (Maybe Text -> f (Maybe Text))
-> CopyDBClusterSnapshot -> f CopyDBClusterSnapshot
copyDBClusterSnapshot_preSignedUrl = (CopyDBClusterSnapshot -> Maybe Text)
-> (CopyDBClusterSnapshot -> Maybe Text -> CopyDBClusterSnapshot)
-> Lens
     CopyDBClusterSnapshot
     CopyDBClusterSnapshot
     (Maybe Text)
     (Maybe Text)
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)

-- | 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 :: (Maybe Bool -> f (Maybe Bool))
-> CopyDBClusterSnapshot -> f CopyDBClusterSnapshot
copyDBClusterSnapshot_copyTags = (CopyDBClusterSnapshot -> Maybe Bool)
-> (CopyDBClusterSnapshot -> Maybe Bool -> CopyDBClusterSnapshot)
-> Lens
     CopyDBClusterSnapshot
     CopyDBClusterSnapshot
     (Maybe Bool)
     (Maybe Bool)
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 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
-- account, then you must specify a value for @KmsKeyId@.
--
-- To copy an encrypted cluster snapshot to another 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 Region that they are created in, and you can\'t use
-- encryption keys from one Region in another 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 :: (Maybe Text -> f (Maybe Text))
-> CopyDBClusterSnapshot -> f CopyDBClusterSnapshot
copyDBClusterSnapshot_kmsKeyId = (CopyDBClusterSnapshot -> Maybe Text)
-> (CopyDBClusterSnapshot -> Maybe Text -> CopyDBClusterSnapshot)
-> Lens
     CopyDBClusterSnapshot
     CopyDBClusterSnapshot
     (Maybe Text)
     (Maybe Text)
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 tags to be assigned to the cluster snapshot.
copyDBClusterSnapshot_tags :: Lens.Lens' CopyDBClusterSnapshot (Prelude.Maybe [Tag])
copyDBClusterSnapshot_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CopyDBClusterSnapshot -> f CopyDBClusterSnapshot
copyDBClusterSnapshot_tags = (CopyDBClusterSnapshot -> Maybe [Tag])
-> (CopyDBClusterSnapshot -> Maybe [Tag] -> CopyDBClusterSnapshot)
-> Lens
     CopyDBClusterSnapshot
     CopyDBClusterSnapshot
     (Maybe [Tag])
     (Maybe [Tag])
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) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CopyDBClusterSnapshot -> f CopyDBClusterSnapshot)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CopyDBClusterSnapshot
-> f CopyDBClusterSnapshot
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 AnIso [Tag] [Tag] [Tag] [Tag]
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 Region as the copy, specify a
--     valid snapshot identifier.
--
-- -   If the source snapshot is in a different Region than the copy,
--     specify a valid cluster snapshot ARN.
--
-- Example: @my-cluster-snapshot1@
copyDBClusterSnapshot_sourceDBClusterSnapshotIdentifier :: Lens.Lens' CopyDBClusterSnapshot Prelude.Text
copyDBClusterSnapshot_sourceDBClusterSnapshotIdentifier :: (Text -> f Text)
-> CopyDBClusterSnapshot -> f CopyDBClusterSnapshot
copyDBClusterSnapshot_sourceDBClusterSnapshotIdentifier = (CopyDBClusterSnapshot -> Text)
-> (CopyDBClusterSnapshot -> Text -> CopyDBClusterSnapshot)
-> Lens CopyDBClusterSnapshot CopyDBClusterSnapshot Text Text
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 :: (Text -> f Text)
-> CopyDBClusterSnapshot -> f CopyDBClusterSnapshot
copyDBClusterSnapshot_targetDBClusterSnapshotIdentifier = (CopyDBClusterSnapshot -> Text)
-> (CopyDBClusterSnapshot -> Text -> CopyDBClusterSnapshot)
-> Lens CopyDBClusterSnapshot CopyDBClusterSnapshot Text Text
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 :: CopyDBClusterSnapshot -> Request CopyDBClusterSnapshot
request = Service -> CopyDBClusterSnapshot -> Request CopyDBClusterSnapshot
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy CopyDBClusterSnapshot
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CopyDBClusterSnapshot)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse CopyDBClusterSnapshot))
-> Logger
-> Service
-> Proxy CopyDBClusterSnapshot
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CopyDBClusterSnapshot)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> 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'
            (Maybe DBClusterSnapshot -> Int -> CopyDBClusterSnapshotResponse)
-> Either String (Maybe DBClusterSnapshot)
-> Either String (Int -> CopyDBClusterSnapshotResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe DBClusterSnapshot)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DBClusterSnapshot")
            Either String (Int -> CopyDBClusterSnapshotResponse)
-> Either String Int -> Either String CopyDBClusterSnapshotResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CopyDBClusterSnapshot

instance Prelude.NFData CopyDBClusterSnapshot

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

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

instance Core.ToQuery CopyDBClusterSnapshot where
  toQuery :: CopyDBClusterSnapshot -> QueryString
toQuery CopyDBClusterSnapshot' {Maybe Bool
Maybe [Tag]
Maybe Text
Text
targetDBClusterSnapshotIdentifier :: Text
sourceDBClusterSnapshotIdentifier :: Text
tags :: Maybe [Tag]
kmsKeyId :: Maybe Text
copyTags :: Maybe Bool
preSignedUrl :: Maybe Text
$sel:targetDBClusterSnapshotIdentifier:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Text
$sel:sourceDBClusterSnapshotIdentifier:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Text
$sel:tags:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Maybe [Tag]
$sel:kmsKeyId:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Maybe Text
$sel:copyTags:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Maybe Bool
$sel:preSignedUrl:CopyDBClusterSnapshot' :: CopyDBClusterSnapshot -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"CopyDBClusterSnapshot" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"PreSignedUrl" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
preSignedUrl,
        ByteString
"CopyTags" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
copyTags,
        ByteString
"KmsKeyId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
kmsKeyId,
        ByteString
"Tags"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Tag] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"Tag" ([Tag] -> QueryString) -> Maybe [Tag] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags),
        ByteString
"SourceDBClusterSnapshotIdentifier"
          ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
sourceDBClusterSnapshotIdentifier,
        ByteString
"TargetDBClusterSnapshotIdentifier"
          ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: 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
(CopyDBClusterSnapshotResponse
 -> CopyDBClusterSnapshotResponse -> Bool)
-> (CopyDBClusterSnapshotResponse
    -> CopyDBClusterSnapshotResponse -> Bool)
-> Eq CopyDBClusterSnapshotResponse
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]
(Int -> ReadS CopyDBClusterSnapshotResponse)
-> ReadS [CopyDBClusterSnapshotResponse]
-> ReadPrec CopyDBClusterSnapshotResponse
-> ReadPrec [CopyDBClusterSnapshotResponse]
-> Read 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
(Int -> CopyDBClusterSnapshotResponse -> ShowS)
-> (CopyDBClusterSnapshotResponse -> String)
-> ([CopyDBClusterSnapshotResponse] -> ShowS)
-> Show CopyDBClusterSnapshotResponse
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.
 CopyDBClusterSnapshotResponse
 -> Rep CopyDBClusterSnapshotResponse x)
-> (forall x.
    Rep CopyDBClusterSnapshotResponse x
    -> CopyDBClusterSnapshotResponse)
-> Generic CopyDBClusterSnapshotResponse
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' :: Maybe DBClusterSnapshot -> Int -> CopyDBClusterSnapshotResponse
CopyDBClusterSnapshotResponse'
    { $sel:dbClusterSnapshot:CopyDBClusterSnapshotResponse' :: Maybe DBClusterSnapshot
dbClusterSnapshot =
        Maybe 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 :: (Maybe DBClusterSnapshot -> f (Maybe DBClusterSnapshot))
-> CopyDBClusterSnapshotResponse -> f CopyDBClusterSnapshotResponse
copyDBClusterSnapshotResponse_dbClusterSnapshot = (CopyDBClusterSnapshotResponse -> Maybe DBClusterSnapshot)
-> (CopyDBClusterSnapshotResponse
    -> Maybe DBClusterSnapshot -> CopyDBClusterSnapshotResponse)
-> Lens
     CopyDBClusterSnapshotResponse
     CopyDBClusterSnapshotResponse
     (Maybe DBClusterSnapshot)
     (Maybe 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 :: (Int -> f Int)
-> CopyDBClusterSnapshotResponse -> f CopyDBClusterSnapshotResponse
copyDBClusterSnapshotResponse_httpStatus = (CopyDBClusterSnapshotResponse -> Int)
-> (CopyDBClusterSnapshotResponse
    -> Int -> CopyDBClusterSnapshotResponse)
-> Lens
     CopyDBClusterSnapshotResponse CopyDBClusterSnapshotResponse Int Int
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