{-# 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.AmplifyBackend.ListBackendJobs
-- 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 jobs for the backend of an Amplify app.
--
-- This operation returns paginated results.
module Amazonka.AmplifyBackend.ListBackendJobs
  ( -- * Creating a Request
    ListBackendJobs (..),
    newListBackendJobs,

    -- * Request Lenses
    listBackendJobs_status,
    listBackendJobs_jobId,
    listBackendJobs_operation,
    listBackendJobs_nextToken,
    listBackendJobs_maxResults,
    listBackendJobs_appId,
    listBackendJobs_backendEnvironmentName,

    -- * Destructuring the Response
    ListBackendJobsResponse (..),
    newListBackendJobsResponse,

    -- * Response Lenses
    listBackendJobsResponse_nextToken,
    listBackendJobsResponse_jobs,
    listBackendJobsResponse_httpStatus,
  )
where

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

-- | The request body for ListBackendJobs.
--
-- /See:/ 'newListBackendJobs' smart constructor.
data ListBackendJobs = ListBackendJobs'
  { -- | Filters the list of response objects to include only those with the
    -- specified status.
    ListBackendJobs -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The ID for the job.
    ListBackendJobs -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
    -- | Filters the list of response objects to include only those with the
    -- specified operation name.
    ListBackendJobs -> Maybe Text
operation :: Prelude.Maybe Prelude.Text,
    -- | The token for the next set of results.
    ListBackendJobs -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results that you want in the response.
    ListBackendJobs -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The app ID.
    ListBackendJobs -> Text
appId :: Prelude.Text,
    -- | The name of the backend environment.
    ListBackendJobs -> Text
backendEnvironmentName :: Prelude.Text
  }
  deriving (ListBackendJobs -> ListBackendJobs -> Bool
(ListBackendJobs -> ListBackendJobs -> Bool)
-> (ListBackendJobs -> ListBackendJobs -> Bool)
-> Eq ListBackendJobs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListBackendJobs -> ListBackendJobs -> Bool
$c/= :: ListBackendJobs -> ListBackendJobs -> Bool
== :: ListBackendJobs -> ListBackendJobs -> Bool
$c== :: ListBackendJobs -> ListBackendJobs -> Bool
Prelude.Eq, ReadPrec [ListBackendJobs]
ReadPrec ListBackendJobs
Int -> ReadS ListBackendJobs
ReadS [ListBackendJobs]
(Int -> ReadS ListBackendJobs)
-> ReadS [ListBackendJobs]
-> ReadPrec ListBackendJobs
-> ReadPrec [ListBackendJobs]
-> Read ListBackendJobs
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListBackendJobs]
$creadListPrec :: ReadPrec [ListBackendJobs]
readPrec :: ReadPrec ListBackendJobs
$creadPrec :: ReadPrec ListBackendJobs
readList :: ReadS [ListBackendJobs]
$creadList :: ReadS [ListBackendJobs]
readsPrec :: Int -> ReadS ListBackendJobs
$creadsPrec :: Int -> ReadS ListBackendJobs
Prelude.Read, Int -> ListBackendJobs -> ShowS
[ListBackendJobs] -> ShowS
ListBackendJobs -> String
(Int -> ListBackendJobs -> ShowS)
-> (ListBackendJobs -> String)
-> ([ListBackendJobs] -> ShowS)
-> Show ListBackendJobs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListBackendJobs] -> ShowS
$cshowList :: [ListBackendJobs] -> ShowS
show :: ListBackendJobs -> String
$cshow :: ListBackendJobs -> String
showsPrec :: Int -> ListBackendJobs -> ShowS
$cshowsPrec :: Int -> ListBackendJobs -> ShowS
Prelude.Show, (forall x. ListBackendJobs -> Rep ListBackendJobs x)
-> (forall x. Rep ListBackendJobs x -> ListBackendJobs)
-> Generic ListBackendJobs
forall x. Rep ListBackendJobs x -> ListBackendJobs
forall x. ListBackendJobs -> Rep ListBackendJobs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListBackendJobs x -> ListBackendJobs
$cfrom :: forall x. ListBackendJobs -> Rep ListBackendJobs x
Prelude.Generic)

