{-# 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.InstanceGroupConfig
-- 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.InstanceGroupConfig where

import qualified Amazonka.Core as Core
import Amazonka.EMR.Types.AutoScalingPolicy
import Amazonka.EMR.Types.Configuration
import Amazonka.EMR.Types.EbsConfiguration
import Amazonka.EMR.Types.InstanceRoleType
import Amazonka.EMR.Types.MarketType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Configuration defining a new instance group.
--
-- /See:/ 'newInstanceGroupConfig' smart constructor.
data InstanceGroupConfig = InstanceGroupConfig'
  { -- | EBS configurations that will be attached to each EC2 instance in the
    -- instance group.
    InstanceGroupConfig -> Maybe EbsConfiguration
ebsConfiguration :: Prelude.Maybe EbsConfiguration,
    -- | If specified, indicates that the instance group uses Spot Instances.
    -- This is the maximum price you are willing to pay for Spot Instances.
    -- Specify @OnDemandPrice@ to set the amount equal to the On-Demand price,
    -- or specify an amount in USD.
    InstanceGroupConfig -> Maybe Text
bidPrice :: Prelude.Maybe Prelude.Text,
    -- | Amazon EMR releases 4.x or later.
    --
    -- The list of configurations supplied for an EMR cluster instance group.
    -- You can specify a separate configuration for each instance group
    -- (master, core, and task).
    InstanceGroupConfig -> Maybe [Configuration]
configurations :: Prelude.Maybe [Configuration],
    -- | The custom AMI ID to use for the provisioned instance group.
    InstanceGroupConfig -> Maybe Text
customAmiId :: Prelude.Maybe Prelude.Text,
    -- | Market type of the EC2 instances used to create a cluster node.
    InstanceGroupConfig -> Maybe MarketType
market :: Prelude.Maybe MarketType,
    -- | Friendly name given to the instance group.
    InstanceGroupConfig -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | An automatic scaling policy for a core instance group or task instance
    -- group in an Amazon EMR cluster. The automatic scaling policy defines how
    -- an instance group dynamically adds and terminates EC2 instances in
    -- response to the value of a CloudWatch metric. See PutAutoScalingPolicy.
    InstanceGroupConfig -> Maybe AutoScalingPolicy
autoScalingPolicy :: Prelude.Maybe AutoScalingPolicy,
    -- | The role of the instance group in the cluster.
    InstanceGroupConfig -> InstanceRoleType
instanceRole :: InstanceRoleType,
    -- | The EC2 instance type for all instances in the instance group.
    InstanceGroupConfig -> Text
instanceType :: Prelude.Text,
    -- | Target number of instances for the instance group.
    InstanceGroupConfig -> Int
instanceCount :: Prelude.Int
  }
  deriving (InstanceGroupConfig -> InstanceGroupConfig -> Bool
(InstanceGroupConfig -> InstanceGroupConfig -> Bool)
-> (InstanceGroupConfig -> InstanceGroupConfig -> Bool)
-> Eq InstanceGroupConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceGroupConfig -> InstanceGroupConfig -> Bool
$c/= :: InstanceGroupConfig -> InstanceGroupConfig -> Bool
== :: InstanceGroupConfig -> InstanceGroupConfig -> Bool
$c== :: InstanceGroupConfig -> InstanceGroupConfig -> Bool
Prelude.Eq, ReadPrec [InstanceGroupConfig]
ReadPrec InstanceGroupConfig
Int -> ReadS InstanceGroupConfig
ReadS [InstanceGroupConfig]
(Int -> ReadS InstanceGroupConfig)
-> ReadS [InstanceGroupConfig]
-> ReadPrec InstanceGroupConfig
-> ReadPrec [InstanceGroupConfig]
-> Read InstanceGroupConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceGroupConfig]
$creadListPrec :: ReadPrec [InstanceGroupConfig]
readPrec :: ReadPrec InstanceGroupConfig
$creadPrec :: ReadPrec InstanceGroupConfig
readList :: ReadS [InstanceGroupConfig]
$creadList :: ReadS [InstanceGroupConfig]
readsPrec :: Int -> ReadS InstanceGroupConfig
$creadsPrec :: Int -> ReadS InstanceGroupConfig
Prelude.Read, Int -> InstanceGroupConfig -> ShowS
[InstanceGroupConfig] -> ShowS
InstanceGroupConfig -> String
(Int -> InstanceGroupConfig -> ShowS)
-> (InstanceGroupConfig -> String)
-> ([InstanceGroupConfig] -> ShowS)
-> Show InstanceGroupConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceGroupConfig] -> ShowS
$cshowList :: [InstanceGroupConfig] -> ShowS
show :: InstanceGroupConfig -> String
$cshow :: InstanceGroupConfig -> String
showsPrec :: Int -> InstanceGroupConfig -> ShowS
$cshowsPrec :: Int -> InstanceGroupConfig -> ShowS
Prelude.Show, (forall x. InstanceGroupConfig -> Rep InstanceGroupConfig x)
-> (forall x. Rep InstanceGroupConfig x -> InstanceGroupConfig)
-> Generic InstanceGroupConfig
forall x. Rep InstanceGroupConfig x -> InstanceGroupConfig
forall x. InstanceGroupConfig -> Rep InstanceGroupConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstanceGroupConfig x -> InstanceGroupConfig
$cfrom :: forall x. InstanceGroupConfig -> Rep InstanceGroupConfig x
Prelude.Generic)

