{-# 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.ThirdPartyJobDetails
-- 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.ThirdPartyJobDetails where

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

-- | The details of a job sent in response to a @GetThirdPartyJobDetails@
-- request.
--
-- /See:/ 'newThirdPartyJobDetails' smart constructor.
data ThirdPartyJobDetails = ThirdPartyJobDetails'
  { -- | The data to be returned by the third party job worker.
    ThirdPartyJobDetails -> Maybe ThirdPartyJobData
data' :: Prelude.Maybe ThirdPartyJobData,
    -- | The identifier used to identify the job details in AWS CodePipeline.
    ThirdPartyJobDetails -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | A system-generated random number that AWS CodePipeline uses to ensure
    -- that the job is being worked on by only one job worker. Use this number
    -- in an AcknowledgeThirdPartyJob request.
    ThirdPartyJobDetails -> Maybe Text
nonce :: Prelude.Maybe Prelude.Text
  }
  deriving (ThirdPartyJobDetails -> ThirdPartyJobDetails -> Bool
(ThirdPartyJobDetails -> ThirdPartyJobDetails -> Bool)
-> (ThirdPartyJobDetails -> ThirdPartyJobDetails -> Bool)
-> Eq ThirdPartyJobDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ThirdPartyJobDetails -> ThirdPartyJobDetails -> Bool
$c/= :: ThirdPartyJobDetails -> ThirdPartyJobDetails -> Bool
== :: ThirdPartyJobDetails -> ThirdPartyJobDetails -> Bool
$c== :: ThirdPartyJobDetails -> ThirdPartyJobDetails -> Bool
Prelude.Eq, Int -> ThirdPartyJobDetails -> ShowS
[ThirdPartyJobDetails] -> ShowS
ThirdPartyJobDetails -> String
(Int -> ThirdPartyJobDetails -> ShowS)
-> (ThirdPartyJobDetails -> String)
-> ([ThirdPartyJobDetails] -> ShowS)
-> Show ThirdPartyJobDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ThirdPartyJobDetails] -> ShowS
$cshowList :: [ThirdPartyJobDetails] -> ShowS
show :: ThirdPartyJobDetails -> String
$cshow :: ThirdPartyJobDetails -> String
showsPrec :: Int -> ThirdPartyJobDetails -> ShowS
$cshowsPrec :: Int -> ThirdPartyJobDetails -> ShowS
Prelude.Show, (forall x. ThirdPartyJobDetails -> Rep ThirdPartyJobDetails x)
-> (forall x. Rep ThirdPartyJobDetails x -> ThirdPartyJobDetails)
-> Generic ThirdPartyJobDetails
forall x. Rep ThirdPartyJobDetails x -> ThirdPartyJobDetails
forall x. ThirdPartyJobDetails -> Rep ThirdPartyJobDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ThirdPartyJobDetails x -> ThirdPartyJobDetails
$cfrom :: forall x. ThirdPartyJobDetails -> Rep ThirdPartyJobDetails x
Prelude.Generic)

-- |
-- Create a value of 'ThirdPartyJobDetails' 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'', 'thirdPartyJobDetails_data' - The data to be returned by the third party job worker.
--
-- 'id', 'thirdPartyJobDetails_id' - The identifier used to identify the job details in AWS CodePipeline.
--
-- 'nonce', 'thirdPartyJobDetails_nonce' - A system-generated random number that AWS CodePipeline uses to ensure
-- that the job is being worked on by only one job worker. Use this number
-- in an AcknowledgeThirdPartyJob request.
newThirdPartyJobDetails ::
  ThirdPartyJobDetails
newThirdPartyJobDetails :: ThirdPartyJobDetails
newThirdPartyJobDetails =
  ThirdPartyJobDetails' :: Maybe ThirdPartyJobData
-> Maybe Text -> Maybe Text -> ThirdPartyJobDetails
ThirdPartyJobDetails'
    { $sel:data':ThirdPartyJobDetails' :: Maybe ThirdPartyJobData
data' = Maybe ThirdPartyJobData
forall a. Maybe a
Prelude.Nothing,
      $sel:id:ThirdPartyJobDetails' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nonce:ThirdPartyJobDetails' :: Maybe Text
nonce = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The data to be returned by the third party job worker.
thirdPartyJobDetails_data :: Lens.Lens' ThirdPartyJobDetails (Prelude.Maybe ThirdPartyJobData)
thirdPartyJobDetails_data :: (Maybe ThirdPartyJobData -> f (Maybe ThirdPartyJobData))
-> ThirdPartyJobDetails -> f ThirdPartyJobDetails
thirdPartyJobDetails_data = (ThirdPartyJobDetails -> Maybe ThirdPartyJobData)
-> (ThirdPartyJobDetails
    -> Maybe ThirdPartyJobData -> ThirdPartyJobDetails)
-> Lens
     ThirdPartyJobDetails
     ThirdPartyJobDetails
     (Maybe ThirdPartyJobData)
     (Maybe ThirdPartyJobData)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThirdPartyJobDetails' {Maybe ThirdPartyJobData
data' :: Maybe ThirdPartyJobData
$sel:data':ThirdPartyJobDetails' :: ThirdPartyJobDetails -> Maybe ThirdPartyJobData
data'} -> Maybe ThirdPartyJobData
data') (\s :: ThirdPartyJobDetails
s@ThirdPartyJobDetails' {} Maybe ThirdPartyJobData
a -> ThirdPartyJobDetails
s {$sel:data':ThirdPartyJobDetails' :: Maybe ThirdPartyJobData
data' = Maybe ThirdPartyJobData
a} :: ThirdPartyJobDetails)

-- | The identifier used to identify the job details in AWS CodePipeline.
thirdPartyJobDetails_id :: Lens.Lens' ThirdPartyJobDetails (Prelude.Maybe Prelude.Text)
thirdPartyJobDetails_id :: (Maybe Text -> f (Maybe Text))
-> ThirdPartyJobDetails -> f ThirdPartyJobDetails
thirdPartyJobDetails_id = (ThirdPartyJobDetails -> Maybe Text)
-> (ThirdPartyJobDetails -> Maybe Text -> ThirdPartyJobDetails)
-> Lens
     ThirdPartyJobDetails ThirdPartyJobDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThirdPartyJobDetails' {Maybe Text
id :: Maybe Text
$sel:id:ThirdPartyJobDetails' :: ThirdPartyJobDetails -> Maybe Text
id} -> Maybe Text
id) (\s :: ThirdPartyJobDetails
s@ThirdPartyJobDetails' {} Maybe Text
a -> ThirdPartyJobDetails
s {$sel:id:ThirdPartyJobDetails' :: Maybe Text
id = Maybe Text
a} :: ThirdPartyJobDetails)

-- | A system-generated random number that AWS CodePipeline uses to ensure
-- that the job is being worked on by only one job worker. Use this number
-- in an AcknowledgeThirdPartyJob request.
thirdPartyJobDetails_nonce :: Lens.Lens' ThirdPartyJobDetails (Prelude.Maybe Prelude.Text)
thirdPartyJobDetails_nonce :: (Maybe Text -> f (Maybe Text))
-> ThirdPartyJobDetails -> f ThirdPartyJobDetails
thirdPartyJobDetails_nonce = (ThirdPartyJobDetails -> Maybe Text)
-> (ThirdPartyJobDetails -> Maybe Text -> ThirdPartyJobDetails)
-> Lens
     ThirdPartyJobDetails ThirdPartyJobDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThirdPartyJobDetails' {Maybe Text
nonce :: Maybe Text
$sel:nonce:ThirdPartyJobDetails' :: ThirdPartyJobDetails -> Maybe Text
nonce} -> Maybe Text
nonce) (\s :: ThirdPartyJobDetails
s@ThirdPartyJobDetails' {} Maybe Text
a -> ThirdPartyJobDetails
s {$sel:nonce:ThirdPartyJobDetails' :: Maybe Text
nonce = Maybe Text
a} :: ThirdPartyJobDetails)

instance Core.FromJSON ThirdPartyJobDetails where
  parseJSON :: Value -> Parser ThirdPartyJobDetails
parseJSON =
    String
-> (Object -> Parser ThirdPartyJobDetails)
-> Value
-> Parser ThirdPartyJobDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ThirdPartyJobDetails"
      ( \Object
x ->
          Maybe ThirdPartyJobData
-> Maybe Text -> Maybe Text -> ThirdPartyJobDetails
ThirdPartyJobDetails'
            (Maybe ThirdPartyJobData
 -> Maybe Text -> Maybe Text -> ThirdPartyJobDetails)
-> Parser (Maybe ThirdPartyJobData)
-> Parser (Maybe Text -> Maybe Text -> ThirdPartyJobDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ThirdPartyJobData)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"data")
            Parser (Maybe Text -> Maybe Text -> ThirdPartyJobDetails)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> ThirdPartyJobDetails)
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")
            Parser (Maybe Text -> ThirdPartyJobDetails)
-> Parser (Maybe Text) -> Parser ThirdPartyJobDetails
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
"nonce")
      )

instance Prelude.Hashable ThirdPartyJobDetails

instance Prelude.NFData ThirdPartyJobDetails