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

import Amazonka.CodeStar.Types.S3Location
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The Amazon S3 location where the toolchain template file provided with
-- the project request is stored. AWS CodeStar retrieves the file during
-- project creation.
--
-- /See:/ 'newToolchainSource' smart constructor.
data ToolchainSource = ToolchainSource'
  { -- | The Amazon S3 bucket where the toolchain template file provided with the
    -- project request is stored.
    ToolchainSource -> S3Location
s3 :: S3Location
  }
  deriving (ToolchainSource -> ToolchainSource -> Bool
(ToolchainSource -> ToolchainSource -> Bool)
-> (ToolchainSource -> ToolchainSource -> Bool)
-> Eq ToolchainSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ToolchainSource -> ToolchainSource -> Bool
$c/= :: ToolchainSource -> ToolchainSource -> Bool
== :: ToolchainSource -> ToolchainSource -> Bool
$c== :: ToolchainSource -> ToolchainSource -> Bool
Prelude.Eq, ReadPrec [ToolchainSource]
ReadPrec ToolchainSource
Int -> ReadS ToolchainSource
ReadS [ToolchainSource]
(Int -> ReadS ToolchainSource)
-> ReadS [ToolchainSource]
-> ReadPrec ToolchainSource
-> ReadPrec [ToolchainSource]
-> Read ToolchainSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ToolchainSource]
$creadListPrec :: ReadPrec [ToolchainSource]
readPrec :: ReadPrec ToolchainSource
$creadPrec :: ReadPrec ToolchainSource
readList :: ReadS [ToolchainSource]
$creadList :: ReadS [ToolchainSource]
readsPrec :: Int -> ReadS ToolchainSource
$creadsPrec :: Int -> ReadS ToolchainSource
Prelude.Read, Int -> ToolchainSource -> ShowS
[ToolchainSource] -> ShowS
ToolchainSource -> String
(Int -> ToolchainSource -> ShowS)
-> (ToolchainSource -> String)
-> ([ToolchainSource] -> ShowS)
-> Show ToolchainSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ToolchainSource] -> ShowS
$cshowList :: [ToolchainSource] -> ShowS
show :: ToolchainSource -> String
$cshow :: ToolchainSource -> String
showsPrec :: Int -> ToolchainSource -> ShowS
$cshowsPrec :: Int -> ToolchainSource -> ShowS
Prelude.Show, (forall x. ToolchainSource -> Rep ToolchainSource x)
-> (forall x. Rep ToolchainSource x -> ToolchainSource)
-> Generic ToolchainSource
forall x. Rep ToolchainSource x -> ToolchainSource
forall x. ToolchainSource -> Rep ToolchainSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ToolchainSource x -> ToolchainSource
$cfrom :: forall x. ToolchainSource -> Rep ToolchainSource x
Prelude.Generic)

-- |
-- Create a value of 'ToolchainSource' 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:
--
-- 's3', 'toolchainSource_s3' - The Amazon S3 bucket where the toolchain template file provided with the
-- project request is stored.
newToolchainSource ::
  -- | 's3'
  S3Location ->
  ToolchainSource
newToolchainSource :: S3Location -> ToolchainSource
newToolchainSource S3Location
pS3_ = ToolchainSource' :: S3Location -> ToolchainSource
ToolchainSource' {$sel:s3:ToolchainSource' :: S3Location
s3 = S3Location
pS3_}

-- | The Amazon S3 bucket where the toolchain template file provided with the
-- project request is stored.
toolchainSource_s3 :: Lens.Lens' ToolchainSource S3Location
toolchainSource_s3 :: (S3Location -> f S3Location)
-> ToolchainSource -> f ToolchainSource
toolchainSource_s3 = (ToolchainSource -> S3Location)
-> (ToolchainSource -> S3Location -> ToolchainSource)
-> Lens ToolchainSource ToolchainSource S3Location S3Location
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ToolchainSource' {S3Location
s3 :: S3Location
$sel:s3:ToolchainSource' :: ToolchainSource -> S3Location
s3} -> S3Location
s3) (\s :: ToolchainSource
s@ToolchainSource' {} S3Location
a -> ToolchainSource
s {$sel:s3:ToolchainSource' :: S3Location
s3 = S3Location
a} :: ToolchainSource)

instance Prelude.Hashable ToolchainSource

instance Prelude.NFData ToolchainSource

instance Core.ToJSON ToolchainSource where
  toJSON :: ToolchainSource -> Value
toJSON ToolchainSource' {S3Location
s3 :: S3Location
$sel:s3:ToolchainSource' :: ToolchainSource -> S3Location
..} =
    [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
"s3" Text -> S3Location -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= S3Location
s3)])