-- |
-- Create a value of 'ListBackendJobs' 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', 'listBackendJobs_status' - Filters the list of response objects to include only those with the
-- specified status.
--
-- 'jobId', 'listBackendJobs_jobId' - The ID for the job.
--
-- 'operation', 'listBackendJobs_operation' - Filters the list of response objects to include only those with the
-- specified operation name.
--
-- 'nextToken', 'listBackendJobs_nextToken' - The token for the next set of results.
--
-- 'maxResults', 'listBackendJobs_maxResults' - The maximum number of results that you want in the response.
--
-- 'appId', 'listBackendJobs_appId' - The app ID.
--
-- 'backendEnvironmentName', 'listBackendJobs_backendEnvironmentName' - The name of the backend environment.
newListBackendJobs ::
  -- | 'appId'
  Prelude.Text ->
  -- | 'backendEnvironmentName'
  Prelude.Text ->
  ListBackendJobs
newListBackendJobs :: Text -> Text -> ListBackendJobs
newListBackendJobs Text
pAppId_ Text
pBackendEnvironmentName_ =
  ListBackendJobs' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Text
-> Text
-> ListBackendJobs
ListBackendJobs'
    { $sel:status:ListBackendJobs' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:jobId:ListBackendJobs' :: Maybe Text
jobId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:operation:ListBackendJobs' :: Maybe Text
operation = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListBackendJobs' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListBackendJobs' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:appId:ListBackendJobs' :: Text
appId = Text
pAppId_,
      $sel:backendEnvironmentName:ListBackendJobs' :: Text
backendEnvironmentName = Text
pBackendEnvironmentName_
    }

-- | Filters the list of response objects to include only those with the
-- specified status.
listBackendJobs_status :: Lens.Lens' ListBackendJobs (Prelude.Maybe Prelude.Text)
listBackendJobs_status :: (Maybe Text -> f (Maybe Text))
-> ListBackendJobs -> f ListBackendJobs
listBackendJobs_status = (ListBackendJobs -> Maybe Text)
-> (ListBackendJobs -> Maybe Text -> ListBackendJobs)
-> Lens ListBackendJobs ListBackendJobs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackendJobs' {Maybe Text
status :: Maybe Text
$sel:status:ListBackendJobs' :: ListBackendJobs -> Maybe Text
status} -> Maybe Text
status) (\s :: ListBackendJobs
s@ListBackendJobs' {} Maybe Text
a -> ListBackendJobs
s {$sel:status:ListBackendJobs' :: Maybe Text
status = Maybe Text
a} :: ListBackendJobs)

-- | The ID for the job.
listBackendJobs_jobId :: Lens.Lens' ListBackendJobs (Prelude.Maybe Prelude.Text)
listBackendJobs_jobId :: (Maybe Text -> f (Maybe Text))
-> ListBackendJobs -> f ListBackendJobs
listBackendJobs_jobId = (ListBackendJobs -> Maybe Text)
-> (ListBackendJobs -> Maybe Text -> ListBackendJobs)
-> Lens ListBackendJobs ListBackendJobs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackendJobs' {Maybe Text
jobId :: Maybe Text
$sel:jobId:ListBackendJobs' :: ListBackendJobs -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: ListBackendJobs
s@ListBackendJobs' {} Maybe Text
a -> ListBackendJobs
s {$sel:jobId:ListBackendJobs' :: Maybe Text
jobId = Maybe Text
a} :: ListBackendJobs)

-- | Filters the list of response objects to include only those with the
-- specified operation name.
listBackendJobs_operation :: Lens.Lens' ListBackendJobs (Prelude.Maybe Prelude.Text)
listBackendJobs_operation :: (Maybe Text -> f (Maybe Text))
-> ListBackendJobs -> f ListBackendJobs
listBackendJobs_operation = (ListBackendJobs -> Maybe Text)
-> (ListBackendJobs -> Maybe Text -> ListBackendJobs)
-> Lens ListBackendJobs ListBackendJobs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackendJobs' {Maybe Text
operation :: Maybe Text
$sel:operation:ListBackendJobs' :: ListBackendJobs -> Maybe Text
operation} -> Maybe Text
operation) (\s :: ListBackendJobs
s@ListBackendJobs' {} Maybe Text
a -> ListBackendJobs
s {$sel:operation:ListBackendJobs' :: Maybe Text
operation = Maybe Text
a} :: ListBackendJobs)

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

