{-# 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.Redshift.RebootCluster
(
RebootCluster (..),
newRebootCluster,
rebootCluster_clusterIdentifier,
RebootClusterResponse (..),
newRebootClusterResponse,
rebootClusterResponse_cluster,
rebootClusterResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data RebootCluster = RebootCluster'
{
RebootCluster -> Text
clusterIdentifier :: Prelude.Text
}
deriving (RebootCluster -> RebootCluster -> Bool
(RebootCluster -> RebootCluster -> Bool)
-> (RebootCluster -> RebootCluster -> Bool) -> Eq RebootCluster
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RebootCluster -> RebootCluster -> Bool
$c/= :: RebootCluster -> RebootCluster -> Bool
== :: RebootCluster -> RebootCluster -> Bool
$c== :: RebootCluster -> RebootCluster -> Bool
Prelude.Eq, ReadPrec [RebootCluster]
ReadPrec RebootCluster
Int -> ReadS RebootCluster
ReadS [RebootCluster]
(Int -> ReadS RebootCluster)
-> ReadS [RebootCluster]
-> ReadPrec RebootCluster
-> ReadPrec [RebootCluster]
-> Read RebootCluster
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RebootCluster]
$creadListPrec :: ReadPrec [RebootCluster]
readPrec :: ReadPrec RebootCluster
$creadPrec :: ReadPrec RebootCluster
readList :: ReadS [RebootCluster]
$creadList :: ReadS [RebootCluster]
readsPrec :: Int -> ReadS RebootCluster
$creadsPrec :: Int -> ReadS RebootCluster
Prelude.Read, Int -> RebootCluster -> ShowS
[RebootCluster] -> ShowS
RebootCluster -> String
(Int -> RebootCluster -> ShowS)
-> (RebootCluster -> String)
-> ([RebootCluster] -> ShowS)
-> Show RebootCluster
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RebootCluster] -> ShowS
$cshowList :: [RebootCluster] -> ShowS
show :: RebootCluster -> String
$cshow :: RebootCluster -> String
showsPrec :: Int -> RebootCluster -> ShowS
$cshowsPrec :: Int -> RebootCluster -> ShowS
Prelude.Show, (forall x. RebootCluster -> Rep RebootCluster x)
-> (forall x. Rep RebootCluster x -> RebootCluster)
-> Generic RebootCluster
forall x. Rep RebootCluster x -> RebootCluster
forall x. RebootCluster -> Rep RebootCluster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RebootCluster x -> RebootCluster
$cfrom :: forall x. RebootCluster -> Rep RebootCluster x
Prelude.Generic)
newRebootCluster ::
Prelude.Text ->
RebootCluster
newRebootCluster :: Text -> RebootCluster
newRebootCluster Text
pClusterIdentifier_ =
RebootCluster' :: Text -> RebootCluster
RebootCluster'
{ $sel:clusterIdentifier:RebootCluster' :: Text
clusterIdentifier =
Text
pClusterIdentifier_
}
rebootCluster_clusterIdentifier :: Lens.Lens' RebootCluster Prelude.Text
rebootCluster_clusterIdentifier :: (Text -> f Text) -> RebootCluster -> f RebootCluster
rebootCluster_clusterIdentifier = (RebootCluster -> Text)
-> (RebootCluster -> Text -> RebootCluster)
-> Lens RebootCluster RebootCluster Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RebootCluster' {Text
clusterIdentifier :: Text
$sel:clusterIdentifier:RebootCluster' :: RebootCluster -> Text
clusterIdentifier} -> Text
clusterIdentifier) (\s :: RebootCluster
s@RebootCluster' {} Text
a -> RebootCluster
s {$sel:clusterIdentifier:RebootCluster' :: Text
clusterIdentifier = Text
a} :: RebootCluster)
instance Core.AWSRequest RebootCluster where
type
AWSResponse RebootCluster =
RebootClusterResponse
request :: RebootCluster -> Request RebootCluster
request = Service -> RebootCluster -> Request RebootCluster
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy RebootCluster
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RebootCluster)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse RebootCluster))
-> Logger
-> Service
-> Proxy RebootCluster
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RebootCluster)))
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
"RebootClusterResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Cluster -> Int -> RebootClusterResponse
RebootClusterResponse'
(Maybe Cluster -> Int -> RebootClusterResponse)
-> Either String (Maybe Cluster)
-> Either String (Int -> RebootClusterResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Cluster)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Cluster")
Either String (Int -> RebootClusterResponse)
-> Either String Int -> Either String RebootClusterResponse
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 RebootCluster
instance Prelude.NFData RebootCluster
instance Core.ToHeaders RebootCluster where
toHeaders :: RebootCluster -> ResponseHeaders
toHeaders = ResponseHeaders -> RebootCluster -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath RebootCluster where
toPath :: RebootCluster -> ByteString
toPath = ByteString -> RebootCluster -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RebootCluster where
toQuery :: RebootCluster -> QueryString
toQuery RebootCluster' {Text
clusterIdentifier :: Text
$sel:clusterIdentifier:RebootCluster' :: RebootCluster -> 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
"RebootCluster" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
ByteString
"ClusterIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
clusterIdentifier
]
data RebootClusterResponse = RebootClusterResponse'
{ RebootClusterResponse -> Maybe Cluster
cluster :: Prelude.Maybe Cluster,
RebootClusterResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RebootClusterResponse -> RebootClusterResponse -> Bool
(RebootClusterResponse -> RebootClusterResponse -> Bool)
-> (RebootClusterResponse -> RebootClusterResponse -> Bool)
-> Eq RebootClusterResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RebootClusterResponse -> RebootClusterResponse -> Bool
$c/= :: RebootClusterResponse -> RebootClusterResponse -> Bool
== :: RebootClusterResponse -> RebootClusterResponse -> Bool
$c== :: RebootClusterResponse -> RebootClusterResponse -> Bool
Prelude.Eq, ReadPrec [RebootClusterResponse]
ReadPrec RebootClusterResponse
Int -> ReadS RebootClusterResponse
ReadS [RebootClusterResponse]
(Int -> ReadS RebootClusterResponse)
-> ReadS [RebootClusterResponse]
-> ReadPrec RebootClusterResponse
-> ReadPrec [RebootClusterResponse]
-> Read RebootClusterResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RebootClusterResponse]
$creadListPrec :: ReadPrec [RebootClusterResponse]
readPrec :: ReadPrec RebootClusterResponse
$creadPrec :: ReadPrec RebootClusterResponse
readList :: ReadS [RebootClusterResponse]
$creadList :: ReadS [RebootClusterResponse]
readsPrec :: Int -> ReadS RebootClusterResponse
$creadsPrec :: Int -> ReadS RebootClusterResponse
Prelude.Read, Int -> RebootClusterResponse -> ShowS
[RebootClusterResponse] -> ShowS
RebootClusterResponse -> String
(Int -> RebootClusterResponse -> ShowS)
-> (RebootClusterResponse -> String)
-> ([RebootClusterResponse] -> ShowS)
-> Show RebootClusterResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RebootClusterResponse] -> ShowS
$cshowList :: [RebootClusterResponse] -> ShowS
show :: RebootClusterResponse -> String
$cshow :: RebootClusterResponse -> String
showsPrec :: Int -> RebootClusterResponse -> ShowS
$cshowsPrec :: Int -> RebootClusterResponse -> ShowS
Prelude.Show, (forall x. RebootClusterResponse -> Rep RebootClusterResponse x)
-> (forall x. Rep RebootClusterResponse x -> RebootClusterResponse)
-> Generic RebootClusterResponse
forall x. Rep RebootClusterResponse x -> RebootClusterResponse
forall x. RebootClusterResponse -> Rep RebootClusterResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RebootClusterResponse x -> RebootClusterResponse
$cfrom :: forall x. RebootClusterResponse -> Rep RebootClusterResponse x
Prelude.Generic)
newRebootClusterResponse ::
Prelude.Int ->
RebootClusterResponse
newRebootClusterResponse :: Int -> RebootClusterResponse
newRebootClusterResponse Int
pHttpStatus_ =
RebootClusterResponse' :: Maybe Cluster -> Int -> RebootClusterResponse
RebootClusterResponse'
{ $sel:cluster:RebootClusterResponse' :: Maybe Cluster
cluster = Maybe Cluster
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:RebootClusterResponse' :: Int
httpStatus = Int
pHttpStatus_
}
rebootClusterResponse_cluster :: Lens.Lens' RebootClusterResponse (Prelude.Maybe Cluster)
rebootClusterResponse_cluster :: (Maybe Cluster -> f (Maybe Cluster))
-> RebootClusterResponse -> f RebootClusterResponse
rebootClusterResponse_cluster = (RebootClusterResponse -> Maybe Cluster)
-> (RebootClusterResponse
-> Maybe Cluster -> RebootClusterResponse)
-> Lens
RebootClusterResponse
RebootClusterResponse
(Maybe Cluster)
(Maybe Cluster)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RebootClusterResponse' {Maybe Cluster
cluster :: Maybe Cluster
$sel:cluster:RebootClusterResponse' :: RebootClusterResponse -> Maybe Cluster
cluster} -> Maybe Cluster
cluster) (\s :: RebootClusterResponse
s@RebootClusterResponse' {} Maybe Cluster
a -> RebootClusterResponse
s {$sel:cluster:RebootClusterResponse' :: Maybe Cluster
cluster = Maybe Cluster
a} :: RebootClusterResponse)
rebootClusterResponse_httpStatus :: Lens.Lens' RebootClusterResponse Prelude.Int
rebootClusterResponse_httpStatus :: (Int -> f Int) -> RebootClusterResponse -> f RebootClusterResponse
rebootClusterResponse_httpStatus = (RebootClusterResponse -> Int)
-> (RebootClusterResponse -> Int -> RebootClusterResponse)
-> Lens RebootClusterResponse RebootClusterResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RebootClusterResponse' {Int
httpStatus :: Int
$sel:httpStatus:RebootClusterResponse' :: RebootClusterResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RebootClusterResponse
s@RebootClusterResponse' {} Int
a -> RebootClusterResponse
s {$sel:httpStatus:RebootClusterResponse' :: Int
httpStatus = Int
a} :: RebootClusterResponse)
instance Prelude.NFData RebootClusterResponse