{-# 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.Batch.Types.FargatePlatformConfiguration
-- 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.Batch.Types.FargatePlatformConfiguration where

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

-- | The platform configuration for jobs that are running on Fargate
-- resources. Jobs that run on EC2 resources must not specify this
-- parameter.
--
-- /See:/ 'newFargatePlatformConfiguration' smart constructor.
data FargatePlatformConfiguration = FargatePlatformConfiguration'
  { -- | The Fargate platform version where the jobs are running. A platform
    -- version is specified only for jobs that are running on Fargate
    -- resources. If one isn\'t specified, the @LATEST@ platform version is
    -- used by default. This uses a recent, approved version of the Fargate
    -- platform for compute resources. For more information, see
    -- <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html Fargate platform versions>
    -- in the /Amazon Elastic Container Service Developer Guide/.
    FargatePlatformConfiguration -> Maybe Text
platformVersion :: Prelude.Maybe Prelude.Text
  }
  deriving (FargatePlatformConfiguration
-> FargatePlatformConfiguration -> Bool
(FargatePlatformConfiguration
 -> FargatePlatformConfiguration -> Bool)
-> (FargatePlatformConfiguration
    -> FargatePlatformConfiguration -> Bool)
-> Eq FargatePlatformConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FargatePlatformConfiguration
-> FargatePlatformConfiguration -> Bool
$c/= :: FargatePlatformConfiguration
-> FargatePlatformConfiguration -> Bool
== :: FargatePlatformConfiguration
-> FargatePlatformConfiguration -> Bool
$c== :: FargatePlatformConfiguration
-> FargatePlatformConfiguration -> Bool
Prelude.Eq, ReadPrec [FargatePlatformConfiguration]
ReadPrec FargatePlatformConfiguration
Int -> ReadS FargatePlatformConfiguration
ReadS [FargatePlatformConfiguration]
(Int -> ReadS FargatePlatformConfiguration)
-> ReadS [FargatePlatformConfiguration]
-> ReadPrec FargatePlatformConfiguration
-> ReadPrec [FargatePlatformConfiguration]
-> Read FargatePlatformConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FargatePlatformConfiguration]
$creadListPrec :: ReadPrec [FargatePlatformConfiguration]
readPrec :: ReadPrec FargatePlatformConfiguration
$creadPrec :: ReadPrec FargatePlatformConfiguration
readList :: ReadS [FargatePlatformConfiguration]
$creadList :: ReadS [FargatePlatformConfiguration]
readsPrec :: Int -> ReadS FargatePlatformConfiguration
$creadsPrec :: Int -> ReadS FargatePlatformConfiguration
Prelude.Read, Int -> FargatePlatformConfiguration -> ShowS
[FargatePlatformConfiguration] -> ShowS
FargatePlatformConfiguration -> String
(Int -> FargatePlatformConfiguration -> ShowS)
-> (FargatePlatformConfiguration -> String)
-> ([FargatePlatformConfiguration] -> ShowS)
-> Show FargatePlatformConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FargatePlatformConfiguration] -> ShowS
$cshowList :: [FargatePlatformConfiguration] -> ShowS
show :: FargatePlatformConfiguration -> String
$cshow :: FargatePlatformConfiguration -> String
showsPrec :: Int -> FargatePlatformConfiguration -> ShowS
$cshowsPrec :: Int -> FargatePlatformConfiguration -> ShowS
Prelude.Show, (forall x.
 FargatePlatformConfiguration -> Rep FargatePlatformConfiguration x)
-> (forall x.
    Rep FargatePlatformConfiguration x -> FargatePlatformConfiguration)
-> Generic FargatePlatformConfiguration
forall x.
Rep FargatePlatformConfiguration x -> FargatePlatformConfiguration
forall x.
FargatePlatformConfiguration -> Rep FargatePlatformConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FargatePlatformConfiguration x -> FargatePlatformConfiguration
$cfrom :: forall x.
FargatePlatformConfiguration -> Rep FargatePlatformConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'FargatePlatformConfiguration' 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:
--
-- 'platformVersion', 'fargatePlatformConfiguration_platformVersion' - The Fargate platform version where the jobs are running. A platform
-- version is specified only for jobs that are running on Fargate
-- resources. If one isn\'t specified, the @LATEST@ platform version is
-- used by default. This uses a recent, approved version of the Fargate
-- platform for compute resources. For more information, see
-- <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html Fargate platform versions>
-- in the /Amazon Elastic Container Service Developer Guide/.
newFargatePlatformConfiguration ::
  FargatePlatformConfiguration
newFargatePlatformConfiguration :: FargatePlatformConfiguration
newFargatePlatformConfiguration =
  FargatePlatformConfiguration' :: Maybe Text -> FargatePlatformConfiguration
FargatePlatformConfiguration'
    { $sel:platformVersion:FargatePlatformConfiguration' :: Maybe Text
platformVersion =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Fargate platform version where the jobs are running. A platform
-- version is specified only for jobs that are running on Fargate
-- resources. If one isn\'t specified, the @LATEST@ platform version is
-- used by default. This uses a recent, approved version of the Fargate
-- platform for compute resources. For more information, see
-- <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html Fargate platform versions>
-- in the /Amazon Elastic Container Service Developer Guide/.
fargatePlatformConfiguration_platformVersion :: Lens.Lens' FargatePlatformConfiguration (Prelude.Maybe Prelude.Text)
fargatePlatformConfiguration_platformVersion :: (Maybe Text -> f (Maybe Text))
-> FargatePlatformConfiguration -> f FargatePlatformConfiguration
fargatePlatformConfiguration_platformVersion = (FargatePlatformConfiguration -> Maybe Text)
-> (FargatePlatformConfiguration
    -> Maybe Text -> FargatePlatformConfiguration)
-> Lens
     FargatePlatformConfiguration
     FargatePlatformConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FargatePlatformConfiguration' {Maybe Text
platformVersion :: Maybe Text
$sel:platformVersion:FargatePlatformConfiguration' :: FargatePlatformConfiguration -> Maybe Text
platformVersion} -> Maybe Text
platformVersion) (\s :: FargatePlatformConfiguration
s@FargatePlatformConfiguration' {} Maybe Text
a -> FargatePlatformConfiguration
s {$sel:platformVersion:FargatePlatformConfiguration' :: Maybe Text
platformVersion = Maybe Text
a} :: FargatePlatformConfiguration)

instance Core.FromJSON FargatePlatformConfiguration where
  parseJSON :: Value -> Parser FargatePlatformConfiguration
parseJSON =
    String
-> (Object -> Parser FargatePlatformConfiguration)
-> Value
-> Parser FargatePlatformConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FargatePlatformConfiguration"
      ( \Object
x ->
          Maybe Text -> FargatePlatformConfiguration
FargatePlatformConfiguration'
            (Maybe Text -> FargatePlatformConfiguration)
-> Parser (Maybe Text) -> Parser FargatePlatformConfiguration
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
"platformVersion")
      )

instance
  Prelude.Hashable
    FargatePlatformConfiguration

instance Prelude.NFData FargatePlatformConfiguration

instance Core.ToJSON FargatePlatformConfiguration where
  toJSON :: FargatePlatformConfiguration -> Value
toJSON FargatePlatformConfiguration' {Maybe Text
platformVersion :: Maybe Text
$sel:platformVersion:FargatePlatformConfiguration' :: FargatePlatformConfiguration -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"platformVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
platformVersion
          ]
      )