{-# 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.ActionState
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CodePipeline.Types.ActionState where

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

-- | Represents information about the state of an action.
--
-- /See:/ 'newActionState' smart constructor.
data ActionState = ActionState'
  { -- | The name of the action.
    ActionState -> Maybe Text
actionName :: Prelude.Maybe Prelude.Text,
    -- | Represents information about the version (or revision) of an action.
    ActionState -> Maybe ActionRevision
currentRevision :: Prelude.Maybe ActionRevision,
    -- | A URL link for more information about the state of the action, such as a
    -- deployment group details page.
    ActionState -> Maybe Text
entityUrl :: Prelude.Maybe Prelude.Text,
    -- | Represents information about the run of an action.
    ActionState -> Maybe ActionExecution
latestExecution :: Prelude.Maybe ActionExecution,
    -- | A URL link for more information about the revision, such as a commit
    -- details page.
    ActionState -> Maybe Text
revisionUrl :: Prelude.Maybe Prelude.Text
  }
  deriving (ActionState -> ActionState -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActionState -> ActionState -> Bool
$c/= :: ActionState -> ActionState -> Bool
== :: ActionState -> ActionState -> Bool
$c== :: ActionState -> ActionState -> Bool
Prelude.Eq, ReadPrec [ActionState]
ReadPrec ActionState
Int -> ReadS ActionState
ReadS [ActionState]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActionState]
$creadListPrec :: ReadPrec [ActionState]
readPrec :: ReadPrec ActionState
$creadPrec :: ReadPrec ActionState
readList :: ReadS [ActionState]
$creadList :: ReadS [ActionState]
readsPrec :: Int -> ReadS ActionState
$creadsPrec :: Int -> ReadS ActionState
Prelude.Read, Int -> ActionState -> ShowS
[ActionState] -> ShowS
ActionState -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActionState] -> ShowS
$cshowList :: [ActionState] -> ShowS
show :: ActionState -> String
$cshow :: ActionState -> String
showsPrec :: Int -> ActionState -> ShowS
$cshowsPrec :: Int -> ActionState -> ShowS
Prelude.Show, forall x. Rep ActionState x -> ActionState
forall x. ActionState -> Rep ActionState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ActionState x -> ActionState
$cfrom :: forall x. ActionState -> Rep ActionState x
Prelude.Generic)

-- |
-- Create a value of 'ActionState' 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:
--
-- 'actionName', 'actionState_actionName' - The name of the action.
--
-- 'currentRevision', 'actionState_currentRevision' - Represents information about the version (or revision) of an action.
--
-- 'entityUrl', 'actionState_entityUrl' - A URL link for more information about the state of the action, such as a
-- deployment group details page.
--
-- 'latestExecution', 'actionState_latestExecution' - Represents information about the run of an action.
--
-- 'revisionUrl', 'actionState_revisionUrl' - A URL link for more information about the revision, such as a commit
-- details page.
newActionState ::
  ActionState
newActionState :: ActionState
newActionState =
  ActionState'
    { $sel:actionName:ActionState' :: Maybe Text
actionName = forall a. Maybe a
Prelude.Nothing,
      $sel:currentRevision:ActionState' :: Maybe ActionRevision
currentRevision = forall a. Maybe a
Prelude.Nothing,
      $sel:entityUrl:ActionState' :: Maybe Text
entityUrl = forall a. Maybe a
Prelude.Nothing,
      $sel:latestExecution:ActionState' :: Maybe ActionExecution
latestExecution = forall a. Maybe a
Prelude.Nothing,
      $sel:revisionUrl:ActionState' :: Maybe Text
revisionUrl = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the action.
actionState_actionName :: Lens.Lens' ActionState (Prelude.Maybe Prelude.Text)
actionState_actionName :: Lens' ActionState (Maybe Text)
actionState_actionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionState' {Maybe Text
actionName :: Maybe Text
$sel:actionName:ActionState' :: ActionState -> Maybe Text
actionName} -> Maybe Text
actionName) (\s :: ActionState
s@ActionState' {} Maybe Text
a -> ActionState
s {$sel:actionName:ActionState' :: Maybe Text
actionName = Maybe Text
a} :: ActionState)

-- | Represents information about the version (or revision) of an action.
actionState_currentRevision :: Lens.Lens' ActionState (Prelude.Maybe ActionRevision)
actionState_currentRevision :: Lens' ActionState (Maybe ActionRevision)
actionState_currentRevision = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionState' {Maybe ActionRevision
currentRevision :: Maybe ActionRevision
$sel:currentRevision:ActionState' :: ActionState -> Maybe ActionRevision
currentRevision} -> Maybe ActionRevision
currentRevision) (\s :: ActionState
s@ActionState' {} Maybe ActionRevision
a -> ActionState
s {$sel:currentRevision:ActionState' :: Maybe ActionRevision
currentRevision = Maybe ActionRevision
a} :: ActionState)

