{-# 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.RDS.CreateDBSnapshot
(
CreateDBSnapshot (..),
newCreateDBSnapshot,
createDBSnapshot_tags,
createDBSnapshot_dbSnapshotIdentifier,
createDBSnapshot_dbInstanceIdentifier,
CreateDBSnapshotResponse (..),
newCreateDBSnapshotResponse,
createDBSnapshotResponse_dbSnapshot,
createDBSnapshotResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.RDS.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateDBSnapshot = CreateDBSnapshot'
{ CreateDBSnapshot -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateDBSnapshot -> Text
dbSnapshotIdentifier :: Prelude.Text,
CreateDBSnapshot -> Text
dbInstanceIdentifier :: Prelude.Text
}
deriving (CreateDBSnapshot -> CreateDBSnapshot -> Bool
(CreateDBSnapshot -> CreateDBSnapshot -> Bool)
-> (CreateDBSnapshot -> CreateDBSnapshot -> Bool)
-> Eq CreateDBSnapshot
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDBSnapshot -> CreateDBSnapshot -> Bool
$c/= :: CreateDBSnapshot -> CreateDBSnapshot -> Bool
== :: CreateDBSnapshot -> CreateDBSnapshot -> Bool
$c== :: CreateDBSnapshot -> CreateDBSnapshot -> Bool
Prelude.Eq, ReadPrec [CreateDBSnapshot]
ReadPrec CreateDBSnapshot
Int -> ReadS CreateDBSnapshot
ReadS [CreateDBSnapshot]
(Int -> ReadS CreateDBSnapshot)
-> ReadS [CreateDBSnapshot]
-> ReadPrec CreateDBSnapshot
-> ReadPrec [CreateDBSnapshot]
-> Read CreateDBSnapshot
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDBSnapshot]
$creadListPrec :: ReadPrec [CreateDBSnapshot]
readPrec :: ReadPrec CreateDBSnapshot
$creadPrec :: ReadPrec CreateDBSnapshot
readList :: ReadS [CreateDBSnapshot]
$creadList :: ReadS [CreateDBSnapshot]
readsPrec :: Int -> ReadS CreateDBSnapshot
$creadsPrec :: Int -> ReadS CreateDBSnapshot
Prelude.Read, Int -> CreateDBSnapshot -> ShowS
[CreateDBSnapshot] -> ShowS
CreateDBSnapshot -> String
(Int -> CreateDBSnapshot -> ShowS)
-> (CreateDBSnapshot -> String)
-> ([CreateDBSnapshot] -> ShowS)
-> Show CreateDBSnapshot
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDBSnapshot] -> ShowS
$cshowList :: [CreateDBSnapshot] -> ShowS
show :: CreateDBSnapshot -> String
$cshow :: CreateDBSnapshot -> String
showsPrec :: Int -> CreateDBSnapshot -> ShowS
$cshowsPrec :: Int -> CreateDBSnapshot -> ShowS
Prelude.Show, (forall x. CreateDBSnapshot -> Rep CreateDBSnapshot x)
-> (forall x. Rep CreateDBSnapshot x -> CreateDBSnapshot)
-> Generic CreateDBSnapshot
forall x. Rep CreateDBSnapshot x -> CreateDBSnapshot
forall x. CreateDBSnapshot -> Rep CreateDBSnapshot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDBSnapshot x -> CreateDBSnapshot
$cfrom :: forall x. CreateDBSnapshot -> Rep CreateDBSnapshot x
Prelude.Generic)
newCreateDBSnapshot ::
Prelude.Text ->
Prelude.Text ->
CreateDBSnapshot
newCreateDBSnapshot :: Text -> Text -> CreateDBSnapshot
newCreateDBSnapshot
Text
pDBSnapshotIdentifier_
Text
pDBInstanceIdentifier_ =
CreateDBSnapshot' :: Maybe [Tag] -> Text -> Text -> CreateDBSnapshot
CreateDBSnapshot'
{ $sel:tags:CreateDBSnapshot' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:dbSnapshotIdentifier:CreateDBSnapshot' :: Text
dbSnapshotIdentifier = Text
pDBSnapshotIdentifier_,
$sel:dbInstanceIdentifier:CreateDBSnapshot' :: Text
dbInstanceIdentifier = Text
pDBInstanceIdentifier_
}
createDBSnapshot_tags :: Lens.Lens' CreateDBSnapshot (Prelude.Maybe [Tag])
createDBSnapshot_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDBSnapshot -> f CreateDBSnapshot
createDBSnapshot_tags = (CreateDBSnapshot -> Maybe [Tag])
-> (CreateDBSnapshot -> Maybe [Tag] -> CreateDBSnapshot)
-> Lens
CreateDBSnapshot CreateDBSnapshot (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBSnapshot' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateDBSnapshot' :: CreateDBSnapshot -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateDBSnapshot
s@CreateDBSnapshot' {} Maybe [Tag]
a -> CreateDBSnapshot
s {$sel:tags:CreateDBSnapshot' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateDBSnapshot) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDBSnapshot -> f CreateDBSnapshot)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDBSnapshot
-> f CreateDBSnapshot
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
createDBSnapshot_dbSnapshotIdentifier :: Lens.Lens' CreateDBSnapshot Prelude.Text
createDBSnapshot_dbSnapshotIdentifier :: (Text -> f Text) -> CreateDBSnapshot -> f CreateDBSnapshot
createDBSnapshot_dbSnapshotIdentifier = (CreateDBSnapshot -> Text)
-> (CreateDBSnapshot -> Text -> CreateDBSnapshot)
-> Lens CreateDBSnapshot CreateDBSnapshot Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBSnapshot' {Text
dbSnapshotIdentifier :: Text
$sel:dbSnapshotIdentifier:CreateDBSnapshot' :: CreateDBSnapshot -> Text
dbSnapshotIdentifier} -> Text
dbSnapshotIdentifier) (\s :: CreateDBSnapshot
s@CreateDBSnapshot' {} Text
a -> CreateDBSnapshot
s {$sel:dbSnapshotIdentifier:CreateDBSnapshot' :: Text
dbSnapshotIdentifier = Text
a} :: CreateDBSnapshot)
createDBSnapshot_dbInstanceIdentifier :: Lens.Lens' CreateDBSnapshot Prelude.Text
createDBSnapshot_dbInstanceIdentifier :: (Text -> f Text) -> CreateDBSnapshot -> f CreateDBSnapshot
createDBSnapshot_dbInstanceIdentifier = (CreateDBSnapshot -> Text)
-> (CreateDBSnapshot -> Text -> CreateDBSnapshot)
-> Lens CreateDBSnapshot CreateDBSnapshot Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBSnapshot' {Text
dbInstanceIdentifier :: Text
$sel:dbInstanceIdentifier:CreateDBSnapshot' :: CreateDBSnapshot -> Text
dbInstanceIdentifier} -> Text
dbInstanceIdentifier) (\s :: CreateDBSnapshot
s@CreateDBSnapshot' {} Text
a -> CreateDBSnapshot
s {$sel:dbInstanceIdentifier:CreateDBSnapshot' :: Text
dbInstanceIdentifier = Text
a} :: CreateDBSnapshot)
instance Core.AWSRequest CreateDBSnapshot where
type
AWSResponse CreateDBSnapshot =
CreateDBSnapshotResponse
request :: CreateDBSnapshot -> Request CreateDBSnapshot
request = Service -> CreateDBSnapshot -> Request CreateDBSnapshot
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy CreateDBSnapshot
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateDBSnapshot)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse CreateDBSnapshot))
-> Logger
-> Service
-> Proxy CreateDBSnapshot
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateDBSnapshot)))
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
"CreateDBSnapshotResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe DBSnapshot -> Int -> CreateDBSnapshotResponse
CreateDBSnapshotResponse'
(Maybe DBSnapshot -> Int -> CreateDBSnapshotResponse)
-> Either String (Maybe DBSnapshot)
-> Either String (Int -> CreateDBSnapshotResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe DBSnapshot)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DBSnapshot")
Either String (Int -> CreateDBSnapshotResponse)
-> Either String Int -> Either String CreateDBSnapshotResponse
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 CreateDBSnapshot
instance Prelude.NFData CreateDBSnapshot
instance Core.ToHeaders CreateDBSnapshot where
toHeaders :: CreateDBSnapshot -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateDBSnapshot -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath CreateDBSnapshot where
toPath :: CreateDBSnapshot -> ByteString
toPath = ByteString -> CreateDBSnapshot -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateDBSnapshot where
toQuery :: CreateDBSnapshot -> QueryString
toQuery CreateDBSnapshot' {Maybe [Tag]
Text
dbInstanceIdentifier :: Text
dbSnapshotIdentifier :: Text
tags :: Maybe [Tag]
$sel:dbInstanceIdentifier:CreateDBSnapshot' :: CreateDBSnapshot -> Text
$sel:dbSnapshotIdentifier:CreateDBSnapshot' :: CreateDBSnapshot -> Text
$sel:tags:CreateDBSnapshot' :: CreateDBSnapshot -> Maybe [Tag]
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"CreateDBSnapshot" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
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
"DBSnapshotIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dbSnapshotIdentifier,
ByteString
"DBInstanceIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dbInstanceIdentifier
]
data CreateDBSnapshotResponse = CreateDBSnapshotResponse'
{ CreateDBSnapshotResponse -> Maybe DBSnapshot
dbSnapshot :: Prelude.Maybe DBSnapshot,
CreateDBSnapshotResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateDBSnapshotResponse -> CreateDBSnapshotResponse -> Bool
(CreateDBSnapshotResponse -> CreateDBSnapshotResponse -> Bool)
-> (CreateDBSnapshotResponse -> CreateDBSnapshotResponse -> Bool)
-> Eq CreateDBSnapshotResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDBSnapshotResponse -> CreateDBSnapshotResponse -> Bool
$c/= :: CreateDBSnapshotResponse -> CreateDBSnapshotResponse -> Bool
== :: CreateDBSnapshotResponse -> CreateDBSnapshotResponse -> Bool
$c== :: CreateDBSnapshotResponse -> CreateDBSnapshotResponse -> Bool
Prelude.Eq, ReadPrec [CreateDBSnapshotResponse]
ReadPrec CreateDBSnapshotResponse
Int -> ReadS CreateDBSnapshotResponse
ReadS [CreateDBSnapshotResponse]
(Int -> ReadS CreateDBSnapshotResponse)
-> ReadS [CreateDBSnapshotResponse]
-> ReadPrec CreateDBSnapshotResponse
-> ReadPrec [CreateDBSnapshotResponse]
-> Read CreateDBSnapshotResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDBSnapshotResponse]
$creadListPrec :: ReadPrec [CreateDBSnapshotResponse]
readPrec :: ReadPrec CreateDBSnapshotResponse
$creadPrec :: ReadPrec CreateDBSnapshotResponse
readList :: ReadS [CreateDBSnapshotResponse]
$creadList :: ReadS [CreateDBSnapshotResponse]
readsPrec :: Int -> ReadS CreateDBSnapshotResponse
$creadsPrec :: Int -> ReadS CreateDBSnapshotResponse
Prelude.Read, Int -> CreateDBSnapshotResponse -> ShowS
[CreateDBSnapshotResponse] -> ShowS
CreateDBSnapshotResponse -> String
(Int -> CreateDBSnapshotResponse -> ShowS)
-> (CreateDBSnapshotResponse -> String)
-> ([CreateDBSnapshotResponse] -> ShowS)
-> Show CreateDBSnapshotResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDBSnapshotResponse] -> ShowS
$cshowList :: [CreateDBSnapshotResponse] -> ShowS
show :: CreateDBSnapshotResponse -> String
$cshow :: CreateDBSnapshotResponse -> String
showsPrec :: Int -> CreateDBSnapshotResponse -> ShowS
$cshowsPrec :: Int -> CreateDBSnapshotResponse -> ShowS
Prelude.Show, (forall x.
CreateDBSnapshotResponse -> Rep CreateDBSnapshotResponse x)
-> (forall x.
Rep CreateDBSnapshotResponse x -> CreateDBSnapshotResponse)
-> Generic CreateDBSnapshotResponse
forall x.
Rep CreateDBSnapshotResponse x -> CreateDBSnapshotResponse
forall x.
CreateDBSnapshotResponse -> Rep CreateDBSnapshotResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDBSnapshotResponse x -> CreateDBSnapshotResponse
$cfrom :: forall x.
CreateDBSnapshotResponse -> Rep CreateDBSnapshotResponse x
Prelude.Generic)
newCreateDBSnapshotResponse ::
Prelude.Int ->
CreateDBSnapshotResponse
newCreateDBSnapshotResponse :: Int -> CreateDBSnapshotResponse
newCreateDBSnapshotResponse Int
pHttpStatus_ =
CreateDBSnapshotResponse' :: Maybe DBSnapshot -> Int -> CreateDBSnapshotResponse
CreateDBSnapshotResponse'
{ $sel:dbSnapshot:CreateDBSnapshotResponse' :: Maybe DBSnapshot
dbSnapshot =
Maybe DBSnapshot
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateDBSnapshotResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createDBSnapshotResponse_dbSnapshot :: Lens.Lens' CreateDBSnapshotResponse (Prelude.Maybe DBSnapshot)
createDBSnapshotResponse_dbSnapshot :: (Maybe DBSnapshot -> f (Maybe DBSnapshot))
-> CreateDBSnapshotResponse -> f CreateDBSnapshotResponse
createDBSnapshotResponse_dbSnapshot = (CreateDBSnapshotResponse -> Maybe DBSnapshot)
-> (CreateDBSnapshotResponse
-> Maybe DBSnapshot -> CreateDBSnapshotResponse)
-> Lens
CreateDBSnapshotResponse
CreateDBSnapshotResponse
(Maybe DBSnapshot)
(Maybe DBSnapshot)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBSnapshotResponse' {Maybe DBSnapshot
dbSnapshot :: Maybe DBSnapshot
$sel:dbSnapshot:CreateDBSnapshotResponse' :: CreateDBSnapshotResponse -> Maybe DBSnapshot
dbSnapshot} -> Maybe DBSnapshot
dbSnapshot) (\s :: CreateDBSnapshotResponse
s@CreateDBSnapshotResponse' {} Maybe DBSnapshot
a -> CreateDBSnapshotResponse
s {$sel:dbSnapshot:CreateDBSnapshotResponse' :: Maybe DBSnapshot
dbSnapshot = Maybe DBSnapshot
a} :: CreateDBSnapshotResponse)
createDBSnapshotResponse_httpStatus :: Lens.Lens' CreateDBSnapshotResponse Prelude.Int
createDBSnapshotResponse_httpStatus :: (Int -> f Int)
-> CreateDBSnapshotResponse -> f CreateDBSnapshotResponse
createDBSnapshotResponse_httpStatus = (CreateDBSnapshotResponse -> Int)
-> (CreateDBSnapshotResponse -> Int -> CreateDBSnapshotResponse)
-> Lens CreateDBSnapshotResponse CreateDBSnapshotResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBSnapshotResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateDBSnapshotResponse' :: CreateDBSnapshotResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateDBSnapshotResponse
s@CreateDBSnapshotResponse' {} Int
a -> CreateDBSnapshotResponse
s {$sel:httpStatus:CreateDBSnapshotResponse' :: Int
httpStatus = Int
a} :: CreateDBSnapshotResponse)
instance Prelude.NFData CreateDBSnapshotResponse