{-# 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.ListAssetModels
(
ListAssetModels (..),
newListAssetModels,
listAssetModels_nextToken,
listAssetModels_maxResults,
ListAssetModelsResponse (..),
newListAssetModelsResponse,
listAssetModelsResponse_nextToken,
listAssetModelsResponse_httpStatus,
listAssetModelsResponse_assetModelSummaries,
)
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 ListAssetModels = ListAssetModels'
{
ListAssetModels -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListAssetModels -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListAssetModels -> ListAssetModels -> Bool
(ListAssetModels -> ListAssetModels -> Bool)
-> (ListAssetModels -> ListAssetModels -> Bool)
-> Eq ListAssetModels
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAssetModels -> ListAssetModels -> Bool
$c/= :: ListAssetModels -> ListAssetModels -> Bool
== :: ListAssetModels -> ListAssetModels -> Bool
$c== :: ListAssetModels -> ListAssetModels -> Bool
Prelude.Eq, ReadPrec [ListAssetModels]
ReadPrec ListAssetModels
Int -> ReadS ListAssetModels
ReadS [ListAssetModels]
(Int -> ReadS ListAssetModels)
-> ReadS [ListAssetModels]
-> ReadPrec ListAssetModels
-> ReadPrec [ListAssetModels]
-> Read ListAssetModels
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAssetModels]
$creadListPrec :: ReadPrec [ListAssetModels]
readPrec :: ReadPrec ListAssetModels
$creadPrec :: ReadPrec ListAssetModels
readList :: ReadS [ListAssetModels]
$creadList :: ReadS [ListAssetModels]
readsPrec :: Int -> ReadS ListAssetModels
$creadsPrec :: Int -> ReadS ListAssetModels
Prelude.Read, Int -> ListAssetModels -> ShowS
[ListAssetModels] -> ShowS
ListAssetModels -> String
(Int -> ListAssetModels -> ShowS)
-> (ListAssetModels -> String)
-> ([ListAssetModels] -> ShowS)
-> Show ListAssetModels
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAssetModels] -> ShowS
$cshowList :: [ListAssetModels] -> ShowS
show :: ListAssetModels -> String
$cshow :: ListAssetModels -> String
showsPrec :: Int -> ListAssetModels -> ShowS
$cshowsPrec :: Int -> ListAssetModels -> ShowS
Prelude.Show, (forall x. ListAssetModels -> Rep ListAssetModels x)
-> (forall x. Rep ListAssetModels x -> ListAssetModels)
-> Generic ListAssetModels
forall x. Rep ListAssetModels x -> ListAssetModels
forall x. ListAssetModels -> Rep ListAssetModels x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAssetModels x -> ListAssetModels
$cfrom :: forall x. ListAssetModels -> Rep ListAssetModels x
Prelude.Generic)
newListAssetModels ::
ListAssetModels
newListAssetModels :: ListAssetModels
newListAssetModels =
ListAssetModels' :: Maybe Text -> Maybe Natural -> ListAssetModels
ListAssetModels'
{ $sel:nextToken:ListAssetModels' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListAssetModels' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listAssetModels_nextToken :: Lens.Lens' ListAssetModels (Prelude.Maybe Prelude.Text)
listAssetModels_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAssetModels -> f ListAssetModels
listAssetModels_nextToken = (ListAssetModels -> Maybe Text)
-> (ListAssetModels -> Maybe Text -> ListAssetModels)
-> Lens ListAssetModels ListAssetModels (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssetModels' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAssetModels' :: ListAssetModels -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAssetModels
s@ListAssetModels' {} Maybe Text
a -> ListAssetModels
s {$sel:nextToken:ListAssetModels' :: Maybe Text
nextToken = Maybe Text
a} :: ListAssetModels)
listAssetModels_maxResults :: Lens.Lens' ListAssetModels (Prelude.Maybe Prelude.Natural)
listAssetModels_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListAssetModels -> f ListAssetModels
listAssetModels_maxResults = (ListAssetModels -> Maybe Natural)
-> (ListAssetModels -> Maybe Natural -> ListAssetModels)
-> Lens
ListAssetModels ListAssetModels (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssetModels' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListAssetModels' :: ListAssetModels -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListAssetModels
s@ListAssetModels' {} Maybe Natural
a -> ListAssetModels
s {$sel:maxResults:ListAssetModels' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListAssetModels)
instance Core.AWSPager ListAssetModels where
page :: ListAssetModels
-> AWSResponse ListAssetModels -> Maybe ListAssetModels
page ListAssetModels
rq AWSResponse ListAssetModels
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListAssetModels
ListAssetModelsResponse
rs
ListAssetModelsResponse
-> Getting (First Text) ListAssetModelsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListAssetModelsResponse
-> Const (First Text) ListAssetModelsResponse
Lens' ListAssetModelsResponse (Maybe Text)
listAssetModelsResponse_nextToken
((Maybe Text -> Const (First Text) (Maybe Text))
-> ListAssetModelsResponse
-> Const (First Text) ListAssetModelsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListAssetModelsResponse 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 ListAssetModels
forall a. Maybe a
Prelude.Nothing
| [AssetModelSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListAssetModels
ListAssetModelsResponse
rs
ListAssetModelsResponse
-> Getting
[AssetModelSummary] ListAssetModelsResponse [AssetModelSummary]
-> [AssetModelSummary]
forall s a. s -> Getting a s a -> a
Lens.^. Getting
[AssetModelSummary] ListAssetModelsResponse [AssetModelSummary]
Lens' ListAssetModelsResponse [AssetModelSummary]
listAssetModelsResponse_assetModelSummaries
) =
Maybe ListAssetModels
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListAssetModels -> Maybe ListAssetModels
forall a. a -> Maybe a
Prelude.Just (ListAssetModels -> Maybe ListAssetModels)
-> ListAssetModels -> Maybe ListAssetModels
forall a b. (a -> b) -> a -> b
Prelude.$
ListAssetModels
rq
ListAssetModels
-> (ListAssetModels -> ListAssetModels) -> ListAssetModels
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListAssetModels -> Identity ListAssetModels
Lens ListAssetModels ListAssetModels (Maybe Text) (Maybe Text)
listAssetModels_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListAssetModels -> Identity ListAssetModels)
-> Maybe Text -> ListAssetModels -> ListAssetModels
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListAssetModels
ListAssetModelsResponse
rs
ListAssetModelsResponse
-> Getting (First Text) ListAssetModelsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListAssetModelsResponse
-> Const (First Text) ListAssetModelsResponse
Lens' ListAssetModelsResponse (Maybe Text)
listAssetModelsResponse_nextToken
((Maybe Text -> Const (First Text) (Maybe Text))
-> ListAssetModelsResponse
-> Const (First Text) ListAssetModelsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListAssetModelsResponse 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 ListAssetModels where
type
AWSResponse ListAssetModels =
ListAssetModelsResponse
request :: ListAssetModels -> Request ListAssetModels
request = Service -> ListAssetModels -> Request ListAssetModels
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListAssetModels
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListAssetModels)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListAssetModels))
-> Logger
-> Service
-> Proxy ListAssetModels
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListAssetModels)))
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 -> [AssetModelSummary] -> ListAssetModelsResponse
ListAssetModelsResponse'
(Maybe Text
-> Int -> [AssetModelSummary] -> ListAssetModelsResponse)
-> Either String (Maybe Text)
-> Either
String (Int -> [AssetModelSummary] -> ListAssetModelsResponse)
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 (Int -> [AssetModelSummary] -> ListAssetModelsResponse)
-> Either String Int
-> Either String ([AssetModelSummary] -> ListAssetModelsResponse)
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 ([AssetModelSummary] -> ListAssetModelsResponse)
-> Either String [AssetModelSummary]
-> Either String ListAssetModelsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe [AssetModelSummary])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"assetModelSummaries"
Either String (Maybe [AssetModelSummary])
-> [AssetModelSummary] -> Either String [AssetModelSummary]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [AssetModelSummary]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable ListAssetModels
instance Prelude.NFData ListAssetModels
instance Core.ToHeaders ListAssetModels where
toHeaders :: ListAssetModels -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListAssetModels -> 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 ListAssetModels where
toPath :: ListAssetModels -> ByteString
toPath = ByteString -> ListAssetModels -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/asset-models"
instance Core.ToQuery ListAssetModels where
toQuery :: ListAssetModels -> QueryString
toQuery ListAssetModels' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListAssetModels' :: ListAssetModels -> Maybe Natural
$sel:nextToken:ListAssetModels' :: ListAssetModels -> 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 ListAssetModelsResponse = ListAssetModelsResponse'
{
ListAssetModelsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListAssetModelsResponse -> Int
httpStatus :: Prelude.Int,
ListAssetModelsResponse -> [AssetModelSummary]
assetModelSummaries :: [AssetModelSummary]
}
deriving (ListAssetModelsResponse -> ListAssetModelsResponse -> Bool
(ListAssetModelsResponse -> ListAssetModelsResponse -> Bool)
-> (ListAssetModelsResponse -> ListAssetModelsResponse -> Bool)
-> Eq ListAssetModelsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAssetModelsResponse -> ListAssetModelsResponse -> Bool
$c/= :: ListAssetModelsResponse -> ListAssetModelsResponse -> Bool
== :: ListAssetModelsResponse -> ListAssetModelsResponse -> Bool
$c== :: ListAssetModelsResponse -> ListAssetModelsResponse -> Bool
Prelude.Eq, ReadPrec [ListAssetModelsResponse]
ReadPrec ListAssetModelsResponse
Int -> ReadS ListAssetModelsResponse
ReadS [ListAssetModelsResponse]
(Int -> ReadS ListAssetModelsResponse)
-> ReadS [ListAssetModelsResponse]
-> ReadPrec ListAssetModelsResponse
-> ReadPrec [ListAssetModelsResponse]
-> Read ListAssetModelsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAssetModelsResponse]
$creadListPrec :: ReadPrec [ListAssetModelsResponse]
readPrec :: ReadPrec ListAssetModelsResponse
$creadPrec :: ReadPrec ListAssetModelsResponse
readList :: ReadS [ListAssetModelsResponse]
$creadList :: ReadS [ListAssetModelsResponse]
readsPrec :: Int -> ReadS ListAssetModelsResponse
$creadsPrec :: Int -> ReadS ListAssetModelsResponse
Prelude.Read, Int -> ListAssetModelsResponse -> ShowS
[ListAssetModelsResponse] -> ShowS
ListAssetModelsResponse -> String
(Int -> ListAssetModelsResponse -> ShowS)
-> (ListAssetModelsResponse -> String)
-> ([ListAssetModelsResponse] -> ShowS)
-> Show ListAssetModelsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAssetModelsResponse] -> ShowS
$cshowList :: [ListAssetModelsResponse] -> ShowS
show :: ListAssetModelsResponse -> String
$cshow :: ListAssetModelsResponse -> String
showsPrec :: Int -> ListAssetModelsResponse -> ShowS
$cshowsPrec :: Int -> ListAssetModelsResponse -> ShowS
Prelude.Show, (forall x.
ListAssetModelsResponse -> Rep ListAssetModelsResponse x)
-> (forall x.
Rep ListAssetModelsResponse x -> ListAssetModelsResponse)
-> Generic ListAssetModelsResponse
forall x. Rep ListAssetModelsResponse x -> ListAssetModelsResponse
forall x. ListAssetModelsResponse -> Rep ListAssetModelsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAssetModelsResponse x -> ListAssetModelsResponse
$cfrom :: forall x. ListAssetModelsResponse -> Rep ListAssetModelsResponse x
Prelude.Generic)
newListAssetModelsResponse ::
Prelude.Int ->
ListAssetModelsResponse
newListAssetModelsResponse :: Int -> ListAssetModelsResponse
newListAssetModelsResponse Int
pHttpStatus_ =
ListAssetModelsResponse' :: Maybe Text -> Int -> [AssetModelSummary] -> ListAssetModelsResponse
ListAssetModelsResponse'
{ $sel:nextToken:ListAssetModelsResponse' :: Maybe Text
nextToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListAssetModelsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:assetModelSummaries:ListAssetModelsResponse' :: [AssetModelSummary]
assetModelSummaries = [AssetModelSummary]
forall a. Monoid a => a
Prelude.mempty
}
listAssetModelsResponse_nextToken :: Lens.Lens' ListAssetModelsResponse (Prelude.Maybe Prelude.Text)
listAssetModelsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAssetModelsResponse -> f ListAssetModelsResponse
listAssetModelsResponse_nextToken = (ListAssetModelsResponse -> Maybe Text)
-> (ListAssetModelsResponse
-> Maybe Text -> ListAssetModelsResponse)
-> Lens' ListAssetModelsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssetModelsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAssetModelsResponse' :: ListAssetModelsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAssetModelsResponse
s@ListAssetModelsResponse' {} Maybe Text
a -> ListAssetModelsResponse
s {$sel:nextToken:ListAssetModelsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAssetModelsResponse)
listAssetModelsResponse_httpStatus :: Lens.Lens' ListAssetModelsResponse Prelude.Int
listAssetModelsResponse_httpStatus :: (Int -> f Int)
-> ListAssetModelsResponse -> f ListAssetModelsResponse
listAssetModelsResponse_httpStatus = (ListAssetModelsResponse -> Int)
-> (ListAssetModelsResponse -> Int -> ListAssetModelsResponse)
-> Lens ListAssetModelsResponse ListAssetModelsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssetModelsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListAssetModelsResponse' :: ListAssetModelsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListAssetModelsResponse
s@ListAssetModelsResponse' {} Int
a -> ListAssetModelsResponse
s {$sel:httpStatus:ListAssetModelsResponse' :: Int
httpStatus = Int
a} :: ListAssetModelsResponse)
listAssetModelsResponse_assetModelSummaries :: Lens.Lens' ListAssetModelsResponse [AssetModelSummary]
listAssetModelsResponse_assetModelSummaries :: ([AssetModelSummary] -> f [AssetModelSummary])
-> ListAssetModelsResponse -> f ListAssetModelsResponse
listAssetModelsResponse_assetModelSummaries = (ListAssetModelsResponse -> [AssetModelSummary])
-> (ListAssetModelsResponse
-> [AssetModelSummary] -> ListAssetModelsResponse)
-> Lens' ListAssetModelsResponse [AssetModelSummary]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssetModelsResponse' {[AssetModelSummary]
assetModelSummaries :: [AssetModelSummary]
$sel:assetModelSummaries:ListAssetModelsResponse' :: ListAssetModelsResponse -> [AssetModelSummary]
assetModelSummaries} -> [AssetModelSummary]
assetModelSummaries) (\s :: ListAssetModelsResponse
s@ListAssetModelsResponse' {} [AssetModelSummary]
a -> ListAssetModelsResponse
s {$sel:assetModelSummaries:ListAssetModelsResponse' :: [AssetModelSummary]
assetModelSummaries = [AssetModelSummary]
a} :: ListAssetModelsResponse) (([AssetModelSummary] -> f [AssetModelSummary])
-> ListAssetModelsResponse -> f ListAssetModelsResponse)
-> (([AssetModelSummary] -> f [AssetModelSummary])
-> [AssetModelSummary] -> f [AssetModelSummary])
-> ([AssetModelSummary] -> f [AssetModelSummary])
-> ListAssetModelsResponse
-> f ListAssetModelsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([AssetModelSummary] -> f [AssetModelSummary])
-> [AssetModelSummary] -> f [AssetModelSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListAssetModelsResponse