{-# 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.ListOTAUpdates
(
ListOTAUpdates (..),
newListOTAUpdates,
listOTAUpdates_maxResults,
listOTAUpdates_nextToken,
listOTAUpdates_otaUpdateStatus,
ListOTAUpdatesResponse (..),
newListOTAUpdatesResponse,
listOTAUpdatesResponse_nextToken,
listOTAUpdatesResponse_otaUpdates,
listOTAUpdatesResponse_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 ListOTAUpdates = ListOTAUpdates'
{
ListOTAUpdates -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListOTAUpdates -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListOTAUpdates -> Maybe OTAUpdateStatus
otaUpdateStatus :: Prelude.Maybe OTAUpdateStatus
}
deriving (ListOTAUpdates -> ListOTAUpdates -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListOTAUpdates -> ListOTAUpdates -> Bool
$c/= :: ListOTAUpdates -> ListOTAUpdates -> Bool
== :: ListOTAUpdates -> ListOTAUpdates -> Bool
$c== :: ListOTAUpdates -> ListOTAUpdates -> Bool
Prelude.Eq, ReadPrec [ListOTAUpdates]
ReadPrec ListOTAUpdates
Int -> ReadS ListOTAUpdates
ReadS [ListOTAUpdates]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListOTAUpdates]
$creadListPrec :: ReadPrec [ListOTAUpdates]
readPrec :: ReadPrec ListOTAUpdates
$creadPrec :: ReadPrec ListOTAUpdates
readList :: ReadS [ListOTAUpdates]
$creadList :: ReadS [ListOTAUpdates]
readsPrec :: Int -> ReadS ListOTAUpdates
$creadsPrec :: Int -> ReadS ListOTAUpdates
Prelude.Read, Int -> ListOTAUpdates -> ShowS
[ListOTAUpdates] -> ShowS
ListOTAUpdates -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListOTAUpdates] -> ShowS
$cshowList :: [ListOTAUpdates] -> ShowS
show :: ListOTAUpdates -> String
$cshow :: ListOTAUpdates -> String
showsPrec :: Int -> ListOTAUpdates -> ShowS
$cshowsPrec :: Int -> ListOTAUpdates -> ShowS
Prelude.Show, forall x. Rep ListOTAUpdates x -> ListOTAUpdates
forall x. ListOTAUpdates -> Rep ListOTAUpdates x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListOTAUpdates x -> ListOTAUpdates
$cfrom :: forall x. ListOTAUpdates -> Rep ListOTAUpdates x
Prelude.Generic)
newListOTAUpdates ::
ListOTAUpdates
newListOTAUpdates :: ListOTAUpdates
newListOTAUpdates =
ListOTAUpdates'
{ $sel:maxResults:ListOTAUpdates' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListOTAUpdates' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:otaUpdateStatus:ListOTAUpdates' :: Maybe OTAUpdateStatus
otaUpdateStatus = forall a. Maybe a
Prelude.Nothing
}
listOTAUpdates_maxResults :: Lens.Lens' ListOTAUpdates (Prelude.Maybe Prelude.Natural)
listOTAUpdates_maxResults :: Lens' ListOTAUpdates (Maybe Natural)
listOTAUpdates_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOTAUpdates' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListOTAUpdates' :: ListOTAUpdates -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListOTAUpdates
s@ListOTAUpdates' {} Maybe Natural
a -> ListOTAUpdates
s {$sel:maxResults:ListOTAUpdates' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListOTAUpdates)
listOTAUpdates_nextToken :: Lens.Lens' ListOTAUpdates (Prelude.Maybe Prelude.Text)
listOTAUpdates_nextToken :: Lens' ListOTAUpdates (Maybe Text)
listOTAUpdates_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOTAUpdates' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListOTAUpdates' :: ListOTAUpdates -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListOTAUpdates
s@ListOTAUpdates' {} Maybe Text
a -> ListOTAUpdates
s {$sel:nextToken:ListOTAUpdates' :: Maybe Text
nextToken = Maybe Text
a} :: ListOTAUpdates)
listOTAUpdates_otaUpdateStatus :: Lens.Lens' ListOTAUpdates (Prelude.Maybe OTAUpdateStatus)
listOTAUpdates_otaUpdateStatus :: Lens' ListOTAUpdates (Maybe OTAUpdateStatus)
listOTAUpdates_otaUpdateStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOTAUpdates' {Maybe OTAUpdateStatus
otaUpdateStatus :: Maybe OTAUpdateStatus
$sel:otaUpdateStatus:ListOTAUpdates' :: ListOTAUpdates -> Maybe OTAUpdateStatus
otaUpdateStatus} -> Maybe OTAUpdateStatus
otaUpdateStatus) (\s :: ListOTAUpdates
s@ListOTAUpdates' {} Maybe OTAUpdateStatus
a -> ListOTAUpdates
s {$sel:otaUpdateStatus:ListOTAUpdates' :: Maybe OTAUpdateStatus
otaUpdateStatus = Maybe OTAUpdateStatus
a} :: ListOTAUpdates)
instance Core.AWSPager ListOTAUpdates where
page :: ListOTAUpdates
-> AWSResponse ListOTAUpdates -> Maybe ListOTAUpdates
page ListOTAUpdates
rq AWSResponse ListOTAUpdates
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListOTAUpdates
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListOTAUpdatesResponse (Maybe Text)
listOTAUpdatesResponse_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 ListOTAUpdates
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListOTAUpdatesResponse (Maybe [OTAUpdateSummary])
listOTAUpdatesResponse_otaUpdates
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.$ ListOTAUpdates
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListOTAUpdates (Maybe Text)
listOTAUpdates_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListOTAUpdates
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListOTAUpdatesResponse (Maybe Text)
listOTAUpdatesResponse_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 ListOTAUpdates where
type
AWSResponse ListOTAUpdates =
ListOTAUpdatesResponse
request :: (Service -> Service) -> ListOTAUpdates -> Request ListOTAUpdates
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 ListOTAUpdates
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListOTAUpdates)))
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 [OTAUpdateSummary] -> Int -> ListOTAUpdatesResponse
ListOTAUpdatesResponse'
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
"otaUpdates" 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 ListOTAUpdates where
hashWithSalt :: Int -> ListOTAUpdates -> Int
hashWithSalt Int
_salt ListOTAUpdates' {Maybe Natural
Maybe Text
Maybe OTAUpdateStatus
otaUpdateStatus :: Maybe OTAUpdateStatus
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:otaUpdateStatus:ListOTAUpdates' :: ListOTAUpdates -> Maybe OTAUpdateStatus
$sel:nextToken:ListOTAUpdates' :: ListOTAUpdates -> Maybe Text
$sel:maxResults:ListOTAUpdates' :: ListOTAUpdates -> Maybe Natural
..} =
Int
_salt
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 OTAUpdateStatus
otaUpdateStatus
instance Prelude.NFData ListOTAUpdates where
rnf :: ListOTAUpdates -> ()
rnf ListOTAUpdates' {Maybe Natural
Maybe Text
Maybe OTAUpdateStatus
otaUpdateStatus :: Maybe OTAUpdateStatus
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:otaUpdateStatus:ListOTAUpdates' :: ListOTAUpdates -> Maybe OTAUpdateStatus
$sel:nextToken:ListOTAUpdates' :: ListOTAUpdates -> Maybe Text
$sel:maxResults:ListOTAUpdates' :: ListOTAUpdates -> Maybe Natural
..} =
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 OTAUpdateStatus
otaUpdateStatus
instance Data.ToHeaders ListOTAUpdates where
toHeaders :: ListOTAUpdates -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath ListOTAUpdates where
toPath :: ListOTAUpdates -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/otaUpdates"
instance Data.ToQuery ListOTAUpdates where
toQuery :: ListOTAUpdates -> QueryString
toQuery ListOTAUpdates' {Maybe Natural
Maybe Text
Maybe OTAUpdateStatus
otaUpdateStatus :: Maybe OTAUpdateStatus
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:otaUpdateStatus:ListOTAUpdates' :: ListOTAUpdates -> Maybe OTAUpdateStatus
$sel:nextToken:ListOTAUpdates' :: ListOTAUpdates -> Maybe Text
$sel:maxResults:ListOTAUpdates' :: ListOTAUpdates -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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
"otaUpdateStatus" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe OTAUpdateStatus
otaUpdateStatus
]
data ListOTAUpdatesResponse = ListOTAUpdatesResponse'
{
ListOTAUpdatesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListOTAUpdatesResponse -> Maybe [OTAUpdateSummary]
otaUpdates :: Prelude.Maybe [OTAUpdateSummary],
ListOTAUpdatesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListOTAUpdatesResponse -> ListOTAUpdatesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListOTAUpdatesResponse -> ListOTAUpdatesResponse -> Bool
$c/= :: ListOTAUpdatesResponse -> ListOTAUpdatesResponse -> Bool
== :: ListOTAUpdatesResponse -> ListOTAUpdatesResponse -> Bool
$c== :: ListOTAUpdatesResponse -> ListOTAUpdatesResponse -> Bool
Prelude.Eq, ReadPrec [ListOTAUpdatesResponse]
ReadPrec ListOTAUpdatesResponse
Int -> ReadS ListOTAUpdatesResponse
ReadS [ListOTAUpdatesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListOTAUpdatesResponse]
$creadListPrec :: ReadPrec [ListOTAUpdatesResponse]
readPrec :: ReadPrec ListOTAUpdatesResponse
$creadPrec :: ReadPrec ListOTAUpdatesResponse
readList :: ReadS [ListOTAUpdatesResponse]
$creadList :: ReadS [ListOTAUpdatesResponse]
readsPrec :: Int -> ReadS ListOTAUpdatesResponse
$creadsPrec :: Int -> ReadS ListOTAUpdatesResponse
Prelude.Read, Int -> ListOTAUpdatesResponse -> ShowS
[ListOTAUpdatesResponse] -> ShowS
ListOTAUpdatesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListOTAUpdatesResponse] -> ShowS
$cshowList :: [ListOTAUpdatesResponse] -> ShowS
show :: ListOTAUpdatesResponse -> String
$cshow :: ListOTAUpdatesResponse -> String
showsPrec :: Int -> ListOTAUpdatesResponse -> ShowS
$cshowsPrec :: Int -> ListOTAUpdatesResponse -> ShowS
Prelude.Show, forall x. Rep ListOTAUpdatesResponse x -> ListOTAUpdatesResponse
forall x. ListOTAUpdatesResponse -> Rep ListOTAUpdatesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListOTAUpdatesResponse x -> ListOTAUpdatesResponse
$cfrom :: forall x. ListOTAUpdatesResponse -> Rep ListOTAUpdatesResponse x
Prelude.Generic)
newListOTAUpdatesResponse ::
Prelude.Int ->
ListOTAUpdatesResponse
newListOTAUpdatesResponse :: Int -> ListOTAUpdatesResponse
newListOTAUpdatesResponse Int
pHttpStatus_ =
ListOTAUpdatesResponse'
{ $sel:nextToken:ListOTAUpdatesResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:otaUpdates:ListOTAUpdatesResponse' :: Maybe [OTAUpdateSummary]
otaUpdates = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListOTAUpdatesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listOTAUpdatesResponse_nextToken :: Lens.Lens' ListOTAUpdatesResponse (Prelude.Maybe Prelude.Text)
listOTAUpdatesResponse_nextToken :: Lens' ListOTAUpdatesResponse (Maybe Text)
listOTAUpdatesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOTAUpdatesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListOTAUpdatesResponse' :: ListOTAUpdatesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListOTAUpdatesResponse
s@ListOTAUpdatesResponse' {} Maybe Text
a -> ListOTAUpdatesResponse
s {$sel:nextToken:ListOTAUpdatesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListOTAUpdatesResponse)
listOTAUpdatesResponse_otaUpdates :: Lens.Lens' ListOTAUpdatesResponse (Prelude.Maybe [OTAUpdateSummary])
listOTAUpdatesResponse_otaUpdates :: Lens' ListOTAUpdatesResponse (Maybe [OTAUpdateSummary])
listOTAUpdatesResponse_otaUpdates = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOTAUpdatesResponse' {Maybe [OTAUpdateSummary]
otaUpdates :: Maybe [OTAUpdateSummary]
$sel:otaUpdates:ListOTAUpdatesResponse' :: ListOTAUpdatesResponse -> Maybe [OTAUpdateSummary]
otaUpdates} -> Maybe [OTAUpdateSummary]
otaUpdates) (\s :: ListOTAUpdatesResponse
s@ListOTAUpdatesResponse' {} Maybe [OTAUpdateSummary]
a -> ListOTAUpdatesResponse
s {$sel:otaUpdates:ListOTAUpdatesResponse' :: Maybe [OTAUpdateSummary]
otaUpdates = Maybe [OTAUpdateSummary]
a} :: ListOTAUpdatesResponse) 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
listOTAUpdatesResponse_httpStatus :: Lens.Lens' ListOTAUpdatesResponse Prelude.Int
listOTAUpdatesResponse_httpStatus :: Lens' ListOTAUpdatesResponse Int
listOTAUpdatesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOTAUpdatesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListOTAUpdatesResponse' :: ListOTAUpdatesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListOTAUpdatesResponse
s@ListOTAUpdatesResponse' {} Int
a -> ListOTAUpdatesResponse
s {$sel:httpStatus:ListOTAUpdatesResponse' :: Int
httpStatus = Int
a} :: ListOTAUpdatesResponse)
instance Prelude.NFData ListOTAUpdatesResponse where
rnf :: ListOTAUpdatesResponse -> ()
rnf ListOTAUpdatesResponse' {Int
Maybe [OTAUpdateSummary]
Maybe Text
httpStatus :: Int
otaUpdates :: Maybe [OTAUpdateSummary]
nextToken :: Maybe Text
$sel:httpStatus:ListOTAUpdatesResponse' :: ListOTAUpdatesResponse -> Int
$sel:otaUpdates:ListOTAUpdatesResponse' :: ListOTAUpdatesResponse -> Maybe [OTAUpdateSummary]
$sel:nextToken:ListOTAUpdatesResponse' :: ListOTAUpdatesResponse -> 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 [OTAUpdateSummary]
otaUpdates
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus