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

    -- * Request Lenses
    listJobs_maxResults,
    listJobs_namespaceId,
    listJobs_nextToken,
    listJobs_status,
    listJobs_targetSelection,
    listJobs_thingGroupId,
    listJobs_thingGroupName,

    -- * Destructuring the Response
    ListJobsResponse (..),
    newListJobsResponse,

    -- * Response Lenses
    listJobsResponse_jobs,
    listJobsResponse_nextToken,
    listJobsResponse_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:/ 'newListJobs' smart constructor.
data ListJobs = ListJobs'
  { -- | The maximum number of results to return per request.
    ListJobs -> 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.
    ListJobs -> Maybe Text
namespaceId :: Prelude.Maybe Prelude.Text,
    -- | The token to retrieve the next set of results.
    ListJobs -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | An optional filter that lets you search for jobs that have the specified
    -- status.
    ListJobs -> Maybe JobStatus
status :: Prelude.Maybe JobStatus,
    -- | Specifies whether the job will continue to run (CONTINUOUS), or will be
    -- complete after all those things specified as targets have completed the
    -- job (SNAPSHOT). If continuous, the job may also be run on a thing when a
    -- change is detected in a target. For example, a job will run on a thing
    -- when the thing is added to a target group, even after the job was
    -- completed by all things originally in the group.
    --
    -- We recommend that you use continuous jobs instead of snapshot jobs for
    -- dynamic thing group targets. By using continuous jobs, devices that join
    -- the group receive the job execution even after the job has been created.
    ListJobs -> Maybe TargetSelection
targetSelection :: Prelude.Maybe TargetSelection,
    -- | A filter that limits the returned jobs to those for the specified group.
    ListJobs -> Maybe Text
thingGroupId :: Prelude.Maybe Prelude.Text,
    -- | A filter that limits the returned jobs to those for the specified group.
    ListJobs -> Maybe Text
thingGroupName :: Prelude.Maybe Prelude.Text
  }
  deriving (ListJobs -> ListJobs -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListJobs -> ListJobs -> Bool
$c/= :: ListJobs -> ListJobs -> Bool
== :: ListJobs -> ListJobs -> Bool
$c== :: ListJobs -> ListJobs -> Bool
Prelude.Eq, ReadPrec [ListJobs]
ReadPrec ListJobs
Int -> ReadS ListJobs
ReadS [ListJobs]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListJobs]
$creadListPrec :: ReadPrec [ListJobs]
readPrec :: ReadPrec ListJobs
$creadPrec :: ReadPrec ListJobs
readList :: ReadS [ListJobs]
$creadList :: ReadS [ListJobs]
readsPrec :: Int -> ReadS ListJobs
$creadsPrec :: Int -> ReadS ListJobs
Prelude.Read, Int -> ListJobs -> ShowS
[ListJobs] -> ShowS
ListJobs -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListJobs] -> ShowS
$cshowList :: [ListJobs] -> ShowS
show :: ListJobs -> String
$cshow :: ListJobs -> String
showsPrec :: Int -> ListJobs -> ShowS
$cshowsPrec :: Int -> ListJobs -> ShowS
Prelude.Show, forall x. Rep ListJobs x -> ListJobs
forall x. ListJobs -> Rep ListJobs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListJobs x -> ListJobs
$cfrom :: forall x. ListJobs -> Rep ListJobs x
Prelude.Generic)

-- |
-- Create a value of 'ListJobs' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'maxResults', 'listJobs_maxResults' - The maximum number of results to return per request.
--
-- 'namespaceId', 'listJobs_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', 'listJobs_nextToken' - The token to retrieve the next set of results.
--
-- 'status', 'listJobs_status' - An optional filter that lets you search for jobs that have the specified
-- status.
--
-- 'targetSelection', 'listJobs_targetSelection' - Specifies whether the job will continue to run (CONTINUOUS), or will be
-- complete after all those things specified as targets have completed the
-- job (SNAPSHOT). If continuous, the job may also be run on a thing when a
-- change is detected in a target. For example, a job will run on a thing
-- when the thing is added to a target group, even after the job was
-- completed by all things originally in the group.
--
-- We recommend that you use continuous jobs instead of snapshot jobs for
-- dynamic thing group targets. By using continuous jobs, devices that join
-- the group receive the job execution even after the job has been created.
--
-- 'thingGroupId', 'listJobs_thingGroupId' - A filter that limits the returned jobs to those for the specified group.
--
-- 'thingGroupName', 'listJobs_thingGroupName' - A filter that limits the returned jobs to those for the specified group.
newListJobs ::
  ListJobs
newListJobs :: ListJobs
newListJobs =
  ListJobs'
    { $sel:maxResults:ListJobs' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:namespaceId:ListJobs' :: Maybe Text
namespaceId = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListJobs' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ListJobs' :: Maybe JobStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:targetSelection:ListJobs' :: Maybe TargetSelection
targetSelection = forall a. Maybe a
Prelude.Nothing,
      $sel:thingGroupId:ListJobs' :: Maybe Text
thingGroupId = forall a. Maybe a
Prelude.Nothing,
      $sel:thingGroupName:ListJobs' :: Maybe Text
thingGroupName = forall a. Maybe a
Prelude.Nothing
    }

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

