{-# 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.UpdateRoutingControl
(
UpdateRoutingControl (..),
newUpdateRoutingControl,
updateRoutingControl_routingControlName,
updateRoutingControl_routingControlArn,
UpdateRoutingControlResponse (..),
newUpdateRoutingControlResponse,
updateRoutingControlResponse_routingControl,
updateRoutingControlResponse_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 UpdateRoutingControl = UpdateRoutingControl'
{
UpdateRoutingControl -> Text
routingControlName :: Prelude.Text,
UpdateRoutingControl -> Text
routingControlArn :: Prelude.Text
}
deriving (UpdateRoutingControl -> UpdateRoutingControl -> Bool
(UpdateRoutingControl -> UpdateRoutingControl -> Bool)
-> (UpdateRoutingControl -> UpdateRoutingControl -> Bool)
-> Eq UpdateRoutingControl
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRoutingControl -> UpdateRoutingControl -> Bool
$c/= :: UpdateRoutingControl -> UpdateRoutingControl -> Bool
== :: UpdateRoutingControl -> UpdateRoutingControl -> Bool
$c== :: UpdateRoutingControl -> UpdateRoutingControl -> Bool
Prelude.Eq, ReadPrec [UpdateRoutingControl]
ReadPrec UpdateRoutingControl
Int -> ReadS UpdateRoutingControl
ReadS [UpdateRoutingControl]
(Int -> ReadS UpdateRoutingControl)
-> ReadS [UpdateRoutingControl]
-> ReadPrec UpdateRoutingControl
-> ReadPrec [UpdateRoutingControl]
-> Read UpdateRoutingControl
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRoutingControl]
$creadListPrec :: ReadPrec [UpdateRoutingControl]
readPrec :: ReadPrec UpdateRoutingControl
$creadPrec :: ReadPrec UpdateRoutingControl
readList :: ReadS [UpdateRoutingControl]
$creadList :: ReadS [UpdateRoutingControl]
readsPrec :: Int -> ReadS UpdateRoutingControl
$creadsPrec :: Int -> ReadS UpdateRoutingControl
Prelude.Read, Int -> UpdateRoutingControl -> ShowS
[UpdateRoutingControl] -> ShowS
UpdateRoutingControl -> String
(Int -> UpdateRoutingControl -> ShowS)
-> (UpdateRoutingControl -> String)
-> ([UpdateRoutingControl] -> ShowS)
-> Show UpdateRoutingControl
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRoutingControl] -> ShowS
$cshowList :: [UpdateRoutingControl] -> ShowS
show :: UpdateRoutingControl -> String
$cshow :: UpdateRoutingControl -> String
showsPrec :: Int -> UpdateRoutingControl -> ShowS
$cshowsPrec :: Int -> UpdateRoutingControl -> ShowS
Prelude.Show, (forall x. UpdateRoutingControl -> Rep UpdateRoutingControl x)
-> (forall x. Rep UpdateRoutingControl x -> UpdateRoutingControl)
-> Generic UpdateRoutingControl
forall x. Rep UpdateRoutingControl x -> UpdateRoutingControl
forall x. UpdateRoutingControl -> Rep UpdateRoutingControl x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateRoutingControl x -> UpdateRoutingControl
$cfrom :: forall x. UpdateRoutingControl -> Rep UpdateRoutingControl x
Prelude.Generic)
newUpdateRoutingControl ::
Prelude.Text ->
Prelude.Text ->
UpdateRoutingControl
newUpdateRoutingControl :: Text -> Text -> UpdateRoutingControl
newUpdateRoutingControl
Text
pRoutingControlName_
Text
pRoutingControlArn_ =
UpdateRoutingControl' :: Text -> Text -> UpdateRoutingControl
UpdateRoutingControl'
{ $sel:routingControlName:UpdateRoutingControl' :: Text
routingControlName =
Text
pRoutingControlName_,
$sel:routingControlArn:UpdateRoutingControl' :: Text
routingControlArn = Text
pRoutingControlArn_
}
updateRoutingControl_routingControlName :: Lens.Lens' UpdateRoutingControl Prelude.Text
updateRoutingControl_routingControlName :: (Text -> f Text) -> UpdateRoutingControl -> f UpdateRoutingControl
updateRoutingControl_routingControlName = (UpdateRoutingControl -> Text)
-> (UpdateRoutingControl -> Text -> UpdateRoutingControl)
-> Lens UpdateRoutingControl UpdateRoutingControl Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoutingControl' {Text
routingControlName :: Text
$sel:routingControlName:UpdateRoutingControl' :: UpdateRoutingControl -> Text
routingControlName} -> Text
routingControlName) (\s :: UpdateRoutingControl
s@UpdateRoutingControl' {} Text
a -> UpdateRoutingControl
s {$sel:routingControlName:UpdateRoutingControl' :: Text
routingControlName = Text
a} :: UpdateRoutingControl)
updateRoutingControl_routingControlArn :: Lens.Lens' UpdateRoutingControl Prelude.Text
updateRoutingControl_routingControlArn :: (Text -> f Text) -> UpdateRoutingControl -> f UpdateRoutingControl
updateRoutingControl_routingControlArn = (UpdateRoutingControl -> Text)
-> (UpdateRoutingControl -> Text -> UpdateRoutingControl)
-> Lens UpdateRoutingControl UpdateRoutingControl Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoutingControl' {Text
routingControlArn :: Text
$sel:routingControlArn:UpdateRoutingControl' :: UpdateRoutingControl -> Text
routingControlArn} -> Text
routingControlArn) (\s :: UpdateRoutingControl
s@UpdateRoutingControl' {} Text
a -> UpdateRoutingControl
s {$sel:routingControlArn:UpdateRoutingControl' :: Text
routingControlArn = Text
a} :: UpdateRoutingControl)
instance Core.AWSRequest UpdateRoutingControl where
type
AWSResponse UpdateRoutingControl =
UpdateRoutingControlResponse
request :: UpdateRoutingControl -> Request UpdateRoutingControl
request = Service -> UpdateRoutingControl -> Request UpdateRoutingControl
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateRoutingControl
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateRoutingControl)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateRoutingControl))
-> Logger
-> Service
-> Proxy UpdateRoutingControl
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateRoutingControl)))
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 -> UpdateRoutingControlResponse
UpdateRoutingControlResponse'
(Maybe RoutingControl -> Int -> UpdateRoutingControlResponse)
-> Either String (Maybe RoutingControl)
-> Either String (Int -> UpdateRoutingControlResponse)
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 -> UpdateRoutingControlResponse)
-> Either String Int -> Either String UpdateRoutingControlResponse
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 UpdateRoutingControl
instance Prelude.NFData UpdateRoutingControl
instance Core.ToHeaders UpdateRoutingControl where
toHeaders :: UpdateRoutingControl -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateRoutingControl -> 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 UpdateRoutingControl where
toJSON :: UpdateRoutingControl -> Value
toJSON UpdateRoutingControl' {Text
routingControlArn :: Text
routingControlName :: Text
$sel:routingControlArn:UpdateRoutingControl' :: UpdateRoutingControl -> Text
$sel:routingControlName:UpdateRoutingControl' :: UpdateRoutingControl -> 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
"RoutingControlName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
routingControlName),
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 UpdateRoutingControl where
toPath :: UpdateRoutingControl -> ByteString
toPath = ByteString -> UpdateRoutingControl -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/routingcontrol"
instance Core.ToQuery UpdateRoutingControl where
toQuery :: UpdateRoutingControl -> QueryString
toQuery = QueryString -> UpdateRoutingControl -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateRoutingControlResponse = UpdateRoutingControlResponse'
{
UpdateRoutingControlResponse -> Maybe RoutingControl
routingControl :: Prelude.Maybe RoutingControl,
UpdateRoutingControlResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateRoutingControlResponse
-> UpdateRoutingControlResponse -> Bool
(UpdateRoutingControlResponse
-> UpdateRoutingControlResponse -> Bool)
-> (UpdateRoutingControlResponse
-> UpdateRoutingControlResponse -> Bool)
-> Eq UpdateRoutingControlResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRoutingControlResponse
-> UpdateRoutingControlResponse -> Bool
$c/= :: UpdateRoutingControlResponse
-> UpdateRoutingControlResponse -> Bool
== :: UpdateRoutingControlResponse
-> UpdateRoutingControlResponse -> Bool
$c== :: UpdateRoutingControlResponse
-> UpdateRoutingControlResponse -> Bool
Prelude.Eq, ReadPrec [UpdateRoutingControlResponse]
ReadPrec UpdateRoutingControlResponse
Int -> ReadS UpdateRoutingControlResponse
ReadS [UpdateRoutingControlResponse]
(Int -> ReadS UpdateRoutingControlResponse)
-> ReadS [UpdateRoutingControlResponse]
-> ReadPrec UpdateRoutingControlResponse
-> ReadPrec [UpdateRoutingControlResponse]
-> Read UpdateRoutingControlResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRoutingControlResponse]
$creadListPrec :: ReadPrec [UpdateRoutingControlResponse]
readPrec :: ReadPrec UpdateRoutingControlResponse
$creadPrec :: ReadPrec UpdateRoutingControlResponse
readList :: ReadS [UpdateRoutingControlResponse]
$creadList :: ReadS [UpdateRoutingControlResponse]
readsPrec :: Int -> ReadS UpdateRoutingControlResponse
$creadsPrec :: Int -> ReadS UpdateRoutingControlResponse
Prelude.Read, Int -> UpdateRoutingControlResponse -> ShowS
[UpdateRoutingControlResponse] -> ShowS
UpdateRoutingControlResponse -> String
(Int -> UpdateRoutingControlResponse -> ShowS)
-> (UpdateRoutingControlResponse -> String)
-> ([UpdateRoutingControlResponse] -> ShowS)
-> Show UpdateRoutingControlResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRoutingControlResponse] -> ShowS
$cshowList :: [UpdateRoutingControlResponse] -> ShowS
show :: UpdateRoutingControlResponse -> String
$cshow :: UpdateRoutingControlResponse -> String
showsPrec :: Int -> UpdateRoutingControlResponse -> ShowS
$cshowsPrec :: Int -> UpdateRoutingControlResponse -> ShowS
Prelude.Show, (forall x.
UpdateRoutingControlResponse -> Rep UpdateRoutingControlResponse x)
-> (forall x.
Rep UpdateRoutingControlResponse x -> UpdateRoutingControlResponse)
-> Generic UpdateRoutingControlResponse
forall x.
Rep UpdateRoutingControlResponse x -> UpdateRoutingControlResponse
forall x.
UpdateRoutingControlResponse -> Rep UpdateRoutingControlResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateRoutingControlResponse x -> UpdateRoutingControlResponse
$cfrom :: forall x.
UpdateRoutingControlResponse -> Rep UpdateRoutingControlResponse x
Prelude.Generic)
newUpdateRoutingControlResponse ::
Prelude.Int ->
UpdateRoutingControlResponse
newUpdateRoutingControlResponse :: Int -> UpdateRoutingControlResponse
newUpdateRoutingControlResponse Int
pHttpStatus_ =
UpdateRoutingControlResponse' :: Maybe RoutingControl -> Int -> UpdateRoutingControlResponse
UpdateRoutingControlResponse'
{ $sel:routingControl:UpdateRoutingControlResponse' :: Maybe RoutingControl
routingControl =
Maybe RoutingControl
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateRoutingControlResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateRoutingControlResponse_routingControl :: Lens.Lens' UpdateRoutingControlResponse (Prelude.Maybe RoutingControl)
updateRoutingControlResponse_routingControl :: (Maybe RoutingControl -> f (Maybe RoutingControl))
-> UpdateRoutingControlResponse -> f UpdateRoutingControlResponse
updateRoutingControlResponse_routingControl = (UpdateRoutingControlResponse -> Maybe RoutingControl)
-> (UpdateRoutingControlResponse
-> Maybe RoutingControl -> UpdateRoutingControlResponse)
-> Lens
UpdateRoutingControlResponse
UpdateRoutingControlResponse
(Maybe RoutingControl)
(Maybe RoutingControl)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoutingControlResponse' {Maybe RoutingControl
routingControl :: Maybe RoutingControl
$sel:routingControl:UpdateRoutingControlResponse' :: UpdateRoutingControlResponse -> Maybe RoutingControl
routingControl} -> Maybe RoutingControl
routingControl) (\s :: UpdateRoutingControlResponse
s@UpdateRoutingControlResponse' {} Maybe RoutingControl
a -> UpdateRoutingControlResponse
s {$sel:routingControl:UpdateRoutingControlResponse' :: Maybe RoutingControl
routingControl = Maybe RoutingControl
a} :: UpdateRoutingControlResponse)
updateRoutingControlResponse_httpStatus :: Lens.Lens' UpdateRoutingControlResponse Prelude.Int
updateRoutingControlResponse_httpStatus :: (Int -> f Int)
-> UpdateRoutingControlResponse -> f UpdateRoutingControlResponse
updateRoutingControlResponse_httpStatus = (UpdateRoutingControlResponse -> Int)
-> (UpdateRoutingControlResponse
-> Int -> UpdateRoutingControlResponse)
-> Lens
UpdateRoutingControlResponse UpdateRoutingControlResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoutingControlResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateRoutingControlResponse' :: UpdateRoutingControlResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateRoutingControlResponse
s@UpdateRoutingControlResponse' {} Int
a -> UpdateRoutingControlResponse
s {$sel:httpStatus:UpdateRoutingControlResponse' :: Int
httpStatus = Int
a} :: UpdateRoutingControlResponse)
instance Prelude.NFData UpdateRoutingControlResponse