-- | The maximum number of results that you want in the response.
listBackendJobs_maxResults :: Lens.Lens' ListBackendJobs (Prelude.Maybe Prelude.Natural)
listBackendJobs_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListBackendJobs -> f ListBackendJobs
listBackendJobs_maxResults = (ListBackendJobs -> Maybe Natural)
-> (ListBackendJobs -> Maybe Natural -> ListBackendJobs)
-> Lens
     ListBackendJobs ListBackendJobs (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackendJobs' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListBackendJobs' :: ListBackendJobs -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListBackendJobs
s@ListBackendJobs' {} Maybe Natural
a -> ListBackendJobs
s {$sel:maxResults:ListBackendJobs' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListBackendJobs)

-- | The app ID.
listBackendJobs_appId :: Lens.Lens' ListBackendJobs Prelude.Text
listBackendJobs_appId :: (Text -> f Text) -> ListBackendJobs -> f ListBackendJobs
listBackendJobs_appId = (ListBackendJobs -> Text)
-> (ListBackendJobs -> Text -> ListBackendJobs)
-> Lens ListBackendJobs ListBackendJobs Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackendJobs' {Text
appId :: Text
$sel:appId:ListBackendJobs' :: ListBackendJobs -> Text
appId} -> Text
appId) (\s :: ListBackendJobs
s@ListBackendJobs' {} Text
a -> ListBackendJobs
s {$sel:appId:ListBackendJobs' :: Text
appId = Text
a} :: ListBackendJobs)

-- | The name of the backend environment.
listBackendJobs_backendEnvironmentName :: Lens.Lens' ListBackendJobs Prelude.Text
listBackendJobs_backendEnvironmentName :: (Text -> f Text) -> ListBackendJobs -> f ListBackendJobs
listBackendJobs_backendEnvironmentName = (ListBackendJobs -> Text)
-> (ListBackendJobs -> Text -> ListBackendJobs)
-> Lens ListBackendJobs ListBackendJobs Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackendJobs' {Text
backendEnvironmentName :: Text
$sel:backendEnvironmentName:ListBackendJobs' :: ListBackendJobs -> Text
backendEnvironmentName} -> Text
backendEnvironmentName) (\s :: ListBackendJobs
s@ListBackendJobs' {} Text
a -> ListBackendJobs
s {$sel:backendEnvironmentName:ListBackendJobs' :: Text
backendEnvironmentName = Text
a} :: ListBackendJobs)

instance Core.AWSPager ListBackendJobs where
  page :: ListBackendJobs
-> AWSResponse ListBackendJobs -> Maybe ListBackendJobs
page ListBackendJobs
rq AWSResponse ListBackendJobs
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListBackendJobs
ListBackendJobsResponse
rs
            ListBackendJobsResponse
-> Getting (First Text) ListBackendJobsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListBackendJobsResponse
-> Const (First Text) ListBackendJobsResponse
Lens' ListBackendJobsResponse (Maybe Text)
listBackendJobsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListBackendJobsResponse
 -> Const (First Text) ListBackendJobsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListBackendJobsResponse 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 ListBackendJobs
forall a. Maybe a
Prelude.Nothing
    | Maybe [BackendJobRespObj] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListBackendJobs
ListBackendJobsResponse
rs
            ListBackendJobsResponse
-> Getting
     (First [BackendJobRespObj])
     ListBackendJobsResponse
     [BackendJobRespObj]
-> Maybe [BackendJobRespObj]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [BackendJobRespObj]
 -> Const (First [BackendJobRespObj]) (Maybe [BackendJobRespObj]))
