{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.IoTWireless.ListFuotaTasks
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists the FUOTA tasks registered to your AWS account.
module Amazonka.IoTWireless.ListFuotaTasks
  ( -- * Creating a Request
    ListFuotaTasks (..),
    newListFuotaTasks,

    -- * Request Lenses
    listFuotaTasks_maxResults,
    listFuotaTasks_nextToken,

    -- * Destructuring the Response
    ListFuotaTasksResponse (..),
    newListFuotaTasksResponse,

    -- * Response Lenses
    listFuotaTasksResponse_fuotaTaskList,
    listFuotaTasksResponse_nextToken,
    listFuotaTasksResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTWireless.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newListFuotaTasks' smart constructor.
data ListFuotaTasks = ListFuotaTasks'
  { ListFuotaTasks -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | To retrieve the next set of results, the @nextToken@ value from a
    -- previous response; otherwise __null__ to receive the first set of
    -- results.
    ListFuotaTasks -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (ListFuotaTasks -> ListFuotaTasks -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListFuotaTasks -> ListFuotaTasks -> Bool
$c/= :: ListFuotaTasks -> ListFuotaTasks -> Bool
== :: ListFuotaTasks -> ListFuotaTasks -> Bool
$c== :: ListFuotaTasks -> ListFuotaTasks -> Bool
Prelude.Eq, ReadPrec [ListFuotaTasks]
ReadPrec ListFuotaTasks
Int -> ReadS ListFuotaTasks
ReadS [ListFuotaTasks]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListFuotaTasks]
$creadListPrec :: ReadPrec [ListFuotaTasks]
readPrec :: ReadPrec ListFuotaTasks
$creadPrec :: ReadPrec ListFuotaTasks
readList :: ReadS [ListFuotaTasks]
$creadList :: ReadS [ListFuotaTasks]
readsPrec :: Int -> ReadS ListFuotaTasks
$creadsPrec :: Int -> ReadS ListFuotaTasks
Prelude.Read, Int -> ListFuotaTasks -> ShowS
[ListFuotaTasks] -> ShowS
ListFuotaTasks -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListFuotaTasks] -> ShowS
$cshowList :: [ListFuotaTasks] -> ShowS
show :: ListFuotaTasks -> String
$cshow :: ListFuotaTasks -> String
showsPrec :: Int -> ListFuotaTasks -> ShowS
$cshowsPrec :: Int -> ListFuotaTasks -> ShowS
Prelude.Show, forall x. Rep ListFuotaTasks x -> ListFuotaTasks
forall x. ListFuotaTasks -> Rep ListFuotaTasks x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListFuotaTasks x -> ListFuotaTasks
$cfrom :: forall x. ListFuotaTasks -> Rep ListFuotaTasks x
Prelude.Generic)

-- |
-- Create a value of 'ListFuotaTasks' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'maxResults', 'listFuotaTasks_maxResults' - Undocumented member.
--
-- 'nextToken', 'listFuotaTasks_nextToken' - To retrieve the next set of results, the @nextToken@ value from a
-- previous response; otherwise __null__ to receive the first set of
-- results.
newListFuotaTasks ::
  ListFuotaTasks
newListFuotaTasks :: ListFuotaTasks
newListFuotaTasks =
  ListFuotaTasks'
    { $sel:maxResults:ListFuotaTasks' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListFuotaTasks' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
listFuotaTasks_maxResults :: Lens.Lens' ListFuotaTasks (Prelude.Maybe Prelude.Natural)
listFuotaTasks_maxResults :: Lens' ListFuotaTasks (Maybe Natural)
listFuotaTasks_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFuotaTasks' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListFuotaTasks' :: ListFuotaTasks -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListFuotaTasks
s@ListFuotaTasks' {} Maybe Natural
a -> ListFuotaTasks
s {$sel:maxResults:ListFuotaTasks' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListFuotaTasks)

-- | To retrieve the next set of results, the @nextToken@ value from a
-- previous response; otherwise __null__ to receive the first set of
-- results.
listFuotaTasks_nextToken :: Lens.Lens' ListFuotaTasks (Prelude.Maybe Prelude.Text)
listFuotaTasks_nextToken :: Lens' ListFuotaTasks (Maybe Text)
listFuotaTasks_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFuotaTasks' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListFuotaTasks' :: ListFuotaTasks -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListFuotaTasks
s@ListFuotaTasks' {} Maybe Text
a -> ListFuotaTasks
s {$sel:nextToken:ListFuotaTasks' :: Maybe Text
nextToken = Maybe Text
a} :: ListFuotaTasks)

instance Core.AWSRequest ListFuotaTasks where
  type
    AWSResponse ListFuotaTasks =
      ListFuotaTasksResponse
  request :: (Service -> Service) -> ListFuotaTasks -> Request ListFuotaTasks
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 ListFuotaTasks
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListFuotaTasks)))
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 [FuotaTask] -> Maybe Text -> Int -> ListFuotaTasksResponse
ListFuotaTasksResponse'
            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
