{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.CodePipeline.Types.JobDetails
-- 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)
module Amazonka.CodePipeline.Types.JobDetails where

import Amazonka.CodePipeline.Types.JobData
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents information about the details of a job.
--
-- /See:/ 'newJobDetails' smart constructor.
data JobDetails = JobDetails'
  { -- | Represents other information about a job required for a job worker to
    -- complete the job.
    JobDetails -> Maybe JobData
data' :: Prelude.Maybe JobData,
    -- | The AWS account ID associated with the job.
    JobDetails -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | The unique system-generated ID of the job.
    JobDetails -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (JobDetails -> JobDetails -> Bool
(JobDetails -> JobDetails -> Bool)
-> (JobDetails -> JobDetails -> Bool) -> Eq JobDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JobDetails -> JobDetails -> Bool
$c/= :: JobDetails -> JobDetails -> Bool
== :: JobDetails -> JobDetails -> Bool
$c== :: JobDetails -> JobDetails -> Bool
Prelude.Eq, Int -> JobDetails -> ShowS
[JobDetails] -> ShowS
JobDetails -> String
(Int -> JobDetails -> ShowS)
-> (JobDetails -> String)
-> ([JobDetails] -> ShowS)
-> Show JobDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JobDetails] -> ShowS
$cshowList :: [JobDetails] -> ShowS
show :: JobDetails -> String
$cshow :: JobDetails -> String
showsPrec :: Int -> JobDetails -> ShowS
$cshowsPrec :: Int -> JobDetails -> ShowS
Prelude.Show, (forall x. JobDetails -> Rep JobDetails x)
-> (forall x. Rep JobDetails x -> JobDetails) -> Generic JobDetails
forall x. Rep JobDetails x -> JobDetails
forall x. JobDetails -> Rep JobDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JobDetails x -> JobDetails
$cfrom :: forall x. JobDetails -> Rep JobDetails x
Prelude.Generic)

-- |
-- Create a value of 'JobDetails' 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:
--
-- 'data'', 'jobDetails_data' - Represents other information about a job required for a job worker to
-- complete the job.
--
-- 'accountId', 'jobDetails_accountId' - The AWS account ID associated with the job.
--
-- 'id', 'jobDetails_id' - The unique system-generated ID of the job.
newJobDetails ::
  JobDetails
newJobDetails :: JobDetails
newJobDetails =
  JobDetails' :: Maybe JobData -> Maybe Text -> Maybe Text -> JobDetails
JobDetails'
    { $sel:data':JobDetails' :: Maybe JobData
data' = Maybe JobData
forall a. Maybe a
Prelude.Nothing,
      $sel:accountId:JobDetails' :: Maybe Text
accountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:JobDetails' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Represents other information about a job required for a job worker to
-- complete the job.
jobDetails_data :: Lens.Lens' JobDetails (Prelude.Maybe JobData)
jobDetails_data :: (Maybe JobData -> f (Maybe JobData)) -> JobDetails -> f JobDetails
jobDetails_data = (JobDetails -> Maybe JobData)
-> (JobDetails -> Maybe JobData -> JobDetails)
-> Lens JobDetails JobDetails (Maybe JobData) (Maybe JobData)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDetails' {Maybe JobData
data' :: Maybe JobData
$sel:data':JobDetails' :: JobDetails -> Maybe JobData
data'} -> Maybe JobData
data') (\s :: JobDetails
s@JobDetails' {} Maybe JobData
a -> JobDetails
s {$sel:data':JobDetails' :: Maybe JobData
data' = Maybe JobData
a} :: JobDetails)

-- | The AWS account ID associated with the job.
jobDetails_accountId :: Lens.Lens' JobDetails (Prelude.Maybe Prelude.Text)
jobDetails_accountId :: (Maybe Text -> f (Maybe Text)) -> JobDetails -> f JobDetails
jobDetails_accountId = (JobDetails -> Maybe Text)
-> (JobDetails -> Maybe Text -> JobDetails)
-> Lens JobDetails JobDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDetails' {Maybe Text
accountId :: Maybe Text
$sel:accountId:JobDetails' :: JobDetails -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: JobDetails
s@JobDetails' {} Maybe Text
a -> JobDetails
s {$sel:accountId:JobDetails' :: Maybe Text
accountId = Maybe Text
a} :: JobDetails)

-- | The unique system-generated ID of the job.
jobDetails_id :: Lens.Lens' JobDetails (Prelude.Maybe Prelude.Text)
jobDetails_id :: (Maybe Text -> f (Maybe Text)) -> JobDetails -> f JobDetails
jobDetails_id = (JobDetails -> Maybe Text)
-> (JobDetails -> Maybe Text -> JobDetails)
-> Lens JobDetails JobDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDetails' {Maybe Text
id :: Maybe Text
$sel:id:JobDetails' :: JobDetails -> Maybe Text
id} -> Maybe Text
id) (\s :: JobDetails
s@JobDetails' {} Maybe Text
a -> JobDetails
s {$sel:id:JobDetails' :: Maybe Text
id = Maybe Text
a} :: JobDetails)

instance Core.FromJSON JobDetails where
  parseJSON :: Value -> Parser JobDetails
parseJSON =
    String
-> (Object -> Parser JobDetails) -> Value -> Parser JobDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"JobDetails"
      ( \Object
x ->
          Maybe JobData -> Maybe Text -> Maybe Text -> JobDetails
JobDetails'
            (Maybe JobData -> Maybe Text -> Maybe Text -> JobDetails)
-> Parser (Maybe JobData)
-> Parser (Maybe Text -> Maybe Text -> JobDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe JobData)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"data")
            Parser (Maybe Text -> Maybe Text -> JobDetails)
-> Parser (Maybe Text) -> Parser (Maybe Text -> JobDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"accountId")
            Parser (Maybe Text -> JobDetails)
-> Parser (Maybe Text) -> Parser JobDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"id")
      )

instance Prelude.Hashable JobDetails

instance Prelude.NFData JobDetails