-> ListBackendJobsResponse
-> Const (First [BackendJobRespObj]) ListBackendJobsResponse
Lens' ListBackendJobsResponse (Maybe [BackendJobRespObj])
listBackendJobsResponse_jobs ((Maybe [BackendJobRespObj]
  -> Const (First [BackendJobRespObj]) (Maybe [BackendJobRespObj]))
 -> ListBackendJobsResponse
 -> Const (First [BackendJobRespObj]) ListBackendJobsResponse)
-> (([BackendJobRespObj]
     -> Const (First [BackendJobRespObj]) [BackendJobRespObj])
    -> Maybe [BackendJobRespObj]
    -> Const (First [BackendJobRespObj]) (Maybe [BackendJobRespObj]))
-> Getting
     (First [BackendJobRespObj])
     ListBackendJobsResponse
     [BackendJobRespObj]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([BackendJobRespObj]
 -> Const (First [BackendJobRespObj]) [BackendJobRespObj])
-> Maybe [BackendJobRespObj]
-> Const (First [BackendJobRespObj]) (Maybe [BackendJobRespObj])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListBackendJobs
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListBackendJobs -> Maybe ListBackendJobs
forall a. a -> Maybe a
Prelude.Just (ListBackendJobs -> Maybe ListBackendJobs)
-> ListBackendJobs -> Maybe ListBackendJobs
forall a b. (a -> b) -> a -> b
Prelude.$
        ListBackendJobs
rq
          ListBackendJobs
-> (ListBackendJobs -> ListBackendJobs) -> ListBackendJobs
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListBackendJobs -> Identity ListBackendJobs
Lens ListBackendJobs ListBackendJobs (Maybe Text) (Maybe Text)
listBackendJobs_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListBackendJobs -> Identity ListBackendJobs)
-> Maybe Text -> ListBackendJobs -> ListBackendJobs
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListBackendJobs
ListBackendJobsResponse
rs
          ListBackendJobsResponse
-> Getting (First Text) ListBackendJobsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListBackendJobsResponse
-> Const (First Text) ListBackendJobsResponse
Lens' ListBackendJobsResponse (Maybe Text)
listBackendJobsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListBackendJobsResponse
 -> Const (First Text) ListBackendJobsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListBackendJobsResponse 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 ListBackendJobs where
  type
    AWSResponse ListBackendJobs =
      ListBackendJobsResponse
  request :: ListBackendJobs -> Request ListBackendJobs
