{-# 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.CodePipeline.PutThirdPartyJobFailureResult
-- 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)
--
-- Represents the failure of a third party job as returned to the pipeline
-- by a job worker. Used for partner actions only.
module Amazonka.CodePipeline.PutThirdPartyJobFailureResult
  ( -- * Creating a Request
    PutThirdPartyJobFailureResult (..),
    newPutThirdPartyJobFailureResult,

    -- * Request Lenses
    putThirdPartyJobFailureResult_jobId,
    putThirdPartyJobFailureResult_clientToken,
    putThirdPartyJobFailureResult_failureDetails,

    -- * Destructuring the Response
    PutThirdPartyJobFailureResultResponse (..),
    newPutThirdPartyJobFailureResultResponse,
  )
where

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

-- | Represents the input of a @PutThirdPartyJobFailureResult@ action.
--
-- /See:/ 'newPutThirdPartyJobFailureResult' smart constructor.
data PutThirdPartyJobFailureResult = PutThirdPartyJobFailureResult'
  { -- | The ID of the job that failed. This is the same ID returned from
    -- @PollForThirdPartyJobs@.
    PutThirdPartyJobFailureResult -> Text
jobId :: Prelude.Text,
    -- | 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.
    PutThirdPartyJobFailureResult -> Text
clientToken :: Prelude.Text,
    -- | Represents information about failure details.
    PutThirdPartyJobFailureResult -> FailureDetails
failureDetails :: FailureDetails
  }
  deriving (PutThirdPartyJobFailureResult
-> PutThirdPartyJobFailureResult -> Bool
(PutThirdPartyJobFailureResult
 -> PutThirdPartyJobFailureResult -> Bool)
-> (PutThirdPartyJobFailureResult
    -> PutThirdPartyJobFailureResult -> Bool)
-> Eq PutThirdPartyJobFailureResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutThirdPartyJobFailureResult
-> PutThirdPartyJobFailureResult -> Bool
$c/= :: PutThirdPartyJobFailureResult
-> PutThirdPartyJobFailureResult -> Bool
== :: PutThirdPartyJobFailureResult
-> PutThirdPartyJobFailureResult -> Bool
$c== :: PutThirdPartyJobFailureResult
-> PutThirdPartyJobFailureResult -> Bool
Prelude.Eq, ReadPrec [PutThirdPartyJobFailureResult]
ReadPrec PutThirdPartyJobFailureResult
Int -> ReadS PutThirdPartyJobFailureResult
ReadS [PutThirdPartyJobFailureResult]
(Int -> ReadS PutThirdPartyJobFailureResult)
-> ReadS [PutThirdPartyJobFailureResult]
-> ReadPrec PutThirdPartyJobFailureResult
-> ReadPrec [PutThirdPartyJobFailureResult]
-> Read PutThirdPartyJobFailureResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutThirdPartyJobFailureResult]
$creadListPrec :: ReadPrec [PutThirdPartyJobFailureResult]
readPrec :: ReadPrec PutThirdPartyJobFailureResult
$creadPrec :: ReadPrec PutThirdPartyJobFailureResult
readList :: ReadS [PutThirdPartyJobFailureResult]
$creadList :: ReadS [PutThirdPartyJobFailureResult]
readsPrec :: Int -> ReadS PutThirdPartyJobFailureResult
$creadsPrec :: Int -> ReadS PutThirdPartyJobFailureResult
Prelude.Read, Int -> PutThirdPartyJobFailureResult -> ShowS
[PutThirdPartyJobFailureResult] -> ShowS
PutThirdPartyJobFailureResult -> String
(Int -> PutThirdPartyJobFailureResult -> ShowS)
-> (PutThirdPartyJobFailureResult -> String)
-> ([PutThirdPartyJobFailureResult] -> ShowS)
-> Show PutThirdPartyJobFailureResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutThirdPartyJobFailureResult] -> ShowS
$cshowList :: [PutThirdPartyJobFailureResult] -> ShowS
show :: PutThirdPartyJobFailureResult -> String
$cshow :: PutThirdPartyJobFailureResult -> String
showsPrec :: Int -> PutThirdPartyJobFailureResult -> ShowS
$cshowsPrec :: Int -> PutThirdPartyJobFailureResult -> ShowS
Prelude.Show, (forall x.
 PutThirdPartyJobFailureResult
 -> Rep PutThirdPartyJobFailureResult x)
