{-# 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.ElasticTranscoder.CreateJob
-- 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)
--
-- When you create a job, Elastic Transcoder returns JSON data that
-- includes the values that you specified plus information about the job
-- that is created.
--
-- If you have specified more than one output for your jobs (for example,
-- one output for the Kindle Fire and another output for the Apple iPhone
-- 4s), you currently must use the Elastic Transcoder API to list the jobs
-- (as opposed to the AWS Console).
module Amazonka.ElasticTranscoder.CreateJob
  ( -- * Creating a Request
    CreateJob (..),
    newCreateJob,

    -- * Request Lenses
    createJob_inputs,
    createJob_input,
    createJob_userMetadata,
    createJob_outputs,
    createJob_output,
    createJob_playlists,
    createJob_outputKeyPrefix,
    createJob_pipelineId,

    -- * Destructuring the Response
    CreateJobResponse (..),
    newCreateJobResponse,

    -- * Response Lenses
    createJobResponse_job,
    createJobResponse_httpStatus,
  )
where

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

-- | The @CreateJobRequest@ structure.
--
-- /See:/ 'newCreateJob' smart constructor.
data CreateJob = CreateJob'
  { -- | A section of the request body that provides information about the files
    -- that are being transcoded.
    CreateJob -> Maybe [JobInput]
inputs :: Prelude.Maybe [JobInput],
    -- | A section of the request body that provides information about the file
    -- that is being transcoded.
    CreateJob -> Maybe JobInput
input :: Prelude.Maybe JobInput,
    -- | User-defined metadata that you want to associate with an Elastic
    -- Transcoder job. You specify metadata in @key\/value@ pairs, and you can
    -- add up to 10 @key\/value@ pairs per job. Elastic Transcoder does not
    -- guarantee that @key\/value@ pairs are returned in the same order in
    -- which you specify them.
    CreateJob -> Maybe (HashMap Text Text)
userMetadata :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | A section of the request body that provides information about the
    -- transcoded (target) files. We recommend that you use the @Outputs@
    -- syntax instead of the @Output@ syntax.
    CreateJob -> Maybe [CreateJobOutput]
outputs :: Prelude.Maybe [CreateJobOutput],
    -- | A section of the request body that provides information about the
    -- transcoded (target) file. We strongly recommend that you use the
    -- @Outputs@ syntax instead of the @Output@ syntax.
    CreateJob -> Maybe CreateJobOutput
output :: Prelude.Maybe CreateJobOutput,
    -- | If you specify a preset in @PresetId@ for which the value of @Container@
    -- is fmp4 (Fragmented MP4) or ts (MPEG-TS), Playlists contains information
    -- about the master playlists that you want Elastic Transcoder to create.
    --
    -- The maximum number of master playlists in a job is 30.
    CreateJob -> Maybe [CreateJobPlaylist]
playlists :: Prelude.Maybe [CreateJobPlaylist],
    -- | The value, if any, that you want Elastic Transcoder to prepend to the
    -- names of all files that this job creates, including output files,
    -- thumbnails, and playlists.
    CreateJob -> Maybe Text
outputKeyPrefix :: Prelude.Maybe Prelude.Text,
    -- | The @Id@ of the pipeline that you want Elastic Transcoder to use for
    -- transcoding. The pipeline determines several settings, including the
    -- Amazon S3 bucket from which Elastic Transcoder gets the files to
    -- transcode and the bucket into which Elastic Transcoder puts the
    -- transcoded files.
    CreateJob -> Text
pipelineId :: Prelude.Text
  }
  deriving (CreateJob -> CreateJob -> Bool
(CreateJob -> CreateJob -> Bool)
-> (CreateJob -> CreateJob -> Bool) -> Eq CreateJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateJob -> CreateJob -> Bool
$c/= :: CreateJob -> CreateJob -> Bool
== :: CreateJob -> CreateJob -> Bool
$c== :: CreateJob -> CreateJob -> Bool
Prelude.Eq, ReadPrec [CreateJob]
ReadPrec CreateJob
Int -> ReadS CreateJob
ReadS [CreateJob]
(Int -> ReadS CreateJob)
-> ReadS [CreateJob]
-> ReadPrec CreateJob
-> ReadPrec [CreateJob]
-> Read CreateJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateJob]
$creadListPrec :: ReadPrec [CreateJob]
readPrec :: ReadPrec CreateJob
$creadPrec :: ReadPrec CreateJob
readList :: ReadS [CreateJob]
$creadList :: ReadS [CreateJob]
readsPrec :: Int -> ReadS CreateJob
$creadsPrec :: Int -> ReadS CreateJob
Prelude.Read, Int -> CreateJob -> ShowS
[CreateJob] -> ShowS
CreateJob -> String
(Int -> CreateJob -> ShowS)
-> (CreateJob -> String)
-> ([CreateJob] -> ShowS)
-> Show CreateJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateJob] -> ShowS
$cshowList :: [CreateJob] -> ShowS
show :: CreateJob -> String
$cshow :: CreateJob -> String
showsPrec :: Int -> CreateJob -> ShowS
$cshowsPrec :: Int -> CreateJob -> ShowS
Prelude.Show, (forall x. CreateJob -> Rep CreateJob x)
-> (forall x. Rep CreateJob x -> CreateJob) -> Generic CreateJob
forall x. Rep CreateJob x -> CreateJob
forall x. CreateJob -> Rep CreateJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateJob x -> CreateJob
$cfrom :: forall x. CreateJob -> Rep CreateJob x
Prelude.Generic)

-- |
-- Create a value of 'CreateJob' 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:
--
-- 'inputs', 'createJob_inputs' - A section of the request body that provides information about the files
-- that are being transcoded.
--
-- 'input', 'createJob_input' - A section of the request body that provides information about the file
-- that is being transcoded.
--
-- 'userMetadata', 'createJob_userMetadata' - User-defined metadata that you want to associate with an Elastic
-- Transcoder job. You specify metadata in @key\/value@ pairs, and you can
-- add up to 10 @key\/value@ pairs per job. Elastic Transcoder does not
-- guarantee that @key\/value@ pairs are returned in the same order in
-- which you specify them.
--
-- 'outputs', 'createJob_outputs' - A section of the request body that provides information about the
-- transcoded (target) files. We recommend that you use the @Outputs@
-- syntax instead of the @Output@ syntax.
--
-- 'output', 'createJob_output' - A section of the request body that provides information about the
-- transcoded (target) file. We strongly recommend that you use the
-- @Outputs@ syntax instead of the @Output@ syntax.
--
-- 'playlists', 'createJob_playlists' - If you specify a preset in @PresetId@ for which the value of @Container@
-- is fmp4 (Fragmented MP4) or ts (MPEG-TS), Playlists contains information
-- about the master playlists that you want Elastic Transcoder to create.
--
-- The maximum number of master playlists in a job is 30.
--
-- 'outputKeyPrefix', 'createJob_outputKeyPrefix' - The value, if any, that you want Elastic Transcoder to prepend to the
-- names of all files that this job creates, including output files,
-- thumbnails, and playlists.
--
-- 'pipelineId', 'createJob_pipelineId' - The @Id@ of the pipeline that you want Elastic Transcoder to use for
-- transcoding. The pipeline determines several settings, including the
-- Amazon S3 bucket from which Elastic Transcoder gets the files to
-- transcode and the bucket into which Elastic Transcoder puts the
-- transcoded files.
newCreateJob ::
  -- | 'pipelineId'
  Prelude.Text ->
  CreateJob
newCreateJob :: Text -> CreateJob
newCreateJob Text
pPipelineId_ =
  CreateJob' :: Maybe [JobInput]
