{-# 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.EMR.Types.InstanceFleetModifyConfig
-- 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.EMR.Types.InstanceFleetModifyConfig where

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

-- | Configuration parameters for an instance fleet modification request.
--
-- The instance fleet configuration is available only in Amazon EMR
-- versions 4.8.0 and later, excluding 5.0.x versions.
--
-- /See:/ 'newInstanceFleetModifyConfig' smart constructor.
data InstanceFleetModifyConfig = InstanceFleetModifyConfig'
  { -- | The target capacity of On-Demand units for the instance fleet. For more
    -- information see InstanceFleetConfig$TargetOnDemandCapacity.
    InstanceFleetModifyConfig -> Maybe Natural
targetOnDemandCapacity :: Prelude.Maybe Prelude.Natural,
    -- | The target capacity of Spot units for the instance fleet. For more
    -- information, see InstanceFleetConfig$TargetSpotCapacity.
    InstanceFleetModifyConfig -> Maybe Natural
targetSpotCapacity :: Prelude.Maybe Prelude.Natural,
    -- | A unique identifier for the instance fleet.
    InstanceFleetModifyConfig -> Text
instanceFleetId :: Prelude.Text
  }
  deriving (InstanceFleetModifyConfig -> InstanceFleetModifyConfig -> Bool
(InstanceFleetModifyConfig -> InstanceFleetModifyConfig -> Bool)
-> (InstanceFleetModifyConfig -> InstanceFleetModifyConfig -> Bool)
-> Eq InstanceFleetModifyConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceFleetModifyConfig -> InstanceFleetModifyConfig -> Bool
$c/= :: InstanceFleetModifyConfig -> InstanceFleetModifyConfig -> Bool
== :: InstanceFleetModifyConfig -> InstanceFleetModifyConfig -> Bool
$c== :: InstanceFleetModifyConfig -> InstanceFleetModifyConfig -> Bool
Prelude.Eq, ReadPrec [InstanceFleetModifyConfig]
ReadPrec InstanceFleetModifyConfig
Int -> ReadS InstanceFleetModifyConfig
ReadS [InstanceFleetModifyConfig]
(Int -> ReadS InstanceFleetModifyConfig)
-> ReadS [InstanceFleetModifyConfig]
-> ReadPrec InstanceFleetModifyConfig
-> ReadPrec [InstanceFleetModifyConfig]
-> Read InstanceFleetModifyConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceFleetModifyConfig]
$creadListPrec :: ReadPrec [InstanceFleetModifyConfig]
readPrec :: ReadPrec InstanceFleetModifyConfig
$creadPrec :: ReadPrec InstanceFleetModifyConfig
readList :: ReadS [InstanceFleetModifyConfig]
$creadList :: ReadS [InstanceFleetModifyConfig]
readsPrec :: Int -> ReadS InstanceFleetModifyConfig
$creadsPrec :: Int -> ReadS InstanceFleetModifyConfig
Prelude.Read, Int -> InstanceFleetModifyConfig -> ShowS
[InstanceFleetModifyConfig] -> ShowS
InstanceFleetModifyConfig -> String
(Int -> InstanceFleetModifyConfig -> ShowS)
-> (InstanceFleetModifyConfig -> String)
-> ([InstanceFleetModifyConfig] -> ShowS)
-> Show InstanceFleetModifyConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceFleetModifyConfig] -> ShowS
$cshowList :: [InstanceFleetModifyConfig] -> ShowS
show :: InstanceFleetModifyConfig -> String
$cshow :: InstanceFleetModifyConfig -> String
showsPrec :: Int -> InstanceFleetModifyConfig -> ShowS
$cshowsPrec :: Int -> InstanceFleetModifyConfig -> ShowS
Prelude.Show, (forall x.
 InstanceFleetModifyConfig -> Rep InstanceFleetModifyConfig x)
-> (forall x.
    Rep InstanceFleetModifyConfig x -> InstanceFleetModifyConfig)
-> Generic InstanceFleetModifyConfig
forall x.
Rep InstanceFleetModifyConfig x -> InstanceFleetModifyConfig
forall x.
InstanceFleetModifyConfig -> Rep InstanceFleetModifyConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InstanceFleetModifyConfig x -> InstanceFleetModifyConfig
$cfrom :: forall x.
InstanceFleetModifyConfig -> Rep InstanceFleetModifyConfig x
Prelude.Generic)

-- |
-- Create a value of 'InstanceFleetModifyConfig' 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:
--
-- 'targetOnDemandCapacity', 'instanceFleetModifyConfig_targetOnDemandCapacity' - The target capacity of On-Demand units for the instance fleet. For more
-- information see InstanceFleetConfig$TargetOnDemandCapacity.
--
-- 'targetSpotCapacity', 'instanceFleetModifyConfig_targetSpotCapacity' - The target capacity of Spot units for the instance fleet. For more
-- information, see InstanceFleetConfig$TargetSpotCapacity.
--
-- 'instanceFleetId', 'instanceFleetModifyConfig_instanceFleetId' - A unique identifier for the instance fleet.
newInstanceFleetModifyConfig ::
  -- | 'instanceFleetId'
  Prelude.Text ->
  InstanceFleetModifyConfig
newInstanceFleetModifyConfig :: Text -> InstanceFleetModifyConfig
newInstanceFleetModifyConfig Text
pInstanceFleetId_ =
  InstanceFleetModifyConfig' :: Maybe Natural -> Maybe Natural -> Text -> InstanceFleetModifyConfig
