{-# 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.Greengrass.ListDeviceDefinitions
(
ListDeviceDefinitions (..),
newListDeviceDefinitions,
listDeviceDefinitions_maxResults,
listDeviceDefinitions_nextToken,
ListDeviceDefinitionsResponse (..),
newListDeviceDefinitionsResponse,
listDeviceDefinitionsResponse_definitions,
listDeviceDefinitionsResponse_nextToken,
listDeviceDefinitionsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Greengrass.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListDeviceDefinitions = ListDeviceDefinitions'
{
ListDeviceDefinitions -> Maybe Text
maxResults :: Prelude.Maybe Prelude.Text,
ListDeviceDefinitions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListDeviceDefinitions -> ListDeviceDefinitions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDeviceDefinitions -> ListDeviceDefinitions -> Bool
$c/= :: ListDeviceDefinitions -> ListDeviceDefinitions -> Bool
== :: ListDeviceDefinitions -> ListDeviceDefinitions -> Bool
$c== :: ListDeviceDefinitions -> ListDeviceDefinitions -> Bool
Prelude.Eq, ReadPrec [ListDeviceDefinitions]
ReadPrec ListDeviceDefinitions
Int -> ReadS ListDeviceDefinitions
ReadS [ListDeviceDefinitions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDeviceDefinitions]
$creadListPrec :: ReadPrec [ListDeviceDefinitions]
readPrec :: ReadPrec ListDeviceDefinitions
$creadPrec :: ReadPrec ListDeviceDefinitions
readList :: ReadS [ListDeviceDefinitions]
$creadList :: ReadS [ListDeviceDefinitions]
readsPrec :: Int -> ReadS ListDeviceDefinitions
$creadsPrec :: Int -> ReadS ListDeviceDefinitions
Prelude.Read, Int -> ListDeviceDefinitions -> ShowS
[ListDeviceDefinitions] -> ShowS
ListDeviceDefinitions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDeviceDefinitions] -> ShowS
$cshowList :: [ListDeviceDefinitions] -> ShowS
show :: ListDeviceDefinitions -> String
$cshow :: ListDeviceDefinitions -> String
showsPrec :: Int -> ListDeviceDefinitions -> ShowS
$cshowsPrec :: Int -> ListDeviceDefinitions -> ShowS
Prelude.Show, forall x. Rep ListDeviceDefinitions x -> ListDeviceDefinitions
forall x. ListDeviceDefinitions -> Rep ListDeviceDefinitions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListDeviceDefinitions x -> ListDeviceDefinitions
$cfrom :: forall x. ListDeviceDefinitions -> Rep ListDeviceDefinitions x
Prelude.Generic)
newListDeviceDefinitions ::
ListDeviceDefinitions
newListDeviceDefinitions :: ListDeviceDefinitions
newListDeviceDefinitions =
ListDeviceDefinitions'
{ $sel:maxResults:ListDeviceDefinitions' :: Maybe Text
maxResults =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListDeviceDefinitions' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listDeviceDefinitions_maxResults :: Lens.Lens' ListDeviceDefinitions (Prelude.Maybe Prelude.Text)
listDeviceDefinitions_maxResults :: Lens' ListDeviceDefinitions (Maybe Text)
listDeviceDefinitions_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeviceDefinitions' {Maybe Text
maxResults :: Maybe Text
$sel:maxResults:ListDeviceDefinitions' :: ListDeviceDefinitions -> Maybe Text
maxResults} -> Maybe Text
maxResults) (\s :: ListDeviceDefinitions
s@ListDeviceDefinitions' {} Maybe Text
a -> ListDeviceDefinitions
s {$sel:maxResults:ListDeviceDefinitions' :: Maybe Text
maxResults = Maybe Text
a} :: ListDeviceDefinitions)
listDeviceDefinitions_nextToken :: Lens.Lens' ListDeviceDefinitions (Prelude.Maybe Prelude.Text)
listDeviceDefinitions_nextToken :: Lens' ListDeviceDefinitions (Maybe Text)
listDeviceDefinitions_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeviceDefinitions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDeviceDefinitions' :: ListDeviceDefinitions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDeviceDefinitions
s@ListDeviceDefinitions' {} Maybe Text
a -> ListDeviceDefinitions
s {$sel:nextToken:ListDeviceDefinitions' :: Maybe Text
nextToken = Maybe Text
a} :: ListDeviceDefinitions)
instance Core.AWSPager ListDeviceDefinitions where
page :: ListDeviceDefinitions
-> AWSResponse ListDeviceDefinitions -> Maybe ListDeviceDefinitions
page ListDeviceDefinitions
rq AWSResponse ListDeviceDefinitions
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListDeviceDefinitions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDeviceDefinitionsResponse (Maybe Text)
listDeviceDefinitionsResponse_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 ListDeviceDefinitions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDeviceDefinitionsResponse (Maybe [DefinitionInformation])
listDeviceDefinitionsResponse_definitions
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.$ ListDeviceDefinitions
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListDeviceDefinitions (Maybe Text)
listDeviceDefinitions_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListDeviceDefinitions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDeviceDefinitionsResponse (Maybe Text)
listDeviceDefinitionsResponse_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 ListDeviceDefinitions where
type
AWSResponse ListDeviceDefinitions =
ListDeviceDefinitionsResponse
request :: (Service -> Service)
-> ListDeviceDefinitions -> Request ListDeviceDefinitions
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 ListDeviceDefinitions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListDeviceDefinitions)))
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 [DefinitionInformation]
-> Maybe Text -> Int -> ListDeviceDefinitionsResponse
ListDeviceDefinitionsResponse'
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
"Definitions" 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.<*> (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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListDeviceDefinitions where
hashWithSalt :: Int -> ListDeviceDefinitions -> Int
hashWithSalt Int
_salt ListDeviceDefinitions' {Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Text
$sel:nextToken:ListDeviceDefinitions' :: ListDeviceDefinitions -> Maybe Text
$sel:maxResults:ListDeviceDefinitions' :: ListDeviceDefinitions -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData ListDeviceDefinitions where
rnf :: ListDeviceDefinitions -> ()
rnf ListDeviceDefinitions' {Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Text
$sel:nextToken:ListDeviceDefinitions' :: ListDeviceDefinitions -> Maybe Text
$sel:maxResults:ListDeviceDefinitions' :: ListDeviceDefinitions -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
instance Data.ToHeaders ListDeviceDefinitions where
toHeaders :: ListDeviceDefinitions -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath ListDeviceDefinitions where
toPath :: ListDeviceDefinitions -> ByteString
toPath =
forall a b. a -> b -> a
Prelude.const ByteString
"/greengrass/definition/devices"
instance Data.ToQuery ListDeviceDefinitions where
toQuery :: ListDeviceDefinitions -> QueryString
toQuery ListDeviceDefinitions' {Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Text
$sel:nextToken:ListDeviceDefinitions' :: ListDeviceDefinitions -> Maybe Text
$sel:maxResults:ListDeviceDefinitions' :: ListDeviceDefinitions -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"MaxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
maxResults,
ByteString
"NextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
data ListDeviceDefinitionsResponse = ListDeviceDefinitionsResponse'
{
ListDeviceDefinitionsResponse -> Maybe [DefinitionInformation]
definitions :: Prelude.Maybe [DefinitionInformation],
ListDeviceDefinitionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListDeviceDefinitionsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListDeviceDefinitionsResponse
-> ListDeviceDefinitionsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDeviceDefinitionsResponse
-> ListDeviceDefinitionsResponse -> Bool
$c/= :: ListDeviceDefinitionsResponse
-> ListDeviceDefinitionsResponse -> Bool
== :: ListDeviceDefinitionsResponse
-> ListDeviceDefinitionsResponse -> Bool
$c== :: ListDeviceDefinitionsResponse
-> ListDeviceDefinitionsResponse -> Bool
Prelude.Eq, ReadPrec [ListDeviceDefinitionsResponse]
ReadPrec ListDeviceDefinitionsResponse
Int -> ReadS ListDeviceDefinitionsResponse
ReadS [ListDeviceDefinitionsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDeviceDefinitionsResponse]
$creadListPrec :: ReadPrec [ListDeviceDefinitionsResponse]
readPrec :: ReadPrec ListDeviceDefinitionsResponse
$creadPrec :: ReadPrec ListDeviceDefinitionsResponse
readList :: ReadS [ListDeviceDefinitionsResponse]
$creadList :: ReadS [ListDeviceDefinitionsResponse]
readsPrec :: Int -> ReadS ListDeviceDefinitionsResponse
$creadsPrec :: Int -> ReadS ListDeviceDefinitionsResponse
Prelude.Read, Int -> ListDeviceDefinitionsResponse -> ShowS
[ListDeviceDefinitionsResponse] -> ShowS
ListDeviceDefinitionsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDeviceDefinitionsResponse] -> ShowS
$cshowList :: [ListDeviceDefinitionsResponse] -> ShowS
show :: ListDeviceDefinitionsResponse -> String
$cshow :: ListDeviceDefinitionsResponse -> String
showsPrec :: Int -> ListDeviceDefinitionsResponse -> ShowS
$cshowsPrec :: Int -> ListDeviceDefinitionsResponse -> ShowS
Prelude.Show, forall x.
Rep ListDeviceDefinitionsResponse x
-> ListDeviceDefinitionsResponse
forall x.
ListDeviceDefinitionsResponse
-> Rep ListDeviceDefinitionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListDeviceDefinitionsResponse x
-> ListDeviceDefinitionsResponse
$cfrom :: forall x.
ListDeviceDefinitionsResponse
-> Rep ListDeviceDefinitionsResponse x
Prelude.Generic)
newListDeviceDefinitionsResponse ::
Prelude.Int ->
ListDeviceDefinitionsResponse
newListDeviceDefinitionsResponse :: Int -> ListDeviceDefinitionsResponse
newListDeviceDefinitionsResponse Int
pHttpStatus_ =
ListDeviceDefinitionsResponse'
{ $sel:definitions:ListDeviceDefinitionsResponse' :: Maybe [DefinitionInformation]
definitions =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListDeviceDefinitionsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListDeviceDefinitionsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listDeviceDefinitionsResponse_definitions :: Lens.Lens' ListDeviceDefinitionsResponse (Prelude.Maybe [DefinitionInformation])
listDeviceDefinitionsResponse_definitions :: Lens' ListDeviceDefinitionsResponse (Maybe [DefinitionInformation])
listDeviceDefinitionsResponse_definitions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeviceDefinitionsResponse' {Maybe [DefinitionInformation]
definitions :: Maybe [DefinitionInformation]
$sel:definitions:ListDeviceDefinitionsResponse' :: ListDeviceDefinitionsResponse -> Maybe [DefinitionInformation]
definitions} -> Maybe [DefinitionInformation]
definitions) (\s :: ListDeviceDefinitionsResponse
s@ListDeviceDefinitionsResponse' {} Maybe [DefinitionInformation]
a -> ListDeviceDefinitionsResponse
s {$sel:definitions:ListDeviceDefinitionsResponse' :: Maybe [DefinitionInformation]
definitions = Maybe [DefinitionInformation]
a} :: ListDeviceDefinitionsResponse) 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
listDeviceDefinitionsResponse_nextToken :: Lens.Lens' ListDeviceDefinitionsResponse (Prelude.Maybe Prelude.Text)
listDeviceDefinitionsResponse_nextToken :: Lens' ListDeviceDefinitionsResponse (Maybe Text)
listDeviceDefinitionsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeviceDefinitionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDeviceDefinitionsResponse' :: ListDeviceDefinitionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDeviceDefinitionsResponse
s@ListDeviceDefinitionsResponse' {} Maybe Text
a -> ListDeviceDefinitionsResponse
s {$sel:nextToken:ListDeviceDefinitionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListDeviceDefinitionsResponse)
listDeviceDefinitionsResponse_httpStatus :: Lens.Lens' ListDeviceDefinitionsResponse Prelude.Int
listDeviceDefinitionsResponse_httpStatus :: Lens' ListDeviceDefinitionsResponse Int
listDeviceDefinitionsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeviceDefinitionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListDeviceDefinitionsResponse' :: ListDeviceDefinitionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListDeviceDefinitionsResponse
s@ListDeviceDefinitionsResponse' {} Int
a -> ListDeviceDefinitionsResponse
s {$sel:httpStatus:ListDeviceDefinitionsResponse' :: Int
httpStatus = Int
a} :: ListDeviceDefinitionsResponse)
instance Prelude.NFData ListDeviceDefinitionsResponse where
rnf :: ListDeviceDefinitionsResponse -> ()
rnf ListDeviceDefinitionsResponse' {Int
Maybe [DefinitionInformation]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
definitions :: Maybe [DefinitionInformation]
$sel:httpStatus:ListDeviceDefinitionsResponse' :: ListDeviceDefinitionsResponse -> Int
$sel:nextToken:ListDeviceDefinitionsResponse' :: ListDeviceDefinitionsResponse -> Maybe Text
$sel:definitions:ListDeviceDefinitionsResponse' :: ListDeviceDefinitionsResponse -> Maybe [DefinitionInformation]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [DefinitionInformation]
definitions
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 Int
httpStatus