packages feed

amazonka-codepipeline-2.0: gen/Amazonka/CodePipeline/PutJobSuccessResult.hs

{-# 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.PutJobSuccessResult
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Represents the success of a job as returned to the pipeline by a job
-- worker. Used for custom actions only.
module Amazonka.CodePipeline.PutJobSuccessResult
  ( -- * Creating a Request
    PutJobSuccessResult (..),
    newPutJobSuccessResult,

    -- * Request Lenses
    putJobSuccessResult_continuationToken,
    putJobSuccessResult_currentRevision,
    putJobSuccessResult_executionDetails,
    putJobSuccessResult_outputVariables,
    putJobSuccessResult_jobId,

    -- * Destructuring the Response
    PutJobSuccessResultResponse (..),
    newPutJobSuccessResultResponse,
  )
where

import Amazonka.CodePipeline.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Represents the input of a @PutJobSuccessResult@ action.
--
-- /See:/ 'newPutJobSuccessResult' smart constructor.
data PutJobSuccessResult = PutJobSuccessResult'
  { -- | A token generated by a job worker, such as an AWS CodeDeploy deployment
    -- ID, that a successful job provides to identify a custom action in
    -- progress. Future jobs use this token to identify the running instance of
    -- the action. It can be reused to return more information about the
    -- progress of the custom action. When the action is complete, no
    -- continuation token should be supplied.
    continuationToken :: Prelude.Maybe Prelude.Text,
    -- | The ID of the current revision of the artifact successfully worked on by
    -- the job.
    currentRevision :: Prelude.Maybe CurrentRevision,
    -- | The execution details of the successful job, such as the actions taken
    -- by the job worker.
    executionDetails :: Prelude.Maybe ExecutionDetails,
    -- | Key-value pairs produced as output by a job worker that can be made
    -- available to a downstream action configuration. @outputVariables@ can be
    -- included only when there is no continuation token on the request.
    outputVariables :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The unique system-generated ID of the job that succeeded. This is the
    -- same ID returned from @PollForJobs@.
    jobId :: Prelude.Text
  }
  deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)

-- |
-- Create a value of 'PutJobSuccessResult' 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:
--
-- 'continuationToken', 'putJobSuccessResult_continuationToken' - A token generated by a job worker, such as an AWS CodeDeploy deployment
-- ID, that a successful job provides to identify a custom action in
-- progress. Future jobs use this token to identify the running instance of
-- the action. It can be reused to return more information about the
-- progress of the custom action. When the action is complete, no
-- continuation token should be supplied.
--
-- 'currentRevision', 'putJobSuccessResult_currentRevision' - The ID of the current revision of the artifact successfully worked on by
-- the job.
--
-- 'executionDetails', 'putJobSuccessResult_executionDetails' - The execution details of the successful job, such as the actions taken
-- by the job worker.
--
-- 'outputVariables', 'putJobSuccessResult_outputVariables' - Key-value pairs produced as output by a job worker that can be made
-- available to a downstream action configuration. @outputVariables@ can be
-- included only when there is no continuation token on the request.
--
-- 'jobId', 'putJobSuccessResult_jobId' - The unique system-generated ID of the job that succeeded. This is the
-- same ID returned from @PollForJobs@.
newPutJobSuccessResult ::
  -- | 'jobId'
  Prelude.Text ->
  PutJobSuccessResult
newPutJobSuccessResult pJobId_ =
  PutJobSuccessResult'
    { continuationToken =
        Prelude.Nothing,
      currentRevision = Prelude.Nothing,
      executionDetails = Prelude.Nothing,
      outputVariables = Prelude.Nothing,
      jobId = pJobId_
    }

-- | A token generated by a job worker, such as an AWS CodeDeploy deployment
-- ID, that a successful job provides to identify a custom action in
-- progress. Future jobs use this token to identify the running instance of
-- the action. It can be reused to return more information about the
-- progress of the custom action. When the action is complete, no
-- continuation token should be supplied.
putJobSuccessResult_continuationToken :: Lens.Lens' PutJobSuccessResult (Prelude.Maybe Prelude.Text)
putJobSuccessResult_continuationToken = Lens.lens (\PutJobSuccessResult' {continuationToken} -> continuationToken) (\s@PutJobSuccessResult' {} a -> s {continuationToken = a} :: PutJobSuccessResult)

-- | The ID of the current revision of the artifact successfully worked on by
-- the job.
putJobSuccessResult_currentRevision :: Lens.Lens' PutJobSuccessResult (Prelude.Maybe CurrentRevision)
putJobSuccessResult_currentRevision = Lens.lens (\PutJobSuccessResult' {currentRevision} -> currentRevision) (\s@PutJobSuccessResult' {} a -> s {currentRevision = a} :: PutJobSuccessResult)

-- | The execution details of the successful job, such as the actions taken
-- by the job worker.
putJobSuccessResult_executionDetails :: Lens.Lens' PutJobSuccessResult (Prelude.Maybe ExecutionDetails)
putJobSuccessResult_executionDetails = Lens.lens (\PutJobSuccessResult' {executionDetails} -> executionDetails) (\s@PutJobSuccessResult' {} a -> s {executionDetails = a} :: PutJobSuccessResult)

-- | Key-value pairs produced as output by a job worker that can be made
-- available to a downstream action configuration. @outputVariables@ can be
-- included only when there is no continuation token on the request.
putJobSuccessResult_outputVariables :: Lens.Lens' PutJobSuccessResult (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
putJobSuccessResult_outputVariables = Lens.lens (\PutJobSuccessResult' {outputVariables} -> outputVariables) (\s@PutJobSuccessResult' {} a -> s {outputVariables = a} :: PutJobSuccessResult) Prelude.. Lens.mapping Lens.coerced

-- | The unique system-generated ID of the job that succeeded. This is the
-- same ID returned from @PollForJobs@.
putJobSuccessResult_jobId :: Lens.Lens' PutJobSuccessResult Prelude.Text
putJobSuccessResult_jobId = Lens.lens (\PutJobSuccessResult' {jobId} -> jobId) (\s@PutJobSuccessResult' {} a -> s {jobId = a} :: PutJobSuccessResult)

instance Core.AWSRequest PutJobSuccessResult where
  type
    AWSResponse PutJobSuccessResult =
      PutJobSuccessResultResponse
  request overrides =
    Request.postJSON (overrides defaultService)
  response =
    Response.receiveNull PutJobSuccessResultResponse'

instance Prelude.Hashable PutJobSuccessResult where
  hashWithSalt _salt PutJobSuccessResult' {..} =
    _salt
      `Prelude.hashWithSalt` continuationToken
      `Prelude.hashWithSalt` currentRevision
      `Prelude.hashWithSalt` executionDetails
      `Prelude.hashWithSalt` outputVariables
      `Prelude.hashWithSalt` jobId

instance Prelude.NFData PutJobSuccessResult where
  rnf PutJobSuccessResult' {..} =
    Prelude.rnf continuationToken
      `Prelude.seq` Prelude.rnf currentRevision
      `Prelude.seq` Prelude.rnf executionDetails
      `Prelude.seq` Prelude.rnf outputVariables
      `Prelude.seq` Prelude.rnf jobId

instance Data.ToHeaders PutJobSuccessResult where
  toHeaders =
    Prelude.const
      ( Prelude.mconcat
          [ "X-Amz-Target"
              Data.=# ( "CodePipeline_20150709.PutJobSuccessResult" ::
                          Prelude.ByteString
                      ),
            "Content-Type"
              Data.=# ( "application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON PutJobSuccessResult where
  toJSON PutJobSuccessResult' {..} =
    Data.object
      ( Prelude.catMaybes
          [ ("continuationToken" Data..=)
              Prelude.<$> continuationToken,
            ("currentRevision" Data..=)
              Prelude.<$> currentRevision,
            ("executionDetails" Data..=)
              Prelude.<$> executionDetails,
            ("outputVariables" Data..=)
              Prelude.<$> outputVariables,
            Prelude.Just ("jobId" Data..= jobId)
          ]
      )

instance Data.ToPath PutJobSuccessResult where
  toPath = Prelude.const "/"

instance Data.ToQuery PutJobSuccessResult where
  toQuery = Prelude.const Prelude.mempty

-- | /See:/ 'newPutJobSuccessResultResponse' smart constructor.
data PutJobSuccessResultResponse = PutJobSuccessResultResponse'
  {
  }
  deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)

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

instance Prelude.NFData PutJobSuccessResultResponse where
  rnf _ = ()