{-# 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.EMRContainers.ListJobRuns
-- 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 job runs based on a set of parameters. A job run is a unit of
-- work, such as a Spark jar, PySpark script, or SparkSQL query, that you
-- submit to Amazon EMR on EKS.
--
-- This operation returns paginated results.
module Amazonka.EMRContainers.ListJobRuns
  ( -- * Creating a Request
    ListJobRuns (..),
    newListJobRuns,

    -- * Request Lenses
    listJobRuns_createdAfter,
    listJobRuns_createdBefore,
    listJobRuns_maxResults,
    listJobRuns_name,
    listJobRuns_nextToken,
    listJobRuns_states,
    listJobRuns_virtualClusterId,

    -- * Destructuring the Response
    ListJobRunsResponse (..),
    newListJobRunsResponse,

    -- * Response Lenses
    listJobRunsResponse_jobRuns,
    listJobRunsResponse_nextToken,
    listJobRunsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListJobRuns' smart constructor.
data ListJobRuns = ListJobRuns'
  { -- | The date and time after which the job runs were submitted.
    ListJobRuns -> Maybe ISO8601
createdAfter :: Prelude.Maybe Data.ISO8601,
    -- | The date and time before which the job runs were submitted.
    ListJobRuns -> Maybe ISO8601
createdBefore :: Prelude.Maybe Data.ISO8601,
    -- | The maximum number of job runs that can be listed.
    ListJobRuns -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
    -- | The name of the job run.
    ListJobRuns -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The token for the next set of job runs to return.
    ListJobRuns -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The states of the job run.
    ListJobRuns -> Maybe [JobRunState]
states :: Prelude.Maybe [JobRunState],
    -- | The ID of the virtual cluster for which to list the job run.
    ListJobRuns -> Text
virtualClusterId :: Prelude.Text
  }
  deriving (ListJobRuns -> ListJobRuns -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListJobRuns -> ListJobRuns -> Bool
$c/= :: ListJobRuns -> ListJobRuns -> Bool
== :: ListJobRuns -> ListJobRuns -> Bool
$c== :: ListJobRuns -> ListJobRuns -> Bool
Prelude.Eq, ReadPrec [ListJobRuns]
ReadPrec ListJobRuns
Int -> ReadS ListJobRuns
ReadS [ListJobRuns]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListJobRuns]
$creadListPrec :: ReadPrec [ListJobRuns]
readPrec :: ReadPrec ListJobRuns
$creadPrec :: ReadPrec ListJobRuns
readList :: ReadS [ListJobRuns]
$creadList :: ReadS [ListJobRuns]
readsPrec :: Int -> ReadS ListJobRuns
$creadsPrec :: Int -> ReadS ListJobRuns
Prelude.Read, Int -> ListJobRuns -> ShowS
[ListJobRuns] -> ShowS
ListJobRuns -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListJobRuns] -> ShowS
$cshowList :: [ListJobRuns] -> ShowS
show :: ListJobRuns -> String
$cshow :: ListJobRuns -> String
showsPrec :: Int -> ListJobRuns -> ShowS
$cshowsPrec :: Int -> ListJobRuns -> ShowS
Prelude.Show, forall x. Rep ListJobRuns x -> ListJobRuns
forall x. ListJobRuns -> Rep ListJobRuns x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListJobRuns x -> ListJobRuns
$cfrom :: forall x. ListJobRuns -> Rep ListJobRuns x
Prelude.Generic)

-- |
-- Create a value of 'ListJobRuns' 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:
--
-- 'createdAfter', 'listJobRuns_createdAfter' - The date and time after which the job runs were submitted.
--
-- 'createdBefore', 'listJobRuns_createdBefore' - The date and time before which the job runs were submitted.
--
-- 'maxResults', 'listJobRuns_maxResults' - The maximum number of job runs that can be listed.
--
-- 'name', 'listJobRuns_name' - The name of the job run.
--
-- 'nextToken', 'listJobRuns_nextToken' - The token for the next set of job runs to return.
--
-- 'states', 'listJobRuns_states' - The states of the job run.
--
-- 'virtualClusterId', 'listJobRuns_virtualClusterId' - The ID of the virtual cluster for which to list the job run.
newListJobRuns ::
  -- | 'virtualClusterId'
  Prelude.Text ->
  ListJobRuns
newListJobRuns :: Text -> ListJobRuns
newListJobRuns Text
pVirtualClusterId_ =
  ListJobRuns'
    { $sel:createdAfter:ListJobRuns' :: Maybe ISO8601
createdAfter = forall a. Maybe a
Prelude.Nothing,
      $sel:createdBefore:ListJobRuns' :: Maybe ISO8601
createdBefore = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListJobRuns' :: Maybe Int
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ListJobRuns' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListJobRuns' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:states:ListJobRuns' :: Maybe [JobRunState]
states = forall a. Maybe a
Prelude.Nothing,
      $sel:virtualClusterId:ListJobRuns' :: Text
virtualClusterId = Text
pVirtualClusterId_
    }

-- | The date and time after which the job runs were submitted.
listJobRuns_createdAfter :: Lens.Lens' ListJobRuns (Prelude.Maybe Prelude.UTCTime)
listJobRuns_createdAfter :: Lens' ListJobRuns (Maybe UTCTime)
listJobRuns_createdAfter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobRuns' {Maybe ISO8601
createdAfter :: Maybe ISO8601
$sel:createdAfter:ListJobRuns' :: ListJobRuns -> Maybe ISO8601
createdAfter} -> Maybe ISO8601
createdAfter) (\s :: ListJobRuns
s@ListJobRuns' {} Maybe ISO8601
a -> ListJobRuns
s {$sel:createdAfter:ListJobRuns' :: Maybe ISO8601
createdAfter = Maybe ISO8601
a} :: ListJobRuns) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The date and time before which the job runs were submitted.
listJobRuns_createdBefore :: Lens.Lens' ListJobRuns (Prelude.Maybe Prelude.UTCTime)
listJobRuns_createdBefore :: Lens' ListJobRuns (Maybe UTCTime)
listJobRuns_createdBefore = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobRuns' {Maybe ISO8601
createdBefore :: Maybe ISO8601
$sel:createdBefore:ListJobRuns' :: ListJobRuns -> Maybe ISO8601
createdBefore} -> Maybe ISO8601
createdBefore) (\s :: ListJobRuns
s@ListJobRuns' {} Maybe ISO8601
a -> ListJobRuns
s {$sel:createdBefore:ListJobRuns' :: Maybe ISO8601
createdBefore = Maybe ISO8601
a} :: ListJobRuns) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The maximum number of job runs that can be listed.
listJobRuns_maxResults :: Lens.Lens' ListJobRuns (Prelude.Maybe Prelude.Int)
listJobRuns_maxResults :: Lens' ListJobRuns (Maybe Int)
listJobRuns_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobRuns' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:ListJobRuns' :: ListJobRuns -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: ListJobRuns
s@ListJobRuns' {} Maybe Int
a -> ListJobRuns
s {$sel:maxResults:ListJobRuns' :: Maybe Int
maxResults = Maybe Int
a} :: ListJobRuns)

-- | The name of the job run.
listJobRuns_name :: Lens.Lens' ListJobRuns (Prelude.Maybe Prelude.Text)
listJobRuns_name :: Lens' ListJobRuns (Maybe Text)
listJobRuns_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobRuns' {Maybe Text
name :: Maybe Text
$sel:name:ListJobRuns' :: ListJobRuns -> Maybe Text
name} -> Maybe Text
name) (\s :: ListJobRuns
s@ListJobRuns' {} Maybe Text
a -> ListJobRuns
s {$sel:name:ListJobRuns' :: Maybe Text
name = Maybe Text
a} :: ListJobRuns)

-- | The token for the next set of job runs to return.
listJobRuns_nextToken :: Lens.Lens' ListJobRuns (Prelude.Maybe Prelude.Text)
listJobRuns_nextToken :: Lens' ListJobRuns (Maybe Text)
listJobRuns_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobRuns' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListJobRuns' :: ListJobRuns -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListJobRuns
s@ListJobRuns' {} Maybe Text
a -> ListJobRuns
s {$sel:nextToken:ListJobRuns' :: Maybe Text
nextToken = Maybe Text
a} :: ListJobRuns)

-- | The states of the job run.
listJobRuns_states :: Lens.Lens' ListJobRuns (Prelude.Maybe [JobRunState])
listJobRuns_states :: Lens' ListJobRuns (Maybe [JobRunState])
listJobRuns_states = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobRuns' {Maybe [JobRunState]
states :: Maybe [JobRunState]
$sel:states:ListJobRuns' :: ListJobRuns -> Maybe [JobRunState]
states} -> Maybe [JobRunState]
states) (\s :: ListJobRuns
s@ListJobRuns' {} Maybe [JobRunState]
a -> ListJobRuns
s {$sel:states:ListJobRuns' :: Maybe [JobRunState]
states = Maybe [JobRunState]
a} :: ListJobRuns) 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 ID of the virtual cluster for which to list the job run.
listJobRuns_virtualClusterId :: Lens.Lens' ListJobRuns Prelude.Text
listJobRuns_virtualClusterId :: Lens' ListJobRuns Text
listJobRuns_virtualClusterId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobRuns' {Text
virtualClusterId :: Text
$sel:virtualClusterId:ListJobRuns' :: ListJobRuns -> Text
virtualClusterId} -> Text
virtualClusterId) (\s :: ListJobRuns
s@ListJobRuns' {} Text
a -> ListJobRuns
s {$sel:virtualClusterId:ListJobRuns' :: Text
virtualClusterId = Text
a} :: ListJobRuns)

instance Core.AWSPager ListJobRuns where
  page :: ListJobRuns -> AWSResponse ListJobRuns -> Maybe ListJobRuns
page ListJobRuns
rq AWSResponse ListJobRuns
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListJobRuns
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListJobRunsResponse (Maybe Text)
listJobRunsResponse_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 ListJobRuns
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListJobRunsResponse (Maybe [JobRun])
listJobRunsResponse_jobRuns
            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.$ ListJobRuns
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListJobRuns (Maybe Text)
listJobRuns_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListJobRuns
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListJobRunsResponse (Maybe Text)
listJobRunsResponse_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 ListJobRuns where
  type AWSResponse ListJobRuns = ListJobRunsResponse
  request :: (Service -> Service) -> ListJobRuns -> Request ListJobRuns
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 ListJobRuns
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListJobRuns)))
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 [JobRun] -> Maybe Text -> Int -> ListJobRunsResponse
ListJobRunsResponse'
            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
"jobRuns" 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 ListJobRuns where
  hashWithSalt :: Int -> ListJobRuns -> Int
hashWithSalt Int
_salt ListJobRuns' {Maybe Int
Maybe [JobRunState]
Maybe Text
Maybe ISO8601
Text
virtualClusterId :: Text
states :: Maybe [JobRunState]
nextToken :: Maybe Text
name :: Maybe Text
maxResults :: Maybe Int
createdBefore :: Maybe ISO8601
createdAfter :: Maybe ISO8601
$sel:virtualClusterId:ListJobRuns' :: ListJobRuns -> Text
$sel:states:ListJobRuns' :: ListJobRuns -> Maybe [JobRunState]
$sel:nextToken:ListJobRuns' :: ListJobRuns -> Maybe Text
$sel:name:ListJobRuns' :: ListJobRuns -> Maybe Text
$sel:maxResults:ListJobRuns' :: ListJobRuns -> Maybe Int
$sel:createdBefore:ListJobRuns' :: ListJobRuns -> Maybe ISO8601
$sel:createdAfter:ListJobRuns' :: ListJobRuns -> Maybe ISO8601
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
createdAfter
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
createdBefore
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [JobRunState]
states
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
virtualClusterId

