{-# 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.RebootCacheCluster
(
RebootCacheCluster (..),
newRebootCacheCluster,
rebootCacheCluster_cacheClusterId,
rebootCacheCluster_cacheNodeIdsToReboot,
RebootCacheClusterResponse (..),
newRebootCacheClusterResponse,
rebootCacheClusterResponse_cacheCluster,
rebootCacheClusterResponse_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
data RebootCacheCluster = RebootCacheCluster'
{
RebootCacheCluster -> Text
cacheClusterId :: Prelude.Text,
RebootCacheCluster -> [Text]
cacheNodeIdsToReboot :: [Prelude.Text]
}
deriving (RebootCacheCluster -> RebootCacheCluster -> Bool
(RebootCacheCluster -> RebootCacheCluster -> Bool)
-> (RebootCacheCluster -> RebootCacheCluster -> Bool)
-> Eq RebootCacheCluster
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RebootCacheCluster -> RebootCacheCluster -> Bool
$c/= :: RebootCacheCluster -> RebootCacheCluster -> Bool
== :: RebootCacheCluster -> RebootCacheCluster -> Bool
$c== :: RebootCacheCluster -> RebootCacheCluster -> Bool
Prelude.Eq, ReadPrec [RebootCacheCluster]
ReadPrec RebootCacheCluster
Int -> ReadS RebootCacheCluster
ReadS [RebootCacheCluster]
(Int -> ReadS RebootCacheCluster)
-> ReadS [RebootCacheCluster]
-> ReadPrec RebootCacheCluster
-> ReadPrec [RebootCacheCluster]
-> Read RebootCacheCluster
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RebootCacheCluster]
$creadListPrec :: ReadPrec [RebootCacheCluster]
readPrec :: ReadPrec RebootCacheCluster
$creadPrec :: ReadPrec RebootCacheCluster
readList :: ReadS [RebootCacheCluster]
$creadList :: ReadS [RebootCacheCluster]
readsPrec :: Int -> ReadS RebootCacheCluster
$creadsPrec :: Int -> ReadS RebootCacheCluster
Prelude.Read, Int -> RebootCacheCluster -> ShowS
[RebootCacheCluster] -> ShowS
RebootCacheCluster -> String
(Int -> RebootCacheCluster -> ShowS)
-> (RebootCacheCluster -> String)
-> ([RebootCacheCluster] -> ShowS)
-> Show RebootCacheCluster
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RebootCacheCluster] -> ShowS
$cshowList :: [RebootCacheCluster] -> ShowS
show :: RebootCacheCluster -> String
$cshow :: RebootCacheCluster -> String
showsPrec :: Int -> RebootCacheCluster -> ShowS
$cshowsPrec :: Int -> RebootCacheCluster -> ShowS
Prelude.Show, (forall x. RebootCacheCluster -> Rep RebootCacheCluster x)
-> (forall x. Rep RebootCacheCluster x -> RebootCacheCluster)
-> Generic RebootCacheCluster
forall x. Rep RebootCacheCluster x -> RebootCacheCluster
forall x. RebootCacheCluster -> Rep RebootCacheCluster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RebootCacheCluster x -> RebootCacheCluster
$cfrom :: forall x. RebootCacheCluster -> Rep RebootCacheCluster x
Prelude.Generic)
newRebootCacheCluster ::
Prelude.Text ->
RebootCacheCluster
newRebootCacheCluster :: Text -> RebootCacheCluster
newRebootCacheCluster Text
pCacheClusterId_ =
RebootCacheCluster' :: Text -> [Text] -> RebootCacheCluster
RebootCacheCluster'
{ $sel:cacheClusterId:RebootCacheCluster' :: Text
cacheClusterId =
Text
pCacheClusterId_,
$sel:cacheNodeIdsToReboot:RebootCacheCluster' :: [Text]
cacheNodeIdsToReboot = [Text]
forall a. Monoid a => a
Prelude.mempty
}
rebootCacheCluster_cacheClusterId :: Lens.Lens' RebootCacheCluster Prelude.Text
rebootCacheCluster_cacheClusterId :: (Text -> f Text) -> RebootCacheCluster -> f RebootCacheCluster
rebootCacheCluster_cacheClusterId = (RebootCacheCluster -> Text)
-> (RebootCacheCluster -> Text -> RebootCacheCluster)
-> Lens RebootCacheCluster RebootCacheCluster Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RebootCacheCluster' {Text
cacheClusterId :: Text
$sel:cacheClusterId:RebootCacheCluster' :: RebootCacheCluster -> Text
cacheClusterId} -> Text
cacheClusterId) (\s :: RebootCacheCluster
s@RebootCacheCluster' {} Text
a -> RebootCacheCluster
s {$sel:cacheClusterId:RebootCacheCluster' :: Text
cacheClusterId = Text
a} :: RebootCacheCluster)
rebootCacheCluster_cacheNodeIdsToReboot :: Lens.Lens' RebootCacheCluster [Prelude.Text]
rebootCacheCluster_cacheNodeIdsToReboot :: ([Text] -> f [Text]) -> RebootCacheCluster -> f RebootCacheCluster
rebootCacheCluster_cacheNodeIdsToReboot = (RebootCacheCluster -> [Text])
-> (RebootCacheCluster -> [Text] -> RebootCacheCluster)
-> Lens RebootCacheCluster RebootCacheCluster [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RebootCacheCluster' {[Text]
cacheNodeIdsToReboot :: [Text]
$sel:cacheNodeIdsToReboot:RebootCacheCluster' :: RebootCacheCluster -> [Text]
cacheNodeIdsToReboot} -> [Text]
cacheNodeIdsToReboot) (\s :: RebootCacheCluster
s@RebootCacheCluster' {} [Text]
a -> RebootCacheCluster
s {$sel:cacheNodeIdsToReboot:RebootCacheCluster' :: [Text]
cacheNodeIdsToReboot = [Text]
a} :: RebootCacheCluster) (([Text] -> f [Text])
-> RebootCacheCluster -> f RebootCacheCluster)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> RebootCacheCluster
-> f RebootCacheCluster
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest RebootCacheCluster where
type
AWSResponse RebootCacheCluster =
RebootCacheClusterResponse
request :: RebootCacheCluster -> Request RebootCacheCluster
request = Service -> RebootCacheCluster -> Request RebootCacheCluster
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy RebootCacheCluster
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RebootCacheCluster)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse RebootCacheCluster))
-> Logger
-> Service
-> Proxy RebootCacheCluster
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RebootCacheCluster)))
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
"RebootCacheClusterResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe CacheCluster -> Int -> RebootCacheClusterResponse
RebootCacheClusterResponse'
(Maybe CacheCluster -> Int -> RebootCacheClusterResponse)
-> Either String (Maybe CacheCluster)
-> Either String (Int -> RebootCacheClusterResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe CacheCluster)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"CacheCluster")
Either String (Int -> RebootCacheClusterResponse)
-> Either String Int -> Either String RebootCacheClusterResponse
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 RebootCacheCluster
instance Prelude.NFData RebootCacheCluster
instance Core.ToHeaders RebootCacheCluster where
toHeaders :: RebootCacheCluster -> ResponseHeaders
toHeaders = ResponseHeaders -> RebootCacheCluster -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath RebootCacheCluster where
toPath :: RebootCacheCluster -> ByteString
toPath = ByteString -> RebootCacheCluster -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RebootCacheCluster where
toQuery :: RebootCacheCluster -> QueryString
toQuery RebootCacheCluster' {[Text]
Text
cacheNodeIdsToReboot :: [Text]
cacheClusterId :: Text
$sel:cacheNodeIdsToReboot:RebootCacheCluster' :: RebootCacheCluster -> [Text]
$sel:cacheClusterId:RebootCacheCluster' :: RebootCacheCluster -> 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
"RebootCacheCluster" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-02-02" :: Prelude.ByteString),
ByteString
"CacheClusterId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
cacheClusterId,
ByteString
"CacheNodeIdsToReboot"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"CacheNodeId" [Text]
cacheNodeIdsToReboot
]
data RebootCacheClusterResponse = RebootCacheClusterResponse'
{ RebootCacheClusterResponse -> Maybe CacheCluster
cacheCluster :: Prelude.Maybe CacheCluster,
RebootCacheClusterResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RebootCacheClusterResponse -> RebootCacheClusterResponse -> Bool
(RebootCacheClusterResponse -> RebootCacheClusterResponse -> Bool)
-> (RebootCacheClusterResponse
-> RebootCacheClusterResponse -> Bool)
-> Eq RebootCacheClusterResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RebootCacheClusterResponse -> RebootCacheClusterResponse -> Bool
$c/= :: RebootCacheClusterResponse -> RebootCacheClusterResponse -> Bool
== :: RebootCacheClusterResponse -> RebootCacheClusterResponse -> Bool
$c== :: RebootCacheClusterResponse -> RebootCacheClusterResponse -> Bool
Prelude.Eq, ReadPrec [RebootCacheClusterResponse]
ReadPrec RebootCacheClusterResponse
Int -> ReadS RebootCacheClusterResponse
ReadS [RebootCacheClusterResponse]
(Int -> ReadS RebootCacheClusterResponse)
-> ReadS [RebootCacheClusterResponse]
-> ReadPrec RebootCacheClusterResponse
-> ReadPrec [RebootCacheClusterResponse]
-> Read RebootCacheClusterResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RebootCacheClusterResponse]
$creadListPrec :: ReadPrec [RebootCacheClusterResponse]
readPrec :: ReadPrec RebootCacheClusterResponse
$creadPrec :: ReadPrec RebootCacheClusterResponse
readList :: ReadS [RebootCacheClusterResponse]
$creadList :: ReadS [RebootCacheClusterResponse]
readsPrec :: Int -> ReadS RebootCacheClusterResponse
$creadsPrec :: Int -> ReadS RebootCacheClusterResponse
Prelude.Read, Int -> RebootCacheClusterResponse -> ShowS
[RebootCacheClusterResponse] -> ShowS
RebootCacheClusterResponse -> String
(Int -> RebootCacheClusterResponse -> ShowS)
-> (RebootCacheClusterResponse -> String)
-> ([RebootCacheClusterResponse] -> ShowS)
-> Show RebootCacheClusterResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RebootCacheClusterResponse] -> ShowS
$cshowList :: [RebootCacheClusterResponse] -> ShowS
show :: RebootCacheClusterResponse -> String
$cshow :: RebootCacheClusterResponse -> String
showsPrec :: Int -> RebootCacheClusterResponse -> ShowS
$cshowsPrec :: Int -> RebootCacheClusterResponse -> ShowS
Prelude.Show, (forall x.
RebootCacheClusterResponse -> Rep RebootCacheClusterResponse x)
-> (forall x.
Rep RebootCacheClusterResponse x -> RebootCacheClusterResponse)
-> Generic RebootCacheClusterResponse
forall x.
Rep RebootCacheClusterResponse x -> RebootCacheClusterResponse
forall x.
RebootCacheClusterResponse -> Rep RebootCacheClusterResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RebootCacheClusterResponse x -> RebootCacheClusterResponse
$cfrom :: forall x.
RebootCacheClusterResponse -> Rep RebootCacheClusterResponse x
Prelude.Generic)
newRebootCacheClusterResponse ::
Prelude.Int ->
RebootCacheClusterResponse
newRebootCacheClusterResponse :: Int -> RebootCacheClusterResponse
newRebootCacheClusterResponse Int
pHttpStatus_ =
RebootCacheClusterResponse' :: Maybe CacheCluster -> Int -> RebootCacheClusterResponse
RebootCacheClusterResponse'
{ $sel:cacheCluster:RebootCacheClusterResponse' :: Maybe CacheCluster
cacheCluster =
Maybe CacheCluster
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:RebootCacheClusterResponse' :: Int
httpStatus = Int
pHttpStatus_
}
rebootCacheClusterResponse_cacheCluster :: Lens.Lens' RebootCacheClusterResponse (Prelude.Maybe CacheCluster)
rebootCacheClusterResponse_cacheCluster :: (Maybe CacheCluster -> f (Maybe CacheCluster))
-> RebootCacheClusterResponse -> f RebootCacheClusterResponse
rebootCacheClusterResponse_cacheCluster = (RebootCacheClusterResponse -> Maybe CacheCluster)
-> (RebootCacheClusterResponse
-> Maybe CacheCluster -> RebootCacheClusterResponse)
-> Lens
RebootCacheClusterResponse
RebootCacheClusterResponse
(Maybe CacheCluster)
(Maybe CacheCluster)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RebootCacheClusterResponse' {Maybe CacheCluster
cacheCluster :: Maybe CacheCluster
$sel:cacheCluster:RebootCacheClusterResponse' :: RebootCacheClusterResponse -> Maybe CacheCluster
cacheCluster} -> Maybe CacheCluster
cacheCluster) (\s :: RebootCacheClusterResponse
s@RebootCacheClusterResponse' {} Maybe CacheCluster
a -> RebootCacheClusterResponse
s {$sel:cacheCluster:RebootCacheClusterResponse' :: Maybe CacheCluster
cacheCluster = Maybe CacheCluster
a} :: RebootCacheClusterResponse)
rebootCacheClusterResponse_httpStatus :: Lens.Lens' RebootCacheClusterResponse Prelude.Int
rebootCacheClusterResponse_httpStatus :: (Int -> f Int)
-> RebootCacheClusterResponse -> f RebootCacheClusterResponse
rebootCacheClusterResponse_httpStatus = (RebootCacheClusterResponse -> Int)
-> (RebootCacheClusterResponse
-> Int -> RebootCacheClusterResponse)
-> Lens
RebootCacheClusterResponse RebootCacheClusterResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RebootCacheClusterResponse' {Int
httpStatus :: Int
$sel:httpStatus:RebootCacheClusterResponse' :: RebootCacheClusterResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RebootCacheClusterResponse
s@RebootCacheClusterResponse' {} Int
a -> RebootCacheClusterResponse
s {$sel:httpStatus:RebootCacheClusterResponse' :: Int
httpStatus = Int
a} :: RebootCacheClusterResponse)
instance Prelude.NFData RebootCacheClusterResponse