-> Maybe JobInput
-> Maybe (HashMap Text Text)
-> Maybe [CreateJobOutput]
-> Maybe CreateJobOutput
-> Maybe [CreateJobPlaylist]
-> Maybe Text
-> Text
-> CreateJob
CreateJob'
    { $sel:inputs:CreateJob' :: Maybe [JobInput]
inputs = Maybe [JobInput]
forall a. Maybe a
Prelude.Nothing,
      $sel:input:CreateJob' :: Maybe JobInput
input = Maybe JobInput
forall a. Maybe a
Prelude.Nothing,
      $sel:userMetadata:CreateJob' :: Maybe (HashMap Text Text)
userMetadata = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:outputs:CreateJob' :: Maybe [CreateJobOutput]
outputs = Maybe [CreateJobOutput]
forall a. Maybe a
Prelude.Nothing,
      $sel:output:CreateJob' :: Maybe CreateJobOutput
output = Maybe CreateJobOutput
forall a. Maybe a
Prelude.Nothing,
      $sel:playlists:CreateJob' :: Maybe [CreateJobPlaylist]
playlists = Maybe [CreateJobPlaylist]
forall a. Maybe a
Prelude.Nothing,
      $sel:outputKeyPrefix:CreateJob' :: Maybe Text
outputKeyPrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:pipelineId:CreateJob' :: Text
pipelineId = Text
pPipelineId_
    }

-- | A section of the request body that provides information about the files
-- that are being transcoded.
createJob_inputs :: Lens.Lens' CreateJob (Prelude.Maybe [JobInput])
createJob_inputs :: (Maybe [JobInput] -> f (Maybe [JobInput]))
-> CreateJob -> f CreateJob
createJob_inputs = (CreateJob -> Maybe [JobInput])
-> (CreateJob -> Maybe [JobInput] -> CreateJob)
-> Lens CreateJob CreateJob (Maybe [JobInput]) (Maybe [JobInput])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateJob' {Maybe [JobInput]
inputs :: Maybe [JobInput]
$sel:inputs:CreateJob' :: CreateJob -> Maybe [JobInput]
inputs} -> Maybe [JobInput]
inputs) (\s :: CreateJob
s@CreateJob' {} Maybe [JobInput]
a -> CreateJob
s {$sel:inputs:CreateJob' :: Maybe [JobInput]
inputs = Maybe [JobInput]
a} :: CreateJob) ((Maybe [JobInput] -> f (Maybe [JobInput]))
 -> CreateJob -> f CreateJob)
-> ((Maybe [JobInput] -> f (Maybe [JobInput]))
    -> Maybe [JobInput] -> f (Maybe [JobInput]))
-> (Maybe [JobInput] -> f (Maybe [JobInput]))
-> CreateJob
-> f CreateJob
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [JobInput] [JobInput] [JobInput] [JobInput]
-> Iso
     (Maybe [JobInput])
     (Maybe [JobInput])
     (Maybe [JobInput])
     (Maybe [JobInput])
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 [JobInput] [JobInput] [JobInput] [JobInput]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A section of the request body that provides information about the file
-- that is being transcoded.
createJob_input :: Lens.Lens' CreateJob (Prelude.Maybe JobInput)
createJob_input :: (Maybe JobInput -> f (Maybe JobInput)) -> CreateJob -> f CreateJob
createJob_input = (CreateJob -> Maybe JobInput)
-> (CreateJob -> Maybe JobInput -> CreateJob)
-> Lens CreateJob CreateJob (Maybe JobInput) (Maybe JobInput)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateJob' {Maybe JobInput
input :: Maybe JobInput
$sel:input:CreateJob' :: CreateJob -> Maybe JobInput
input} -> Maybe JobInput
input) (\s :: CreateJob
s@CreateJob' {} Maybe JobInput
a -> CreateJob
s {$sel:input:CreateJob' :: Maybe JobInput
input = Maybe JobInput
a} :: CreateJob)

-- | User-defined metadata that you want to associate with an Elastic
-- Transcoder job. You specify metadata in @key\/value@ pairs, and you can
-- add up to 10 @key\/value@ pairs per job. Elastic Transcoder does not
-- guarantee that @key\/value@ pairs are returned in the same order in
-- which you specify them.
createJob_userMetadata :: Lens.Lens' CreateJob (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createJob_userMetadata :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateJob -> f CreateJob
createJob_userMetadata = (CreateJob -> Maybe (HashMap Text Text))
-> (CreateJob -> Maybe (HashMap Text Text) -> CreateJob)
-> Lens
     CreateJob
     CreateJob
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateJob' {Maybe (HashMap Text Text)
userMetadata :: Maybe (HashMap Text Text)
$sel:userMetadata:CreateJob' :: CreateJob -> Maybe (HashMap Text Text)
userMetadata} -> Maybe (HashMap Text Text)
userMetadata) (\s :: CreateJob
s@CreateJob' {} Maybe (HashMap Text Text)
a -> CreateJob
s {$sel:userMetadata:CreateJob' :: Maybe (HashMap Text Text)
userMetadata = Maybe (HashMap Text Text)
a} :: CreateJob) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateJob -> f CreateJob)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateJob
-> f CreateJob
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text 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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A section of the request body that provides information about the
-- transcoded (target) files. We recommend that you use the @Outputs@
-- syntax instead of the @Output@ syntax.
createJob_outputs :: Lens.Lens' CreateJob (Prelude.Maybe [CreateJobOutput])
createJob_outputs :: (Maybe [CreateJobOutput] -> f (Maybe [CreateJobOutput]))
-> CreateJob -> f CreateJob
createJob_outputs = (CreateJob -> Maybe [CreateJobOutput])
-> (CreateJob -> Maybe [CreateJobOutput] -> CreateJob)
-> Lens
     CreateJob
     CreateJob
     (Maybe [CreateJobOutput])
     (Maybe [CreateJobOutput])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateJob' {Maybe [CreateJobOutput]
outputs :: Maybe [CreateJobOutput]
$sel:outputs:CreateJob' :: CreateJob -> Maybe [CreateJobOutput]
outputs} -> Maybe [CreateJobOutput]
outputs) (\s :: CreateJob
s@CreateJob' {} Maybe [CreateJobOutput]
a -> CreateJob
s {$sel:outputs:CreateJob' :: Maybe [CreateJobOutput]
outputs = Maybe [CreateJobOutput]
a} :: CreateJob) ((Maybe [CreateJobOutput] -> f (Maybe [CreateJobOutput]))
 -> CreateJob -> f CreateJob)
-> ((Maybe [CreateJobOutput] -> f (Maybe [CreateJobOutput]))
    -> Maybe [CreateJobOutput] -> f (Maybe [CreateJobOutput]))
-> (Maybe [CreateJobOutput] -> f (Maybe [CreateJobOutput]))
-> CreateJob
-> f CreateJob
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CreateJobOutput]
  [CreateJobOutput]
  [CreateJobOutput]
  [CreateJobOutput]
-> Iso
     (Maybe [CreateJobOutput])
     (Maybe [CreateJobOutput])
     (Maybe [CreateJobOutput])
     (Maybe [CreateJobOutput])
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
  [CreateJobOutput]
  [CreateJobOutput]
  [CreateJobOutput]
  [CreateJobOutput]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A section of the request body that provides information about the
-- transcoded (target) file. We strongly recommend that you use the
-- @Outputs@ syntax instead of the @Output@ syntax.
createJob_output :: Lens.Lens' CreateJob (Prelude.Maybe CreateJobOutput)
createJob_output :: (Maybe CreateJobOutput -> f (Maybe CreateJobOutput))
-> CreateJob -> f CreateJob
createJob_output = (CreateJob -> Maybe CreateJobOutput)
-> (CreateJob -> Maybe CreateJobOutput -> CreateJob)
-> Lens
     CreateJob CreateJob (Maybe CreateJobOutput) (Maybe CreateJobOutput)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateJob' {Maybe CreateJobOutput
output :: Maybe CreateJobOutput
$sel:output:CreateJob' :: CreateJob -> Maybe CreateJobOutput
output} -> Maybe CreateJobOutput
output) (\s :: CreateJob
s@CreateJob' {} Maybe CreateJobOutput
a -> CreateJob
s {$sel:output:CreateJob' :: Maybe CreateJobOutput
output = Maybe CreateJobOutput
a} :: CreateJob)

