{-# 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.IoTEvents.ListInputs
-- 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 inputs you have created.
module Amazonka.IoTEvents.ListInputs
  ( -- * Creating a Request
    ListInputs (..),
    newListInputs,

    -- * Request Lenses
    listInputs_maxResults,
    listInputs_nextToken,

    -- * Destructuring the Response
    ListInputsResponse (..),
    newListInputsResponse,

    -- * Response Lenses
    listInputsResponse_inputSummaries,
    listInputsResponse_nextToken,
    listInputsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListInputs' smart constructor.
data ListInputs = ListInputs'
  { -- | The maximum number of results to be returned per request.
    ListInputs -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token that you can use to return the next set of results.
    ListInputs -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (ListInputs -> ListInputs -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListInputs -> ListInputs -> Bool
$c/= :: ListInputs -> ListInputs -> Bool
== :: ListInputs -> ListInputs -> Bool
$c== :: ListInputs -> ListInputs -> Bool
Prelude.Eq, ReadPrec [ListInputs]
ReadPrec ListInputs
Int -> ReadS ListInputs
ReadS [ListInputs]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListInputs]
$creadListPrec :: ReadPrec [ListInputs]
readPrec :: ReadPrec ListInputs
$creadPrec :: ReadPrec ListInputs
readList :: ReadS [ListInputs]
$creadList :: ReadS [ListInputs]
readsPrec :: Int -> ReadS ListInputs
$creadsPrec :: Int -> ReadS ListInputs
Prelude.Read, Int -> ListInputs -> ShowS
[ListInputs] -> ShowS
ListInputs -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListInputs] -> ShowS
$cshowList :: [ListInputs] -> ShowS
show :: ListInputs -> String
$cshow :: ListInputs -> String
showsPrec :: Int -> ListInputs -> ShowS
$cshowsPrec :: Int -> ListInputs -> ShowS
Prelude.Show, forall x. Rep ListInputs x -> ListInputs
forall x. ListInputs -> Rep ListInputs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListInputs x -> ListInputs
$cfrom :: forall x. ListInputs -> Rep ListInputs x
Prelude.Generic)

-- |
-- Create a value of 'ListInputs' 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', 'listInputs_maxResults' - The maximum number of results to be returned per request.
--
-- 'nextToken', 'listInputs_nextToken' - The token that you can use to return the next set of results.
newListInputs ::
  ListInputs
newListInputs :: ListInputs
newListInputs =
  ListInputs'
    { $sel:maxResults:ListInputs' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListInputs' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum number of results to be returned per request.
listInputs_maxResults :: Lens.Lens' ListInputs (Prelude.Maybe Prelude.Natural)
listInputs_maxResults :: Lens' ListInputs (Maybe Natural)
listInputs_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInputs' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListInputs' :: ListInputs -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListInputs
s@ListInputs' {} Maybe Natural
a -> ListInputs
s {$sel:maxResults:ListInputs' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListInputs)

-- | The token that you can use to return the next set of results.
listInputs_nextToken :: Lens.Lens' ListInputs (Prelude.Maybe Prelude.Text)
listInputs_nextToken :: Lens' ListInputs (Maybe Text)
listInputs_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInputs' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListInputs' :: ListInputs -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListInputs
s@ListInputs' {} Maybe Text
a -> ListInputs
s {$sel:nextToken:ListInputs' :: Maybe Text
nextToken = Maybe Text
a} :: ListInputs)

instance Core.AWSRequest ListInputs where
  type AWSResponse ListInputs = ListInputsResponse
  request :: (Service -> Service) -> ListInputs -> Request ListInputs
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 ListInputs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListInputs)))
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 [InputSummary] -> Maybe Text -> Int -> ListInputsResponse
ListInputsResponse'
            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
"inputSummaries" 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 ListInputs where
  hashWithSalt :: Int -> ListInputs -> Int
hashWithSalt Int
_salt ListInputs' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListInputs' :: ListInputs -> Maybe Text
$sel:maxResults:ListInputs' :: ListInputs -> 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 ListInputs where
  rnf :: ListInputs -> ()
rnf ListInputs' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListInputs' :: ListInputs -> Maybe Text
$sel:maxResults:ListInputs' :: ListInputs -> 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 ListInputs where
  toHeaders :: ListInputs -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath ListInputs where
  toPath :: ListInputs -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/inputs"