-- |
-- Create a value of 'InstanceGroupConfig' 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:
--
-- 'ebsConfiguration', 'instanceGroupConfig_ebsConfiguration' - EBS configurations that will be attached to each EC2 instance in the
-- instance group.
--
-- 'bidPrice', 'instanceGroupConfig_bidPrice' - If specified, indicates that the instance group uses Spot Instances.
-- This is the maximum price you are willing to pay for Spot Instances.
-- Specify @OnDemandPrice@ to set the amount equal to the On-Demand price,
-- or specify an amount in USD.
--
-- 'configurations', 'instanceGroupConfig_configurations' - Amazon EMR releases 4.x or later.
--
-- The list of configurations supplied for an EMR cluster instance group.
-- You can specify a separate configuration for each instance group
-- (master, core, and task).
--
-- 'customAmiId', 'instanceGroupConfig_customAmiId' - The custom AMI ID to use for the provisioned instance group.
--
-- 'market', 'instanceGroupConfig_market' - Market type of the EC2 instances used to create a cluster node.
--
-- 'name', 'instanceGroupConfig_name' - Friendly name given to the instance group.
--
-- 'autoScalingPolicy', 'instanceGroupConfig_autoScalingPolicy' - An automatic scaling policy for a core instance group or task instance
-- group in an Amazon EMR cluster. The automatic scaling policy defines how
-- an instance group dynamically adds and terminates EC2 instances in
-- response to the value of a CloudWatch metric. See PutAutoScalingPolicy.
--
-- 'instanceRole', 'instanceGroupConfig_instanceRole' - The role of the instance group in the cluster.
--
-- 'instanceType', 'instanceGroupConfig_instanceType' - The EC2 instance type for all instances in the instance group.
--
-- 'instanceCount', 'instanceGroupConfig_instanceCount' - Target number of instances for the instance group.
newInstanceGroupConfig ::
  -- | 'instanceRole'
  InstanceRoleType ->
  -- | 'instanceType'
  Prelude.Text ->
  -- | 'instanceCount'
  Prelude.Int ->
  InstanceGroupConfig
newInstanceGroupConfig :: InstanceRoleType -> Text -> Int -> InstanceGroupConfig
newInstanceGroupConfig
  InstanceRoleType
pInstanceRole_
  Text
pInstanceType_
  Int
pInstanceCount_ =
    InstanceGroupConfig' :: Maybe EbsConfiguration
