{-# 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.SecurityHub.Types.AwsEcsClusterDefaultCapacityProviderStrategyDetails
-- 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.SecurityHub.Types.AwsEcsClusterDefaultCapacityProviderStrategyDetails where

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

-- | The default capacity provider strategy for the cluster. The default
-- capacity provider strategy is used when services or tasks are run
-- without a specified launch type or capacity provider strategy.
--
-- /See:/ 'newAwsEcsClusterDefaultCapacityProviderStrategyDetails' smart constructor.
data AwsEcsClusterDefaultCapacityProviderStrategyDetails = AwsEcsClusterDefaultCapacityProviderStrategyDetails'
  { -- | The minimum number of tasks to run on the specified capacity provider.
    AwsEcsClusterDefaultCapacityProviderStrategyDetails -> Maybe Int
base :: Prelude.Maybe Prelude.Int,
    -- | The name of the capacity provider.
    AwsEcsClusterDefaultCapacityProviderStrategyDetails -> Maybe Text
capacityProvider :: Prelude.Maybe Prelude.Text,
    -- | The relative percentage of the total number of tasks launched that
    -- should use the capacity provider.
    AwsEcsClusterDefaultCapacityProviderStrategyDetails -> Maybe Int
weight :: Prelude.Maybe Prelude.Int
  }
  deriving (AwsEcsClusterDefaultCapacityProviderStrategyDetails
-> AwsEcsClusterDefaultCapacityProviderStrategyDetails -> Bool
(AwsEcsClusterDefaultCapacityProviderStrategyDetails
 -> AwsEcsClusterDefaultCapacityProviderStrategyDetails -> Bool)
-> (AwsEcsClusterDefaultCapacityProviderStrategyDetails
    -> AwsEcsClusterDefaultCapacityProviderStrategyDetails -> Bool)
-> Eq AwsEcsClusterDefaultCapacityProviderStrategyDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsEcsClusterDefaultCapacityProviderStrategyDetails
-> AwsEcsClusterDefaultCapacityProviderStrategyDetails -> Bool
$c/= :: AwsEcsClusterDefaultCapacityProviderStrategyDetails
-> AwsEcsClusterDefaultCapacityProviderStrategyDetails -> Bool
== :: AwsEcsClusterDefaultCapacityProviderStrategyDetails
-> AwsEcsClusterDefaultCapacityProviderStrategyDetails -> Bool
$c== :: AwsEcsClusterDefaultCapacityProviderStrategyDetails
-> AwsEcsClusterDefaultCapacityProviderStrategyDetails -> Bool
Prelude.Eq, ReadPrec [AwsEcsClusterDefaultCapacityProviderStrategyDetails]
ReadPrec AwsEcsClusterDefaultCapacityProviderStrategyDetails
Int -> ReadS AwsEcsClusterDefaultCapacityProviderStrategyDetails
ReadS [AwsEcsClusterDefaultCapacityProviderStrategyDetails]
(Int -> ReadS AwsEcsClusterDefaultCapacityProviderStrategyDetails)
-> ReadS [AwsEcsClusterDefaultCapacityProviderStrategyDetails]
-> ReadPrec AwsEcsClusterDefaultCapacityProviderStrategyDetails
-> ReadPrec [AwsEcsClusterDefaultCapacityProviderStrategyDetails]
-> Read AwsEcsClusterDefaultCapacityProviderStrategyDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsEcsClusterDefaultCapacityProviderStrategyDetails]
$creadListPrec :: ReadPrec [AwsEcsClusterDefaultCapacityProviderStrategyDetails]
readPrec :: ReadPrec AwsEcsClusterDefaultCapacityProviderStrategyDetails
$creadPrec :: ReadPrec AwsEcsClusterDefaultCapacityProviderStrategyDetails
readList :: ReadS [AwsEcsClusterDefaultCapacityProviderStrategyDetails]
$creadList :: ReadS [AwsEcsClusterDefaultCapacityProviderStrategyDetails]
readsPrec :: Int -> ReadS AwsEcsClusterDefaultCapacityProviderStrategyDetails
$creadsPrec :: Int -> ReadS AwsEcsClusterDefaultCapacityProviderStrategyDetails
Prelude.Read, Int -> AwsEcsClusterDefaultCapacityProviderStrategyDetails -> ShowS
[AwsEcsClusterDefaultCapacityProviderStrategyDetails] -> ShowS
AwsEcsClusterDefaultCapacityProviderStrategyDetails -> String
(Int
 -> AwsEcsClusterDefaultCapacityProviderStrategyDetails -> ShowS)
-> (AwsEcsClusterDefaultCapacityProviderStrategyDetails -> String)
-> ([AwsEcsClusterDefaultCapacityProviderStrategyDetails] -> ShowS)
-> Show AwsEcsClusterDefaultCapacityProviderStrategyDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsEcsClusterDefaultCapacityProviderStrategyDetails] -> ShowS
$cshowList :: [AwsEcsClusterDefaultCapacityProviderStrategyDetails] -> ShowS
show :: AwsEcsClusterDefaultCapacityProviderStrategyDetails -> String
$cshow :: AwsEcsClusterDefaultCapacityProviderStrategyDetails -> String
showsPrec :: Int -> AwsEcsClusterDefaultCapacityProviderStrategyDetails -> ShowS
$cshowsPrec :: Int -> AwsEcsClusterDefaultCapacityProviderStrategyDetails -> ShowS
Prelude.Show, (forall x.
 AwsEcsClusterDefaultCapacityProviderStrategyDetails
 -> Rep AwsEcsClusterDefaultCapacityProviderStrategyDetails x)
-> (forall x.
    Rep AwsEcsClusterDefaultCapacityProviderStrategyDetails x
    -> AwsEcsClusterDefaultCapacityProviderStrategyDetails)
-> Generic AwsEcsClusterDefaultCapacityProviderStrategyDetails
forall x.
Rep AwsEcsClusterDefaultCapacityProviderStrategyDetails x
-> AwsEcsClusterDefaultCapacityProviderStrategyDetails
forall x.
AwsEcsClusterDefaultCapacityProviderStrategyDetails
-> Rep AwsEcsClusterDefaultCapacityProviderStrategyDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsEcsClusterDefaultCapacityProviderStrategyDetails x
-> AwsEcsClusterDefaultCapacityProviderStrategyDetails
$cfrom :: forall x.
AwsEcsClusterDefaultCapacityProviderStrategyDetails
-> Rep AwsEcsClusterDefaultCapacityProviderStrategyDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsEcsClusterDefaultCapacityProviderStrategyDetails' 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:
--
-- 'base', 'awsEcsClusterDefaultCapacityProviderStrategyDetails_base' - The minimum number of tasks to run on the specified capacity provider.
--
-- 'capacityProvider', 'awsEcsClusterDefaultCapacityProviderStrategyDetails_capacityProvider' - The name of the capacity provider.
--
-- 'weight', 'awsEcsClusterDefaultCapacityProviderStrategyDetails_weight' - The relative percentage of the total number of tasks launched that
-- should use the capacity provider.
newAwsEcsClusterDefaultCapacityProviderStrategyDetails ::
  AwsEcsClusterDefaultCapacityProviderStrategyDetails
newAwsEcsClusterDefaultCapacityProviderStrategyDetails :: AwsEcsClusterDefaultCapacityProviderStrategyDetails
newAwsEcsClusterDefaultCapacityProviderStrategyDetails =
  AwsEcsClusterDefaultCapacityProviderStrategyDetails' :: Maybe Int
-> Maybe Text
-> Maybe Int
-> AwsEcsClusterDefaultCapacityProviderStrategyDetails
AwsEcsClusterDefaultCapacityProviderStrategyDetails'
    { $sel:base:AwsEcsClusterDefaultCapacityProviderStrategyDetails' :: Maybe Int
base =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:capacityProvider:AwsEcsClusterDefaultCapacityProviderStrategyDetails' :: Maybe Text
capacityProvider =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:weight:AwsEcsClusterDefaultCapacityProviderStrategyDetails' :: Maybe Int
weight =
        Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The minimum number of tasks to run on the specified capacity provider.
awsEcsClusterDefaultCapacityProviderStrategyDetails_base :: Lens.Lens' AwsEcsClusterDefaultCapacityProviderStrategyDetails (Prelude.Maybe Prelude.Int)
awsEcsClusterDefaultCapacityProviderStrategyDetails_base :: (Maybe Int -> f (Maybe Int))
-> AwsEcsClusterDefaultCapacityProviderStrategyDetails
-> f AwsEcsClusterDefaultCapacityProviderStrategyDetails
awsEcsClusterDefaultCapacityProviderStrategyDetails_base = (AwsEcsClusterDefaultCapacityProviderStrategyDetails -> Maybe Int)
-> (AwsEcsClusterDefaultCapacityProviderStrategyDetails
    -> Maybe Int
    -> AwsEcsClusterDefaultCapacityProviderStrategyDetails)
-> Lens
     AwsEcsClusterDefaultCapacityProviderStrategyDetails
     AwsEcsClusterDefaultCapacityProviderStrategyDetails
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEcsClusterDefaultCapacityProviderStrategyDetails' {Maybe Int
base :: Maybe Int
$sel:base:AwsEcsClusterDefaultCapacityProviderStrategyDetails' :: AwsEcsClusterDefaultCapacityProviderStrategyDetails -> Maybe Int
base} -> Maybe Int
base) (\s :: AwsEcsClusterDefaultCapacityProviderStrategyDetails
s@AwsEcsClusterDefaultCapacityProviderStrategyDetails' {} Maybe Int
a -> AwsEcsClusterDefaultCapacityProviderStrategyDetails
s {$sel:base:AwsEcsClusterDefaultCapacityProviderStrategyDetails' :: Maybe Int
base = Maybe Int
a} :: AwsEcsClusterDefaultCapacityProviderStrategyDetails)

-- | The name of the capacity provider.
awsEcsClusterDefaultCapacityProviderStrategyDetails_capacityProvider :: Lens.Lens' AwsEcsClusterDefaultCapacityProviderStrategyDetails (Prelude.Maybe Prelude.Text)
awsEcsClusterDefaultCapacityProviderStrategyDetails_capacityProvider :: (Maybe Text -> f (Maybe Text))
-> AwsEcsClusterDefaultCapacityProviderStrategyDetails
-> f AwsEcsClusterDefaultCapacityProviderStrategyDetails
awsEcsClusterDefaultCapacityProviderStrategyDetails_capacityProvider = (AwsEcsClusterDefaultCapacityProviderStrategyDetails -> Maybe Text)
-> (AwsEcsClusterDefaultCapacityProviderStrategyDetails
    -> Maybe Text
    -> AwsEcsClusterDefaultCapacityProviderStrategyDetails)
-> Lens
     AwsEcsClusterDefaultCapacityProviderStrategyDetails
     AwsEcsClusterDefaultCapacityProviderStrategyDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEcsClusterDefaultCapacityProviderStrategyDetails' {Maybe Text
capacityProvider :: Maybe Text
$sel:capacityProvider:AwsEcsClusterDefaultCapacityProviderStrategyDetails' :: AwsEcsClusterDefaultCapacityProviderStrategyDetails -> Maybe Text
capacityProvider} -> Maybe Text
capacityProvider) (\s :: AwsEcsClusterDefaultCapacityProviderStrategyDetails
s@AwsEcsClusterDefaultCapacityProviderStrategyDetails' {} Maybe Text
a -> AwsEcsClusterDefaultCapacityProviderStrategyDetails
s {$sel:capacityProvider:AwsEcsClusterDefaultCapacityProviderStrategyDetails' :: Maybe Text
capacityProvider = Maybe Text
a} :: AwsEcsClusterDefaultCapacityProviderStrategyDetails)

-- | The relative percentage of the total number of tasks launched that
-- should use the capacity provider.
awsEcsClusterDefaultCapacityProviderStrategyDetails_weight :: Lens.Lens' AwsEcsClusterDefaultCapacityProviderStrategyDetails (Prelude.Maybe Prelude.Int)
awsEcsClusterDefaultCapacityProviderStrategyDetails_weight :: (Maybe Int -> f (Maybe Int))
-> AwsEcsClusterDefaultCapacityProviderStrategyDetails
-> f AwsEcsClusterDefaultCapacityProviderStrategyDetails
awsEcsClusterDefaultCapacityProviderStrategyDetails_weight = (AwsEcsClusterDefaultCapacityProviderStrategyDetails -> Maybe Int)
-> (AwsEcsClusterDefaultCapacityProviderStrategyDetails
    -> Maybe Int
    -> AwsEcsClusterDefaultCapacityProviderStrategyDetails)