"FuotaTaskList" 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 ListFuotaTasks where
  hashWithSalt :: Int -> ListFuotaTasks -> Int
hashWithSalt Int
_salt ListFuotaTasks' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListFuotaTasks' :: ListFuotaTasks -> Maybe Text
$sel:maxResults:ListFuotaTasks' :: ListFuotaTasks -> 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

instance Prelude.NFData ListFuotaTasks where
  rnf :: ListFuotaTasks -> ()
rnf ListFuotaTasks' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListFuotaTasks' :: ListFuotaTasks -> Maybe Text
$sel:maxResults:ListFuotaTasks' :: ListFuotaTasks -> 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

instance Data.ToHeaders ListFuotaTasks where
  toHeaders :: ListFuotaTasks -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath ListFuotaTasks where
  toPath :: ListFuotaTasks -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/fuota-tasks"

instance Data.ToQuery ListFuotaTasks where
  toQuery :: ListFuotaTasks -> QueryString
toQuery ListFuotaTasks' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListFuotaTasks' :: ListFuotaTasks -> Maybe Text
$sel:maxResults:ListFuotaTasks' :: ListFuotaTasks -> 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
      ]

-- | /See:/ 'newListFuotaTasksResponse' smart constructor.
data ListFuotaTasksResponse = ListFuotaTasksResponse'
  { ListFuotaTasksResponse -> Maybe [FuotaTask]
fuotaTaskList :: Prelude.Maybe [FuotaTask],
    -- | To retrieve the next set of results, the @nextToken@ value from a
    -- previous response; otherwise __null__ to receive the first set of
    -- results.
    ListFuotaTasksResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListFuotaTasksResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListFuotaTasksResponse -> ListFuotaTasksResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListFuotaTasksResponse -> ListFuotaTasksResponse -> Bool
$c/= :: ListFuotaTasksResponse -> ListFuotaTasksResponse -> Bool
== :: ListFuotaTasksResponse -> ListFuotaTasksResponse -> Bool
$c== :: ListFuotaTasksResponse -> ListFuotaTasksResponse -> Bool
Prelude.Eq, ReadPrec [ListFuotaTasksResponse]
ReadPrec ListFuotaTasksResponse
Int -> ReadS ListFuotaTasksResponse
ReadS [ListFuotaTasksResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListFuotaTasksResponse]
$creadListPrec :: ReadPrec [ListFuotaTasksResponse]
readPrec :: ReadPrec ListFuotaTasksResponse
$creadPrec :: ReadPrec ListFuotaTasksResponse
readList :: ReadS [ListFuotaTasksResponse]
$creadList :: ReadS [ListFuotaTasksResponse]
readsPrec :: Int -> ReadS ListFuotaTasksResponse
$creadsPrec :: Int -> ReadS ListFuotaTasksResponse
Prelude.Read, Int -> ListFuotaTasksResponse -> ShowS
[ListFuotaTasksResponse] -> ShowS
ListFuotaTasksResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListFuotaTasksResponse] -> ShowS
$cshowList :: [ListFuotaTasksResponse] -> ShowS
show :: ListFuotaTasksResponse -> String
$cshow :: ListFuotaTasksResponse -> String
showsPrec :: Int -> ListFuotaTasksResponse -> ShowS
$cshowsPrec :: Int -> ListFuotaTasksResponse -> ShowS
Prelude.Show, forall x. Rep ListFuotaTasksResponse x -> ListFuotaTasksResponse
forall x. ListFuotaTasksResponse -> Rep ListFuotaTasksResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListFuotaTasksResponse x -> ListFuotaTasksResponse
$cfrom :: forall x. ListFuotaTasksResponse -> Rep ListFuotaTasksResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListFuotaTasksResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'fuotaTaskList', 'listFuotaTasksResponse_fuotaTaskList' - Undocumented member.
--
-- 'nextToken', 'listFuotaTasksResponse_nextToken' - To retrieve the next set of results, the @nextToken@ value from a
-- previous response; otherwise __null__ to receive the first set of
-- results.
--
-- 'httpStatus', 'listFuotaTasksResponse_httpStatus' - The response's http status code.
newListFuotaTasksResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListFuotaTasksResponse
newListFuotaTasksResponse :: Int -> ListFuotaTasksResponse
newListFuotaTasksResponse Int
pHttpStatus_ =
  ListFuotaTasksResponse'
    { $sel:fuotaTaskList:ListFuotaTasksResponse' :: Maybe [FuotaTask]
fuotaTaskList =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListFuotaTasksResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListFuotaTasksResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
listFuotaTasksResponse_fuotaTaskList :: Lens.Lens' ListFuotaTasksResponse (Prelude.Maybe [FuotaTask])
listFuotaTasksResponse_fuotaTaskList :: Lens' ListFuotaTasksResponse (Maybe [FuotaTask])
listFuotaTasksResponse_fuotaTaskList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFuotaTasksResponse' {Maybe [FuotaTask]
fuotaTaskList :: Maybe [FuotaTask]
$sel:fuotaTaskList:ListFuotaTasksResponse' :: ListFuotaTasksResponse -> Maybe [FuotaTask]
fuotaTaskList} -> Maybe [FuotaTask]
fuotaTaskList) (\s :: ListFuotaTasksResponse
s@ListFuotaTasksResponse' {} Maybe [FuotaTask]
a -> ListFuotaTasksResponse
s {$sel:fuotaTaskList:ListFuotaTasksResponse' :: Maybe [FuotaTask]
fuotaTaskList = Maybe [FuotaTask]
a} :: ListFuotaTasksResponse) 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

