{-# 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.IoT.ListJobExecutionsForJob
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists the job executions for a job.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions ListJobExecutionsForJob>
-- action.
--
-- This operation returns paginated results.
module Amazonka.IoT.ListJobExecutionsForJob
  ( -- * Creating a Request
    ListJobExecutionsForJob (..),
    newListJobExecutionsForJob,

    -- * Request Lenses
    listJobExecutionsForJob_status,
    listJobExecutionsForJob_nextToken,
    listJobExecutionsForJob_maxResults,
    listJobExecutionsForJob_jobId,

    -- * Destructuring the Response
    ListJobExecutionsForJobResponse (..),
    newListJobExecutionsForJobResponse,

    -- * Response Lenses
    listJobExecutionsForJobResponse_executionSummaries,
    listJobExecutionsForJobResponse_nextToken,
    listJobExecutionsForJobResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListJobExecutionsForJob' smart constructor.
data ListJobExecutionsForJob = ListJobExecutionsForJob'
  { -- | The status of the job.
    ListJobExecutionsForJob -> Maybe JobExecutionStatus
status :: Prelude.Maybe JobExecutionStatus,
    -- | The token to retrieve the next set of results.
    ListJobExecutionsForJob -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to be returned per request.
    ListJobExecutionsForJob -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The unique identifier you assigned to this job when it was created.
    ListJobExecutionsForJob -> Text
jobId :: Prelude.Text
  }
  deriving (ListJobExecutionsForJob -> ListJobExecutionsForJob -> Bool
(ListJobExecutionsForJob -> ListJobExecutionsForJob -> Bool)
-> (ListJobExecutionsForJob -> ListJobExecutionsForJob -> Bool)
-> Eq ListJobExecutionsForJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListJobExecutionsForJob -> ListJobExecutionsForJob -> Bool
$c/= :: ListJobExecutionsForJob -> ListJobExecutionsForJob -> Bool
== :: ListJobExecutionsForJob -> ListJobExecutionsForJob -> Bool
$c== :: ListJobExecutionsForJob -> ListJobExecutionsForJob -> Bool
Prelude.Eq, ReadPrec [ListJobExecutionsForJob]
ReadPrec ListJobExecutionsForJob
Int -> ReadS ListJobExecutionsForJob
ReadS [ListJobExecutionsForJob]
(Int -> ReadS ListJobExecutionsForJob)
-> ReadS [ListJobExecutionsForJob]
-> ReadPrec ListJobExecutionsForJob
-> ReadPrec [ListJobExecutionsForJob]
-> Read ListJobExecutionsForJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListJobExecutionsForJob]
$creadListPrec :: ReadPrec [ListJobExecutionsForJob]
readPrec :: ReadPrec ListJobExecutionsForJob
$creadPrec :: ReadPrec ListJobExecutionsForJob
readList :: ReadS [ListJobExecutionsForJob]
$creadList :: ReadS [ListJobExecutionsForJob]
readsPrec :: Int -> ReadS ListJobExecutionsForJob
$creadsPrec :: Int -> ReadS ListJobExecutionsForJob
Prelude.Read, Int -> ListJobExecutionsForJob -> ShowS
[ListJobExecutionsForJob] -> ShowS
ListJobExecutionsForJob -> String
(Int -> ListJobExecutionsForJob -> ShowS)
-> (ListJobExecutionsForJob -> String)
-> ([ListJobExecutionsForJob] -> ShowS)
-> Show ListJobExecutionsForJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListJobExecutionsForJob] -> ShowS
$cshowList :: [ListJobExecutionsForJob] -> ShowS
show :: ListJobExecutionsForJob -> String
$cshow :: ListJobExecutionsForJob -> String
showsPrec :: Int -> ListJobExecutionsForJob -> ShowS
$cshowsPrec :: Int -> ListJobExecutionsForJob -> ShowS
Prelude.Show, (forall x.
 ListJobExecutionsForJob -> Rep ListJobExecutionsForJob x)
-> (forall x.
    Rep ListJobExecutionsForJob x -> ListJobExecutionsForJob)
-> Generic ListJobExecutionsForJob
forall x. Rep ListJobExecutionsForJob x -> ListJobExecutionsForJob
forall x. ListJobExecutionsForJob -> Rep ListJobExecutionsForJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListJobExecutionsForJob x -> ListJobExecutionsForJob
$cfrom :: forall x. ListJobExecutionsForJob -> Rep ListJobExecutionsForJob x
Prelude.Generic)

-- |
-- Create a value of 'ListJobExecutionsForJob' 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:
--
-- 'status', 'listJobExecutionsForJob_status' - The status of the job.
--
-- 'nextToken', 'listJobExecutionsForJob_nextToken' - The token to retrieve the next set of results.
--
-- 'maxResults', 'listJobExecutionsForJob_maxResults' - The maximum number of results to be returned per request.
--
-- 'jobId', 'listJobExecutionsForJob_jobId' - The unique identifier you assigned to this job when it was created.
newListJobExecutionsForJob ::
  -- | 'jobId'
  Prelude.Text ->
  ListJobExecutionsForJob
newListJobExecutionsForJob :: Text -> ListJobExecutionsForJob
newListJobExecutionsForJob Text
pJobId_ =
  ListJobExecutionsForJob' :: Maybe JobExecutionStatus
-> Maybe Text -> Maybe Natural -> Text -> ListJobExecutionsForJob
ListJobExecutionsForJob'
    { $sel:status:ListJobExecutionsForJob' :: Maybe JobExecutionStatus
status = Maybe JobExecutionStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListJobExecutionsForJob' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListJobExecutionsForJob' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:jobId:ListJobExecutionsForJob' :: Text
jobId = Text
pJobId_
    }

-- | The status of the job.
listJobExecutionsForJob_status :: Lens.Lens' ListJobExecutionsForJob (Prelude.Maybe JobExecutionStatus)
listJobExecutionsForJob_status :: (Maybe JobExecutionStatus -> f (Maybe JobExecutionStatus))
-> ListJobExecutionsForJob -> f ListJobExecutionsForJob
listJobExecutionsForJob_status = (ListJobExecutionsForJob -> Maybe JobExecutionStatus)
-> (ListJobExecutionsForJob
    -> Maybe JobExecutionStatus -> ListJobExecutionsForJob)
-> Lens
     ListJobExecutionsForJob
     ListJobExecutionsForJob
     (Maybe JobExecutionStatus)
     (Maybe JobExecutionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobExecutionsForJob' {Maybe JobExecutionStatus
status :: Maybe JobExecutionStatus
$sel:status:ListJobExecutionsForJob' :: ListJobExecutionsForJob -> Maybe JobExecutionStatus
status} -> Maybe JobExecutionStatus
status) (\s :: ListJobExecutionsForJob
s@ListJobExecutionsForJob' {} Maybe JobExecutionStatus
a -> ListJobExecutionsForJob
s {$sel:status:ListJobExecutionsForJob' :: Maybe JobExecutionStatus
status = Maybe JobExecutionStatus
a} :: ListJobExecutionsForJob)

-- | The token to retrieve the next set of results.
listJobExecutionsForJob_nextToken :: Lens.Lens' ListJobExecutionsForJob (Prelude.Maybe Prelude.Text)
listJobExecutionsForJob_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListJobExecutionsForJob -> f ListJobExecutionsForJob
listJobExecutionsForJob_nextToken = (ListJobExecutionsForJob -> Maybe Text)
-> (ListJobExecutionsForJob
    -> Maybe Text -> ListJobExecutionsForJob)
-> Lens
     ListJobExecutionsForJob
     ListJobExecutionsForJob
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobExecutionsForJob' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListJobExecutionsForJob' :: ListJobExecutionsForJob -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListJobExecutionsForJob
s@ListJobExecutionsForJob' {} Maybe Text
a -> ListJobExecutionsForJob
s {$sel:nextToken:ListJobExecutionsForJob' :: Maybe Text
nextToken = Maybe Text
a} :: ListJobExecutionsForJob)

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

-- | The unique identifier you assigned to this job when it was created.
listJobExecutionsForJob_jobId :: Lens.Lens' ListJobExecutionsForJob Prelude.Text
listJobExecutionsForJob_jobId :: (Text -> f Text)
-> ListJobExecutionsForJob -> f ListJobExecutionsForJob
listJobExecutionsForJob_jobId = (ListJobExecutionsForJob -> Text)
-> (ListJobExecutionsForJob -> Text -> ListJobExecutionsForJob)
-> Lens ListJobExecutionsForJob ListJobExecutionsForJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobExecutionsForJob' {Text
jobId :: Text
$sel:jobId:ListJobExecutionsForJob' :: ListJobExecutionsForJob -> Text
jobId} -> Text
jobId) (\s :: ListJobExecutionsForJob
s@ListJobExecutionsForJob' {} Text
a -> ListJobExecutionsForJob
s {$sel:jobId:ListJobExecutionsForJob' :: Text
jobId = Text
a} :: ListJobExecutionsForJob)

instance Core.AWSPager ListJobExecutionsForJob where
  page :: ListJobExecutionsForJob
-> AWSResponse ListJobExecutionsForJob
-> Maybe ListJobExecutionsForJob
page ListJobExecutionsForJob
rq AWSResponse ListJobExecutionsForJob
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListJobExecutionsForJob
ListJobExecutionsForJobResponse
rs
            ListJobExecutionsForJobResponse
-> Getting (First Text) ListJobExecutionsForJobResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListJobExecutionsForJobResponse
-> Const (First Text) ListJobExecutionsForJobResponse
Lens' ListJobExecutionsForJobResponse (Maybe Text)
listJobExecutionsForJobResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListJobExecutionsForJobResponse
 -> Const (First Text) ListJobExecutionsForJobResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListJobExecutionsForJobResponse 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 ListJobExecutionsForJob
forall a. Maybe a
Prelude.Nothing
    | Maybe [JobExecutionSummaryForJob] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListJobExecutionsForJob
ListJobExecutionsForJobResponse
rs
            ListJobExecutionsForJobResponse
-> Getting
     (First [JobExecutionSummaryForJob])
     ListJobExecutionsForJobResponse
     [JobExecutionSummaryForJob]
-> Maybe [JobExecutionSummaryForJob]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [JobExecutionSummaryForJob]
 -> Const
      (First [JobExecutionSummaryForJob])
      (Maybe [JobExecutionSummaryForJob]))
-> ListJobExecutionsForJobResponse
-> Const
     (First [JobExecutionSummaryForJob]) ListJobExecutionsForJobResponse
Lens'
  ListJobExecutionsForJobResponse (Maybe [JobExecutionSummaryForJob])
listJobExecutionsForJobResponse_executionSummaries
              ((Maybe [JobExecutionSummaryForJob]
  -> Const
       (First [JobExecutionSummaryForJob])
       (Maybe [JobExecutionSummaryForJob]))
 -> ListJobExecutionsForJobResponse
 -> Const
      (First [JobExecutionSummaryForJob])
      ListJobExecutionsForJobResponse)
-> (([JobExecutionSummaryForJob]
     -> Const
          (First [JobExecutionSummaryForJob]) [JobExecutionSummaryForJob])
    -> Maybe [JobExecutionSummaryForJob]
    -> Const
         (First [JobExecutionSummaryForJob])
         (Maybe [JobExecutionSummaryForJob]))
-> Getting
     (First [JobExecutionSummaryForJob])
     ListJobExecutionsForJobResponse
     [JobExecutionSummaryForJob]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([JobExecutionSummaryForJob]
 -> Const
      (First [JobExecutionSummaryForJob]) [JobExecutionSummaryForJob])
-> Maybe [JobExecutionSummaryForJob]
-> Const
     (First [JobExecutionSummaryForJob])
     (Maybe [JobExecutionSummaryForJob])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListJobExecutionsForJob
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListJobExecutionsForJob -> Maybe ListJobExecutionsForJob
forall a. a -> Maybe a
Prelude.Just (ListJobExecutionsForJob -> Maybe ListJobExecutionsForJob)
-> ListJobExecutionsForJob -> Maybe ListJobExecutionsForJob
forall a b. (a -> b) -> a -> b
Prelude.$
        ListJobExecutionsForJob
rq
          ListJobExecutionsForJob
-> (ListJobExecutionsForJob -> ListJobExecutionsForJob)
-> ListJobExecutionsForJob
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListJobExecutionsForJob -> Identity ListJobExecutionsForJob
Lens
  ListJobExecutionsForJob
  ListJobExecutionsForJob
  (Maybe Text)
  (Maybe Text)
listJobExecutionsForJob_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListJobExecutionsForJob -> Identity ListJobExecutionsForJob)
-> Maybe Text -> ListJobExecutionsForJob -> ListJobExecutionsForJob
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListJobExecutionsForJob
ListJobExecutionsForJobResponse
rs
          ListJobExecutionsForJobResponse
-> Getting (First Text) ListJobExecutionsForJobResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListJobExecutionsForJobResponse
-> Const (First Text) ListJobExecutionsForJobResponse
Lens' ListJobExecutionsForJobResponse (Maybe Text)
listJobExecutionsForJobResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListJobExecutionsForJobResponse
 -> Const (First Text) ListJobExecutionsForJobResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListJobExecutionsForJobResponse 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 ListJobExecutionsForJob where
  type
    AWSResponse ListJobExecutionsForJob =
      ListJobExecutionsForJobResponse
  request :: ListJobExecutionsForJob -> Request ListJobExecutionsForJob
request = Service
-> ListJobExecutionsForJob -> Request ListJobExecutionsForJob
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListJobExecutionsForJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListJobExecutionsForJob)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListJobExecutionsForJob))
-> Logger
-> Service
-> Proxy ListJobExecutionsForJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListJobExecutionsForJob)))
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 [JobExecutionSummaryForJob]
-> Maybe Text -> Int -> ListJobExecutionsForJobResponse
ListJobExecutionsForJobResponse'
            (Maybe [JobExecutionSummaryForJob]
 -> Maybe Text -> Int -> ListJobExecutionsForJobResponse)
-> Either String (Maybe [JobExecutionSummaryForJob])
-> Either
     String (Maybe Text -> Int -> ListJobExecutionsForJobResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text
-> Either String (Maybe (Maybe [JobExecutionSummaryForJob]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"executionSummaries"
                            Either String (Maybe (Maybe [JobExecutionSummaryForJob]))
-> Maybe [JobExecutionSummaryForJob]
-> Either String (Maybe [JobExecutionSummaryForJob])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [JobExecutionSummaryForJob]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either
  String (Maybe Text -> Int -> ListJobExecutionsForJobResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListJobExecutionsForJobResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
            Either String (Int -> ListJobExecutionsForJobResponse)
-> Either String Int
-> Either String ListJobExecutionsForJobResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListJobExecutionsForJob

instance Prelude.NFData ListJobExecutionsForJob

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

instance Core.ToPath ListJobExecutionsForJob where
  toPath :: ListJobExecutionsForJob -> ByteString
toPath ListJobExecutionsForJob' {Maybe Natural
Maybe Text
Maybe JobExecutionStatus
Text
jobId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
status :: Maybe JobExecutionStatus
$sel:jobId:ListJobExecutionsForJob' :: ListJobExecutionsForJob -> Text
$sel:maxResults:ListJobExecutionsForJob' :: ListJobExecutionsForJob -> Maybe Natural
$sel:nextToken:ListJobExecutionsForJob' :: ListJobExecutionsForJob -> Maybe Text
$sel:status:ListJobExecutionsForJob' :: ListJobExecutionsForJob -> Maybe JobExecutionStatus
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/jobs/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
jobId, ByteString
"/things"]

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

-- | /See:/ 'newListJobExecutionsForJobResponse' smart constructor.
data ListJobExecutionsForJobResponse = ListJobExecutionsForJobResponse'
  { -- | A list of job execution summaries.
    ListJobExecutionsForJobResponse
-> Maybe [JobExecutionSummaryForJob]
executionSummaries :: Prelude.Maybe [JobExecutionSummaryForJob],
    -- | The token for the next set of results, or __null__ if there are no
    -- additional results.
    ListJobExecutionsForJobResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListJobExecutionsForJobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListJobExecutionsForJobResponse
-> ListJobExecutionsForJobResponse -> Bool
(ListJobExecutionsForJobResponse
 -> ListJobExecutionsForJobResponse -> Bool)
-> (ListJobExecutionsForJobResponse
    -> ListJobExecutionsForJobResponse -> Bool)
-> Eq ListJobExecutionsForJobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListJobExecutionsForJobResponse
-> ListJobExecutionsForJobResponse -> Bool
$c/= :: ListJobExecutionsForJobResponse
-> ListJobExecutionsForJobResponse -> Bool
== :: ListJobExecutionsForJobResponse
-> ListJobExecutionsForJobResponse -> Bool
$c== :: ListJobExecutionsForJobResponse
-> ListJobExecutionsForJobResponse -> Bool
Prelude.Eq, ReadPrec [ListJobExecutionsForJobResponse]
ReadPrec ListJobExecutionsForJobResponse
Int -> ReadS ListJobExecutionsForJobResponse
ReadS [ListJobExecutionsForJobResponse]
(Int -> ReadS ListJobExecutionsForJobResponse)
-> ReadS [ListJobExecutionsForJobResponse]
-> ReadPrec ListJobExecutionsForJobResponse
-> ReadPrec [ListJobExecutionsForJobResponse]
-> Read ListJobExecutionsForJobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListJobExecutionsForJobResponse]
$creadListPrec :: ReadPrec [ListJobExecutionsForJobResponse]
readPrec :: ReadPrec ListJobExecutionsForJobResponse
$creadPrec :: ReadPrec ListJobExecutionsForJobResponse
readList :: ReadS [ListJobExecutionsForJobResponse]
$creadList :: ReadS [ListJobExecutionsForJobResponse]
readsPrec :: Int -> ReadS ListJobExecutionsForJobResponse
$creadsPrec :: Int -> ReadS ListJobExecutionsForJobResponse
Prelude.Read, Int -> ListJobExecutionsForJobResponse -> ShowS
[ListJobExecutionsForJobResponse] -> ShowS
ListJobExecutionsForJobResponse -> String
(Int -> ListJobExecutionsForJobResponse -> ShowS)
-> (ListJobExecutionsForJobResponse -> String)
-> ([ListJobExecutionsForJobResponse] -> ShowS)
-> Show ListJobExecutionsForJobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListJobExecutionsForJobResponse] -> ShowS
$cshowList :: [ListJobExecutionsForJobResponse] -> ShowS
show :: ListJobExecutionsForJobResponse -> String
$cshow :: ListJobExecutionsForJobResponse -> String
showsPrec :: Int -> ListJobExecutionsForJobResponse -> ShowS
$cshowsPrec :: Int -> ListJobExecutionsForJobResponse -> ShowS
Prelude.Show, (forall x.
 ListJobExecutionsForJobResponse
 -> Rep ListJobExecutionsForJobResponse x)
-> (forall x.
    Rep ListJobExecutionsForJobResponse x
    -> ListJobExecutionsForJobResponse)
-> Generic ListJobExecutionsForJobResponse
forall x.
Rep ListJobExecutionsForJobResponse x
-> ListJobExecutionsForJobResponse
forall x.
ListJobExecutionsForJobResponse
-> Rep ListJobExecutionsForJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListJobExecutionsForJobResponse x
-> ListJobExecutionsForJobResponse
$cfrom :: forall x.
ListJobExecutionsForJobResponse
-> Rep ListJobExecutionsForJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListJobExecutionsForJobResponse' 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:
--
-- 'executionSummaries', 'listJobExecutionsForJobResponse_executionSummaries' - A list of job execution summaries.
--
-- 'nextToken', 'listJobExecutionsForJobResponse_nextToken' - The token for the next set of results, or __null__ if there are no
-- additional results.
--
-- 'httpStatus', 'listJobExecutionsForJobResponse_httpStatus' - The response's http status code.
newListJobExecutionsForJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListJobExecutionsForJobResponse
newListJobExecutionsForJobResponse :: Int -> ListJobExecutionsForJobResponse
newListJobExecutionsForJobResponse Int
pHttpStatus_ =
  ListJobExecutionsForJobResponse' :: Maybe [JobExecutionSummaryForJob]
-> Maybe Text -> Int -> ListJobExecutionsForJobResponse
ListJobExecutionsForJobResponse'
    { $sel:executionSummaries:ListJobExecutionsForJobResponse' :: Maybe [JobExecutionSummaryForJob]
executionSummaries =
        Maybe [JobExecutionSummaryForJob]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListJobExecutionsForJobResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListJobExecutionsForJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of job execution summaries.
listJobExecutionsForJobResponse_executionSummaries :: Lens.Lens' ListJobExecutionsForJobResponse (Prelude.Maybe [JobExecutionSummaryForJob])
listJobExecutionsForJobResponse_executionSummaries :: (Maybe [JobExecutionSummaryForJob]
 -> f (Maybe [JobExecutionSummaryForJob]))
-> ListJobExecutionsForJobResponse
-> f ListJobExecutionsForJobResponse
listJobExecutionsForJobResponse_executionSummaries = (ListJobExecutionsForJobResponse
 -> Maybe [JobExecutionSummaryForJob])
-> (ListJobExecutionsForJobResponse
    -> Maybe [JobExecutionSummaryForJob]
    -> ListJobExecutionsForJobResponse)
-> Lens'
     ListJobExecutionsForJobResponse (Maybe [JobExecutionSummaryForJob])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobExecutionsForJobResponse' {Maybe [JobExecutionSummaryForJob]
executionSummaries :: Maybe [JobExecutionSummaryForJob]
$sel:executionSummaries:ListJobExecutionsForJobResponse' :: ListJobExecutionsForJobResponse
-> Maybe [JobExecutionSummaryForJob]
executionSummaries} -> Maybe [JobExecutionSummaryForJob]
executionSummaries) (\s :: ListJobExecutionsForJobResponse
s@ListJobExecutionsForJobResponse' {} Maybe [JobExecutionSummaryForJob]
a -> ListJobExecutionsForJobResponse
s {$sel:executionSummaries:ListJobExecutionsForJobResponse' :: Maybe [JobExecutionSummaryForJob]
executionSummaries = Maybe [JobExecutionSummaryForJob]
a} :: ListJobExecutionsForJobResponse) ((Maybe [JobExecutionSummaryForJob]
  -> f (Maybe [JobExecutionSummaryForJob]))
 -> ListJobExecutionsForJobResponse
 -> f ListJobExecutionsForJobResponse)
-> ((Maybe [JobExecutionSummaryForJob]
     -> f (Maybe [JobExecutionSummaryForJob]))
    -> Maybe [JobExecutionSummaryForJob]
    -> f (Maybe [JobExecutionSummaryForJob]))
-> (Maybe [JobExecutionSummaryForJob]
    -> f (Maybe [JobExecutionSummaryForJob]))
-> ListJobExecutionsForJobResponse
-> f ListJobExecutionsForJobResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [JobExecutionSummaryForJob]
  [JobExecutionSummaryForJob]
  [JobExecutionSummaryForJob]
  [JobExecutionSummaryForJob]
-> Iso
     (Maybe [JobExecutionSummaryForJob])
     (Maybe [JobExecutionSummaryForJob])
     (Maybe [JobExecutionSummaryForJob])
     (Maybe [JobExecutionSummaryForJob])
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
  [JobExecutionSummaryForJob]
  [JobExecutionSummaryForJob]
  [JobExecutionSummaryForJob]
  [JobExecutionSummaryForJob]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token for the next set of results, or __null__ if there are no
-- additional results.
listJobExecutionsForJobResponse_nextToken :: Lens.Lens' ListJobExecutionsForJobResponse (Prelude.Maybe Prelude.Text)
listJobExecutionsForJobResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListJobExecutionsForJobResponse
-> f ListJobExecutionsForJobResponse
listJobExecutionsForJobResponse_nextToken = (ListJobExecutionsForJobResponse -> Maybe Text)
-> (ListJobExecutionsForJobResponse
    -> Maybe Text -> ListJobExecutionsForJobResponse)
-> Lens' ListJobExecutionsForJobResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobExecutionsForJobResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListJobExecutionsForJobResponse' :: ListJobExecutionsForJobResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListJobExecutionsForJobResponse
s@ListJobExecutionsForJobResponse' {} Maybe Text
a -> ListJobExecutionsForJobResponse
s {$sel:nextToken:ListJobExecutionsForJobResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListJobExecutionsForJobResponse)

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

instance
  Prelude.NFData
    ListJobExecutionsForJobResponse