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

import Amazonka.CodePipeline.Types.ActionConfigurationProperty
import Amazonka.CodePipeline.Types.ActionTypeId
import Amazonka.CodePipeline.Types.ActionTypeSettings
import Amazonka.CodePipeline.Types.ArtifactDetails
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

-- | Returns information about the details of an action type.
--
-- /See:/ 'newActionType' smart constructor.
data ActionType = ActionType'
  { -- | The configuration properties for the action type.
    ActionType -> Maybe [ActionConfigurationProperty]
actionConfigurationProperties :: Prelude.Maybe [ActionConfigurationProperty],
    -- | The settings for the action type.
    ActionType -> Maybe ActionTypeSettings
settings :: Prelude.Maybe ActionTypeSettings,
    -- | Represents information about an action type.
    ActionType -> ActionTypeId
id :: ActionTypeId,
    -- | The details of the input artifact for the action, such as its commit ID.
    ActionType -> ArtifactDetails
inputArtifactDetails :: ArtifactDetails,
    -- | The details of the output artifact of the action, such as its commit ID.
    ActionType -> ArtifactDetails
outputArtifactDetails :: ArtifactDetails
  }
  deriving (ActionType -> ActionType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActionType -> ActionType -> Bool
$c/= :: ActionType -> ActionType -> Bool
== :: ActionType -> ActionType -> Bool
$c== :: ActionType -> ActionType -> Bool
Prelude.Eq, ReadPrec [ActionType]
ReadPrec ActionType
Int -> ReadS ActionType
ReadS [ActionType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActionType]
$creadListPrec :: ReadPrec [ActionType]
readPrec :: ReadPrec ActionType
$creadPrec :: ReadPrec ActionType
readList :: ReadS [ActionType]
$creadList :: ReadS [ActionType]
readsPrec :: Int -> ReadS ActionType
$creadsPrec :: Int -> ReadS ActionType
Prelude.Read, Int -> ActionType -> ShowS
[ActionType] -> ShowS
ActionType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActionType] -> ShowS
$cshowList :: [ActionType] -> ShowS
show :: ActionType -> String
$cshow :: ActionType -> String
showsPrec :: Int -> ActionType -> ShowS
$cshowsPrec :: Int -> ActionType -> ShowS
Prelude.Show, forall x. Rep ActionType x -> ActionType
forall x. ActionType -> Rep ActionType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ActionType x -> ActionType
$cfrom :: forall x. ActionType -> Rep ActionType x
Prelude.Generic)

-- |
-- Create a value of 'ActionType' 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:
--
-- 'actionConfigurationProperties', 'actionType_actionConfigurationProperties' - The configuration properties for the action type.
--
-- 'settings', 'actionType_settings' - The settings for the action type.
--
-- 'id', 'actionType_id' - Represents information about an action type.
--
-- 'inputArtifactDetails', 'actionType_inputArtifactDetails' - The details of the input artifact for the action, such as its commit ID.
--
-- 'outputArtifactDetails', 'actionType_outputArtifactDetails' - The details of the output artifact of the action, such as its commit ID.
newActionType ::
  -- | 'id'
  ActionTypeId ->
  -- | 'inputArtifactDetails'
  ArtifactDetails ->
  -- | 'outputArtifactDetails'
  ArtifactDetails ->
  ActionType
newActionType :: ActionTypeId -> ArtifactDetails -> ArtifactDetails -> ActionType
newActionType
  ActionTypeId
pId_
  ArtifactDetails
pInputArtifactDetails_
  ArtifactDetails
pOutputArtifactDetails_ =
    ActionType'
      { $sel:actionConfigurationProperties:ActionType' :: Maybe [ActionConfigurationProperty]
actionConfigurationProperties =
          forall a. Maybe a
Prelude.Nothing,
        $sel:settings:ActionType' :: Maybe ActionTypeSettings
settings = forall a. Maybe a
Prelude.Nothing,
        $sel:id:ActionType' :: ActionTypeId
id = ActionTypeId
pId_,
        $sel:inputArtifactDetails:ActionType' :: ArtifactDetails
inputArtifactDetails = ArtifactDetails
pInputArtifactDetails_,
        $sel:outputArtifactDetails:ActionType' :: ArtifactDetails
outputArtifactDetails = ArtifactDetails
pOutputArtifactDetails_
      }

-- | The configuration properties for the action type.
actionType_actionConfigurationProperties :: Lens.Lens' ActionType (Prelude.Maybe [ActionConfigurationProperty])
actionType_actionConfigurationProperties :: Lens' ActionType (Maybe [ActionConfigurationProperty])
actionType_actionConfigurationProperties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionType' {Maybe [ActionConfigurationProperty]
actionConfigurationProperties :: Maybe [ActionConfigurationProperty]
$sel:actionConfigurationProperties:ActionType' :: ActionType -> Maybe [ActionConfigurationProperty]
actionConfigurationProperties} -> Maybe [ActionConfigurationProperty]
actionConfigurationProperties) (\s :: ActionType
s@ActionType' {} Maybe [ActionConfigurationProperty]
a -> ActionType
s {$sel:actionConfigurationProperties:ActionType' :: Maybe [ActionConfigurationProperty]
actionConfigurationProperties = Maybe [ActionConfigurationProperty]
a} :: ActionType) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The settings for the action type.
actionType_settings :: Lens.Lens' ActionType (Prelude.Maybe ActionTypeSettings)
actionType_settings :: Lens' ActionType (Maybe ActionTypeSettings)
actionType_settings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionType' {Maybe ActionTypeSettings
settings :: Maybe ActionTypeSettings
$sel:settings:ActionType' :: ActionType -> Maybe ActionTypeSettings
settings} -> Maybe ActionTypeSettings
settings) (\s :: ActionType
s@ActionType' {} Maybe ActionTypeSettings
a -> ActionType
s {$sel:settings:ActionType' :: Maybe ActionTypeSettings
settings = Maybe ActionTypeSettings
a} :: ActionType)

