{-# 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.ListJobExecutionsForThing
-- 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 the job executions for the specified thing.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions ListJobExecutionsForThing>
-- action.
--
-- This operation returns paginated results.
module Amazonka.IoT.ListJobExecutionsForThing
  ( -- * Creating a Request
    ListJobExecutionsForThing (..),
    newListJobExecutionsForThing,

    -- * Request Lenses
    listJobExecutionsForThing_jobId,
    listJobExecutionsForThing_maxResults,
    listJobExecutionsForThing_namespaceId,
    listJobExecutionsForThing_nextToken,
    listJobExecutionsForThing_status,
    listJobExecutionsForThing_thingName,

    -- * Destructuring the Response
    ListJobExecutionsForThingResponse (..),
    newListJobExecutionsForThingResponse,

    -- * Response Lenses
    listJobExecutionsForThingResponse_executionSummaries,
    listJobExecutionsForThingResponse_nextToken,
    listJobExecutionsForThingResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListJobExecutionsForThing' smart constructor.
data ListJobExecutionsForThing = ListJobExecutionsForThing'
  { -- | The unique identifier you assigned to this job when it was created.
    ListJobExecutionsForThing -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to be returned per request.
    ListJobExecutionsForThing -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The namespace used to indicate that a job is a customer-managed job.
    --
    -- When you specify a value for this parameter, Amazon Web Services IoT
    -- Core sends jobs notifications to MQTT topics that contain the value in
    -- the following format.
    --
    -- @$aws\/things\/@/@THING_NAME@/@\/jobs\/@/@JOB_ID@/@\/notify-namespace-@/@NAMESPACE_ID@/@\/@
    --
    -- The @namespaceId@ feature is in public preview.
    ListJobExecutionsForThing -> Maybe Text
namespaceId :: Prelude.Maybe Prelude.Text,
    -- | The token to retrieve the next set of results.
    ListJobExecutionsForThing -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | An optional filter that lets you search for jobs that have the specified
    -- status.
    ListJobExecutionsForThing -> Maybe JobExecutionStatus
status :: Prelude.Maybe JobExecutionStatus,
    -- | The thing name.
    ListJobExecutionsForThing -> Text
thingName :: Prelude.Text
  }
  deriving (ListJobExecutionsForThing -> ListJobExecutionsForThing -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListJobExecutionsForThing -> ListJobExecutionsForThing -> Bool
$c/= :: ListJobExecutionsForThing -> ListJobExecutionsForThing -> Bool
== :: ListJobExecutionsForThing -> ListJobExecutionsForThing -> Bool
$c== :: ListJobExecutionsForThing -> ListJobExecutionsForThing -> Bool
Prelude.Eq, ReadPrec [ListJobExecutionsForThing]
ReadPrec ListJobExecutionsForThing
Int -> ReadS ListJobExecutionsForThing
ReadS [ListJobExecutionsForThing]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListJobExecutionsForThing]
$creadListPrec :: ReadPrec [ListJobExecutionsForThing]
readPrec :: ReadPrec ListJobExecutionsForThing
$creadPrec :: ReadPrec ListJobExecutionsForThing
readList :: ReadS [ListJobExecutionsForThing]
$creadList :: ReadS [ListJobExecutionsForThing]
readsPrec :: Int -> ReadS ListJobExecutionsForThing
$creadsPrec :: Int -> ReadS ListJobExecutionsForThing
Prelude.Read, Int -> ListJobExecutionsForThing -> ShowS
[ListJobExecutionsForThing] -> ShowS
ListJobExecutionsForThing -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListJobExecutionsForThing] -> ShowS
$cshowList :: [ListJobExecutionsForThing] -> ShowS
show :: ListJobExecutionsForThing -> String
$cshow :: ListJobExecutionsForThing -> String
showsPrec :: Int -> ListJobExecutionsForThing -> ShowS
$cshowsPrec :: Int -> ListJobExecutionsForThing -> ShowS
Prelude.Show, forall x.
Rep ListJobExecutionsForThing x -> ListJobExecutionsForThing
forall x.
ListJobExecutionsForThing -> Rep ListJobExecutionsForThing x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListJobExecutionsForThing x -> ListJobExecutionsForThing
$cfrom :: forall x.
ListJobExecutionsForThing -> Rep ListJobExecutionsForThing x
Prelude.Generic)

-- |
-- Create a value of 'ListJobExecutionsForThing' 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:
--
-- 'jobId', 'listJobExecutionsForThing_jobId' - The unique identifier you assigned to this job when it was created.
--
-- 'maxResults', 'listJobExecutionsForThing_maxResults' - The maximum number of results to be returned per request.
--
-- 'namespaceId', 'listJobExecutionsForThing_namespaceId' - The namespace used to indicate that a job is a customer-managed job.
--
-- When you specify a value for this parameter, Amazon Web Services IoT
-- Core sends jobs notifications to MQTT topics that contain the value in
-- the following format.
--
-- @$aws\/things\/@/@THING_NAME@/@\/jobs\/@/@JOB_ID@/@\/notify-namespace-@/@NAMESPACE_ID@/@\/@
--
-- The @namespaceId@ feature is in public preview.
--
-- 'nextToken', 'listJobExecutionsForThing_nextToken' - The token to retrieve the next set of results.
--
-- 'status', 'listJobExecutionsForThing_status' - An optional filter that lets you search for jobs that have the specified
-- status.
--
-- 'thingName', 'listJobExecutionsForThing_thingName' - The thing name.
newListJobExecutionsForThing ::
  -- | 'thingName'
  Prelude.Text ->
  ListJobExecutionsForThing
newListJobExecutionsForThing :: Text -> ListJobExecutionsForThing
newListJobExecutionsForThing Text
pThingName_ =
  ListJobExecutionsForThing'
    { $sel:jobId:ListJobExecutionsForThing' :: Maybe Text
jobId = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListJobExecutionsForThing' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:namespaceId:ListJobExecutionsForThing' :: Maybe Text
namespaceId = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListJobExecutionsForThing' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ListJobExecutionsForThing' :: Maybe JobExecutionStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:thingName:ListJobExecutionsForThing' :: Text
thingName = Text
pThingName_
    }

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

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

-- | The namespace used to indicate that a job is a customer-managed job.
--
-- When you specify a value for this parameter, Amazon Web Services IoT
-- Core sends jobs notifications to MQTT topics that contain the value in
-- the following format.
--
-- @$aws\/things\/@/@THING_NAME@/@\/jobs\/@/@JOB_ID@/@\/notify-namespace-@/@NAMESPACE_ID@/@\/@
--
-- The @namespaceId@ feature is in public preview.
listJobExecutionsForThing_namespaceId :: Lens.Lens' ListJobExecutionsForThing (Prelude.Maybe Prelude.Text)
listJobExecutionsForThing_namespaceId :: Lens' ListJobExecutionsForThing (Maybe Text)
listJobExecutionsForThing_namespaceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobExecutionsForThing' {Maybe Text
namespaceId :: Maybe Text
$sel:namespaceId:ListJobExecutionsForThing' :: ListJobExecutionsForThing -> Maybe Text
namespaceId} -> Maybe Text
namespaceId) (\s :: ListJobExecutionsForThing
s@ListJobExecutionsForThing' {} Maybe Text
a -> ListJobExecutionsForThing
s {$sel:namespaceId:ListJobExecutionsForThing' :: Maybe Text
namespaceId = Maybe Text
a} :: ListJobExecutionsForThing)

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

-- | An optional filter that lets you search for jobs that have the specified
-- status.
listJobExecutionsForThing_status :: Lens.Lens' ListJobExecutionsForThing (Prelude.Maybe JobExecutionStatus)
listJobExecutionsForThing_status :: Lens' ListJobExecutionsForThing (Maybe JobExecutionStatus)
listJobExecutionsForThing_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobExecutionsForThing' {Maybe JobExecutionStatus
status :: Maybe JobExecutionStatus
$sel:status:ListJobExecutionsForThing' :: ListJobExecutionsForThing -> Maybe JobExecutionStatus
status} -> Maybe JobExecutionStatus
status) (\s :: ListJobExecutionsForThing
s@ListJobExecutionsForThing' {} Maybe JobExecutionStatus
a -> ListJobExecutionsForThing
s {$sel:status:ListJobExecutionsForThing' :: Maybe JobExecutionStatus
status = Maybe JobExecutionStatus
a} :: ListJobExecutionsForThing)

-- | The thing name.
listJobExecutionsForThing_thingName :: Lens.Lens' ListJobExecutionsForThing Prelude.Text
listJobExecutionsForThing_thingName :: Lens' ListJobExecutionsForThing Text
listJobExecutionsForThing_thingName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobExecutionsForThing' {Text
thingName :: Text
$sel:thingName:ListJobExecutionsForThing' :: ListJobExecutionsForThing -> Text
thingName} -> Text
thingName) (\s :: ListJobExecutionsForThing
s@ListJobExecutionsForThing' {} Text
a -> ListJobExecutionsForThing
s {$sel:thingName:ListJobExecutionsForThing' :: Text
thingName = Text
a} :: ListJobExecutionsForThing)

instance Core.AWSPager ListJobExecutionsForThing where
  page :: ListJobExecutionsForThing
-> AWSResponse ListJobExecutionsForThing
-> Maybe ListJobExecutionsForThing
page ListJobExecutionsForThing
rq AWSResponse ListJobExecutionsForThing
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListJobExecutionsForThing
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListJobExecutionsForThingResponse (Maybe Text)
listJobExecutionsForThingResponse_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 ListJobExecutionsForThing
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
  ListJobExecutionsForThingResponse
  (Maybe [JobExecutionSummaryForThing])
listJobExecutionsForThingResponse_executionSummaries
            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.$ ListJobExecutionsForThing
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListJobExecutionsForThing (Maybe Text)
listJobExecutionsForThing_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListJobExecutionsForThing
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListJobExecutionsForThingResponse (Maybe Text)
listJobExecutionsForThingResponse_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 ListJobExecutionsForThing where
  type
    AWSResponse ListJobExecutionsForThing =
      ListJobExecutionsForThingResponse
  request :: (Service -> Service)
