{-# 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.SageMakerA2IRuntime.ListHumanLoops
-- 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)
--
-- Returns information about human loops, given the specified parameters.
-- If a human loop was deleted, it will not be included.
--
-- This operation returns paginated results.
module Amazonka.SageMakerA2IRuntime.ListHumanLoops
  ( -- * Creating a Request
    ListHumanLoops (..),
    newListHumanLoops,

    -- * Request Lenses
    listHumanLoops_creationTimeAfter,
    listHumanLoops_nextToken,
    listHumanLoops_sortOrder,
    listHumanLoops_creationTimeBefore,
    listHumanLoops_maxResults,
    listHumanLoops_flowDefinitionArn,

    -- * Destructuring the Response
    ListHumanLoopsResponse (..),
    newListHumanLoopsResponse,

    -- * Response Lenses
    listHumanLoopsResponse_nextToken,
    listHumanLoopsResponse_httpStatus,
    listHumanLoopsResponse_humanLoopSummaries,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SageMakerA2IRuntime.Types

-- | /See:/ 'newListHumanLoops' smart constructor.
data ListHumanLoops = ListHumanLoops'
  { -- | (Optional) The timestamp of the date when you want the human loops to
    -- begin in ISO 8601 format. For example, @2020-02-24@.
    ListHumanLoops -> Maybe POSIX
creationTimeAfter :: Prelude.Maybe Core.POSIX,
    -- | A token to display the next page of results.
    ListHumanLoops -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Optional. The order for displaying results. Valid values: @Ascending@
    -- and @Descending@.
    ListHumanLoops -> Maybe SortOrder
sortOrder :: Prelude.Maybe SortOrder,
    -- | (Optional) The timestamp of the date before which you want the human
    -- loops to begin in ISO 8601 format. For example, @2020-02-24@.
    ListHumanLoops -> Maybe POSIX
creationTimeBefore :: Prelude.Maybe Core.POSIX,
    -- | The total number of items to return. If the total number of available
    -- items is more than the value specified in @MaxResults@, then a
    -- @NextToken@ is returned in the output. You can use this token to display
    -- the next page of results.
    ListHumanLoops -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The Amazon Resource Name (ARN) of a flow definition.
    ListHumanLoops -> Text
flowDefinitionArn :: Prelude.Text
  }
  deriving (ListHumanLoops -> ListHumanLoops -> Bool
(ListHumanLoops -> ListHumanLoops -> Bool)
-> (ListHumanLoops -> ListHumanLoops -> Bool) -> Eq ListHumanLoops
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListHumanLoops -> ListHumanLoops -> Bool
$c/= :: ListHumanLoops -> ListHumanLoops -> Bool
== :: ListHumanLoops -> ListHumanLoops -> Bool
$c== :: ListHumanLoops -> ListHumanLoops -> Bool
Prelude.Eq, ReadPrec [ListHumanLoops]
ReadPrec ListHumanLoops
Int -> ReadS ListHumanLoops
ReadS [ListHumanLoops]
(Int -> ReadS ListHumanLoops)
-> ReadS [ListHumanLoops]
-> ReadPrec ListHumanLoops
-> ReadPrec [ListHumanLoops]
-> Read ListHumanLoops
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListHumanLoops]
$creadListPrec :: ReadPrec [ListHumanLoops]
readPrec :: ReadPrec ListHumanLoops
$creadPrec :: ReadPrec ListHumanLoops
readList :: ReadS [ListHumanLoops]
$creadList :: ReadS [ListHumanLoops]
readsPrec :: Int -> ReadS ListHumanLoops
$creadsPrec :: Int -> ReadS ListHumanLoops
Prelude.Read, Int -> ListHumanLoops -> ShowS
[ListHumanLoops] -> ShowS
ListHumanLoops -> String
(Int -> ListHumanLoops -> ShowS)
-> (ListHumanLoops -> String)
-> ([ListHumanLoops] -> ShowS)
-> Show ListHumanLoops
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListHumanLoops] -> ShowS
$cshowList :: [ListHumanLoops] -> ShowS
show :: ListHumanLoops -> String
$cshow :: ListHumanLoops -> String
showsPrec :: Int -> ListHumanLoops -> ShowS
$cshowsPrec :: Int -> ListHumanLoops -> ShowS
Prelude.Show, (forall x. ListHumanLoops -> Rep ListHumanLoops x)
-> (forall x. Rep ListHumanLoops x -> ListHumanLoops)
-> Generic ListHumanLoops
forall x. Rep ListHumanLoops x -> ListHumanLoops
forall x. ListHumanLoops -> Rep ListHumanLoops x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListHumanLoops x -> ListHumanLoops
$cfrom :: forall x. ListHumanLoops -> Rep ListHumanLoops x
Prelude.Generic)

-- |
-- Create a value of 'ListHumanLoops' 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:
--
-- 'creationTimeAfter', 'listHumanLoops_creationTimeAfter' - (Optional) The timestamp of the date when you want the human loops to
-- begin in ISO 8601 format. For example, @2020-02-24@.
--
-- 'nextToken', 'listHumanLoops_nextToken' - A token to display the next page of results.
--
-- 'sortOrder', 'listHumanLoops_sortOrder' - Optional. The order for displaying results. Valid values: @Ascending@
-- and @Descending@.
--
-- 'creationTimeBefore', 'listHumanLoops_creationTimeBefore' - (Optional) The timestamp of the date before which you want the human
-- loops to begin in ISO 8601 format. For example, @2020-02-24@.
--
-- 'maxResults', 'listHumanLoops_maxResults' - The total number of items to return. If the total number of available
-- items is more than the value specified in @MaxResults@, then a
-- @NextToken@ is returned in the output. You can use this token to display
-- the next page of results.
--
-- 'flowDefinitionArn', 'listHumanLoops_flowDefinitionArn' - The Amazon Resource Name (ARN) of a flow definition.
newListHumanLoops ::
  -- | 'flowDefinitionArn'
  Prelude.Text ->
  ListHumanLoops
newListHumanLoops :: Text -> ListHumanLoops
newListHumanLoops Text
pFlowDefinitionArn_ =
  ListHumanLoops' :: Maybe POSIX
-> Maybe Text
-> Maybe SortOrder
-> Maybe POSIX
-> Maybe Natural
-> Text
-> ListHumanLoops
ListHumanLoops'
    { $sel:creationTimeAfter:ListHumanLoops' :: Maybe POSIX
creationTimeAfter =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListHumanLoops' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:ListHumanLoops' :: Maybe SortOrder
sortOrder = Maybe SortOrder
forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimeBefore:ListHumanLoops' :: Maybe POSIX
creationTimeBefore = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListHumanLoops' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:flowDefinitionArn:ListHumanLoops' :: Text
flowDefinitionArn = Text
pFlowDefinitionArn_
    }

-- | (Optional) The timestamp of the date when you want the human loops to
-- begin in ISO 8601 format. For example, @2020-02-24@.
listHumanLoops_creationTimeAfter :: Lens.Lens' ListHumanLoops (Prelude.Maybe Prelude.UTCTime)
listHumanLoops_creationTimeAfter :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListHumanLoops -> f ListHumanLoops
listHumanLoops_creationTimeAfter = (ListHumanLoops -> Maybe POSIX)
-> (ListHumanLoops -> Maybe POSIX -> ListHumanLoops)
-> Lens ListHumanLoops ListHumanLoops (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHumanLoops' {Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:creationTimeAfter:ListHumanLoops' :: ListHumanLoops -> Maybe POSIX
creationTimeAfter} -> Maybe POSIX
creationTimeAfter) (\s :: ListHumanLoops
s@ListHumanLoops' {} Maybe POSIX
a -> ListHumanLoops
s {$sel:creationTimeAfter:ListHumanLoops' :: Maybe POSIX
creationTimeAfter = Maybe POSIX
a} :: ListHumanLoops) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListHumanLoops -> f ListHumanLoops)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListHumanLoops
-> f ListHumanLoops
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | A token to display the next page of results.
listHumanLoops_nextToken :: Lens.Lens' ListHumanLoops (Prelude.Maybe Prelude.Text)
listHumanLoops_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListHumanLoops -> f ListHumanLoops
listHumanLoops_nextToken = (ListHumanLoops -> Maybe Text)
-> (ListHumanLoops -> Maybe Text -> ListHumanLoops)
-> Lens ListHumanLoops ListHumanLoops (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHumanLoops' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListHumanLoops' :: ListHumanLoops -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListHumanLoops
s@ListHumanLoops' {} Maybe Text
a -> ListHumanLoops
s {$sel:nextToken:ListHumanLoops' :: Maybe Text
nextToken = Maybe Text
a} :: ListHumanLoops)

-- | Optional. The order for displaying results. Valid values: @Ascending@
-- and @Descending@.
listHumanLoops_sortOrder :: Lens.Lens' ListHumanLoops (Prelude.Maybe SortOrder)
listHumanLoops_sortOrder :: (Maybe SortOrder -> f (Maybe SortOrder))
-> ListHumanLoops -> f ListHumanLoops
listHumanLoops_sortOrder = (ListHumanLoops -> Maybe SortOrder)
-> (ListHumanLoops -> Maybe SortOrder -> ListHumanLoops)
-> Lens
     ListHumanLoops ListHumanLoops (Maybe SortOrder) (Maybe SortOrder)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHumanLoops' {Maybe SortOrder
sortOrder :: Maybe SortOrder
$sel:sortOrder:ListHumanLoops' :: ListHumanLoops -> Maybe SortOrder
sortOrder} -> Maybe SortOrder
sortOrder) (\s :: ListHumanLoops
s@ListHumanLoops' {} Maybe SortOrder
a -> ListHumanLoops
s {$sel:sortOrder:ListHumanLoops' :: Maybe SortOrder
sortOrder = Maybe SortOrder
a} :: ListHumanLoops)

-- | (Optional) The timestamp of the date before which you want the human
-- loops to begin in ISO 8601 format. For example, @2020-02-24@.
listHumanLoops_creationTimeBefore :: Lens.Lens' ListHumanLoops (Prelude.Maybe Prelude.UTCTime)
listHumanLoops_creationTimeBefore :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListHumanLoops -> f ListHumanLoops
listHumanLoops_creationTimeBefore = (ListHumanLoops -> Maybe POSIX)
-> (ListHumanLoops -> Maybe POSIX -> ListHumanLoops)
-> Lens ListHumanLoops ListHumanLoops (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHumanLoops' {Maybe POSIX
creationTimeBefore :: Maybe POSIX
$sel:creationTimeBefore:ListHumanLoops' :: ListHumanLoops -> Maybe POSIX
creationTimeBefore} -> Maybe POSIX
creationTimeBefore) (\s :: ListHumanLoops
s@ListHumanLoops' {} Maybe POSIX
a -> ListHumanLoops
s {$sel:creationTimeBefore:ListHumanLoops' :: Maybe POSIX
creationTimeBefore = Maybe POSIX
a} :: ListHumanLoops) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListHumanLoops -> f ListHumanLoops)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListHumanLoops
-> f ListHumanLoops
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The total number of items to return. If the total number of available
-- items is more than the value specified in @MaxResults@, then a
-- @NextToken@ is returned in the output. You can use this token to display
-- the next page of results.
listHumanLoops_maxResults :: Lens.Lens' ListHumanLoops (Prelude.Maybe Prelude.Natural)
listHumanLoops_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListHumanLoops -> f ListHumanLoops
listHumanLoops_maxResults = (ListHumanLoops -> Maybe Natural)
-> (ListHumanLoops -> Maybe Natural -> ListHumanLoops)
-> Lens
     ListHumanLoops ListHumanLoops (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHumanLoops' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListHumanLoops' :: ListHumanLoops -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListHumanLoops
s@ListHumanLoops' {} Maybe Natural
a -> ListHumanLoops
s {$sel:maxResults:ListHumanLoops' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListHumanLoops)

-- | The Amazon Resource Name (ARN) of a flow definition.
listHumanLoops_flowDefinitionArn :: Lens.Lens' ListHumanLoops Prelude.Text
listHumanLoops_flowDefinitionArn :: (Text -> f Text) -> ListHumanLoops -> f ListHumanLoops
listHumanLoops_flowDefinitionArn = (ListHumanLoops -> Text)
-> (ListHumanLoops -> Text -> ListHumanLoops)
-> Lens ListHumanLoops ListHumanLoops Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHumanLoops' {Text
flowDefinitionArn :: Text
$sel:flowDefinitionArn:ListHumanLoops' :: ListHumanLoops -> Text
flowDefinitionArn} -> Text
flowDefinitionArn) (\s :: ListHumanLoops
s@ListHumanLoops' {} Text
a -> ListHumanLoops
s {$sel:flowDefinitionArn:ListHumanLoops' :: Text
flowDefinitionArn = Text
a} :: ListHumanLoops)

