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

import Amazonka.CodeBuild.Types.BuildSummary
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about a batch build build group. Build groups are
-- used to combine builds that can run in parallel, while still being able
-- to set dependencies on other build groups.
--
-- /See:/ 'newBuildGroup' smart constructor.
data BuildGroup = BuildGroup'
  { -- | Contains the identifier of the build group.
    BuildGroup -> Maybe Text
identifier :: Prelude.Maybe Prelude.Text,
    -- | An array of strings that contain the identifiers of the build groups
    -- that this build group depends on.
    BuildGroup -> Maybe [Text]
dependsOn :: Prelude.Maybe [Prelude.Text],
    -- | Specifies if failures in this build group can be ignored.
    BuildGroup -> Maybe Bool
ignoreFailure :: Prelude.Maybe Prelude.Bool,
    -- | A @BuildSummary@ object that contains a summary of the current build
    -- group.
    BuildGroup -> Maybe BuildSummary
currentBuildSummary :: Prelude.Maybe BuildSummary,
    -- | An array of @BuildSummary@ objects that contain summaries of previous
    -- build groups.
    BuildGroup -> Maybe [BuildSummary]
priorBuildSummaryList :: Prelude.Maybe [BuildSummary]
  }
  deriving (BuildGroup -> BuildGroup -> Bool
(BuildGroup -> BuildGroup -> Bool)
-> (BuildGroup -> BuildGroup -> Bool) -> Eq BuildGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BuildGroup -> BuildGroup -> Bool
$c/= :: BuildGroup -> BuildGroup -> Bool
== :: BuildGroup -> BuildGroup -> Bool
$c== :: BuildGroup -> BuildGroup -> Bool
Prelude.Eq, ReadPrec [BuildGroup]
ReadPrec BuildGroup
Int -> ReadS BuildGroup
ReadS [BuildGroup]
(Int -> ReadS BuildGroup)
-> ReadS [BuildGroup]
-> ReadPrec BuildGroup
-> ReadPrec [BuildGroup]
-> Read BuildGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BuildGroup]
$creadListPrec :: ReadPrec [BuildGroup]
readPrec :: ReadPrec BuildGroup
$creadPrec :: ReadPrec BuildGroup
readList :: ReadS [BuildGroup]
$creadList :: ReadS [BuildGroup]
readsPrec :: Int -> ReadS BuildGroup
$creadsPrec :: Int -> ReadS BuildGroup
Prelude.Read, Int -> BuildGroup -> ShowS
[BuildGroup] -> ShowS
BuildGroup -> String
(Int -> BuildGroup -> ShowS)
-> (BuildGroup -> String)
-> ([BuildGroup] -> ShowS)
-> Show BuildGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BuildGroup] -> ShowS
$cshowList :: [BuildGroup] -> ShowS
show :: BuildGroup -> String
$cshow :: BuildGroup -> String
showsPrec :: Int -> BuildGroup -> ShowS
$cshowsPrec :: Int -> BuildGroup -> ShowS
Prelude.Show, (forall x. BuildGroup -> Rep BuildGroup x)
-> (forall x. Rep BuildGroup x -> BuildGroup) -> Generic BuildGroup
forall x. Rep BuildGroup x -> BuildGroup
forall x. BuildGroup -> Rep BuildGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BuildGroup x -> BuildGroup
$cfrom :: forall x. BuildGroup -> Rep BuildGroup x
Prelude.Generic)

-- |
-- Create a value of 'BuildGroup' 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:
--
-- 'identifier', 'buildGroup_identifier' - Contains the identifier of the build group.
--
-- 'dependsOn', 'buildGroup_dependsOn' - An array of strings that contain the identifiers of the build groups
-- that this build group depends on.
--
-- 'ignoreFailure', 'buildGroup_ignoreFailure' - Specifies if failures in this build group can be ignored.
--
-- 'currentBuildSummary', 'buildGroup_currentBuildSummary' - A @BuildSummary@ object that contains a summary of the current build
-- group.
--
-- 'priorBuildSummaryList', 'buildGroup_priorBuildSummaryList' - An array of @BuildSummary@ objects that contain summaries of previous
-- build groups.
newBuildGroup ::
  BuildGroup
newBuildGroup :: BuildGroup
newBuildGroup =
  BuildGroup' :: Maybe Text
-> Maybe [Text]
-> Maybe Bool
-> Maybe BuildSummary
-> Maybe [BuildSummary]
-> BuildGroup
BuildGroup'
    { $sel:identifier:BuildGroup' :: Maybe Text
identifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dependsOn:BuildGroup' :: Maybe [Text]
dependsOn = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:ignoreFailure:BuildGroup' :: Maybe Bool
ignoreFailure = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:currentBuildSummary:BuildGroup' :: Maybe BuildSummary
currentBuildSummary = Maybe BuildSummary
forall a. Maybe a
Prelude.Nothing,
      $sel:priorBuildSummaryList:BuildGroup' :: Maybe [BuildSummary]
priorBuildSummaryList = Maybe [BuildSummary]
forall a. Maybe a
Prelude.Nothing
    }

-- | Contains the identifier of the build group.
buildGroup_identifier :: Lens.Lens' BuildGroup (Prelude.Maybe Prelude.Text)
buildGroup_identifier :: (Maybe Text -> f (Maybe Text)) -> BuildGroup -> f BuildGroup
buildGroup_identifier = (BuildGroup -> Maybe Text)
-> (BuildGroup -> Maybe Text -> BuildGroup)
-> Lens BuildGroup BuildGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BuildGroup' {Maybe Text
identifier :: Maybe Text
$sel:identifier:BuildGroup' :: BuildGroup -> Maybe Text
identifier} -> Maybe Text
identifier) (\s :: BuildGroup
s@BuildGroup' {} Maybe Text
a -> BuildGroup
s {$sel:identifier:BuildGroup' :: Maybe Text
identifier = Maybe Text
a} :: BuildGroup)

-- | An array of strings that contain the identifiers of the build groups
-- that this build group depends on.
buildGroup_dependsOn :: Lens.Lens' BuildGroup (Prelude.Maybe [Prelude.Text])
buildGroup_dependsOn :: (Maybe [Text] -> f (Maybe [Text])) -> BuildGroup -> f BuildGroup
buildGroup_dependsOn = (BuildGroup -> Maybe [Text])
-> (BuildGroup -> Maybe [Text] -> BuildGroup)
-> Lens BuildGroup BuildGroup (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BuildGroup' {Maybe [Text]
dependsOn :: Maybe [Text]
$sel:dependsOn:BuildGroup' :: BuildGroup -> Maybe [Text]
dependsOn} -> Maybe [Text]
dependsOn) (\s :: BuildGroup
s@BuildGroup' {} Maybe [Text]
a -> BuildGroup
s {$sel:dependsOn:BuildGroup' :: Maybe [Text]
dependsOn = Maybe [Text]
a} :: BuildGroup) ((Maybe [Text] -> f (Maybe [Text])) -> BuildGroup -> f BuildGroup)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> BuildGroup
-> f BuildGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies if failures in this build group can be ignored.
buildGroup_ignoreFailure :: Lens.Lens' BuildGroup (Prelude.Maybe Prelude.Bool)
buildGroup_ignoreFailure :: (Maybe Bool -> f (Maybe Bool)) -> BuildGroup -> f BuildGroup
buildGroup_ignoreFailure = (BuildGroup -> Maybe Bool)
-> (BuildGroup -> Maybe Bool -> BuildGroup)
-> Lens BuildGroup BuildGroup (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BuildGroup' {Maybe Bool
ignoreFailure :: Maybe Bool
$sel:ignoreFailure:BuildGroup' :: BuildGroup -> Maybe Bool
ignoreFailure} -> Maybe Bool
ignoreFailure) (\s :: BuildGroup
s@BuildGroup' {} Maybe Bool
a -> BuildGroup
s {$sel:ignoreFailure:BuildGroup' :: Maybe Bool
ignoreFailure = Maybe Bool
a} :: BuildGroup)

-- | A @BuildSummary@ object that contains a summary of the current build
-- group.
buildGroup_currentBuildSummary :: Lens.Lens' BuildGroup (Prelude.Maybe BuildSummary)
buildGroup_currentBuildSummary :: (Maybe BuildSummary -> f (Maybe BuildSummary))
-> BuildGroup -> f BuildGroup
buildGroup_currentBuildSummary = (BuildGroup -> Maybe BuildSummary)
-> (BuildGroup -> Maybe BuildSummary -> BuildGroup)
-> Lens
     BuildGroup BuildGroup (Maybe BuildSummary) (Maybe BuildSummary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BuildGroup' {Maybe BuildSummary
currentBuildSummary :: Maybe BuildSummary
$sel:currentBuildSummary:BuildGroup' :: BuildGroup -> Maybe BuildSummary
currentBuildSummary} -> Maybe BuildSummary
currentBuildSummary) (\s :: BuildGroup
s@BuildGroup' {} Maybe BuildSummary
a -> BuildGroup
s {$sel:currentBuildSummary:BuildGroup' :: Maybe BuildSummary
currentBuildSummary = Maybe BuildSummary
a} :: BuildGroup)

-- | An array of @BuildSummary@ objects that contain summaries of previous
-- build groups.
buildGroup_priorBuildSummaryList :: Lens.Lens' BuildGroup (Prelude.Maybe [BuildSummary])
buildGroup_priorBuildSummaryList :: (Maybe [BuildSummary] -> f (Maybe [BuildSummary]))
-> BuildGroup -> f BuildGroup
buildGroup_priorBuildSummaryList = (BuildGroup -> Maybe [BuildSummary])
-> (BuildGroup -> Maybe [BuildSummary] -> BuildGroup)
-> Lens
     BuildGroup BuildGroup (Maybe [BuildSummary]) (Maybe [BuildSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BuildGroup' {Maybe [BuildSummary]
priorBuildSummaryList :: Maybe [BuildSummary]
$sel:priorBuildSummaryList:BuildGroup' :: BuildGroup -> Maybe [BuildSummary]
priorBuildSummaryList} -> Maybe [BuildSummary]
priorBuildSummaryList) (\s :: BuildGroup
s@BuildGroup' {} Maybe [BuildSummary]
a -> BuildGroup
s {$sel:priorBuildSummaryList:BuildGroup' :: Maybe [BuildSummary]
priorBuildSummaryList = Maybe [BuildSummary]
a} :: BuildGroup) ((Maybe [BuildSummary] -> f (Maybe [BuildSummary]))
 -> BuildGroup -> f BuildGroup)
-> ((Maybe [BuildSummary] -> f (Maybe [BuildSummary]))
    -> Maybe [BuildSummary] -> f (Maybe [BuildSummary]))
-> (Maybe [BuildSummary] -> f (Maybe [BuildSummary]))
-> BuildGroup
-> f BuildGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [BuildSummary] [BuildSummary] [BuildSummary] [BuildSummary]
-> Iso
     (Maybe [BuildSummary])
     (Maybe [BuildSummary])
     (Maybe [BuildSummary])
     (Maybe [BuildSummary])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [BuildSummary] [BuildSummary] [BuildSummary] [BuildSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON BuildGroup where
  parseJSON :: Value -> Parser BuildGroup
parseJSON =
    String
-> (Object -> Parser BuildGroup) -> Value -> Parser BuildGroup
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BuildGroup"
      ( \Object
x ->
          Maybe Text
-> Maybe [Text]
-> Maybe Bool
-> Maybe BuildSummary
-> Maybe [BuildSummary]
-> BuildGroup
BuildGroup'
            (Maybe Text
 -> Maybe [Text]
 -> Maybe Bool
 -> Maybe BuildSummary
 -> Maybe [BuildSummary]
 -> BuildGroup)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe Bool
      -> Maybe BuildSummary
      -> Maybe [BuildSummary]
      -> BuildGroup)
forall (f :: * -> *) a b. Functor 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
"identifier")
            Parser
  (Maybe [Text]
   -> Maybe Bool
   -> Maybe BuildSummary
   -> Maybe [BuildSummary]
   -> BuildGroup)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Bool
      -> Maybe BuildSummary -> Maybe [BuildSummary] -> BuildGroup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"dependsOn" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Bool
   -> Maybe BuildSummary -> Maybe [BuildSummary] -> BuildGroup)
-> Parser (Maybe Bool)
-> Parser
     (Maybe BuildSummary -> Maybe [BuildSummary] -> BuildGroup)
forall (f :: * -> *) a b. Applicative f => 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
"ignoreFailure")
            Parser (Maybe BuildSummary -> Maybe [BuildSummary] -> BuildGroup)
-> Parser (Maybe BuildSummary)
-> Parser (Maybe [BuildSummary] -> BuildGroup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe BuildSummary)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"currentBuildSummary")
            Parser (Maybe [BuildSummary] -> BuildGroup)
-> Parser (Maybe [BuildSummary]) -> Parser BuildGroup
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [BuildSummary]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"priorBuildSummaryList"
                            Parser (Maybe (Maybe [BuildSummary]))
-> Maybe [BuildSummary] -> Parser (Maybe [BuildSummary])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [BuildSummary]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable BuildGroup

instance Prelude.NFData BuildGroup