{-# 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 #-}
module Amazonka.ElastiCache.CopySnapshot
(
CopySnapshot (..),
newCopySnapshot,
copySnapshot_kmsKeyId,
copySnapshot_tags,
copySnapshot_targetBucket,
copySnapshot_sourceSnapshotName,
copySnapshot_targetSnapshotName,
CopySnapshotResponse (..),
newCopySnapshotResponse,
copySnapshotResponse_snapshot,
copySnapshotResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ElastiCache.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CopySnapshot = CopySnapshot'
{
CopySnapshot -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
CopySnapshot -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CopySnapshot -> Maybe Text
targetBucket :: Prelude.Maybe Prelude.Text,
CopySnapshot -> Text
sourceSnapshotName :: Prelude.Text,
CopySnapshot -> Text
targetSnapshotName :: Prelude.Text
}
deriving (CopySnapshot -> CopySnapshot -> Bool
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]
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
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. 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)
newCopySnapshot ::
Prelude.Text ->
Prelude.Text ->
CopySnapshot
newCopySnapshot :: Text -> Text -> CopySnapshot
newCopySnapshot
Text
pSourceSnapshotName_
Text
pTargetSnapshotName_ =
CopySnapshot'
{ $sel:kmsKeyId:CopySnapshot' :: Maybe Text
kmsKeyId = forall a. Maybe a
Prelude.Nothing,
$sel:tags:CopySnapshot' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
$sel:targetBucket:CopySnapshot' :: Maybe Text
targetBucket = forall a. Maybe a
Prelude.Nothing,
$sel:sourceSnapshotName:CopySnapshot' :: Text
sourceSnapshotName = Text
pSourceSnapshotName_,
$sel:targetSnapshotName:CopySnapshot' :: Text
targetSnapshotName = Text
pTargetSnapshotName_
}
copySnapshot_kmsKeyId :: Lens.Lens' CopySnapshot (Prelude.Maybe Prelude.Text)
copySnapshot_kmsKeyId :: Lens' CopySnapshot (Maybe Text)
copySnapshot_kmsKeyId = 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)
copySnapshot_tags :: Lens.Lens' CopySnapshot (Prelude.Maybe [Tag])
copySnapshot_tags :: Lens' CopySnapshot (Maybe [Tag])
copySnapshot_tags = 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) 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
copySnapshot_targetBucket :: Lens.Lens' CopySnapshot (Prelude.Maybe Prelude.Text)
copySnapshot_targetBucket :: Lens' CopySnapshot (Maybe Text)
copySnapshot_targetBucket = 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)
copySnapshot_sourceSnapshotName :: Lens.Lens' CopySnapshot Prelude.Text
copySnapshot_sourceSnapshotName :: Lens' CopySnapshot Text
copySnapshot_sourceSnapshotName = 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)
copySnapshot_targetSnapshotName :: Lens.Lens' CopySnapshot Prelude.Text
copySnapshot_targetSnapshotName :: Lens' CopySnapshot Text
copySnapshot_targetSnapshotName = 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 :: (Service -> Service) -> CopySnapshot -> Request CopySnapshot
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 CopySnapshot
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CopySnapshot)))
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
"CopySnapshotResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Snapshot -> Int -> CopySnapshotResponse
CopySnapshotResponse'
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
"Snapshot")
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 CopySnapshot where
hashWithSalt :: Int -> CopySnapshot -> Int
hashWithSalt Int
_salt CopySnapshot' {Maybe [Tag]
Maybe Text
Text
targetSnapshotName :: Text
sourceSnapshotName :: Text
targetBucket :: Maybe Text
tags :: Maybe [Tag]
kmsKeyId :: Maybe Text
$sel:targetSnapshotName:CopySnapshot' :: CopySnapshot -> Text
$sel:sourceSnapshotName:CopySnapshot' :: CopySnapshot -> Text
$sel:targetBucket:CopySnapshot' :: CopySnapshot -> Maybe Text
$sel:tags:CopySnapshot' :: CopySnapshot -> Maybe [Tag]
$sel:kmsKeyId:CopySnapshot' :: CopySnapshot -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
kmsKeyId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
targetBucket
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sourceSnapshotName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
targetSnapshotName
instance Prelude.NFData CopySnapshot where
rnf :: CopySnapshot -> ()
rnf CopySnapshot' {Maybe [Tag]
Maybe Text
Text
targetSnapshotName :: Text
sourceSnapshotName :: Text
targetBucket :: Maybe Text
tags :: Maybe [Tag]
kmsKeyId :: Maybe Text
$sel:targetSnapshotName:CopySnapshot' :: CopySnapshot -> Text
$sel:sourceSnapshotName:CopySnapshot' :: CopySnapshot -> Text
$sel:targetBucket:CopySnapshot' :: CopySnapshot -> Maybe Text
$sel:tags:CopySnapshot' :: CopySnapshot -> Maybe [Tag]
$sel:kmsKeyId:CopySnapshot' :: CopySnapshot -> Maybe Text
..} =
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 [Tag]
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
targetBucket
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
sourceSnapshotName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
targetSnapshotName
instance Data.ToHeaders CopySnapshot where
toHeaders :: CopySnapshot -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath CopySnapshot where
toPath :: CopySnapshot -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CopySnapshot where
toQuery :: CopySnapshot -> QueryString
toQuery CopySnapshot' {Maybe [Tag]
Maybe Text
Text
targetSnapshotName :: Text
sourceSnapshotName :: Text
targetBucket :: Maybe Text
tags :: Maybe [Tag]
kmsKeyId :: Maybe Text
$sel:targetSnapshotName:CopySnapshot' :: CopySnapshot -> Text
$sel:sourceSnapshotName:CopySnapshot' :: CopySnapshot -> Text
$sel:targetBucket:CopySnapshot' :: CopySnapshot -> Maybe Text
$sel:tags:CopySnapshot' :: CopySnapshot -> Maybe [Tag]
$sel:kmsKeyId:CopySnapshot' :: CopySnapshot -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"CopySnapshot" :: Prelude.ByteString),
ByteString
"Version"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2015-02-02" :: Prelude.ByteString),
ByteString
"KmsKeyId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
kmsKeyId,
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
"TargetBucket" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
targetBucket,
ByteString
"SourceSnapshotName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
sourceSnapshotName,
ByteString
"TargetSnapshotName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
targetSnapshotName
]
data CopySnapshotResponse = CopySnapshotResponse'
{ CopySnapshotResponse -> Maybe Snapshot
snapshot :: Prelude.Maybe Snapshot,
CopySnapshotResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CopySnapshotResponse -> CopySnapshotResponse -> Bool
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]
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
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. 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)
newCopySnapshotResponse ::
Prelude.Int ->
CopySnapshotResponse
newCopySnapshotResponse :: Int -> CopySnapshotResponse
newCopySnapshotResponse Int
pHttpStatus_ =
CopySnapshotResponse'
{ $sel:snapshot:CopySnapshotResponse' :: Maybe Snapshot
snapshot = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CopySnapshotResponse' :: Int
httpStatus = Int
pHttpStatus_
}
copySnapshotResponse_snapshot :: Lens.Lens' CopySnapshotResponse (Prelude.Maybe Snapshot)
copySnapshotResponse_snapshot :: Lens' CopySnapshotResponse (Maybe Snapshot)
copySnapshotResponse_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)
copySnapshotResponse_httpStatus :: Lens.Lens' CopySnapshotResponse Prelude.Int
copySnapshotResponse_httpStatus :: Lens' CopySnapshotResponse Int
copySnapshotResponse_httpStatus = 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 where
rnf :: CopySnapshotResponse -> ()
rnf CopySnapshotResponse' {Int
Maybe Snapshot
httpStatus :: Int
snapshot :: Maybe Snapshot
$sel:httpStatus:CopySnapshotResponse' :: CopySnapshotResponse -> Int
$sel:snapshot:CopySnapshotResponse' :: CopySnapshotResponse -> Maybe Snapshot
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Snapshot
snapshot
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus