{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 list of programming languages that are available for the specified
    -- platform.
    EnvironmentPlatform -> Maybe [EnvironmentLanguage]
languages :: Prelude.Maybe [EnvironmentLanguage],
    -- | The platform\'s name.
    EnvironmentPlatform -> Maybe PlatformType
platform :: Prelude.Maybe PlatformType
  }
  deriving (EnvironmentPlatform -> EnvironmentPlatform -> Bool
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]
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
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. 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:
--
-- 'languages', 'environmentPlatform_languages' - The list of programming languages that are available for the specified
-- platform.
--
-- 'platform', 'environmentPlatform_platform' - The platform\'s name.
newEnvironmentPlatform ::
  EnvironmentPlatform
newEnvironmentPlatform :: EnvironmentPlatform
newEnvironmentPlatform =
  EnvironmentPlatform'
    { $sel:languages:EnvironmentPlatform' :: Maybe [EnvironmentLanguage]
languages = forall a. Maybe a
Prelude.Nothing,
      $sel:platform:EnvironmentPlatform' :: Maybe PlatformType
platform = forall a. Maybe a
Prelude.Nothing
    }

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

-- | The platform\'s name.
environmentPlatform_platform :: Lens.Lens' EnvironmentPlatform (Prelude.Maybe PlatformType)
environmentPlatform_platform :: Lens' EnvironmentPlatform (Maybe PlatformType)
environmentPlatform_platform = 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)

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

instance Prelude.Hashable EnvironmentPlatform where
  hashWithSalt :: Int -> EnvironmentPlatform -> Int
hashWithSalt Int
_salt EnvironmentPlatform' {Maybe [EnvironmentLanguage]
Maybe PlatformType
platform :: Maybe PlatformType
languages :: Maybe [EnvironmentLanguage]
$sel:platform:EnvironmentPlatform' :: EnvironmentPlatform -> Maybe PlatformType
$sel:languages:EnvironmentPlatform' :: EnvironmentPlatform -> Maybe [EnvironmentLanguage]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [EnvironmentLanguage]
languages
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PlatformType
platform

instance Prelude.NFData EnvironmentPlatform where
  rnf :: EnvironmentPlatform -> ()
rnf EnvironmentPlatform' {Maybe [EnvironmentLanguage]
Maybe PlatformType
platform :: Maybe PlatformType
languages :: Maybe [EnvironmentLanguage]
$sel:platform:EnvironmentPlatform' :: EnvironmentPlatform -> Maybe PlatformType
$sel:languages:EnvironmentPlatform' :: EnvironmentPlatform -> Maybe [EnvironmentLanguage]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [EnvironmentLanguage]
languages
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PlatformType
platform