{-# 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.ListInputRoutings
-- 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 one or more input routings.
module Amazonka.IoTEvents.ListInputRoutings
  ( -- * Creating a Request
    ListInputRoutings (..),
    newListInputRoutings,

    -- * Request Lenses
    listInputRoutings_maxResults,
    listInputRoutings_nextToken,
    listInputRoutings_inputIdentifier,

    -- * Destructuring the Response
    ListInputRoutingsResponse (..),
    newListInputRoutingsResponse,

    -- * Response Lenses
    listInputRoutingsResponse_nextToken,
    listInputRoutingsResponse_routedResources,
    listInputRoutingsResponse_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:/ 'newListInputRoutings' smart constructor.
data ListInputRoutings = ListInputRoutings'
  { -- | The maximum number of results to be returned per request.
    ListInputRoutings -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token that you can use to return the next set of results.
    ListInputRoutings -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The identifer of the routed input.
    ListInputRoutings -> InputIdentifier
inputIdentifier :: InputIdentifier
  }
  deriving (ListInputRoutings -> ListInputRoutings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListInputRoutings -> ListInputRoutings -> Bool
$c/= :: ListInputRoutings -> ListInputRoutings -> Bool
== :: ListInputRoutings -> ListInputRoutings -> Bool
$c== :: ListInputRoutings -> ListInputRoutings -> Bool
Prelude.Eq, ReadPrec [ListInputRoutings]
ReadPrec ListInputRoutings
Int -> ReadS ListInputRoutings
ReadS [ListInputRoutings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListInputRoutings]
$creadListPrec :: ReadPrec [ListInputRoutings]
readPrec :: ReadPrec ListInputRoutings
$creadPrec :: ReadPrec ListInputRoutings
readList :: ReadS [ListInputRoutings]
$creadList :: ReadS [ListInputRoutings]
readsPrec :: Int -> ReadS ListInputRoutings
$creadsPrec :: Int -> ReadS ListInputRoutings
Prelude.Read, Int -> ListInputRoutings -> ShowS
[ListInputRoutings] -> ShowS
ListInputRoutings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListInputRoutings] -> ShowS
$cshowList :: [ListInputRoutings] -> ShowS
show :: ListInputRoutings -> String
$cshow :: ListInputRoutings -> String
showsPrec :: Int -> ListInputRoutings -> ShowS
$cshowsPrec :: Int -> ListInputRoutings -> ShowS
Prelude.Show, forall x. Rep ListInputRoutings x -> ListInputRoutings
forall x. ListInputRoutings -> Rep ListInputRoutings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListInputRoutings x -> ListInputRoutings
$cfrom :: forall x. ListInputRoutings -> Rep ListInputRoutings x
Prelude.Generic)

-- |
-- Create a value of 'ListInputRoutings' 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', 'listInputRoutings_maxResults' - The maximum number of results to be returned per request.
--
-- 'nextToken', 'listInputRoutings_nextToken' - The token that you can use to return the next set of results.
--
-- 'inputIdentifier', 'listInputRoutings_inputIdentifier' - The identifer of the routed input.
newListInputRoutings ::
  -- | 'inputIdentifier'
  InputIdentifier ->
  ListInputRoutings
newListInputRoutings :: InputIdentifier -> ListInputRoutings
newListInputRoutings InputIdentifier
pInputIdentifier_ =
  ListInputRoutings'
    { $sel:maxResults:ListInputRoutings' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListInputRoutings' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:inputIdentifier:ListInputRoutings' :: InputIdentifier
inputIdentifier = InputIdentifier
pInputIdentifier_
    }

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

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

-- | The identifer of the routed input.
listInputRoutings_inputIdentifier :: Lens.Lens' ListInputRoutings InputIdentifier
listInputRoutings_inputIdentifier :: Lens' ListInputRoutings InputIdentifier
listInputRoutings_inputIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInputRoutings' {InputIdentifier
inputIdentifier :: InputIdentifier
$sel:inputIdentifier:ListInputRoutings' :: ListInputRoutings -> InputIdentifier
inputIdentifier} -> InputIdentifier
inputIdentifier) (\s :: ListInputRoutings
s@ListInputRoutings' {} InputIdentifier
a -> ListInputRoutings
s {$sel:inputIdentifier:ListInputRoutings' :: InputIdentifier
inputIdentifier = InputIdentifier
a} :: ListInputRoutings)