-- | If you specify a preset in @PresetId@ for which the value of @Container@
-- is fmp4 (Fragmented MP4) or ts (MPEG-TS), Playlists contains information
-- about the master playlists that you want Elastic Transcoder to create.
--
-- The maximum number of master playlists in a job is 30.
createJob_playlists :: Lens.Lens' CreateJob (Prelude.Maybe [CreateJobPlaylist])
createJob_playlists :: (Maybe [CreateJobPlaylist] -> f (Maybe [CreateJobPlaylist]))
-> CreateJob -> f CreateJob
createJob_playlists = (CreateJob -> Maybe [CreateJobPlaylist])
-> (CreateJob -> Maybe [CreateJobPlaylist] -> CreateJob)
-> Lens
     CreateJob
     CreateJob
     (Maybe [CreateJobPlaylist])
     (Maybe [CreateJobPlaylist])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateJob' {Maybe [CreateJobPlaylist]
playlists :: Maybe [CreateJobPlaylist]
$sel:playlists:CreateJob' :: CreateJob -> Maybe [CreateJobPlaylist]
playlists} -> Maybe [CreateJobPlaylist]
playlists) (\s :: CreateJob
s@CreateJob' {} Maybe [CreateJobPlaylist]
a -> CreateJob
s {$sel:playlists:CreateJob' :: Maybe [CreateJobPlaylist]
playlists = Maybe [CreateJobPlaylist]
a} :: CreateJob) ((Maybe [CreateJobPlaylist] -> f (Maybe [CreateJobPlaylist]))
 -> CreateJob -> f CreateJob)
-> ((Maybe [CreateJobPlaylist] -> f (Maybe [CreateJobPlaylist]))
    -> Maybe [CreateJobPlaylist] -> f (Maybe [CreateJobPlaylist]))
-> (Maybe [CreateJobPlaylist] -> f (Maybe [CreateJobPlaylist]))
-> CreateJob
-> f CreateJob
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CreateJobPlaylist]
  [CreateJobPlaylist]
  [CreateJobPlaylist]
  [CreateJobPlaylist]
-> Iso
     (Maybe [CreateJobPlaylist])
     (Maybe [CreateJobPlaylist])
     (Maybe [CreateJobPlaylist])
     (Maybe [CreateJobPlaylist])
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
  [CreateJobPlaylist]
  [CreateJobPlaylist]
  [CreateJobPlaylist]
  [CreateJobPlaylist]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The value, if any, that you want Elastic Transcoder to prepend to the
-- names of all files that this job creates, including output files,
-- thumbnails, and playlists.
createJob_outputKeyPrefix :: Lens.Lens' CreateJob (Prelude.Maybe Prelude.Text)
createJob_outputKeyPrefix :: (Maybe Text -> f (Maybe Text)) -> CreateJob -> f CreateJob
createJob_outputKeyPrefix = (CreateJob -> Maybe Text)
-> (CreateJob -> Maybe Text -> CreateJob)
-> Lens CreateJob CreateJob (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateJob' {Maybe Text
outputKeyPrefix :: Maybe Text
$sel:outputKeyPrefix:CreateJob' :: CreateJob -> Maybe Text
outputKeyPrefix} -> Maybe Text
outputKeyPrefix) (\s :: CreateJob
s@CreateJob' {} Maybe Text
a -> CreateJob
s {$sel:outputKeyPrefix:CreateJob' :: Maybe Text
outputKeyPrefix = Maybe Text
a} :: CreateJob)

-- | The @Id@ of the pipeline that you want Elastic Transcoder to use for
-- transcoding. The pipeline determines several settings, including the
-- Amazon S3 bucket from which Elastic Transcoder gets the files to
-- transcode and the bucket into which Elastic Transcoder puts the
-- transcoded files.
createJob_pipelineId :: Lens.Lens' CreateJob Prelude.Text
createJob_pipelineId :: (Text -> f Text) -> CreateJob -> f CreateJob
createJob_pipelineId = (CreateJob -> Text)
-> (CreateJob -> Text -> CreateJob)
-> Lens CreateJob CreateJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateJob' {Text
pipelineId :: Text
$sel:pipelineId:CreateJob' :: CreateJob -> Text
pipelineId} -> Text
pipelineId) (\s :: CreateJob
s@CreateJob' {} Text
a -> CreateJob
s {$sel:pipelineId:CreateJob' :: Text
pipelineId = Text
a} :: CreateJob)

