{-# 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-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.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.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Returns information about the details of an action type.
--
-- /See:/ 'newActionType' smart constructor.
data ActionType = ActionType'
  { -- | The settings for the action type.
    ActionType -> Maybe ActionTypeSettings
settings :: Prelude.Maybe ActionTypeSettings,
    -- | The configuration properties for the action type.
    ActionType -> Maybe [ActionConfigurationProperty]
actionConfigurationProperties :: Prelude.Maybe [ActionConfigurationProperty],
    -- | 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
(ActionType -> ActionType -> Bool)
-> (ActionType -> ActionType -> Bool) -> Eq ActionType
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]
(Int -> ReadS ActionType)
-> ReadS [ActionType]
-> ReadPrec ActionType
-> ReadPrec [ActionType]
-> Read 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
(Int -> ActionType -> ShowS)
-> (ActionType -> String)
-> ([ActionType] -> ShowS)
-> Show ActionType
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. ActionType -> Rep ActionType x)
-> (forall x. Rep ActionType x -> ActionType) -> Generic ActionType
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:
--
-- 'settings', 'actionType_settings' - The settings for the action type.
--
-- 'actionConfigurationProperties', 'actionType_actionConfigurationProperties' - The configuration properties 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' :: Maybe ActionTypeSettings
-> Maybe [ActionConfigurationProperty]
-> ActionTypeId
-> ArtifactDetails
-> ArtifactDetails
-> ActionType
ActionType'
      { $sel:settings:ActionType' :: Maybe ActionTypeSettings
settings = Maybe ActionTypeSettings
forall a. Maybe a
Prelude.Nothing,
        $sel:actionConfigurationProperties:ActionType' :: Maybe [ActionConfigurationProperty]
actionConfigurationProperties = Maybe [ActionConfigurationProperty]
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 settings for the action type.
actionType_settings :: Lens.Lens' ActionType (Prelude.Maybe ActionTypeSettings)
actionType_settings :: (Maybe ActionTypeSettings -> f (Maybe ActionTypeSettings))
-> ActionType -> f ActionType
actionType_settings = (ActionType -> Maybe ActionTypeSettings)
-> (ActionType -> Maybe ActionTypeSettings -> ActionType)
-> Lens
     ActionType
     ActionType
     (Maybe ActionTypeSettings)
     (Maybe ActionTypeSettings)
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)

-- | The configuration properties for the action type.
actionType_actionConfigurationProperties :: Lens.Lens' ActionType (Prelude.Maybe [ActionConfigurationProperty])
actionType_actionConfigurationProperties :: (Maybe [ActionConfigurationProperty]
 -> f (Maybe [ActionConfigurationProperty]))
-> ActionType -> f ActionType
actionType_actionConfigurationProperties = (ActionType -> Maybe [ActionConfigurationProperty])
-> (ActionType
    -> Maybe [ActionConfigurationProperty] -> ActionType)
-> Lens
     ActionType
     ActionType
     (Maybe [ActionConfigurationProperty])
     (Maybe [ActionConfigurationProperty])
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) ((Maybe [ActionConfigurationProperty]
  -> f (Maybe [ActionConfigurationProperty]))
 -> ActionType -> f ActionType)
-> ((Maybe [ActionConfigurationProperty]
     -> f (Maybe [ActionConfigurationProperty]))
    -> Maybe [ActionConfigurationProperty]
    -> f (Maybe [ActionConfigurationProperty]))
-> (Maybe [ActionConfigurationProperty]
    -> f (Maybe [ActionConfigurationProperty]))
-> ActionType
-> f ActionType
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ActionConfigurationProperty]
  [ActionConfigurationProperty]
  [ActionConfigurationProperty]
  [ActionConfigurationProperty]
-> Iso
     (Maybe [ActionConfigurationProperty])
     (Maybe [ActionConfigurationProperty])
     (Maybe [ActionConfigurationProperty])
     (Maybe [ActionConfigurationProperty])
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 AnIso
  [ActionConfigurationProperty]
  [ActionConfigurationProperty]
  [ActionConfigurationProperty]
  [ActionConfigurationProperty]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Represents information about an action type.
actionType_id :: Lens.Lens' ActionType ActionTypeId
actionType_id :: (ActionTypeId -> f ActionTypeId) -> ActionType -> f ActionType
actionType_id = (ActionType -> ActionTypeId)
-> (ActionType -> ActionTypeId -> ActionType)
-> Lens ActionType ActionType ActionTypeId ActionTypeId
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 :: (ArtifactDetails -> f ArtifactDetails)
-> ActionType -> f ActionType
actionType_inputArtifactDetails = (ActionType -> ArtifactDetails)
-> (ActionType -> ArtifactDetails -> ActionType)
-> Lens ActionType ActionType ArtifactDetails ArtifactDetails
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 :: (ArtifactDetails -> f ArtifactDetails)
-> ActionType -> f ActionType
actionType_outputArtifactDetails = (ActionType -> ArtifactDetails)
-> (ActionType -> ArtifactDetails -> ActionType)
-> Lens ActionType ActionType ArtifactDetails ArtifactDetails
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 Core.FromJSON ActionType where
  parseJSON :: Value -> Parser ActionType
parseJSON =
    String
-> (Object -> Parser ActionType) -> Value -> Parser ActionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ActionType"
      ( \Object
x ->
          Maybe ActionTypeSettings
-> Maybe [ActionConfigurationProperty]
-> ActionTypeId
-> ArtifactDetails
-> ArtifactDetails
-> ActionType
ActionType'
            (Maybe ActionTypeSettings
 -> Maybe [ActionConfigurationProperty]
 -> ActionTypeId
 -> ArtifactDetails
 -> ArtifactDetails
 -> ActionType)
-> Parser (Maybe ActionTypeSettings)
-> Parser
     (Maybe [ActionConfigurationProperty]
      -> ActionTypeId
      -> ArtifactDetails
      -> ArtifactDetails
      -> ActionType)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ActionTypeSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"settings")
            Parser
  (Maybe [ActionConfigurationProperty]
   -> ActionTypeId
   -> ArtifactDetails
   -> ArtifactDetails
   -> ActionType)
-> Parser (Maybe [ActionConfigurationProperty])
-> Parser
     (ActionTypeId -> ArtifactDetails -> ArtifactDetails -> ActionType)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text -> Parser (Maybe (Maybe [ActionConfigurationProperty]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"actionConfigurationProperties"
                            Parser (Maybe (Maybe [ActionConfigurationProperty]))
-> Maybe [ActionConfigurationProperty]
-> Parser (Maybe [ActionConfigurationProperty])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ActionConfigurationProperty]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (ActionTypeId -> ArtifactDetails -> ArtifactDetails -> ActionType)
-> Parser ActionTypeId
-> Parser (ArtifactDetails -> ArtifactDetails -> ActionType)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ActionTypeId
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"id")
            Parser (ArtifactDetails -> ArtifactDetails -> ActionType)
-> Parser ArtifactDetails -> Parser (ArtifactDetails -> ActionType)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ArtifactDetails
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"inputArtifactDetails")
            Parser (ArtifactDetails -> ActionType)
-> Parser ArtifactDetails -> Parser ActionType
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ArtifactDetails
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"outputArtifactDetails")
      )

instance Prelude.Hashable ActionType

instance Prelude.NFData ActionType