{-# 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.Route53Domains.ListDomains
(
ListDomains (..),
newListDomains,
listDomains_marker,
listDomains_maxItems,
ListDomainsResponse (..),
newListDomainsResponse,
listDomainsResponse_nextPageMarker,
listDomainsResponse_httpStatus,
listDomainsResponse_domains,
)
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.Route53Domains.Types
data ListDomains = ListDomains'
{
ListDomains -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
ListDomains -> Maybe Int
maxItems :: Prelude.Maybe Prelude.Int
}
deriving (ListDomains -> ListDomains -> Bool
(ListDomains -> ListDomains -> Bool)
-> (ListDomains -> ListDomains -> Bool) -> Eq ListDomains
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDomains -> ListDomains -> Bool
$c/= :: ListDomains -> ListDomains -> Bool
== :: ListDomains -> ListDomains -> Bool
$c== :: ListDomains -> ListDomains -> Bool
Prelude.Eq, ReadPrec [ListDomains]
ReadPrec ListDomains
Int -> ReadS ListDomains
ReadS [ListDomains]
(Int -> ReadS ListDomains)
-> ReadS [ListDomains]
-> ReadPrec ListDomains
-> ReadPrec [ListDomains]
-> Read ListDomains
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDomains]
$creadListPrec :: ReadPrec [ListDomains]
readPrec :: ReadPrec ListDomains
$creadPrec :: ReadPrec ListDomains
readList :: ReadS [ListDomains]
$creadList :: ReadS [ListDomains]
readsPrec :: Int -> ReadS ListDomains
$creadsPrec :: Int -> ReadS ListDomains
Prelude.Read, Int -> ListDomains -> ShowS
[ListDomains] -> ShowS
ListDomains -> String
(Int -> ListDomains -> ShowS)
-> (ListDomains -> String)
-> ([ListDomains] -> ShowS)
-> Show ListDomains
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDomains] -> ShowS
$cshowList :: [ListDomains] -> ShowS
show :: ListDomains -> String
$cshow :: ListDomains -> String
showsPrec :: Int -> ListDomains -> ShowS
$cshowsPrec :: Int -> ListDomains -> ShowS
Prelude.Show, (forall x. ListDomains -> Rep ListDomains x)
-> (forall x. Rep ListDomains x -> ListDomains)
-> Generic ListDomains
forall x. Rep ListDomains x -> ListDomains
forall x. ListDomains -> Rep ListDomains x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListDomains x -> ListDomains
$cfrom :: forall x. ListDomains -> Rep ListDomains x
Prelude.Generic)
newListDomains ::
ListDomains
newListDomains :: ListDomains
newListDomains =
ListDomains' :: Maybe Text -> Maybe Int -> ListDomains
ListDomains'
{ $sel:marker:ListDomains' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxItems:ListDomains' :: Maybe Int
maxItems = Maybe Int
forall a. Maybe a
Prelude.Nothing
}
listDomains_marker :: Lens.Lens' ListDomains (Prelude.Maybe Prelude.Text)
listDomains_marker :: (Maybe Text -> f (Maybe Text)) -> ListDomains -> f ListDomains
listDomains_marker = (ListDomains -> Maybe Text)
-> (ListDomains -> Maybe Text -> ListDomains)
-> Lens ListDomains ListDomains (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDomains' {Maybe Text
marker :: Maybe Text
$sel:marker:ListDomains' :: ListDomains -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListDomains
s@ListDomains' {} Maybe Text
a -> ListDomains
s {$sel:marker:ListDomains' :: Maybe Text
marker = Maybe Text
a} :: ListDomains)
listDomains_maxItems :: Lens.Lens' ListDomains (Prelude.Maybe Prelude.Int)
listDomains_maxItems :: (Maybe Int -> f (Maybe Int)) -> ListDomains -> f ListDomains
listDomains_maxItems = (ListDomains -> Maybe Int)
-> (ListDomains -> Maybe Int -> ListDomains)
-> Lens ListDomains ListDomains (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDomains' {Maybe Int
maxItems :: Maybe Int
$sel:maxItems:ListDomains' :: ListDomains -> Maybe Int
maxItems} -> Maybe Int
maxItems) (\s :: ListDomains
s@ListDomains' {} Maybe Int
a -> ListDomains
s {$sel:maxItems:ListDomains' :: Maybe Int
maxItems = Maybe Int
a} :: ListDomains)
instance Core.AWSPager ListDomains where
page :: ListDomains -> AWSResponse ListDomains -> Maybe ListDomains
page ListDomains
rq AWSResponse ListDomains
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListDomains
ListDomainsResponse
rs
ListDomainsResponse
-> Getting (First Text) ListDomainsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListDomainsResponse -> Const (First Text) ListDomainsResponse
Lens' ListDomainsResponse (Maybe Text)
listDomainsResponse_nextPageMarker
((Maybe Text -> Const (First Text) (Maybe Text))
-> ListDomainsResponse -> Const (First Text) ListDomainsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListDomainsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe ListDomains
forall a. Maybe a
Prelude.Nothing
| [DomainSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop (AWSResponse ListDomains
ListDomainsResponse
rs ListDomainsResponse
-> Getting [DomainSummary] ListDomainsResponse [DomainSummary]
-> [DomainSummary]
forall s a. s -> Getting a s a -> a
Lens.^. Getting [DomainSummary] ListDomainsResponse [DomainSummary]
Lens' ListDomainsResponse [DomainSummary]
listDomainsResponse_domains) =
Maybe ListDomains
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListDomains -> Maybe ListDomains
forall a. a -> Maybe a
Prelude.Just (ListDomains -> Maybe ListDomains)
-> ListDomains -> Maybe ListDomains
forall a b. (a -> b) -> a -> b
Prelude.$
ListDomains
rq
ListDomains -> (ListDomains -> ListDomains) -> ListDomains
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListDomains -> Identity ListDomains
Lens ListDomains ListDomains (Maybe Text) (Maybe Text)
listDomains_marker
((Maybe Text -> Identity (Maybe Text))
-> ListDomains -> Identity ListDomains)
-> Maybe Text -> ListDomains -> ListDomains
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListDomains
ListDomainsResponse
rs
ListDomainsResponse
-> Getting (First Text) ListDomainsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListDomainsResponse -> Const (First Text) ListDomainsResponse
Lens' ListDomainsResponse (Maybe Text)
listDomainsResponse_nextPageMarker
((Maybe Text -> Const (First Text) (Maybe Text))
-> ListDomainsResponse -> Const (First Text) ListDomainsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListDomainsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListDomains where
type AWSResponse ListDomains = ListDomainsResponse
request :: ListDomains -> Request ListDomains
request = Service -> ListDomains -> Request ListDomains
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListDomains
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListDomains)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListDomains))
-> Logger
-> Service
-> Proxy ListDomains
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListDomains)))
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 -> [DomainSummary] -> ListDomainsResponse
ListDomainsResponse'
(Maybe Text -> Int -> [DomainSummary] -> ListDomainsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> [DomainSummary] -> ListDomainsResponse)
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
"NextPageMarker")
Either String (Int -> [DomainSummary] -> ListDomainsResponse)
-> Either String Int
-> Either String ([DomainSummary] -> ListDomainsResponse)
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))
Either String ([DomainSummary] -> ListDomainsResponse)
-> Either String [DomainSummary]
-> Either String ListDomainsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [DomainSummary])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Domains" Either String (Maybe [DomainSummary])
-> [DomainSummary] -> Either String [DomainSummary]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [DomainSummary]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListDomains
instance Prelude.NFData ListDomains
instance Core.ToHeaders ListDomains where
toHeaders :: ListDomains -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListDomains -> 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
"Route53Domains_v20140515.ListDomains" ::
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 ListDomains where
toJSON :: ListDomains -> Value
toJSON ListDomains' {Maybe Int
Maybe Text
maxItems :: Maybe Int
marker :: Maybe Text
$sel:maxItems:ListDomains' :: ListDomains -> Maybe Int
$sel:marker:ListDomains' :: ListDomains -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Marker" 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
marker,
(Text
"MaxItems" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxItems
]
)
instance Core.ToPath ListDomains where
toPath :: ListDomains -> ByteString
toPath = ByteString -> ListDomains -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListDomains where
toQuery :: ListDomains -> QueryString
toQuery = QueryString -> ListDomains -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListDomainsResponse = ListDomainsResponse'
{
ListDomainsResponse -> Maybe Text
nextPageMarker :: Prelude.Maybe Prelude.Text,
ListDomainsResponse -> Int
httpStatus :: Prelude.Int,
ListDomainsResponse -> [DomainSummary]
domains :: [DomainSummary]
}
deriving (ListDomainsResponse -> ListDomainsResponse -> Bool
(ListDomainsResponse -> ListDomainsResponse -> Bool)
-> (ListDomainsResponse -> ListDomainsResponse -> Bool)
-> Eq ListDomainsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDomainsResponse -> ListDomainsResponse -> Bool
$c/= :: ListDomainsResponse -> ListDomainsResponse -> Bool
== :: ListDomainsResponse -> ListDomainsResponse -> Bool
$c== :: ListDomainsResponse -> ListDomainsResponse -> Bool
Prelude.Eq, ReadPrec [ListDomainsResponse]
ReadPrec ListDomainsResponse
Int -> ReadS ListDomainsResponse
ReadS [ListDomainsResponse]
(Int -> ReadS ListDomainsResponse)
-> ReadS [ListDomainsResponse]
-> ReadPrec ListDomainsResponse
-> ReadPrec [ListDomainsResponse]
-> Read ListDomainsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDomainsResponse]
$creadListPrec :: ReadPrec [ListDomainsResponse]
readPrec :: ReadPrec ListDomainsResponse
$creadPrec :: ReadPrec ListDomainsResponse
readList :: ReadS [ListDomainsResponse]
$creadList :: ReadS [ListDomainsResponse]
readsPrec :: Int -> ReadS ListDomainsResponse
$creadsPrec :: Int -> ReadS ListDomainsResponse
Prelude.Read, Int -> ListDomainsResponse -> ShowS
[ListDomainsResponse] -> ShowS
ListDomainsResponse -> String
(Int -> ListDomainsResponse -> ShowS)
-> (ListDomainsResponse -> String)
-> ([ListDomainsResponse] -> ShowS)
-> Show ListDomainsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDomainsResponse] -> ShowS
$cshowList :: [ListDomainsResponse] -> ShowS
show :: ListDomainsResponse -> String
$cshow :: ListDomainsResponse -> String
showsPrec :: Int -> ListDomainsResponse -> ShowS
$cshowsPrec :: Int -> ListDomainsResponse -> ShowS
Prelude.Show, (forall x. ListDomainsResponse -> Rep ListDomainsResponse x)
-> (forall x. Rep ListDomainsResponse x -> ListDomainsResponse)
-> Generic ListDomainsResponse
forall x. Rep ListDomainsResponse x -> ListDomainsResponse
forall x. ListDomainsResponse -> Rep ListDomainsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListDomainsResponse x -> ListDomainsResponse
$cfrom :: forall x. ListDomainsResponse -> Rep ListDomainsResponse x
Prelude.Generic)
newListDomainsResponse ::
Prelude.Int ->
ListDomainsResponse
newListDomainsResponse :: Int -> ListDomainsResponse
newListDomainsResponse Int
pHttpStatus_ =
ListDomainsResponse' :: Maybe Text -> Int -> [DomainSummary] -> ListDomainsResponse
ListDomainsResponse'
{ $sel:nextPageMarker:ListDomainsResponse' :: Maybe Text
nextPageMarker =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListDomainsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:domains:ListDomainsResponse' :: [DomainSummary]
domains = [DomainSummary]
forall a. Monoid a => a
Prelude.mempty
}
listDomainsResponse_nextPageMarker :: Lens.Lens' ListDomainsResponse (Prelude.Maybe Prelude.Text)
listDomainsResponse_nextPageMarker :: (Maybe Text -> f (Maybe Text))
-> ListDomainsResponse -> f ListDomainsResponse
listDomainsResponse_nextPageMarker = (ListDomainsResponse -> Maybe Text)
-> (ListDomainsResponse -> Maybe Text -> ListDomainsResponse)
-> Lens' ListDomainsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDomainsResponse' {Maybe Text
nextPageMarker :: Maybe Text
$sel:nextPageMarker:ListDomainsResponse' :: ListDomainsResponse -> Maybe Text
nextPageMarker} -> Maybe Text
nextPageMarker) (\s :: ListDomainsResponse
s@ListDomainsResponse' {} Maybe Text
a -> ListDomainsResponse
s {$sel:nextPageMarker:ListDomainsResponse' :: Maybe Text
nextPageMarker = Maybe Text
a} :: ListDomainsResponse)
listDomainsResponse_httpStatus :: Lens.Lens' ListDomainsResponse Prelude.Int
listDomainsResponse_httpStatus :: (Int -> f Int) -> ListDomainsResponse -> f ListDomainsResponse
listDomainsResponse_httpStatus = (ListDomainsResponse -> Int)
-> (ListDomainsResponse -> Int -> ListDomainsResponse)
-> Lens ListDomainsResponse ListDomainsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDomainsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListDomainsResponse' :: ListDomainsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListDomainsResponse
s@ListDomainsResponse' {} Int
a -> ListDomainsResponse
s {$sel:httpStatus:ListDomainsResponse' :: Int
httpStatus = Int
a} :: ListDomainsResponse)
listDomainsResponse_domains :: Lens.Lens' ListDomainsResponse [DomainSummary]
listDomainsResponse_domains :: ([DomainSummary] -> f [DomainSummary])
-> ListDomainsResponse -> f ListDomainsResponse
listDomainsResponse_domains = (ListDomainsResponse -> [DomainSummary])
-> (ListDomainsResponse -> [DomainSummary] -> ListDomainsResponse)
-> Lens' ListDomainsResponse [DomainSummary]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDomainsResponse' {[DomainSummary]
domains :: [DomainSummary]
$sel:domains:ListDomainsResponse' :: ListDomainsResponse -> [DomainSummary]
domains} -> [DomainSummary]
domains) (\s :: ListDomainsResponse
s@ListDomainsResponse' {} [DomainSummary]
a -> ListDomainsResponse
s {$sel:domains:ListDomainsResponse' :: [DomainSummary]
domains = [DomainSummary]
a} :: ListDomainsResponse) (([DomainSummary] -> f [DomainSummary])
-> ListDomainsResponse -> f ListDomainsResponse)
-> (([DomainSummary] -> f [DomainSummary])
-> [DomainSummary] -> f [DomainSummary])
-> ([DomainSummary] -> f [DomainSummary])
-> ListDomainsResponse
-> f ListDomainsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([DomainSummary] -> f [DomainSummary])
-> [DomainSummary] -> f [DomainSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListDomainsResponse