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

import Amazonka.CodeStar.Types.S3Location
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 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
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]
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
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. 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' {$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 :: Lens' ToolchainSource S3Location
toolchainSource_s3 = 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 where
  hashWithSalt :: Int -> ToolchainSource -> Int
hashWithSalt Int
_salt ToolchainSource' {S3Location
s3 :: S3Location
$sel:s3:ToolchainSource' :: ToolchainSource -> S3Location
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` S3Location
s3

instance Prelude.NFData ToolchainSource where
  rnf :: ToolchainSource -> ()
rnf ToolchainSource' {S3Location
s3 :: S3Location
$sel:s3:ToolchainSource' :: ToolchainSource -> S3Location
..} = forall a. NFData a => a -> ()
Prelude.rnf S3Location
s3

instance Data.ToJSON ToolchainSource where
  toJSON :: ToolchainSource -> Value
toJSON ToolchainSource' {S3Location
s3 :: S3Location
$sel:s3:ToolchainSource' :: ToolchainSource -> S3Location
..} =
    [Pair] -> Value
Data.object
      (forall a. [Maybe a] -> [a]
Prelude.catMaybes [forall a. a -> Maybe a
Prelude.Just (Key
"s3" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= S3Location
s3)])