instance Core.AWSRequest ListInputRoutings where
  type
    AWSResponse ListInputRoutings =
      ListInputRoutingsResponse
  request :: (Service -> Service)
-> ListInputRoutings -> Request ListInputRoutings
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListInputRoutings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListInputRoutings)))
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 [RoutedResource] -> Int -> ListInputRoutingsResponse
ListInputRoutingsResponse'
            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
"routedResources"
                            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 ListInputRoutings where
  hashWithSalt :: Int -> ListInputRoutings -> Int
hashWithSalt Int
_salt ListInputRoutings' {Maybe Natural
Maybe Text
InputIdentifier
inputIdentifier :: InputIdentifier
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:inputIdentifier:ListInputRoutings' :: ListInputRoutings -> InputIdentifier
$sel:nextToken:ListInputRoutings' :: ListInputRoutings -> Maybe Text
$sel:maxResults:ListInputRoutings' :: ListInputRoutings -> 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` InputIdentifier
inputIdentifier

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

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

instance Data.ToJSON ListInputRoutings where
  toJSON :: ListInputRoutings -> Value
toJSON ListInputRoutings' {Maybe Natural
Maybe Text
InputIdentifier
inputIdentifier :: InputIdentifier
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:inputIdentifier:ListInputRoutings' :: ListInputRoutings -> InputIdentifier
$sel:nextToken:ListInputRoutings' :: ListInputRoutings -> Maybe Text
$sel:maxResults:ListInputRoutings' :: ListInputRoutings -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"maxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Key
"nextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"inputIdentifier" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= InputIdentifier
inputIdentifier)
          ]
      )

instance Data.ToPath ListInputRoutings where
  toPath :: ListInputRoutings -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/input-routings"

instance Data.ToQuery ListInputRoutings where
  toQuery :: ListInputRoutings -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newListInputRoutingsResponse' smart constructor.
