{-# 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.WorkMail.ListMailDomains
(
ListMailDomains (..),
newListMailDomains,
listMailDomains_nextToken,
listMailDomains_maxResults,
listMailDomains_organizationId,
ListMailDomainsResponse (..),
newListMailDomainsResponse,
listMailDomainsResponse_nextToken,
listMailDomainsResponse_mailDomains,
listMailDomainsResponse_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.WorkMail.Types
data ListMailDomains = ListMailDomains'
{
ListMailDomains -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListMailDomains -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListMailDomains -> Text
organizationId :: Prelude.Text
}
deriving (ListMailDomains -> ListMailDomains -> Bool
(ListMailDomains -> ListMailDomains -> Bool)
-> (ListMailDomains -> ListMailDomains -> Bool)
-> Eq ListMailDomains
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListMailDomains -> ListMailDomains -> Bool
$c/= :: ListMailDomains -> ListMailDomains -> Bool
== :: ListMailDomains -> ListMailDomains -> Bool
$c== :: ListMailDomains -> ListMailDomains -> Bool
Prelude.Eq, ReadPrec [ListMailDomains]
ReadPrec ListMailDomains
Int -> ReadS ListMailDomains
ReadS [ListMailDomains]
(Int -> ReadS ListMailDomains)
-> ReadS [ListMailDomains]
-> ReadPrec ListMailDomains
-> ReadPrec [ListMailDomains]
-> Read ListMailDomains
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListMailDomains]
$creadListPrec :: ReadPrec [ListMailDomains]
readPrec :: ReadPrec ListMailDomains
$creadPrec :: ReadPrec ListMailDomains
readList :: ReadS [ListMailDomains]
$creadList :: ReadS [ListMailDomains]
readsPrec :: Int -> ReadS ListMailDomains
$creadsPrec :: Int -> ReadS ListMailDomains
Prelude.Read, Int -> ListMailDomains -> ShowS
[ListMailDomains] -> ShowS
ListMailDomains -> String
(Int -> ListMailDomains -> ShowS)
-> (ListMailDomains -> String)
-> ([ListMailDomains] -> ShowS)
-> Show ListMailDomains
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListMailDomains] -> ShowS
$cshowList :: [ListMailDomains] -> ShowS
show :: ListMailDomains -> String
$cshow :: ListMailDomains -> String
showsPrec :: Int -> ListMailDomains -> ShowS
$cshowsPrec :: Int -> ListMailDomains -> ShowS
Prelude.Show, (forall x. ListMailDomains -> Rep ListMailDomains x)
-> (forall x. Rep ListMailDomains x -> ListMailDomains)
-> Generic ListMailDomains
forall x. Rep ListMailDomains x -> ListMailDomains
forall x. ListMailDomains -> Rep ListMailDomains x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListMailDomains x -> ListMailDomains
$cfrom :: forall x. ListMailDomains -> Rep ListMailDomains x
Prelude.Generic)
newListMailDomains ::
Prelude.Text ->
ListMailDomains
newListMailDomains :: Text -> ListMailDomains
newListMailDomains Text
pOrganizationId_ =
ListMailDomains' :: Maybe Text -> Maybe Natural -> Text -> ListMailDomains
ListMailDomains'
{ $sel:nextToken:ListMailDomains' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListMailDomains' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:organizationId:ListMailDomains' :: Text
organizationId = Text
pOrganizationId_
}
listMailDomains_nextToken :: Lens.Lens' ListMailDomains (Prelude.Maybe Prelude.Text)
listMailDomains_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListMailDomains -> f ListMailDomains
listMailDomains_nextToken = (ListMailDomains -> Maybe Text)
-> (ListMailDomains -> Maybe Text -> ListMailDomains)
-> Lens ListMailDomains ListMailDomains (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMailDomains' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListMailDomains' :: ListMailDomains -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListMailDomains
s@ListMailDomains' {} Maybe Text
a -> ListMailDomains
s {$sel:nextToken:ListMailDomains' :: Maybe Text
nextToken = Maybe Text
a} :: ListMailDomains)
listMailDomains_maxResults :: Lens.Lens' ListMailDomains (Prelude.Maybe Prelude.Natural)
listMailDomains_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListMailDomains -> f ListMailDomains
listMailDomains_maxResults = (ListMailDomains -> Maybe Natural)
-> (ListMailDomains -> Maybe Natural -> ListMailDomains)
-> Lens
ListMailDomains ListMailDomains (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMailDomains' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListMailDomains' :: ListMailDomains -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListMailDomains
s@ListMailDomains' {} Maybe Natural
a -> ListMailDomains
s {$sel:maxResults:ListMailDomains' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListMailDomains)
listMailDomains_organizationId :: Lens.Lens' ListMailDomains Prelude.Text
listMailDomains_organizationId :: (Text -> f Text) -> ListMailDomains -> f ListMailDomains
listMailDomains_organizationId = (ListMailDomains -> Text)
-> (ListMailDomains -> Text -> ListMailDomains)
-> Lens ListMailDomains ListMailDomains Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMailDomains' {Text
organizationId :: Text
$sel:organizationId:ListMailDomains' :: ListMailDomains -> Text
organizationId} -> Text
organizationId) (\s :: ListMailDomains
s@ListMailDomains' {} Text
a -> ListMailDomains
s {$sel:organizationId:ListMailDomains' :: Text
organizationId = Text
a} :: ListMailDomains)
instance Core.AWSRequest ListMailDomains where
type
AWSResponse ListMailDomains =
ListMailDomainsResponse
request :: ListMailDomains -> Request ListMailDomains
request = Service -> ListMailDomains -> Request ListMailDomains
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListMailDomains
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListMailDomains)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListMailDomains))
-> Logger
-> Service
-> Proxy ListMailDomains
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListMailDomains)))
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 [MailDomainSummary] -> Int -> ListMailDomainsResponse
ListMailDomainsResponse'
(Maybe Text
-> Maybe [MailDomainSummary] -> Int -> ListMailDomainsResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe [MailDomainSummary] -> Int -> ListMailDomainsResponse)
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 [MailDomainSummary] -> Int -> ListMailDomainsResponse)
-> Either String (Maybe [MailDomainSummary])
-> Either String (Int -> ListMailDomainsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [MailDomainSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"MailDomains" Either String (Maybe (Maybe [MailDomainSummary]))
-> Maybe [MailDomainSummary]
-> Either String (Maybe [MailDomainSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [MailDomainSummary]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> ListMailDomainsResponse)
-> Either String Int -> Either String ListMailDomainsResponse
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 ListMailDomains
instance Prelude.NFData ListMailDomains
instance Core.ToHeaders ListMailDomains where
toHeaders :: ListMailDomains -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListMailDomains -> 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
"WorkMailService.ListMailDomains" ::
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 ListMailDomains where
toJSON :: ListMailDomains -> Value
toJSON ListMailDomains' {Maybe Natural
Maybe Text
Text
organizationId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:organizationId:ListMailDomains' :: ListMailDomains -> Text
$sel:maxResults:ListMailDomains' :: ListMailDomains -> Maybe Natural
$sel:nextToken:ListMailDomains' :: ListMailDomains -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (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,
(Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"OrganizationId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
organizationId)
]
)
instance Core.ToPath ListMailDomains where
toPath :: ListMailDomains -> ByteString
toPath = ByteString -> ListMailDomains -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListMailDomains where
toQuery :: ListMailDomains -> QueryString
toQuery = QueryString -> ListMailDomains -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListMailDomainsResponse = ListMailDomainsResponse'
{
ListMailDomainsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListMailDomainsResponse -> Maybe [MailDomainSummary]
mailDomains :: Prelude.Maybe [MailDomainSummary],
ListMailDomainsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListMailDomainsResponse -> ListMailDomainsResponse -> Bool
(ListMailDomainsResponse -> ListMailDomainsResponse -> Bool)
-> (ListMailDomainsResponse -> ListMailDomainsResponse -> Bool)
-> Eq ListMailDomainsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListMailDomainsResponse -> ListMailDomainsResponse -> Bool
$c/= :: ListMailDomainsResponse -> ListMailDomainsResponse -> Bool
== :: ListMailDomainsResponse -> ListMailDomainsResponse -> Bool
$c== :: ListMailDomainsResponse -> ListMailDomainsResponse -> Bool
Prelude.Eq, ReadPrec [ListMailDomainsResponse]
ReadPrec ListMailDomainsResponse
Int -> ReadS ListMailDomainsResponse
ReadS [ListMailDomainsResponse]
(Int -> ReadS ListMailDomainsResponse)
-> ReadS [ListMailDomainsResponse]
-> ReadPrec ListMailDomainsResponse
-> ReadPrec [ListMailDomainsResponse]
-> Read ListMailDomainsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListMailDomainsResponse]
$creadListPrec :: ReadPrec [ListMailDomainsResponse]
readPrec :: ReadPrec ListMailDomainsResponse
$creadPrec :: ReadPrec ListMailDomainsResponse
readList :: ReadS [ListMailDomainsResponse]
$creadList :: ReadS [ListMailDomainsResponse]
readsPrec :: Int -> ReadS ListMailDomainsResponse
$creadsPrec :: Int -> ReadS ListMailDomainsResponse
Prelude.Read, Int -> ListMailDomainsResponse -> ShowS
[ListMailDomainsResponse] -> ShowS
ListMailDomainsResponse -> String
(Int -> ListMailDomainsResponse -> ShowS)
-> (ListMailDomainsResponse -> String)
-> ([ListMailDomainsResponse] -> ShowS)
-> Show ListMailDomainsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListMailDomainsResponse] -> ShowS
$cshowList :: [ListMailDomainsResponse] -> ShowS
show :: ListMailDomainsResponse -> String
$cshow :: ListMailDomainsResponse -> String
showsPrec :: Int -> ListMailDomainsResponse -> ShowS
$cshowsPrec :: Int -> ListMailDomainsResponse -> ShowS
Prelude.Show, (forall x.
ListMailDomainsResponse -> Rep ListMailDomainsResponse x)
-> (forall x.
Rep ListMailDomainsResponse x -> ListMailDomainsResponse)
-> Generic ListMailDomainsResponse
forall x. Rep ListMailDomainsResponse x -> ListMailDomainsResponse
forall x. ListMailDomainsResponse -> Rep ListMailDomainsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListMailDomainsResponse x -> ListMailDomainsResponse
$cfrom :: forall x. ListMailDomainsResponse -> Rep ListMailDomainsResponse x
Prelude.Generic)
newListMailDomainsResponse ::
Prelude.Int ->
ListMailDomainsResponse
newListMailDomainsResponse :: Int -> ListMailDomainsResponse
newListMailDomainsResponse Int
pHttpStatus_ =
ListMailDomainsResponse' :: Maybe Text
-> Maybe [MailDomainSummary] -> Int -> ListMailDomainsResponse
ListMailDomainsResponse'
{ $sel:nextToken:ListMailDomainsResponse' :: Maybe Text
nextToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:mailDomains:ListMailDomainsResponse' :: Maybe [MailDomainSummary]
mailDomains = Maybe [MailDomainSummary]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListMailDomainsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listMailDomainsResponse_nextToken :: Lens.Lens' ListMailDomainsResponse (Prelude.Maybe Prelude.Text)
listMailDomainsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListMailDomainsResponse -> f ListMailDomainsResponse
listMailDomainsResponse_nextToken = (ListMailDomainsResponse -> Maybe Text)
-> (ListMailDomainsResponse
-> Maybe Text -> ListMailDomainsResponse)
-> Lens
ListMailDomainsResponse
ListMailDomainsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMailDomainsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListMailDomainsResponse' :: ListMailDomainsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListMailDomainsResponse
s@ListMailDomainsResponse' {} Maybe Text
a -> ListMailDomainsResponse
s {$sel:nextToken:ListMailDomainsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListMailDomainsResponse)
listMailDomainsResponse_mailDomains :: Lens.Lens' ListMailDomainsResponse (Prelude.Maybe [MailDomainSummary])
listMailDomainsResponse_mailDomains :: (Maybe [MailDomainSummary] -> f (Maybe [MailDomainSummary]))
-> ListMailDomainsResponse -> f ListMailDomainsResponse
listMailDomainsResponse_mailDomains = (ListMailDomainsResponse -> Maybe [MailDomainSummary])
-> (ListMailDomainsResponse
-> Maybe [MailDomainSummary] -> ListMailDomainsResponse)
-> Lens
ListMailDomainsResponse
ListMailDomainsResponse
(Maybe [MailDomainSummary])
(Maybe [MailDomainSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMailDomainsResponse' {Maybe [MailDomainSummary]
mailDomains :: Maybe [MailDomainSummary]
$sel:mailDomains:ListMailDomainsResponse' :: ListMailDomainsResponse -> Maybe [MailDomainSummary]
mailDomains} -> Maybe [MailDomainSummary]
mailDomains) (\s :: ListMailDomainsResponse
s@ListMailDomainsResponse' {} Maybe [MailDomainSummary]
a -> ListMailDomainsResponse
s {$sel:mailDomains:ListMailDomainsResponse' :: Maybe [MailDomainSummary]
mailDomains = Maybe [MailDomainSummary]
a} :: ListMailDomainsResponse) ((Maybe [MailDomainSummary] -> f (Maybe [MailDomainSummary]))
-> ListMailDomainsResponse -> f ListMailDomainsResponse)
-> ((Maybe [MailDomainSummary] -> f (Maybe [MailDomainSummary]))
-> Maybe [MailDomainSummary] -> f (Maybe [MailDomainSummary]))
-> (Maybe [MailDomainSummary] -> f (Maybe [MailDomainSummary]))
-> ListMailDomainsResponse
-> f ListMailDomainsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[MailDomainSummary]
[MailDomainSummary]
[MailDomainSummary]
[MailDomainSummary]
-> Iso
(Maybe [MailDomainSummary])
(Maybe [MailDomainSummary])
(Maybe [MailDomainSummary])
(Maybe [MailDomainSummary])
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
[MailDomainSummary]
[MailDomainSummary]
[MailDomainSummary]
[MailDomainSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listMailDomainsResponse_httpStatus :: Lens.Lens' ListMailDomainsResponse Prelude.Int
listMailDomainsResponse_httpStatus :: (Int -> f Int)
-> ListMailDomainsResponse -> f ListMailDomainsResponse
listMailDomainsResponse_httpStatus = (ListMailDomainsResponse -> Int)
-> (ListMailDomainsResponse -> Int -> ListMailDomainsResponse)
-> Lens ListMailDomainsResponse ListMailDomainsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMailDomainsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListMailDomainsResponse' :: ListMailDomainsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListMailDomainsResponse
s@ListMailDomainsResponse' {} Int
a -> ListMailDomainsResponse
s {$sel:httpStatus:ListMailDomainsResponse' :: Int
httpStatus = Int
a} :: ListMailDomainsResponse)
instance Prelude.NFData ListMailDomainsResponse