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

import Amazonka.CodeBuild.Types.EnvironmentLanguage
import Amazonka.CodeBuild.Types.PlatformType
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 platform and are managed by
-- CodeBuild.
--
-- /See:/ 'newEnvironmentPlatform' smart constructor.
data EnvironmentPlatform = EnvironmentPlatform'
  { -- | The platform\'s name.
    EnvironmentPlatform -> Maybe PlatformType
platform :: Prelude.Maybe PlatformType,
    -- | The list of programming languages that are available for the specified
    -- platform.
    EnvironmentPlatform -> Maybe [EnvironmentLanguage]
languages :: Prelude.Maybe [EnvironmentLanguage]
  }
  deriving (EnvironmentPlatform -> EnvironmentPlatform -> Bool
(EnvironmentPlatform -> EnvironmentPlatform -> Bool)
-> (EnvironmentPlatform -> EnvironmentPlatform -> Bool)
-> Eq EnvironmentPlatform
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnvironmentPlatform -> EnvironmentPlatform -> Bool
$c/= :: EnvironmentPlatform -> EnvironmentPlatform -> Bool
== :: EnvironmentPlatform -> EnvironmentPlatform -> Bool
$c== :: EnvironmentPlatform -> EnvironmentPlatform -> Bool
Prelude.Eq, ReadPrec [EnvironmentPlatform]
ReadPrec EnvironmentPlatform
Int -> ReadS EnvironmentPlatform
ReadS [EnvironmentPlatform]
(Int -> ReadS EnvironmentPlatform)
-> ReadS [EnvironmentPlatform]
-> ReadPrec EnvironmentPlatform
-> ReadPrec [EnvironmentPlatform]
-> Read EnvironmentPlatform
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnvironmentPlatform]
$creadListPrec :: ReadPrec [EnvironmentPlatform]
readPrec :: ReadPrec EnvironmentPlatform
$creadPrec :: ReadPrec EnvironmentPlatform
readList :: ReadS [EnvironmentPlatform]
$creadList :: ReadS [EnvironmentPlatform]
readsPrec :: Int -> ReadS EnvironmentPlatform
$creadsPrec :: Int -> ReadS EnvironmentPlatform
Prelude.Read, Int -> EnvironmentPlatform -> ShowS
[EnvironmentPlatform] -> ShowS
EnvironmentPlatform -> String
(Int -> EnvironmentPlatform -> ShowS)
-> (EnvironmentPlatform -> String)
-> ([EnvironmentPlatform] -> ShowS)
-> Show EnvironmentPlatform
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnvironmentPlatform] -> ShowS
$cshowList :: [EnvironmentPlatform] -> ShowS
show :: EnvironmentPlatform -> String
$cshow :: EnvironmentPlatform -> String
showsPrec :: Int -> EnvironmentPlatform -> ShowS
$cshowsPrec :: Int -> EnvironmentPlatform -> ShowS
Prelude.Show, (forall x. EnvironmentPlatform -> Rep EnvironmentPlatform x)
-> (forall x. Rep EnvironmentPlatform x -> EnvironmentPlatform)
-> Generic EnvironmentPlatform
forall x. Rep EnvironmentPlatform x -> EnvironmentPlatform
forall x. EnvironmentPlatform -> Rep EnvironmentPlatform x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EnvironmentPlatform x -> EnvironmentPlatform
$cfrom :: forall x. EnvironmentPlatform -> Rep EnvironmentPlatform x
Prelude.Generic)

-- |
-- Create a value of 'EnvironmentPlatform' 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:
--
-- 'platform', 'environmentPlatform_platform' - The platform\'s name.
--
-- 'languages', 'environmentPlatform_languages' - The list of programming languages that are available for the specified
-- platform.
newEnvironmentPlatform ::
  EnvironmentPlatform
newEnvironmentPlatform :: EnvironmentPlatform
newEnvironmentPlatform =
  EnvironmentPlatform' :: Maybe PlatformType
-> Maybe [EnvironmentLanguage] -> EnvironmentPlatform
EnvironmentPlatform'
    { $sel:platform:EnvironmentPlatform' :: Maybe PlatformType
platform = Maybe PlatformType
forall a. Maybe a
Prelude.Nothing,
      $sel:languages:EnvironmentPlatform' :: Maybe [EnvironmentLanguage]
languages = Maybe [EnvironmentLanguage]
forall a. Maybe a
Prelude.Nothing
    }

-- | The platform\'s name.
environmentPlatform_platform :: Lens.Lens' EnvironmentPlatform (Prelude.Maybe PlatformType)
environmentPlatform_platform :: (Maybe PlatformType -> f (Maybe PlatformType))
-> EnvironmentPlatform -> f EnvironmentPlatform
environmentPlatform_platform = (EnvironmentPlatform -> Maybe PlatformType)
-> (EnvironmentPlatform
    -> Maybe PlatformType -> EnvironmentPlatform)
-> Lens
     EnvironmentPlatform
     EnvironmentPlatform
     (Maybe PlatformType)
     (Maybe PlatformType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnvironmentPlatform' {Maybe PlatformType
platform :: Maybe PlatformType
$sel:platform:EnvironmentPlatform' :: EnvironmentPlatform -> Maybe PlatformType
platform} -> Maybe PlatformType
platform) (\s :: EnvironmentPlatform
s@EnvironmentPlatform' {} Maybe PlatformType
a -> EnvironmentPlatform
s {$sel:platform:EnvironmentPlatform' :: Maybe PlatformType
platform = Maybe PlatformType
a} :: EnvironmentPlatform)

-- | The list of programming languages that are available for the specified
-- platform.
environmentPlatform_languages :: Lens.Lens' EnvironmentPlatform (Prelude.Maybe [EnvironmentLanguage])
environmentPlatform_languages :: (Maybe [EnvironmentLanguage] -> f (Maybe [EnvironmentLanguage]))
-> EnvironmentPlatform -> f EnvironmentPlatform
environmentPlatform_languages = (EnvironmentPlatform -> Maybe [EnvironmentLanguage])
-> (EnvironmentPlatform
    -> Maybe [EnvironmentLanguage] -> EnvironmentPlatform)
-> Lens
     EnvironmentPlatform
     EnvironmentPlatform
     (Maybe [EnvironmentLanguage])
     (Maybe [EnvironmentLanguage])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnvironmentPlatform' {Maybe [EnvironmentLanguage]
languages :: Maybe [EnvironmentLanguage]
$sel:languages:EnvironmentPlatform' :: EnvironmentPlatform -> Maybe [EnvironmentLanguage]
languages} -> Maybe [EnvironmentLanguage]
languages) (\s :: EnvironmentPlatform
s@EnvironmentPlatform' {} Maybe [EnvironmentLanguage]
a -> EnvironmentPlatform
s {$sel:languages:EnvironmentPlatform' :: Maybe [EnvironmentLanguage]
languages = Maybe [EnvironmentLanguage]
a} :: EnvironmentPlatform) ((Maybe [EnvironmentLanguage] -> f (Maybe [EnvironmentLanguage]))
 -> EnvironmentPlatform -> f EnvironmentPlatform)
-> ((Maybe [EnvironmentLanguage]
     -> f (Maybe [EnvironmentLanguage]))
    -> Maybe [EnvironmentLanguage] -> f (Maybe [EnvironmentLanguage]))
-> (Maybe [EnvironmentLanguage] -> f (Maybe [EnvironmentLanguage]))
-> EnvironmentPlatform
-> f EnvironmentPlatform
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [EnvironmentLanguage]
  [EnvironmentLanguage]
  [EnvironmentLanguage]
  [EnvironmentLanguage]
-> Iso
     (Maybe [EnvironmentLanguage])
     (Maybe [EnvironmentLanguage])
     (Maybe [EnvironmentLanguage])
     (Maybe [EnvironmentLanguage])
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
  [EnvironmentLanguage]
  [EnvironmentLanguage]
  [EnvironmentLanguage]
  [EnvironmentLanguage]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.Hashable EnvironmentPlatform

instance Prelude.NFData EnvironmentPlatform