{-# 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.MediaLive.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)
--
-- Produces list of inputs that have been created
--
-- This operation returns paginated results.
module Amazonka.MediaLive.ListInputs
  ( -- * Creating a Request
    ListInputs (..),
    newListInputs,

    -- * Request Lenses
    listInputs_maxResults,
    listInputs_nextToken,

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

    -- * Response Lenses
    listInputsResponse_inputs,
    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.MediaLive.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Placeholder documentation for ListInputsRequest
--
-- /See:/ 'newListInputs' smart constructor.
data ListInputs = ListInputs'
  { ListInputs -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    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' - Undocumented member.
--
-- 'nextToken', 'listInputs_nextToken' - Undocumented member.
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
    }

-- | Undocumented member.
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)

-- | Undocumented member.
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.AWSPager ListInputs where
  page :: ListInputs -> AWSResponse ListInputs -> Maybe ListInputs
page ListInputs
rq AWSResponse ListInputs
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListInputs
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListInputsResponse (Maybe Text)
listInputsResponse_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 ListInputs
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListInputsResponse (Maybe [Input])
listInputsResponse_inputs
            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.$ ListInputs
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListInputs (Maybe Text)
listInputs_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListInputs
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListInputsResponse (Maybe Text)
listInputsResponse_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 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 [Input] -> 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
"inputs" 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] -> 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 ListInputs where
  toPath :: ListInputs -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/prod/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
      ]

-- | Placeholder documentation for ListInputsResponse
--
-- /See:/ 'newListInputsResponse' smart constructor.
data ListInputsResponse = ListInputsResponse'
  { ListInputsResponse -> Maybe [Input]
inputs :: Prelude.Maybe [Input],
    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:
--
-- 'inputs', 'listInputsResponse_inputs' - Undocumented member.
--
-- 'nextToken', 'listInputsResponse_nextToken' - Undocumented member.
--
-- 'httpStatus', 'listInputsResponse_httpStatus' - The response's http status code.
newListInputsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListInputsResponse
newListInputsResponse :: Int -> ListInputsResponse
newListInputsResponse Int
pHttpStatus_ =
  ListInputsResponse'
    { $sel:inputs:ListInputsResponse' :: Maybe [Input]
inputs = 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_
    }

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

-- | Undocumented member.
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 [Input]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
inputs :: Maybe [Input]
$sel:httpStatus:ListInputsResponse' :: ListInputsResponse -> Int
$sel:nextToken:ListInputsResponse' :: ListInputsResponse -> Maybe Text
$sel:inputs:ListInputsResponse' :: ListInputsResponse -> Maybe [Input]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Input]
inputs
      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