-- | To retrieve the next set of results, the @nextToken@ value from a
-- previous response; otherwise __null__ to receive the first set of
-- results.
listFuotaTasksResponse_nextToken :: Lens.Lens' ListFuotaTasksResponse (Prelude.Maybe Prelude.Text)
listFuotaTasksResponse_nextToken :: Lens' ListFuotaTasksResponse (Maybe Text)
listFuotaTasksResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFuotaTasksResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListFuotaTasksResponse' :: ListFuotaTasksResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListFuotaTasksResponse
s@ListFuotaTasksResponse' {} Maybe Text
a -> ListFuotaTasksResponse
s {$sel:nextToken:ListFuotaTasksResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListFuotaTasksResponse)

-- | The response's http status code.
listFuotaTasksResponse_httpStatus :: Lens.Lens' ListFuotaTasksResponse Prelude.Int
listFuotaTasksResponse_httpStatus :: Lens' ListFuotaTasksResponse Int
listFuotaTasksResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFuotaTasksResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListFuotaTasksResponse' :: ListFuotaTasksResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListFuotaTasksResponse
s@ListFuotaTasksResponse' {} Int
a -> ListFuotaTasksResponse
s {$sel:httpStatus:ListFuotaTasksResponse' :: Int
httpStatus = Int
a} :: ListFuotaTasksResponse)

instance Prelude.NFData ListFuotaTasksResponse where
  rnf :: ListFuotaTasksResponse -> ()
rnf ListFuotaTasksResponse' {Int
Maybe [FuotaTask]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
fuotaTaskList :: Maybe [FuotaTask]
$sel:httpStatus:ListFuotaTasksResponse' :: ListFuotaTasksResponse -> Int
$sel:nextToken:ListFuotaTasksResponse' :: ListFuotaTasksResponse -> Maybe Text
$sel:fuotaTaskList:ListFuotaTasksResponse' :: ListFuotaTasksResponse -> Maybe [FuotaTask]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [FuotaTask]
fuotaTaskList
      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