-> (forall x.
    Rep PutThirdPartyJobFailureResult x
    -> PutThirdPartyJobFailureResult)
-> Generic PutThirdPartyJobFailureResult
forall x.
Rep PutThirdPartyJobFailureResult x
-> PutThirdPartyJobFailureResult
forall x.
PutThirdPartyJobFailureResult
-> Rep PutThirdPartyJobFailureResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutThirdPartyJobFailureResult x
-> PutThirdPartyJobFailureResult
$cfrom :: forall x.
PutThirdPartyJobFailureResult
-> Rep PutThirdPartyJobFailureResult x
Prelude.Generic)

-- |
-- Create a value of 'PutThirdPartyJobFailureResult' 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:
--
-- 'jobId', 'putThirdPartyJobFailureResult_jobId' - The ID of the job that failed. This is the same ID returned from
-- @PollForThirdPartyJobs@.
--
-- 'clientToken', 'putThirdPartyJobFailureResult_clientToken' - 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.
--
-- 'failureDetails', 'putThirdPartyJobFailureResult_failureDetails' - Represents information about failure details.
newPutThirdPartyJobFailureResult ::
  -- | 'jobId'
  Prelude.Text ->
  -- | 'clientToken'
  Prelude.Text ->
  -- | 'failureDetails'
  FailureDetails ->
  PutThirdPartyJobFailureResult
newPutThirdPartyJobFailureResult :: Text -> Text -> FailureDetails -> PutThirdPartyJobFailureResult
newPutThirdPartyJobFailureResult
  Text
pJobId_
  Text
pClientToken_
  FailureDetails
pFailureDetails_ =
    PutThirdPartyJobFailureResult' :: Text -> Text -> FailureDetails -> PutThirdPartyJobFailureResult
PutThirdPartyJobFailureResult'
      { $sel:jobId:PutThirdPartyJobFailureResult' :: Text
jobId = Text
pJobId_,
        $sel:clientToken:PutThirdPartyJobFailureResult' :: Text
clientToken = Text
pClientToken_,
        $sel:failureDetails:PutThirdPartyJobFailureResult' :: FailureDetails
failureDetails = FailureDetails
pFailureDetails_
      }

-- | The ID of the job that failed. This is the same ID returned from
-- @PollForThirdPartyJobs@.
putThirdPartyJobFailureResult_jobId :: Lens.Lens' PutThirdPartyJobFailureResult Prelude.Text
putThirdPartyJobFailureResult_jobId :: (Text -> f Text)
-> PutThirdPartyJobFailureResult -> f PutThirdPartyJobFailureResult
putThirdPartyJobFailureResult_jobId = (PutThirdPartyJobFailureResult -> Text)
-> (PutThirdPartyJobFailureResult
    -> Text -> PutThirdPartyJobFailureResult)
-> Lens
     PutThirdPartyJobFailureResult
     PutThirdPartyJobFailureResult
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutThirdPartyJobFailureResult' {Text
jobId :: Text
$sel:jobId:PutThirdPartyJobFailureResult' :: PutThirdPartyJobFailureResult -> Text
jobId} -> Text
jobId) (\s :: PutThirdPartyJobFailureResult
s@PutThirdPartyJobFailureResult' {} Text
a -> PutThirdPartyJobFailureResult
s {$sel:jobId:PutThirdPartyJobFailureResult' :: Text
jobId = Text
a} :: PutThirdPartyJobFailureResult)

-- | 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.
putThirdPartyJobFailureResult_clientToken :: Lens.Lens' PutThirdPartyJobFailureResult Prelude.Text
putThirdPartyJobFailureResult_clientToken :: (Text -> f Text)
-> PutThirdPartyJobFailureResult -> f PutThirdPartyJobFailureResult
putThirdPartyJobFailureResult_clientToken = (PutThirdPartyJobFailureResult -> Text)
-> (PutThirdPartyJobFailureResult
    -> Text -> PutThirdPartyJobFailureResult)
-> Lens
     PutThirdPartyJobFailureResult
     PutThirdPartyJobFailureResult
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutThirdPartyJobFailureResult' {Text
clientToken :: Text
$sel:clientToken:PutThirdPartyJobFailureResult' :: PutThirdPartyJobFailureResult -> Text
clientToken} -> Text
clientToken) (\s :: PutThirdPartyJobFailureResult
s@PutThirdPartyJobFailureResult' {} Text
a -> PutThirdPartyJobFailureResult
s {$sel:clientToken:PutThirdPartyJobFailureResult' :: Text
clientToken = Text
a} :: PutThirdPartyJobFailureResult)

-- | Represents information about failure details.
putThirdPartyJobFailureResult_failureDetails :: Lens.Lens' PutThirdPartyJobFailureResult FailureDetails
putThirdPartyJobFailureResult_failureDetails :: (FailureDetails -> f FailureDetails)
-> PutThirdPartyJobFailureResult -> f PutThirdPartyJobFailureResult
putThirdPartyJobFailureResult_failureDetails = (PutThirdPartyJobFailureResult -> FailureDetails)
-> (PutThirdPartyJobFailureResult
    -> FailureDetails -> PutThirdPartyJobFailureResult)
-> Lens
     PutThirdPartyJobFailureResult
     PutThirdPartyJobFailureResult
     FailureDetails
     FailureDetails
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutThirdPartyJobFailureResult' {FailureDetails
failureDetails :: FailureDetails
$sel:failureDetails:PutThirdPartyJobFailureResult' :: PutThirdPartyJobFailureResult -> FailureDetails
failureDetails} -> FailureDetails
failureDetails) (\s :: PutThirdPartyJobFailureResult
s@PutThirdPartyJobFailureResult' {} FailureDetails
a -> PutThirdPartyJobFailureResult
s {$sel:failureDetails:PutThirdPartyJobFailureResult' :: FailureDetails
failureDetails = FailureDetails
a} :: PutThirdPartyJobFailureResult)

instance
  Core.AWSRequest
    PutThirdPartyJobFailureResult
  where
  type
    AWSResponse PutThirdPartyJobFailureResult =
      PutThirdPartyJobFailureResultResponse
  request :: PutThirdPartyJobFailureResult
-> Request PutThirdPartyJobFailureResult
request = Service
-> PutThirdPartyJobFailureResult
-> Request PutThirdPartyJobFailureResult
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy PutThirdPartyJobFailureResult
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutThirdPartyJobFailureResult)))
response =
    AWSResponse PutThirdPartyJobFailureResult
-> Logger
-> Service
-> Proxy PutThirdPartyJobFailureResult
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutThirdPartyJobFailureResult)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse PutThirdPartyJobFailureResult
PutThirdPartyJobFailureResultResponse
PutThirdPartyJobFailureResultResponse'

instance
  Prelude.Hashable
    PutThirdPartyJobFailureResult

instance Prelude.NFData PutThirdPartyJobFailureResult

instance Core.ToHeaders PutThirdPartyJobFailureResult where
  toHeaders :: PutThirdPartyJobFailureResult -> [Header]
toHeaders =
    [Header] -> PutThirdPartyJobFailureResult -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"CodePipeline_20150709.PutThirdPartyJobFailureResult" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON PutThirdPartyJobFailureResult where
  toJSON :: PutThirdPartyJobFailureResult -> Value
toJSON PutThirdPartyJobFailureResult' {Text
FailureDetails
failureDetails :: FailureDetails
clientToken :: Text
jobId :: Text
$sel:failureDetails:PutThirdPartyJobFailureResult' :: PutThirdPartyJobFailureResult -> FailureDetails
$sel:clientToken:PutThirdPartyJobFailureResult' :: PutThirdPartyJobFailureResult -> Text
$sel:jobId:PutThirdPartyJobFailureResult' :: PutThirdPartyJobFailureResult -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"jobId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
jobId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"clientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientToken),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"failureDetails" Text -> FailureDetails -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= FailureDetails
failureDetails)
          ]
      )

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

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