-> ListJobExecutionsForThing -> Request ListJobExecutionsForThing
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 ListJobExecutionsForThing
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListJobExecutionsForThing)))
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 [JobExecutionSummaryForThing]
-> Maybe Text -> Int -> ListJobExecutionsForThingResponse
ListJobExecutionsForThingResponse'
            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
"executionSummaries"
                            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 ListJobExecutionsForThing where
  hashWithSalt :: Int -> ListJobExecutionsForThing -> Int
hashWithSalt Int
_salt ListJobExecutionsForThing' {Maybe Natural
Maybe Text
Maybe JobExecutionStatus
Text
thingName :: Text
status :: Maybe JobExecutionStatus
nextToken :: Maybe Text
namespaceId :: Maybe Text
maxResults :: Maybe Natural
jobId :: Maybe Text
$sel:thingName:ListJobExecutionsForThing' :: ListJobExecutionsForThing -> Text
$sel:status:ListJobExecutionsForThing' :: ListJobExecutionsForThing -> Maybe JobExecutionStatus
$sel:nextToken:ListJobExecutionsForThing' :: ListJobExecutionsForThing -> Maybe Text
$sel:namespaceId:ListJobExecutionsForThing' :: ListJobExecutionsForThing -> Maybe Text
$sel:maxResults:ListJobExecutionsForThing' :: ListJobExecutionsForThing -> Maybe Natural
$sel:jobId:ListJobExecutionsForThing' :: ListJobExecutionsForThing -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
jobId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
namespaceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe JobExecutionStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
thingName

instance Prelude.NFData ListJobExecutionsForThing where
  rnf :: ListJobExecutionsForThing -> ()
rnf ListJobExecutionsForThing' {Maybe Natural
Maybe Text
Maybe JobExecutionStatus
Text
thingName :: Text
status :: Maybe JobExecutionStatus
nextToken :: Maybe Text
namespaceId :: Maybe Text
maxResults :: Maybe Natural
jobId :: Maybe Text
$sel:thingName:ListJobExecutionsForThing' :: ListJobExecutionsForThing -> Text
$sel:status:ListJobExecutionsForThing' :: ListJobExecutionsForThing -> Maybe JobExecutionStatus
$sel:nextToken:ListJobExecutionsForThing' :: ListJobExecutionsForThing -> Maybe Text
$sel:namespaceId:ListJobExecutionsForThing' :: ListJobExecutionsForThing -> Maybe Text
$sel:maxResults:ListJobExecutionsForThing' :: ListJobExecutionsForThing -> Maybe Natural
$sel:jobId:ListJobExecutionsForThing' :: ListJobExecutionsForThing -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
jobId
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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
namespaceId
      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 JobExecutionStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
thingName

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

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

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

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

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

-- | A list of job execution summaries.
listJobExecutionsForThingResponse_executionSummaries :: Lens.Lens' ListJobExecutionsForThingResponse (Prelude.Maybe [JobExecutionSummaryForThing])
listJobExecutionsForThingResponse_executionSummaries :: Lens'
  ListJobExecutionsForThingResponse
  (Maybe [JobExecutionSummaryForThing])
listJobExecutionsForThingResponse_executionSummaries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobExecutionsForThingResponse' {Maybe [JobExecutionSummaryForThing]
executionSummaries :: Maybe [JobExecutionSummaryForThing]
$sel:executionSummaries:ListJobExecutionsForThingResponse' :: ListJobExecutionsForThingResponse
-> Maybe [JobExecutionSummaryForThing]
executionSummaries} -> Maybe [JobExecutionSummaryForThing]
executionSummaries) (\s :: ListJobExecutionsForThingResponse
s@ListJobExecutionsForThingResponse' {} Maybe [JobExecutionSummaryForThing]
a -> ListJobExecutionsForThingResponse
s {$sel:executionSummaries:ListJobExecutionsForThingResponse' :: Maybe [JobExecutionSummaryForThing]
executionSummaries = Maybe [JobExecutionSummaryForThing]
a} :: ListJobExecutionsForThingResponse) 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 token for the next set of results, or __null__ if there are no
-- additional results.
listJobExecutionsForThingResponse_nextToken :: Lens.Lens' ListJobExecutionsForThingResponse (Prelude.Maybe Prelude.Text)
listJobExecutionsForThingResponse_nextToken :: Lens' ListJobExecutionsForThingResponse (Maybe Text)
listJobExecutionsForThingResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobExecutionsForThingResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListJobExecutionsForThingResponse' :: ListJobExecutionsForThingResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListJobExecutionsForThingResponse
s@ListJobExecutionsForThingResponse' {} Maybe Text
a -> ListJobExecutionsForThingResponse
s {$sel:nextToken:ListJobExecutionsForThingResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListJobExecutionsForThingResponse)

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

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