InstanceFleetModifyConfig'
    { $sel:targetOnDemandCapacity:InstanceFleetModifyConfig' :: Maybe Natural
targetOnDemandCapacity =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:targetSpotCapacity:InstanceFleetModifyConfig' :: Maybe Natural
targetSpotCapacity = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceFleetId:InstanceFleetModifyConfig' :: Text
instanceFleetId = Text
pInstanceFleetId_
    }

-- | The target capacity of On-Demand units for the instance fleet. For more
-- information see InstanceFleetConfig$TargetOnDemandCapacity.
instanceFleetModifyConfig_targetOnDemandCapacity :: Lens.Lens' InstanceFleetModifyConfig (Prelude.Maybe Prelude.Natural)
instanceFleetModifyConfig_targetOnDemandCapacity :: (Maybe Natural -> f (Maybe Natural))
-> InstanceFleetModifyConfig -> f InstanceFleetModifyConfig
instanceFleetModifyConfig_targetOnDemandCapacity = (InstanceFleetModifyConfig -> Maybe Natural)
-> (InstanceFleetModifyConfig
    -> Maybe Natural -> InstanceFleetModifyConfig)
-> Lens
     InstanceFleetModifyConfig
     InstanceFleetModifyConfig
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceFleetModifyConfig' {Maybe Natural
targetOnDemandCapacity :: Maybe Natural
$sel:targetOnDemandCapacity:InstanceFleetModifyConfig' :: InstanceFleetModifyConfig -> Maybe Natural
targetOnDemandCapacity} -> Maybe Natural
targetOnDemandCapacity) (\s :: InstanceFleetModifyConfig
s@InstanceFleetModifyConfig' {} Maybe Natural
a -> InstanceFleetModifyConfig
s {$sel:targetOnDemandCapacity:InstanceFleetModifyConfig' :: Maybe Natural
targetOnDemandCapacity = Maybe Natural
a} :: InstanceFleetModifyConfig)

-- | The target capacity of Spot units for the instance fleet. For more
-- information, see InstanceFleetConfig$TargetSpotCapacity.
instanceFleetModifyConfig_targetSpotCapacity :: Lens.Lens' InstanceFleetModifyConfig (Prelude.Maybe Prelude.Natural)
instanceFleetModifyConfig_targetSpotCapacity :: (Maybe Natural -> f (Maybe Natural))
-> InstanceFleetModifyConfig -> f InstanceFleetModifyConfig
instanceFleetModifyConfig_targetSpotCapacity = (InstanceFleetModifyConfig -> Maybe Natural)
-> (InstanceFleetModifyConfig
    -> Maybe Natural -> InstanceFleetModifyConfig)
-> Lens
     InstanceFleetModifyConfig
     InstanceFleetModifyConfig
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceFleetModifyConfig' {Maybe Natural
targetSpotCapacity :: Maybe Natural
$sel:targetSpotCapacity:InstanceFleetModifyConfig' :: InstanceFleetModifyConfig -> Maybe Natural
targetSpotCapacity} -> Maybe Natural
targetSpotCapacity) (\s :: InstanceFleetModifyConfig
s@InstanceFleetModifyConfig' {} Maybe Natural
a -> InstanceFleetModifyConfig
s {$sel:targetSpotCapacity:InstanceFleetModifyConfig' :: Maybe Natural
targetSpotCapacity = Maybe Natural
a} :: InstanceFleetModifyConfig)

-- | A unique identifier for the instance fleet.
instanceFleetModifyConfig_instanceFleetId :: Lens.Lens' InstanceFleetModifyConfig Prelude.Text
instanceFleetModifyConfig_instanceFleetId :: (Text -> f Text)
-> InstanceFleetModifyConfig -> f InstanceFleetModifyConfig
instanceFleetModifyConfig_instanceFleetId = (InstanceFleetModifyConfig -> Text)
-> (InstanceFleetModifyConfig -> Text -> InstanceFleetModifyConfig)
-> Lens
     InstanceFleetModifyConfig InstanceFleetModifyConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceFleetModifyConfig' {Text
instanceFleetId :: Text
$sel:instanceFleetId:InstanceFleetModifyConfig' :: InstanceFleetModifyConfig -> Text
instanceFleetId} -> Text
instanceFleetId) (\s :: InstanceFleetModifyConfig
s@InstanceFleetModifyConfig' {} Text
a -> InstanceFleetModifyConfig
s {$sel:instanceFleetId:InstanceFleetModifyConfig' :: Text
instanceFleetId = Text
a} :: InstanceFleetModifyConfig)

instance Prelude.Hashable InstanceFleetModifyConfig

instance Prelude.NFData InstanceFleetModifyConfig

instance Core.ToJSON InstanceFleetModifyConfig where
  toJSON :: InstanceFleetModifyConfig -> Value
toJSON InstanceFleetModifyConfig' {Maybe Natural
Text
instanceFleetId :: Text
targetSpotCapacity :: Maybe Natural
targetOnDemandCapacity :: Maybe Natural
$sel:instanceFleetId:InstanceFleetModifyConfig' :: InstanceFleetModifyConfig -> Text
$sel:targetSpotCapacity:InstanceFleetModifyConfig' :: InstanceFleetModifyConfig -> Maybe Natural
$sel:targetOnDemandCapacity:InstanceFleetModifyConfig' :: InstanceFleetModifyConfig -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"TargetOnDemandCapacity" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
targetOnDemandCapacity,
            (Text
"TargetSpotCapacity" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
targetSpotCapacity,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"InstanceFleetId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
instanceFleetId)
          ]
      )