{-# 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.Outposts.ListSites
(
ListSites (..),
newListSites,
listSites_nextToken,
listSites_maxResults,
ListSitesResponse (..),
newListSitesResponse,
listSitesResponse_nextToken,
listSitesResponse_sites,
listSitesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Outposts.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListSites = ListSites'
{ ListSites -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListSites -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListSites -> ListSites -> Bool
(ListSites -> ListSites -> Bool)
-> (ListSites -> ListSites -> Bool) -> Eq ListSites
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSites -> ListSites -> Bool
$c/= :: ListSites -> ListSites -> Bool
== :: ListSites -> ListSites -> Bool
$c== :: ListSites -> ListSites -> Bool
Prelude.Eq, ReadPrec [ListSites]
ReadPrec ListSites
Int -> ReadS ListSites
ReadS [ListSites]
(Int -> ReadS ListSites)
-> ReadS [ListSites]
-> ReadPrec ListSites
-> ReadPrec [ListSites]
-> Read ListSites
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSites]
$creadListPrec :: ReadPrec [ListSites]
readPrec :: ReadPrec ListSites
$creadPrec :: ReadPrec ListSites
readList :: ReadS [ListSites]
$creadList :: ReadS [ListSites]
readsPrec :: Int -> ReadS ListSites
$creadsPrec :: Int -> ReadS ListSites
Prelude.Read, Int -> ListSites -> ShowS
[ListSites] -> ShowS
ListSites -> String
(Int -> ListSites -> ShowS)
-> (ListSites -> String)
-> ([ListSites] -> ShowS)
-> Show ListSites
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSites] -> ShowS
$cshowList :: [ListSites] -> ShowS
show :: ListSites -> String
$cshow :: ListSites -> String
showsPrec :: Int -> ListSites -> ShowS
$cshowsPrec :: Int -> ListSites -> ShowS
Prelude.Show, (forall x. ListSites -> Rep ListSites x)
-> (forall x. Rep ListSites x -> ListSites) -> Generic ListSites
forall x. Rep ListSites x -> ListSites
forall x. ListSites -> Rep ListSites x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListSites x -> ListSites
$cfrom :: forall x. ListSites -> Rep ListSites x
Prelude.Generic)
newListSites ::
ListSites
newListSites :: ListSites
newListSites =
ListSites' :: Maybe Text -> Maybe Natural -> ListSites
ListSites'
{ $sel:nextToken:ListSites' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListSites' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listSites_nextToken :: Lens.Lens' ListSites (Prelude.Maybe Prelude.Text)
listSites_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListSites -> f ListSites
listSites_nextToken = (ListSites -> Maybe Text)
-> (ListSites -> Maybe Text -> ListSites)
-> Lens ListSites ListSites (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSites' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSites' :: ListSites -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSites
s@ListSites' {} Maybe Text
a -> ListSites
s {$sel:nextToken:ListSites' :: Maybe Text
nextToken = Maybe Text
a} :: ListSites)
listSites_maxResults :: Lens.Lens' ListSites (Prelude.Maybe Prelude.Natural)
listSites_maxResults :: (Maybe Natural -> f (Maybe Natural)) -> ListSites -> f ListSites
listSites_maxResults = (ListSites -> Maybe Natural)
-> (ListSites -> Maybe Natural -> ListSites)
-> Lens ListSites ListSites (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSites' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListSites' :: ListSites -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListSites
s@ListSites' {} Maybe Natural
a -> ListSites
s {$sel:maxResults:ListSites' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListSites)
instance Core.AWSRequest ListSites where
type AWSResponse ListSites = ListSitesResponse
request :: ListSites -> Request ListSites
request = Service -> ListSites -> Request ListSites
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListSites
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListSites)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListSites))
-> Logger
-> Service
-> Proxy ListSites
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListSites)))
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 [Site] -> Int -> ListSitesResponse
ListSitesResponse'
(Maybe Text -> Maybe [Site] -> Int -> ListSitesResponse)
-> Either String (Maybe Text)
-> Either String (Maybe [Site] -> Int -> ListSitesResponse)
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 [Site] -> Int -> ListSitesResponse)
-> Either String (Maybe [Site])
-> Either String (Int -> ListSitesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [Site]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Sites" Either String (Maybe (Maybe [Site]))
-> Maybe [Site] -> Either String (Maybe [Site])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Site]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> ListSitesResponse)
-> Either String Int -> Either String ListSitesResponse
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 ListSites
instance Prelude.NFData ListSites
instance Core.ToHeaders ListSites where
toHeaders :: ListSites -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListSites -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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.ToPath ListSites where
toPath :: ListSites -> ByteString
toPath = ByteString -> ListSites -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/sites"
instance Core.ToQuery ListSites where
toQuery :: ListSites -> QueryString
toQuery ListSites' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListSites' :: ListSites -> Maybe Natural
$sel:nextToken:ListSites' :: ListSites -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
ByteString
"MaxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
]
data ListSitesResponse = ListSitesResponse'
{ ListSitesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListSitesResponse -> Maybe [Site]
sites :: Prelude.Maybe [Site],
ListSitesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListSitesResponse -> ListSitesResponse -> Bool
(ListSitesResponse -> ListSitesResponse -> Bool)
-> (ListSitesResponse -> ListSitesResponse -> Bool)
-> Eq ListSitesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSitesResponse -> ListSitesResponse -> Bool
$c/= :: ListSitesResponse -> ListSitesResponse -> Bool
== :: ListSitesResponse -> ListSitesResponse -> Bool
$c== :: ListSitesResponse -> ListSitesResponse -> Bool
Prelude.Eq, ReadPrec [ListSitesResponse]
ReadPrec ListSitesResponse
Int -> ReadS ListSitesResponse
ReadS [ListSitesResponse]
(Int -> ReadS ListSitesResponse)
-> ReadS [ListSitesResponse]
-> ReadPrec ListSitesResponse
-> ReadPrec [ListSitesResponse]
-> Read ListSitesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSitesResponse]
$creadListPrec :: ReadPrec [ListSitesResponse]
readPrec :: ReadPrec ListSitesResponse
$creadPrec :: ReadPrec ListSitesResponse
readList :: ReadS [ListSitesResponse]
$creadList :: ReadS [ListSitesResponse]
readsPrec :: Int -> ReadS ListSitesResponse
$creadsPrec :: Int -> ReadS ListSitesResponse
Prelude.Read, Int -> ListSitesResponse -> ShowS
[ListSitesResponse] -> ShowS
ListSitesResponse -> String
(Int -> ListSitesResponse -> ShowS)
-> (ListSitesResponse -> String)
-> ([ListSitesResponse] -> ShowS)
-> Show ListSitesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSitesResponse] -> ShowS
$cshowList :: [ListSitesResponse] -> ShowS
show :: ListSitesResponse -> String
$cshow :: ListSitesResponse -> String
showsPrec :: Int -> ListSitesResponse -> ShowS
$cshowsPrec :: Int -> ListSitesResponse -> ShowS
Prelude.Show, (forall x. ListSitesResponse -> Rep ListSitesResponse x)
-> (forall x. Rep ListSitesResponse x -> ListSitesResponse)
-> Generic ListSitesResponse
forall x. Rep ListSitesResponse x -> ListSitesResponse
forall x. ListSitesResponse -> Rep ListSitesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListSitesResponse x -> ListSitesResponse
$cfrom :: forall x. ListSitesResponse -> Rep ListSitesResponse x
Prelude.Generic)
newListSitesResponse ::
Prelude.Int ->
ListSitesResponse
newListSitesResponse :: Int -> ListSitesResponse
newListSitesResponse Int
pHttpStatus_ =
ListSitesResponse' :: Maybe Text -> Maybe [Site] -> Int -> ListSitesResponse
ListSitesResponse'
{ $sel:nextToken:ListSitesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:sites:ListSitesResponse' :: Maybe [Site]
sites = Maybe [Site]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListSitesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listSitesResponse_nextToken :: Lens.Lens' ListSitesResponse (Prelude.Maybe Prelude.Text)
listSitesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListSitesResponse -> f ListSitesResponse
listSitesResponse_nextToken = (ListSitesResponse -> Maybe Text)
-> (ListSitesResponse -> Maybe Text -> ListSitesResponse)
-> Lens
ListSitesResponse ListSitesResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSitesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSitesResponse' :: ListSitesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSitesResponse
s@ListSitesResponse' {} Maybe Text
a -> ListSitesResponse
s {$sel:nextToken:ListSitesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListSitesResponse)
listSitesResponse_sites :: Lens.Lens' ListSitesResponse (Prelude.Maybe [Site])
listSitesResponse_sites :: (Maybe [Site] -> f (Maybe [Site]))
-> ListSitesResponse -> f ListSitesResponse
listSitesResponse_sites = (ListSitesResponse -> Maybe [Site])
-> (ListSitesResponse -> Maybe [Site] -> ListSitesResponse)
-> Lens
ListSitesResponse ListSitesResponse (Maybe [Site]) (Maybe [Site])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSitesResponse' {Maybe [Site]
sites :: Maybe [Site]
$sel:sites:ListSitesResponse' :: ListSitesResponse -> Maybe [Site]
sites} -> Maybe [Site]
sites) (\s :: ListSitesResponse
s@ListSitesResponse' {} Maybe [Site]
a -> ListSitesResponse
s {$sel:sites:ListSitesResponse' :: Maybe [Site]
sites = Maybe [Site]
a} :: ListSitesResponse) ((Maybe [Site] -> f (Maybe [Site]))
-> ListSitesResponse -> f ListSitesResponse)
-> ((Maybe [Site] -> f (Maybe [Site]))
-> Maybe [Site] -> f (Maybe [Site]))
-> (Maybe [Site] -> f (Maybe [Site]))
-> ListSitesResponse
-> f ListSitesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Site] [Site] [Site] [Site]
-> Iso (Maybe [Site]) (Maybe [Site]) (Maybe [Site]) (Maybe [Site])
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 [Site] [Site] [Site] [Site]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listSitesResponse_httpStatus :: Lens.Lens' ListSitesResponse Prelude.Int
listSitesResponse_httpStatus :: (Int -> f Int) -> ListSitesResponse -> f ListSitesResponse
listSitesResponse_httpStatus = (ListSitesResponse -> Int)
-> (ListSitesResponse -> Int -> ListSitesResponse)
-> Lens ListSitesResponse ListSitesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSitesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListSitesResponse' :: ListSitesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListSitesResponse
s@ListSitesResponse' {} Int
a -> ListSitesResponse
s {$sel:httpStatus:ListSitesResponse' :: Int
httpStatus = Int
a} :: ListSitesResponse)
instance Prelude.NFData ListSitesResponse