{-# 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.ElastiCache.CopySnapshot
-- 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)
--
-- Makes a copy of an existing snapshot.
--
-- This operation is valid for Redis only.
--
-- Users or groups that have permissions to use the @CopySnapshot@
-- operation can create their own Amazon S3 buckets and copy snapshots to
-- it. To control access to your snapshots, use an IAM policy to control
-- who has the ability to use the @CopySnapshot@ operation. For more
-- information about using IAM to control the use of ElastiCache
-- operations, see
-- <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/backups-exporting.html Exporting Snapshots>
-- and
-- <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/IAM.html Authentication & Access Control>.
--
-- You could receive the following error messages.
--
-- __Error Messages__
--
-- -   __Error Message:__ The S3 bucket %s is outside of the region.
--
--     __Solution:__ Create an Amazon S3 bucket in the same region as your
--     snapshot. For more information, see
--     <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/backups-exporting.html#backups-exporting-create-s3-bucket Step 1: Create an Amazon S3 Bucket>
--     in the ElastiCache User Guide.
--
-- -   __Error Message:__ The S3 bucket %s does not exist.
--
--     __Solution:__ Create an Amazon S3 bucket in the same region as your
--     snapshot. For more information, see
--     <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/backups-exporting.html#backups-exporting-create-s3-bucket Step 1: Create an Amazon S3 Bucket>
--     in the ElastiCache User Guide.
--
-- -   __Error Message:__ The S3 bucket %s is not owned by the
--     authenticated user.
--
--     __Solution:__ Create an Amazon S3 bucket in the same region as your
--     snapshot. For more information, see
--     <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/backups-exporting.html#backups-exporting-create-s3-bucket Step 1: Create an Amazon S3 Bucket>
--     in the ElastiCache User Guide.
--
-- -   __Error Message:__ The authenticated user does not have sufficient
--     permissions to perform the desired activity.
--
--     __Solution:__ Contact your system administrator to get the needed
--     permissions.
--
-- -   __Error Message:__ The S3 bucket %s already contains an object with
--     key %s.
--
--     __Solution:__ Give the @TargetSnapshotName@ a new and unique value.
--     If exporting a snapshot, you could alternatively create a new Amazon
--     S3 bucket and use this same value for @TargetSnapshotName@.
--
-- -   __Error Message:__ ElastiCache has not been granted READ permissions
--     %s on the S3 Bucket.
--
--     __Solution:__ Add List and Read permissions on the bucket. For more
--     information, see
--     <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/backups-exporting.html#backups-exporting-grant-access Step 2: Grant ElastiCache Access to Your Amazon S3 Bucket>
--     in the ElastiCache User Guide.
--
-- -   __Error Message:__ ElastiCache has not been granted WRITE
--     permissions %s on the S3 Bucket.
--
--     __Solution:__ Add Upload\/Delete permissions on the bucket. For more
--     information, see
--     <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/backups-exporting.html#backups-exporting-grant-access Step 2: Grant ElastiCache Access to Your Amazon S3 Bucket>
--     in the ElastiCache User Guide.
--
-- -   __Error Message:__ ElastiCache has not been granted READ_ACP
--     permissions %s on the S3 Bucket.
--
--     __Solution:__ Add View Permissions on the bucket. For more
--     information, see
--     <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/backups-exporting.html#backups-exporting-grant-access Step 2: Grant ElastiCache Access to Your Amazon S3 Bucket>
--     in the ElastiCache User Guide.
module Amazonka.ElastiCache.CopySnapshot
  ( -- * Creating a Request
    CopySnapshot (..),
    newCopySnapshot,

    -- * Request Lenses
    copySnapshot_targetBucket,
    copySnapshot_kmsKeyId,
    copySnapshot_tags,
    copySnapshot_sourceSnapshotName,
    copySnapshot_targetSnapshotName,

    -- * Destructuring the Response
    CopySnapshotResponse (..),
    newCopySnapshotResponse,

    -- * Response Lenses
    copySnapshotResponse_snapshot,
    copySnapshotResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ElastiCache.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 of a @CopySnapshotMessage@ operation.
--
-- /See:/ 'newCopySnapshot' smart constructor.
data CopySnapshot = CopySnapshot'
  { -- | The Amazon S3 bucket to which the snapshot is exported. This parameter
    -- is used only when exporting a snapshot for external access.
    --
    -- When using this parameter to export a snapshot, be sure Amazon
    -- ElastiCache has the needed permissions to this S3 bucket. For more
    -- information, see
    -- <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/backups-exporting.html#backups-exporting-grant-access Step 2: Grant ElastiCache Access to Your Amazon S3 Bucket>
    -- in the /Amazon ElastiCache User Guide/.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/backups-exporting.html Exporting a Snapshot>
    -- in the /Amazon ElastiCache User Guide/.
    CopySnapshot -> Maybe Text
targetBucket :: Prelude.Maybe Prelude.Text,
    -- | The ID of the KMS key used to encrypt the target snapshot.
    CopySnapshot -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | A list of tags to be added to this resource. A tag is a key-value pair.
    -- A tag key must be accompanied by a tag value, although null is accepted.
    CopySnapshot -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The name of an existing snapshot from which to make a copy.
    CopySnapshot -> Text
sourceSnapshotName :: Prelude.Text,
    -- | A name for the snapshot copy. ElastiCache does not permit overwriting a
    -- snapshot, therefore this name must be unique within its context -
    -- ElastiCache or an Amazon S3 bucket if exporting.
    CopySnapshot -> Text
targetSnapshotName :: Prelude.Text
  }
  deriving (CopySnapshot -> CopySnapshot -> Bool
(CopySnapshot -> CopySnapshot -> Bool)
-> (CopySnapshot -> CopySnapshot -> Bool) -> Eq CopySnapshot
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CopySnapshot -> CopySnapshot -> Bool
$c/= :: CopySnapshot -> CopySnapshot -> Bool
== :: CopySnapshot -> CopySnapshot -> Bool
$c== :: CopySnapshot -> CopySnapshot -> Bool
Prelude.Eq, ReadPrec [CopySnapshot]
ReadPrec CopySnapshot
Int -> ReadS CopySnapshot
ReadS [CopySnapshot]
(Int -> ReadS CopySnapshot)
-> ReadS [CopySnapshot]
-> ReadPrec CopySnapshot
-> ReadPrec [CopySnapshot]
-> Read CopySnapshot
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CopySnapshot]
$creadListPrec :: ReadPrec [CopySnapshot]
readPrec :: ReadPrec CopySnapshot
$creadPrec :: ReadPrec CopySnapshot
readList :: ReadS [CopySnapshot]
$creadList :: ReadS [CopySnapshot]
readsPrec :: Int -> ReadS CopySnapshot
$creadsPrec :: Int -> ReadS CopySnapshot
Prelude.Read, Int -> CopySnapshot -> ShowS
[CopySnapshot] -> ShowS
CopySnapshot -> String
(Int -> CopySnapshot -> ShowS)
-> (CopySnapshot -> String)
-> ([CopySnapshot] -> ShowS)
-> Show CopySnapshot
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CopySnapshot] -> ShowS
$cshowList :: [CopySnapshot] -> ShowS
show :: CopySnapshot -> String
$cshow :: CopySnapshot -> String
showsPrec :: Int -> CopySnapshot -> ShowS
$cshowsPrec :: Int -> CopySnapshot -> ShowS
Prelude.Show, (forall x. CopySnapshot -> Rep CopySnapshot x)
-> (forall x. Rep CopySnapshot x -> CopySnapshot)
-> Generic CopySnapshot
forall x. Rep CopySnapshot x -> CopySnapshot
forall x. CopySnapshot -> Rep CopySnapshot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CopySnapshot x -> CopySnapshot
$cfrom :: forall x. CopySnapshot -> Rep CopySnapshot x
Prelude.Generic)