instance Core.AWSPager ListHumanLoops where
  page :: ListHumanLoops
-> AWSResponse ListHumanLoops -> Maybe ListHumanLoops
page ListHumanLoops
rq AWSResponse ListHumanLoops
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListHumanLoops
ListHumanLoopsResponse
rs
            ListHumanLoopsResponse
-> Getting (First Text) ListHumanLoopsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListHumanLoopsResponse
-> Const (First Text) ListHumanLoopsResponse
Lens' ListHumanLoopsResponse (Maybe Text)
listHumanLoopsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListHumanLoopsResponse
 -> Const (First Text) ListHumanLoopsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListHumanLoopsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListHumanLoops
forall a. Maybe a
Prelude.Nothing
    | [HumanLoopSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListHumanLoops
ListHumanLoopsResponse
rs
            ListHumanLoopsResponse
-> Getting
     [HumanLoopSummary] ListHumanLoopsResponse [HumanLoopSummary]
-> [HumanLoopSummary]
forall s a. s -> Getting a s a -> a
Lens.^. Getting
  [HumanLoopSummary] ListHumanLoopsResponse [HumanLoopSummary]
Lens' ListHumanLoopsResponse [HumanLoopSummary]
listHumanLoopsResponse_humanLoopSummaries
        ) =
      Maybe ListHumanLoops
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListHumanLoops -> Maybe ListHumanLoops
forall a. a -> Maybe a
Prelude.Just (ListHumanLoops -> Maybe ListHumanLoops)
-> ListHumanLoops -> Maybe ListHumanLoops
forall a b. (a -> b) -> a -> b
Prelude.$
        ListHumanLoops
rq
          ListHumanLoops
-> (ListHumanLoops -> ListHumanLoops) -> ListHumanLoops
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListHumanLoops -> Identity ListHumanLoops
Lens ListHumanLoops ListHumanLoops (Maybe Text) (Maybe Text)
listHumanLoops_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListHumanLoops -> Identity ListHumanLoops)
-> Maybe Text -> ListHumanLoops -> ListHumanLoops
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListHumanLoops
ListHumanLoopsResponse
rs
          ListHumanLoopsResponse
-> Getting (First Text) ListHumanLoopsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListHumanLoopsResponse
-> Const (First Text) ListHumanLoopsResponse
Lens' ListHumanLoopsResponse (Maybe Text)
listHumanLoopsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListHumanLoopsResponse
 -> Const (First Text) ListHumanLoopsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListHumanLoopsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListHumanLoops where
  type
    AWSResponse ListHumanLoops =
      ListHumanLoopsResponse
  request :: ListHumanLoops -> Request ListHumanLoops
request = Service -> ListHumanLoops -> Request ListHumanLoops
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListHumanLoops
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListHumanLoops)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListHumanLoops))
-> Logger
-> Service
-> Proxy ListHumanLoops
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListHumanLoops)))
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 Text -> Int -> [HumanLoopSummary] -> ListHumanLoopsResponse
ListHumanLoopsResponse'
            (Maybe Text -> Int -> [HumanLoopSummary] -> ListHumanLoopsResponse)
-> Either String (Maybe Text)
-> Either
     String (Int -> [HumanLoopSummary] -> ListHumanLoopsResponse)
forall (f :: * -> *) a b. Functor 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 -> [HumanLoopSummary] -> ListHumanLoopsResponse)
-> Either String Int
-> Either String ([HumanLoopSummary] -> ListHumanLoopsResponse)
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))
            Either String ([HumanLoopSummary] -> ListHumanLoopsResponse)
-> Either String [HumanLoopSummary]
-> Either String ListHumanLoopsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe [HumanLoopSummary])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"HumanLoopSummaries"
                            Either String (Maybe [HumanLoopSummary])
-> [HumanLoopSummary] -> Either String [HumanLoopSummary]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [HumanLoopSummary]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable ListHumanLoops

instance Prelude.NFData ListHumanLoops

instance Core.ToHeaders ListHumanLoops where
  toHeaders :: ListHumanLoops -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListHumanLoops -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath ListHumanLoops where
  toPath :: ListHumanLoops -> ByteString
toPath = ByteString -> ListHumanLoops -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/human-loops"

instance Core.ToQuery ListHumanLoops where
  toQuery :: ListHumanLoops -> QueryString
