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

import Amazonka.CodePipeline.Types.ActionCategory
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Specifies the category, owner, provider, and version of the action type.
--
-- /See:/ 'newActionTypeIdentifier' smart constructor.
data ActionTypeIdentifier = ActionTypeIdentifier'
  { -- | Defines what kind of action can be taken in the stage, one of the
    -- following:
    --
    -- -   @Source@
    --
    -- -   @Build@
    --
    -- -   @Test@
    --
    -- -   @Deploy@
    --
    -- -   @Approval@
    --
    -- -   @Invoke@
    ActionTypeIdentifier -> ActionCategory
category :: ActionCategory,
    -- | The creator of the action type being called: @AWS@ or @ThirdParty@.
    ActionTypeIdentifier -> Text
owner :: Prelude.Text,
    -- | The provider of the action type being called. The provider name is
    -- supplied when the action type is created.
    ActionTypeIdentifier -> Text
provider :: Prelude.Text,
    -- | A string that describes the action type version.
    ActionTypeIdentifier -> Text
version :: Prelude.Text
  }
  deriving (ActionTypeIdentifier -> ActionTypeIdentifier -> Bool
(ActionTypeIdentifier -> ActionTypeIdentifier -> Bool)
-> (ActionTypeIdentifier -> ActionTypeIdentifier -> Bool)
-> Eq ActionTypeIdentifier
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActionTypeIdentifier -> ActionTypeIdentifier -> Bool
$c/= :: ActionTypeIdentifier -> ActionTypeIdentifier -> Bool
== :: ActionTypeIdentifier -> ActionTypeIdentifier -> Bool
$c== :: ActionTypeIdentifier -> ActionTypeIdentifier -> Bool
Prelude.Eq, ReadPrec [ActionTypeIdentifier]
ReadPrec ActionTypeIdentifier
Int -> ReadS ActionTypeIdentifier
ReadS [ActionTypeIdentifier]
(Int -> ReadS ActionTypeIdentifier)
-> ReadS [ActionTypeIdentifier]
-> ReadPrec ActionTypeIdentifier
-> ReadPrec [ActionTypeIdentifier]
-> Read ActionTypeIdentifier
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActionTypeIdentifier]
$creadListPrec :: ReadPrec [ActionTypeIdentifier]
readPrec :: ReadPrec ActionTypeIdentifier
$creadPrec :: ReadPrec ActionTypeIdentifier
readList :: ReadS [ActionTypeIdentifier]
$creadList :: ReadS [ActionTypeIdentifier]
readsPrec :: Int -> ReadS ActionTypeIdentifier
$creadsPrec :: Int -> ReadS ActionTypeIdentifier
Prelude.Read, Int -> ActionTypeIdentifier -> ShowS
[ActionTypeIdentifier] -> ShowS
ActionTypeIdentifier -> String
(Int -> ActionTypeIdentifier -> ShowS)
-> (ActionTypeIdentifier -> String)
-> ([ActionTypeIdentifier] -> ShowS)
-> Show ActionTypeIdentifier
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActionTypeIdentifier] -> ShowS
$cshowList :: [ActionTypeIdentifier] -> ShowS
show :: ActionTypeIdentifier -> String
$cshow :: ActionTypeIdentifier -> String
showsPrec :: Int -> ActionTypeIdentifier -> ShowS
$cshowsPrec :: Int -> ActionTypeIdentifier -> ShowS
Prelude.Show, (forall x. ActionTypeIdentifier -> Rep ActionTypeIdentifier x)
-> (forall x. Rep ActionTypeIdentifier x -> ActionTypeIdentifier)
-> Generic ActionTypeIdentifier
forall x. Rep ActionTypeIdentifier x -> ActionTypeIdentifier
forall x. ActionTypeIdentifier -> Rep ActionTypeIdentifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ActionTypeIdentifier x -> ActionTypeIdentifier
$cfrom :: forall x. ActionTypeIdentifier -> Rep ActionTypeIdentifier x
Prelude.Generic)