-- |
-- Create a value of 'CopySnapshot' 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:
--
-- 'targetBucket', 'copySnapshot_targetBucket' - The Amazon S3 bucket to which the snapshot is exported. This parameter
-- is used only when exporting a snapshot for external access.
--
-- When using this parameter to export a snapshot, be sure Amazon
-- ElastiCache has the needed permissions to this S3 bucket. For more
-- information, see
-- <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/backups-exporting.html#backups-exporting-grant-access Step 2: Grant ElastiCache Access to Your Amazon S3 Bucket>
-- in the /Amazon ElastiCache User Guide/.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/backups-exporting.html Exporting a Snapshot>
-- in the /Amazon ElastiCache User Guide/.
--
-- 'kmsKeyId', 'copySnapshot_kmsKeyId' - The ID of the KMS key used to encrypt the target snapshot.
--
-- 'tags', 'copySnapshot_tags' - A list of tags to be added to this resource. A tag is a key-value pair.
-- A tag key must be accompanied by a tag value, although null is accepted.
--
-- 'sourceSnapshotName', 'copySnapshot_sourceSnapshotName' - The name of an existing snapshot from which to make a copy.
--
-- 'targetSnapshotName', 'copySnapshot_targetSnapshotName' - A name for the snapshot copy. ElastiCache does not permit overwriting a
-- snapshot, therefore this name must be unique within its context -
-- ElastiCache or an Amazon S3 bucket if exporting.
newCopySnapshot ::
  -- | 'sourceSnapshotName'
  Prelude.Text ->
  -- | 'targetSnapshotName'
  Prelude.Text ->
  CopySnapshot