toQuery ListHumanLoops' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe SortOrder
Text
flowDefinitionArn :: Text
maxResults :: Maybe Natural
creationTimeBefore :: Maybe POSIX
sortOrder :: Maybe SortOrder
nextToken :: Maybe Text
creationTimeAfter :: Maybe POSIX
$sel:flowDefinitionArn:ListHumanLoops' :: ListHumanLoops -> Text
$sel:maxResults:ListHumanLoops' :: ListHumanLoops -> Maybe Natural
$sel:creationTimeBefore:ListHumanLoops' :: ListHumanLoops -> Maybe POSIX
$sel:sortOrder:ListHumanLoops' :: ListHumanLoops -> Maybe SortOrder
$sel:nextToken:ListHumanLoops' :: ListHumanLoops -> Maybe Text
$sel:creationTimeAfter:ListHumanLoops' :: ListHumanLoops -> Maybe POSIX
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"CreationTimeAfter" ByteString -> Maybe POSIX -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe POSIX
creationTimeAfter,
        ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"SortOrder" ByteString -> Maybe SortOrder -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe SortOrder
sortOrder,
        ByteString
"CreationTimeBefore" ByteString -> Maybe POSIX -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe POSIX
creationTimeBefore,
        ByteString
"MaxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults,
        ByteString
"FlowDefinitionArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
flowDefinitionArn
      ]

-- | /See:/ 'newListHumanLoopsResponse' smart constructor.
data ListHumanLoopsResponse = ListHumanLoopsResponse'
  { -- | A token to display the next page of results.
    ListHumanLoopsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListHumanLoopsResponse -> Int
httpStatus :: Prelude.Int,
    -- | An array of objects that contain information about the human loops.
    ListHumanLoopsResponse -> [HumanLoopSummary]
humanLoopSummaries :: [HumanLoopSummary]
  }
  deriving (ListHumanLoopsResponse -> ListHumanLoopsResponse -> Bool
(ListHumanLoopsResponse -> ListHumanLoopsResponse -> Bool)
-> (ListHumanLoopsResponse -> ListHumanLoopsResponse -> Bool)
-> Eq ListHumanLoopsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListHumanLoopsResponse -> ListHumanLoopsResponse -> Bool
$c/= :: ListHumanLoopsResponse -> ListHumanLoopsResponse -> Bool
== :: ListHumanLoopsResponse -> ListHumanLoopsResponse -> Bool
$c== :: ListHumanLoopsResponse -> ListHumanLoopsResponse -> Bool
Prelude.Eq, ReadPrec [ListHumanLoopsResponse]
ReadPrec ListHumanLoopsResponse
Int -> ReadS ListHumanLoopsResponse
ReadS [ListHumanLoopsResponse]
(Int -> ReadS ListHumanLoopsResponse)
-> ReadS [ListHumanLoopsResponse]
-> ReadPrec ListHumanLoopsResponse
-> ReadPrec [ListHumanLoopsResponse]
-> Read ListHumanLoopsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListHumanLoopsResponse]
$creadListPrec :: ReadPrec [ListHumanLoopsResponse]
readPrec :: ReadPrec ListHumanLoopsResponse
$creadPrec :: ReadPrec ListHumanLoopsResponse
readList :: ReadS [ListHumanLoopsResponse]
$creadList :: ReadS [ListHumanLoopsResponse]
readsPrec :: Int -> ReadS ListHumanLoopsResponse
$creadsPrec :: Int -> ReadS ListHumanLoopsResponse
Prelude.Read, Int -> ListHumanLoopsResponse -> ShowS
[ListHumanLoopsResponse] -> ShowS
ListHumanLoopsResponse -> String
(Int -> ListHumanLoopsResponse -> ShowS)
-> (ListHumanLoopsResponse -> String)
-> ([ListHumanLoopsResponse] -> ShowS)
-> Show ListHumanLoopsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListHumanLoopsResponse] -> ShowS
$cshowList :: [ListHumanLoopsResponse] -> ShowS
show :: ListHumanLoopsResponse -> String
$cshow :: ListHumanLoopsResponse -> String
showsPrec :: Int -> ListHumanLoopsResponse -> ShowS
$cshowsPrec :: Int -> ListHumanLoopsResponse -> ShowS
Prelude.Show, (forall x. ListHumanLoopsResponse -> Rep ListHumanLoopsResponse x)
-> (forall x.
    Rep ListHumanLoopsResponse x -> ListHumanLoopsResponse)
