{-# 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.CodeStar.Types.Toolchain
-- 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.CodeStar.Types.Toolchain where

import Amazonka.CodeStar.Types.ToolchainSource
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

-- | The toolchain template file provided with the project request. AWS
-- CodeStar uses the template to provision the toolchain stack in AWS
-- CloudFormation.
--
-- /See:/ 'newToolchain' smart constructor.
data Toolchain = Toolchain'
  { -- | The service role ARN for AWS CodeStar to use for the toolchain template
    -- during stack provisioning.
    Toolchain -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text,
    -- | The list of parameter overrides to be passed into the toolchain template
    -- during stack provisioning, if any.
    Toolchain -> Maybe (HashMap Text (Sensitive Text))
stackParameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text (Data.Sensitive Prelude.Text)),
    -- | The Amazon S3 location where the toolchain template file provided with
    -- the project request is stored. AWS CodeStar retrieves the file during
    -- project creation.
    Toolchain -> ToolchainSource
source :: ToolchainSource
  }
  deriving (Toolchain -> Toolchain -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Toolchain -> Toolchain -> Bool
$c/= :: Toolchain -> Toolchain -> Bool
== :: Toolchain -> Toolchain -> Bool
$c== :: Toolchain -> Toolchain -> Bool
Prelude.Eq, Int -> Toolchain -> ShowS
[Toolchain] -> ShowS
Toolchain -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Toolchain] -> ShowS
$cshowList :: [Toolchain] -> ShowS
show :: Toolchain -> String
$cshow :: Toolchain -> String
showsPrec :: Int -> Toolchain -> ShowS
$cshowsPrec :: Int -> Toolchain -> ShowS
Prelude.Show, forall x. Rep Toolchain x -> Toolchain
forall x. Toolchain -> Rep Toolchain x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Toolchain x -> Toolchain
$cfrom :: forall x. Toolchain -> Rep Toolchain x
Prelude.Generic)

-- |
-- Create a value of 'Toolchain' 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:
--
-- 'roleArn', 'toolchain_roleArn' - The service role ARN for AWS CodeStar to use for the toolchain template
-- during stack provisioning.
--
-- 'stackParameters', 'toolchain_stackParameters' - The list of parameter overrides to be passed into the toolchain template
-- during stack provisioning, if any.
--
-- 'source', 'toolchain_source' - The Amazon S3 location where the toolchain template file provided with
-- the project request is stored. AWS CodeStar retrieves the file during
-- project creation.
newToolchain ::
  -- | 'source'
  ToolchainSource ->
  Toolchain
newToolchain :: ToolchainSource -> Toolchain
newToolchain ToolchainSource
pSource_ =
  Toolchain'
    { $sel:roleArn:Toolchain' :: Maybe Text
roleArn = forall a. Maybe a
Prelude.Nothing,
      $sel:stackParameters:Toolchain' :: Maybe (HashMap Text (Sensitive Text))
stackParameters = forall a. Maybe a
Prelude.Nothing,
      $sel:source:Toolchain' :: ToolchainSource
source = ToolchainSource
pSource_
    }

-- | The service role ARN for AWS CodeStar to use for the toolchain template
-- during stack provisioning.
toolchain_roleArn :: Lens.Lens' Toolchain (Prelude.Maybe Prelude.Text)
toolchain_roleArn :: Lens' Toolchain (Maybe Text)
toolchain_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Toolchain' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:Toolchain' :: Toolchain -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: Toolchain
s@Toolchain' {} Maybe Text
a -> Toolchain
s {$sel:roleArn:Toolchain' :: Maybe Text
roleArn = Maybe Text
a} :: Toolchain)

-- | The list of parameter overrides to be passed into the toolchain template
-- during stack provisioning, if any.
toolchain_stackParameters :: Lens.Lens' Toolchain (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
toolchain_stackParameters :: Lens' Toolchain (Maybe (HashMap Text Text))
toolchain_stackParameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Toolchain' {Maybe (HashMap Text (Sensitive Text))
stackParameters :: Maybe (HashMap Text (Sensitive Text))
$sel:stackParameters:Toolchain' :: Toolchain -> Maybe (HashMap Text (Sensitive Text))
stackParameters} -> Maybe (HashMap Text (Sensitive Text))
stackParameters) (\s :: Toolchain
s@Toolchain' {} Maybe (HashMap Text (Sensitive Text))
a -> Toolchain
s {$sel:stackParameters:Toolchain' :: Maybe (HashMap Text (Sensitive Text))
stackParameters = Maybe (HashMap Text (Sensitive Text))
a} :: Toolchain) 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 Amazon S3 location where the toolchain template file provided with
-- the project request is stored. AWS CodeStar retrieves the file during
-- project creation.
toolchain_source :: Lens.Lens' Toolchain ToolchainSource
toolchain_source :: Lens' Toolchain ToolchainSource
toolchain_source = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Toolchain' {ToolchainSource
source :: ToolchainSource
$sel:source:Toolchain' :: Toolchain -> ToolchainSource
source} -> ToolchainSource
source) (\s :: Toolchain
s@Toolchain' {} ToolchainSource
a -> Toolchain
s {$sel:source:Toolchain' :: ToolchainSource
source = ToolchainSource
a} :: Toolchain)

instance Prelude.Hashable Toolchain where
  hashWithSalt :: Int -> Toolchain -> Int
hashWithSalt Int
_salt Toolchain' {Maybe Text
Maybe (HashMap Text (Sensitive Text))
ToolchainSource
source :: ToolchainSource
stackParameters :: Maybe (HashMap Text (Sensitive Text))
roleArn :: Maybe Text
$sel:source:Toolchain' :: Toolchain -> ToolchainSource
$sel:stackParameters:Toolchain' :: Toolchain -> Maybe (HashMap Text (Sensitive Text))
$sel:roleArn:Toolchain' :: Toolchain -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
roleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text (Sensitive Text))
stackParameters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ToolchainSource
source

instance Prelude.NFData Toolchain where
  rnf :: Toolchain -> ()
rnf Toolchain' {Maybe Text
Maybe (HashMap Text (Sensitive Text))
ToolchainSource
source :: ToolchainSource
stackParameters :: Maybe (HashMap Text (Sensitive Text))
roleArn :: Maybe Text
$sel:source:Toolchain' :: Toolchain -> ToolchainSource
$sel:stackParameters:Toolchain' :: Toolchain -> Maybe (HashMap Text (Sensitive Text))
$sel:roleArn:Toolchain' :: Toolchain -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
roleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text (Sensitive Text))
stackParameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ToolchainSource
source

instance Data.ToJSON Toolchain where
  toJSON :: Toolchain -> Value
toJSON Toolchain' {Maybe Text
Maybe (HashMap Text (Sensitive Text))
ToolchainSource
source :: ToolchainSource
stackParameters :: Maybe (HashMap Text (Sensitive Text))
roleArn :: Maybe Text
$sel:source:Toolchain' :: Toolchain -> ToolchainSource
$sel:stackParameters:Toolchain' :: Toolchain -> Maybe (HashMap Text (Sensitive Text))
$sel:roleArn:Toolchain' :: Toolchain -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"roleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
roleArn,
            (Key
"stackParameters" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text (Sensitive Text))
stackParameters,
            forall a. a -> Maybe a
Prelude.Just (Key
"source" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ToolchainSource
source)
          ]
      )