newCopySnapshot :: Text -> Text -> CopySnapshot
newCopySnapshot
  Text
pSourceSnapshotName_
  Text
pTargetSnapshotName_ =
    CopySnapshot' :: Maybe Text
-> Maybe Text -> Maybe [Tag] -> Text -> Text -> CopySnapshot
CopySnapshot'
      { $sel:targetBucket:CopySnapshot' :: Maybe Text
targetBucket = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:kmsKeyId:CopySnapshot' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CopySnapshot' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:sourceSnapshotName:CopySnapshot' :: Text
sourceSnapshotName = Text
pSourceSnapshotName_,
        $sel:targetSnapshotName:CopySnapshot' :: Text
targetSnapshotName = Text
pTargetSnapshotName_
      }

-- | The Amazon S3 bucket to which the snapshot is exported. This parameter
-- is used only when exporting a snapshot for external access.
--
-- When using this parameter to export a snapshot, be sure Amazon
-- ElastiCache has the needed permissions to this S3 bucket. For more
-- information, see
-- <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/backups-exporting.html#backups-exporting-grant-access Step 2: Grant ElastiCache Access to Your Amazon S3 Bucket>
-- in the /Amazon ElastiCache User Guide/.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/backups-exporting.html Exporting a Snapshot>
-- in the /Amazon ElastiCache User Guide/.
copySnapshot_targetBucket :: Lens.Lens' CopySnapshot (Prelude.Maybe Prelude.Text)
copySnapshot_targetBucket :: (Maybe Text -> f (Maybe Text)) -> CopySnapshot -> f CopySnapshot
copySnapshot_targetBucket = (CopySnapshot -> Maybe Text)
-> (CopySnapshot -> Maybe Text -> CopySnapshot)
-> Lens CopySnapshot CopySnapshot (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopySnapshot' {Maybe Text
targetBucket :: Maybe Text
$sel:targetBucket:CopySnapshot' :: CopySnapshot -> Maybe Text
targetBucket} -> Maybe Text
targetBucket) (\s :: CopySnapshot
s@CopySnapshot' {} Maybe Text
a -> CopySnapshot
s {$sel:targetBucket:CopySnapshot' :: Maybe Text
targetBucket = Maybe Text
a} :: CopySnapshot)