-- |
-- Create a value of 'ActionTypeIdentifier' 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:
--
-- 'category', 'actionTypeIdentifier_category' - Defines what kind of action can be taken in the stage, one of the
-- following:
--
-- -   @Source@
--
-- -   @Build@
--
-- -   @Test@
--
-- -   @Deploy@
--
-- -   @Approval@
--
-- -   @Invoke@
--
-- 'owner', 'actionTypeIdentifier_owner' - The creator of the action type being called: @AWS@ or @ThirdParty@.
--
-- 'provider', 'actionTypeIdentifier_provider' - The provider of the action type being called. The provider name is
-- supplied when the action type is created.
--
-- 'version', 'actionTypeIdentifier_version' - A string that describes the action type version.
newActionTypeIdentifier ::
  -- | 'category'
  ActionCategory ->
  -- | 'owner'
  Prelude.Text ->
  -- | 'provider'
  Prelude.Text ->
  -- | 'version'
  Prelude.Text ->
  ActionTypeIdentifier
newActionTypeIdentifier :: ActionCategory -> Text -> Text -> Text -> ActionTypeIdentifier
newActionTypeIdentifier
  ActionCategory
pCategory_
  Text
pOwner_
  Text
pProvider_
  Text
pVersion_ =
    ActionTypeIdentifier' :: ActionCategory -> Text -> Text -> Text -> ActionTypeIdentifier
ActionTypeIdentifier'
      { $sel:category:ActionTypeIdentifier' :: ActionCategory
category = ActionCategory
pCategory_,
        $sel:owner:ActionTypeIdentifier' :: Text
owner = Text
pOwner_,
        $sel:provider:ActionTypeIdentifier' :: Text
provider = Text
pProvider_,
        $sel:version:ActionTypeIdentifier' :: Text
version = Text
pVersion_
      }

-- | Defines what kind of action can be taken in the stage, one of the
-- following:
--
-- -   @Source@
--
-- -   @Build@
--
-- -   @Test@
--
-- -   @Deploy@
--
-- -   @Approval@
--
-- -   @Invoke@
actionTypeIdentifier_category :: Lens.Lens' ActionTypeIdentifier ActionCategory
actionTypeIdentifier_category :: (ActionCategory -> f ActionCategory)
-> ActionTypeIdentifier -> f ActionTypeIdentifier
actionTypeIdentifier_category = (ActionTypeIdentifier -> ActionCategory)
-> (ActionTypeIdentifier -> ActionCategory -> ActionTypeIdentifier)
-> Lens
     ActionTypeIdentifier
     ActionTypeIdentifier
     ActionCategory
     ActionCategory
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionTypeIdentifier' {ActionCategory
category :: ActionCategory
$sel:category:ActionTypeIdentifier' :: ActionTypeIdentifier -> ActionCategory
category} -> ActionCategory
category) (\s :: ActionTypeIdentifier
s@ActionTypeIdentifier' {} ActionCategory
a -> ActionTypeIdentifier
s {$sel:category:ActionTypeIdentifier' :: ActionCategory
category = ActionCategory
a} :: ActionTypeIdentifier)

-- | The creator of the action type being called: @AWS@ or @ThirdParty@.
actionTypeIdentifier_owner :: Lens.Lens' ActionTypeIdentifier Prelude.Text
actionTypeIdentifier_owner :: (Text -> f Text) -> ActionTypeIdentifier -> f ActionTypeIdentifier
actionTypeIdentifier_owner = (ActionTypeIdentifier -> Text)
-> (ActionTypeIdentifier -> Text -> ActionTypeIdentifier)
-> Lens ActionTypeIdentifier ActionTypeIdentifier Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionTypeIdentifier' {Text
owner :: Text
$sel:owner:ActionTypeIdentifier' :: ActionTypeIdentifier -> Text
owner} -> Text
owner) (\s :: ActionTypeIdentifier
s@ActionTypeIdentifier' {} Text
a -> ActionTypeIdentifier
s {$sel:owner:ActionTypeIdentifier' :: Text
owner = Text
a} :: ActionTypeIdentifier)

