{-# 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.DirectoryService.AddRegion
(
AddRegion (..),
newAddRegion,
addRegion_directoryId,
addRegion_regionName,
addRegion_vPCSettings,
AddRegionResponse (..),
newAddRegionResponse,
addRegionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DirectoryService.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AddRegion = AddRegion'
{
AddRegion -> Text
directoryId :: Prelude.Text,
AddRegion -> Text
regionName :: Prelude.Text,
AddRegion -> DirectoryVpcSettings
vPCSettings :: DirectoryVpcSettings
}
deriving (AddRegion -> AddRegion -> Bool
(AddRegion -> AddRegion -> Bool)
-> (AddRegion -> AddRegion -> Bool) -> Eq AddRegion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddRegion -> AddRegion -> Bool
$c/= :: AddRegion -> AddRegion -> Bool
== :: AddRegion -> AddRegion -> Bool
$c== :: AddRegion -> AddRegion -> Bool
Prelude.Eq, ReadPrec [AddRegion]
ReadPrec AddRegion
Int -> ReadS AddRegion
ReadS [AddRegion]
(Int -> ReadS AddRegion)
-> ReadS [AddRegion]
-> ReadPrec AddRegion
-> ReadPrec [AddRegion]
-> Read AddRegion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddRegion]
$creadListPrec :: ReadPrec [AddRegion]
readPrec :: ReadPrec AddRegion
$creadPrec :: ReadPrec AddRegion
readList :: ReadS [AddRegion]
$creadList :: ReadS [AddRegion]
readsPrec :: Int -> ReadS AddRegion
$creadsPrec :: Int -> ReadS AddRegion
Prelude.Read, Int -> AddRegion -> ShowS
[AddRegion] -> ShowS
AddRegion -> String
(Int -> AddRegion -> ShowS)
-> (AddRegion -> String)
-> ([AddRegion] -> ShowS)
-> Show AddRegion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddRegion] -> ShowS
$cshowList :: [AddRegion] -> ShowS
show :: AddRegion -> String
$cshow :: AddRegion -> String
showsPrec :: Int -> AddRegion -> ShowS
$cshowsPrec :: Int -> AddRegion -> ShowS
Prelude.Show, (forall x. AddRegion -> Rep AddRegion x)
-> (forall x. Rep AddRegion x -> AddRegion) -> Generic AddRegion
forall x. Rep AddRegion x -> AddRegion
forall x. AddRegion -> Rep AddRegion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddRegion x -> AddRegion
$cfrom :: forall x. AddRegion -> Rep AddRegion x
Prelude.Generic)
newAddRegion ::
Prelude.Text ->
Prelude.Text ->
DirectoryVpcSettings ->
AddRegion
newAddRegion :: Text -> Text -> DirectoryVpcSettings -> AddRegion
newAddRegion Text
pDirectoryId_ Text
pRegionName_ DirectoryVpcSettings
pVPCSettings_ =
AddRegion' :: Text -> Text -> DirectoryVpcSettings -> AddRegion
AddRegion'
{ $sel:directoryId:AddRegion' :: Text
directoryId = Text
pDirectoryId_,
$sel:regionName:AddRegion' :: Text
regionName = Text
pRegionName_,
$sel:vPCSettings:AddRegion' :: DirectoryVpcSettings
vPCSettings = DirectoryVpcSettings
pVPCSettings_
}
addRegion_directoryId :: Lens.Lens' AddRegion Prelude.Text
addRegion_directoryId :: (Text -> f Text) -> AddRegion -> f AddRegion
addRegion_directoryId = (AddRegion -> Text)
-> (AddRegion -> Text -> AddRegion)
-> Lens AddRegion AddRegion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddRegion' {Text
directoryId :: Text
$sel:directoryId:AddRegion' :: AddRegion -> Text
directoryId} -> Text
directoryId) (\s :: AddRegion
s@AddRegion' {} Text
a -> AddRegion
s {$sel:directoryId:AddRegion' :: Text
directoryId = Text
a} :: AddRegion)
addRegion_regionName :: Lens.Lens' AddRegion Prelude.Text
addRegion_regionName :: (Text -> f Text) -> AddRegion -> f AddRegion
addRegion_regionName = (AddRegion -> Text)
-> (AddRegion -> Text -> AddRegion)
-> Lens AddRegion AddRegion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddRegion' {Text
regionName :: Text
$sel:regionName:AddRegion' :: AddRegion -> Text
regionName} -> Text
regionName) (\s :: AddRegion
s@AddRegion' {} Text
a -> AddRegion
s {$sel:regionName:AddRegion' :: Text
regionName = Text
a} :: AddRegion)
addRegion_vPCSettings :: Lens.Lens' AddRegion DirectoryVpcSettings
addRegion_vPCSettings :: (DirectoryVpcSettings -> f DirectoryVpcSettings)
-> AddRegion -> f AddRegion
addRegion_vPCSettings = (AddRegion -> DirectoryVpcSettings)
-> (AddRegion -> DirectoryVpcSettings -> AddRegion)
-> Lens
AddRegion AddRegion DirectoryVpcSettings DirectoryVpcSettings
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddRegion' {DirectoryVpcSettings
vPCSettings :: DirectoryVpcSettings
$sel:vPCSettings:AddRegion' :: AddRegion -> DirectoryVpcSettings
vPCSettings} -> DirectoryVpcSettings
vPCSettings) (\s :: AddRegion
s@AddRegion' {} DirectoryVpcSettings
a -> AddRegion
s {$sel:vPCSettings:AddRegion' :: DirectoryVpcSettings
vPCSettings = DirectoryVpcSettings
a} :: AddRegion)
instance Core.AWSRequest AddRegion where
type AWSResponse AddRegion = AddRegionResponse
request :: AddRegion -> Request AddRegion
request = Service -> AddRegion -> Request AddRegion
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AddRegion
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AddRegion)))
response =
(Int
-> ResponseHeaders -> () -> Either String (AWSResponse AddRegion))
-> Logger
-> Service
-> Proxy AddRegion
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AddRegion)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> AddRegionResponse
AddRegionResponse'
(Int -> AddRegionResponse)
-> Either String Int -> Either String AddRegionResponse
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))
)
instance Prelude.Hashable AddRegion
instance Prelude.NFData AddRegion
instance Core.ToHeaders AddRegion where
toHeaders :: AddRegion -> ResponseHeaders
toHeaders =
ResponseHeaders -> AddRegion -> 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
"DirectoryService_20150416.AddRegion" ::
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 AddRegion where
toJSON :: AddRegion -> Value
toJSON AddRegion' {Text
DirectoryVpcSettings
vPCSettings :: DirectoryVpcSettings
regionName :: Text
directoryId :: Text
$sel:vPCSettings:AddRegion' :: AddRegion -> DirectoryVpcSettings
$sel:regionName:AddRegion' :: AddRegion -> Text
$sel:directoryId:AddRegion' :: AddRegion -> 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
"DirectoryId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
directoryId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"RegionName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
regionName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"VPCSettings" Text -> DirectoryVpcSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DirectoryVpcSettings
vPCSettings)
]
)
instance Core.ToPath AddRegion where
toPath :: AddRegion -> ByteString
toPath = ByteString -> AddRegion -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AddRegion where
toQuery :: AddRegion -> QueryString
toQuery = QueryString -> AddRegion -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AddRegionResponse = AddRegionResponse'
{
AddRegionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AddRegionResponse -> AddRegionResponse -> Bool
(AddRegionResponse -> AddRegionResponse -> Bool)
-> (AddRegionResponse -> AddRegionResponse -> Bool)
-> Eq AddRegionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddRegionResponse -> AddRegionResponse -> Bool
$c/= :: AddRegionResponse -> AddRegionResponse -> Bool
== :: AddRegionResponse -> AddRegionResponse -> Bool
$c== :: AddRegionResponse -> AddRegionResponse -> Bool
Prelude.Eq, ReadPrec [AddRegionResponse]
ReadPrec AddRegionResponse
Int -> ReadS AddRegionResponse
ReadS [AddRegionResponse]
(Int -> ReadS AddRegionResponse)
-> ReadS [AddRegionResponse]
-> ReadPrec AddRegionResponse
-> ReadPrec [AddRegionResponse]
-> Read AddRegionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddRegionResponse]
$creadListPrec :: ReadPrec [AddRegionResponse]
readPrec :: ReadPrec AddRegionResponse
$creadPrec :: ReadPrec AddRegionResponse
readList :: ReadS [AddRegionResponse]
$creadList :: ReadS [AddRegionResponse]
readsPrec :: Int -> ReadS AddRegionResponse
$creadsPrec :: Int -> ReadS AddRegionResponse
Prelude.Read, Int -> AddRegionResponse -> ShowS
[AddRegionResponse] -> ShowS
AddRegionResponse -> String
(Int -> AddRegionResponse -> ShowS)
-> (AddRegionResponse -> String)
-> ([AddRegionResponse] -> ShowS)
-> Show AddRegionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddRegionResponse] -> ShowS
$cshowList :: [AddRegionResponse] -> ShowS
show :: AddRegionResponse -> String
$cshow :: AddRegionResponse -> String
showsPrec :: Int -> AddRegionResponse -> ShowS
$cshowsPrec :: Int -> AddRegionResponse -> ShowS
Prelude.Show, (forall x. AddRegionResponse -> Rep AddRegionResponse x)
-> (forall x. Rep AddRegionResponse x -> AddRegionResponse)
-> Generic AddRegionResponse
forall x. Rep AddRegionResponse x -> AddRegionResponse
forall x. AddRegionResponse -> Rep AddRegionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddRegionResponse x -> AddRegionResponse
$cfrom :: forall x. AddRegionResponse -> Rep AddRegionResponse x
Prelude.Generic)
newAddRegionResponse ::
Prelude.Int ->
AddRegionResponse
newAddRegionResponse :: Int -> AddRegionResponse
newAddRegionResponse Int
pHttpStatus_ =
AddRegionResponse' :: Int -> AddRegionResponse
AddRegionResponse' {$sel:httpStatus:AddRegionResponse' :: Int
httpStatus = Int
pHttpStatus_}
addRegionResponse_httpStatus :: Lens.Lens' AddRegionResponse Prelude.Int
addRegionResponse_httpStatus :: (Int -> f Int) -> AddRegionResponse -> f AddRegionResponse
addRegionResponse_httpStatus = (AddRegionResponse -> Int)
-> (AddRegionResponse -> Int -> AddRegionResponse)
-> Lens AddRegionResponse AddRegionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddRegionResponse' {Int
httpStatus :: Int
$sel:httpStatus:AddRegionResponse' :: AddRegionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AddRegionResponse
s@AddRegionResponse' {} Int
a -> AddRegionResponse
s {$sel:httpStatus:AddRegionResponse' :: Int
httpStatus = Int
a} :: AddRegionResponse)
instance Prelude.NFData AddRegionResponse