{-# 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.CreateSnapshot
(
CreateSnapshot (..),
newCreateSnapshot,
createSnapshot_cacheClusterId,
createSnapshot_kmsKeyId,
createSnapshot_replicationGroupId,
createSnapshot_tags,
createSnapshot_snapshotName,
CreateSnapshotResponse (..),
newCreateSnapshotResponse,
createSnapshotResponse_snapshot,
createSnapshotResponse_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 CreateSnapshot = CreateSnapshot'
{
CreateSnapshot -> Maybe Text
cacheClusterId :: Prelude.Maybe Prelude.Text,
CreateSnapshot -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
CreateSnapshot -> Maybe Text
replicationGroupId :: Prelude.Maybe Prelude.Text,
CreateSnapshot -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateSnapshot -> Text
snapshotName :: Prelude.Text
}
deriving (CreateSnapshot -> CreateSnapshot -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSnapshot -> CreateSnapshot -> Bool
$c/= :: CreateSnapshot -> CreateSnapshot -> Bool
== :: CreateSnapshot -> CreateSnapshot -> Bool
$c== :: CreateSnapshot -> CreateSnapshot -> Bool
Prelude.Eq, ReadPrec [CreateSnapshot]
ReadPrec CreateSnapshot
Int -> ReadS CreateSnapshot
ReadS [CreateSnapshot]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSnapshot]
$creadListPrec :: ReadPrec [CreateSnapshot]
readPrec :: ReadPrec CreateSnapshot
$creadPrec :: ReadPrec CreateSnapshot
readList :: ReadS [CreateSnapshot]
$creadList :: ReadS [CreateSnapshot]
readsPrec :: Int -> ReadS CreateSnapshot
$creadsPrec :: Int -> ReadS CreateSnapshot
Prelude.Read, Int -> CreateSnapshot -> ShowS
[CreateSnapshot] -> ShowS
CreateSnapshot -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSnapshot] -> ShowS
$cshowList :: [CreateSnapshot] -> ShowS
show :: CreateSnapshot -> String
$cshow :: CreateSnapshot -> String
showsPrec :: Int -> CreateSnapshot -> ShowS
$cshowsPrec :: Int -> CreateSnapshot -> ShowS
Prelude.Show, forall x. Rep CreateSnapshot x -> CreateSnapshot
forall x. CreateSnapshot -> Rep CreateSnapshot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateSnapshot x -> CreateSnapshot
$cfrom :: forall x. CreateSnapshot -> Rep CreateSnapshot x
Prelude.Generic)
newCreateSnapshot ::
Prelude.Text ->
CreateSnapshot
newCreateSnapshot :: Text -> CreateSnapshot
newCreateSnapshot Text
pSnapshotName_ =
CreateSnapshot'
{ $sel:cacheClusterId:CreateSnapshot' :: Maybe Text
cacheClusterId = forall a. Maybe a
Prelude.Nothing,
$sel:kmsKeyId:CreateSnapshot' :: Maybe Text
kmsKeyId = forall a. Maybe a
Prelude.Nothing,
$sel:replicationGroupId:CreateSnapshot' :: Maybe Text
replicationGroupId = forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateSnapshot' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
$sel:snapshotName:CreateSnapshot' :: Text
snapshotName = Text
pSnapshotName_
}
createSnapshot_cacheClusterId :: Lens.Lens' CreateSnapshot (Prelude.Maybe Prelude.Text)
createSnapshot_cacheClusterId :: Lens' CreateSnapshot (Maybe Text)
createSnapshot_cacheClusterId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSnapshot' {Maybe Text
cacheClusterId :: Maybe Text
$sel:cacheClusterId:CreateSnapshot' :: CreateSnapshot -> Maybe Text
cacheClusterId} -> Maybe Text
cacheClusterId) (\s :: CreateSnapshot
s@CreateSnapshot' {} Maybe Text
a -> CreateSnapshot
s {$sel:cacheClusterId:CreateSnapshot' :: Maybe Text
cacheClusterId = Maybe Text
a} :: CreateSnapshot)
createSnapshot_kmsKeyId :: Lens.Lens' CreateSnapshot (Prelude.Maybe Prelude.Text)
createSnapshot_kmsKeyId :: Lens' CreateSnapshot (Maybe Text)
createSnapshot_kmsKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSnapshot' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:CreateSnapshot' :: CreateSnapshot -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: CreateSnapshot
s@CreateSnapshot' {} Maybe Text
a -> CreateSnapshot
s {$sel:kmsKeyId:CreateSnapshot' :: Maybe Text
kmsKeyId = Maybe Text
a} :: CreateSnapshot)
createSnapshot_replicationGroupId :: Lens.Lens' CreateSnapshot (Prelude.Maybe Prelude.Text)
createSnapshot_replicationGroupId :: Lens' CreateSnapshot (Maybe Text)
createSnapshot_replicationGroupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSnapshot' {Maybe Text
replicationGroupId :: Maybe Text
$sel:replicationGroupId:CreateSnapshot' :: CreateSnapshot -> Maybe Text
replicationGroupId} -> Maybe Text
replicationGroupId) (\s :: CreateSnapshot
s@CreateSnapshot' {} Maybe Text
a -> CreateSnapshot
s {$sel:replicationGroupId:CreateSnapshot' :: Maybe Text
replicationGroupId = Maybe Text
a} :: CreateSnapshot)
createSnapshot_tags :: Lens.Lens' CreateSnapshot (Prelude.Maybe [Tag])
createSnapshot_tags :: Lens' CreateSnapshot (Maybe [Tag])
createSnapshot_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSnapshot' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateSnapshot' :: CreateSnapshot -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateSnapshot
s@CreateSnapshot' {} Maybe [Tag]
a -> CreateSnapshot
s {$sel:tags:CreateSnapshot' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateSnapshot) 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
createSnapshot_snapshotName :: Lens.Lens' CreateSnapshot Prelude.Text
createSnapshot_snapshotName :: Lens' CreateSnapshot Text
createSnapshot_snapshotName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSnapshot' {Text
snapshotName :: Text
$sel:snapshotName:CreateSnapshot' :: CreateSnapshot -> Text
snapshotName} -> Text
snapshotName) (\s :: CreateSnapshot
s@CreateSnapshot' {} Text
a -> CreateSnapshot
s {$sel:snapshotName:CreateSnapshot' :: Text
snapshotName = Text
a} :: CreateSnapshot)
instance Core.AWSRequest CreateSnapshot where
type
AWSResponse CreateSnapshot =
CreateSnapshotResponse
request :: (Service -> Service) -> CreateSnapshot -> Request CreateSnapshot
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 CreateSnapshot
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateSnapshot)))
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
"CreateSnapshotResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Snapshot -> Int -> CreateSnapshotResponse
CreateSnapshotResponse'
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 CreateSnapshot where
hashWithSalt :: Int -> CreateSnapshot -> Int
hashWithSalt Int
_salt CreateSnapshot' {Maybe [Tag]
Maybe Text
Text
snapshotName :: Text
tags :: Maybe [Tag]
replicationGroupId :: Maybe Text
kmsKeyId :: Maybe Text
cacheClusterId :: Maybe Text
$sel:snapshotName:CreateSnapshot' :: CreateSnapshot -> Text
$sel:tags:CreateSnapshot' :: CreateSnapshot -> Maybe [Tag]
$sel:replicationGroupId:CreateSnapshot' :: CreateSnapshot -> Maybe Text
$sel:kmsKeyId:CreateSnapshot' :: CreateSnapshot -> Maybe Text
$sel:cacheClusterId:CreateSnapshot' :: CreateSnapshot -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cacheClusterId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
kmsKeyId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
replicationGroupId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
snapshotName
instance Prelude.NFData CreateSnapshot where
rnf :: CreateSnapshot -> ()
rnf CreateSnapshot' {Maybe [Tag]
Maybe Text
Text
snapshotName :: Text
tags :: Maybe [Tag]
replicationGroupId :: Maybe Text
kmsKeyId :: Maybe Text
cacheClusterId :: Maybe Text
$sel:snapshotName:CreateSnapshot' :: CreateSnapshot -> Text
$sel:tags:CreateSnapshot' :: CreateSnapshot -> Maybe [Tag]
$sel:replicationGroupId:CreateSnapshot' :: CreateSnapshot -> Maybe Text
$sel:kmsKeyId:CreateSnapshot' :: CreateSnapshot -> Maybe Text
$sel:cacheClusterId:CreateSnapshot' :: CreateSnapshot -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cacheClusterId
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
replicationGroupId
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
snapshotName
instance Data.ToHeaders CreateSnapshot where
toHeaders :: CreateSnapshot -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath CreateSnapshot where
toPath :: CreateSnapshot -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateSnapshot where
toQuery :: CreateSnapshot -> QueryString
toQuery CreateSnapshot' {Maybe [Tag]
Maybe Text
Text
snapshotName :: Text
tags :: Maybe [Tag]
replicationGroupId :: Maybe Text
kmsKeyId :: Maybe Text
cacheClusterId :: Maybe Text
$sel:snapshotName:CreateSnapshot' :: CreateSnapshot -> Text
$sel:tags:CreateSnapshot' :: CreateSnapshot -> Maybe [Tag]
$sel:replicationGroupId:CreateSnapshot' :: CreateSnapshot -> Maybe Text
$sel:kmsKeyId:CreateSnapshot' :: CreateSnapshot -> Maybe Text
$sel:cacheClusterId:CreateSnapshot' :: CreateSnapshot -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"CreateSnapshot" :: Prelude.ByteString),
ByteString
"Version"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2015-02-02" :: Prelude.ByteString),
ByteString
"CacheClusterId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
cacheClusterId,
ByteString
"KmsKeyId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
kmsKeyId,
ByteString
"ReplicationGroupId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
replicationGroupId,
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
"SnapshotName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
snapshotName
]
data CreateSnapshotResponse = CreateSnapshotResponse'
{ CreateSnapshotResponse -> Maybe Snapshot
snapshot :: Prelude.Maybe Snapshot,
CreateSnapshotResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateSnapshotResponse -> CreateSnapshotResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSnapshotResponse -> CreateSnapshotResponse -> Bool
$c/= :: CreateSnapshotResponse -> CreateSnapshotResponse -> Bool
== :: CreateSnapshotResponse -> CreateSnapshotResponse -> Bool
$c== :: CreateSnapshotResponse -> CreateSnapshotResponse -> Bool
Prelude.Eq, ReadPrec [CreateSnapshotResponse]
ReadPrec CreateSnapshotResponse
Int -> ReadS CreateSnapshotResponse
ReadS [CreateSnapshotResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSnapshotResponse]
$creadListPrec :: ReadPrec [CreateSnapshotResponse]
readPrec :: ReadPrec CreateSnapshotResponse
$creadPrec :: ReadPrec CreateSnapshotResponse
readList :: ReadS [CreateSnapshotResponse]
$creadList :: ReadS [CreateSnapshotResponse]
readsPrec :: Int -> ReadS CreateSnapshotResponse
$creadsPrec :: Int -> ReadS CreateSnapshotResponse
Prelude.Read, Int -> CreateSnapshotResponse -> ShowS
[CreateSnapshotResponse] -> ShowS
CreateSnapshotResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSnapshotResponse] -> ShowS
$cshowList :: [CreateSnapshotResponse] -> ShowS
show :: CreateSnapshotResponse -> String
$cshow :: CreateSnapshotResponse -> String
showsPrec :: Int -> CreateSnapshotResponse -> ShowS
$cshowsPrec :: Int -> CreateSnapshotResponse -> ShowS
Prelude.Show, forall x. Rep CreateSnapshotResponse x -> CreateSnapshotResponse
forall x. CreateSnapshotResponse -> Rep CreateSnapshotResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateSnapshotResponse x -> CreateSnapshotResponse
$cfrom :: forall x. CreateSnapshotResponse -> Rep CreateSnapshotResponse x
Prelude.Generic)
newCreateSnapshotResponse ::
Prelude.Int ->
CreateSnapshotResponse
newCreateSnapshotResponse :: Int -> CreateSnapshotResponse
newCreateSnapshotResponse Int
pHttpStatus_ =
CreateSnapshotResponse'
{ $sel:snapshot:CreateSnapshotResponse' :: Maybe Snapshot
snapshot = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateSnapshotResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createSnapshotResponse_snapshot :: Lens.Lens' CreateSnapshotResponse (Prelude.Maybe Snapshot)
createSnapshotResponse_snapshot :: Lens' CreateSnapshotResponse (Maybe Snapshot)
createSnapshotResponse_snapshot = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSnapshotResponse' {Maybe Snapshot
snapshot :: Maybe Snapshot
$sel:snapshot:CreateSnapshotResponse' :: CreateSnapshotResponse -> Maybe Snapshot
snapshot} -> Maybe Snapshot
snapshot) (\s :: CreateSnapshotResponse
s@CreateSnapshotResponse' {} Maybe Snapshot
a -> CreateSnapshotResponse
s {$sel:snapshot:CreateSnapshotResponse' :: Maybe Snapshot
snapshot = Maybe Snapshot
a} :: CreateSnapshotResponse)
createSnapshotResponse_httpStatus :: Lens.Lens' CreateSnapshotResponse Prelude.Int
createSnapshotResponse_httpStatus :: Lens' CreateSnapshotResponse Int
createSnapshotResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSnapshotResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateSnapshotResponse' :: CreateSnapshotResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateSnapshotResponse
s@CreateSnapshotResponse' {} Int
a -> CreateSnapshotResponse
s {$sel:httpStatus:CreateSnapshotResponse' :: Int
httpStatus = Int
a} :: CreateSnapshotResponse)
instance Prelude.NFData CreateSnapshotResponse where
rnf :: CreateSnapshotResponse -> ()
rnf CreateSnapshotResponse' {Int
Maybe Snapshot
httpStatus :: Int
snapshot :: Maybe Snapshot
$sel:httpStatus:CreateSnapshotResponse' :: CreateSnapshotResponse -> Int
$sel:snapshot:CreateSnapshotResponse' :: CreateSnapshotResponse -> 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