-> Lens
     AwsEcsClusterDefaultCapacityProviderStrategyDetails
     AwsEcsClusterDefaultCapacityProviderStrategyDetails
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEcsClusterDefaultCapacityProviderStrategyDetails' {Maybe Int
weight :: Maybe Int
$sel:weight:AwsEcsClusterDefaultCapacityProviderStrategyDetails' :: AwsEcsClusterDefaultCapacityProviderStrategyDetails -> Maybe Int
weight} -> Maybe Int
weight) (\s :: AwsEcsClusterDefaultCapacityProviderStrategyDetails
s@AwsEcsClusterDefaultCapacityProviderStrategyDetails' {} Maybe Int
a -> AwsEcsClusterDefaultCapacityProviderStrategyDetails
s {$sel:weight:AwsEcsClusterDefaultCapacityProviderStrategyDetails' :: Maybe Int
weight = Maybe Int
a} :: AwsEcsClusterDefaultCapacityProviderStrategyDetails)

instance
  Core.FromJSON
    AwsEcsClusterDefaultCapacityProviderStrategyDetails
  where
  parseJSON :: Value -> Parser AwsEcsClusterDefaultCapacityProviderStrategyDetails
parseJSON =
    String
-> (Object
    -> Parser AwsEcsClusterDefaultCapacityProviderStrategyDetails)
-> Value
-> Parser AwsEcsClusterDefaultCapacityProviderStrategyDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsEcsClusterDefaultCapacityProviderStrategyDetails"
      ( \Object
x ->
          Maybe Int
-> Maybe Text
-> Maybe Int
-> AwsEcsClusterDefaultCapacityProviderStrategyDetails
AwsEcsClusterDefaultCapacityProviderStrategyDetails'
            (Maybe Int
 -> Maybe Text
 -> Maybe Int
 -> AwsEcsClusterDefaultCapacityProviderStrategyDetails)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text
      -> Maybe Int
      -> AwsEcsClusterDefaultCapacityProviderStrategyDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Base")
              Parser
  (Maybe Text
   -> Maybe Int
   -> AwsEcsClusterDefaultCapacityProviderStrategyDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Int -> AwsEcsClusterDefaultCapacityProviderStrategyDetails)
forall (f :: * -> *) a b. Applicative f => 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
"CapacityProvider")
              Parser
  (Maybe Int -> AwsEcsClusterDefaultCapacityProviderStrategyDetails)
-> Parser (Maybe Int)
-> Parser AwsEcsClusterDefaultCapacityProviderStrategyDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Weight")
      )

instance
  Prelude.Hashable
    AwsEcsClusterDefaultCapacityProviderStrategyDetails

instance
  Prelude.NFData
    AwsEcsClusterDefaultCapacityProviderStrategyDetails

instance
  Core.ToJSON
    AwsEcsClusterDefaultCapacityProviderStrategyDetails
  where
  toJSON :: AwsEcsClusterDefaultCapacityProviderStrategyDetails -> Value
toJSON
    AwsEcsClusterDefaultCapacityProviderStrategyDetails' {Maybe Int
Maybe Text
weight :: Maybe Int
capacityProvider :: Maybe Text
base :: Maybe Int
$sel:weight:AwsEcsClusterDefaultCapacityProviderStrategyDetails' :: AwsEcsClusterDefaultCapacityProviderStrategyDetails -> Maybe Int
$sel:capacityProvider:AwsEcsClusterDefaultCapacityProviderStrategyDetails' :: AwsEcsClusterDefaultCapacityProviderStrategyDetails -> Maybe Text
$sel:base:AwsEcsClusterDefaultCapacityProviderStrategyDetails' :: AwsEcsClusterDefaultCapacityProviderStrategyDetails -> Maybe Int
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ (Text
"Base" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
base,
              (Text
"CapacityProvider" 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
capacityProvider,
              (Text
"Weight" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
weight
            ]
        )