-- | 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.
listJobs_namespaceId :: Lens.Lens' ListJobs (Prelude.Maybe Prelude.Text)
listJobs_namespaceId :: Lens' ListJobs (Maybe Text)
listJobs_namespaceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobs' {Maybe Text
namespaceId :: Maybe Text
$sel:namespaceId:ListJobs' :: ListJobs -> Maybe Text
namespaceId} -> Maybe Text
namespaceId) (\s :: ListJobs
s@ListJobs' {} Maybe Text
a -> ListJobs
s {$sel:namespaceId:ListJobs' :: Maybe Text
namespaceId = Maybe Text
a} :: ListJobs)

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

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

-- | Specifies whether the job will continue to run (CONTINUOUS), or will be
-- complete after all those things specified as targets have completed the
-- job (SNAPSHOT). If continuous, the job may also be run on a thing when a
-- change is detected in a target. For example, a job will run on a thing
-- when the thing is added to a target group, even after the job was
-- completed by all things originally in the group.
--
-- We recommend that you use continuous jobs instead of snapshot jobs for
-- dynamic thing group targets. By using continuous jobs, devices that join
-- the group receive the job execution even after the job has been created.
listJobs_targetSelection :: Lens.Lens' ListJobs (Prelude.Maybe TargetSelection)
listJobs_targetSelection :: Lens' ListJobs (Maybe TargetSelection)
listJobs_targetSelection = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobs' {Maybe TargetSelection
targetSelection :: Maybe TargetSelection
$sel:targetSelection:ListJobs' :: ListJobs -> Maybe TargetSelection
targetSelection} -> Maybe TargetSelection
targetSelection) (\s :: ListJobs
s@ListJobs' {} Maybe TargetSelection
a -> ListJobs
s {$sel:targetSelection:ListJobs' :: Maybe TargetSelection
targetSelection = Maybe TargetSelection
a} :: ListJobs)

-- | A filter that limits the returned jobs to those for the specified group.
listJobs_thingGroupId :: Lens.Lens' ListJobs (Prelude.Maybe Prelude.Text)
listJobs_thingGroupId :: Lens' ListJobs (Maybe Text)
listJobs_thingGroupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobs' {Maybe Text
thingGroupId :: Maybe Text
$sel:thingGroupId:ListJobs' :: ListJobs -> Maybe Text
thingGroupId} -> Maybe Text
thingGroupId) (\s :: ListJobs
s@ListJobs' {} Maybe Text
a -> ListJobs
s {$sel:thingGroupId:ListJobs' :: Maybe Text
thingGroupId = Maybe Text
a} :: ListJobs)

-- | A filter that limits the returned jobs to those for the specified group.
listJobs_thingGroupName :: Lens.Lens' ListJobs (Prelude.Maybe Prelude.Text)
listJobs_thingGroupName :: Lens' ListJobs (Maybe Text)
listJobs_thingGroupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobs' {Maybe Text
thingGroupName :: Maybe Text
$sel:thingGroupName:ListJobs' :: ListJobs -> Maybe Text
thingGroupName} -> Maybe Text
thingGroupName) (\s :: ListJobs
s@ListJobs' {} Maybe Text
a -> ListJobs
s {$sel:thingGroupName:ListJobs' :: Maybe Text
thingGroupName = Maybe Text
a} :: ListJobs)

instance Core.AWSPager ListJobs where
  page :: ListJobs -> AWSResponse ListJobs -> Maybe ListJobs
page ListJobs
rq AWSResponse ListJobs
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListJobs
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListJobsResponse (Maybe Text)
listJobsResponse_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 ListJobs
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListJobsResponse (Maybe [JobSummary])
listJobsResponse_jobs
            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.$ ListJobs
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListJobs (Maybe Text)
listJobs_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListJobs
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListJobsResponse (Maybe Text)
listJobsResponse_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 ListJobs where
  type AWSResponse ListJobs = ListJobsResponse
  request :: (Service -> Service) -> ListJobs -> Request ListJobs
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 ListJobs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListJobs)))
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 [JobSummary] -> Maybe Text -> Int -> ListJobsResponse
ListJobsResponse'
            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
"jobs" 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 ListJobs where
  hashWithSalt :: Int -> ListJobs -> Int
