{-# 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.CodeSource
-- 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.CodeSource 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 location where the source code files provided with the project
-- request are stored. AWS CodeStar retrieves the files during project
-- creation.
--
-- /See:/ 'newCodeSource' smart constructor.
data CodeSource = CodeSource'
  { -- | Information about the Amazon S3 location where the source code files
    -- provided with the project request are stored.
    CodeSource -> S3Location
s3 :: S3Location
  }
  deriving (CodeSource -> CodeSource -> Bool
(CodeSource -> CodeSource -> Bool)
-> (CodeSource -> CodeSource -> Bool) -> Eq CodeSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CodeSource -> CodeSource -> Bool
$c/= :: CodeSource -> CodeSource -> Bool
== :: CodeSource -> CodeSource -> Bool
$c== :: CodeSource -> CodeSource -> Bool
Prelude.Eq, ReadPrec [CodeSource]
ReadPrec CodeSource
Int -> ReadS CodeSource
ReadS [CodeSource]
(Int -> ReadS CodeSource)
-> ReadS [CodeSource]
-> ReadPrec CodeSource
-> ReadPrec [CodeSource]
-> Read CodeSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CodeSource]
$creadListPrec :: ReadPrec [CodeSource]
readPrec :: ReadPrec CodeSource
$creadPrec :: ReadPrec CodeSource
readList :: ReadS [CodeSource]
$creadList :: ReadS [CodeSource]
readsPrec :: Int -> ReadS CodeSource
$creadsPrec :: Int -> ReadS CodeSource
Prelude.Read, Int -> CodeSource -> ShowS
[CodeSource] -> ShowS
CodeSource -> String
(Int -> CodeSource -> ShowS)
-> (CodeSource -> String)
-> ([CodeSource] -> ShowS)
-> Show CodeSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CodeSource] -> ShowS
$cshowList :: [CodeSource] -> ShowS
show :: CodeSource -> String
$cshow :: CodeSource -> String
showsPrec :: Int -> CodeSource -> ShowS
$cshowsPrec :: Int -> CodeSource -> ShowS
Prelude.Show, (forall x. CodeSource -> Rep CodeSource x)
-> (forall x. Rep CodeSource x -> CodeSource) -> Generic CodeSource
forall x. Rep CodeSource x -> CodeSource
forall x. CodeSource -> Rep CodeSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CodeSource x -> CodeSource
$cfrom :: forall x. CodeSource -> Rep CodeSource x
Prelude.Generic)

-- |
-- Create a value of 'CodeSource' 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', 'codeSource_s3' - Information about the Amazon S3 location where the source code files
-- provided with the project request are stored.
newCodeSource ::
  -- | 's3'
  S3Location ->
  CodeSource
newCodeSource :: S3Location -> CodeSource
newCodeSource S3Location
pS3_ = CodeSource' :: S3Location -> CodeSource
CodeSource' {$sel:s3:CodeSource' :: S3Location
s3 = S3Location
pS3_}

-- | Information about the Amazon S3 location where the source code files
-- provided with the project request are stored.
codeSource_s3 :: Lens.Lens' CodeSource S3Location
codeSource_s3 :: (S3Location -> f S3Location) -> CodeSource -> f CodeSource
codeSource_s3 = (CodeSource -> S3Location)
-> (CodeSource -> S3Location -> CodeSource)
-> Lens CodeSource CodeSource S3Location S3Location
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeSource' {S3Location
s3 :: S3Location
$sel:s3:CodeSource' :: CodeSource -> S3Location
s3} -> S3Location
s3) (\s :: CodeSource
s@CodeSource' {} S3Location
a -> CodeSource
s {$sel:s3:CodeSource' :: S3Location
s3 = S3Location
a} :: CodeSource)

instance Prelude.Hashable CodeSource

instance Prelude.NFData CodeSource

instance Core.ToJSON CodeSource where
  toJSON :: CodeSource -> Value
toJSON CodeSource' {S3Location
s3 :: S3Location
$sel:s3:CodeSource' :: CodeSource -> 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)])