instance Core.AWSRequest CreateJob where
  type AWSResponse CreateJob = CreateJobResponse
  request :: CreateJob -> Request CreateJob
request = Service -> CreateJob -> Request CreateJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateJob)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateJob))
-> Logger
-> Service
-> Proxy CreateJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateJob)))
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 Job -> Int -> CreateJobResponse
CreateJobResponse'
            (Maybe Job -> Int -> CreateJobResponse)
-> Either String (Maybe Job)
-> Either String (Int -> CreateJobResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Job)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Job")
            Either String (Int -> CreateJobResponse)
-> Either String Int -> Either String CreateJobResponse
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 CreateJob

instance Prelude.NFData CreateJob

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

instance Core.ToJSON CreateJob where
  toJSON :: CreateJob -> Value
toJSON CreateJob' {Maybe [CreateJobPlaylist]
Maybe [JobInput]
Maybe [CreateJobOutput]
Maybe Text
Maybe (HashMap Text Text)
Maybe JobInput
Maybe CreateJobOutput
Text
pipelineId :: Text
outputKeyPrefix :: Maybe Text
playlists :: Maybe [CreateJobPlaylist]
output :: Maybe CreateJobOutput
outputs :: Maybe [CreateJobOutput]
userMetadata :: Maybe (HashMap Text Text)
input :: Maybe JobInput
inputs :: Maybe [JobInput]
$sel:pipelineId:CreateJob' :: CreateJob -> Text
$sel:outputKeyPrefix:CreateJob' :: CreateJob -> Maybe Text
$sel:playlists:CreateJob' :: CreateJob -> Maybe [CreateJobPlaylist]
$sel:output:CreateJob' :: CreateJob -> Maybe CreateJobOutput
$sel:outputs:CreateJob' :: CreateJob -> Maybe [CreateJobOutput]
$sel:userMetadata:CreateJob' :: CreateJob -> Maybe (HashMap Text Text)
$sel:input:CreateJob' :: CreateJob -> Maybe JobInput
$sel:inputs:CreateJob' :: CreateJob -> Maybe [JobInput]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Inputs" Text -> [JobInput] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([JobInput] -> Pair) -> Maybe [JobInput] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [JobInput]
inputs,
            (Text
"Input" Text -> JobInput -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (JobInput -> Pair) -> Maybe JobInput -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe JobInput
input,
            (Text
"UserMetadata" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
userMetadata,
            (Text
"Outputs" Text -> [CreateJobOutput] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([CreateJobOutput] -> Pair)
-> Maybe [CreateJobOutput] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [CreateJobOutput]
outputs,
            (Text
"Output" Text -> CreateJobOutput -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CreateJobOutput -> Pair) -> Maybe CreateJobOutput -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CreateJobOutput
output,
            (Text
"Playlists" Text -> [CreateJobPlaylist] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([CreateJobPlaylist] -> Pair)
-> Maybe [CreateJobPlaylist] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [CreateJobPlaylist]
playlists,
            (Text
"OutputKeyPrefix" 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
outputKeyPrefix,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"PipelineId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
pipelineId)
          ]
      )

instance Core.ToPath CreateJob where
  toPath :: CreateJob -> ByteString
toPath = ByteString -> CreateJob -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2012-09-25/jobs"

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

-- | The CreateJobResponse structure.
--
-- /See:/ 'newCreateJobResponse' smart constructor.
data CreateJobResponse = CreateJobResponse'
  { -- | A section of the response body that provides information about the job
    -- that is created.
    CreateJobResponse -> Maybe Job
job :: Prelude.Maybe Job,
    -- | The response's http status code.
    CreateJobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateJobResponse -> CreateJobResponse -> Bool
(CreateJobResponse -> CreateJobResponse -> Bool)
-> (CreateJobResponse -> CreateJobResponse -> Bool)
-> Eq CreateJobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateJobResponse -> CreateJobResponse -> Bool
$c/= :: CreateJobResponse -> CreateJobResponse -> Bool
== :: CreateJobResponse -> CreateJobResponse -> Bool
$c== :: CreateJobResponse -> CreateJobResponse -> Bool
Prelude.Eq, ReadPrec [CreateJobResponse]
ReadPrec CreateJobResponse
Int -> ReadS CreateJobResponse
ReadS [CreateJobResponse]
(Int -> ReadS CreateJobResponse)
-> ReadS [CreateJobResponse]
-> ReadPrec CreateJobResponse
-> ReadPrec [CreateJobResponse]
-> Read CreateJobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateJobResponse]
$creadListPrec :: ReadPrec [CreateJobResponse]
readPrec :: ReadPrec CreateJobResponse
$creadPrec :: ReadPrec CreateJobResponse
readList :: ReadS [CreateJobResponse]
$creadList :: ReadS [CreateJobResponse]
readsPrec :: Int -> ReadS CreateJobResponse
$creadsPrec :: Int -> ReadS CreateJobResponse
Prelude.Read, Int -> CreateJobResponse -> ShowS
[CreateJobResponse] -> ShowS
CreateJobResponse -> String
(Int -> CreateJobResponse -> ShowS)
-> (CreateJobResponse -> String)
-> ([CreateJobResponse] -> ShowS)
-> Show CreateJobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateJobResponse] -> ShowS
$cshowList :: [CreateJobResponse] -> ShowS
show :: CreateJobResponse -> String
$cshow :: CreateJobResponse -> String
showsPrec :: Int -> CreateJobResponse -> ShowS
$cshowsPrec :: Int -> CreateJobResponse -> ShowS
Prelude.Show, (forall x. CreateJobResponse -> Rep CreateJobResponse x)
-> (forall x. Rep CreateJobResponse x -> CreateJobResponse)
-> Generic CreateJobResponse
forall x. Rep CreateJobResponse x -> CreateJobResponse
forall x. CreateJobResponse -> Rep CreateJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateJobResponse x -> CreateJobResponse
$cfrom :: forall x. CreateJobResponse -> Rep CreateJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateJobResponse' 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:
--
-- 'job', 'createJobResponse_job' - A section of the response body that provides information about the job
-- that is created.
--
-- 'httpStatus', 'createJobResponse_httpStatus' - The response's http status code.
newCreateJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateJobResponse
newCreateJobResponse :: Int -> CreateJobResponse
newCreateJobResponse Int
pHttpStatus_ =
  CreateJobResponse' :: Maybe Job -> Int -> CreateJobResponse
CreateJobResponse'
    { $sel:job:CreateJobResponse' :: Maybe Job
job = Maybe Job
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A section of the response body that provides information about the job
-- that is created.
createJobResponse_job :: Lens.Lens' CreateJobResponse (Prelude.Maybe Job)
createJobResponse_job :: (Maybe Job -> f (Maybe Job))
-> CreateJobResponse -> f CreateJobResponse
createJobResponse_job = (CreateJobResponse -> Maybe Job)
-> (CreateJobResponse -> Maybe Job -> CreateJobResponse)
-> Lens CreateJobResponse CreateJobResponse (Maybe Job) (Maybe Job)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateJobResponse' {Maybe Job
job :: Maybe Job
$sel:job:CreateJobResponse' :: CreateJobResponse -> Maybe Job
job} -> Maybe Job
job) (\s :: CreateJobResponse
s@CreateJobResponse' {} Maybe Job
a -> CreateJobResponse
s {$sel:job:CreateJobResponse' :: Maybe Job
job = Maybe Job
a} :: CreateJobResponse)

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

instance Prelude.NFData CreateJobResponse