{-# 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.SecurityHub.Types.AwsCodeBuildProjectSource
-- 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.SecurityHub.Types.AwsCodeBuildProjectSource where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the build input source code for this build project.
--
-- /See:/ 'newAwsCodeBuildProjectSource' smart constructor.
data AwsCodeBuildProjectSource = AwsCodeBuildProjectSource'
  { -- | Whether to ignore SSL warnings while connecting to the project source
    -- code.
    AwsCodeBuildProjectSource -> Maybe Bool
insecureSsl :: Prelude.Maybe Prelude.Bool,
    -- | Information about the location of the source code to be built.
    --
    -- Valid values include:
    --
    -- -   For source code settings that are specified in the source action of
    --     a pipeline in CodePipeline, location should not be specified. If it
    --     is specified, CodePipeline ignores it. This is because CodePipeline
    --     uses the settings in a pipeline\'s source action instead of this
    --     value.
    --
    -- -   For source code in an CodeCommit repository, the HTTPS clone URL to
    --     the repository that contains the source code and the build spec file
    --     (for example,
    --     @https:\/\/git-codecommit.region-ID.amazonaws.com\/v1\/repos\/repo-name@
    --     ).
    --
    -- -   For source code in an S3 input bucket, one of the following.
    --
    --     -   The path to the ZIP file that contains the source code (for
    --         example, @bucket-name\/path\/to\/object-name.zip@).
    --
    --     -   The path to the folder that contains the source code (for
    --         example, @bucket-name\/path\/to\/source-code\/folder\/@).
    --
    -- -   For source code in a GitHub repository, the HTTPS clone URL to the
    --     repository that contains the source and the build spec file.
    --
    -- -   For source code in a Bitbucket repository, the HTTPS clone URL to
    --     the repository that contains the source and the build spec file.
    AwsCodeBuildProjectSource -> Maybe Text
location :: Prelude.Maybe Prelude.Text,
    -- | Information about the Git clone depth for the build project.
    AwsCodeBuildProjectSource -> Maybe Int
gitCloneDepth :: Prelude.Maybe Prelude.Int,
    -- | The type of repository that contains the source code to be built. Valid
    -- values are:
    --
    -- -   @BITBUCKET@ - The source code is in a Bitbucket repository.
    --
    -- -   @CODECOMMIT@ - The source code is in an CodeCommit repository.
    --
    -- -   @CODEPIPELINE@ - The source code settings are specified in the
    --     source action of a pipeline in CodePipeline.
    --
    -- -   @GITHUB@ - The source code is in a GitHub repository.
    --
    -- -   @GITHUB_ENTERPRISE@ - The source code is in a GitHub Enterprise
    --     repository.
    --
    -- -   @NO_SOURCE@ - The project does not have input source code.
    --
    -- -   @S3@ - The source code is in an S3 input bucket.
    AwsCodeBuildProjectSource -> Maybe Text
type' :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsCodeBuildProjectSource -> AwsCodeBuildProjectSource -> Bool
(AwsCodeBuildProjectSource -> AwsCodeBuildProjectSource -> Bool)
-> (AwsCodeBuildProjectSource -> AwsCodeBuildProjectSource -> Bool)
-> Eq AwsCodeBuildProjectSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsCodeBuildProjectSource -> AwsCodeBuildProjectSource -> Bool
$c/= :: AwsCodeBuildProjectSource -> AwsCodeBuildProjectSource -> Bool
== :: AwsCodeBuildProjectSource -> AwsCodeBuildProjectSource -> Bool
$c== :: AwsCodeBuildProjectSource -> AwsCodeBuildProjectSource -> Bool
Prelude.Eq, ReadPrec [AwsCodeBuildProjectSource]
ReadPrec AwsCodeBuildProjectSource
Int -> ReadS AwsCodeBuildProjectSource
ReadS [AwsCodeBuildProjectSource]
(Int -> ReadS AwsCodeBuildProjectSource)
-> ReadS [AwsCodeBuildProjectSource]
-> ReadPrec AwsCodeBuildProjectSource
-> ReadPrec [AwsCodeBuildProjectSource]
-> Read AwsCodeBuildProjectSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsCodeBuildProjectSource]
$creadListPrec :: ReadPrec [AwsCodeBuildProjectSource]
readPrec :: ReadPrec AwsCodeBuildProjectSource
$creadPrec :: ReadPrec AwsCodeBuildProjectSource
readList :: ReadS [AwsCodeBuildProjectSource]
$creadList :: ReadS [AwsCodeBuildProjectSource]
readsPrec :: Int -> ReadS AwsCodeBuildProjectSource
$creadsPrec :: Int -> ReadS AwsCodeBuildProjectSource
Prelude.Read, Int -> AwsCodeBuildProjectSource -> ShowS
[AwsCodeBuildProjectSource] -> ShowS
AwsCodeBuildProjectSource -> String
(Int -> AwsCodeBuildProjectSource -> ShowS)
-> (AwsCodeBuildProjectSource -> String)
-> ([AwsCodeBuildProjectSource] -> ShowS)
-> Show AwsCodeBuildProjectSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsCodeBuildProjectSource] -> ShowS
$cshowList :: [AwsCodeBuildProjectSource] -> ShowS
show :: AwsCodeBuildProjectSource -> String
$cshow :: AwsCodeBuildProjectSource -> String
showsPrec :: Int -> AwsCodeBuildProjectSource -> ShowS
$cshowsPrec :: Int -> AwsCodeBuildProjectSource -> ShowS
Prelude.Show, (forall x.
 AwsCodeBuildProjectSource -> Rep AwsCodeBuildProjectSource x)