-> Maybe Text
-> Maybe [Configuration]
-> Maybe Text
-> Maybe MarketType
-> Maybe Text
-> Maybe AutoScalingPolicy
-> InstanceRoleType
-> Text
-> Int
-> InstanceGroupConfig
InstanceGroupConfig'
      { $sel:ebsConfiguration:InstanceGroupConfig' :: Maybe EbsConfiguration
ebsConfiguration =
          Maybe EbsConfiguration
forall a. Maybe a
Prelude.Nothing,
        $sel:bidPrice:InstanceGroupConfig' :: Maybe Text
bidPrice = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:configurations:InstanceGroupConfig' :: Maybe [Configuration]
configurations = Maybe [Configuration]
forall a. Maybe a
Prelude.Nothing,
        $sel:customAmiId:InstanceGroupConfig' :: Maybe Text
customAmiId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:market:InstanceGroupConfig' :: Maybe MarketType
market = Maybe MarketType
forall a. Maybe a
Prelude.Nothing,
        $sel:name:InstanceGroupConfig' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:autoScalingPolicy:InstanceGroupConfig' :: Maybe AutoScalingPolicy
autoScalingPolicy = Maybe AutoScalingPolicy
forall a. Maybe a
Prelude.Nothing,
        $sel:instanceRole:InstanceGroupConfig' :: InstanceRoleType
instanceRole = InstanceRoleType
pInstanceRole_,
        $sel:instanceType:InstanceGroupConfig' :: Text
instanceType = Text
pInstanceType_,
        $sel:instanceCount:InstanceGroupConfig' :: Int
instanceCount = Int
pInstanceCount_
      }

-- | EBS configurations that will be attached to each EC2 instance in the
-- instance group.
instanceGroupConfig_ebsConfiguration :: Lens.Lens' InstanceGroupConfig (Prelude.Maybe EbsConfiguration)
instanceGroupConfig_ebsConfiguration :: (Maybe EbsConfiguration -> f (Maybe EbsConfiguration))
-> InstanceGroupConfig -> f InstanceGroupConfig
instanceGroupConfig_ebsConfiguration = (InstanceGroupConfig -> Maybe EbsConfiguration)
-> (InstanceGroupConfig
    -> Maybe EbsConfiguration -> InstanceGroupConfig)
-> Lens
     InstanceGroupConfig
     InstanceGroupConfig
     (Maybe EbsConfiguration)
     (Maybe EbsConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceGroupConfig' {Maybe EbsConfiguration
ebsConfiguration :: Maybe EbsConfiguration
$sel:ebsConfiguration:InstanceGroupConfig' :: InstanceGroupConfig -> Maybe EbsConfiguration
ebsConfiguration} -> Maybe EbsConfiguration
ebsConfiguration) (\s :: InstanceGroupConfig
s@InstanceGroupConfig' {} Maybe EbsConfiguration
a -> InstanceGroupConfig
s {$sel:ebsConfiguration:InstanceGroupConfig' :: Maybe EbsConfiguration
ebsConfiguration = Maybe EbsConfiguration
a} :: InstanceGroupConfig)

-- | If specified, indicates that the instance group uses Spot Instances.
-- This is the maximum price you are willing to pay for Spot Instances.
-- Specify @OnDemandPrice@ to set the amount equal to the On-Demand price,
-- or specify an amount in USD.
instanceGroupConfig_bidPrice :: Lens.Lens' InstanceGroupConfig (Prelude.Maybe Prelude.Text)
instanceGroupConfig_bidPrice :: (Maybe Text -> f (Maybe Text))
-> InstanceGroupConfig -> f InstanceGroupConfig
instanceGroupConfig_bidPrice = (InstanceGroupConfig -> Maybe Text)
-> (InstanceGroupConfig -> Maybe Text -> InstanceGroupConfig)
-> Lens
     InstanceGroupConfig InstanceGroupConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceGroupConfig' {Maybe Text
bidPrice :: Maybe Text
$sel:bidPrice:InstanceGroupConfig' :: InstanceGroupConfig -> Maybe Text
bidPrice} -> Maybe Text
bidPrice) (\s :: InstanceGroupConfig
s@InstanceGroupConfig' {} Maybe Text
a -> InstanceGroupConfig
s {$sel:bidPrice:InstanceGroupConfig' :: Maybe Text
bidPrice = Maybe Text
a} :: InstanceGroupConfig)

-- | Amazon EMR releases 4.x or later.
--
-- The list of configurations supplied for an EMR cluster instance group.
-- You can specify a separate configuration for each instance group
-- (master, core, and task).
instanceGroupConfig_configurations :: Lens.Lens' InstanceGroupConfig (Prelude.Maybe [Configuration])
instanceGroupConfig_configurations :: (Maybe [Configuration] -> f (Maybe [Configuration]))
-> InstanceGroupConfig -> f InstanceGroupConfig
instanceGroupConfig_configurations = (InstanceGroupConfig -> Maybe [Configuration])
-> (InstanceGroupConfig
    -> Maybe [Configuration] -> InstanceGroupConfig)
