{-# 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.Batch.DescribeJobDefinitions
-- 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)
--
-- Describes a list of job definitions. You can specify a @status@ (such as
-- @ACTIVE@) to only return job definitions that match that status.
--
-- This operation returns paginated results.
module Amazonka.Batch.DescribeJobDefinitions
  ( -- * Creating a Request
    DescribeJobDefinitions (..),
    newDescribeJobDefinitions,

    -- * Request Lenses
    describeJobDefinitions_status,
    describeJobDefinitions_jobDefinitionName,
    describeJobDefinitions_jobDefinitions,
    describeJobDefinitions_nextToken,
    describeJobDefinitions_maxResults,

    -- * Destructuring the Response
    DescribeJobDefinitionsResponse (..),
    newDescribeJobDefinitionsResponse,

    -- * Response Lenses
    describeJobDefinitionsResponse_jobDefinitions,
    describeJobDefinitionsResponse_nextToken,
    describeJobDefinitionsResponse_httpStatus,
  )
where

import Amazonka.Batch.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

-- | Contains the parameters for @DescribeJobDefinitions@.
--
-- /See:/ 'newDescribeJobDefinitions' smart constructor.
data DescribeJobDefinitions = DescribeJobDefinitions'
  { -- | The status used to filter job definitions.
    DescribeJobDefinitions -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The name of the job definition to describe.
    DescribeJobDefinitions -> Maybe Text
jobDefinitionName :: Prelude.Maybe Prelude.Text,
    -- | A list of up to 100 job definitions. Each entry in the list can either
    -- be an ARN of the form
    -- @arn:aws:batch:${Region}:${Account}:job-definition\/${JobDefinitionName}:${Revision}@
    -- or a short version using the form @${JobDefinitionName}:${Revision}@.
    DescribeJobDefinitions -> Maybe [Text]
jobDefinitions :: Prelude.Maybe [Prelude.Text],
    -- | The @nextToken@ value returned from a previous paginated
    -- @DescribeJobDefinitions@ request where @maxResults@ was used and the
    -- results exceeded the value of that parameter. Pagination continues from
    -- the end of the previous results that returned the @nextToken@ value.
    -- This value is @null@ when there are no more results to return.
    --
    -- This token should be treated as an opaque identifier that\'s only used
    -- to retrieve the next items in a list and not for other programmatic
    -- purposes.
    DescribeJobDefinitions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results returned by @DescribeJobDefinitions@ in
    -- paginated output. When this parameter is used, @DescribeJobDefinitions@
    -- only returns @maxResults@ results in a single page and a @nextToken@
    -- response element. The remaining results of the initial request can be
    -- seen by sending another @DescribeJobDefinitions@ request with the
    -- returned @nextToken@ value. This value can be between 1 and 100. If this
    -- parameter isn\'t used, then @DescribeJobDefinitions@ returns up to 100
    -- results and a @nextToken@ value if applicable.
    DescribeJobDefinitions -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int
  }
  deriving (DescribeJobDefinitions -> DescribeJobDefinitions -> Bool
(DescribeJobDefinitions -> DescribeJobDefinitions -> Bool)
-> (DescribeJobDefinitions -> DescribeJobDefinitions -> Bool)
-> Eq DescribeJobDefinitions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeJobDefinitions -> DescribeJobDefinitions -> Bool
$c/= :: DescribeJobDefinitions -> DescribeJobDefinitions -> Bool
== :: DescribeJobDefinitions -> DescribeJobDefinitions -> Bool
$c== :: DescribeJobDefinitions -> DescribeJobDefinitions -> Bool
Prelude.Eq, ReadPrec [DescribeJobDefinitions]
ReadPrec DescribeJobDefinitions
Int -> ReadS DescribeJobDefinitions
ReadS [DescribeJobDefinitions]
(Int -> ReadS DescribeJobDefinitions)
-> ReadS [DescribeJobDefinitions]
-> ReadPrec DescribeJobDefinitions
-> ReadPrec [DescribeJobDefinitions]
-> Read DescribeJobDefinitions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeJobDefinitions]
$creadListPrec :: ReadPrec [DescribeJobDefinitions]
readPrec :: ReadPrec DescribeJobDefinitions
$creadPrec :: ReadPrec DescribeJobDefinitions
readList :: ReadS [DescribeJobDefinitions]
$creadList :: ReadS [DescribeJobDefinitions]
readsPrec :: Int -> ReadS DescribeJobDefinitions
$creadsPrec :: Int -> ReadS DescribeJobDefinitions
Prelude.Read, Int -> DescribeJobDefinitions -> ShowS
[DescribeJobDefinitions] -> ShowS
DescribeJobDefinitions -> String
(Int -> DescribeJobDefinitions -> ShowS)
-> (DescribeJobDefinitions -> String)
-> ([DescribeJobDefinitions] -> ShowS)
-> Show DescribeJobDefinitions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeJobDefinitions] -> ShowS
$cshowList :: [DescribeJobDefinitions] -> ShowS
show :: DescribeJobDefinitions -> String
$cshow :: DescribeJobDefinitions -> String
showsPrec :: Int -> DescribeJobDefinitions -> ShowS
$cshowsPrec :: Int -> DescribeJobDefinitions -> ShowS
Prelude.Show, (forall x. DescribeJobDefinitions -> Rep DescribeJobDefinitions x)
-> (forall x.
    Rep DescribeJobDefinitions x -> DescribeJobDefinitions)