-- | A URL link for more information about the state of the action, such as a
-- deployment group details page.
actionState_entityUrl :: Lens.Lens' ActionState (Prelude.Maybe Prelude.Text)
actionState_entityUrl :: Lens' ActionState (Maybe Text)
actionState_entityUrl = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionState' {Maybe Text
entityUrl :: Maybe Text
$sel:entityUrl:ActionState' :: ActionState -> Maybe Text
entityUrl} -> Maybe Text
entityUrl) (\s :: ActionState
s@ActionState' {} Maybe Text
a -> ActionState
s {$sel:entityUrl:ActionState' :: Maybe Text
entityUrl = Maybe Text
a} :: ActionState)

-- | Represents information about the run of an action.
actionState_latestExecution :: Lens.Lens' ActionState (Prelude.Maybe ActionExecution)
actionState_latestExecution :: Lens' ActionState (Maybe ActionExecution)
actionState_latestExecution = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionState' {Maybe ActionExecution
latestExecution :: Maybe ActionExecution
$sel:latestExecution:ActionState' :: ActionState -> Maybe ActionExecution
latestExecution} -> Maybe ActionExecution
latestExecution) (\s :: ActionState
s@ActionState' {} Maybe ActionExecution
a -> ActionState
s {$sel:latestExecution:ActionState' :: Maybe ActionExecution
latestExecution = Maybe ActionExecution
a} :: ActionState)

-- | A URL link for more information about the revision, such as a commit
-- details page.
actionState_revisionUrl :: Lens.Lens' ActionState (Prelude.Maybe Prelude.Text)
actionState_revisionUrl :: Lens' ActionState (Maybe Text)
actionState_revisionUrl = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionState' {Maybe Text
revisionUrl :: Maybe Text
$sel:revisionUrl:ActionState' :: ActionState -> Maybe Text
revisionUrl} -> Maybe Text
revisionUrl) (\s :: ActionState
s@ActionState' {} Maybe Text
a -> ActionState
s {$sel:revisionUrl:ActionState' :: Maybe Text
revisionUrl = Maybe Text
a} :: ActionState)

instance Data.FromJSON ActionState where
  parseJSON :: Value -> Parser ActionState
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ActionState"
      ( \Object
x ->
          Maybe Text
-> Maybe ActionRevision
-> Maybe Text
-> Maybe ActionExecution
-> Maybe Text
-> ActionState
ActionState'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"actionName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"currentRevision")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"entityUrl")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"latestExecution")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"revisionUrl")
      )

instance Prelude.Hashable ActionState where
  hashWithSalt :: Int -> ActionState -> Int
hashWithSalt Int
_salt ActionState' {Maybe Text
Maybe ActionRevision
Maybe ActionExecution
revisionUrl :: Maybe Text
latestExecution :: Maybe ActionExecution
entityUrl :: Maybe Text
currentRevision :: Maybe ActionRevision
actionName :: Maybe Text
$sel:revisionUrl:ActionState' :: ActionState -> Maybe Text
$sel:latestExecution:ActionState' :: ActionState -> Maybe ActionExecution
$sel:entityUrl:ActionState' :: ActionState -> Maybe Text
$sel:currentRevision:ActionState' :: ActionState -> Maybe ActionRevision
$sel:actionName:ActionState' :: ActionState -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
actionName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ActionRevision
currentRevision
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
entityUrl
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ActionExecution
latestExecution
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
revisionUrl

instance Prelude.NFData ActionState where
  rnf :: ActionState -> ()
rnf ActionState' {Maybe Text
Maybe ActionRevision
Maybe ActionExecution
revisionUrl :: Maybe Text
latestExecution :: Maybe ActionExecution
entityUrl :: Maybe Text
currentRevision :: Maybe ActionRevision
actionName :: Maybe Text
$sel:revisionUrl:ActionState' :: ActionState -> Maybe Text
$sel:latestExecution:ActionState' :: ActionState -> Maybe ActionExecution
$sel:entityUrl:ActionState' :: ActionState -> Maybe Text
$sel:currentRevision:ActionState' :: ActionState -> Maybe ActionRevision
$sel:actionName:ActionState' :: ActionState -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
actionName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ActionRevision
currentRevision
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
entityUrl
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ActionExecution
latestExecution
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
revisionUrl