instance Prelude.NFData ListJobRuns where
  rnf :: ListJobRuns -> ()
rnf ListJobRuns' {Maybe Int
Maybe [JobRunState]
Maybe Text
Maybe ISO8601
Text
virtualClusterId :: Text
states :: Maybe [JobRunState]
nextToken :: Maybe Text
name :: Maybe Text
maxResults :: Maybe Int
createdBefore :: Maybe ISO8601
createdAfter :: Maybe ISO8601
$sel:virtualClusterId:ListJobRuns' :: ListJobRuns -> Text
$sel:states:ListJobRuns' :: ListJobRuns -> Maybe [JobRunState]
$sel:nextToken:ListJobRuns' :: ListJobRuns -> Maybe Text
$sel:name:ListJobRuns' :: ListJobRuns -> Maybe Text
$sel:maxResults:ListJobRuns' :: ListJobRuns -> Maybe Int
$sel:createdBefore:ListJobRuns' :: ListJobRuns -> Maybe ISO8601
$sel:createdAfter:ListJobRuns' :: ListJobRuns -> Maybe ISO8601
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
createdAfter
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
createdBefore
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      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 Maybe [JobRunState]
states
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
virtualClusterId

instance Data.ToHeaders ListJobRuns where
  toHeaders :: ListJobRuns -> 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 ListJobRuns where
  toPath :: ListJobRuns -> ByteString
toPath ListJobRuns' {Maybe Int
Maybe [JobRunState]
Maybe Text
Maybe ISO8601
Text
virtualClusterId :: Text
states :: Maybe [JobRunState]
nextToken :: Maybe Text
name :: Maybe Text
maxResults :: Maybe Int
createdBefore :: Maybe ISO8601
createdAfter :: Maybe ISO8601
$sel:virtualClusterId:ListJobRuns' :: ListJobRuns -> Text
$sel:states:ListJobRuns' :: ListJobRuns -> Maybe [JobRunState]
$sel:nextToken:ListJobRuns' :: ListJobRuns -> Maybe Text
$sel:name:ListJobRuns' :: ListJobRuns -> Maybe Text
$sel:maxResults:ListJobRuns' :: ListJobRuns -> Maybe Int
$sel:createdBefore:ListJobRuns' :: ListJobRuns -> Maybe ISO8601
$sel:createdAfter:ListJobRuns' :: ListJobRuns -> Maybe ISO8601
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/virtualclusters/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
virtualClusterId,
        ByteString
"/jobruns"
      ]

instance Data.ToQuery ListJobRuns where
  toQuery :: ListJobRuns -> QueryString
toQuery ListJobRuns' {Maybe Int
Maybe [JobRunState]
Maybe Text
Maybe ISO8601
Text
virtualClusterId :: Text
states :: Maybe [JobRunState]
nextToken :: Maybe Text
name :: Maybe Text
maxResults :: Maybe Int
createdBefore :: Maybe ISO8601
createdAfter :: Maybe ISO8601
$sel:virtualClusterId:ListJobRuns' :: ListJobRuns -> Text
$sel:states:ListJobRuns' :: ListJobRuns -> Maybe [JobRunState]
$sel:nextToken:ListJobRuns' :: ListJobRuns -> Maybe Text
$sel:name:ListJobRuns' :: ListJobRuns -> Maybe Text
$sel:maxResults:ListJobRuns' :: ListJobRuns -> Maybe Int
$sel:createdBefore:ListJobRuns' :: ListJobRuns -> Maybe ISO8601
$sel:createdAfter:ListJobRuns' :: ListJobRuns -> Maybe ISO8601
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"createdAfter" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe ISO8601
createdAfter,
        ByteString
"createdBefore" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe ISO8601
createdBefore,
        ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Int
maxResults,
        ByteString
"name" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
name,
        ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken,
        ByteString
"states"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a. ToQuery a => a -> QueryString
Data.toQuery
            (forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"member" forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [JobRunState]
states)
      ]

-- | /See:/ 'newListJobRunsResponse' smart constructor.
data ListJobRunsResponse = ListJobRunsResponse'
  { -- | This output lists information about the specified job runs.
    ListJobRunsResponse -> Maybe [JobRun]
jobRuns :: Prelude.Maybe [JobRun],
    -- | This output displays the token for the next set of job runs.
    ListJobRunsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListJobRunsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListJobRunsResponse -> ListJobRunsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListJobRunsResponse -> ListJobRunsResponse -> Bool
$c/= :: ListJobRunsResponse -> ListJobRunsResponse -> Bool
== :: ListJobRunsResponse -> ListJobRunsResponse -> Bool
$c== :: ListJobRunsResponse -> ListJobRunsResponse -> Bool
Prelude.Eq, Int -> ListJobRunsResponse -> ShowS
[ListJobRunsResponse] -> ShowS
ListJobRunsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListJobRunsResponse] -> ShowS
$cshowList :: [ListJobRunsResponse] -> ShowS
show :: ListJobRunsResponse -> String
$cshow :: ListJobRunsResponse -> String
showsPrec :: Int -> ListJobRunsResponse -> ShowS
$cshowsPrec :: Int -> ListJobRunsResponse -> ShowS
Prelude.Show, forall x. Rep ListJobRunsResponse x -> ListJobRunsResponse
forall x. ListJobRunsResponse -> Rep ListJobRunsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListJobRunsResponse x -> ListJobRunsResponse
$cfrom :: forall x. ListJobRunsResponse -> Rep ListJobRunsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListJobRunsResponse' 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:
--
-- 'jobRuns', 'listJobRunsResponse_jobRuns' - This output lists information about the specified job runs.
--
-- 'nextToken', 'listJobRunsResponse_nextToken' - This output displays the token for the next set of job runs.
--
-- 'httpStatus', 'listJobRunsResponse_httpStatus' - The response's http status code.
newListJobRunsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListJobRunsResponse
newListJobRunsResponse :: Int -> ListJobRunsResponse
newListJobRunsResponse Int
pHttpStatus_ =
  ListJobRunsResponse'
    { $sel:jobRuns:ListJobRunsResponse' :: Maybe [JobRun]
jobRuns = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListJobRunsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListJobRunsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | This output lists information about the specified job runs.
listJobRunsResponse_jobRuns :: Lens.Lens' ListJobRunsResponse (Prelude.Maybe [JobRun])
listJobRunsResponse_jobRuns :: Lens' ListJobRunsResponse (Maybe [JobRun])
listJobRunsResponse_jobRuns = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobRunsResponse' {Maybe [JobRun]
jobRuns :: Maybe [JobRun]
$sel:jobRuns:ListJobRunsResponse' :: ListJobRunsResponse -> Maybe [JobRun]
jobRuns} -> Maybe [JobRun]
jobRuns) (\s :: ListJobRunsResponse
s@ListJobRunsResponse' {} Maybe [JobRun]
a -> ListJobRunsResponse
s {$sel:jobRuns:ListJobRunsResponse' :: Maybe [JobRun]
jobRuns = Maybe [JobRun]
a} :: ListJobRunsResponse) 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

-- | This output displays the token for the next set of job runs.
listJobRunsResponse_nextToken :: Lens.Lens' ListJobRunsResponse (Prelude.Maybe Prelude.Text)
listJobRunsResponse_nextToken :: Lens' ListJobRunsResponse (Maybe Text)
listJobRunsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobRunsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListJobRunsResponse' :: ListJobRunsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListJobRunsResponse
s@ListJobRunsResponse' {} Maybe Text
a -> ListJobRunsResponse
s {$sel:nextToken:ListJobRunsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListJobRunsResponse)

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

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