request = Service -> ListBackendJobs -> Request ListBackendJobs
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListBackendJobs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListBackendJobs)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListBackendJobs))
-> Logger
-> Service
-> Proxy ListBackendJobs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListBackendJobs)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe [BackendJobRespObj] -> Int -> ListBackendJobsResponse
ListBackendJobsResponse'
            (Maybe Text
 -> Maybe [BackendJobRespObj] -> Int -> ListBackendJobsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [BackendJobRespObj] -> Int -> ListBackendJobsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
            Either
  String
  (Maybe [BackendJobRespObj] -> Int -> ListBackendJobsResponse)
-> Either String (Maybe [BackendJobRespObj])
-> Either String (Int -> ListBackendJobsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [BackendJobRespObj]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"jobs" Either String (Maybe (Maybe [BackendJobRespObj]))
-> Maybe [BackendJobRespObj]
-> Either String (Maybe [BackendJobRespObj])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [BackendJobRespObj]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> ListBackendJobsResponse)
-> Either String Int -> Either String ListBackendJobsResponse
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 ListBackendJobs

instance Prelude.NFData ListBackendJobs

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

instance Core.ToJSON ListBackendJobs where
  toJSON :: ListBackendJobs -> Value
toJSON ListBackendJobs' {Maybe Natural
Maybe Text
Text
backendEnvironmentName :: Text
appId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
operation :: Maybe Text
jobId :: Maybe Text
status :: Maybe Text
$sel:backendEnvironmentName:ListBackendJobs' :: ListBackendJobs -> Text
$sel:appId:ListBackendJobs' :: ListBackendJobs -> Text
$sel:maxResults:ListBackendJobs' :: ListBackendJobs -> Maybe Natural
$sel:nextToken:ListBackendJobs' :: ListBackendJobs -> Maybe Text
$sel:operation:ListBackendJobs' :: ListBackendJobs -> Maybe Text
$sel:jobId:ListBackendJobs' :: ListBackendJobs -> Maybe Text
$sel:status:ListBackendJobs' :: ListBackendJobs -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"status" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
status,
            (Text
"jobId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
jobId,
            (Text
"operation" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
operation,
            (Text
"nextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"maxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
          ]
      )

instance Core.ToPath ListBackendJobs where
  toPath :: ListBackendJobs -> ByteString
toPath ListBackendJobs' {Maybe Natural
Maybe Text
Text
backendEnvironmentName :: Text
appId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
operation :: Maybe Text
jobId :: Maybe Text
status :: Maybe Text
$sel:backendEnvironmentName:ListBackendJobs' :: ListBackendJobs -> Text
$sel:appId:ListBackendJobs' :: ListBackendJobs -> Text
$sel:maxResults:ListBackendJobs' :: ListBackendJobs -> Maybe Natural
$sel:nextToken:ListBackendJobs' :: ListBackendJobs -> Maybe Text
$sel:operation:ListBackendJobs' :: ListBackendJobs -> Maybe Text
$sel:jobId:ListBackendJobs' :: ListBackendJobs -> Maybe Text
$sel:status:ListBackendJobs' :: ListBackendJobs -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/backend/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
appId,
        ByteString
"/job/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
backendEnvironmentName
      ]

instance Core.ToQuery ListBackendJobs where
  toQuery :: ListBackendJobs -> QueryString
toQuery = QueryString -> ListBackendJobs -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newListBackendJobsResponse' smart constructor.
data ListBackendJobsResponse = ListBackendJobsResponse'
  { -- | The token for the next set of results.
    ListBackendJobsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | An array of jobs and their properties.
    ListBackendJobsResponse -> Maybe [BackendJobRespObj]
jobs :: Prelude.Maybe [BackendJobRespObj],
    -- | The response's http status code.
    ListBackendJobsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListBackendJobsResponse -> ListBackendJobsResponse -> Bool
(ListBackendJobsResponse -> ListBackendJobsResponse -> Bool)
-> (ListBackendJobsResponse -> ListBackendJobsResponse -> Bool)
-> Eq ListBackendJobsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListBackendJobsResponse -> ListBackendJobsResponse -> Bool
$c/= :: ListBackendJobsResponse -> ListBackendJobsResponse -> Bool
== :: ListBackendJobsResponse -> ListBackendJobsResponse -> Bool
$c== :: ListBackendJobsResponse -> ListBackendJobsResponse -> Bool
Prelude.Eq, ReadPrec [ListBackendJobsResponse]
ReadPrec ListBackendJobsResponse
Int -> ReadS ListBackendJobsResponse
ReadS [ListBackendJobsResponse]
(Int -> ReadS ListBackendJobsResponse)
-> ReadS [ListBackendJobsResponse]
-> ReadPrec ListBackendJobsResponse
-> ReadPrec [ListBackendJobsResponse]
-> Read ListBackendJobsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListBackendJobsResponse]
$creadListPrec :: ReadPrec [ListBackendJobsResponse]
readPrec :: ReadPrec ListBackendJobsResponse
$creadPrec :: ReadPrec ListBackendJobsResponse
readList :: ReadS [ListBackendJobsResponse]
$creadList :: ReadS [ListBackendJobsResponse]
readsPrec :: Int -> ReadS ListBackendJobsResponse
$creadsPrec :: Int -> ReadS ListBackendJobsResponse
Prelude.Read, Int -> ListBackendJobsResponse -> ShowS
[ListBackendJobsResponse] -> ShowS
ListBackendJobsResponse -> String
(Int -> ListBackendJobsResponse -> ShowS)
-> (ListBackendJobsResponse -> String)
-> ([ListBackendJobsResponse] -> ShowS)
-> Show ListBackendJobsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListBackendJobsResponse] -> ShowS
$cshowList :: [ListBackendJobsResponse] -> ShowS
show :: ListBackendJobsResponse -> String
$cshow :: ListBackendJobsResponse -> String
showsPrec :: Int -> ListBackendJobsResponse -> ShowS
$cshowsPrec :: Int -> ListBackendJobsResponse -> ShowS
Prelude.Show, (forall x.
 ListBackendJobsResponse -> Rep ListBackendJobsResponse x)