-- | The ID of the KMS key used to encrypt the target snapshot.
copySnapshot_kmsKeyId :: Lens.Lens' CopySnapshot (Prelude.Maybe Prelude.Text)
copySnapshot_kmsKeyId :: (Maybe Text -> f (Maybe Text)) -> CopySnapshot -> f CopySnapshot
copySnapshot_kmsKeyId = (CopySnapshot -> Maybe Text)
-> (CopySnapshot -> Maybe Text -> CopySnapshot)
-> Lens CopySnapshot CopySnapshot (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopySnapshot' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:CopySnapshot' :: CopySnapshot -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: CopySnapshot
s@CopySnapshot' {} Maybe Text
a -> CopySnapshot
s {$sel:kmsKeyId:CopySnapshot' :: Maybe Text
kmsKeyId = Maybe Text
a} :: CopySnapshot)

-- | A list of tags to be added to this resource. A tag is a key-value pair.
-- A tag key must be accompanied by a tag value, although null is accepted.
copySnapshot_tags :: Lens.Lens' CopySnapshot (Prelude.Maybe [Tag])
copySnapshot_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> CopySnapshot -> f CopySnapshot
copySnapshot_tags = (CopySnapshot -> Maybe [Tag])
-> (CopySnapshot -> Maybe [Tag] -> CopySnapshot)
-> Lens CopySnapshot CopySnapshot (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopySnapshot' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CopySnapshot' :: CopySnapshot -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CopySnapshot
s@CopySnapshot' {} Maybe [Tag]
a -> CopySnapshot
s {$sel:tags:CopySnapshot' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CopySnapshot) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CopySnapshot -> f CopySnapshot)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CopySnapshot
-> f CopySnapshot
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 name of an existing snapshot from which to make a copy.
copySnapshot_sourceSnapshotName :: Lens.Lens' CopySnapshot Prelude.Text
copySnapshot_sourceSnapshotName :: (Text -> f Text) -> CopySnapshot -> f CopySnapshot
copySnapshot_sourceSnapshotName = (CopySnapshot -> Text)
-> (CopySnapshot -> Text -> CopySnapshot)
-> Lens CopySnapshot CopySnapshot Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopySnapshot' {Text
sourceSnapshotName :: Text
$sel:sourceSnapshotName:CopySnapshot' :: CopySnapshot -> Text
sourceSnapshotName} -> Text
sourceSnapshotName) (\s :: CopySnapshot
s@CopySnapshot' {} Text
a -> CopySnapshot
s {$sel:sourceSnapshotName:CopySnapshot' :: Text
sourceSnapshotName = Text
a} :: CopySnapshot)

-- | A name for the snapshot copy. ElastiCache does not permit overwriting a
-- snapshot, therefore this name must be unique within its context -
-- ElastiCache or an Amazon S3 bucket if exporting.
copySnapshot_targetSnapshotName :: Lens.Lens' CopySnapshot Prelude.Text
copySnapshot_targetSnapshotName :: (Text -> f Text) -> CopySnapshot -> f CopySnapshot
copySnapshot_targetSnapshotName = (CopySnapshot -> Text)
-> (CopySnapshot -> Text -> CopySnapshot)
-> Lens CopySnapshot CopySnapshot Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopySnapshot' {Text
targetSnapshotName :: Text
$sel:targetSnapshotName:CopySnapshot' :: CopySnapshot -> Text
targetSnapshotName} -> Text
targetSnapshotName) (\s :: CopySnapshot
s@CopySnapshot' {} Text
a -> CopySnapshot
s {$sel:targetSnapshotName:CopySnapshot' :: Text
targetSnapshotName = Text
a} :: CopySnapshot)

instance Core.AWSRequest CopySnapshot where
  type AWSResponse CopySnapshot = CopySnapshotResponse
  request :: CopySnapshot -> Request CopySnapshot
