{-# 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.IoT.ListThings
(
ListThings (..),
newListThings,
listThings_attributeName,
listThings_attributeValue,
listThings_maxResults,
listThings_nextToken,
listThings_thingTypeName,
listThings_usePrefixAttributeValue,
ListThingsResponse (..),
newListThingsResponse,
listThingsResponse_nextToken,
listThingsResponse_things,
listThingsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListThings = ListThings'
{
ListThings -> Maybe Text
attributeName :: Prelude.Maybe Prelude.Text,
ListThings -> Maybe Text
attributeValue :: Prelude.Maybe Prelude.Text,
ListThings -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListThings -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListThings -> Maybe Text
thingTypeName :: Prelude.Maybe Prelude.Text,
ListThings -> Maybe Bool
usePrefixAttributeValue :: Prelude.Maybe Prelude.Bool
}
deriving (ListThings -> ListThings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListThings -> ListThings -> Bool
$c/= :: ListThings -> ListThings -> Bool
== :: ListThings -> ListThings -> Bool
$c== :: ListThings -> ListThings -> Bool
Prelude.Eq, ReadPrec [ListThings]
ReadPrec ListThings
Int -> ReadS ListThings
ReadS [ListThings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListThings]
$creadListPrec :: ReadPrec [ListThings]
readPrec :: ReadPrec ListThings
$creadPrec :: ReadPrec ListThings
readList :: ReadS [ListThings]
$creadList :: ReadS [ListThings]
readsPrec :: Int -> ReadS ListThings
$creadsPrec :: Int -> ReadS ListThings
Prelude.Read, Int -> ListThings -> ShowS
[ListThings] -> ShowS
ListThings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListThings] -> ShowS
$cshowList :: [ListThings] -> ShowS
show :: ListThings -> String
$cshow :: ListThings -> String
showsPrec :: Int -> ListThings -> ShowS
$cshowsPrec :: Int -> ListThings -> ShowS
Prelude.Show, forall x. Rep ListThings x -> ListThings
forall x. ListThings -> Rep ListThings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListThings x -> ListThings
$cfrom :: forall x. ListThings -> Rep ListThings x
Prelude.Generic)
newListThings ::
ListThings
newListThings :: ListThings
newListThings =
ListThings'
{ $sel:attributeName:ListThings' :: Maybe Text
attributeName = forall a. Maybe a
Prelude.Nothing,
$sel:attributeValue:ListThings' :: Maybe Text
attributeValue = forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListThings' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListThings' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:thingTypeName:ListThings' :: Maybe Text
thingTypeName = forall a. Maybe a
Prelude.Nothing,
$sel:usePrefixAttributeValue:ListThings' :: Maybe Bool
usePrefixAttributeValue = forall a. Maybe a
Prelude.Nothing
}
listThings_attributeName :: Lens.Lens' ListThings (Prelude.Maybe Prelude.Text)
listThings_attributeName :: Lens' ListThings (Maybe Text)
listThings_attributeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThings' {Maybe Text
attributeName :: Maybe Text
$sel:attributeName:ListThings' :: ListThings -> Maybe Text
attributeName} -> Maybe Text
attributeName) (\s :: ListThings
s@ListThings' {} Maybe Text
a -> ListThings
s {$sel:attributeName:ListThings' :: Maybe Text
attributeName = Maybe Text
a} :: ListThings)
listThings_attributeValue :: Lens.Lens' ListThings (Prelude.Maybe Prelude.Text)
listThings_attributeValue :: Lens' ListThings (Maybe Text)
listThings_attributeValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThings' {Maybe Text
attributeValue :: Maybe Text
$sel:attributeValue:ListThings' :: ListThings -> Maybe Text
attributeValue} -> Maybe Text
attributeValue) (\s :: ListThings
s@ListThings' {} Maybe Text
a -> ListThings
s {$sel:attributeValue:ListThings' :: Maybe Text
attributeValue = Maybe Text
a} :: ListThings)
listThings_maxResults :: Lens.Lens' ListThings (Prelude.Maybe Prelude.Natural)
listThings_maxResults :: Lens' ListThings (Maybe Natural)
listThings_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThings' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListThings' :: ListThings -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListThings
s@ListThings' {} Maybe Natural
a -> ListThings
s {$sel:maxResults:ListThings' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListThings)
listThings_nextToken :: Lens.Lens' ListThings (Prelude.Maybe Prelude.Text)
listThings_nextToken :: Lens' ListThings (Maybe Text)
listThings_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThings' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListThings' :: ListThings -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListThings
s@ListThings' {} Maybe Text
a -> ListThings
s {$sel:nextToken:ListThings' :: Maybe Text
nextToken = Maybe Text
a} :: ListThings)
listThings_thingTypeName :: Lens.Lens' ListThings (Prelude.Maybe Prelude.Text)
listThings_thingTypeName :: Lens' ListThings (Maybe Text)
listThings_thingTypeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThings' {Maybe Text
thingTypeName :: Maybe Text
$sel:thingTypeName:ListThings' :: ListThings -> Maybe Text
thingTypeName} -> Maybe Text
thingTypeName) (\s :: ListThings
s@ListThings' {} Maybe Text
a -> ListThings
s {$sel:thingTypeName:ListThings' :: Maybe Text
thingTypeName = Maybe Text
a} :: ListThings)
listThings_usePrefixAttributeValue :: Lens.Lens' ListThings (Prelude.Maybe Prelude.Bool)
listThings_usePrefixAttributeValue :: Lens' ListThings (Maybe Bool)
listThings_usePrefixAttributeValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThings' {Maybe Bool
usePrefixAttributeValue :: Maybe Bool
$sel:usePrefixAttributeValue:ListThings' :: ListThings -> Maybe Bool
usePrefixAttributeValue} -> Maybe Bool
usePrefixAttributeValue) (\s :: ListThings
s@ListThings' {} Maybe Bool
a -> ListThings
s {$sel:usePrefixAttributeValue:ListThings' :: Maybe Bool
usePrefixAttributeValue = Maybe Bool
a} :: ListThings)
instance Core.AWSPager ListThings where
page :: ListThings -> AWSResponse ListThings -> Maybe ListThings
page ListThings
rq AWSResponse ListThings
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListThings
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListThingsResponse (Maybe Text)
listThingsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListThings
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListThingsResponse (Maybe [ThingAttribute])
listThingsResponse_things
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListThings
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListThings (Maybe Text)
listThings_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListThings
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListThingsResponse (Maybe Text)
listThingsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListThings where
type AWSResponse ListThings = ListThingsResponse
request :: (Service -> Service) -> ListThings -> Request ListThings
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListThings
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListThings)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Maybe [ThingAttribute] -> Int -> ListThingsResponse
ListThingsResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"things" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListThings where
hashWithSalt :: Int -> ListThings -> Int
hashWithSalt Int
_salt ListThings' {Maybe Bool
Maybe Natural
Maybe Text
usePrefixAttributeValue :: Maybe Bool
thingTypeName :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
attributeValue :: Maybe Text
attributeName :: Maybe Text
$sel:usePrefixAttributeValue:ListThings' :: ListThings -> Maybe Bool
$sel:thingTypeName:ListThings' :: ListThings -> Maybe Text
$sel:nextToken:ListThings' :: ListThings -> Maybe Text
$sel:maxResults:ListThings' :: ListThings -> Maybe Natural
$sel:attributeValue:ListThings' :: ListThings -> Maybe Text
$sel:attributeName:ListThings' :: ListThings -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
attributeName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
attributeValue
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
thingTypeName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
usePrefixAttributeValue
instance Prelude.NFData ListThings where
rnf :: ListThings -> ()
rnf ListThings' {Maybe Bool
Maybe Natural
Maybe Text
usePrefixAttributeValue :: Maybe Bool
thingTypeName :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
attributeValue :: Maybe Text
attributeName :: Maybe Text
$sel:usePrefixAttributeValue:ListThings' :: ListThings -> Maybe Bool
$sel:thingTypeName:ListThings' :: ListThings -> Maybe Text
$sel:nextToken:ListThings' :: ListThings -> Maybe Text
$sel:maxResults:ListThings' :: ListThings -> Maybe Natural
$sel:attributeValue:ListThings' :: ListThings -> Maybe Text
$sel:attributeName:ListThings' :: ListThings -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
attributeName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
attributeValue
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
thingTypeName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
usePrefixAttributeValue
instance Data.ToHeaders ListThings where
toHeaders :: ListThings -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath ListThings where
toPath :: ListThings -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/things"
instance Data.ToQuery ListThings where
toQuery :: ListThings -> QueryString
toQuery ListThings' {Maybe Bool
Maybe Natural
Maybe Text
usePrefixAttributeValue :: Maybe Bool
thingTypeName :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
attributeValue :: Maybe Text
attributeName :: Maybe Text
$sel:usePrefixAttributeValue:ListThings' :: ListThings -> Maybe Bool
$sel:thingTypeName:ListThings' :: ListThings -> Maybe Text
$sel:nextToken:ListThings' :: ListThings -> Maybe Text
$sel:maxResults:ListThings' :: ListThings -> Maybe Natural
$sel:attributeValue:ListThings' :: ListThings -> Maybe Text
$sel:attributeName:ListThings' :: ListThings -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"attributeName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
attributeName,
ByteString
"attributeValue" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
attributeValue,
ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken,
ByteString
"thingTypeName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
thingTypeName,
ByteString
"usePrefixAttributeValue"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
usePrefixAttributeValue
]
data ListThingsResponse = ListThingsResponse'
{
ListThingsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListThingsResponse -> Maybe [ThingAttribute]
things :: Prelude.Maybe [ThingAttribute],
ListThingsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListThingsResponse -> ListThingsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListThingsResponse -> ListThingsResponse -> Bool
$c/= :: ListThingsResponse -> ListThingsResponse -> Bool
== :: ListThingsResponse -> ListThingsResponse -> Bool
$c== :: ListThingsResponse -> ListThingsResponse -> Bool
Prelude.Eq, ReadPrec [ListThingsResponse]
ReadPrec ListThingsResponse
Int -> ReadS ListThingsResponse
ReadS [ListThingsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListThingsResponse]
$creadListPrec :: ReadPrec [ListThingsResponse]
readPrec :: ReadPrec ListThingsResponse
$creadPrec :: ReadPrec ListThingsResponse
readList :: ReadS [ListThingsResponse]
$creadList :: ReadS [ListThingsResponse]
readsPrec :: Int -> ReadS ListThingsResponse
$creadsPrec :: Int -> ReadS ListThingsResponse
Prelude.Read, Int -> ListThingsResponse -> ShowS
[ListThingsResponse] -> ShowS
ListThingsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListThingsResponse] -> ShowS
$cshowList :: [ListThingsResponse] -> ShowS
show :: ListThingsResponse -> String
$cshow :: ListThingsResponse -> String
showsPrec :: Int -> ListThingsResponse -> ShowS
$cshowsPrec :: Int -> ListThingsResponse -> ShowS
Prelude.Show, forall x. Rep ListThingsResponse x -> ListThingsResponse
forall x. ListThingsResponse -> Rep ListThingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListThingsResponse x -> ListThingsResponse
$cfrom :: forall x. ListThingsResponse -> Rep ListThingsResponse x
Prelude.Generic)
newListThingsResponse ::
Prelude.Int ->
ListThingsResponse
newListThingsResponse :: Int -> ListThingsResponse
newListThingsResponse Int
pHttpStatus_ =
ListThingsResponse'
{ $sel:nextToken:ListThingsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:things:ListThingsResponse' :: Maybe [ThingAttribute]
things = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListThingsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listThingsResponse_nextToken :: Lens.Lens' ListThingsResponse (Prelude.Maybe Prelude.Text)
listThingsResponse_nextToken :: Lens' ListThingsResponse (Maybe Text)
listThingsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListThingsResponse' :: ListThingsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListThingsResponse
s@ListThingsResponse' {} Maybe Text
a -> ListThingsResponse
s {$sel:nextToken:ListThingsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListThingsResponse)
listThingsResponse_things :: Lens.Lens' ListThingsResponse (Prelude.Maybe [ThingAttribute])
listThingsResponse_things :: Lens' ListThingsResponse (Maybe [ThingAttribute])
listThingsResponse_things = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingsResponse' {Maybe [ThingAttribute]
things :: Maybe [ThingAttribute]
$sel:things:ListThingsResponse' :: ListThingsResponse -> Maybe [ThingAttribute]
things} -> Maybe [ThingAttribute]
things) (\s :: ListThingsResponse
s@ListThingsResponse' {} Maybe [ThingAttribute]
a -> ListThingsResponse
s {$sel:things:ListThingsResponse' :: Maybe [ThingAttribute]
things = Maybe [ThingAttribute]
a} :: ListThingsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listThingsResponse_httpStatus :: Lens.Lens' ListThingsResponse Prelude.Int
listThingsResponse_httpStatus :: Lens' ListThingsResponse Int
listThingsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListThingsResponse' :: ListThingsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListThingsResponse
s@ListThingsResponse' {} Int
a -> ListThingsResponse
s {$sel:httpStatus:ListThingsResponse' :: Int
httpStatus = Int
a} :: ListThingsResponse)
instance Prelude.NFData ListThingsResponse where
rnf :: ListThingsResponse -> ()
rnf ListThingsResponse' {Int
Maybe [ThingAttribute]
Maybe Text
httpStatus :: Int
things :: Maybe [ThingAttribute]
nextToken :: Maybe Text
$sel:httpStatus:ListThingsResponse' :: ListThingsResponse -> Int
$sel:things:ListThingsResponse' :: ListThingsResponse -> Maybe [ThingAttribute]
$sel:nextToken:ListThingsResponse' :: ListThingsResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ThingAttribute]
things
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus