{-# 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.Route53RecoveryControlConfig.CreateRoutingControl
(
CreateRoutingControl (..),
newCreateRoutingControl,
createRoutingControl_controlPanelArn,
createRoutingControl_clientToken,
createRoutingControl_clusterArn,
createRoutingControl_routingControlName,
CreateRoutingControlResponse (..),
newCreateRoutingControlResponse,
createRoutingControlResponse_routingControl,
createRoutingControlResponse_httpStatus,
)
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.Route53RecoveryControlConfig.Types
data CreateRoutingControl = CreateRoutingControl'
{
CreateRoutingControl -> Maybe Text
controlPanelArn :: Prelude.Maybe Prelude.Text,
CreateRoutingControl -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
CreateRoutingControl -> Text
clusterArn :: Prelude.Text,
CreateRoutingControl -> Text
routingControlName :: Prelude.Text
}
deriving (CreateRoutingControl -> CreateRoutingControl -> Bool
(CreateRoutingControl -> CreateRoutingControl -> Bool)
-> (CreateRoutingControl -> CreateRoutingControl -> Bool)
-> Eq CreateRoutingControl
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRoutingControl -> CreateRoutingControl -> Bool
$c/= :: CreateRoutingControl -> CreateRoutingControl -> Bool
== :: CreateRoutingControl -> CreateRoutingControl -> Bool
$c== :: CreateRoutingControl -> CreateRoutingControl -> Bool
Prelude.Eq, ReadPrec [CreateRoutingControl]
ReadPrec CreateRoutingControl
Int -> ReadS CreateRoutingControl
ReadS [CreateRoutingControl]
(Int -> ReadS CreateRoutingControl)
-> ReadS [CreateRoutingControl]
-> ReadPrec CreateRoutingControl
-> ReadPrec [CreateRoutingControl]
-> Read CreateRoutingControl
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRoutingControl]
$creadListPrec :: ReadPrec [CreateRoutingControl]
readPrec :: ReadPrec CreateRoutingControl
$creadPrec :: ReadPrec CreateRoutingControl
readList :: ReadS [CreateRoutingControl]
$creadList :: ReadS [CreateRoutingControl]
readsPrec :: Int -> ReadS CreateRoutingControl
$creadsPrec :: Int -> ReadS CreateRoutingControl
Prelude.Read, Int -> CreateRoutingControl -> ShowS
[CreateRoutingControl] -> ShowS
CreateRoutingControl -> String
(Int -> CreateRoutingControl -> ShowS)
-> (CreateRoutingControl -> String)
-> ([CreateRoutingControl] -> ShowS)
-> Show CreateRoutingControl
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRoutingControl] -> ShowS
$cshowList :: [CreateRoutingControl] -> ShowS
show :: CreateRoutingControl -> String
$cshow :: CreateRoutingControl -> String
showsPrec :: Int -> CreateRoutingControl -> ShowS
$cshowsPrec :: Int -> CreateRoutingControl -> ShowS
Prelude.Show, (forall x. CreateRoutingControl -> Rep CreateRoutingControl x)
-> (forall x. Rep CreateRoutingControl x -> CreateRoutingControl)
-> Generic CreateRoutingControl
forall x. Rep CreateRoutingControl x -> CreateRoutingControl
forall x. CreateRoutingControl -> Rep CreateRoutingControl x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateRoutingControl x -> CreateRoutingControl
$cfrom :: forall x. CreateRoutingControl -> Rep CreateRoutingControl x
Prelude.Generic)
newCreateRoutingControl ::
Prelude.Text ->
Prelude.Text ->
CreateRoutingControl
newCreateRoutingControl :: Text -> Text -> CreateRoutingControl
newCreateRoutingControl
Text
pClusterArn_
Text
pRoutingControlName_ =
CreateRoutingControl' :: Maybe Text -> Maybe Text -> Text -> Text -> CreateRoutingControl
CreateRoutingControl'
{ $sel:controlPanelArn:CreateRoutingControl' :: Maybe Text
controlPanelArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:clientToken:CreateRoutingControl' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:clusterArn:CreateRoutingControl' :: Text
clusterArn = Text
pClusterArn_,
$sel:routingControlName:CreateRoutingControl' :: Text
routingControlName = Text
pRoutingControlName_
}
createRoutingControl_controlPanelArn :: Lens.Lens' CreateRoutingControl (Prelude.Maybe Prelude.Text)
createRoutingControl_controlPanelArn :: (Maybe Text -> f (Maybe Text))
-> CreateRoutingControl -> f CreateRoutingControl
createRoutingControl_controlPanelArn = (CreateRoutingControl -> Maybe Text)
-> (CreateRoutingControl -> Maybe Text -> CreateRoutingControl)
-> Lens
CreateRoutingControl CreateRoutingControl (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoutingControl' {Maybe Text
controlPanelArn :: Maybe Text
$sel:controlPanelArn:CreateRoutingControl' :: CreateRoutingControl -> Maybe Text
controlPanelArn} -> Maybe Text
controlPanelArn) (\s :: CreateRoutingControl
s@CreateRoutingControl' {} Maybe Text
a -> CreateRoutingControl
s {$sel:controlPanelArn:CreateRoutingControl' :: Maybe Text
controlPanelArn = Maybe Text
a} :: CreateRoutingControl)
createRoutingControl_clientToken :: Lens.Lens' CreateRoutingControl (Prelude.Maybe Prelude.Text)
createRoutingControl_clientToken :: (Maybe Text -> f (Maybe Text))
-> CreateRoutingControl -> f CreateRoutingControl
createRoutingControl_clientToken = (CreateRoutingControl -> Maybe Text)
-> (CreateRoutingControl -> Maybe Text -> CreateRoutingControl)
-> Lens
CreateRoutingControl CreateRoutingControl (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoutingControl' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateRoutingControl' :: CreateRoutingControl -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateRoutingControl
s@CreateRoutingControl' {} Maybe Text
a -> CreateRoutingControl
s {$sel:clientToken:CreateRoutingControl' :: Maybe Text
clientToken = Maybe Text
a} :: CreateRoutingControl)
createRoutingControl_clusterArn :: Lens.Lens' CreateRoutingControl Prelude.Text
createRoutingControl_clusterArn :: (Text -> f Text) -> CreateRoutingControl -> f CreateRoutingControl
createRoutingControl_clusterArn = (CreateRoutingControl -> Text)
-> (CreateRoutingControl -> Text -> CreateRoutingControl)
-> Lens CreateRoutingControl CreateRoutingControl Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoutingControl' {Text
clusterArn :: Text
$sel:clusterArn:CreateRoutingControl' :: CreateRoutingControl -> Text
clusterArn} -> Text
clusterArn) (\s :: CreateRoutingControl
s@CreateRoutingControl' {} Text
a -> CreateRoutingControl
s {$sel:clusterArn:CreateRoutingControl' :: Text
clusterArn = Text
a} :: CreateRoutingControl)
createRoutingControl_routingControlName :: Lens.Lens' CreateRoutingControl Prelude.Text
createRoutingControl_routingControlName :: (Text -> f Text) -> CreateRoutingControl -> f CreateRoutingControl
createRoutingControl_routingControlName = (CreateRoutingControl -> Text)
-> (CreateRoutingControl -> Text -> CreateRoutingControl)
-> Lens CreateRoutingControl CreateRoutingControl Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoutingControl' {Text
routingControlName :: Text
$sel:routingControlName:CreateRoutingControl' :: CreateRoutingControl -> Text
routingControlName} -> Text
routingControlName) (\s :: CreateRoutingControl
s@CreateRoutingControl' {} Text
a -> CreateRoutingControl
s {$sel:routingControlName:CreateRoutingControl' :: Text
routingControlName = Text
a} :: CreateRoutingControl)
instance Core.AWSRequest CreateRoutingControl where
type
AWSResponse CreateRoutingControl =
CreateRoutingControlResponse
request :: CreateRoutingControl -> Request CreateRoutingControl
request = Service -> CreateRoutingControl -> Request CreateRoutingControl
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateRoutingControl
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateRoutingControl)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateRoutingControl))
-> Logger
-> Service
-> Proxy CreateRoutingControl
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateRoutingControl)))
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 ->
Maybe RoutingControl -> Int -> CreateRoutingControlResponse
CreateRoutingControlResponse'
(Maybe RoutingControl -> Int -> CreateRoutingControlResponse)
-> Either String (Maybe RoutingControl)
-> Either String (Int -> CreateRoutingControlResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe RoutingControl)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"RoutingControl")
Either String (Int -> CreateRoutingControlResponse)
-> Either String Int -> Either String CreateRoutingControlResponse
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 CreateRoutingControl
instance Prelude.NFData CreateRoutingControl
instance Core.ToHeaders CreateRoutingControl where
toHeaders :: CreateRoutingControl -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateRoutingControl -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON CreateRoutingControl where
toJSON :: CreateRoutingControl -> Value
toJSON CreateRoutingControl' {Maybe Text
Text
routingControlName :: Text
clusterArn :: Text
clientToken :: Maybe Text
controlPanelArn :: Maybe Text
$sel:routingControlName:CreateRoutingControl' :: CreateRoutingControl -> Text
$sel:clusterArn:CreateRoutingControl' :: CreateRoutingControl -> Text
$sel:clientToken:CreateRoutingControl' :: CreateRoutingControl -> Maybe Text
$sel:controlPanelArn:CreateRoutingControl' :: CreateRoutingControl -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ControlPanelArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
controlPanelArn,
(Text
"ClientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientToken,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ClusterArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clusterArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"RoutingControlName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
routingControlName)
]
)
instance Core.ToPath CreateRoutingControl where
toPath :: CreateRoutingControl -> ByteString
toPath = ByteString -> CreateRoutingControl -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/routingcontrol"
instance Core.ToQuery CreateRoutingControl where
toQuery :: CreateRoutingControl -> QueryString
toQuery = QueryString -> CreateRoutingControl -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateRoutingControlResponse = CreateRoutingControlResponse'
{
CreateRoutingControlResponse -> Maybe RoutingControl
routingControl :: Prelude.Maybe RoutingControl,
CreateRoutingControlResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateRoutingControlResponse
-> CreateRoutingControlResponse -> Bool
(CreateRoutingControlResponse
-> CreateRoutingControlResponse -> Bool)
-> (CreateRoutingControlResponse
-> CreateRoutingControlResponse -> Bool)
-> Eq CreateRoutingControlResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRoutingControlResponse
-> CreateRoutingControlResponse -> Bool
$c/= :: CreateRoutingControlResponse
-> CreateRoutingControlResponse -> Bool
== :: CreateRoutingControlResponse
-> CreateRoutingControlResponse -> Bool
$c== :: CreateRoutingControlResponse
-> CreateRoutingControlResponse -> Bool
Prelude.Eq, ReadPrec [CreateRoutingControlResponse]
ReadPrec CreateRoutingControlResponse
Int -> ReadS CreateRoutingControlResponse
ReadS [CreateRoutingControlResponse]
(Int -> ReadS CreateRoutingControlResponse)
-> ReadS [CreateRoutingControlResponse]
-> ReadPrec CreateRoutingControlResponse
-> ReadPrec [CreateRoutingControlResponse]
-> Read CreateRoutingControlResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRoutingControlResponse]
$creadListPrec :: ReadPrec [CreateRoutingControlResponse]
readPrec :: ReadPrec CreateRoutingControlResponse
$creadPrec :: ReadPrec CreateRoutingControlResponse
readList :: ReadS [CreateRoutingControlResponse]
$creadList :: ReadS [CreateRoutingControlResponse]
readsPrec :: Int -> ReadS CreateRoutingControlResponse
$creadsPrec :: Int -> ReadS CreateRoutingControlResponse
Prelude.Read, Int -> CreateRoutingControlResponse -> ShowS
[CreateRoutingControlResponse] -> ShowS
CreateRoutingControlResponse -> String
(Int -> CreateRoutingControlResponse -> ShowS)
-> (CreateRoutingControlResponse -> String)
-> ([CreateRoutingControlResponse] -> ShowS)
-> Show CreateRoutingControlResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRoutingControlResponse] -> ShowS
$cshowList :: [CreateRoutingControlResponse] -> ShowS
show :: CreateRoutingControlResponse -> String
$cshow :: CreateRoutingControlResponse -> String
showsPrec :: Int -> CreateRoutingControlResponse -> ShowS
$cshowsPrec :: Int -> CreateRoutingControlResponse -> ShowS
Prelude.Show, (forall x.
CreateRoutingControlResponse -> Rep CreateRoutingControlResponse x)
-> (forall x.
Rep CreateRoutingControlResponse x -> CreateRoutingControlResponse)
-> Generic CreateRoutingControlResponse
forall x.
Rep CreateRoutingControlResponse x -> CreateRoutingControlResponse
forall x.
CreateRoutingControlResponse -> Rep CreateRoutingControlResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateRoutingControlResponse x -> CreateRoutingControlResponse
$cfrom :: forall x.
CreateRoutingControlResponse -> Rep CreateRoutingControlResponse x
Prelude.Generic)
newCreateRoutingControlResponse ::
Prelude.Int ->
CreateRoutingControlResponse
newCreateRoutingControlResponse :: Int -> CreateRoutingControlResponse
newCreateRoutingControlResponse Int
pHttpStatus_ =
CreateRoutingControlResponse' :: Maybe RoutingControl -> Int -> CreateRoutingControlResponse
CreateRoutingControlResponse'
{ $sel:routingControl:CreateRoutingControlResponse' :: Maybe RoutingControl
routingControl =
Maybe RoutingControl
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateRoutingControlResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createRoutingControlResponse_routingControl :: Lens.Lens' CreateRoutingControlResponse (Prelude.Maybe RoutingControl)
createRoutingControlResponse_routingControl :: (Maybe RoutingControl -> f (Maybe RoutingControl))
-> CreateRoutingControlResponse -> f CreateRoutingControlResponse
createRoutingControlResponse_routingControl = (CreateRoutingControlResponse -> Maybe RoutingControl)
-> (CreateRoutingControlResponse
-> Maybe RoutingControl -> CreateRoutingControlResponse)
-> Lens
CreateRoutingControlResponse
CreateRoutingControlResponse
(Maybe RoutingControl)
(Maybe RoutingControl)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoutingControlResponse' {Maybe RoutingControl
routingControl :: Maybe RoutingControl
$sel:routingControl:CreateRoutingControlResponse' :: CreateRoutingControlResponse -> Maybe RoutingControl
routingControl} -> Maybe RoutingControl
routingControl) (\s :: CreateRoutingControlResponse
s@CreateRoutingControlResponse' {} Maybe RoutingControl
a -> CreateRoutingControlResponse
s {$sel:routingControl:CreateRoutingControlResponse' :: Maybe RoutingControl
routingControl = Maybe RoutingControl
a} :: CreateRoutingControlResponse)
createRoutingControlResponse_httpStatus :: Lens.Lens' CreateRoutingControlResponse Prelude.Int
createRoutingControlResponse_httpStatus :: (Int -> f Int)
-> CreateRoutingControlResponse -> f CreateRoutingControlResponse
createRoutingControlResponse_httpStatus = (CreateRoutingControlResponse -> Int)
-> (CreateRoutingControlResponse
-> Int -> CreateRoutingControlResponse)
-> Lens
CreateRoutingControlResponse CreateRoutingControlResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoutingControlResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateRoutingControlResponse' :: CreateRoutingControlResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateRoutingControlResponse
s@CreateRoutingControlResponse' {} Int
a -> CreateRoutingControlResponse
s {$sel:httpStatus:CreateRoutingControlResponse' :: Int
httpStatus = Int
a} :: CreateRoutingControlResponse)
instance Prelude.NFData CreateRoutingControlResponse