{-# 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.ECS.Types.ClusterConfiguration
-- 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.ECS.Types.ClusterConfiguration where

import qualified Amazonka.Core as Core
import Amazonka.ECS.Types.ExecuteCommandConfiguration
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The execute command configuration for the cluster.
--
-- /See:/ 'newClusterConfiguration' smart constructor.
data ClusterConfiguration = ClusterConfiguration'
  { -- | The details of the execute command configuration.
    ClusterConfiguration -> Maybe ExecuteCommandConfiguration
executeCommandConfiguration :: Prelude.Maybe ExecuteCommandConfiguration
  }
  deriving (ClusterConfiguration -> ClusterConfiguration -> Bool
(ClusterConfiguration -> ClusterConfiguration -> Bool)
-> (ClusterConfiguration -> ClusterConfiguration -> Bool)
-> Eq ClusterConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClusterConfiguration -> ClusterConfiguration -> Bool
$c/= :: ClusterConfiguration -> ClusterConfiguration -> Bool
== :: ClusterConfiguration -> ClusterConfiguration -> Bool
$c== :: ClusterConfiguration -> ClusterConfiguration -> Bool
Prelude.Eq, ReadPrec [ClusterConfiguration]
ReadPrec ClusterConfiguration
Int -> ReadS ClusterConfiguration
ReadS [ClusterConfiguration]
(Int -> ReadS ClusterConfiguration)
-> ReadS [ClusterConfiguration]
-> ReadPrec ClusterConfiguration
-> ReadPrec [ClusterConfiguration]
-> Read ClusterConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClusterConfiguration]
$creadListPrec :: ReadPrec [ClusterConfiguration]
readPrec :: ReadPrec ClusterConfiguration
$creadPrec :: ReadPrec ClusterConfiguration
readList :: ReadS [ClusterConfiguration]
$creadList :: ReadS [ClusterConfiguration]
readsPrec :: Int -> ReadS ClusterConfiguration
$creadsPrec :: Int -> ReadS ClusterConfiguration
Prelude.Read, Int -> ClusterConfiguration -> ShowS
[ClusterConfiguration] -> ShowS
ClusterConfiguration -> String
(Int -> ClusterConfiguration -> ShowS)
-> (ClusterConfiguration -> String)
-> ([ClusterConfiguration] -> ShowS)
-> Show ClusterConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClusterConfiguration] -> ShowS
$cshowList :: [ClusterConfiguration] -> ShowS
show :: ClusterConfiguration -> String
$cshow :: ClusterConfiguration -> String
showsPrec :: Int -> ClusterConfiguration -> ShowS
$cshowsPrec :: Int -> ClusterConfiguration -> ShowS
Prelude.Show, (forall x. ClusterConfiguration -> Rep ClusterConfiguration x)
-> (forall x. Rep ClusterConfiguration x -> ClusterConfiguration)
-> Generic ClusterConfiguration
forall x. Rep ClusterConfiguration x -> ClusterConfiguration
forall x. ClusterConfiguration -> Rep ClusterConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ClusterConfiguration x -> ClusterConfiguration
$cfrom :: forall x. ClusterConfiguration -> Rep ClusterConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ClusterConfiguration' 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:
--
-- 'executeCommandConfiguration', 'clusterConfiguration_executeCommandConfiguration' - The details of the execute command configuration.
newClusterConfiguration ::
  ClusterConfiguration
newClusterConfiguration :: ClusterConfiguration
newClusterConfiguration =
  ClusterConfiguration' :: Maybe ExecuteCommandConfiguration -> ClusterConfiguration
ClusterConfiguration'
    { $sel:executeCommandConfiguration:ClusterConfiguration' :: Maybe ExecuteCommandConfiguration
executeCommandConfiguration =
        Maybe ExecuteCommandConfiguration
forall a. Maybe a
Prelude.Nothing
    }

-- | The details of the execute command configuration.
clusterConfiguration_executeCommandConfiguration :: Lens.Lens' ClusterConfiguration (Prelude.Maybe ExecuteCommandConfiguration)
clusterConfiguration_executeCommandConfiguration :: (Maybe ExecuteCommandConfiguration
 -> f (Maybe ExecuteCommandConfiguration))
-> ClusterConfiguration -> f ClusterConfiguration
clusterConfiguration_executeCommandConfiguration = (ClusterConfiguration -> Maybe ExecuteCommandConfiguration)
-> (ClusterConfiguration
    -> Maybe ExecuteCommandConfiguration -> ClusterConfiguration)
-> Lens
     ClusterConfiguration
     ClusterConfiguration
     (Maybe ExecuteCommandConfiguration)
     (Maybe ExecuteCommandConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterConfiguration' {Maybe ExecuteCommandConfiguration
executeCommandConfiguration :: Maybe ExecuteCommandConfiguration
$sel:executeCommandConfiguration:ClusterConfiguration' :: ClusterConfiguration -> Maybe ExecuteCommandConfiguration
executeCommandConfiguration} -> Maybe ExecuteCommandConfiguration
executeCommandConfiguration) (\s :: ClusterConfiguration
s@ClusterConfiguration' {} Maybe ExecuteCommandConfiguration
a -> ClusterConfiguration
s {$sel:executeCommandConfiguration:ClusterConfiguration' :: Maybe ExecuteCommandConfiguration
executeCommandConfiguration = Maybe ExecuteCommandConfiguration
a} :: ClusterConfiguration)

instance Core.FromJSON ClusterConfiguration where
  parseJSON :: Value -> Parser ClusterConfiguration
parseJSON =
    String
-> (Object -> Parser ClusterConfiguration)
-> Value
-> Parser ClusterConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ClusterConfiguration"
      ( \Object
x ->
          Maybe ExecuteCommandConfiguration -> ClusterConfiguration
ClusterConfiguration'
            (Maybe ExecuteCommandConfiguration -> ClusterConfiguration)
-> Parser (Maybe ExecuteCommandConfiguration)
-> Parser ClusterConfiguration
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ExecuteCommandConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"executeCommandConfiguration")
      )

instance Prelude.Hashable ClusterConfiguration

instance Prelude.NFData ClusterConfiguration

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