-> Generic DescribeJobDefinitions
forall x. Rep DescribeJobDefinitions x -> DescribeJobDefinitions
forall x. DescribeJobDefinitions -> Rep DescribeJobDefinitions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeJobDefinitions x -> DescribeJobDefinitions
$cfrom :: forall x. DescribeJobDefinitions -> Rep DescribeJobDefinitions x
Prelude.Generic)

-- |
-- Create a value of 'DescribeJobDefinitions' 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', 'describeJobDefinitions_status' - The status used to filter job definitions.
--
-- 'jobDefinitionName', 'describeJobDefinitions_jobDefinitionName' - The name of the job definition to describe.
--
-- 'jobDefinitions', 'describeJobDefinitions_jobDefinitions' - A list of up to 100 job definitions. Each entry in the list can either
-- be an ARN of the form
-- @arn:aws:batch:${Region}:${Account}:job-definition\/${JobDefinitionName}:${Revision}@
-- or a short version using the form @${JobDefinitionName}:${Revision}@.
--
-- 'nextToken', 'describeJobDefinitions_nextToken' - The @nextToken@ value returned from a previous paginated
-- @DescribeJobDefinitions@ request where @maxResults@ was used and the
-- results exceeded the value of that parameter. Pagination continues from
-- the end of the previous results that returned the @nextToken@ value.
-- This value is @null@ when there are no more results to return.
--
-- This token should be treated as an opaque identifier that\'s only used
-- to retrieve the next items in a list and not for other programmatic
-- purposes.
--
-- 'maxResults', 'describeJobDefinitions_maxResults' - The maximum number of results returned by @DescribeJobDefinitions@ in
-- paginated output. When this parameter is used, @DescribeJobDefinitions@
-- only returns @maxResults@ results in a single page and a @nextToken@
-- response element. The remaining results of the initial request can be
-- seen by sending another @DescribeJobDefinitions@ request with the
-- returned @nextToken@ value. This value can be between 1 and 100. If this
-- parameter isn\'t used, then @DescribeJobDefinitions@ returns up to 100
-- results and a @nextToken@ value if applicable.
newDescribeJobDefinitions ::
  DescribeJobDefinitions
newDescribeJobDefinitions :: DescribeJobDefinitions
newDescribeJobDefinitions =
  DescribeJobDefinitions' :: Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe Int
-> DescribeJobDefinitions
DescribeJobDefinitions'
    { $sel:status:DescribeJobDefinitions' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:jobDefinitionName:DescribeJobDefinitions' :: Maybe Text
jobDefinitionName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:jobDefinitions:DescribeJobDefinitions' :: Maybe [Text]
jobDefinitions = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeJobDefinitions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeJobDefinitions' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The status used to filter job definitions.
describeJobDefinitions_status :: Lens.Lens' DescribeJobDefinitions (Prelude.Maybe Prelude.Text)
describeJobDefinitions_status :: (Maybe Text -> f (Maybe Text))
-> DescribeJobDefinitions -> f DescribeJobDefinitions
describeJobDefinitions_status = (DescribeJobDefinitions -> Maybe Text)
-> (DescribeJobDefinitions -> Maybe Text -> DescribeJobDefinitions)
-> Lens
     DescribeJobDefinitions
     DescribeJobDefinitions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJobDefinitions' {Maybe Text
status :: Maybe Text
$sel:status:DescribeJobDefinitions' :: DescribeJobDefinitions -> Maybe Text
status} -> Maybe Text
status) (\s :: DescribeJobDefinitions
s@DescribeJobDefinitions' {} Maybe Text
a -> DescribeJobDefinitions
s {$sel:status:DescribeJobDefinitions' :: Maybe Text
status = Maybe Text
a} :: DescribeJobDefinitions)