-> Generic ListHumanLoopsResponse
forall x. Rep ListHumanLoopsResponse x -> ListHumanLoopsResponse
forall x. ListHumanLoopsResponse -> Rep ListHumanLoopsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListHumanLoopsResponse x -> ListHumanLoopsResponse
$cfrom :: forall x. ListHumanLoopsResponse -> Rep ListHumanLoopsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListHumanLoopsResponse' 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', 'listHumanLoopsResponse_nextToken' - A token to display the next page of results.
--
-- 'httpStatus', 'listHumanLoopsResponse_httpStatus' - The response's http status code.
--
-- 'humanLoopSummaries', 'listHumanLoopsResponse_humanLoopSummaries' - An array of objects that contain information about the human loops.
newListHumanLoopsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListHumanLoopsResponse
newListHumanLoopsResponse :: Int -> ListHumanLoopsResponse
newListHumanLoopsResponse Int
pHttpStatus_ =
  ListHumanLoopsResponse' :: Maybe Text -> Int -> [HumanLoopSummary] -> ListHumanLoopsResponse
ListHumanLoopsResponse'
    { $sel:nextToken:ListHumanLoopsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListHumanLoopsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:humanLoopSummaries:ListHumanLoopsResponse' :: [HumanLoopSummary]
humanLoopSummaries = [HumanLoopSummary]
forall a. Monoid a => a
Prelude.mempty
    }

-- | A token to display the next page of results.
listHumanLoopsResponse_nextToken :: Lens.Lens' ListHumanLoopsResponse (Prelude.Maybe Prelude.Text)
listHumanLoopsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListHumanLoopsResponse -> f ListHumanLoopsResponse
listHumanLoopsResponse_nextToken = (ListHumanLoopsResponse -> Maybe Text)
-> (ListHumanLoopsResponse -> Maybe Text -> ListHumanLoopsResponse)
-> Lens' ListHumanLoopsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHumanLoopsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListHumanLoopsResponse' :: ListHumanLoopsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListHumanLoopsResponse
s@ListHumanLoopsResponse' {} Maybe Text
a -> ListHumanLoopsResponse
s {$sel:nextToken:ListHumanLoopsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListHumanLoopsResponse)

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

-- | An array of objects that contain information about the human loops.
listHumanLoopsResponse_humanLoopSummaries :: Lens.Lens' ListHumanLoopsResponse [HumanLoopSummary]
listHumanLoopsResponse_humanLoopSummaries :: ([HumanLoopSummary] -> f [HumanLoopSummary])
-> ListHumanLoopsResponse -> f ListHumanLoopsResponse
listHumanLoopsResponse_humanLoopSummaries = (ListHumanLoopsResponse -> [HumanLoopSummary])
-> (ListHumanLoopsResponse
    -> [HumanLoopSummary] -> ListHumanLoopsResponse)
-> Lens' ListHumanLoopsResponse [HumanLoopSummary]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHumanLoopsResponse' {[HumanLoopSummary]
humanLoopSummaries :: [HumanLoopSummary]
$sel:humanLoopSummaries:ListHumanLoopsResponse' :: ListHumanLoopsResponse -> [HumanLoopSummary]
humanLoopSummaries} -> [HumanLoopSummary]
humanLoopSummaries) (\s :: ListHumanLoopsResponse
s@ListHumanLoopsResponse' {} [HumanLoopSummary]
a -> ListHumanLoopsResponse
s {$sel:humanLoopSummaries:ListHumanLoopsResponse' :: [HumanLoopSummary]
humanLoopSummaries = [HumanLoopSummary]
a} :: ListHumanLoopsResponse) (([HumanLoopSummary] -> f [HumanLoopSummary])
 -> ListHumanLoopsResponse -> f ListHumanLoopsResponse)
-> (([HumanLoopSummary] -> f [HumanLoopSummary])
    -> [HumanLoopSummary] -> f [HumanLoopSummary])
-> ([HumanLoopSummary] -> f [HumanLoopSummary])
-> ListHumanLoopsResponse
-> f ListHumanLoopsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([HumanLoopSummary] -> f [HumanLoopSummary])
-> [HumanLoopSummary] -> f [HumanLoopSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData ListHumanLoopsResponse