{-# 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.Route53RecoveryCluster.GetRoutingControlState
(
GetRoutingControlState (..),
newGetRoutingControlState,
getRoutingControlState_routingControlArn,
GetRoutingControlStateResponse (..),
newGetRoutingControlStateResponse,
getRoutingControlStateResponse_httpStatus,
getRoutingControlStateResponse_routingControlArn,
getRoutingControlStateResponse_routingControlState,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Route53RecoveryCluster.Types
data GetRoutingControlState = GetRoutingControlState'
{
GetRoutingControlState -> Text
routingControlArn :: Prelude.Text
}
deriving (GetRoutingControlState -> GetRoutingControlState -> Bool
(GetRoutingControlState -> GetRoutingControlState -> Bool)
-> (GetRoutingControlState -> GetRoutingControlState -> Bool)
-> Eq GetRoutingControlState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRoutingControlState -> GetRoutingControlState -> Bool
$c/= :: GetRoutingControlState -> GetRoutingControlState -> Bool
== :: GetRoutingControlState -> GetRoutingControlState -> Bool
$c== :: GetRoutingControlState -> GetRoutingControlState -> Bool
Prelude.Eq, ReadPrec [GetRoutingControlState]
ReadPrec GetRoutingControlState
Int -> ReadS GetRoutingControlState
ReadS [GetRoutingControlState]
(Int -> ReadS GetRoutingControlState)
-> ReadS [GetRoutingControlState]
-> ReadPrec GetRoutingControlState
-> ReadPrec [GetRoutingControlState]
-> Read GetRoutingControlState
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRoutingControlState]
$creadListPrec :: ReadPrec [GetRoutingControlState]
readPrec :: ReadPrec GetRoutingControlState
$creadPrec :: ReadPrec GetRoutingControlState
readList :: ReadS [GetRoutingControlState]
$creadList :: ReadS [GetRoutingControlState]
readsPrec :: Int -> ReadS GetRoutingControlState
$creadsPrec :: Int -> ReadS GetRoutingControlState
Prelude.Read, Int -> GetRoutingControlState -> ShowS
[GetRoutingControlState] -> ShowS
GetRoutingControlState -> String
(Int -> GetRoutingControlState -> ShowS)
-> (GetRoutingControlState -> String)
-> ([GetRoutingControlState] -> ShowS)
-> Show GetRoutingControlState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRoutingControlState] -> ShowS
$cshowList :: [GetRoutingControlState] -> ShowS
show :: GetRoutingControlState -> String
$cshow :: GetRoutingControlState -> String
showsPrec :: Int -> GetRoutingControlState -> ShowS
$cshowsPrec :: Int -> GetRoutingControlState -> ShowS
Prelude.Show, (forall x. GetRoutingControlState -> Rep GetRoutingControlState x)
-> (forall x.
Rep GetRoutingControlState x -> GetRoutingControlState)
-> Generic GetRoutingControlState
forall x. Rep GetRoutingControlState x -> GetRoutingControlState
forall x. GetRoutingControlState -> Rep GetRoutingControlState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRoutingControlState x -> GetRoutingControlState
$cfrom :: forall x. GetRoutingControlState -> Rep GetRoutingControlState x
Prelude.Generic)
newGetRoutingControlState ::
Prelude.Text ->
GetRoutingControlState
newGetRoutingControlState :: Text -> GetRoutingControlState
newGetRoutingControlState Text
pRoutingControlArn_ =
GetRoutingControlState' :: Text -> GetRoutingControlState
GetRoutingControlState'
{ $sel:routingControlArn:GetRoutingControlState' :: Text
routingControlArn =
Text
pRoutingControlArn_
}
getRoutingControlState_routingControlArn :: Lens.Lens' GetRoutingControlState Prelude.Text
getRoutingControlState_routingControlArn :: (Text -> f Text)
-> GetRoutingControlState -> f GetRoutingControlState
getRoutingControlState_routingControlArn = (GetRoutingControlState -> Text)
-> (GetRoutingControlState -> Text -> GetRoutingControlState)
-> Lens GetRoutingControlState GetRoutingControlState Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRoutingControlState' {Text
routingControlArn :: Text
$sel:routingControlArn:GetRoutingControlState' :: GetRoutingControlState -> Text
routingControlArn} -> Text
routingControlArn) (\s :: GetRoutingControlState
s@GetRoutingControlState' {} Text
a -> GetRoutingControlState
s {$sel:routingControlArn:GetRoutingControlState' :: Text
routingControlArn = Text
a} :: GetRoutingControlState)
instance Core.AWSRequest GetRoutingControlState where
type
AWSResponse GetRoutingControlState =
GetRoutingControlStateResponse
request :: GetRoutingControlState -> Request GetRoutingControlState
request = Service -> GetRoutingControlState -> Request GetRoutingControlState
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetRoutingControlState
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetRoutingControlState)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetRoutingControlState))
-> Logger
-> Service
-> Proxy GetRoutingControlState
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetRoutingControlState)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int
-> Text -> RoutingControlState -> GetRoutingControlStateResponse
GetRoutingControlStateResponse'
(Int
-> Text -> RoutingControlState -> GetRoutingControlStateResponse)
-> Either String Int
-> Either
String
(Text -> RoutingControlState -> GetRoutingControlStateResponse)
forall (f :: * -> *) a b. Functor 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))
Either
String
(Text -> RoutingControlState -> GetRoutingControlStateResponse)
-> Either String Text
-> Either
String (RoutingControlState -> GetRoutingControlStateResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"RoutingControlArn")
Either
String (RoutingControlState -> GetRoutingControlStateResponse)
-> Either String RoutingControlState
-> Either String GetRoutingControlStateResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String RoutingControlState
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"RoutingControlState")
)
instance Prelude.Hashable GetRoutingControlState
instance Prelude.NFData GetRoutingControlState
instance Core.ToHeaders GetRoutingControlState where
toHeaders :: GetRoutingControlState -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetRoutingControlState -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"ToggleCustomerAPI.GetRoutingControlState" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON GetRoutingControlState where
toJSON :: GetRoutingControlState -> Value
toJSON GetRoutingControlState' {Text
routingControlArn :: Text
$sel:routingControlArn:GetRoutingControlState' :: GetRoutingControlState -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"RoutingControlArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
routingControlArn)
]
)
instance Core.ToPath GetRoutingControlState where
toPath :: GetRoutingControlState -> ByteString
toPath = ByteString -> GetRoutingControlState -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetRoutingControlState where
toQuery :: GetRoutingControlState -> QueryString
toQuery = QueryString -> GetRoutingControlState -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetRoutingControlStateResponse = GetRoutingControlStateResponse'
{
GetRoutingControlStateResponse -> Int
httpStatus :: Prelude.Int,
GetRoutingControlStateResponse -> Text
routingControlArn :: Prelude.Text,
GetRoutingControlStateResponse -> RoutingControlState
routingControlState :: RoutingControlState
}
deriving (GetRoutingControlStateResponse
-> GetRoutingControlStateResponse -> Bool
(GetRoutingControlStateResponse
-> GetRoutingControlStateResponse -> Bool)
-> (GetRoutingControlStateResponse
-> GetRoutingControlStateResponse -> Bool)
-> Eq GetRoutingControlStateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRoutingControlStateResponse
-> GetRoutingControlStateResponse -> Bool
$c/= :: GetRoutingControlStateResponse
-> GetRoutingControlStateResponse -> Bool
== :: GetRoutingControlStateResponse
-> GetRoutingControlStateResponse -> Bool
$c== :: GetRoutingControlStateResponse
-> GetRoutingControlStateResponse -> Bool
Prelude.Eq, ReadPrec [GetRoutingControlStateResponse]
ReadPrec GetRoutingControlStateResponse
Int -> ReadS GetRoutingControlStateResponse
ReadS [GetRoutingControlStateResponse]
(Int -> ReadS GetRoutingControlStateResponse)
-> ReadS [GetRoutingControlStateResponse]
-> ReadPrec GetRoutingControlStateResponse
-> ReadPrec [GetRoutingControlStateResponse]
-> Read GetRoutingControlStateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRoutingControlStateResponse]
$creadListPrec :: ReadPrec [GetRoutingControlStateResponse]
readPrec :: ReadPrec GetRoutingControlStateResponse
$creadPrec :: ReadPrec GetRoutingControlStateResponse
readList :: ReadS [GetRoutingControlStateResponse]
$creadList :: ReadS [GetRoutingControlStateResponse]
readsPrec :: Int -> ReadS GetRoutingControlStateResponse
$creadsPrec :: Int -> ReadS GetRoutingControlStateResponse
Prelude.Read, Int -> GetRoutingControlStateResponse -> ShowS
[GetRoutingControlStateResponse] -> ShowS
GetRoutingControlStateResponse -> String
(Int -> GetRoutingControlStateResponse -> ShowS)
-> (GetRoutingControlStateResponse -> String)
-> ([GetRoutingControlStateResponse] -> ShowS)
-> Show GetRoutingControlStateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRoutingControlStateResponse] -> ShowS
$cshowList :: [GetRoutingControlStateResponse] -> ShowS
show :: GetRoutingControlStateResponse -> String
$cshow :: GetRoutingControlStateResponse -> String
showsPrec :: Int -> GetRoutingControlStateResponse -> ShowS
$cshowsPrec :: Int -> GetRoutingControlStateResponse -> ShowS
Prelude.Show, (forall x.
GetRoutingControlStateResponse
-> Rep GetRoutingControlStateResponse x)
-> (forall x.
Rep GetRoutingControlStateResponse x
-> GetRoutingControlStateResponse)
-> Generic GetRoutingControlStateResponse
forall x.
Rep GetRoutingControlStateResponse x
-> GetRoutingControlStateResponse
forall x.
GetRoutingControlStateResponse
-> Rep GetRoutingControlStateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetRoutingControlStateResponse x
-> GetRoutingControlStateResponse
$cfrom :: forall x.
GetRoutingControlStateResponse
-> Rep GetRoutingControlStateResponse x
Prelude.Generic)
newGetRoutingControlStateResponse ::
Prelude.Int ->
Prelude.Text ->
RoutingControlState ->
GetRoutingControlStateResponse
newGetRoutingControlStateResponse :: Int
-> Text -> RoutingControlState -> GetRoutingControlStateResponse
newGetRoutingControlStateResponse
Int
pHttpStatus_
Text
pRoutingControlArn_
RoutingControlState
pRoutingControlState_ =
GetRoutingControlStateResponse' :: Int
-> Text -> RoutingControlState -> GetRoutingControlStateResponse
GetRoutingControlStateResponse'
{ $sel:httpStatus:GetRoutingControlStateResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:routingControlArn:GetRoutingControlStateResponse' :: Text
routingControlArn = Text
pRoutingControlArn_,
$sel:routingControlState:GetRoutingControlStateResponse' :: RoutingControlState
routingControlState = RoutingControlState
pRoutingControlState_
}
getRoutingControlStateResponse_httpStatus :: Lens.Lens' GetRoutingControlStateResponse Prelude.Int
getRoutingControlStateResponse_httpStatus :: (Int -> f Int)
-> GetRoutingControlStateResponse
-> f GetRoutingControlStateResponse
getRoutingControlStateResponse_httpStatus = (GetRoutingControlStateResponse -> Int)
-> (GetRoutingControlStateResponse
-> Int -> GetRoutingControlStateResponse)
-> Lens
GetRoutingControlStateResponse
GetRoutingControlStateResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRoutingControlStateResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetRoutingControlStateResponse' :: GetRoutingControlStateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetRoutingControlStateResponse
s@GetRoutingControlStateResponse' {} Int
a -> GetRoutingControlStateResponse
s {$sel:httpStatus:GetRoutingControlStateResponse' :: Int
httpStatus = Int
a} :: GetRoutingControlStateResponse)
getRoutingControlStateResponse_routingControlArn :: Lens.Lens' GetRoutingControlStateResponse Prelude.Text
getRoutingControlStateResponse_routingControlArn :: (Text -> f Text)
-> GetRoutingControlStateResponse
-> f GetRoutingControlStateResponse
getRoutingControlStateResponse_routingControlArn = (GetRoutingControlStateResponse -> Text)
-> (GetRoutingControlStateResponse
-> Text -> GetRoutingControlStateResponse)
-> Lens
GetRoutingControlStateResponse
GetRoutingControlStateResponse
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRoutingControlStateResponse' {Text
routingControlArn :: Text
$sel:routingControlArn:GetRoutingControlStateResponse' :: GetRoutingControlStateResponse -> Text
routingControlArn} -> Text
routingControlArn) (\s :: GetRoutingControlStateResponse
s@GetRoutingControlStateResponse' {} Text
a -> GetRoutingControlStateResponse
s {$sel:routingControlArn:GetRoutingControlStateResponse' :: Text
routingControlArn = Text
a} :: GetRoutingControlStateResponse)
getRoutingControlStateResponse_routingControlState :: Lens.Lens' GetRoutingControlStateResponse RoutingControlState
getRoutingControlStateResponse_routingControlState :: (RoutingControlState -> f RoutingControlState)
-> GetRoutingControlStateResponse
-> f GetRoutingControlStateResponse
getRoutingControlStateResponse_routingControlState = (GetRoutingControlStateResponse -> RoutingControlState)
-> (GetRoutingControlStateResponse
-> RoutingControlState -> GetRoutingControlStateResponse)
-> Lens
GetRoutingControlStateResponse
GetRoutingControlStateResponse
RoutingControlState
RoutingControlState
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRoutingControlStateResponse' {RoutingControlState
routingControlState :: RoutingControlState
$sel:routingControlState:GetRoutingControlStateResponse' :: GetRoutingControlStateResponse -> RoutingControlState
routingControlState} -> RoutingControlState
routingControlState) (\s :: GetRoutingControlStateResponse
s@GetRoutingControlStateResponse' {} RoutingControlState
a -> GetRoutingControlStateResponse
s {$sel:routingControlState:GetRoutingControlStateResponse' :: RoutingControlState
routingControlState = RoutingControlState
a} :: GetRoutingControlStateResponse)
instance
Prelude.NFData
GetRoutingControlStateResponse