{-# 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.DescribeRegions
(
DescribeRegions (..),
newDescribeRegions,
describeRegions_regionName,
describeRegions_nextToken,
describeRegions_directoryId,
DescribeRegionsResponse (..),
newDescribeRegionsResponse,
describeRegionsResponse_nextToken,
describeRegionsResponse_regionsDescription,
describeRegionsResponse_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 DescribeRegions = DescribeRegions'
{
DescribeRegions -> Maybe Text
regionName :: Prelude.Maybe Prelude.Text,
DescribeRegions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
DescribeRegions -> Text
directoryId :: Prelude.Text
}
deriving (DescribeRegions -> DescribeRegions -> Bool
(DescribeRegions -> DescribeRegions -> Bool)
-> (DescribeRegions -> DescribeRegions -> Bool)
-> Eq DescribeRegions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeRegions -> DescribeRegions -> Bool
$c/= :: DescribeRegions -> DescribeRegions -> Bool
== :: DescribeRegions -> DescribeRegions -> Bool
$c== :: DescribeRegions -> DescribeRegions -> Bool
Prelude.Eq, ReadPrec [DescribeRegions]
ReadPrec DescribeRegions
Int -> ReadS DescribeRegions
ReadS [DescribeRegions]
(Int -> ReadS DescribeRegions)
-> ReadS [DescribeRegions]
-> ReadPrec DescribeRegions
-> ReadPrec [DescribeRegions]
-> Read DescribeRegions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeRegions]
$creadListPrec :: ReadPrec [DescribeRegions]
readPrec :: ReadPrec DescribeRegions
$creadPrec :: ReadPrec DescribeRegions
readList :: ReadS [DescribeRegions]
$creadList :: ReadS [DescribeRegions]
readsPrec :: Int -> ReadS DescribeRegions
$creadsPrec :: Int -> ReadS DescribeRegions
Prelude.Read, Int -> DescribeRegions -> ShowS
[DescribeRegions] -> ShowS
DescribeRegions -> String
(Int -> DescribeRegions -> ShowS)
-> (DescribeRegions -> String)
-> ([DescribeRegions] -> ShowS)
-> Show DescribeRegions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeRegions] -> ShowS
$cshowList :: [DescribeRegions] -> ShowS
show :: DescribeRegions -> String
$cshow :: DescribeRegions -> String
showsPrec :: Int -> DescribeRegions -> ShowS
$cshowsPrec :: Int -> DescribeRegions -> ShowS
Prelude.Show, (forall x. DescribeRegions -> Rep DescribeRegions x)
-> (forall x. Rep DescribeRegions x -> DescribeRegions)
-> Generic DescribeRegions
forall x. Rep DescribeRegions x -> DescribeRegions
forall x. DescribeRegions -> Rep DescribeRegions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeRegions x -> DescribeRegions
$cfrom :: forall x. DescribeRegions -> Rep DescribeRegions x
Prelude.Generic)
newDescribeRegions ::
Prelude.Text ->
DescribeRegions
newDescribeRegions :: Text -> DescribeRegions
newDescribeRegions Text
pDirectoryId_ =
DescribeRegions' :: Maybe Text -> Maybe Text -> Text -> DescribeRegions
DescribeRegions'
{ $sel:regionName:DescribeRegions' :: Maybe Text
regionName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:DescribeRegions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:directoryId:DescribeRegions' :: Text
directoryId = Text
pDirectoryId_
}
describeRegions_regionName :: Lens.Lens' DescribeRegions (Prelude.Maybe Prelude.Text)
describeRegions_regionName :: (Maybe Text -> f (Maybe Text))
-> DescribeRegions -> f DescribeRegions
describeRegions_regionName = (DescribeRegions -> Maybe Text)
-> (DescribeRegions -> Maybe Text -> DescribeRegions)
-> Lens DescribeRegions DescribeRegions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRegions' {Maybe Text
regionName :: Maybe Text
$sel:regionName:DescribeRegions' :: DescribeRegions -> Maybe Text
regionName} -> Maybe Text
regionName) (\s :: DescribeRegions
s@DescribeRegions' {} Maybe Text
a -> DescribeRegions
s {$sel:regionName:DescribeRegions' :: Maybe Text
regionName = Maybe Text
a} :: DescribeRegions)
describeRegions_nextToken :: Lens.Lens' DescribeRegions (Prelude.Maybe Prelude.Text)
describeRegions_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeRegions -> f DescribeRegions
describeRegions_nextToken = (DescribeRegions -> Maybe Text)
-> (DescribeRegions -> Maybe Text -> DescribeRegions)
-> Lens DescribeRegions DescribeRegions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRegions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeRegions' :: DescribeRegions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeRegions
s@DescribeRegions' {} Maybe Text
a -> DescribeRegions
s {$sel:nextToken:DescribeRegions' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeRegions)
describeRegions_directoryId :: Lens.Lens' DescribeRegions Prelude.Text
describeRegions_directoryId :: (Text -> f Text) -> DescribeRegions -> f DescribeRegions
describeRegions_directoryId = (DescribeRegions -> Text)
-> (DescribeRegions -> Text -> DescribeRegions)
-> Lens DescribeRegions DescribeRegions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRegions' {Text
directoryId :: Text
$sel:directoryId:DescribeRegions' :: DescribeRegions -> Text
directoryId} -> Text
directoryId) (\s :: DescribeRegions
s@DescribeRegions' {} Text
a -> DescribeRegions
s {$sel:directoryId:DescribeRegions' :: Text
directoryId = Text
a} :: DescribeRegions)
instance Core.AWSRequest DescribeRegions where
type
AWSResponse DescribeRegions =
DescribeRegionsResponse
request :: DescribeRegions -> Request DescribeRegions
request = Service -> DescribeRegions -> Request DescribeRegions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeRegions
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeRegions)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeRegions))
-> Logger
-> Service
-> Proxy DescribeRegions
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeRegions)))
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
-> Maybe [RegionDescription] -> Int -> DescribeRegionsResponse
DescribeRegionsResponse'
(Maybe Text
-> Maybe [RegionDescription] -> Int -> DescribeRegionsResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe [RegionDescription] -> Int -> DescribeRegionsResponse)
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
"NextToken")
Either
String
(Maybe [RegionDescription] -> Int -> DescribeRegionsResponse)
-> Either String (Maybe [RegionDescription])
-> Either String (Int -> DescribeRegionsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe (Maybe [RegionDescription]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"RegionsDescription"
Either String (Maybe (Maybe [RegionDescription]))
-> Maybe [RegionDescription]
-> Either String (Maybe [RegionDescription])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [RegionDescription]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> DescribeRegionsResponse)
-> Either String Int -> Either String DescribeRegionsResponse
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 DescribeRegions
instance Prelude.NFData DescribeRegions
instance Core.ToHeaders DescribeRegions where
toHeaders :: DescribeRegions -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeRegions -> 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.DescribeRegions" ::
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 DescribeRegions where
toJSON :: DescribeRegions -> Value
toJSON DescribeRegions' {Maybe Text
Text
directoryId :: Text
nextToken :: Maybe Text
regionName :: Maybe Text
$sel:directoryId:DescribeRegions' :: DescribeRegions -> Text
$sel:nextToken:DescribeRegions' :: DescribeRegions -> Maybe Text
$sel:regionName:DescribeRegions' :: DescribeRegions -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"RegionName" 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
regionName,
(Text
"NextToken" 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
nextToken,
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)
]
)
instance Core.ToPath DescribeRegions where
toPath :: DescribeRegions -> ByteString
toPath = ByteString -> DescribeRegions -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeRegions where
toQuery :: DescribeRegions -> QueryString
toQuery = QueryString -> DescribeRegions -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeRegionsResponse = DescribeRegionsResponse'
{
DescribeRegionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
DescribeRegionsResponse -> Maybe [RegionDescription]
regionsDescription :: Prelude.Maybe [RegionDescription],
DescribeRegionsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeRegionsResponse -> DescribeRegionsResponse -> Bool
(DescribeRegionsResponse -> DescribeRegionsResponse -> Bool)
-> (DescribeRegionsResponse -> DescribeRegionsResponse -> Bool)
-> Eq DescribeRegionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeRegionsResponse -> DescribeRegionsResponse -> Bool
$c/= :: DescribeRegionsResponse -> DescribeRegionsResponse -> Bool
== :: DescribeRegionsResponse -> DescribeRegionsResponse -> Bool
$c== :: DescribeRegionsResponse -> DescribeRegionsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeRegionsResponse]
ReadPrec DescribeRegionsResponse
Int -> ReadS DescribeRegionsResponse
ReadS [DescribeRegionsResponse]
(Int -> ReadS DescribeRegionsResponse)
-> ReadS [DescribeRegionsResponse]
-> ReadPrec DescribeRegionsResponse
-> ReadPrec [DescribeRegionsResponse]
-> Read DescribeRegionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeRegionsResponse]
$creadListPrec :: ReadPrec [DescribeRegionsResponse]
readPrec :: ReadPrec DescribeRegionsResponse
$creadPrec :: ReadPrec DescribeRegionsResponse
readList :: ReadS [DescribeRegionsResponse]
$creadList :: ReadS [DescribeRegionsResponse]
readsPrec :: Int -> ReadS DescribeRegionsResponse
$creadsPrec :: Int -> ReadS DescribeRegionsResponse
Prelude.Read, Int -> DescribeRegionsResponse -> ShowS
[DescribeRegionsResponse] -> ShowS
DescribeRegionsResponse -> String
(Int -> DescribeRegionsResponse -> ShowS)
-> (DescribeRegionsResponse -> String)
-> ([DescribeRegionsResponse] -> ShowS)
-> Show DescribeRegionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeRegionsResponse] -> ShowS
$cshowList :: [DescribeRegionsResponse] -> ShowS
show :: DescribeRegionsResponse -> String
$cshow :: DescribeRegionsResponse -> String
showsPrec :: Int -> DescribeRegionsResponse -> ShowS
$cshowsPrec :: Int -> DescribeRegionsResponse -> ShowS
Prelude.Show, (forall x.
DescribeRegionsResponse -> Rep DescribeRegionsResponse x)
-> (forall x.
Rep DescribeRegionsResponse x -> DescribeRegionsResponse)
-> Generic DescribeRegionsResponse
forall x. Rep DescribeRegionsResponse x -> DescribeRegionsResponse
forall x. DescribeRegionsResponse -> Rep DescribeRegionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeRegionsResponse x -> DescribeRegionsResponse
$cfrom :: forall x. DescribeRegionsResponse -> Rep DescribeRegionsResponse x
Prelude.Generic)
newDescribeRegionsResponse ::
Prelude.Int ->
DescribeRegionsResponse
newDescribeRegionsResponse :: Int -> DescribeRegionsResponse
newDescribeRegionsResponse Int
pHttpStatus_ =
DescribeRegionsResponse' :: Maybe Text
-> Maybe [RegionDescription] -> Int -> DescribeRegionsResponse
DescribeRegionsResponse'
{ $sel:nextToken:DescribeRegionsResponse' :: Maybe Text
nextToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:regionsDescription:DescribeRegionsResponse' :: Maybe [RegionDescription]
regionsDescription = Maybe [RegionDescription]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeRegionsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeRegionsResponse_nextToken :: Lens.Lens' DescribeRegionsResponse (Prelude.Maybe Prelude.Text)
describeRegionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeRegionsResponse -> f DescribeRegionsResponse
describeRegionsResponse_nextToken = (DescribeRegionsResponse -> Maybe Text)
-> (DescribeRegionsResponse
-> Maybe Text -> DescribeRegionsResponse)
-> Lens
DescribeRegionsResponse
DescribeRegionsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRegionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeRegionsResponse' :: DescribeRegionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeRegionsResponse
s@DescribeRegionsResponse' {} Maybe Text
a -> DescribeRegionsResponse
s {$sel:nextToken:DescribeRegionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeRegionsResponse)
describeRegionsResponse_regionsDescription :: Lens.Lens' DescribeRegionsResponse (Prelude.Maybe [RegionDescription])
describeRegionsResponse_regionsDescription :: (Maybe [RegionDescription] -> f (Maybe [RegionDescription]))
-> DescribeRegionsResponse -> f DescribeRegionsResponse
describeRegionsResponse_regionsDescription = (DescribeRegionsResponse -> Maybe [RegionDescription])
-> (DescribeRegionsResponse
-> Maybe [RegionDescription] -> DescribeRegionsResponse)
-> Lens
DescribeRegionsResponse
DescribeRegionsResponse
(Maybe [RegionDescription])
(Maybe [RegionDescription])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRegionsResponse' {Maybe [RegionDescription]
regionsDescription :: Maybe [RegionDescription]
$sel:regionsDescription:DescribeRegionsResponse' :: DescribeRegionsResponse -> Maybe [RegionDescription]
regionsDescription} -> Maybe [RegionDescription]
regionsDescription) (\s :: DescribeRegionsResponse
s@DescribeRegionsResponse' {} Maybe [RegionDescription]
a -> DescribeRegionsResponse
s {$sel:regionsDescription:DescribeRegionsResponse' :: Maybe [RegionDescription]
regionsDescription = Maybe [RegionDescription]
a} :: DescribeRegionsResponse) ((Maybe [RegionDescription] -> f (Maybe [RegionDescription]))
-> DescribeRegionsResponse -> f DescribeRegionsResponse)
-> ((Maybe [RegionDescription] -> f (Maybe [RegionDescription]))
-> Maybe [RegionDescription] -> f (Maybe [RegionDescription]))
-> (Maybe [RegionDescription] -> f (Maybe [RegionDescription]))
-> DescribeRegionsResponse
-> f DescribeRegionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[RegionDescription]
[RegionDescription]
[RegionDescription]
[RegionDescription]
-> Iso
(Maybe [RegionDescription])
(Maybe [RegionDescription])
(Maybe [RegionDescription])
(Maybe [RegionDescription])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[RegionDescription]
[RegionDescription]
[RegionDescription]
[RegionDescription]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeRegionsResponse_httpStatus :: Lens.Lens' DescribeRegionsResponse Prelude.Int
describeRegionsResponse_httpStatus :: (Int -> f Int)
-> DescribeRegionsResponse -> f DescribeRegionsResponse
describeRegionsResponse_httpStatus = (DescribeRegionsResponse -> Int)
-> (DescribeRegionsResponse -> Int -> DescribeRegionsResponse)
-> Lens DescribeRegionsResponse DescribeRegionsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRegionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeRegionsResponse' :: DescribeRegionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeRegionsResponse
s@DescribeRegionsResponse' {} Int
a -> DescribeRegionsResponse
s {$sel:httpStatus:DescribeRegionsResponse' :: Int
httpStatus = Int
a} :: DescribeRegionsResponse)
instance Prelude.NFData DescribeRegionsResponse