{-# 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.DocumentDB.RebootDBInstance
(
RebootDBInstance (..),
newRebootDBInstance,
rebootDBInstance_forceFailover,
rebootDBInstance_dbInstanceIdentifier,
RebootDBInstanceResponse (..),
newRebootDBInstanceResponse,
rebootDBInstanceResponse_dbInstance,
rebootDBInstanceResponse_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
data RebootDBInstance = RebootDBInstance'
{
RebootDBInstance -> Maybe Bool
forceFailover :: Prelude.Maybe Prelude.Bool,
RebootDBInstance -> Text
dbInstanceIdentifier :: Prelude.Text
}
deriving (RebootDBInstance -> RebootDBInstance -> Bool
(RebootDBInstance -> RebootDBInstance -> Bool)
-> (RebootDBInstance -> RebootDBInstance -> Bool)
-> Eq RebootDBInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RebootDBInstance -> RebootDBInstance -> Bool
$c/= :: RebootDBInstance -> RebootDBInstance -> Bool
== :: RebootDBInstance -> RebootDBInstance -> Bool
$c== :: RebootDBInstance -> RebootDBInstance -> Bool
Prelude.Eq, ReadPrec [RebootDBInstance]
ReadPrec RebootDBInstance
Int -> ReadS RebootDBInstance
ReadS [RebootDBInstance]
(Int -> ReadS RebootDBInstance)
-> ReadS [RebootDBInstance]
-> ReadPrec RebootDBInstance
-> ReadPrec [RebootDBInstance]
-> Read RebootDBInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RebootDBInstance]
$creadListPrec :: ReadPrec [RebootDBInstance]
readPrec :: ReadPrec RebootDBInstance
$creadPrec :: ReadPrec RebootDBInstance
readList :: ReadS [RebootDBInstance]
$creadList :: ReadS [RebootDBInstance]
readsPrec :: Int -> ReadS RebootDBInstance
$creadsPrec :: Int -> ReadS RebootDBInstance
Prelude.Read, Int -> RebootDBInstance -> ShowS
[RebootDBInstance] -> ShowS
RebootDBInstance -> String
(Int -> RebootDBInstance -> ShowS)
-> (RebootDBInstance -> String)
-> ([RebootDBInstance] -> ShowS)
-> Show RebootDBInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RebootDBInstance] -> ShowS
$cshowList :: [RebootDBInstance] -> ShowS
show :: RebootDBInstance -> String
$cshow :: RebootDBInstance -> String
showsPrec :: Int -> RebootDBInstance -> ShowS
$cshowsPrec :: Int -> RebootDBInstance -> ShowS
Prelude.Show, (forall x. RebootDBInstance -> Rep RebootDBInstance x)
-> (forall x. Rep RebootDBInstance x -> RebootDBInstance)
-> Generic RebootDBInstance
forall x. Rep RebootDBInstance x -> RebootDBInstance
forall x. RebootDBInstance -> Rep RebootDBInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RebootDBInstance x -> RebootDBInstance
$cfrom :: forall x. RebootDBInstance -> Rep RebootDBInstance x
Prelude.Generic)
newRebootDBInstance ::
Prelude.Text ->
RebootDBInstance
newRebootDBInstance :: Text -> RebootDBInstance
newRebootDBInstance Text
pDBInstanceIdentifier_ =
RebootDBInstance' :: Maybe Bool -> Text -> RebootDBInstance
RebootDBInstance'
{ $sel:forceFailover:RebootDBInstance' :: Maybe Bool
forceFailover = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:dbInstanceIdentifier:RebootDBInstance' :: Text
dbInstanceIdentifier = Text
pDBInstanceIdentifier_
}
rebootDBInstance_forceFailover :: Lens.Lens' RebootDBInstance (Prelude.Maybe Prelude.Bool)
rebootDBInstance_forceFailover :: (Maybe Bool -> f (Maybe Bool))
-> RebootDBInstance -> f RebootDBInstance
rebootDBInstance_forceFailover = (RebootDBInstance -> Maybe Bool)
-> (RebootDBInstance -> Maybe Bool -> RebootDBInstance)
-> Lens RebootDBInstance RebootDBInstance (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RebootDBInstance' {Maybe Bool
forceFailover :: Maybe Bool
$sel:forceFailover:RebootDBInstance' :: RebootDBInstance -> Maybe Bool
forceFailover} -> Maybe Bool
forceFailover) (\s :: RebootDBInstance
s@RebootDBInstance' {} Maybe Bool
a -> RebootDBInstance
s {$sel:forceFailover:RebootDBInstance' :: Maybe Bool
forceFailover = Maybe Bool
a} :: RebootDBInstance)
rebootDBInstance_dbInstanceIdentifier :: Lens.Lens' RebootDBInstance Prelude.Text
rebootDBInstance_dbInstanceIdentifier :: (Text -> f Text) -> RebootDBInstance -> f RebootDBInstance
rebootDBInstance_dbInstanceIdentifier = (RebootDBInstance -> Text)
-> (RebootDBInstance -> Text -> RebootDBInstance)
-> Lens RebootDBInstance RebootDBInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RebootDBInstance' {Text
dbInstanceIdentifier :: Text
$sel:dbInstanceIdentifier:RebootDBInstance' :: RebootDBInstance -> Text
dbInstanceIdentifier} -> Text
dbInstanceIdentifier) (\s :: RebootDBInstance
s@RebootDBInstance' {} Text
a -> RebootDBInstance
s {$sel:dbInstanceIdentifier:RebootDBInstance' :: Text
dbInstanceIdentifier = Text
a} :: RebootDBInstance)
instance Core.AWSRequest RebootDBInstance where
type
AWSResponse RebootDBInstance =
RebootDBInstanceResponse
request :: RebootDBInstance -> Request RebootDBInstance
request = Service -> RebootDBInstance -> Request RebootDBInstance
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy RebootDBInstance
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RebootDBInstance)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse RebootDBInstance))
-> Logger
-> Service
-> Proxy RebootDBInstance
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RebootDBInstance)))
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
"RebootDBInstanceResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe DBInstance -> Int -> RebootDBInstanceResponse
RebootDBInstanceResponse'
(Maybe DBInstance -> Int -> RebootDBInstanceResponse)
-> Either String (Maybe DBInstance)
-> Either String (Int -> RebootDBInstanceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe DBInstance)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DBInstance")
Either String (Int -> RebootDBInstanceResponse)
-> Either String Int -> Either String RebootDBInstanceResponse
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 RebootDBInstance
instance Prelude.NFData RebootDBInstance
instance Core.ToHeaders RebootDBInstance where
toHeaders :: RebootDBInstance -> ResponseHeaders
toHeaders = ResponseHeaders -> RebootDBInstance -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath RebootDBInstance where
toPath :: RebootDBInstance -> ByteString
toPath = ByteString -> RebootDBInstance -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RebootDBInstance where
toQuery :: RebootDBInstance -> QueryString
toQuery RebootDBInstance' {Maybe Bool
Text
dbInstanceIdentifier :: Text
forceFailover :: Maybe Bool
$sel:dbInstanceIdentifier:RebootDBInstance' :: RebootDBInstance -> Text
$sel:forceFailover:RebootDBInstance' :: RebootDBInstance -> Maybe Bool
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"RebootDBInstance" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
ByteString
"ForceFailover" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
forceFailover,
ByteString
"DBInstanceIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dbInstanceIdentifier
]
data RebootDBInstanceResponse = RebootDBInstanceResponse'
{ RebootDBInstanceResponse -> Maybe DBInstance
dbInstance :: Prelude.Maybe DBInstance,
RebootDBInstanceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RebootDBInstanceResponse -> RebootDBInstanceResponse -> Bool
(RebootDBInstanceResponse -> RebootDBInstanceResponse -> Bool)
-> (RebootDBInstanceResponse -> RebootDBInstanceResponse -> Bool)
-> Eq RebootDBInstanceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RebootDBInstanceResponse -> RebootDBInstanceResponse -> Bool
$c/= :: RebootDBInstanceResponse -> RebootDBInstanceResponse -> Bool
== :: RebootDBInstanceResponse -> RebootDBInstanceResponse -> Bool
$c== :: RebootDBInstanceResponse -> RebootDBInstanceResponse -> Bool
Prelude.Eq, ReadPrec [RebootDBInstanceResponse]
ReadPrec RebootDBInstanceResponse
Int -> ReadS RebootDBInstanceResponse
ReadS [RebootDBInstanceResponse]
(Int -> ReadS RebootDBInstanceResponse)
-> ReadS [RebootDBInstanceResponse]
-> ReadPrec RebootDBInstanceResponse
-> ReadPrec [RebootDBInstanceResponse]
-> Read RebootDBInstanceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RebootDBInstanceResponse]
$creadListPrec :: ReadPrec [RebootDBInstanceResponse]
readPrec :: ReadPrec RebootDBInstanceResponse
$creadPrec :: ReadPrec RebootDBInstanceResponse
readList :: ReadS [RebootDBInstanceResponse]
$creadList :: ReadS [RebootDBInstanceResponse]
readsPrec :: Int -> ReadS RebootDBInstanceResponse
$creadsPrec :: Int -> ReadS RebootDBInstanceResponse
Prelude.Read, Int -> RebootDBInstanceResponse -> ShowS
[RebootDBInstanceResponse] -> ShowS
RebootDBInstanceResponse -> String
(Int -> RebootDBInstanceResponse -> ShowS)
-> (RebootDBInstanceResponse -> String)
-> ([RebootDBInstanceResponse] -> ShowS)
-> Show RebootDBInstanceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RebootDBInstanceResponse] -> ShowS
$cshowList :: [RebootDBInstanceResponse] -> ShowS
show :: RebootDBInstanceResponse -> String
$cshow :: RebootDBInstanceResponse -> String
showsPrec :: Int -> RebootDBInstanceResponse -> ShowS
$cshowsPrec :: Int -> RebootDBInstanceResponse -> ShowS
Prelude.Show, (forall x.
RebootDBInstanceResponse -> Rep RebootDBInstanceResponse x)
-> (forall x.
Rep RebootDBInstanceResponse x -> RebootDBInstanceResponse)
-> Generic RebootDBInstanceResponse
forall x.
Rep RebootDBInstanceResponse x -> RebootDBInstanceResponse
forall x.
RebootDBInstanceResponse -> Rep RebootDBInstanceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RebootDBInstanceResponse x -> RebootDBInstanceResponse
$cfrom :: forall x.
RebootDBInstanceResponse -> Rep RebootDBInstanceResponse x
Prelude.Generic)
newRebootDBInstanceResponse ::
Prelude.Int ->
RebootDBInstanceResponse
newRebootDBInstanceResponse :: Int -> RebootDBInstanceResponse
newRebootDBInstanceResponse Int
pHttpStatus_ =
RebootDBInstanceResponse' :: Maybe DBInstance -> Int -> RebootDBInstanceResponse
RebootDBInstanceResponse'
{ $sel:dbInstance:RebootDBInstanceResponse' :: Maybe DBInstance
dbInstance =
Maybe DBInstance
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:RebootDBInstanceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
rebootDBInstanceResponse_dbInstance :: Lens.Lens' RebootDBInstanceResponse (Prelude.Maybe DBInstance)
rebootDBInstanceResponse_dbInstance :: (Maybe DBInstance -> f (Maybe DBInstance))
-> RebootDBInstanceResponse -> f RebootDBInstanceResponse
rebootDBInstanceResponse_dbInstance = (RebootDBInstanceResponse -> Maybe DBInstance)
-> (RebootDBInstanceResponse
-> Maybe DBInstance -> RebootDBInstanceResponse)
-> Lens
RebootDBInstanceResponse
RebootDBInstanceResponse
(Maybe DBInstance)
(Maybe DBInstance)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RebootDBInstanceResponse' {Maybe DBInstance
dbInstance :: Maybe DBInstance
$sel:dbInstance:RebootDBInstanceResponse' :: RebootDBInstanceResponse -> Maybe DBInstance
dbInstance} -> Maybe DBInstance
dbInstance) (\s :: RebootDBInstanceResponse
s@RebootDBInstanceResponse' {} Maybe DBInstance
a -> RebootDBInstanceResponse
s {$sel:dbInstance:RebootDBInstanceResponse' :: Maybe DBInstance
dbInstance = Maybe DBInstance
a} :: RebootDBInstanceResponse)
rebootDBInstanceResponse_httpStatus :: Lens.Lens' RebootDBInstanceResponse Prelude.Int
rebootDBInstanceResponse_httpStatus :: (Int -> f Int)
-> RebootDBInstanceResponse -> f RebootDBInstanceResponse
rebootDBInstanceResponse_httpStatus = (RebootDBInstanceResponse -> Int)
-> (RebootDBInstanceResponse -> Int -> RebootDBInstanceResponse)
-> Lens RebootDBInstanceResponse RebootDBInstanceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RebootDBInstanceResponse' {Int
httpStatus :: Int
$sel:httpStatus:RebootDBInstanceResponse' :: RebootDBInstanceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RebootDBInstanceResponse
s@RebootDBInstanceResponse' {} Int
a -> RebootDBInstanceResponse
s {$sel:httpStatus:RebootDBInstanceResponse' :: Int
httpStatus = Int
a} :: RebootDBInstanceResponse)
instance Prelude.NFData RebootDBInstanceResponse