-> (forall x.
    Rep ListBackendJobsResponse x -> ListBackendJobsResponse)
-> Generic ListBackendJobsResponse
forall x. Rep ListBackendJobsResponse x -> ListBackendJobsResponse
forall x. ListBackendJobsResponse -> Rep ListBackendJobsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListBackendJobsResponse x -> ListBackendJobsResponse
$cfrom :: forall x. ListBackendJobsResponse -> Rep ListBackendJobsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListBackendJobsResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nextToken', 'listBackendJobsResponse_nextToken' - The token for the next set of results.
--
-- 'jobs', 'listBackendJobsResponse_jobs' - An array of jobs and their properties.
--
-- 'httpStatus', 'listBackendJobsResponse_httpStatus' - The response's http status code.
newListBackendJobsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListBackendJobsResponse
newListBackendJobsResponse :: Int -> ListBackendJobsResponse
newListBackendJobsResponse Int
pHttpStatus_ =
  ListBackendJobsResponse' :: Maybe Text
-> Maybe [BackendJobRespObj] -> Int -> ListBackendJobsResponse
ListBackendJobsResponse'
    { $sel:nextToken:ListBackendJobsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:jobs:ListBackendJobsResponse' :: Maybe [BackendJobRespObj]
jobs = Maybe [BackendJobRespObj]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListBackendJobsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | An array of jobs and their properties.
listBackendJobsResponse_jobs :: Lens.Lens' ListBackendJobsResponse (Prelude.Maybe [BackendJobRespObj])
listBackendJobsResponse_jobs :: (Maybe [BackendJobRespObj] -> f (Maybe [BackendJobRespObj]))
-> ListBackendJobsResponse -> f ListBackendJobsResponse
listBackendJobsResponse_jobs = (ListBackendJobsResponse -> Maybe [BackendJobRespObj])
-> (ListBackendJobsResponse
    -> Maybe [BackendJobRespObj] -> ListBackendJobsResponse)
-> Lens' ListBackendJobsResponse (Maybe [BackendJobRespObj])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackendJobsResponse' {Maybe [BackendJobRespObj]
jobs :: Maybe [BackendJobRespObj]
$sel:jobs:ListBackendJobsResponse' :: ListBackendJobsResponse -> Maybe [BackendJobRespObj]
jobs} -> Maybe [BackendJobRespObj]
jobs) (\s :: ListBackendJobsResponse
s@ListBackendJobsResponse' {} Maybe [BackendJobRespObj]
a -> ListBackendJobsResponse
s {$sel:jobs:ListBackendJobsResponse' :: Maybe [BackendJobRespObj]
jobs = Maybe [BackendJobRespObj]
a} :: ListBackendJobsResponse) ((Maybe [BackendJobRespObj] -> f (Maybe [BackendJobRespObj]))
 -> ListBackendJobsResponse -> f ListBackendJobsResponse)
-> ((Maybe [BackendJobRespObj] -> f (Maybe [BackendJobRespObj]))
    -> Maybe [BackendJobRespObj] -> f (Maybe [BackendJobRespObj]))
-> (Maybe [BackendJobRespObj] -> f (Maybe [BackendJobRespObj]))
-> ListBackendJobsResponse
-> f ListBackendJobsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [BackendJobRespObj]
  [BackendJobRespObj]
  [BackendJobRespObj]
  [BackendJobRespObj]
-> Iso
     (Maybe [BackendJobRespObj])
     (Maybe [BackendJobRespObj])
     (Maybe [BackendJobRespObj])
     (Maybe [BackendJobRespObj])
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
  [BackendJobRespObj]
  [BackendJobRespObj]
  [BackendJobRespObj]
  [BackendJobRespObj]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListBackendJobsResponse