{-# 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.CodeBuild.Types.GitSubmodulesConfig
-- 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.CodeBuild.Types.GitSubmodulesConfig where

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

-- | Information about the Git submodules configuration for an CodeBuild
-- build project.
--
-- /See:/ 'newGitSubmodulesConfig' smart constructor.
data GitSubmodulesConfig = GitSubmodulesConfig'
  { -- | Set to true to fetch Git submodules for your CodeBuild build project.
    GitSubmodulesConfig -> Bool
fetchSubmodules :: Prelude.Bool
  }
  deriving (GitSubmodulesConfig -> GitSubmodulesConfig -> Bool
(GitSubmodulesConfig -> GitSubmodulesConfig -> Bool)
-> (GitSubmodulesConfig -> GitSubmodulesConfig -> Bool)
-> Eq GitSubmodulesConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GitSubmodulesConfig -> GitSubmodulesConfig -> Bool
$c/= :: GitSubmodulesConfig -> GitSubmodulesConfig -> Bool
== :: GitSubmodulesConfig -> GitSubmodulesConfig -> Bool
$c== :: GitSubmodulesConfig -> GitSubmodulesConfig -> Bool
Prelude.Eq, ReadPrec [GitSubmodulesConfig]
ReadPrec GitSubmodulesConfig
Int -> ReadS GitSubmodulesConfig
ReadS [GitSubmodulesConfig]
(Int -> ReadS GitSubmodulesConfig)
-> ReadS [GitSubmodulesConfig]
-> ReadPrec GitSubmodulesConfig
-> ReadPrec [GitSubmodulesConfig]
-> Read GitSubmodulesConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GitSubmodulesConfig]
$creadListPrec :: ReadPrec [GitSubmodulesConfig]
readPrec :: ReadPrec GitSubmodulesConfig
$creadPrec :: ReadPrec GitSubmodulesConfig
readList :: ReadS [GitSubmodulesConfig]
$creadList :: ReadS [GitSubmodulesConfig]
readsPrec :: Int -> ReadS GitSubmodulesConfig
$creadsPrec :: Int -> ReadS GitSubmodulesConfig
Prelude.Read, Int -> GitSubmodulesConfig -> ShowS
[GitSubmodulesConfig] -> ShowS
GitSubmodulesConfig -> String
(Int -> GitSubmodulesConfig -> ShowS)
-> (GitSubmodulesConfig -> String)
-> ([GitSubmodulesConfig] -> ShowS)
-> Show GitSubmodulesConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GitSubmodulesConfig] -> ShowS
$cshowList :: [GitSubmodulesConfig] -> ShowS
show :: GitSubmodulesConfig -> String
$cshow :: GitSubmodulesConfig -> String
showsPrec :: Int -> GitSubmodulesConfig -> ShowS
$cshowsPrec :: Int -> GitSubmodulesConfig -> ShowS
Prelude.Show, (forall x. GitSubmodulesConfig -> Rep GitSubmodulesConfig x)
-> (forall x. Rep GitSubmodulesConfig x -> GitSubmodulesConfig)
-> Generic GitSubmodulesConfig
forall x. Rep GitSubmodulesConfig x -> GitSubmodulesConfig
forall x. GitSubmodulesConfig -> Rep GitSubmodulesConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GitSubmodulesConfig x -> GitSubmodulesConfig
$cfrom :: forall x. GitSubmodulesConfig -> Rep GitSubmodulesConfig x
Prelude.Generic)

-- |
-- Create a value of 'GitSubmodulesConfig' 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:
--
-- 'fetchSubmodules', 'gitSubmodulesConfig_fetchSubmodules' - Set to true to fetch Git submodules for your CodeBuild build project.
newGitSubmodulesConfig ::
  -- | 'fetchSubmodules'
  Prelude.Bool ->
  GitSubmodulesConfig
newGitSubmodulesConfig :: Bool -> GitSubmodulesConfig
newGitSubmodulesConfig Bool
pFetchSubmodules_ =
  GitSubmodulesConfig' :: Bool -> GitSubmodulesConfig
GitSubmodulesConfig'
    { $sel:fetchSubmodules:GitSubmodulesConfig' :: Bool
fetchSubmodules =
        Bool
pFetchSubmodules_
    }

-- | Set to true to fetch Git submodules for your CodeBuild build project.
gitSubmodulesConfig_fetchSubmodules :: Lens.Lens' GitSubmodulesConfig Prelude.Bool
gitSubmodulesConfig_fetchSubmodules :: (Bool -> f Bool) -> GitSubmodulesConfig -> f GitSubmodulesConfig
gitSubmodulesConfig_fetchSubmodules = (GitSubmodulesConfig -> Bool)
-> (GitSubmodulesConfig -> Bool -> GitSubmodulesConfig)
-> Lens GitSubmodulesConfig GitSubmodulesConfig Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GitSubmodulesConfig' {Bool
fetchSubmodules :: Bool
$sel:fetchSubmodules:GitSubmodulesConfig' :: GitSubmodulesConfig -> Bool
fetchSubmodules} -> Bool
fetchSubmodules) (\s :: GitSubmodulesConfig
s@GitSubmodulesConfig' {} Bool
a -> GitSubmodulesConfig
s {$sel:fetchSubmodules:GitSubmodulesConfig' :: Bool
fetchSubmodules = Bool
a} :: GitSubmodulesConfig)

instance Core.FromJSON GitSubmodulesConfig where
  parseJSON :: Value -> Parser GitSubmodulesConfig
parseJSON =
    String
-> (Object -> Parser GitSubmodulesConfig)
-> Value
-> Parser GitSubmodulesConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"GitSubmodulesConfig"
      ( \Object
x ->
          Bool -> GitSubmodulesConfig
GitSubmodulesConfig'
            (Bool -> GitSubmodulesConfig)
-> Parser Bool -> Parser GitSubmodulesConfig
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"fetchSubmodules")
      )

instance Prelude.Hashable GitSubmodulesConfig

instance Prelude.NFData GitSubmodulesConfig

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