{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- 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_nextToken,
    listInputs_maxResults,

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

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

import qualified Amazonka.Core as Core
import Amazonka.IoTEvents.Types
import qualified Amazonka.Lens as Lens
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 token that you can use to return the next set of results.
    ListInputs -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to be returned per request.
    ListInputs -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListInputs -> ListInputs -> Bool
(ListInputs -> ListInputs -> Bool)
-> (ListInputs -> ListInputs -> Bool) -> Eq ListInputs
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]
(Int -> ReadS ListInputs)
-> ReadS [ListInputs]
-> ReadPrec ListInputs
-> ReadPrec [ListInputs]
-> Read 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
(Int -> ListInputs -> ShowS)
-> (ListInputs -> String)
-> ([ListInputs] -> ShowS)
-> Show ListInputs
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. ListInputs -> Rep ListInputs x)
-> (forall x. Rep ListInputs x -> ListInputs) -> Generic ListInputs
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:
--
-- 'nextToken', 'listInputs_nextToken' - The token that you can use to return the next set of results.
--
-- 'maxResults', 'listInputs_maxResults' - The maximum number of results to be returned per request.
newListInputs ::
  ListInputs
newListInputs :: ListInputs
newListInputs =
  ListInputs' :: Maybe Text -> Maybe Natural -> ListInputs
ListInputs'
    { $sel:nextToken:ListInputs' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListInputs' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The token that you can use to return the next set of results.
listInputs_nextToken :: Lens.Lens' ListInputs (Prelude.Maybe Prelude.Text)
listInputs_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListInputs -> f ListInputs
listInputs_nextToken = (ListInputs -> Maybe Text)
-> (ListInputs -> Maybe Text -> ListInputs)
-> Lens ListInputs ListInputs (Maybe Text) (Maybe Text)
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)

-- | The maximum number of results to be returned per request.
listInputs_maxResults :: Lens.Lens' ListInputs (Prelude.Maybe Prelude.Natural)
listInputs_maxResults :: (Maybe Natural -> f (Maybe Natural)) -> ListInputs -> f ListInputs
listInputs_maxResults = (ListInputs -> Maybe Natural)
-> (ListInputs -> Maybe Natural -> ListInputs)
-> Lens ListInputs ListInputs (Maybe Natural) (Maybe Natural)
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)

instance Core.AWSRequest ListInputs where
  type AWSResponse ListInputs = ListInputsResponse
  request :: ListInputs -> Request ListInputs
request = Service -> ListInputs -> Request ListInputs
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListInputs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListInputs)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListInputs))
-> Logger
-> Service
-> Proxy ListInputs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListInputs)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> 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'
            (Maybe [InputSummary] -> Maybe Text -> Int -> ListInputsResponse)
-> Either String (Maybe [InputSummary])
-> Either String (Maybe Text -> Int -> ListInputsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [InputSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"inputSummaries" Either String (Maybe (Maybe [InputSummary]))
-> Maybe [InputSummary] -> Either String (Maybe [InputSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [InputSummary]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> ListInputsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListInputsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
            Either String (Int -> ListInputsResponse)
-> Either String Int -> Either String ListInputsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListInputs

instance Prelude.NFData ListInputs

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

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

instance Core.ToQuery ListInputs where
  toQuery :: ListInputs -> QueryString
toQuery ListInputs' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListInputs' :: ListInputs -> Maybe Natural
$sel:nextToken:ListInputs' :: ListInputs -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
      ]

-- | /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
(ListInputsResponse -> ListInputsResponse -> Bool)
-> (ListInputsResponse -> ListInputsResponse -> Bool)
-> Eq ListInputsResponse
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]
(Int -> ReadS ListInputsResponse)
-> ReadS [ListInputsResponse]
-> ReadPrec ListInputsResponse
-> ReadPrec [ListInputsResponse]
-> Read 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
(Int -> ListInputsResponse -> ShowS)
-> (ListInputsResponse -> String)
-> ([ListInputsResponse] -> ShowS)
-> Show ListInputsResponse
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. ListInputsResponse -> Rep ListInputsResponse x)
-> (forall x. Rep ListInputsResponse x -> ListInputsResponse)
-> Generic ListInputsResponse
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' :: Maybe [InputSummary] -> Maybe Text -> Int -> ListInputsResponse
ListInputsResponse'
    { $sel:inputSummaries:ListInputsResponse' :: Maybe [InputSummary]
inputSummaries =
        Maybe [InputSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListInputsResponse' :: Maybe Text
nextToken = Maybe Text
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 :: (Maybe [InputSummary] -> f (Maybe [InputSummary]))
-> ListInputsResponse -> f ListInputsResponse
listInputsResponse_inputSummaries = (ListInputsResponse -> Maybe [InputSummary])
-> (ListInputsResponse
    -> Maybe [InputSummary] -> ListInputsResponse)
-> Lens
     ListInputsResponse
     ListInputsResponse
     (Maybe [InputSummary])
     (Maybe [InputSummary])
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) ((Maybe [InputSummary] -> f (Maybe [InputSummary]))
 -> ListInputsResponse -> f ListInputsResponse)
-> ((Maybe [InputSummary] -> f (Maybe [InputSummary]))
    -> Maybe [InputSummary] -> f (Maybe [InputSummary]))
-> (Maybe [InputSummary] -> f (Maybe [InputSummary]))
-> ListInputsResponse
-> f ListInputsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [InputSummary] [InputSummary] [InputSummary] [InputSummary]
-> Iso
     (Maybe [InputSummary])
     (Maybe [InputSummary])
     (Maybe [InputSummary])
     (Maybe [InputSummary])
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 AnIso [InputSummary] [InputSummary] [InputSummary] [InputSummary]
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 :: (Maybe Text -> f (Maybe Text))
-> ListInputsResponse -> f ListInputsResponse
listInputsResponse_nextToken = (ListInputsResponse -> Maybe Text)
-> (ListInputsResponse -> Maybe Text -> ListInputsResponse)
-> Lens
     ListInputsResponse ListInputsResponse (Maybe Text) (Maybe Text)
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 :: (Int -> f Int) -> ListInputsResponse -> f ListInputsResponse
listInputsResponse_httpStatus = (ListInputsResponse -> Int)
-> (ListInputsResponse -> Int -> ListInputsResponse)
-> Lens ListInputsResponse ListInputsResponse Int Int
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