-- | The name of the job definition to describe.
describeJobDefinitions_jobDefinitionName :: Lens.Lens' DescribeJobDefinitions (Prelude.Maybe Prelude.Text)
describeJobDefinitions_jobDefinitionName :: (Maybe Text -> f (Maybe Text))
-> DescribeJobDefinitions -> f DescribeJobDefinitions
describeJobDefinitions_jobDefinitionName = (DescribeJobDefinitions -> Maybe Text)
-> (DescribeJobDefinitions -> Maybe Text -> DescribeJobDefinitions)
-> Lens
     DescribeJobDefinitions
     DescribeJobDefinitions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJobDefinitions' {Maybe Text
jobDefinitionName :: Maybe Text
$sel:jobDefinitionName:DescribeJobDefinitions' :: DescribeJobDefinitions -> Maybe Text
jobDefinitionName} -> Maybe Text
jobDefinitionName) (\s :: DescribeJobDefinitions
s@DescribeJobDefinitions' {} Maybe Text
a -> DescribeJobDefinitions
s {$sel:jobDefinitionName:DescribeJobDefinitions' :: Maybe Text
jobDefinitionName = Maybe Text
a} :: DescribeJobDefinitions)

-- | A list of up to 100 job definitions. Each entry in the list can either
-- be an ARN of the form
-- @arn:aws:batch:${Region}:${Account}:job-definition\/${JobDefinitionName}:${Revision}@
-- or a short version using the form @${JobDefinitionName}:${Revision}@.
describeJobDefinitions_jobDefinitions :: Lens.Lens' DescribeJobDefinitions (Prelude.Maybe [Prelude.Text])
describeJobDefinitions_jobDefinitions :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeJobDefinitions -> f DescribeJobDefinitions
describeJobDefinitions_jobDefinitions = (DescribeJobDefinitions -> Maybe [Text])
-> (DescribeJobDefinitions
    -> Maybe [Text] -> DescribeJobDefinitions)
-> Lens
     DescribeJobDefinitions
     DescribeJobDefinitions
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJobDefinitions' {Maybe [Text]
jobDefinitions :: Maybe [Text]
$sel:jobDefinitions:DescribeJobDefinitions' :: DescribeJobDefinitions -> Maybe [Text]
jobDefinitions} -> Maybe [Text]
jobDefinitions) (\s :: DescribeJobDefinitions
s@DescribeJobDefinitions' {} Maybe [Text]
a -> DescribeJobDefinitions
s {$sel:jobDefinitions:DescribeJobDefinitions' :: Maybe [Text]
jobDefinitions = Maybe [Text]
a} :: DescribeJobDefinitions) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeJobDefinitions -> f DescribeJobDefinitions)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeJobDefinitions
-> f DescribeJobDefinitions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The @nextToken@ value returned from a previous paginated
-- @DescribeJobDefinitions@ request where @maxResults@ was used and the
-- results exceeded the value of that parameter. Pagination continues from
-- the end of the previous results that returned the @nextToken@ value.
-- This value is @null@ when there are no more results to return.
--
-- This token should be treated as an opaque identifier that\'s only used
-- to retrieve the next items in a list and not for other programmatic
-- purposes.
describeJobDefinitions_nextToken :: Lens.Lens' DescribeJobDefinitions (Prelude.Maybe Prelude.Text)
describeJobDefinitions_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeJobDefinitions -> f DescribeJobDefinitions
describeJobDefinitions_nextToken = (DescribeJobDefinitions -> Maybe Text)
-> (DescribeJobDefinitions -> Maybe Text -> DescribeJobDefinitions)
-> Lens
     DescribeJobDefinitions
     DescribeJobDefinitions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJobDefinitions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeJobDefinitions' :: DescribeJobDefinitions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeJobDefinitions
s@DescribeJobDefinitions' {} Maybe Text
a -> DescribeJobDefinitions
s {$sel:nextToken:DescribeJobDefinitions' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeJobDefinitions)

-- | The maximum number of results returned by @DescribeJobDefinitions@ in
-- paginated output. When this parameter is used, @DescribeJobDefinitions@
-- only returns @maxResults@ results in a single page and a @nextToken@
-- response element. The remaining results of the initial request can be
-- seen by sending another @DescribeJobDefinitions@ request with the
-- returned @nextToken@ value. This value can be between 1 and 100. If this
-- parameter isn\'t used, then @DescribeJobDefinitions@ returns up to 100
-- results and a @nextToken@ value if applicable.
describeJobDefinitions_maxResults :: Lens.Lens' DescribeJobDefinitions (Prelude.Maybe Prelude.Int)
describeJobDefinitions_maxResults :: (Maybe Int -> f (Maybe Int))
-> DescribeJobDefinitions -> f DescribeJobDefinitions
describeJobDefinitions_maxResults = (DescribeJobDefinitions -> Maybe Int)
-> (DescribeJobDefinitions -> Maybe Int -> DescribeJobDefinitions)
-> Lens
     DescribeJobDefinitions
     DescribeJobDefinitions
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJobDefinitions' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:DescribeJobDefinitions' :: DescribeJobDefinitions -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: DescribeJobDefinitions
s@DescribeJobDefinitions' {} Maybe Int
a -> DescribeJobDefinitions
s {$sel:maxResults:DescribeJobDefinitions' :: Maybe Int
maxResults = Maybe Int
a} :: DescribeJobDefinitions)

instance Core.AWSPager DescribeJobDefinitions where
  page :: DescribeJobDefinitions
-> AWSResponse DescribeJobDefinitions
-> Maybe DescribeJobDefinitions
page DescribeJobDefinitions
rq AWSResponse DescribeJobDefinitions
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeJobDefinitions
DescribeJobDefinitionsResponse
rs
            DescribeJobDefinitionsResponse
-> Getting (First Text) DescribeJobDefinitionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeJobDefinitionsResponse
-> Const (First Text) DescribeJobDefinitionsResponse
Lens' DescribeJobDefinitionsResponse (Maybe Text)
describeJobDefinitionsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeJobDefinitionsResponse
 -> Const (First Text) DescribeJobDefinitionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeJobDefinitionsResponse 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 DescribeJobDefinitions
forall a. Maybe a
Prelude.Nothing
    | Maybe [JobDefinition] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeJobDefinitions
DescribeJobDefinitionsResponse
rs
            DescribeJobDefinitionsResponse
-> Getting
     (First [JobDefinition])
     DescribeJobDefinitionsResponse
     [JobDefinition]
-> Maybe [JobDefinition]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [JobDefinition]
 -> Const (First [JobDefinition]) (Maybe [JobDefinition]))
-> DescribeJobDefinitionsResponse
-> Const (First [JobDefinition]) DescribeJobDefinitionsResponse
Lens' DescribeJobDefinitionsResponse (Maybe [JobDefinition])
describeJobDefinitionsResponse_jobDefinitions
              ((Maybe [JobDefinition]
  -> Const (First [JobDefinition]) (Maybe [JobDefinition]))
 -> DescribeJobDefinitionsResponse
 -> Const (First [JobDefinition]) DescribeJobDefinitionsResponse)
-> (([JobDefinition]
     -> Const (First [JobDefinition]) [JobDefinition])
    -> Maybe [JobDefinition]
    -> Const (First [JobDefinition]) (Maybe [JobDefinition]))
-> Getting
     (First [JobDefinition])
     DescribeJobDefinitionsResponse
     [JobDefinition]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([JobDefinition] -> Const (First [JobDefinition]) [JobDefinition])
-> Maybe [JobDefinition]
-> Const (First [JobDefinition]) (Maybe [JobDefinition])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeJobDefinitions
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeJobDefinitions -> Maybe DescribeJobDefinitions
forall a. a -> Maybe a
Prelude.Just (DescribeJobDefinitions -> Maybe DescribeJobDefinitions)
-> DescribeJobDefinitions -> Maybe DescribeJobDefinitions
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeJobDefinitions
rq
          DescribeJobDefinitions
