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

import Amazonka.CodeBuild.Types.EnvironmentImage
import Amazonka.CodeBuild.Types.LanguageType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A set of Docker images that are related by programming language and are
-- managed by CodeBuild.
--
-- /See:/ 'newEnvironmentLanguage' smart constructor.
data EnvironmentLanguage = EnvironmentLanguage'
  { -- | The list of Docker images that are related by the specified programming
    -- language.
    EnvironmentLanguage -> Maybe [EnvironmentImage]
images :: Prelude.Maybe [EnvironmentImage],
    -- | The programming language for the Docker images.
    EnvironmentLanguage -> Maybe LanguageType
language :: Prelude.Maybe LanguageType
  }
  deriving (EnvironmentLanguage -> EnvironmentLanguage -> Bool
(EnvironmentLanguage -> EnvironmentLanguage -> Bool)
-> (EnvironmentLanguage -> EnvironmentLanguage -> Bool)
-> Eq EnvironmentLanguage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnvironmentLanguage -> EnvironmentLanguage -> Bool
$c/= :: EnvironmentLanguage -> EnvironmentLanguage -> Bool
== :: EnvironmentLanguage -> EnvironmentLanguage -> Bool
$c== :: EnvironmentLanguage -> EnvironmentLanguage -> Bool
Prelude.Eq, ReadPrec [EnvironmentLanguage]
ReadPrec EnvironmentLanguage
Int -> ReadS EnvironmentLanguage
ReadS [EnvironmentLanguage]
(Int -> ReadS EnvironmentLanguage)
-> ReadS [EnvironmentLanguage]
-> ReadPrec EnvironmentLanguage
-> ReadPrec [EnvironmentLanguage]
-> Read EnvironmentLanguage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnvironmentLanguage]
$creadListPrec :: ReadPrec [EnvironmentLanguage]
readPrec :: ReadPrec EnvironmentLanguage
$creadPrec :: ReadPrec EnvironmentLanguage
readList :: ReadS [EnvironmentLanguage]
$creadList :: ReadS [EnvironmentLanguage]
readsPrec :: Int -> ReadS EnvironmentLanguage
$creadsPrec :: Int -> ReadS EnvironmentLanguage
Prelude.Read, Int -> EnvironmentLanguage -> ShowS
[EnvironmentLanguage] -> ShowS
EnvironmentLanguage -> String
(Int -> EnvironmentLanguage -> ShowS)
-> (EnvironmentLanguage -> String)
-> ([EnvironmentLanguage] -> ShowS)
-> Show EnvironmentLanguage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnvironmentLanguage] -> ShowS
$cshowList :: [EnvironmentLanguage] -> ShowS
show :: EnvironmentLanguage -> String
$cshow :: EnvironmentLanguage -> String
showsPrec :: Int -> EnvironmentLanguage -> ShowS
$cshowsPrec :: Int -> EnvironmentLanguage -> ShowS
Prelude.Show, (forall x. EnvironmentLanguage -> Rep EnvironmentLanguage x)
-> (forall x. Rep EnvironmentLanguage x -> EnvironmentLanguage)
-> Generic EnvironmentLanguage
forall x. Rep EnvironmentLanguage x -> EnvironmentLanguage
forall x. EnvironmentLanguage -> Rep EnvironmentLanguage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EnvironmentLanguage x -> EnvironmentLanguage
$cfrom :: forall x. EnvironmentLanguage -> Rep EnvironmentLanguage x
Prelude.Generic)

-- |
-- Create a value of 'EnvironmentLanguage' 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:
--
-- 'images', 'environmentLanguage_images' - The list of Docker images that are related by the specified programming
-- language.
--
-- 'language', 'environmentLanguage_language' - The programming language for the Docker images.
newEnvironmentLanguage ::
  EnvironmentLanguage
newEnvironmentLanguage :: EnvironmentLanguage
newEnvironmentLanguage =
  EnvironmentLanguage' :: Maybe [EnvironmentImage]
-> Maybe LanguageType -> EnvironmentLanguage
EnvironmentLanguage'
    { $sel:images:EnvironmentLanguage' :: Maybe [EnvironmentImage]
images = Maybe [EnvironmentImage]
forall a. Maybe a
Prelude.Nothing,
      $sel:language:EnvironmentLanguage' :: Maybe LanguageType
language = Maybe LanguageType
forall a. Maybe a
Prelude.Nothing
    }

-- | The list of Docker images that are related by the specified programming
-- language.
environmentLanguage_images :: Lens.Lens' EnvironmentLanguage (Prelude.Maybe [EnvironmentImage])
environmentLanguage_images :: (Maybe [EnvironmentImage] -> f (Maybe [EnvironmentImage]))
-> EnvironmentLanguage -> f EnvironmentLanguage
environmentLanguage_images = (EnvironmentLanguage -> Maybe [EnvironmentImage])
-> (EnvironmentLanguage
    -> Maybe [EnvironmentImage] -> EnvironmentLanguage)
-> Lens
     EnvironmentLanguage
     EnvironmentLanguage
     (Maybe [EnvironmentImage])
     (Maybe [EnvironmentImage])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnvironmentLanguage' {Maybe [EnvironmentImage]
images :: Maybe [EnvironmentImage]
$sel:images:EnvironmentLanguage' :: EnvironmentLanguage -> Maybe [EnvironmentImage]
images} -> Maybe [EnvironmentImage]
images) (\s :: EnvironmentLanguage
s@EnvironmentLanguage' {} Maybe [EnvironmentImage]
a -> EnvironmentLanguage
s {$sel:images:EnvironmentLanguage' :: Maybe [EnvironmentImage]
images = Maybe [EnvironmentImage]
a} :: EnvironmentLanguage) ((Maybe [EnvironmentImage] -> f (Maybe [EnvironmentImage]))
 -> EnvironmentLanguage -> f EnvironmentLanguage)
-> ((Maybe [EnvironmentImage] -> f (Maybe [EnvironmentImage]))
    -> Maybe [EnvironmentImage] -> f (Maybe [EnvironmentImage]))
-> (Maybe [EnvironmentImage] -> f (Maybe [EnvironmentImage]))
-> EnvironmentLanguage
-> f EnvironmentLanguage
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [EnvironmentImage]
  [EnvironmentImage]
  [EnvironmentImage]
  [EnvironmentImage]
-> Iso
     (Maybe [EnvironmentImage])
     (Maybe [EnvironmentImage])
     (Maybe [EnvironmentImage])
     (Maybe [EnvironmentImage])
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
  [EnvironmentImage]
  [EnvironmentImage]
  [EnvironmentImage]
  [EnvironmentImage]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The programming language for the Docker images.
environmentLanguage_language :: Lens.Lens' EnvironmentLanguage (Prelude.Maybe LanguageType)
environmentLanguage_language :: (Maybe LanguageType -> f (Maybe LanguageType))
-> EnvironmentLanguage -> f EnvironmentLanguage
environmentLanguage_language = (EnvironmentLanguage -> Maybe LanguageType)
-> (EnvironmentLanguage
    -> Maybe LanguageType -> EnvironmentLanguage)
-> Lens
     EnvironmentLanguage
     EnvironmentLanguage
     (Maybe LanguageType)
     (Maybe LanguageType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnvironmentLanguage' {Maybe LanguageType
language :: Maybe LanguageType
$sel:language:EnvironmentLanguage' :: EnvironmentLanguage -> Maybe LanguageType
language} -> Maybe LanguageType
language) (\s :: EnvironmentLanguage
s@EnvironmentLanguage' {} Maybe LanguageType
a -> EnvironmentLanguage
s {$sel:language:EnvironmentLanguage' :: Maybe LanguageType
language = Maybe LanguageType
a} :: EnvironmentLanguage)

instance Core.FromJSON EnvironmentLanguage where
  parseJSON :: Value -> Parser EnvironmentLanguage
parseJSON =
    String
-> (Object -> Parser EnvironmentLanguage)
-> Value
-> Parser EnvironmentLanguage
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EnvironmentLanguage"
      ( \Object
x ->
          Maybe [EnvironmentImage]
-> Maybe LanguageType -> EnvironmentLanguage
EnvironmentLanguage'
            (Maybe [EnvironmentImage]
 -> Maybe LanguageType -> EnvironmentLanguage)
-> Parser (Maybe [EnvironmentImage])
-> Parser (Maybe LanguageType -> EnvironmentLanguage)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [EnvironmentImage]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"images" Parser (Maybe (Maybe [EnvironmentImage]))
-> Maybe [EnvironmentImage] -> Parser (Maybe [EnvironmentImage])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [EnvironmentImage]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe LanguageType -> EnvironmentLanguage)
-> Parser (Maybe LanguageType) -> Parser EnvironmentLanguage
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe LanguageType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"language")
      )

instance Prelude.Hashable EnvironmentLanguage

instance Prelude.NFData EnvironmentLanguage