-> Lens
     InstanceGroupConfig
     InstanceGroupConfig
     (Maybe [Configuration])
     (Maybe [Configuration])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceGroupConfig' {Maybe [Configuration]
configurations :: Maybe [Configuration]
$sel:configurations:InstanceGroupConfig' :: InstanceGroupConfig -> Maybe [Configuration]
configurations} -> Maybe [Configuration]
configurations) (\s :: InstanceGroupConfig
s@InstanceGroupConfig' {} Maybe [Configuration]
a -> InstanceGroupConfig
s {$sel:configurations:InstanceGroupConfig' :: Maybe [Configuration]
configurations = Maybe [Configuration]
a} :: InstanceGroupConfig) ((Maybe [Configuration] -> f (Maybe [Configuration]))
 -> InstanceGroupConfig -> f InstanceGroupConfig)
-> ((Maybe [Configuration] -> f (Maybe [Configuration]))
    -> Maybe [Configuration] -> f (Maybe [Configuration]))
-> (Maybe [Configuration] -> f (Maybe [Configuration]))
-> InstanceGroupConfig
-> f InstanceGroupConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [Configuration] [Configuration] [Configuration] [Configuration]
-> Iso
     (Maybe [Configuration])
     (Maybe [Configuration])
     (Maybe [Configuration])
     (Maybe [Configuration])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [Configuration] [Configuration] [Configuration] [Configuration]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The custom AMI ID to use for the provisioned instance group.
instanceGroupConfig_customAmiId :: Lens.Lens' InstanceGroupConfig (Prelude.Maybe Prelude.Text)
instanceGroupConfig_customAmiId :: (Maybe Text -> f (Maybe Text))
-> InstanceGroupConfig -> f InstanceGroupConfig
instanceGroupConfig_customAmiId = (InstanceGroupConfig -> Maybe Text)
-> (InstanceGroupConfig -> Maybe Text -> InstanceGroupConfig)
-> Lens
     InstanceGroupConfig InstanceGroupConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceGroupConfig' {Maybe Text
customAmiId :: Maybe Text
$sel:customAmiId:InstanceGroupConfig' :: InstanceGroupConfig -> Maybe Text
customAmiId} -> Maybe Text
customAmiId) (\s :: InstanceGroupConfig
s@InstanceGroupConfig' {} Maybe Text
a -> InstanceGroupConfig
s {$sel:customAmiId:InstanceGroupConfig' :: Maybe Text
customAmiId = Maybe Text
a} :: InstanceGroupConfig)

-- | Market type of the EC2 instances used to create a cluster node.
instanceGroupConfig_market :: Lens.Lens' InstanceGroupConfig (Prelude.Maybe MarketType)
instanceGroupConfig_market :: (Maybe MarketType -> f (Maybe MarketType))
-> InstanceGroupConfig -> f InstanceGroupConfig
instanceGroupConfig_market = (InstanceGroupConfig -> Maybe MarketType)
-> (InstanceGroupConfig -> Maybe MarketType -> InstanceGroupConfig)
-> Lens
     InstanceGroupConfig
     InstanceGroupConfig
     (Maybe MarketType)
     (Maybe MarketType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceGroupConfig' {Maybe MarketType
market :: Maybe MarketType
$sel:market:InstanceGroupConfig' :: InstanceGroupConfig -> Maybe MarketType
market} -> Maybe MarketType
market) (\s :: InstanceGroupConfig
s@InstanceGroupConfig' {} Maybe MarketType
a -> InstanceGroupConfig
s {$sel:market:InstanceGroupConfig' :: Maybe MarketType
market = Maybe MarketType
a} :: InstanceGroupConfig)