-> (DescribeJobDefinitions -> DescribeJobDefinitions)
-> DescribeJobDefinitions
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeJobDefinitions -> Identity DescribeJobDefinitions
Lens
  DescribeJobDefinitions
  DescribeJobDefinitions
  (Maybe Text)
  (Maybe Text)
describeJobDefinitions_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeJobDefinitions -> Identity DescribeJobDefinitions)
-> Maybe Text -> DescribeJobDefinitions -> DescribeJobDefinitions
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeJobDefinitions
DescribeJobDefinitionsResponse
rs
          DescribeJobDefinitionsResponse
-> Getting (First Text) DescribeJobDefinitionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeJobDefinitionsResponse
-> Const (First Text) DescribeJobDefinitionsResponse
Lens' DescribeJobDefinitionsResponse (Maybe Text)
describeJobDefinitionsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeJobDefinitionsResponse
 -> Const (First Text) DescribeJobDefinitionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeJobDefinitionsResponse 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 DescribeJobDefinitions where
  type
    AWSResponse DescribeJobDefinitions =
      DescribeJobDefinitionsResponse
  request :: DescribeJobDefinitions -> Request DescribeJobDefinitions
request = Service -> DescribeJobDefinitions -> Request DescribeJobDefinitions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeJobDefinitions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeJobDefinitions)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeJobDefinitions))
-> Logger
-> Service
-> Proxy DescribeJobDefinitions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeJobDefinitions)))
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 [JobDefinition]
-> Maybe Text -> Int -> DescribeJobDefinitionsResponse
DescribeJobDefinitionsResponse'
            (Maybe [JobDefinition]
 -> Maybe Text -> Int -> DescribeJobDefinitionsResponse)
-> Either String (Maybe [JobDefinition])
-> Either
     String (Maybe Text -> Int -> DescribeJobDefinitionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [JobDefinition]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"jobDefinitions" Either String (Maybe (Maybe [JobDefinition]))
-> Maybe [JobDefinition] -> Either String (Maybe [JobDefinition])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [JobDefinition]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> DescribeJobDefinitionsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeJobDefinitionsResponse)
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 -> DescribeJobDefinitionsResponse)
-> Either String Int
-> Either String DescribeJobDefinitionsResponse
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 DescribeJobDefinitions

instance Prelude.NFData DescribeJobDefinitions

instance Core.ToHeaders DescribeJobDefinitions where
  toHeaders :: DescribeJobDefinitions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeJobDefinitions -> 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 DescribeJobDefinitions where
  toJSON :: DescribeJobDefinitions -> Value
toJSON DescribeJobDefinitions' {Maybe Int
Maybe [Text]
Maybe Text
maxResults :: Maybe Int
nextToken :: Maybe Text
jobDefinitions :: Maybe [Text]
jobDefinitionName :: Maybe Text
status :: Maybe Text
$sel:maxResults:DescribeJobDefinitions' :: DescribeJobDefinitions -> Maybe Int
$sel:nextToken:DescribeJobDefinitions' :: DescribeJobDefinitions -> Maybe Text
$sel:jobDefinitions:DescribeJobDefinitions' :: DescribeJobDefinitions -> Maybe [Text]
$sel:jobDefinitionName:DescribeJobDefinitions' :: DescribeJobDefinitions -> Maybe Text
$sel:status:DescribeJobDefinitions' :: DescribeJobDefinitions -> 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
"jobDefinitionName" 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
jobDefinitionName,
            (Text
"jobDefinitions" 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]
jobDefinitions,
            (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 -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults
          ]
      )

instance Core.ToPath DescribeJobDefinitions where
  toPath :: DescribeJobDefinitions -> ByteString
toPath = ByteString -> DescribeJobDefinitions -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v1/describejobdefinitions"

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