instance Data.ToQuery ListInputs where
  toQuery :: ListInputs -> QueryString
toQuery ListInputs' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListInputs' :: ListInputs -> Maybe Text
$sel:maxResults:ListInputs' :: ListInputs -> 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:/ 'newListInputsResponse' smart constructor.
data ListInputsResponse = ListInputsResponse'
  { -- | Summary information about the inputs.
    ListInputsResponse -> Maybe [InputSummary]
inputSummaries :: Prelude.Maybe [InputSummary],
    -- | The token that you can use to return the next set of results, or @null@
    -- if there are no more results.
    ListInputsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListInputsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListInputsResponse -> ListInputsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListInputsResponse -> ListInputsResponse -> Bool
$c/= :: ListInputsResponse -> ListInputsResponse -> Bool
== :: ListInputsResponse -> ListInputsResponse -> Bool
$c== :: ListInputsResponse -> ListInputsResponse -> Bool
Prelude.Eq, ReadPrec [ListInputsResponse]
ReadPrec ListInputsResponse
Int -> ReadS ListInputsResponse
ReadS [ListInputsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListInputsResponse]
$creadListPrec :: ReadPrec [ListInputsResponse]
readPrec :: ReadPrec ListInputsResponse
$creadPrec :: ReadPrec ListInputsResponse
readList :: ReadS [ListInputsResponse]
$creadList :: ReadS [ListInputsResponse]
readsPrec :: Int -> ReadS ListInputsResponse
$creadsPrec :: Int -> ReadS ListInputsResponse
Prelude.Read, Int -> ListInputsResponse -> ShowS
[ListInputsResponse] -> ShowS
ListInputsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListInputsResponse] -> ShowS
$cshowList :: [ListInputsResponse] -> ShowS
show :: ListInputsResponse -> String
$cshow :: ListInputsResponse -> String
showsPrec :: Int -> ListInputsResponse -> ShowS
$cshowsPrec :: Int -> ListInputsResponse -> ShowS
Prelude.Show, forall x. Rep ListInputsResponse x -> ListInputsResponse
forall x. ListInputsResponse -> Rep ListInputsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListInputsResponse x -> ListInputsResponse
$cfrom :: forall x. ListInputsResponse -> Rep ListInputsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListInputsResponse' 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:
--
-- 'inputSummaries', 'listInputsResponse_inputSummaries' - Summary information about the inputs.
--
-- 'nextToken', 'listInputsResponse_nextToken' - The token that you can use to return the next set of results, or @null@
-- if there are no more results.
--
-- 'httpStatus', 'listInputsResponse_httpStatus' - The response's http status code.
newListInputsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListInputsResponse
newListInputsResponse :: Int -> ListInputsResponse
newListInputsResponse Int
pHttpStatus_ =
  ListInputsResponse'
    { $sel:inputSummaries:ListInputsResponse' :: Maybe [InputSummary]
inputSummaries =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListInputsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListInputsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Summary information about the inputs.
listInputsResponse_inputSummaries :: Lens.Lens' ListInputsResponse (Prelude.Maybe [InputSummary])
listInputsResponse_inputSummaries :: Lens' ListInputsResponse (Maybe [InputSummary])
listInputsResponse_inputSummaries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInputsResponse' {Maybe [InputSummary]
inputSummaries :: Maybe [InputSummary]
$sel:inputSummaries:ListInputsResponse' :: ListInputsResponse -> Maybe [InputSummary]
inputSummaries} -> Maybe [InputSummary]
inputSummaries) (\s :: ListInputsResponse
s@ListInputsResponse' {} Maybe [InputSummary]
a -> ListInputsResponse
s {$sel:inputSummaries:ListInputsResponse' :: Maybe [InputSummary]
inputSummaries = Maybe [InputSummary]
a} :: ListInputsResponse) 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

-- | The token that you can use to return the next set of results, or @null@
-- if there are no more results.
listInputsResponse_nextToken :: Lens.Lens' ListInputsResponse (Prelude.Maybe Prelude.Text)
listInputsResponse_nextToken :: Lens' ListInputsResponse (Maybe Text)
listInputsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInputsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListInputsResponse' :: ListInputsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListInputsResponse
s@ListInputsResponse' {} Maybe Text
a -> ListInputsResponse
s {$sel:nextToken:ListInputsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListInputsResponse)

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

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