{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ECS.Types.ClusterConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ECS.Types.ExecuteCommandConfiguration
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
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]
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
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. 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'
    { $sel:executeCommandConfiguration:ClusterConfiguration' :: Maybe ExecuteCommandConfiguration
executeCommandConfiguration =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The details of the execute command configuration.
clusterConfiguration_executeCommandConfiguration :: Lens.Lens' ClusterConfiguration (Prelude.Maybe ExecuteCommandConfiguration)
clusterConfiguration_executeCommandConfiguration :: Lens' ClusterConfiguration (Maybe ExecuteCommandConfiguration)
clusterConfiguration_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 Data.FromJSON ClusterConfiguration where
  parseJSON :: Value -> Parser ClusterConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ClusterConfiguration"
      ( \Object
x ->
          Maybe ExecuteCommandConfiguration -> ClusterConfiguration
ClusterConfiguration'
            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
"executeCommandConfiguration")
      )

instance Prelude.Hashable ClusterConfiguration where
  hashWithSalt :: Int -> ClusterConfiguration -> Int
hashWithSalt Int
_salt ClusterConfiguration' {Maybe ExecuteCommandConfiguration
executeCommandConfiguration :: Maybe ExecuteCommandConfiguration
$sel:executeCommandConfiguration:ClusterConfiguration' :: ClusterConfiguration -> Maybe ExecuteCommandConfiguration
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ExecuteCommandConfiguration
executeCommandConfiguration

instance Prelude.NFData ClusterConfiguration where
  rnf :: ClusterConfiguration -> ()
rnf ClusterConfiguration' {Maybe ExecuteCommandConfiguration
executeCommandConfiguration :: Maybe ExecuteCommandConfiguration
$sel:executeCommandConfiguration:ClusterConfiguration' :: ClusterConfiguration -> Maybe ExecuteCommandConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ExecuteCommandConfiguration
executeCommandConfiguration

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