-- | Friendly name given to the instance group.
instanceGroupConfig_name :: Lens.Lens' InstanceGroupConfig (Prelude.Maybe Prelude.Text)
instanceGroupConfig_name :: (Maybe Text -> f (Maybe Text))
-> InstanceGroupConfig -> f InstanceGroupConfig
instanceGroupConfig_name = (InstanceGroupConfig -> Maybe Text)
-> (InstanceGroupConfig -> Maybe Text -> InstanceGroupConfig)
-> Lens
     InstanceGroupConfig InstanceGroupConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceGroupConfig' {Maybe Text
name :: Maybe Text
$sel:name:InstanceGroupConfig' :: InstanceGroupConfig -> Maybe Text
name} -> Maybe Text
name) (\s :: InstanceGroupConfig
s@InstanceGroupConfig' {} Maybe Text
a -> InstanceGroupConfig
s {$sel:name:InstanceGroupConfig' :: Maybe Text
name = Maybe Text
a} :: InstanceGroupConfig)

-- | An automatic scaling policy for a core instance group or task instance
-- group in an Amazon EMR cluster. The automatic scaling policy defines how
-- an instance group dynamically adds and terminates EC2 instances in
-- response to the value of a CloudWatch metric. See PutAutoScalingPolicy.
instanceGroupConfig_autoScalingPolicy :: Lens.Lens' InstanceGroupConfig (Prelude.Maybe AutoScalingPolicy)
instanceGroupConfig_autoScalingPolicy :: (Maybe AutoScalingPolicy -> f (Maybe AutoScalingPolicy))
-> InstanceGroupConfig -> f InstanceGroupConfig
instanceGroupConfig_autoScalingPolicy = (InstanceGroupConfig -> Maybe AutoScalingPolicy)
-> (InstanceGroupConfig
    -> Maybe AutoScalingPolicy -> InstanceGroupConfig)
-> Lens
     InstanceGroupConfig
     InstanceGroupConfig
     (Maybe AutoScalingPolicy)
     (Maybe AutoScalingPolicy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceGroupConfig' {Maybe AutoScalingPolicy
autoScalingPolicy :: Maybe AutoScalingPolicy
$sel:autoScalingPolicy:InstanceGroupConfig' :: InstanceGroupConfig -> Maybe AutoScalingPolicy
autoScalingPolicy} -> Maybe AutoScalingPolicy
autoScalingPolicy) (\s :: InstanceGroupConfig
s@InstanceGroupConfig' {} Maybe AutoScalingPolicy
a -> InstanceGroupConfig
s {$sel:autoScalingPolicy:InstanceGroupConfig' :: Maybe AutoScalingPolicy
autoScalingPolicy = Maybe AutoScalingPolicy
a} :: InstanceGroupConfig)

-- | The role of the instance group in the cluster.
instanceGroupConfig_instanceRole :: Lens.Lens' InstanceGroupConfig InstanceRoleType
instanceGroupConfig_instanceRole :: (InstanceRoleType -> f InstanceRoleType)
-> InstanceGroupConfig -> f InstanceGroupConfig
instanceGroupConfig_instanceRole = (InstanceGroupConfig -> InstanceRoleType)
-> (InstanceGroupConfig -> InstanceRoleType -> InstanceGroupConfig)
-> Lens
     InstanceGroupConfig
     InstanceGroupConfig
     InstanceRoleType
     InstanceRoleType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceGroupConfig' {InstanceRoleType
instanceRole :: InstanceRoleType
$sel:instanceRole:InstanceGroupConfig' :: InstanceGroupConfig -> InstanceRoleType
instanceRole} -> InstanceRoleType
instanceRole) (\s :: InstanceGroupConfig
s@InstanceGroupConfig' {} InstanceRoleType
a -> InstanceGroupConfig
s {$sel:instanceRole:InstanceGroupConfig' :: InstanceRoleType
instanceRole = InstanceRoleType
a} :: InstanceGroupConfig)

-- | The EC2 instance type for all instances in the instance group.
instanceGroupConfig_instanceType :: Lens.Lens' InstanceGroupConfig Prelude.Text
instanceGroupConfig_instanceType :: (Text -> f Text) -> InstanceGroupConfig -> f InstanceGroupConfig
instanceGroupConfig_instanceType = (InstanceGroupConfig -> Text)
-> (InstanceGroupConfig -> Text -> InstanceGroupConfig)
-> Lens InstanceGroupConfig InstanceGroupConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceGroupConfig' {Text
instanceType :: Text
$sel:instanceType:InstanceGroupConfig' :: InstanceGroupConfig -> Text
instanceType} -> Text
instanceType) (\s :: InstanceGroupConfig
s@InstanceGroupConfig' {} Text
a -> InstanceGroupConfig
s {$sel:instanceType:InstanceGroupConfig' :: Text
instanceType = Text
a} :: InstanceGroupConfig)

