{-# 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.GetHomeRegion
(
GetHomeRegion (..),
newGetHomeRegion,
GetHomeRegionResponse (..),
newGetHomeRegionResponse,
getHomeRegionResponse_homeRegion,
getHomeRegionResponse_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 GetHomeRegion = GetHomeRegion'
{
}
deriving (GetHomeRegion -> GetHomeRegion -> Bool
(GetHomeRegion -> GetHomeRegion -> Bool)
-> (GetHomeRegion -> GetHomeRegion -> Bool) -> Eq GetHomeRegion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetHomeRegion -> GetHomeRegion -> Bool
$c/= :: GetHomeRegion -> GetHomeRegion -> Bool
== :: GetHomeRegion -> GetHomeRegion -> Bool
$c== :: GetHomeRegion -> GetHomeRegion -> Bool
Prelude.Eq, ReadPrec [GetHomeRegion]
ReadPrec GetHomeRegion
Int -> ReadS GetHomeRegion
ReadS [GetHomeRegion]
(Int -> ReadS GetHomeRegion)
-> ReadS [GetHomeRegion]
-> ReadPrec GetHomeRegion
-> ReadPrec [GetHomeRegion]
-> Read GetHomeRegion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetHomeRegion]
$creadListPrec :: ReadPrec [GetHomeRegion]
readPrec :: ReadPrec GetHomeRegion
$creadPrec :: ReadPrec GetHomeRegion
readList :: ReadS [GetHomeRegion]
$creadList :: ReadS [GetHomeRegion]
readsPrec :: Int -> ReadS GetHomeRegion
$creadsPrec :: Int -> ReadS GetHomeRegion
Prelude.Read, Int -> GetHomeRegion -> ShowS
[GetHomeRegion] -> ShowS
GetHomeRegion -> String
(Int -> GetHomeRegion -> ShowS)
-> (GetHomeRegion -> String)
-> ([GetHomeRegion] -> ShowS)
-> Show GetHomeRegion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetHomeRegion] -> ShowS
$cshowList :: [GetHomeRegion] -> ShowS
show :: GetHomeRegion -> String
$cshow :: GetHomeRegion -> String
showsPrec :: Int -> GetHomeRegion -> ShowS
$cshowsPrec :: Int -> GetHomeRegion -> ShowS
Prelude.Show, (forall x. GetHomeRegion -> Rep GetHomeRegion x)
-> (forall x. Rep GetHomeRegion x -> GetHomeRegion)
-> Generic GetHomeRegion
forall x. Rep GetHomeRegion x -> GetHomeRegion
forall x. GetHomeRegion -> Rep GetHomeRegion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetHomeRegion x -> GetHomeRegion
$cfrom :: forall x. GetHomeRegion -> Rep GetHomeRegion x
Prelude.Generic)
newGetHomeRegion ::
GetHomeRegion
newGetHomeRegion :: GetHomeRegion
newGetHomeRegion = GetHomeRegion
GetHomeRegion'
instance Core.AWSRequest GetHomeRegion where
type
AWSResponse GetHomeRegion =
GetHomeRegionResponse
request :: GetHomeRegion -> Request GetHomeRegion
request = Service -> GetHomeRegion -> Request GetHomeRegion
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetHomeRegion
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetHomeRegion)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetHomeRegion))
-> Logger
-> Service
-> Proxy GetHomeRegion
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetHomeRegion)))
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 Text -> Int -> GetHomeRegionResponse
GetHomeRegionResponse'
(Maybe Text -> Int -> GetHomeRegionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetHomeRegionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"HomeRegion")
Either String (Int -> GetHomeRegionResponse)
-> Either String Int -> Either String GetHomeRegionResponse
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 GetHomeRegion
instance Prelude.NFData GetHomeRegion
instance Core.ToHeaders GetHomeRegion where
toHeaders :: GetHomeRegion -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetHomeRegion -> 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.GetHomeRegion" ::
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 GetHomeRegion where
toJSON :: GetHomeRegion -> Value
toJSON = Value -> GetHomeRegion -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath GetHomeRegion where
toPath :: GetHomeRegion -> ByteString
toPath = ByteString -> GetHomeRegion -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetHomeRegion where
toQuery :: GetHomeRegion -> QueryString
toQuery = QueryString -> GetHomeRegion -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetHomeRegionResponse = GetHomeRegionResponse'
{
GetHomeRegionResponse -> Maybe Text
homeRegion :: Prelude.Maybe Prelude.Text,
GetHomeRegionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetHomeRegionResponse -> GetHomeRegionResponse -> Bool
(GetHomeRegionResponse -> GetHomeRegionResponse -> Bool)
-> (GetHomeRegionResponse -> GetHomeRegionResponse -> Bool)
-> Eq GetHomeRegionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetHomeRegionResponse -> GetHomeRegionResponse -> Bool
$c/= :: GetHomeRegionResponse -> GetHomeRegionResponse -> Bool
== :: GetHomeRegionResponse -> GetHomeRegionResponse -> Bool
$c== :: GetHomeRegionResponse -> GetHomeRegionResponse -> Bool
Prelude.Eq, ReadPrec [GetHomeRegionResponse]
ReadPrec GetHomeRegionResponse
Int -> ReadS GetHomeRegionResponse
ReadS [GetHomeRegionResponse]
(Int -> ReadS GetHomeRegionResponse)
-> ReadS [GetHomeRegionResponse]
-> ReadPrec GetHomeRegionResponse
-> ReadPrec [GetHomeRegionResponse]
-> Read GetHomeRegionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetHomeRegionResponse]
$creadListPrec :: ReadPrec [GetHomeRegionResponse]
readPrec :: ReadPrec GetHomeRegionResponse
$creadPrec :: ReadPrec GetHomeRegionResponse
readList :: ReadS [GetHomeRegionResponse]
$creadList :: ReadS [GetHomeRegionResponse]
readsPrec :: Int -> ReadS GetHomeRegionResponse
$creadsPrec :: Int -> ReadS GetHomeRegionResponse
Prelude.Read, Int -> GetHomeRegionResponse -> ShowS
[GetHomeRegionResponse] -> ShowS
GetHomeRegionResponse -> String
(Int -> GetHomeRegionResponse -> ShowS)
-> (GetHomeRegionResponse -> String)
-> ([GetHomeRegionResponse] -> ShowS)
-> Show GetHomeRegionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetHomeRegionResponse] -> ShowS
$cshowList :: [GetHomeRegionResponse] -> ShowS
show :: GetHomeRegionResponse -> String
$cshow :: GetHomeRegionResponse -> String
showsPrec :: Int -> GetHomeRegionResponse -> ShowS
$cshowsPrec :: Int -> GetHomeRegionResponse -> ShowS
Prelude.Show, (forall x. GetHomeRegionResponse -> Rep GetHomeRegionResponse x)
-> (forall x. Rep GetHomeRegionResponse x -> GetHomeRegionResponse)
-> Generic GetHomeRegionResponse
forall x. Rep GetHomeRegionResponse x -> GetHomeRegionResponse
forall x. GetHomeRegionResponse -> Rep GetHomeRegionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetHomeRegionResponse x -> GetHomeRegionResponse
$cfrom :: forall x. GetHomeRegionResponse -> Rep GetHomeRegionResponse x
Prelude.Generic)
newGetHomeRegionResponse ::
Prelude.Int ->
GetHomeRegionResponse
newGetHomeRegionResponse :: Int -> GetHomeRegionResponse
newGetHomeRegionResponse Int
pHttpStatus_ =
GetHomeRegionResponse' :: Maybe Text -> Int -> GetHomeRegionResponse
GetHomeRegionResponse'
{ $sel:homeRegion:GetHomeRegionResponse' :: Maybe Text
homeRegion =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetHomeRegionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getHomeRegionResponse_homeRegion :: Lens.Lens' GetHomeRegionResponse (Prelude.Maybe Prelude.Text)
getHomeRegionResponse_homeRegion :: (Maybe Text -> f (Maybe Text))
-> GetHomeRegionResponse -> f GetHomeRegionResponse
getHomeRegionResponse_homeRegion = (GetHomeRegionResponse -> Maybe Text)
-> (GetHomeRegionResponse -> Maybe Text -> GetHomeRegionResponse)
-> Lens
GetHomeRegionResponse
GetHomeRegionResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetHomeRegionResponse' {Maybe Text
homeRegion :: Maybe Text
$sel:homeRegion:GetHomeRegionResponse' :: GetHomeRegionResponse -> Maybe Text
homeRegion} -> Maybe Text
homeRegion) (\s :: GetHomeRegionResponse
s@GetHomeRegionResponse' {} Maybe Text
a -> GetHomeRegionResponse
s {$sel:homeRegion:GetHomeRegionResponse' :: Maybe Text
homeRegion = Maybe Text
a} :: GetHomeRegionResponse)
getHomeRegionResponse_httpStatus :: Lens.Lens' GetHomeRegionResponse Prelude.Int
getHomeRegionResponse_httpStatus :: (Int -> f Int) -> GetHomeRegionResponse -> f GetHomeRegionResponse
getHomeRegionResponse_httpStatus = (GetHomeRegionResponse -> Int)
-> (GetHomeRegionResponse -> Int -> GetHomeRegionResponse)
-> Lens GetHomeRegionResponse GetHomeRegionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetHomeRegionResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetHomeRegionResponse' :: GetHomeRegionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetHomeRegionResponse
s@GetHomeRegionResponse' {} Int
a -> GetHomeRegionResponse
s {$sel:httpStatus:GetHomeRegionResponse' :: Int
httpStatus = Int
a} :: GetHomeRegionResponse)
instance Prelude.NFData GetHomeRegionResponse