-> (forall x.
    Rep AwsCodeBuildProjectSource x -> AwsCodeBuildProjectSource)
-> Generic AwsCodeBuildProjectSource
forall x.
Rep AwsCodeBuildProjectSource x -> AwsCodeBuildProjectSource
forall x.
AwsCodeBuildProjectSource -> Rep AwsCodeBuildProjectSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsCodeBuildProjectSource x -> AwsCodeBuildProjectSource
$cfrom :: forall x.
AwsCodeBuildProjectSource -> Rep AwsCodeBuildProjectSource x
Prelude.Generic)

-- |
-- Create a value of 'AwsCodeBuildProjectSource' 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:
--
-- 'insecureSsl', 'awsCodeBuildProjectSource_insecureSsl' - Whether to ignore SSL warnings while connecting to the project source
-- code.
--
-- 'location', 'awsCodeBuildProjectSource_location' - Information about the location of the source code to be built.
--
-- Valid values include:
--
-- -   For source code settings that are specified in the source action of
--     a pipeline in CodePipeline, location should not be specified. If it
--     is specified, CodePipeline ignores it. This is because CodePipeline
--     uses the settings in a pipeline\'s source action instead of this
--     value.
--
-- -   For source code in an CodeCommit repository, the HTTPS clone URL to
--     the repository that contains the source code and the build spec file
--     (for example,
--     @https:\/\/git-codecommit.region-ID.amazonaws.com\/v1\/repos\/repo-name@
--     ).
--
-- -   For source code in an S3 input bucket, one of the following.
--
--     -   The path to the ZIP file that contains the source code (for
--         example, @bucket-name\/path\/to\/object-name.zip@).
--
--     -   The path to the folder that contains the source code (for
--         example, @bucket-name\/path\/to\/source-code\/folder\/@).
--
-- -   For source code in a GitHub repository, the HTTPS clone URL to the
--     repository that contains the source and the build spec file.
--
-- -   For source code in a Bitbucket repository, the HTTPS clone URL to
--     the repository that contains the source and the build spec file.
--
-- 'gitCloneDepth', 'awsCodeBuildProjectSource_gitCloneDepth' - Information about the Git clone depth for the build project.
--
-- 'type'', 'awsCodeBuildProjectSource_type' - The type of repository that contains the source code to be built. Valid
-- values are:
--
-- -   @BITBUCKET@ - The source code is in a Bitbucket repository.
--
-- -   @CODECOMMIT@ - The source code is in an CodeCommit repository.
--
-- -   @CODEPIPELINE@ - The source code settings are specified in the
--     source action of a pipeline in CodePipeline.
--
-- -   @GITHUB@ - The source code is in a GitHub repository.
--
-- -   @GITHUB_ENTERPRISE@ - The source code is in a GitHub Enterprise
--     repository.
--
-- -   @NO_SOURCE@ - The project does not have input source code.
--
-- -   @S3@ - The source code is in an S3 input bucket.
newAwsCodeBuildProjectSource ::
  AwsCodeBuildProjectSource
