{-# 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.IoTSiteWise.ListPortals
(
ListPortals (..),
newListPortals,
listPortals_nextToken,
listPortals_maxResults,
ListPortalsResponse (..),
newListPortalsResponse,
listPortalsResponse_portalSummaries,
listPortalsResponse_nextToken,
listPortalsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoTSiteWise.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 ListPortals = ListPortals'
{
ListPortals -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListPortals -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListPortals -> ListPortals -> Bool
(ListPortals -> ListPortals -> Bool)
-> (ListPortals -> ListPortals -> Bool) -> Eq ListPortals
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPortals -> ListPortals -> Bool
$c/= :: ListPortals -> ListPortals -> Bool
== :: ListPortals -> ListPortals -> Bool
$c== :: ListPortals -> ListPortals -> Bool
Prelude.Eq, ReadPrec [ListPortals]
ReadPrec ListPortals
Int -> ReadS ListPortals
ReadS [ListPortals]
(Int -> ReadS ListPortals)
-> ReadS [ListPortals]
-> ReadPrec ListPortals
-> ReadPrec [ListPortals]
-> Read ListPortals
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPortals]
$creadListPrec :: ReadPrec [ListPortals]
readPrec :: ReadPrec ListPortals
$creadPrec :: ReadPrec ListPortals
readList :: ReadS [ListPortals]
$creadList :: ReadS [ListPortals]
readsPrec :: Int -> ReadS ListPortals
$creadsPrec :: Int -> ReadS ListPortals
Prelude.Read, Int -> ListPortals -> ShowS
[ListPortals] -> ShowS
ListPortals -> String
(Int -> ListPortals -> ShowS)
-> (ListPortals -> String)
-> ([ListPortals] -> ShowS)
-> Show ListPortals
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPortals] -> ShowS
$cshowList :: [ListPortals] -> ShowS
show :: ListPortals -> String
$cshow :: ListPortals -> String
showsPrec :: Int -> ListPortals -> ShowS
$cshowsPrec :: Int -> ListPortals -> ShowS
Prelude.Show, (forall x. ListPortals -> Rep ListPortals x)
-> (forall x. Rep ListPortals x -> ListPortals)
-> Generic ListPortals
forall x. Rep ListPortals x -> ListPortals
forall x. ListPortals -> Rep ListPortals x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPortals x -> ListPortals
$cfrom :: forall x. ListPortals -> Rep ListPortals x
Prelude.Generic)
newListPortals ::
ListPortals
newListPortals :: ListPortals
newListPortals =
ListPortals' :: Maybe Text -> Maybe Natural -> ListPortals
ListPortals'
{ $sel:nextToken:ListPortals' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListPortals' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listPortals_nextToken :: Lens.Lens' ListPortals (Prelude.Maybe Prelude.Text)
listPortals_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListPortals -> f ListPortals
listPortals_nextToken = (ListPortals -> Maybe Text)
-> (ListPortals -> Maybe Text -> ListPortals)
-> Lens ListPortals ListPortals (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPortals' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPortals' :: ListPortals -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPortals
s@ListPortals' {} Maybe Text
a -> ListPortals
s {$sel:nextToken:ListPortals' :: Maybe Text
nextToken = Maybe Text
a} :: ListPortals)
listPortals_maxResults :: Lens.Lens' ListPortals (Prelude.Maybe Prelude.Natural)
listPortals_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListPortals -> f ListPortals
listPortals_maxResults = (ListPortals -> Maybe Natural)
-> (ListPortals -> Maybe Natural -> ListPortals)
-> Lens ListPortals ListPortals (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPortals' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListPortals' :: ListPortals -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListPortals
s@ListPortals' {} Maybe Natural
a -> ListPortals
s {$sel:maxResults:ListPortals' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListPortals)
instance Core.AWSPager ListPortals where
page :: ListPortals -> AWSResponse ListPortals -> Maybe ListPortals
page ListPortals
rq AWSResponse ListPortals
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListPortals
ListPortalsResponse
rs
ListPortalsResponse
-> Getting (First Text) ListPortalsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListPortalsResponse -> Const (First Text) ListPortalsResponse
Lens' ListPortalsResponse (Maybe Text)
listPortalsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListPortalsResponse -> Const (First Text) ListPortalsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListPortalsResponse 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 ListPortals
forall a. Maybe a
Prelude.Nothing
| Maybe [PortalSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListPortals
ListPortalsResponse
rs
ListPortalsResponse
-> Getting
(First [PortalSummary]) ListPortalsResponse [PortalSummary]
-> Maybe [PortalSummary]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [PortalSummary]
-> Const (First [PortalSummary]) (Maybe [PortalSummary]))
-> ListPortalsResponse
-> Const (First [PortalSummary]) ListPortalsResponse
Lens' ListPortalsResponse (Maybe [PortalSummary])
listPortalsResponse_portalSummaries
((Maybe [PortalSummary]
-> Const (First [PortalSummary]) (Maybe [PortalSummary]))
-> ListPortalsResponse
-> Const (First [PortalSummary]) ListPortalsResponse)
-> (([PortalSummary]
-> Const (First [PortalSummary]) [PortalSummary])
-> Maybe [PortalSummary]
-> Const (First [PortalSummary]) (Maybe [PortalSummary]))
-> Getting
(First [PortalSummary]) ListPortalsResponse [PortalSummary]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([PortalSummary] -> Const (First [PortalSummary]) [PortalSummary])
-> Maybe [PortalSummary]
-> Const (First [PortalSummary]) (Maybe [PortalSummary])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe ListPortals
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListPortals -> Maybe ListPortals
forall a. a -> Maybe a
Prelude.Just (ListPortals -> Maybe ListPortals)
-> ListPortals -> Maybe ListPortals
forall a b. (a -> b) -> a -> b
Prelude.$
ListPortals
rq
ListPortals -> (ListPortals -> ListPortals) -> ListPortals
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListPortals -> Identity ListPortals
Lens ListPortals ListPortals (Maybe Text) (Maybe Text)
listPortals_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListPortals -> Identity ListPortals)
-> Maybe Text -> ListPortals -> ListPortals
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListPortals
ListPortalsResponse
rs
ListPortalsResponse
-> Getting (First Text) ListPortalsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListPortalsResponse -> Const (First Text) ListPortalsResponse
Lens' ListPortalsResponse (Maybe Text)
listPortalsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListPortalsResponse -> Const (First Text) ListPortalsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListPortalsResponse 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 ListPortals where
type AWSResponse ListPortals = ListPortalsResponse
request :: ListPortals -> Request ListPortals
request = Service -> ListPortals -> Request ListPortals
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListPortals
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListPortals)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListPortals))
-> Logger
-> Service
-> Proxy ListPortals
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListPortals)))
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 [PortalSummary] -> Maybe Text -> Int -> ListPortalsResponse
ListPortalsResponse'
(Maybe [PortalSummary] -> Maybe Text -> Int -> ListPortalsResponse)
-> Either String (Maybe [PortalSummary])
-> Either String (Maybe Text -> Int -> ListPortalsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [PortalSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"portalSummaries"
Either String (Maybe (Maybe [PortalSummary]))
-> Maybe [PortalSummary] -> Either String (Maybe [PortalSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [PortalSummary]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Maybe Text -> Int -> ListPortalsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListPortalsResponse)
forall (f :: * -> *) a b. Applicative f => 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 (Int -> ListPortalsResponse)
-> Either String Int -> Either String ListPortalsResponse
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 ListPortals
instance Prelude.NFData ListPortals
instance Core.ToHeaders ListPortals where
toHeaders :: ListPortals -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListPortals -> 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 ListPortals where
toPath :: ListPortals -> ByteString
toPath = ByteString -> ListPortals -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/portals"
instance Core.ToQuery ListPortals where
toQuery :: ListPortals -> QueryString
toQuery ListPortals' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListPortals' :: ListPortals -> Maybe Natural
$sel:nextToken:ListPortals' :: ListPortals -> 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 ListPortalsResponse = ListPortalsResponse'
{
ListPortalsResponse -> Maybe [PortalSummary]
portalSummaries :: Prelude.Maybe [PortalSummary],
ListPortalsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListPortalsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListPortalsResponse -> ListPortalsResponse -> Bool
(ListPortalsResponse -> ListPortalsResponse -> Bool)
-> (ListPortalsResponse -> ListPortalsResponse -> Bool)
-> Eq ListPortalsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPortalsResponse -> ListPortalsResponse -> Bool
$c/= :: ListPortalsResponse -> ListPortalsResponse -> Bool
== :: ListPortalsResponse -> ListPortalsResponse -> Bool
$c== :: ListPortalsResponse -> ListPortalsResponse -> Bool
Prelude.Eq, ReadPrec [ListPortalsResponse]
ReadPrec ListPortalsResponse
Int -> ReadS ListPortalsResponse
ReadS [ListPortalsResponse]
(Int -> ReadS ListPortalsResponse)
-> ReadS [ListPortalsResponse]
-> ReadPrec ListPortalsResponse
-> ReadPrec [ListPortalsResponse]
-> Read ListPortalsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPortalsResponse]
$creadListPrec :: ReadPrec [ListPortalsResponse]
readPrec :: ReadPrec ListPortalsResponse
$creadPrec :: ReadPrec ListPortalsResponse
readList :: ReadS [ListPortalsResponse]
$creadList :: ReadS [ListPortalsResponse]
readsPrec :: Int -> ReadS ListPortalsResponse
$creadsPrec :: Int -> ReadS ListPortalsResponse
Prelude.Read, Int -> ListPortalsResponse -> ShowS
[ListPortalsResponse] -> ShowS
ListPortalsResponse -> String
(Int -> ListPortalsResponse -> ShowS)
-> (ListPortalsResponse -> String)
-> ([ListPortalsResponse] -> ShowS)
-> Show ListPortalsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPortalsResponse] -> ShowS
$cshowList :: [ListPortalsResponse] -> ShowS
show :: ListPortalsResponse -> String
$cshow :: ListPortalsResponse -> String
showsPrec :: Int -> ListPortalsResponse -> ShowS
$cshowsPrec :: Int -> ListPortalsResponse -> ShowS
Prelude.Show, (forall x. ListPortalsResponse -> Rep ListPortalsResponse x)
-> (forall x. Rep ListPortalsResponse x -> ListPortalsResponse)
-> Generic ListPortalsResponse
forall x. Rep ListPortalsResponse x -> ListPortalsResponse
forall x. ListPortalsResponse -> Rep ListPortalsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPortalsResponse x -> ListPortalsResponse
$cfrom :: forall x. ListPortalsResponse -> Rep ListPortalsResponse x
Prelude.Generic)
newListPortalsResponse ::
Prelude.Int ->
ListPortalsResponse
newListPortalsResponse :: Int -> ListPortalsResponse
newListPortalsResponse Int
pHttpStatus_ =
ListPortalsResponse' :: Maybe [PortalSummary] -> Maybe Text -> Int -> ListPortalsResponse
ListPortalsResponse'
{ $sel:portalSummaries:ListPortalsResponse' :: Maybe [PortalSummary]
portalSummaries =
Maybe [PortalSummary]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListPortalsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListPortalsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listPortalsResponse_portalSummaries :: Lens.Lens' ListPortalsResponse (Prelude.Maybe [PortalSummary])
listPortalsResponse_portalSummaries :: (Maybe [PortalSummary] -> f (Maybe [PortalSummary]))
-> ListPortalsResponse -> f ListPortalsResponse
listPortalsResponse_portalSummaries = (ListPortalsResponse -> Maybe [PortalSummary])
-> (ListPortalsResponse
-> Maybe [PortalSummary] -> ListPortalsResponse)
-> Lens' ListPortalsResponse (Maybe [PortalSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPortalsResponse' {Maybe [PortalSummary]
portalSummaries :: Maybe [PortalSummary]
$sel:portalSummaries:ListPortalsResponse' :: ListPortalsResponse -> Maybe [PortalSummary]
portalSummaries} -> Maybe [PortalSummary]
portalSummaries) (\s :: ListPortalsResponse
s@ListPortalsResponse' {} Maybe [PortalSummary]
a -> ListPortalsResponse
s {$sel:portalSummaries:ListPortalsResponse' :: Maybe [PortalSummary]
portalSummaries = Maybe [PortalSummary]
a} :: ListPortalsResponse) ((Maybe [PortalSummary] -> f (Maybe [PortalSummary]))
-> ListPortalsResponse -> f ListPortalsResponse)
-> ((Maybe [PortalSummary] -> f (Maybe [PortalSummary]))
-> Maybe [PortalSummary] -> f (Maybe [PortalSummary]))
-> (Maybe [PortalSummary] -> f (Maybe [PortalSummary]))
-> ListPortalsResponse
-> f ListPortalsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[PortalSummary] [PortalSummary] [PortalSummary] [PortalSummary]
-> Iso
(Maybe [PortalSummary])
(Maybe [PortalSummary])
(Maybe [PortalSummary])
(Maybe [PortalSummary])
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
[PortalSummary] [PortalSummary] [PortalSummary] [PortalSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listPortalsResponse_nextToken :: Lens.Lens' ListPortalsResponse (Prelude.Maybe Prelude.Text)
listPortalsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListPortalsResponse -> f ListPortalsResponse
listPortalsResponse_nextToken = (ListPortalsResponse -> Maybe Text)
-> (ListPortalsResponse -> Maybe Text -> ListPortalsResponse)
-> Lens' ListPortalsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPortalsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPortalsResponse' :: ListPortalsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPortalsResponse
s@ListPortalsResponse' {} Maybe Text
a -> ListPortalsResponse
s {$sel:nextToken:ListPortalsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListPortalsResponse)
listPortalsResponse_httpStatus :: Lens.Lens' ListPortalsResponse Prelude.Int
listPortalsResponse_httpStatus :: (Int -> f Int) -> ListPortalsResponse -> f ListPortalsResponse
listPortalsResponse_httpStatus = (ListPortalsResponse -> Int)
-> (ListPortalsResponse -> Int -> ListPortalsResponse)
-> Lens ListPortalsResponse ListPortalsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPortalsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListPortalsResponse' :: ListPortalsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListPortalsResponse
s@ListPortalsResponse' {} Int
a -> ListPortalsResponse
s {$sel:httpStatus:ListPortalsResponse' :: Int
httpStatus = Int
a} :: ListPortalsResponse)
instance Prelude.NFData ListPortalsResponse