-- | Represents information about an action type.
actionType_id :: Lens.Lens' ActionType ActionTypeId
actionType_id :: Lens' ActionType ActionTypeId
actionType_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionType' {ActionTypeId
id :: ActionTypeId
$sel:id:ActionType' :: ActionType -> ActionTypeId
id} -> ActionTypeId
id) (\s :: ActionType
s@ActionType' {} ActionTypeId
a -> ActionType
s {$sel:id:ActionType' :: ActionTypeId
id = ActionTypeId
a} :: ActionType)

-- | The details of the input artifact for the action, such as its commit ID.
actionType_inputArtifactDetails :: Lens.Lens' ActionType ArtifactDetails
actionType_inputArtifactDetails :: Lens' ActionType ArtifactDetails
actionType_inputArtifactDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionType' {ArtifactDetails
inputArtifactDetails :: ArtifactDetails
$sel:inputArtifactDetails:ActionType' :: ActionType -> ArtifactDetails
inputArtifactDetails} -> ArtifactDetails
inputArtifactDetails) (\s :: ActionType
s@ActionType' {} ArtifactDetails
a -> ActionType
s {$sel:inputArtifactDetails:ActionType' :: ArtifactDetails
inputArtifactDetails = ArtifactDetails
a} :: ActionType)

-- | The details of the output artifact of the action, such as its commit ID.
actionType_outputArtifactDetails :: Lens.Lens' ActionType ArtifactDetails
actionType_outputArtifactDetails :: Lens' ActionType ArtifactDetails
actionType_outputArtifactDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionType' {ArtifactDetails
outputArtifactDetails :: ArtifactDetails
$sel:outputArtifactDetails:ActionType' :: ActionType -> ArtifactDetails
outputArtifactDetails} -> ArtifactDetails
outputArtifactDetails) (\s :: ActionType
s@ActionType' {} ArtifactDetails
a -> ActionType
s {$sel:outputArtifactDetails:ActionType' :: ArtifactDetails
outputArtifactDetails = ArtifactDetails
a} :: ActionType)

instance Data.FromJSON ActionType where
  parseJSON :: Value -> Parser ActionType
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ActionType"
      ( \Object
x ->
          Maybe [ActionConfigurationProperty]
-> Maybe ActionTypeSettings
-> ActionTypeId
-> ArtifactDetails
-> ArtifactDetails
-> ActionType
ActionType'
            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
"actionConfigurationProperties"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"settings")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"id")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"inputArtifactDetails")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"outputArtifactDetails")
      )

instance Prelude.Hashable ActionType where
  hashWithSalt :: Int -> ActionType -> Int
hashWithSalt Int
_salt ActionType' {Maybe [ActionConfigurationProperty]
Maybe ActionTypeSettings
ActionTypeId
ArtifactDetails
outputArtifactDetails :: ArtifactDetails
inputArtifactDetails :: ArtifactDetails
id :: ActionTypeId
settings :: Maybe ActionTypeSettings
actionConfigurationProperties :: Maybe [ActionConfigurationProperty]
$sel:outputArtifactDetails:ActionType' :: ActionType -> ArtifactDetails
$sel:inputArtifactDetails:ActionType' :: ActionType -> ArtifactDetails
$sel:id:ActionType' :: ActionType -> ActionTypeId
$sel:settings:ActionType' :: ActionType -> Maybe ActionTypeSettings
$sel:actionConfigurationProperties:ActionType' :: ActionType -> Maybe [ActionConfigurationProperty]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ActionConfigurationProperty]
actionConfigurationProperties
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ActionTypeSettings
settings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ActionTypeId
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ArtifactDetails
inputArtifactDetails
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ArtifactDetails
outputArtifactDetails

instance Prelude.NFData ActionType where
  rnf :: ActionType -> ()
rnf ActionType' {Maybe [ActionConfigurationProperty]
Maybe ActionTypeSettings
ActionTypeId
ArtifactDetails
outputArtifactDetails :: ArtifactDetails
inputArtifactDetails :: ArtifactDetails
id :: ActionTypeId
settings :: Maybe ActionTypeSettings
actionConfigurationProperties :: Maybe [ActionConfigurationProperty]
$sel:outputArtifactDetails:ActionType' :: ActionType -> ArtifactDetails
$sel:inputArtifactDetails:ActionType' :: ActionType -> ArtifactDetails
$sel:id:ActionType' :: ActionType -> ActionTypeId
$sel:settings:ActionType' :: ActionType -> Maybe ActionTypeSettings
$sel:actionConfigurationProperties:ActionType' :: ActionType -> Maybe [ActionConfigurationProperty]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [ActionConfigurationProperty]
actionConfigurationProperties
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ActionTypeSettings
settings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ActionTypeId
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ArtifactDetails
inputArtifactDetails
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ArtifactDetails
outputArtifactDetails