newAwsCodeBuildProjectSource :: AwsCodeBuildProjectSource
newAwsCodeBuildProjectSource =
  AwsCodeBuildProjectSource' :: Maybe Bool
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> AwsCodeBuildProjectSource
AwsCodeBuildProjectSource'
    { $sel:insecureSsl:AwsCodeBuildProjectSource' :: Maybe Bool
insecureSsl =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:location:AwsCodeBuildProjectSource' :: Maybe Text
location = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:gitCloneDepth:AwsCodeBuildProjectSource' :: Maybe Int
gitCloneDepth = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:type':AwsCodeBuildProjectSource' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Whether to ignore SSL warnings while connecting to the project source
-- code.
awsCodeBuildProjectSource_insecureSsl :: Lens.Lens' AwsCodeBuildProjectSource (Prelude.Maybe Prelude.Bool)
awsCodeBuildProjectSource_insecureSsl :: (Maybe Bool -> f (Maybe Bool))
-> AwsCodeBuildProjectSource -> f AwsCodeBuildProjectSource
awsCodeBuildProjectSource_insecureSsl = (AwsCodeBuildProjectSource -> Maybe Bool)
-> (AwsCodeBuildProjectSource
    -> Maybe Bool -> AwsCodeBuildProjectSource)
-> Lens
     AwsCodeBuildProjectSource
     AwsCodeBuildProjectSource
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsCodeBuildProjectSource' {Maybe Bool
insecureSsl :: Maybe Bool
$sel:insecureSsl:AwsCodeBuildProjectSource' :: AwsCodeBuildProjectSource -> Maybe Bool
insecureSsl} -> Maybe Bool
insecureSsl) (\s :: AwsCodeBuildProjectSource
s@AwsCodeBuildProjectSource' {} Maybe Bool
a -> AwsCodeBuildProjectSource
s {$sel:insecureSsl:AwsCodeBuildProjectSource' :: Maybe Bool
insecureSsl = Maybe Bool
a} :: AwsCodeBuildProjectSource)

-- | Information about the location of the source code to be built.
--
-- Valid values include:
--
-- -   For source code settings that are specified in the source action of
--     a pipeline in CodePipeline, location should not be specified. If it
--     is specified, CodePipeline ignores it. This is because CodePipeline
--     uses the settings in a pipeline\'s source action instead of this
--     value.
--
-- -   For source code in an CodeCommit repository, the HTTPS clone URL to
--     the repository that contains the source code and the build spec file
--     (for example,
--     @https:\/\/git-codecommit.region-ID.amazonaws.com\/v1\/repos\/repo-name@
--     ).
--
-- -   For source code in an S3 input bucket, one of the following.
--
--     -   The path to the ZIP file that contains the source code (for
--         example, @bucket-name\/path\/to\/object-name.zip@).
--
--     -   The path to the folder that contains the source code (for
--         example, @bucket-name\/path\/to\/source-code\/folder\/@).
--
-- -   For source code in a GitHub repository, the HTTPS clone URL to the
--     repository that contains the source and the build spec file.
--
-- -   For source code in a Bitbucket repository, the HTTPS clone URL to
--     the repository that contains the source and the build spec file.
awsCodeBuildProjectSource_location :: Lens.Lens' AwsCodeBuildProjectSource (Prelude.Maybe Prelude.Text)
awsCodeBuildProjectSource_location :: (Maybe Text -> f (Maybe Text))
-> AwsCodeBuildProjectSource -> f AwsCodeBuildProjectSource
awsCodeBuildProjectSource_location = (AwsCodeBuildProjectSource -> Maybe Text)
-> (AwsCodeBuildProjectSource
    -> Maybe Text -> AwsCodeBuildProjectSource)
-> Lens
     AwsCodeBuildProjectSource
     AwsCodeBuildProjectSource
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsCodeBuildProjectSource' {Maybe Text
location :: Maybe Text
$sel:location:AwsCodeBuildProjectSource' :: AwsCodeBuildProjectSource -> Maybe Text
location} -> Maybe Text
location) (\s :: AwsCodeBuildProjectSource
s@AwsCodeBuildProjectSource' {} Maybe Text
a -> AwsCodeBuildProjectSource
s {$sel:location:AwsCodeBuildProjectSource' :: Maybe Text
location = Maybe Text
a} :: AwsCodeBuildProjectSource)

-- | Information about the Git clone depth for the build project.
awsCodeBuildProjectSource_gitCloneDepth :: Lens.Lens' AwsCodeBuildProjectSource (Prelude.Maybe Prelude.Int)
awsCodeBuildProjectSource_gitCloneDepth :: (Maybe Int -> f (Maybe Int))
-> AwsCodeBuildProjectSource -> f AwsCodeBuildProjectSource
awsCodeBuildProjectSource_gitCloneDepth = (AwsCodeBuildProjectSource -> Maybe Int)
-> (AwsCodeBuildProjectSource
    -> Maybe Int -> AwsCodeBuildProjectSource)
-> Lens
     AwsCodeBuildProjectSource
     AwsCodeBuildProjectSource
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsCodeBuildProjectSource' {Maybe Int
gitCloneDepth :: Maybe Int
$sel:gitCloneDepth:AwsCodeBuildProjectSource' :: AwsCodeBuildProjectSource -> Maybe Int
gitCloneDepth} -> Maybe Int
gitCloneDepth) (\s :: AwsCodeBuildProjectSource
s@AwsCodeBuildProjectSource' {} Maybe Int
a -> AwsCodeBuildProjectSource
s {$sel:gitCloneDepth:AwsCodeBuildProjectSource' :: Maybe Int
gitCloneDepth = Maybe Int
a} :: AwsCodeBuildProjectSource)