-- | /See:/ 'newPutThirdPartyJobFailureResultResponse' smart constructor.
data PutThirdPartyJobFailureResultResponse = PutThirdPartyJobFailureResultResponse'
  {
  }
  deriving (PutThirdPartyJobFailureResultResponse
-> PutThirdPartyJobFailureResultResponse -> Bool
(PutThirdPartyJobFailureResultResponse
 -> PutThirdPartyJobFailureResultResponse -> Bool)
-> (PutThirdPartyJobFailureResultResponse
    -> PutThirdPartyJobFailureResultResponse -> Bool)
-> Eq PutThirdPartyJobFailureResultResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutThirdPartyJobFailureResultResponse
-> PutThirdPartyJobFailureResultResponse -> Bool
$c/= :: PutThirdPartyJobFailureResultResponse
-> PutThirdPartyJobFailureResultResponse -> Bool
== :: PutThirdPartyJobFailureResultResponse
-> PutThirdPartyJobFailureResultResponse -> Bool
$c== :: PutThirdPartyJobFailureResultResponse
-> PutThirdPartyJobFailureResultResponse -> Bool
Prelude.Eq, ReadPrec [PutThirdPartyJobFailureResultResponse]
ReadPrec PutThirdPartyJobFailureResultResponse
Int -> ReadS PutThirdPartyJobFailureResultResponse
ReadS [PutThirdPartyJobFailureResultResponse]
(Int -> ReadS PutThirdPartyJobFailureResultResponse)
-> ReadS [PutThirdPartyJobFailureResultResponse]
-> ReadPrec PutThirdPartyJobFailureResultResponse
-> ReadPrec [PutThirdPartyJobFailureResultResponse]
-> Read PutThirdPartyJobFailureResultResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutThirdPartyJobFailureResultResponse]
$creadListPrec :: ReadPrec [PutThirdPartyJobFailureResultResponse]
readPrec :: ReadPrec PutThirdPartyJobFailureResultResponse
$creadPrec :: ReadPrec PutThirdPartyJobFailureResultResponse
readList :: ReadS [PutThirdPartyJobFailureResultResponse]
$creadList :: ReadS [PutThirdPartyJobFailureResultResponse]
readsPrec :: Int -> ReadS PutThirdPartyJobFailureResultResponse
$creadsPrec :: Int -> ReadS PutThirdPartyJobFailureResultResponse
Prelude.Read, Int -> PutThirdPartyJobFailureResultResponse -> ShowS
[PutThirdPartyJobFailureResultResponse] -> ShowS
PutThirdPartyJobFailureResultResponse -> String
(Int -> PutThirdPartyJobFailureResultResponse -> ShowS)
-> (PutThirdPartyJobFailureResultResponse -> String)
-> ([PutThirdPartyJobFailureResultResponse] -> ShowS)
-> Show PutThirdPartyJobFailureResultResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutThirdPartyJobFailureResultResponse] -> ShowS
$cshowList :: [PutThirdPartyJobFailureResultResponse] -> ShowS
show :: PutThirdPartyJobFailureResultResponse -> String
$cshow :: PutThirdPartyJobFailureResultResponse -> String
showsPrec :: Int -> PutThirdPartyJobFailureResultResponse -> ShowS
$cshowsPrec :: Int -> PutThirdPartyJobFailureResultResponse -> ShowS
Prelude.Show, (forall x.
 PutThirdPartyJobFailureResultResponse
 -> Rep PutThirdPartyJobFailureResultResponse x)
-> (forall x.
    Rep PutThirdPartyJobFailureResultResponse x
    -> PutThirdPartyJobFailureResultResponse)
-> Generic PutThirdPartyJobFailureResultResponse
forall x.
Rep PutThirdPartyJobFailureResultResponse x
-> PutThirdPartyJobFailureResultResponse
forall x.
PutThirdPartyJobFailureResultResponse
-> Rep PutThirdPartyJobFailureResultResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutThirdPartyJobFailureResultResponse x
-> PutThirdPartyJobFailureResultResponse
$cfrom :: forall x.
PutThirdPartyJobFailureResultResponse
-> Rep PutThirdPartyJobFailureResultResponse x
Prelude.Generic)

-- |
-- Create a value of 'PutThirdPartyJobFailureResultResponse' 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.
newPutThirdPartyJobFailureResultResponse ::
  PutThirdPartyJobFailureResultResponse
newPutThirdPartyJobFailureResultResponse :: PutThirdPartyJobFailureResultResponse
newPutThirdPartyJobFailureResultResponse =
  PutThirdPartyJobFailureResultResponse
PutThirdPartyJobFailureResultResponse'

instance
  Prelude.NFData
    PutThirdPartyJobFailureResultResponse