-- | Target number of instances for the instance group.
instanceGroupConfig_instanceCount :: Lens.Lens' InstanceGroupConfig Prelude.Int
instanceGroupConfig_instanceCount :: (Int -> f Int) -> InstanceGroupConfig -> f InstanceGroupConfig
instanceGroupConfig_instanceCount = (InstanceGroupConfig -> Int)
-> (InstanceGroupConfig -> Int -> InstanceGroupConfig)
-> Lens InstanceGroupConfig InstanceGroupConfig Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceGroupConfig' {Int
instanceCount :: Int
$sel:instanceCount:InstanceGroupConfig' :: InstanceGroupConfig -> Int
instanceCount} -> Int
instanceCount) (\s :: InstanceGroupConfig
s@InstanceGroupConfig' {} Int
a -> InstanceGroupConfig
s {$sel:instanceCount:InstanceGroupConfig' :: Int
instanceCount = Int
a} :: InstanceGroupConfig)

instance Prelude.Hashable InstanceGroupConfig

instance Prelude.NFData InstanceGroupConfig

instance Core.ToJSON InstanceGroupConfig where
  toJSON :: InstanceGroupConfig -> Value
toJSON InstanceGroupConfig' {Int
Maybe [Configuration]
Maybe Text
Maybe MarketType
Maybe AutoScalingPolicy
Maybe EbsConfiguration
Text
InstanceRoleType
instanceCount :: Int
instanceType :: Text
instanceRole :: InstanceRoleType
autoScalingPolicy :: Maybe AutoScalingPolicy
name :: Maybe Text
market :: Maybe MarketType
customAmiId :: Maybe Text
configurations :: Maybe [Configuration]
bidPrice :: Maybe Text
ebsConfiguration :: Maybe EbsConfiguration
$sel:instanceCount:InstanceGroupConfig' :: InstanceGroupConfig -> Int
$sel:instanceType:InstanceGroupConfig' :: InstanceGroupConfig -> Text
$sel:instanceRole:InstanceGroupConfig' :: InstanceGroupConfig -> InstanceRoleType
$sel:autoScalingPolicy:InstanceGroupConfig' :: InstanceGroupConfig -> Maybe AutoScalingPolicy
$sel:name:InstanceGroupConfig' :: InstanceGroupConfig -> Maybe Text
$sel:market:InstanceGroupConfig' :: InstanceGroupConfig -> Maybe MarketType
$sel:customAmiId:InstanceGroupConfig' :: InstanceGroupConfig -> Maybe Text
$sel:configurations:InstanceGroupConfig' :: InstanceGroupConfig -> Maybe [Configuration]
$sel:bidPrice:InstanceGroupConfig' :: InstanceGroupConfig -> Maybe Text
$sel:ebsConfiguration:InstanceGroupConfig' :: InstanceGroupConfig -> Maybe EbsConfiguration
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"EbsConfiguration" Text -> EbsConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (EbsConfiguration -> Pair) -> Maybe EbsConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EbsConfiguration
ebsConfiguration,
            (Text
"BidPrice" 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
bidPrice,
            (Text
"Configurations" Text -> [Configuration] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([Configuration] -> Pair) -> Maybe [Configuration] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Configuration]
configurations,
            (Text
"CustomAmiId" 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
customAmiId,
            (Text
"Market" Text -> MarketType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (MarketType -> Pair) -> Maybe MarketType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MarketType
market,
            (Text
"Name" 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
name,
            (Text
"AutoScalingPolicy" Text -> AutoScalingPolicy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AutoScalingPolicy -> Pair)
-> Maybe AutoScalingPolicy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AutoScalingPolicy
autoScalingPolicy,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"InstanceRole" Text -> InstanceRoleType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= InstanceRoleType
instanceRole),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"InstanceType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
instanceType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"InstanceCount" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
instanceCount)
          ]
      )