-- | /See:/ 'newDescribeJobDefinitionsResponse' smart constructor.
data DescribeJobDefinitionsResponse = DescribeJobDefinitionsResponse'
  { -- | The list of job definitions.
    DescribeJobDefinitionsResponse -> Maybe [JobDefinition]
jobDefinitions :: Prelude.Maybe [JobDefinition],
    -- | The @nextToken@ value to include in a future @DescribeJobDefinitions@
    -- request. When the results of a @DescribeJobDefinitions@ request exceed
    -- @maxResults@, this value can be used to retrieve the next page of
    -- results. This value is @null@ when there are no more results to return.
    DescribeJobDefinitionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeJobDefinitionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeJobDefinitionsResponse
-> DescribeJobDefinitionsResponse -> Bool
(DescribeJobDefinitionsResponse
 -> DescribeJobDefinitionsResponse -> Bool)
-> (DescribeJobDefinitionsResponse
    -> DescribeJobDefinitionsResponse -> Bool)
-> Eq DescribeJobDefinitionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeJobDefinitionsResponse
-> DescribeJobDefinitionsResponse -> Bool
$c/= :: DescribeJobDefinitionsResponse
-> DescribeJobDefinitionsResponse -> Bool
== :: DescribeJobDefinitionsResponse
-> DescribeJobDefinitionsResponse -> Bool
$c== :: DescribeJobDefinitionsResponse
-> DescribeJobDefinitionsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeJobDefinitionsResponse]
ReadPrec DescribeJobDefinitionsResponse
Int -> ReadS DescribeJobDefinitionsResponse
ReadS [DescribeJobDefinitionsResponse]
(Int -> ReadS DescribeJobDefinitionsResponse)
-> ReadS [DescribeJobDefinitionsResponse]
-> ReadPrec DescribeJobDefinitionsResponse
-> ReadPrec [DescribeJobDefinitionsResponse]
-> Read DescribeJobDefinitionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeJobDefinitionsResponse]
$creadListPrec :: ReadPrec [DescribeJobDefinitionsResponse]
readPrec :: ReadPrec DescribeJobDefinitionsResponse
$creadPrec :: ReadPrec DescribeJobDefinitionsResponse
readList :: ReadS [DescribeJobDefinitionsResponse]
$creadList :: ReadS [DescribeJobDefinitionsResponse]
readsPrec :: Int -> ReadS DescribeJobDefinitionsResponse
$creadsPrec :: Int -> ReadS DescribeJobDefinitionsResponse
Prelude.Read, Int -> DescribeJobDefinitionsResponse -> ShowS
[DescribeJobDefinitionsResponse] -> ShowS
DescribeJobDefinitionsResponse -> String
(Int -> DescribeJobDefinitionsResponse -> ShowS)
-> (DescribeJobDefinitionsResponse -> String)
-> ([DescribeJobDefinitionsResponse] -> ShowS)
-> Show DescribeJobDefinitionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeJobDefinitionsResponse] -> ShowS
$cshowList :: [DescribeJobDefinitionsResponse] -> ShowS
show :: DescribeJobDefinitionsResponse -> String
$cshow :: DescribeJobDefinitionsResponse -> String
showsPrec :: Int -> DescribeJobDefinitionsResponse -> ShowS
$cshowsPrec :: Int -> DescribeJobDefinitionsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeJobDefinitionsResponse
 -> Rep DescribeJobDefinitionsResponse x)
-> (forall x.
    Rep DescribeJobDefinitionsResponse x
    -> DescribeJobDefinitionsResponse)
-> Generic DescribeJobDefinitionsResponse
forall x.
Rep DescribeJobDefinitionsResponse x
-> DescribeJobDefinitionsResponse
forall x.
DescribeJobDefinitionsResponse
-> Rep DescribeJobDefinitionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeJobDefinitionsResponse x
-> DescribeJobDefinitionsResponse
$cfrom :: forall x.
DescribeJobDefinitionsResponse
-> Rep DescribeJobDefinitionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeJobDefinitionsResponse' 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:
--
-- 'jobDefinitions', 'describeJobDefinitionsResponse_jobDefinitions' - The list of job definitions.
--
-- 'nextToken', 'describeJobDefinitionsResponse_nextToken' - The @nextToken@ value to include in a future @DescribeJobDefinitions@
-- request. When the results of a @DescribeJobDefinitions@ request exceed
-- @maxResults@, this value can be used to retrieve the next page of
-- results. This value is @null@ when there are no more results to return.
--
-- 'httpStatus', 'describeJobDefinitionsResponse_httpStatus' - The response's http status code.
newDescribeJobDefinitionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeJobDefinitionsResponse
newDescribeJobDefinitionsResponse :: Int -> DescribeJobDefinitionsResponse
newDescribeJobDefinitionsResponse Int
pHttpStatus_ =
  DescribeJobDefinitionsResponse' :: Maybe [JobDefinition]
