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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A response to a @PollForThirdPartyJobs@ request returned by AWS
-- CodePipeline when there is a job to be worked on by a partner action.
--
-- /See:/ 'newThirdPartyJob' smart constructor.
data ThirdPartyJob = ThirdPartyJob'
  { -- | The @clientToken@ portion of the @clientId@ and @clientToken@ pair used
    -- to verify that the calling entity is allowed access to the job and its
    -- details.
    ThirdPartyJob -> Maybe Text
clientId :: Prelude.Maybe Prelude.Text,
    -- | The identifier used to identify the job in AWS CodePipeline.
    ThirdPartyJob -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text
  }
  deriving (ThirdPartyJob -> ThirdPartyJob -> Bool
(ThirdPartyJob -> ThirdPartyJob -> Bool)
-> (ThirdPartyJob -> ThirdPartyJob -> Bool) -> Eq ThirdPartyJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ThirdPartyJob -> ThirdPartyJob -> Bool
$c/= :: ThirdPartyJob -> ThirdPartyJob -> Bool
== :: ThirdPartyJob -> ThirdPartyJob -> Bool
$c== :: ThirdPartyJob -> ThirdPartyJob -> Bool
Prelude.Eq, ReadPrec [ThirdPartyJob]
ReadPrec ThirdPartyJob
Int -> ReadS ThirdPartyJob
ReadS [ThirdPartyJob]
(Int -> ReadS ThirdPartyJob)
-> ReadS [ThirdPartyJob]
-> ReadPrec ThirdPartyJob
-> ReadPrec [ThirdPartyJob]
-> Read ThirdPartyJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ThirdPartyJob]
$creadListPrec :: ReadPrec [ThirdPartyJob]
readPrec :: ReadPrec ThirdPartyJob
$creadPrec :: ReadPrec ThirdPartyJob
readList :: ReadS [ThirdPartyJob]
$creadList :: ReadS [ThirdPartyJob]
readsPrec :: Int -> ReadS ThirdPartyJob
$creadsPrec :: Int -> ReadS ThirdPartyJob
Prelude.Read, Int -> ThirdPartyJob -> ShowS
[ThirdPartyJob] -> ShowS
ThirdPartyJob -> String
(Int -> ThirdPartyJob -> ShowS)
-> (ThirdPartyJob -> String)
-> ([ThirdPartyJob] -> ShowS)
-> Show ThirdPartyJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ThirdPartyJob] -> ShowS
$cshowList :: [ThirdPartyJob] -> ShowS
show :: ThirdPartyJob -> String
$cshow :: ThirdPartyJob -> String
showsPrec :: Int -> ThirdPartyJob -> ShowS
$cshowsPrec :: Int -> ThirdPartyJob -> ShowS
Prelude.Show, (forall x. ThirdPartyJob -> Rep ThirdPartyJob x)
-> (forall x. Rep ThirdPartyJob x -> ThirdPartyJob)
-> Generic ThirdPartyJob
forall x. Rep ThirdPartyJob x -> ThirdPartyJob
forall x. ThirdPartyJob -> Rep ThirdPartyJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ThirdPartyJob x -> ThirdPartyJob
$cfrom :: forall x. ThirdPartyJob -> Rep ThirdPartyJob x
Prelude.Generic)

-- |
-- Create a value of 'ThirdPartyJob' 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:
--
-- 'clientId', 'thirdPartyJob_clientId' - The @clientToken@ portion of the @clientId@ and @clientToken@ pair used
-- to verify that the calling entity is allowed access to the job and its
-- details.
--
-- 'jobId', 'thirdPartyJob_jobId' - The identifier used to identify the job in AWS CodePipeline.
newThirdPartyJob ::
  ThirdPartyJob
newThirdPartyJob :: ThirdPartyJob
newThirdPartyJob =
  ThirdPartyJob' :: Maybe Text -> Maybe Text -> ThirdPartyJob
ThirdPartyJob'
    { $sel:clientId:ThirdPartyJob' :: Maybe Text
clientId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:jobId:ThirdPartyJob' :: Maybe Text
jobId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The @clientToken@ portion of the @clientId@ and @clientToken@ pair used
-- to verify that the calling entity is allowed access to the job and its
-- details.
thirdPartyJob_clientId :: Lens.Lens' ThirdPartyJob (Prelude.Maybe Prelude.Text)
thirdPartyJob_clientId :: (Maybe Text -> f (Maybe Text)) -> ThirdPartyJob -> f ThirdPartyJob
thirdPartyJob_clientId = (ThirdPartyJob -> Maybe Text)
-> (ThirdPartyJob -> Maybe Text -> ThirdPartyJob)
-> Lens ThirdPartyJob ThirdPartyJob (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThirdPartyJob' {Maybe Text
clientId :: Maybe Text
$sel:clientId:ThirdPartyJob' :: ThirdPartyJob -> Maybe Text
clientId} -> Maybe Text
clientId) (\s :: ThirdPartyJob
s@ThirdPartyJob' {} Maybe Text
a -> ThirdPartyJob
s {$sel:clientId:ThirdPartyJob' :: Maybe Text
clientId = Maybe Text
a} :: ThirdPartyJob)

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

instance Core.FromJSON ThirdPartyJob where
  parseJSON :: Value -> Parser ThirdPartyJob
parseJSON =
    String
-> (Object -> Parser ThirdPartyJob)
-> Value
-> Parser ThirdPartyJob
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ThirdPartyJob"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> ThirdPartyJob
ThirdPartyJob'
            (Maybe Text -> Maybe Text -> ThirdPartyJob)
-> Parser (Maybe Text) -> Parser (Maybe Text -> ThirdPartyJob)
forall (f :: * -> *) a b. Functor 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
"clientId")
            Parser (Maybe Text -> ThirdPartyJob)
-> Parser (Maybe Text) -> Parser ThirdPartyJob
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
"jobId")
      )

instance Prelude.Hashable ThirdPartyJob

instance Prelude.NFData ThirdPartyJob