-- | The type of repository that contains the source code to be built. Valid
-- values are:
--
-- -   @BITBUCKET@ - The source code is in a Bitbucket repository.
--
-- -   @CODECOMMIT@ - The source code is in an CodeCommit repository.
--
-- -   @CODEPIPELINE@ - The source code settings are specified in the
--     source action of a pipeline in CodePipeline.
--
-- -   @GITHUB@ - The source code is in a GitHub repository.
--
-- -   @GITHUB_ENTERPRISE@ - The source code is in a GitHub Enterprise
--     repository.
--
-- -   @NO_SOURCE@ - The project does not have input source code.
--
-- -   @S3@ - The source code is in an S3 input bucket.
awsCodeBuildProjectSource_type :: Lens.Lens' AwsCodeBuildProjectSource (Prelude.Maybe Prelude.Text)
awsCodeBuildProjectSource_type :: (Maybe Text -> f (Maybe Text))
-> AwsCodeBuildProjectSource -> f AwsCodeBuildProjectSource
awsCodeBuildProjectSource_type = (AwsCodeBuildProjectSource -> Maybe Text)
-> (AwsCodeBuildProjectSource
    -> Maybe Text -> AwsCodeBuildProjectSource)
-> Lens
     AwsCodeBuildProjectSource
     AwsCodeBuildProjectSource
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsCodeBuildProjectSource' {Maybe Text
type' :: Maybe Text
$sel:type':AwsCodeBuildProjectSource' :: AwsCodeBuildProjectSource -> Maybe Text
type'} -> Maybe Text
type') (\s :: AwsCodeBuildProjectSource
s@AwsCodeBuildProjectSource' {} Maybe Text
a -> AwsCodeBuildProjectSource
s {$sel:type':AwsCodeBuildProjectSource' :: Maybe Text
type' = Maybe Text
a} :: AwsCodeBuildProjectSource)

instance Core.FromJSON AwsCodeBuildProjectSource where
  parseJSON :: Value -> Parser AwsCodeBuildProjectSource
parseJSON =
    String
-> (Object -> Parser AwsCodeBuildProjectSource)
-> Value
-> Parser AwsCodeBuildProjectSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsCodeBuildProjectSource"
      ( \Object
x ->
          Maybe Bool
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> AwsCodeBuildProjectSource
AwsCodeBuildProjectSource'
            (Maybe Bool
 -> Maybe Text
 -> Maybe Int
 -> Maybe Text
 -> AwsCodeBuildProjectSource)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Int -> Maybe Text -> AwsCodeBuildProjectSource)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InsecureSsl")
            Parser
  (Maybe Text
   -> Maybe Int -> Maybe Text -> AwsCodeBuildProjectSource)
-> Parser (Maybe Text)
-> Parser (Maybe Int -> Maybe Text -> AwsCodeBuildProjectSource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Location")
            Parser (Maybe Int -> Maybe Text -> AwsCodeBuildProjectSource)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> AwsCodeBuildProjectSource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"GitCloneDepth")
            Parser (Maybe Text -> AwsCodeBuildProjectSource)
-> Parser (Maybe Text) -> Parser AwsCodeBuildProjectSource
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
      )

instance Prelude.Hashable AwsCodeBuildProjectSource

instance Prelude.NFData AwsCodeBuildProjectSource

instance Core.ToJSON AwsCodeBuildProjectSource where
  toJSON :: AwsCodeBuildProjectSource -> Value
toJSON AwsCodeBuildProjectSource' {Maybe Bool
Maybe Int
Maybe Text
type' :: Maybe Text
gitCloneDepth :: Maybe Int
location :: Maybe Text
insecureSsl :: Maybe Bool
$sel:type':AwsCodeBuildProjectSource' :: AwsCodeBuildProjectSource -> Maybe Text
$sel:gitCloneDepth:AwsCodeBuildProjectSource' :: AwsCodeBuildProjectSource -> Maybe Int
$sel:location:AwsCodeBuildProjectSource' :: AwsCodeBuildProjectSource -> Maybe Text
$sel:insecureSsl:AwsCodeBuildProjectSource' :: AwsCodeBuildProjectSource -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"InsecureSsl" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
insecureSsl,
            (Text
"Location" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
location,
            (Text
"GitCloneDepth" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
gitCloneDepth,
            (Text
"Type" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
type'
          ]
      )