data ListInputRoutingsResponse = ListInputRoutingsResponse'
  { -- | The token that you can use to return the next set of results, or @null@
    -- if there are no more results.
    ListInputRoutingsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Summary information about the routed resources.
    ListInputRoutingsResponse -> Maybe [RoutedResource]
routedResources :: Prelude.Maybe [RoutedResource],
    -- | The response's http status code.
    ListInputRoutingsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListInputRoutingsResponse -> ListInputRoutingsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListInputRoutingsResponse -> ListInputRoutingsResponse -> Bool
$c/= :: ListInputRoutingsResponse -> ListInputRoutingsResponse -> Bool
== :: ListInputRoutingsResponse -> ListInputRoutingsResponse -> Bool
$c== :: ListInputRoutingsResponse -> ListInputRoutingsResponse -> Bool
Prelude.Eq, ReadPrec [ListInputRoutingsResponse]
ReadPrec ListInputRoutingsResponse
Int -> ReadS ListInputRoutingsResponse
ReadS [ListInputRoutingsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListInputRoutingsResponse]
$creadListPrec :: ReadPrec [ListInputRoutingsResponse]
readPrec :: ReadPrec ListInputRoutingsResponse
$creadPrec :: ReadPrec ListInputRoutingsResponse
readList :: ReadS [ListInputRoutingsResponse]
$creadList :: ReadS [ListInputRoutingsResponse]
readsPrec :: Int -> ReadS ListInputRoutingsResponse
$creadsPrec :: Int -> ReadS ListInputRoutingsResponse
Prelude.Read, Int -> ListInputRoutingsResponse -> ShowS
[ListInputRoutingsResponse] -> ShowS
ListInputRoutingsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListInputRoutingsResponse] -> ShowS
$cshowList :: [ListInputRoutingsResponse] -> ShowS
show :: ListInputRoutingsResponse -> String
$cshow :: ListInputRoutingsResponse -> String
showsPrec :: Int -> ListInputRoutingsResponse -> ShowS
$cshowsPrec :: Int -> ListInputRoutingsResponse -> ShowS
Prelude.Show, forall x.
Rep ListInputRoutingsResponse x -> ListInputRoutingsResponse
forall x.
ListInputRoutingsResponse -> Rep ListInputRoutingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListInputRoutingsResponse x -> ListInputRoutingsResponse
$cfrom :: forall x.
ListInputRoutingsResponse -> Rep ListInputRoutingsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListInputRoutingsResponse' 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', 'listInputRoutingsResponse_nextToken' - The token that you can use to return the next set of results, or @null@
-- if there are no more results.
--
-- 'routedResources', 'listInputRoutingsResponse_routedResources' - Summary information about the routed resources.
--
-- 'httpStatus', 'listInputRoutingsResponse_httpStatus' - The response's http status code.
newListInputRoutingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListInputRoutingsResponse
newListInputRoutingsResponse :: Int -> ListInputRoutingsResponse
newListInputRoutingsResponse Int
pHttpStatus_ =
  ListInputRoutingsResponse'
    { $sel:nextToken:ListInputRoutingsResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:routedResources:ListInputRoutingsResponse' :: Maybe [RoutedResource]
routedResources = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListInputRoutingsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | Summary information about the routed resources.
listInputRoutingsResponse_routedResources :: Lens.Lens' ListInputRoutingsResponse (Prelude.Maybe [RoutedResource])
listInputRoutingsResponse_routedResources :: Lens' ListInputRoutingsResponse (Maybe [RoutedResource])
listInputRoutingsResponse_routedResources = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInputRoutingsResponse' {Maybe [RoutedResource]
routedResources :: Maybe [RoutedResource]
$sel:routedResources:ListInputRoutingsResponse' :: ListInputRoutingsResponse -> Maybe [RoutedResource]
routedResources} -> Maybe [RoutedResource]
routedResources) (\s :: ListInputRoutingsResponse
s@ListInputRoutingsResponse' {} Maybe [RoutedResource]
a -> ListInputRoutingsResponse
s {$sel:routedResources:ListInputRoutingsResponse' :: Maybe [RoutedResource]
routedResources = Maybe [RoutedResource]
a} :: ListInputRoutingsResponse) 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 response's http status code.
listInputRoutingsResponse_httpStatus :: Lens.Lens' ListInputRoutingsResponse Prelude.Int
listInputRoutingsResponse_httpStatus :: Lens' ListInputRoutingsResponse Int
listInputRoutingsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInputRoutingsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListInputRoutingsResponse' :: ListInputRoutingsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListInputRoutingsResponse
s@ListInputRoutingsResponse' {} Int
a -> ListInputRoutingsResponse
s {$sel:httpStatus:ListInputRoutingsResponse' :: Int
httpStatus = Int
a} :: ListInputRoutingsResponse)

instance Prelude.NFData ListInputRoutingsResponse where
  rnf :: ListInputRoutingsResponse -> ()
rnf ListInputRoutingsResponse' {Int
Maybe [RoutedResource]
Maybe Text
httpStatus :: Int
routedResources :: Maybe [RoutedResource]
nextToken :: Maybe Text
$sel:httpStatus:ListInputRoutingsResponse' :: ListInputRoutingsResponse -> Int
$sel:routedResources:ListInputRoutingsResponse' :: ListInputRoutingsResponse -> Maybe [RoutedResource]
$sel:nextToken:ListInputRoutingsResponse' :: ListInputRoutingsResponse -> 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 [RoutedResource]
routedResources
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus