{-# 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.MigrationHubConfig.CreateHomeRegionControl
(
CreateHomeRegionControl (..),
newCreateHomeRegionControl,
createHomeRegionControl_dryRun,
createHomeRegionControl_homeRegion,
createHomeRegionControl_target,
CreateHomeRegionControlResponse (..),
newCreateHomeRegionControlResponse,
createHomeRegionControlResponse_homeRegionControl,
createHomeRegionControlResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MigrationHubConfig.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateHomeRegionControl = CreateHomeRegionControl'
{
CreateHomeRegionControl -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
CreateHomeRegionControl -> Text
homeRegion :: Prelude.Text,
CreateHomeRegionControl -> Target
target :: Target
}
deriving (CreateHomeRegionControl -> CreateHomeRegionControl -> Bool
(CreateHomeRegionControl -> CreateHomeRegionControl -> Bool)
-> (CreateHomeRegionControl -> CreateHomeRegionControl -> Bool)
-> Eq CreateHomeRegionControl
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateHomeRegionControl -> CreateHomeRegionControl -> Bool
$c/= :: CreateHomeRegionControl -> CreateHomeRegionControl -> Bool
== :: CreateHomeRegionControl -> CreateHomeRegionControl -> Bool
$c== :: CreateHomeRegionControl -> CreateHomeRegionControl -> Bool
Prelude.Eq, ReadPrec [CreateHomeRegionControl]
ReadPrec CreateHomeRegionControl
Int -> ReadS CreateHomeRegionControl
ReadS [CreateHomeRegionControl]
(Int -> ReadS CreateHomeRegionControl)
-> ReadS [CreateHomeRegionControl]
-> ReadPrec CreateHomeRegionControl
-> ReadPrec [CreateHomeRegionControl]
-> Read CreateHomeRegionControl
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateHomeRegionControl]
$creadListPrec :: ReadPrec [CreateHomeRegionControl]
readPrec :: ReadPrec CreateHomeRegionControl
$creadPrec :: ReadPrec CreateHomeRegionControl
readList :: ReadS [CreateHomeRegionControl]
$creadList :: ReadS [CreateHomeRegionControl]
readsPrec :: Int -> ReadS CreateHomeRegionControl
$creadsPrec :: Int -> ReadS CreateHomeRegionControl
Prelude.Read, Int -> CreateHomeRegionControl -> ShowS
[CreateHomeRegionControl] -> ShowS
CreateHomeRegionControl -> String
(Int -> CreateHomeRegionControl -> ShowS)
-> (CreateHomeRegionControl -> String)
-> ([CreateHomeRegionControl] -> ShowS)
-> Show CreateHomeRegionControl
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateHomeRegionControl] -> ShowS
$cshowList :: [CreateHomeRegionControl] -> ShowS
show :: CreateHomeRegionControl -> String
$cshow :: CreateHomeRegionControl -> String
showsPrec :: Int -> CreateHomeRegionControl -> ShowS
$cshowsPrec :: Int -> CreateHomeRegionControl -> ShowS
Prelude.Show, (forall x.
CreateHomeRegionControl -> Rep CreateHomeRegionControl x)
-> (forall x.
Rep CreateHomeRegionControl x -> CreateHomeRegionControl)
-> Generic CreateHomeRegionControl
forall x. Rep CreateHomeRegionControl x -> CreateHomeRegionControl
forall x. CreateHomeRegionControl -> Rep CreateHomeRegionControl x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateHomeRegionControl x -> CreateHomeRegionControl
$cfrom :: forall x. CreateHomeRegionControl -> Rep CreateHomeRegionControl x
Prelude.Generic)
newCreateHomeRegionControl ::
Prelude.Text ->
Target ->
CreateHomeRegionControl
newCreateHomeRegionControl :: Text -> Target -> CreateHomeRegionControl
newCreateHomeRegionControl Text
pHomeRegion_ Target
pTarget_ =
CreateHomeRegionControl' :: Maybe Bool -> Text -> Target -> CreateHomeRegionControl
CreateHomeRegionControl'
{ $sel:dryRun:CreateHomeRegionControl' :: Maybe Bool
dryRun = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:homeRegion:CreateHomeRegionControl' :: Text
homeRegion = Text
pHomeRegion_,
$sel:target:CreateHomeRegionControl' :: Target
target = Target
pTarget_
}
createHomeRegionControl_dryRun :: Lens.Lens' CreateHomeRegionControl (Prelude.Maybe Prelude.Bool)
createHomeRegionControl_dryRun :: (Maybe Bool -> f (Maybe Bool))
-> CreateHomeRegionControl -> f CreateHomeRegionControl
createHomeRegionControl_dryRun = (CreateHomeRegionControl -> Maybe Bool)
-> (CreateHomeRegionControl
-> Maybe Bool -> CreateHomeRegionControl)
-> Lens
CreateHomeRegionControl
CreateHomeRegionControl
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHomeRegionControl' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:CreateHomeRegionControl' :: CreateHomeRegionControl -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: CreateHomeRegionControl
s@CreateHomeRegionControl' {} Maybe Bool
a -> CreateHomeRegionControl
s {$sel:dryRun:CreateHomeRegionControl' :: Maybe Bool
dryRun = Maybe Bool
a} :: CreateHomeRegionControl)
createHomeRegionControl_homeRegion :: Lens.Lens' CreateHomeRegionControl Prelude.Text
createHomeRegionControl_homeRegion :: (Text -> f Text)
-> CreateHomeRegionControl -> f CreateHomeRegionControl
createHomeRegionControl_homeRegion = (CreateHomeRegionControl -> Text)
-> (CreateHomeRegionControl -> Text -> CreateHomeRegionControl)
-> Lens CreateHomeRegionControl CreateHomeRegionControl Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHomeRegionControl' {Text
homeRegion :: Text
$sel:homeRegion:CreateHomeRegionControl' :: CreateHomeRegionControl -> Text
homeRegion} -> Text
homeRegion) (\s :: CreateHomeRegionControl
s@CreateHomeRegionControl' {} Text
a -> CreateHomeRegionControl
s {$sel:homeRegion:CreateHomeRegionControl' :: Text
homeRegion = Text
a} :: CreateHomeRegionControl)
createHomeRegionControl_target :: Lens.Lens' CreateHomeRegionControl Target
createHomeRegionControl_target :: (Target -> f Target)
-> CreateHomeRegionControl -> f CreateHomeRegionControl
createHomeRegionControl_target = (CreateHomeRegionControl -> Target)
-> (CreateHomeRegionControl -> Target -> CreateHomeRegionControl)
-> Lens
CreateHomeRegionControl CreateHomeRegionControl Target Target
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHomeRegionControl' {Target
target :: Target
$sel:target:CreateHomeRegionControl' :: CreateHomeRegionControl -> Target
target} -> Target
target) (\s :: CreateHomeRegionControl
s@CreateHomeRegionControl' {} Target
a -> CreateHomeRegionControl
s {$sel:target:CreateHomeRegionControl' :: Target
target = Target
a} :: CreateHomeRegionControl)
instance Core.AWSRequest CreateHomeRegionControl where
type
AWSResponse CreateHomeRegionControl =
CreateHomeRegionControlResponse
request :: CreateHomeRegionControl -> Request CreateHomeRegionControl
request = Service
-> CreateHomeRegionControl -> Request CreateHomeRegionControl
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateHomeRegionControl
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateHomeRegionControl)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateHomeRegionControl))
-> Logger
-> Service
-> Proxy CreateHomeRegionControl
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateHomeRegionControl)))
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 HomeRegionControl -> Int -> CreateHomeRegionControlResponse
CreateHomeRegionControlResponse'
(Maybe HomeRegionControl -> Int -> CreateHomeRegionControlResponse)
-> Either String (Maybe HomeRegionControl)
-> Either String (Int -> CreateHomeRegionControlResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe HomeRegionControl)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"HomeRegionControl")
Either String (Int -> CreateHomeRegionControlResponse)
-> Either String Int
-> Either String CreateHomeRegionControlResponse
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 CreateHomeRegionControl
instance Prelude.NFData CreateHomeRegionControl
instance Core.ToHeaders CreateHomeRegionControl where
toHeaders :: CreateHomeRegionControl -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateHomeRegionControl -> 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
"AWSMigrationHubMultiAccountService.CreateHomeRegionControl" ::
Prelude.ByteString
),
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 CreateHomeRegionControl where
toJSON :: CreateHomeRegionControl -> Value
toJSON CreateHomeRegionControl' {Maybe Bool
Text
Target
target :: Target
homeRegion :: Text
dryRun :: Maybe Bool
$sel:target:CreateHomeRegionControl' :: CreateHomeRegionControl -> Target
$sel:homeRegion:CreateHomeRegionControl' :: CreateHomeRegionControl -> Text
$sel:dryRun:CreateHomeRegionControl' :: CreateHomeRegionControl -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DryRun" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
dryRun,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"HomeRegion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
homeRegion),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Target" Text -> Target -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Target
target)
]
)
instance Core.ToPath CreateHomeRegionControl where
toPath :: CreateHomeRegionControl -> ByteString
toPath = ByteString -> CreateHomeRegionControl -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateHomeRegionControl where
toQuery :: CreateHomeRegionControl -> QueryString
toQuery = QueryString -> CreateHomeRegionControl -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateHomeRegionControlResponse = CreateHomeRegionControlResponse'
{
CreateHomeRegionControlResponse -> Maybe HomeRegionControl
homeRegionControl :: Prelude.Maybe HomeRegionControl,
CreateHomeRegionControlResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateHomeRegionControlResponse
-> CreateHomeRegionControlResponse -> Bool
(CreateHomeRegionControlResponse
-> CreateHomeRegionControlResponse -> Bool)
-> (CreateHomeRegionControlResponse
-> CreateHomeRegionControlResponse -> Bool)
-> Eq CreateHomeRegionControlResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateHomeRegionControlResponse
-> CreateHomeRegionControlResponse -> Bool
$c/= :: CreateHomeRegionControlResponse
-> CreateHomeRegionControlResponse -> Bool
== :: CreateHomeRegionControlResponse
-> CreateHomeRegionControlResponse -> Bool
$c== :: CreateHomeRegionControlResponse
-> CreateHomeRegionControlResponse -> Bool
Prelude.Eq, ReadPrec [CreateHomeRegionControlResponse]
ReadPrec CreateHomeRegionControlResponse
Int -> ReadS CreateHomeRegionControlResponse
ReadS [CreateHomeRegionControlResponse]
(Int -> ReadS CreateHomeRegionControlResponse)
-> ReadS [CreateHomeRegionControlResponse]
-> ReadPrec CreateHomeRegionControlResponse
-> ReadPrec [CreateHomeRegionControlResponse]
-> Read CreateHomeRegionControlResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateHomeRegionControlResponse]
$creadListPrec :: ReadPrec [CreateHomeRegionControlResponse]
readPrec :: ReadPrec CreateHomeRegionControlResponse
$creadPrec :: ReadPrec CreateHomeRegionControlResponse
readList :: ReadS [CreateHomeRegionControlResponse]
$creadList :: ReadS [CreateHomeRegionControlResponse]
readsPrec :: Int -> ReadS CreateHomeRegionControlResponse
$creadsPrec :: Int -> ReadS CreateHomeRegionControlResponse
Prelude.Read, Int -> CreateHomeRegionControlResponse -> ShowS
[CreateHomeRegionControlResponse] -> ShowS
CreateHomeRegionControlResponse -> String
(Int -> CreateHomeRegionControlResponse -> ShowS)
-> (CreateHomeRegionControlResponse -> String)
-> ([CreateHomeRegionControlResponse] -> ShowS)
-> Show CreateHomeRegionControlResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateHomeRegionControlResponse] -> ShowS
$cshowList :: [CreateHomeRegionControlResponse] -> ShowS
show :: CreateHomeRegionControlResponse -> String
$cshow :: CreateHomeRegionControlResponse -> String
showsPrec :: Int -> CreateHomeRegionControlResponse -> ShowS
$cshowsPrec :: Int -> CreateHomeRegionControlResponse -> ShowS
Prelude.Show, (forall x.
CreateHomeRegionControlResponse
-> Rep CreateHomeRegionControlResponse x)
-> (forall x.
Rep CreateHomeRegionControlResponse x
-> CreateHomeRegionControlResponse)
-> Generic CreateHomeRegionControlResponse
forall x.
Rep CreateHomeRegionControlResponse x
-> CreateHomeRegionControlResponse
forall x.
CreateHomeRegionControlResponse
-> Rep CreateHomeRegionControlResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateHomeRegionControlResponse x
-> CreateHomeRegionControlResponse
$cfrom :: forall x.
CreateHomeRegionControlResponse
-> Rep CreateHomeRegionControlResponse x
Prelude.Generic)
newCreateHomeRegionControlResponse ::
Prelude.Int ->
CreateHomeRegionControlResponse
newCreateHomeRegionControlResponse :: Int -> CreateHomeRegionControlResponse
newCreateHomeRegionControlResponse Int
pHttpStatus_ =
CreateHomeRegionControlResponse' :: Maybe HomeRegionControl -> Int -> CreateHomeRegionControlResponse
CreateHomeRegionControlResponse'
{ $sel:homeRegionControl:CreateHomeRegionControlResponse' :: Maybe HomeRegionControl
homeRegionControl =
Maybe HomeRegionControl
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateHomeRegionControlResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createHomeRegionControlResponse_homeRegionControl :: Lens.Lens' CreateHomeRegionControlResponse (Prelude.Maybe HomeRegionControl)
createHomeRegionControlResponse_homeRegionControl :: (Maybe HomeRegionControl -> f (Maybe HomeRegionControl))
-> CreateHomeRegionControlResponse
-> f CreateHomeRegionControlResponse
createHomeRegionControlResponse_homeRegionControl = (CreateHomeRegionControlResponse -> Maybe HomeRegionControl)
-> (CreateHomeRegionControlResponse
-> Maybe HomeRegionControl -> CreateHomeRegionControlResponse)
-> Lens
CreateHomeRegionControlResponse
CreateHomeRegionControlResponse
(Maybe HomeRegionControl)
(Maybe HomeRegionControl)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHomeRegionControlResponse' {Maybe HomeRegionControl
homeRegionControl :: Maybe HomeRegionControl
$sel:homeRegionControl:CreateHomeRegionControlResponse' :: CreateHomeRegionControlResponse -> Maybe HomeRegionControl
homeRegionControl} -> Maybe HomeRegionControl
homeRegionControl) (\s :: CreateHomeRegionControlResponse
s@CreateHomeRegionControlResponse' {} Maybe HomeRegionControl
a -> CreateHomeRegionControlResponse
s {$sel:homeRegionControl:CreateHomeRegionControlResponse' :: Maybe HomeRegionControl
homeRegionControl = Maybe HomeRegionControl
a} :: CreateHomeRegionControlResponse)
createHomeRegionControlResponse_httpStatus :: Lens.Lens' CreateHomeRegionControlResponse Prelude.Int
createHomeRegionControlResponse_httpStatus :: (Int -> f Int)
-> CreateHomeRegionControlResponse
-> f CreateHomeRegionControlResponse
createHomeRegionControlResponse_httpStatus = (CreateHomeRegionControlResponse -> Int)
-> (CreateHomeRegionControlResponse
-> Int -> CreateHomeRegionControlResponse)
-> Lens
CreateHomeRegionControlResponse
CreateHomeRegionControlResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHomeRegionControlResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateHomeRegionControlResponse' :: CreateHomeRegionControlResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateHomeRegionControlResponse
s@CreateHomeRegionControlResponse' {} Int
a -> CreateHomeRegionControlResponse
s {$sel:httpStatus:CreateHomeRegionControlResponse' :: Int
httpStatus = Int
a} :: CreateHomeRegionControlResponse)
instance
Prelude.NFData
CreateHomeRegionControlResponse