-> Maybe Text -> Int -> DescribeJobDefinitionsResponse
DescribeJobDefinitionsResponse'
    { $sel:jobDefinitions:DescribeJobDefinitionsResponse' :: Maybe [JobDefinition]
jobDefinitions =
        Maybe [JobDefinition]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeJobDefinitionsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeJobDefinitionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The list of job definitions.
describeJobDefinitionsResponse_jobDefinitions :: Lens.Lens' DescribeJobDefinitionsResponse (Prelude.Maybe [JobDefinition])
describeJobDefinitionsResponse_jobDefinitions :: (Maybe [JobDefinition] -> f (Maybe [JobDefinition]))
-> DescribeJobDefinitionsResponse
-> f DescribeJobDefinitionsResponse
describeJobDefinitionsResponse_jobDefinitions = (DescribeJobDefinitionsResponse -> Maybe [JobDefinition])
-> (DescribeJobDefinitionsResponse
    -> Maybe [JobDefinition] -> DescribeJobDefinitionsResponse)
-> Lens' DescribeJobDefinitionsResponse (Maybe [JobDefinition])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJobDefinitionsResponse' {Maybe [JobDefinition]
jobDefinitions :: Maybe [JobDefinition]
$sel:jobDefinitions:DescribeJobDefinitionsResponse' :: DescribeJobDefinitionsResponse -> Maybe [JobDefinition]
jobDefinitions} -> Maybe [JobDefinition]
jobDefinitions) (\s :: DescribeJobDefinitionsResponse
s@DescribeJobDefinitionsResponse' {} Maybe [JobDefinition]
a -> DescribeJobDefinitionsResponse
s {$sel:jobDefinitions:DescribeJobDefinitionsResponse' :: Maybe [JobDefinition]
jobDefinitions = Maybe [JobDefinition]
a} :: DescribeJobDefinitionsResponse) ((Maybe [JobDefinition] -> f (Maybe [JobDefinition]))
 -> DescribeJobDefinitionsResponse
 -> f DescribeJobDefinitionsResponse)
-> ((Maybe [JobDefinition] -> f (Maybe [JobDefinition]))
    -> Maybe [JobDefinition] -> f (Maybe [JobDefinition]))
-> (Maybe [JobDefinition] -> f (Maybe [JobDefinition]))
-> DescribeJobDefinitionsResponse
-> f DescribeJobDefinitionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [JobDefinition] [JobDefinition] [JobDefinition] [JobDefinition]
-> Iso
     (Maybe [JobDefinition])
     (Maybe [JobDefinition])
     (Maybe [JobDefinition])
     (Maybe [JobDefinition])
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
  [JobDefinition] [JobDefinition] [JobDefinition] [JobDefinition]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The @nextToken@ value to include in a future @DescribeJobDefinitions@
-- request. When the results of a @DescribeJobDefinitions@ request exceed
-- @maxResults@, this value can be used to retrieve the next page of
-- results. This value is @null@ when there are no more results to return.
describeJobDefinitionsResponse_nextToken :: Lens.Lens' DescribeJobDefinitionsResponse (Prelude.Maybe Prelude.Text)
describeJobDefinitionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeJobDefinitionsResponse
-> f DescribeJobDefinitionsResponse
describeJobDefinitionsResponse_nextToken = (DescribeJobDefinitionsResponse -> Maybe Text)
-> (DescribeJobDefinitionsResponse
    -> Maybe Text -> DescribeJobDefinitionsResponse)
-> Lens' DescribeJobDefinitionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJobDefinitionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeJobDefinitionsResponse' :: DescribeJobDefinitionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeJobDefinitionsResponse
s@DescribeJobDefinitionsResponse' {} Maybe Text
a -> DescribeJobDefinitionsResponse
s {$sel:nextToken:DescribeJobDefinitionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeJobDefinitionsResponse)

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

instance
  Prelude.NFData
    DescribeJobDefinitionsResponse