hashWithSalt Int
_salt ListJobs' {Maybe Natural
Maybe Text
Maybe JobStatus
Maybe TargetSelection
thingGroupName :: Maybe Text
thingGroupId :: Maybe Text
targetSelection :: Maybe TargetSelection
status :: Maybe JobStatus
nextToken :: Maybe Text
namespaceId :: Maybe Text
maxResults :: Maybe Natural
$sel:thingGroupName:ListJobs' :: ListJobs -> Maybe Text
$sel:thingGroupId:ListJobs' :: ListJobs -> Maybe Text
$sel:targetSelection:ListJobs' :: ListJobs -> Maybe TargetSelection
$sel:status:ListJobs' :: ListJobs -> Maybe JobStatus
$sel:nextToken:ListJobs' :: ListJobs -> Maybe Text
$sel:namespaceId:ListJobs' :: ListJobs -> Maybe Text
$sel:maxResults:ListJobs' :: ListJobs -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
namespaceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe JobStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TargetSelection
targetSelection
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
thingGroupId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
thingGroupName

instance Prelude.NFData ListJobs where
  rnf :: ListJobs -> ()
rnf ListJobs' {Maybe Natural
Maybe Text
Maybe JobStatus
Maybe TargetSelection
thingGroupName :: Maybe Text
thingGroupId :: Maybe Text
targetSelection :: Maybe TargetSelection
status :: Maybe JobStatus
nextToken :: Maybe Text
namespaceId :: Maybe Text
maxResults :: Maybe Natural
$sel:thingGroupName:ListJobs' :: ListJobs -> Maybe Text
$sel:thingGroupId:ListJobs' :: ListJobs -> Maybe Text
$sel:targetSelection:ListJobs' :: ListJobs -> Maybe TargetSelection
$sel:status:ListJobs' :: ListJobs -> Maybe JobStatus
$sel:nextToken:ListJobs' :: ListJobs -> Maybe Text
$sel:namespaceId:ListJobs' :: ListJobs -> Maybe Text
$sel:maxResults:ListJobs' :: ListJobs -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
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 JobStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TargetSelection
targetSelection
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
thingGroupId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
thingGroupName

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

instance Data.ToPath ListJobs where
  toPath :: ListJobs -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/jobs"

instance Data.ToQuery ListJobs where
  toQuery :: ListJobs -> QueryString
toQuery ListJobs' {Maybe Natural
Maybe Text
Maybe JobStatus
Maybe TargetSelection
thingGroupName :: Maybe Text
thingGroupId :: Maybe Text
targetSelection :: Maybe TargetSelection
status :: Maybe JobStatus
nextToken :: Maybe Text
namespaceId :: Maybe Text
maxResults :: Maybe Natural
$sel:thingGroupName:ListJobs' :: ListJobs -> Maybe Text
$sel:thingGroupId:ListJobs' :: ListJobs -> Maybe Text
$sel:targetSelection:ListJobs' :: ListJobs -> Maybe TargetSelection
$sel:status:ListJobs' :: ListJobs -> Maybe JobStatus
$sel:nextToken:ListJobs' :: ListJobs -> Maybe Text
$sel:namespaceId:ListJobs' :: ListJobs -> Maybe Text
$sel:maxResults:ListJobs' :: ListJobs -> Maybe Natural
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ 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 JobStatus
status,
        ByteString
"targetSelection" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe TargetSelection
targetSelection,
        ByteString
"thingGroupId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
thingGroupId,
        ByteString
"thingGroupName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
thingGroupName
      ]

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

-- |
-- Create a value of 'ListJobsResponse' 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:
--
-- 'jobs', 'listJobsResponse_jobs' - A list of jobs.
--
-- 'nextToken', 'listJobsResponse_nextToken' - The token for the next set of results, or __null__ if there are no
-- additional results.
--
-- 'httpStatus', 'listJobsResponse_httpStatus' - The response's http status code.
newListJobsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListJobsResponse
newListJobsResponse :: Int -> ListJobsResponse
newListJobsResponse Int
pHttpStatus_ =
  ListJobsResponse'
    { $sel:jobs:ListJobsResponse' :: Maybe [JobSummary]
jobs = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListJobsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListJobsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of jobs.
listJobsResponse_jobs :: Lens.Lens' ListJobsResponse (Prelude.Maybe [JobSummary])
listJobsResponse_jobs :: Lens' ListJobsResponse (Maybe [JobSummary])
listJobsResponse_jobs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobsResponse' {Maybe [JobSummary]
jobs :: Maybe [JobSummary]
$sel:jobs:ListJobsResponse' :: ListJobsResponse -> Maybe [JobSummary]
jobs} -> Maybe [JobSummary]
jobs) (\s :: ListJobsResponse
s@ListJobsResponse' {} Maybe [JobSummary]
a -> ListJobsResponse
s {$sel:jobs:ListJobsResponse' :: Maybe [JobSummary]
jobs = Maybe [JobSummary]
a} :: ListJobsResponse) 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.
listJobsResponse_nextToken :: Lens.Lens' ListJobsResponse (Prelude.Maybe Prelude.Text)
listJobsResponse_nextToken :: Lens' ListJobsResponse (Maybe Text)
listJobsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListJobsResponse' :: ListJobsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListJobsResponse
s@ListJobsResponse' {} Maybe Text
a -> ListJobsResponse
s {$sel:nextToken:ListJobsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListJobsResponse)

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

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