request = Service -> CopySnapshot -> Request CopySnapshot
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy CopySnapshot
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CopySnapshot)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse CopySnapshot))
-> Logger
-> Service
-> Proxy CopySnapshot
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CopySnapshot)))
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
"CopySnapshotResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Snapshot -> Int -> CopySnapshotResponse
CopySnapshotResponse'
            (Maybe Snapshot -> Int -> CopySnapshotResponse)
-> Either String (Maybe Snapshot)
-> Either String (Int -> CopySnapshotResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Snapshot)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Snapshot")
            Either String (Int -> CopySnapshotResponse)
-> Either String Int -> Either String CopySnapshotResponse
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 CopySnapshot

instance Prelude.NFData CopySnapshot

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

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

instance Core.ToQuery CopySnapshot where
  toQuery :: CopySnapshot -> QueryString
toQuery CopySnapshot' {Maybe [Tag]
Maybe Text
Text
targetSnapshotName :: Text
sourceSnapshotName :: Text
tags :: Maybe [Tag]
kmsKeyId :: Maybe Text
targetBucket :: Maybe Text
$sel:targetSnapshotName:CopySnapshot' :: CopySnapshot -> Text
$sel:sourceSnapshotName:CopySnapshot' :: CopySnapshot -> Text
$sel:tags:CopySnapshot' :: CopySnapshot -> Maybe [Tag]
$sel:kmsKeyId:CopySnapshot' :: CopySnapshot -> Maybe Text
$sel:targetBucket:CopySnapshot' :: CopySnapshot -> 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
"CopySnapshot" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-02-02" :: Prelude.ByteString),
        ByteString
"TargetBucket" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
targetBucket,
        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
"SourceSnapshotName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
sourceSnapshotName,
        ByteString
"TargetSnapshotName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
targetSnapshotName
      ]

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

-- |
-- Create a value of 'CopySnapshotResponse' 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:
--
-- 'snapshot', 'copySnapshotResponse_snapshot' - Undocumented member.
--
-- 'httpStatus', 'copySnapshotResponse_httpStatus' - The response's http status code.
newCopySnapshotResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CopySnapshotResponse
newCopySnapshotResponse :: Int -> CopySnapshotResponse
newCopySnapshotResponse Int
pHttpStatus_ =
  CopySnapshotResponse' :: Maybe Snapshot -> Int -> CopySnapshotResponse
CopySnapshotResponse'
    { $sel:snapshot:CopySnapshotResponse' :: Maybe Snapshot
snapshot = Maybe Snapshot
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CopySnapshotResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
copySnapshotResponse_snapshot :: Lens.Lens' CopySnapshotResponse (Prelude.Maybe Snapshot)
copySnapshotResponse_snapshot :: (Maybe Snapshot -> f (Maybe Snapshot))
-> CopySnapshotResponse -> f CopySnapshotResponse
copySnapshotResponse_snapshot = (CopySnapshotResponse -> Maybe Snapshot)
-> (CopySnapshotResponse -> Maybe Snapshot -> CopySnapshotResponse)
-> Lens
     CopySnapshotResponse
     CopySnapshotResponse
     (Maybe Snapshot)
     (Maybe Snapshot)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopySnapshotResponse' {Maybe Snapshot
snapshot :: Maybe Snapshot
$sel:snapshot:CopySnapshotResponse' :: CopySnapshotResponse -> Maybe Snapshot
snapshot} -> Maybe Snapshot
snapshot) (\s :: CopySnapshotResponse
s@CopySnapshotResponse' {} Maybe Snapshot
a -> CopySnapshotResponse
s {$sel:snapshot:CopySnapshotResponse' :: Maybe Snapshot
snapshot = Maybe Snapshot
a} :: CopySnapshotResponse)

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

instance Prelude.NFData CopySnapshotResponse