-- | The provider of the action type being called. The provider name is
-- supplied when the action type is created.
actionTypeIdentifier_provider :: Lens.Lens' ActionTypeIdentifier Prelude.Text
actionTypeIdentifier_provider :: (Text -> f Text) -> ActionTypeIdentifier -> f ActionTypeIdentifier
actionTypeIdentifier_provider = (ActionTypeIdentifier -> Text)
-> (ActionTypeIdentifier -> Text -> ActionTypeIdentifier)
-> Lens ActionTypeIdentifier ActionTypeIdentifier Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionTypeIdentifier' {Text
provider :: Text
$sel:provider:ActionTypeIdentifier' :: ActionTypeIdentifier -> Text
provider} -> Text
provider) (\s :: ActionTypeIdentifier
s@ActionTypeIdentifier' {} Text
a -> ActionTypeIdentifier
s {$sel:provider:ActionTypeIdentifier' :: Text
provider = Text
a} :: ActionTypeIdentifier)

-- | A string that describes the action type version.
actionTypeIdentifier_version :: Lens.Lens' ActionTypeIdentifier Prelude.Text
actionTypeIdentifier_version :: (Text -> f Text) -> ActionTypeIdentifier -> f ActionTypeIdentifier
actionTypeIdentifier_version = (ActionTypeIdentifier -> Text)
-> (ActionTypeIdentifier -> Text -> ActionTypeIdentifier)
-> Lens ActionTypeIdentifier ActionTypeIdentifier Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionTypeIdentifier' {Text
version :: Text
$sel:version:ActionTypeIdentifier' :: ActionTypeIdentifier -> Text
version} -> Text
version) (\s :: ActionTypeIdentifier
s@ActionTypeIdentifier' {} Text
a -> ActionTypeIdentifier
s {$sel:version:ActionTypeIdentifier' :: Text
version = Text
a} :: ActionTypeIdentifier)

instance Core.FromJSON ActionTypeIdentifier where
  parseJSON :: Value -> Parser ActionTypeIdentifier
parseJSON =
    String
-> (Object -> Parser ActionTypeIdentifier)
-> Value
-> Parser ActionTypeIdentifier
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ActionTypeIdentifier"
      ( \Object
x ->
          ActionCategory -> Text -> Text -> Text -> ActionTypeIdentifier
ActionTypeIdentifier'
            (ActionCategory -> Text -> Text -> Text -> ActionTypeIdentifier)
-> Parser ActionCategory
-> Parser (Text -> Text -> Text -> ActionTypeIdentifier)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser ActionCategory
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"category")
            Parser (Text -> Text -> Text -> ActionTypeIdentifier)
-> Parser Text -> Parser (Text -> Text -> ActionTypeIdentifier)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"owner")
            Parser (Text -> Text -> ActionTypeIdentifier)
-> Parser Text -> Parser (Text -> ActionTypeIdentifier)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"provider")
            Parser (Text -> ActionTypeIdentifier)
-> Parser Text -> Parser ActionTypeIdentifier
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"version")
      )

instance Prelude.Hashable ActionTypeIdentifier

instance Prelude.NFData ActionTypeIdentifier

instance Core.ToJSON ActionTypeIdentifier where
  toJSON :: ActionTypeIdentifier -> Value
toJSON ActionTypeIdentifier' {Text
ActionCategory
version :: Text
provider :: Text
owner :: Text
category :: ActionCategory
$sel:version:ActionTypeIdentifier' :: ActionTypeIdentifier -> Text
$sel:provider:ActionTypeIdentifier' :: ActionTypeIdentifier -> Text
$sel:owner:ActionTypeIdentifier' :: ActionTypeIdentifier -> Text
$sel:category:ActionTypeIdentifier' :: ActionTypeIdentifier -> ActionCategory
..} =
    [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
"category" Text -> ActionCategory -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ActionCategory
category),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"owner" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
owner),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"provider" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
provider),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"version" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
version)
          ]
      )