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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EMR.Types.InstanceFleetProvisioningSpecifications
import Amazonka.EMR.Types.InstanceFleetStatus
import Amazonka.EMR.Types.InstanceFleetType
import Amazonka.EMR.Types.InstanceTypeSpecification
import qualified Amazonka.Prelude as Prelude

-- | Describes an instance fleet, which is a group of EC2 instances that host
-- a particular node type (master, core, or task) in an Amazon EMR cluster.
-- Instance fleets can consist of a mix of instance types and On-Demand and
-- Spot Instances, which are provisioned to meet a defined target capacity.
--
-- The instance fleet configuration is available only in Amazon EMR
-- versions 4.8.0 and later, excluding 5.0.x versions.
--
-- /See:/ 'newInstanceFleet' smart constructor.
data InstanceFleet = InstanceFleet'
  { -- | The unique identifier of the instance fleet.
    InstanceFleet -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The node type that the instance fleet hosts. Valid values are MASTER,
    -- CORE, or TASK.
    InstanceFleet -> Maybe InstanceFleetType
instanceFleetType :: Prelude.Maybe InstanceFleetType,
    -- | An array of specifications for the instance types that comprise an
    -- instance fleet.
    InstanceFleet -> Maybe [InstanceTypeSpecification]
instanceTypeSpecifications :: Prelude.Maybe [InstanceTypeSpecification],
    -- | Describes the launch specification for an instance fleet.
    InstanceFleet -> Maybe InstanceFleetProvisioningSpecifications
launchSpecifications :: Prelude.Maybe InstanceFleetProvisioningSpecifications,
    -- | A friendly name for the instance fleet.
    InstanceFleet -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The number of On-Demand units that have been provisioned for the
    -- instance fleet to fulfill @TargetOnDemandCapacity@. This provisioned
    -- capacity might be less than or greater than @TargetOnDemandCapacity@.
    InstanceFleet -> Maybe Natural
provisionedOnDemandCapacity :: Prelude.Maybe Prelude.Natural,
    -- | The number of Spot units that have been provisioned for this instance
    -- fleet to fulfill @TargetSpotCapacity@. This provisioned capacity might
    -- be less than or greater than @TargetSpotCapacity@.
    InstanceFleet -> Maybe Natural
provisionedSpotCapacity :: Prelude.Maybe Prelude.Natural,
    -- | The current status of the instance fleet.
    InstanceFleet -> Maybe InstanceFleetStatus
status :: Prelude.Maybe InstanceFleetStatus,
    -- | The target capacity of On-Demand units for the instance fleet, which
    -- determines how many On-Demand Instances to provision. When the instance
    -- fleet launches, Amazon EMR tries to provision On-Demand Instances as
    -- specified by InstanceTypeConfig. Each instance configuration has a
    -- specified @WeightedCapacity@. When an On-Demand Instance is provisioned,
    -- the @WeightedCapacity@ units count toward the target capacity. Amazon
    -- EMR provisions instances until the target capacity is totally fulfilled,
    -- even if this results in an overage. For example, if there are 2 units
    -- remaining to fulfill capacity, and Amazon EMR can only provision an
    -- instance with a @WeightedCapacity@ of 5 units, the instance is
    -- provisioned, and the target capacity is exceeded by 3 units. You can use
    -- InstanceFleet$ProvisionedOnDemandCapacity to determine the Spot capacity
    -- units that have been provisioned for the instance fleet.
    --
    -- If not specified or set to 0, only Spot Instances are provisioned for
    -- the instance fleet using @TargetSpotCapacity@. At least one of
    -- @TargetSpotCapacity@ and @TargetOnDemandCapacity@ should be greater than
    -- 0. For a master instance fleet, only one of @TargetSpotCapacity@ and
    -- @TargetOnDemandCapacity@ can be specified, and its value must be 1.
    InstanceFleet -> Maybe Natural
targetOnDemandCapacity :: Prelude.Maybe Prelude.Natural,
    -- | The target capacity of Spot units for the instance fleet, which
    -- determines how many Spot Instances to provision. When the instance fleet
    -- launches, Amazon EMR tries to provision Spot Instances as specified by
    -- InstanceTypeConfig. Each instance configuration has a specified
    -- @WeightedCapacity@. When a Spot instance is provisioned, the
    -- @WeightedCapacity@ units count toward the target capacity. Amazon EMR
    -- provisions instances until the target capacity is totally fulfilled,
    -- even if this results in an overage. For example, if there are 2 units
    -- remaining to fulfill capacity, and Amazon EMR can only provision an
    -- instance with a @WeightedCapacity@ of 5 units, the instance is
    -- provisioned, and the target capacity is exceeded by 3 units. You can use
    -- InstanceFleet$ProvisionedSpotCapacity to determine the Spot capacity
    -- units that have been provisioned for the instance fleet.
    --
    -- If not specified or set to 0, only On-Demand Instances are provisioned
    -- for the instance fleet. At least one of @TargetSpotCapacity@ and
    -- @TargetOnDemandCapacity@ should be greater than 0. For a master instance
    -- fleet, only one of @TargetSpotCapacity@ and @TargetOnDemandCapacity@ can
    -- be specified, and its value must be 1.
    InstanceFleet -> Maybe Natural
targetSpotCapacity :: Prelude.Maybe Prelude.Natural
  }
  deriving (InstanceFleet -> InstanceFleet -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceFleet -> InstanceFleet -> Bool
$c/= :: InstanceFleet -> InstanceFleet -> Bool
== :: InstanceFleet -> InstanceFleet -> Bool
$c== :: InstanceFleet -> InstanceFleet -> Bool
Prelude.Eq, ReadPrec [InstanceFleet]
ReadPrec InstanceFleet
Int -> ReadS InstanceFleet
ReadS [InstanceFleet]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceFleet]
$creadListPrec :: ReadPrec [InstanceFleet]
readPrec :: ReadPrec InstanceFleet
$creadPrec :: ReadPrec InstanceFleet
readList :: ReadS [InstanceFleet]
$creadList :: ReadS [InstanceFleet]
readsPrec :: Int -> ReadS InstanceFleet
$creadsPrec :: Int -> ReadS InstanceFleet
Prelude.Read, Int -> InstanceFleet -> ShowS
[InstanceFleet] -> ShowS
InstanceFleet -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceFleet] -> ShowS
$cshowList :: [InstanceFleet] -> ShowS
show :: InstanceFleet -> String
$cshow :: InstanceFleet -> String
showsPrec :: Int -> InstanceFleet -> ShowS
$cshowsPrec :: Int -> InstanceFleet -> ShowS
Prelude.Show, forall x. Rep InstanceFleet x -> InstanceFleet
forall x. InstanceFleet -> Rep InstanceFleet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstanceFleet x -> InstanceFleet
$cfrom :: forall x. InstanceFleet -> Rep InstanceFleet x
Prelude.Generic)

-- |
-- Create a value of 'InstanceFleet' 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:
--
-- 'id', 'instanceFleet_id' - The unique identifier of the instance fleet.
--
-- 'instanceFleetType', 'instanceFleet_instanceFleetType' - The node type that the instance fleet hosts. Valid values are MASTER,
-- CORE, or TASK.
--
-- 'instanceTypeSpecifications', 'instanceFleet_instanceTypeSpecifications' - An array of specifications for the instance types that comprise an
-- instance fleet.
--
-- 'launchSpecifications', 'instanceFleet_launchSpecifications' - Describes the launch specification for an instance fleet.
--
-- 'name', 'instanceFleet_name' - A friendly name for the instance fleet.
--
-- 'provisionedOnDemandCapacity', 'instanceFleet_provisionedOnDemandCapacity' - The number of On-Demand units that have been provisioned for the
-- instance fleet to fulfill @TargetOnDemandCapacity@. This provisioned
-- capacity might be less than or greater than @TargetOnDemandCapacity@.
--
-- 'provisionedSpotCapacity', 'instanceFleet_provisionedSpotCapacity' - The number of Spot units that have been provisioned for this instance
-- fleet to fulfill @TargetSpotCapacity@. This provisioned capacity might
-- be less than or greater than @TargetSpotCapacity@.
--
-- 'status', 'instanceFleet_status' - The current status of the instance fleet.
--
-- 'targetOnDemandCapacity', 'instanceFleet_targetOnDemandCapacity' - The target capacity of On-Demand units for the instance fleet, which
-- determines how many On-Demand Instances to provision. When the instance
-- fleet launches, Amazon EMR tries to provision On-Demand Instances as
-- specified by InstanceTypeConfig. Each instance configuration has a
-- specified @WeightedCapacity@. When an On-Demand Instance is provisioned,
-- the @WeightedCapacity@ units count toward the target capacity. Amazon
-- EMR provisions instances until the target capacity is totally fulfilled,
-- even if this results in an overage. For example, if there are 2 units
-- remaining to fulfill capacity, and Amazon EMR can only provision an
-- instance with a @WeightedCapacity@ of 5 units, the instance is
-- provisioned, and the target capacity is exceeded by 3 units. You can use
-- InstanceFleet$ProvisionedOnDemandCapacity to determine the Spot capacity
-- units that have been provisioned for the instance fleet.
--
-- If not specified or set to 0, only Spot Instances are provisioned for
-- the instance fleet using @TargetSpotCapacity@. At least one of
-- @TargetSpotCapacity@ and @TargetOnDemandCapacity@ should be greater than
-- 0. For a master instance fleet, only one of @TargetSpotCapacity@ and
-- @TargetOnDemandCapacity@ can be specified, and its value must be 1.
--
-- 'targetSpotCapacity', 'instanceFleet_targetSpotCapacity' - The target capacity of Spot units for the instance fleet, which
-- determines how many Spot Instances to provision. When the instance fleet
-- launches, Amazon EMR tries to provision Spot Instances as specified by
-- InstanceTypeConfig. Each instance configuration has a specified
-- @WeightedCapacity@. When a Spot instance is provisioned, the
-- @WeightedCapacity@ units count toward the target capacity. Amazon EMR
-- provisions instances until the target capacity is totally fulfilled,
-- even if this results in an overage. For example, if there are 2 units
-- remaining to fulfill capacity, and Amazon EMR can only provision an
-- instance with a @WeightedCapacity@ of 5 units, the instance is
-- provisioned, and the target capacity is exceeded by 3 units. You can use
-- InstanceFleet$ProvisionedSpotCapacity to determine the Spot capacity
-- units that have been provisioned for the instance fleet.
--
-- If not specified or set to 0, only On-Demand Instances are provisioned
-- for the instance fleet. At least one of @TargetSpotCapacity@ and
-- @TargetOnDemandCapacity@ should be greater than 0. For a master instance
-- fleet, only one of @TargetSpotCapacity@ and @TargetOnDemandCapacity@ can
-- be specified, and its value must be 1.
newInstanceFleet ::
  InstanceFleet
newInstanceFleet :: InstanceFleet
newInstanceFleet =
  InstanceFleet'
    { $sel:id:InstanceFleet' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:instanceFleetType:InstanceFleet' :: Maybe InstanceFleetType
instanceFleetType = forall a. Maybe a
Prelude.Nothing,
      $sel:instanceTypeSpecifications:InstanceFleet' :: Maybe [InstanceTypeSpecification]
instanceTypeSpecifications = forall a. Maybe a
Prelude.Nothing,
      $sel:launchSpecifications:InstanceFleet' :: Maybe InstanceFleetProvisioningSpecifications
launchSpecifications = forall a. Maybe a
Prelude.Nothing,
      $sel:name:InstanceFleet' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:provisionedOnDemandCapacity:InstanceFleet' :: Maybe Natural
provisionedOnDemandCapacity = forall a. Maybe a
Prelude.Nothing,
      $sel:provisionedSpotCapacity:InstanceFleet' :: Maybe Natural
provisionedSpotCapacity = forall a. Maybe a
Prelude.Nothing,
      $sel:status:InstanceFleet' :: Maybe InstanceFleetStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:targetOnDemandCapacity:InstanceFleet' :: Maybe Natural
targetOnDemandCapacity = forall a. Maybe a
Prelude.Nothing,
      $sel:targetSpotCapacity:InstanceFleet' :: Maybe Natural
targetSpotCapacity = forall a. Maybe a
Prelude.Nothing
    }

-- | The unique identifier of the instance fleet.
instanceFleet_id :: Lens.Lens' InstanceFleet (Prelude.Maybe Prelude.Text)
instanceFleet_id :: Lens' InstanceFleet (Maybe Text)
instanceFleet_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceFleet' {Maybe Text
id :: Maybe Text
$sel:id:InstanceFleet' :: InstanceFleet -> Maybe Text
id} -> Maybe Text
id) (\s :: InstanceFleet
s@InstanceFleet' {} Maybe Text
a -> InstanceFleet
s {$sel:id:InstanceFleet' :: Maybe Text
id = Maybe Text
a} :: InstanceFleet)

-- | The node type that the instance fleet hosts. Valid values are MASTER,
-- CORE, or TASK.
instanceFleet_instanceFleetType :: Lens.Lens' InstanceFleet (Prelude.Maybe InstanceFleetType)
instanceFleet_instanceFleetType :: Lens' InstanceFleet (Maybe InstanceFleetType)
instanceFleet_instanceFleetType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceFleet' {Maybe InstanceFleetType
instanceFleetType :: Maybe InstanceFleetType
$sel:instanceFleetType:InstanceFleet' :: InstanceFleet -> Maybe InstanceFleetType
instanceFleetType} -> Maybe InstanceFleetType
instanceFleetType) (\s :: InstanceFleet
s@InstanceFleet' {} Maybe InstanceFleetType
a -> InstanceFleet
s {$sel:instanceFleetType:InstanceFleet' :: Maybe InstanceFleetType
instanceFleetType = Maybe InstanceFleetType
a} :: InstanceFleet)

-- | An array of specifications for the instance types that comprise an
-- instance fleet.
instanceFleet_instanceTypeSpecifications :: Lens.Lens' InstanceFleet (Prelude.Maybe [InstanceTypeSpecification])
instanceFleet_instanceTypeSpecifications :: Lens' InstanceFleet (Maybe [InstanceTypeSpecification])
instanceFleet_instanceTypeSpecifications = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceFleet' {Maybe [InstanceTypeSpecification]
instanceTypeSpecifications :: Maybe [InstanceTypeSpecification]
$sel:instanceTypeSpecifications:InstanceFleet' :: InstanceFleet -> Maybe [InstanceTypeSpecification]
instanceTypeSpecifications} -> Maybe [InstanceTypeSpecification]
instanceTypeSpecifications) (\s :: InstanceFleet
s@InstanceFleet' {} Maybe [InstanceTypeSpecification]
a -> InstanceFleet
s {$sel:instanceTypeSpecifications:InstanceFleet' :: Maybe [InstanceTypeSpecification]
instanceTypeSpecifications = Maybe [InstanceTypeSpecification]
a} :: InstanceFleet) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Describes the launch specification for an instance fleet.
instanceFleet_launchSpecifications :: Lens.Lens' InstanceFleet (Prelude.Maybe InstanceFleetProvisioningSpecifications)
instanceFleet_launchSpecifications :: Lens' InstanceFleet (Maybe InstanceFleetProvisioningSpecifications)
instanceFleet_launchSpecifications = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceFleet' {Maybe InstanceFleetProvisioningSpecifications
launchSpecifications :: Maybe InstanceFleetProvisioningSpecifications
$sel:launchSpecifications:InstanceFleet' :: InstanceFleet -> Maybe InstanceFleetProvisioningSpecifications
launchSpecifications} -> Maybe InstanceFleetProvisioningSpecifications
launchSpecifications) (\s :: InstanceFleet
s@InstanceFleet' {} Maybe InstanceFleetProvisioningSpecifications
a -> InstanceFleet
s {$sel:launchSpecifications:InstanceFleet' :: Maybe InstanceFleetProvisioningSpecifications
launchSpecifications = Maybe InstanceFleetProvisioningSpecifications
a} :: InstanceFleet)

-- | A friendly name for the instance fleet.
instanceFleet_name :: Lens.Lens' InstanceFleet (Prelude.Maybe Prelude.Text)
instanceFleet_name :: Lens' InstanceFleet (Maybe Text)
instanceFleet_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceFleet' {Maybe Text
name :: Maybe Text
$sel:name:InstanceFleet' :: InstanceFleet -> Maybe Text
name} -> Maybe Text
name) (\s :: InstanceFleet
s@InstanceFleet' {} Maybe Text
a -> InstanceFleet
s {$sel:name:InstanceFleet' :: Maybe Text
name = Maybe Text
a} :: InstanceFleet)

-- | The number of On-Demand units that have been provisioned for the
-- instance fleet to fulfill @TargetOnDemandCapacity@. This provisioned
-- capacity might be less than or greater than @TargetOnDemandCapacity@.
instanceFleet_provisionedOnDemandCapacity :: Lens.Lens' InstanceFleet (Prelude.Maybe Prelude.Natural)
instanceFleet_provisionedOnDemandCapacity :: Lens' InstanceFleet (Maybe Natural)
instanceFleet_provisionedOnDemandCapacity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceFleet' {Maybe Natural
provisionedOnDemandCapacity :: Maybe Natural
$sel:provisionedOnDemandCapacity:InstanceFleet' :: InstanceFleet -> Maybe Natural
provisionedOnDemandCapacity} -> Maybe Natural
provisionedOnDemandCapacity) (\s :: InstanceFleet
s@InstanceFleet' {} Maybe Natural
a -> InstanceFleet
s {$sel:provisionedOnDemandCapacity:InstanceFleet' :: Maybe Natural
provisionedOnDemandCapacity = Maybe Natural
a} :: InstanceFleet)

-- | The number of Spot units that have been provisioned for this instance
-- fleet to fulfill @TargetSpotCapacity@. This provisioned capacity might
-- be less than or greater than @TargetSpotCapacity@.
instanceFleet_provisionedSpotCapacity :: Lens.Lens' InstanceFleet (Prelude.Maybe Prelude.Natural)
instanceFleet_provisionedSpotCapacity :: Lens' InstanceFleet (Maybe Natural)
instanceFleet_provisionedSpotCapacity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceFleet' {Maybe Natural
provisionedSpotCapacity :: Maybe Natural
$sel:provisionedSpotCapacity:InstanceFleet' :: InstanceFleet -> Maybe Natural
provisionedSpotCapacity} -> Maybe Natural
provisionedSpotCapacity) (\s :: InstanceFleet
s@InstanceFleet' {} Maybe Natural
a -> InstanceFleet
s {$sel:provisionedSpotCapacity:InstanceFleet' :: Maybe Natural
provisionedSpotCapacity = Maybe Natural
a} :: InstanceFleet)

-- | The current status of the instance fleet.
instanceFleet_status :: Lens.Lens' InstanceFleet (Prelude.Maybe InstanceFleetStatus)
instanceFleet_status :: Lens' InstanceFleet (Maybe InstanceFleetStatus)
instanceFleet_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceFleet' {Maybe InstanceFleetStatus
status :: Maybe InstanceFleetStatus
$sel:status:InstanceFleet' :: InstanceFleet -> Maybe InstanceFleetStatus
status} -> Maybe InstanceFleetStatus
status) (\s :: InstanceFleet
s@InstanceFleet' {} Maybe InstanceFleetStatus
a -> InstanceFleet
s {$sel:status:InstanceFleet' :: Maybe InstanceFleetStatus
status = Maybe InstanceFleetStatus
a} :: InstanceFleet)

-- | The target capacity of On-Demand units for the instance fleet, which
-- determines how many On-Demand Instances to provision. When the instance
-- fleet launches, Amazon EMR tries to provision On-Demand Instances as
-- specified by InstanceTypeConfig. Each instance configuration has a
-- specified @WeightedCapacity@. When an On-Demand Instance is provisioned,
-- the @WeightedCapacity@ units count toward the target capacity. Amazon
-- EMR provisions instances until the target capacity is totally fulfilled,
-- even if this results in an overage. For example, if there are 2 units
-- remaining to fulfill capacity, and Amazon EMR can only provision an
-- instance with a @WeightedCapacity@ of 5 units, the instance is
-- provisioned, and the target capacity is exceeded by 3 units. You can use
-- InstanceFleet$ProvisionedOnDemandCapacity to determine the Spot capacity
-- units that have been provisioned for the instance fleet.
--
-- If not specified or set to 0, only Spot Instances are provisioned for
-- the instance fleet using @TargetSpotCapacity@. At least one of
-- @TargetSpotCapacity@ and @TargetOnDemandCapacity@ should be greater than
-- 0. For a master instance fleet, only one of @TargetSpotCapacity@ and
-- @TargetOnDemandCapacity@ can be specified, and its value must be 1.
instanceFleet_targetOnDemandCapacity :: Lens.Lens' InstanceFleet (Prelude.Maybe Prelude.Natural)
instanceFleet_targetOnDemandCapacity :: Lens' InstanceFleet (Maybe Natural)
instanceFleet_targetOnDemandCapacity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceFleet' {Maybe Natural
targetOnDemandCapacity :: Maybe Natural
$sel:targetOnDemandCapacity:InstanceFleet' :: InstanceFleet -> Maybe Natural
targetOnDemandCapacity} -> Maybe Natural
targetOnDemandCapacity) (\s :: InstanceFleet
s@InstanceFleet' {} Maybe Natural
a -> InstanceFleet
s {$sel:targetOnDemandCapacity:InstanceFleet' :: Maybe Natural
targetOnDemandCapacity = Maybe Natural
a} :: InstanceFleet)

-- | The target capacity of Spot units for the instance fleet, which
-- determines how many Spot Instances to provision. When the instance fleet
-- launches, Amazon EMR tries to provision Spot Instances as specified by
-- InstanceTypeConfig. Each instance configuration has a specified
-- @WeightedCapacity@. When a Spot instance is provisioned, the
-- @WeightedCapacity@ units count toward the target capacity. Amazon EMR
-- provisions instances until the target capacity is totally fulfilled,
-- even if this results in an overage. For example, if there are 2 units
-- remaining to fulfill capacity, and Amazon EMR can only provision an
-- instance with a @WeightedCapacity@ of 5 units, the instance is
-- provisioned, and the target capacity is exceeded by 3 units. You can use
-- InstanceFleet$ProvisionedSpotCapacity to determine the Spot capacity
-- units that have been provisioned for the instance fleet.
--
-- If not specified or set to 0, only On-Demand Instances are provisioned
-- for the instance fleet. At least one of @TargetSpotCapacity@ and
-- @TargetOnDemandCapacity@ should be greater than 0. For a master instance
-- fleet, only one of @TargetSpotCapacity@ and @TargetOnDemandCapacity@ can
-- be specified, and its value must be 1.
instanceFleet_targetSpotCapacity :: Lens.Lens' InstanceFleet (Prelude.Maybe Prelude.Natural)
instanceFleet_targetSpotCapacity :: Lens' InstanceFleet (Maybe Natural)
instanceFleet_targetSpotCapacity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceFleet' {Maybe Natural
targetSpotCapacity :: Maybe Natural
$sel:targetSpotCapacity:InstanceFleet' :: InstanceFleet -> Maybe Natural
targetSpotCapacity} -> Maybe Natural
targetSpotCapacity) (\s :: InstanceFleet
s@InstanceFleet' {} Maybe Natural
a -> InstanceFleet
s {$sel:targetSpotCapacity:InstanceFleet' :: Maybe Natural
targetSpotCapacity = Maybe Natural
a} :: InstanceFleet)

instance Data.FromJSON InstanceFleet where
  parseJSON :: Value -> Parser InstanceFleet
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InstanceFleet"
      ( \Object
x ->
          Maybe Text
-> Maybe InstanceFleetType
-> Maybe [InstanceTypeSpecification]
-> Maybe InstanceFleetProvisioningSpecifications
-> Maybe Text
-> Maybe Natural
-> Maybe Natural
-> Maybe InstanceFleetStatus
-> Maybe Natural
-> Maybe Natural
-> InstanceFleet
InstanceFleet'
            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
"Id")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"InstanceFleetType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"InstanceTypeSpecifications"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LaunchSpecifications")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ProvisionedOnDemandCapacity")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ProvisionedSpotCapacity")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Status")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"TargetOnDemandCapacity")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"TargetSpotCapacity")
      )

instance Prelude.Hashable InstanceFleet where
  hashWithSalt :: Int -> InstanceFleet -> Int
hashWithSalt Int
_salt InstanceFleet' {Maybe Natural
Maybe [InstanceTypeSpecification]
Maybe Text
Maybe InstanceFleetStatus
Maybe InstanceFleetType
Maybe InstanceFleetProvisioningSpecifications
targetSpotCapacity :: Maybe Natural
targetOnDemandCapacity :: Maybe Natural
status :: Maybe InstanceFleetStatus
provisionedSpotCapacity :: Maybe Natural
provisionedOnDemandCapacity :: Maybe Natural
name :: Maybe Text
launchSpecifications :: Maybe InstanceFleetProvisioningSpecifications
instanceTypeSpecifications :: Maybe [InstanceTypeSpecification]
instanceFleetType :: Maybe InstanceFleetType
id :: Maybe Text
$sel:targetSpotCapacity:InstanceFleet' :: InstanceFleet -> Maybe Natural
$sel:targetOnDemandCapacity:InstanceFleet' :: InstanceFleet -> Maybe Natural
$sel:status:InstanceFleet' :: InstanceFleet -> Maybe InstanceFleetStatus
$sel:provisionedSpotCapacity:InstanceFleet' :: InstanceFleet -> Maybe Natural
$sel:provisionedOnDemandCapacity:InstanceFleet' :: InstanceFleet -> Maybe Natural
$sel:name:InstanceFleet' :: InstanceFleet -> Maybe Text
$sel:launchSpecifications:InstanceFleet' :: InstanceFleet -> Maybe InstanceFleetProvisioningSpecifications
$sel:instanceTypeSpecifications:InstanceFleet' :: InstanceFleet -> Maybe [InstanceTypeSpecification]
$sel:instanceFleetType:InstanceFleet' :: InstanceFleet -> Maybe InstanceFleetType
$sel:id:InstanceFleet' :: InstanceFleet -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InstanceFleetType
instanceFleetType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [InstanceTypeSpecification]
instanceTypeSpecifications
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InstanceFleetProvisioningSpecifications
launchSpecifications
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
provisionedOnDemandCapacity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
provisionedSpotCapacity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InstanceFleetStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
targetOnDemandCapacity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
targetSpotCapacity

instance Prelude.NFData InstanceFleet where
  rnf :: InstanceFleet -> ()
rnf InstanceFleet' {Maybe Natural
Maybe [InstanceTypeSpecification]
Maybe Text
Maybe InstanceFleetStatus
Maybe InstanceFleetType
Maybe InstanceFleetProvisioningSpecifications
targetSpotCapacity :: Maybe Natural
targetOnDemandCapacity :: Maybe Natural
status :: Maybe InstanceFleetStatus
provisionedSpotCapacity :: Maybe Natural
provisionedOnDemandCapacity :: Maybe Natural
name :: Maybe Text
launchSpecifications :: Maybe InstanceFleetProvisioningSpecifications
instanceTypeSpecifications :: Maybe [InstanceTypeSpecification]
instanceFleetType :: Maybe InstanceFleetType
id :: Maybe Text
$sel:targetSpotCapacity:InstanceFleet' :: InstanceFleet -> Maybe Natural
$sel:targetOnDemandCapacity:InstanceFleet' :: InstanceFleet -> Maybe Natural
$sel:status:InstanceFleet' :: InstanceFleet -> Maybe InstanceFleetStatus
$sel:provisionedSpotCapacity:InstanceFleet' :: InstanceFleet -> Maybe Natural
$sel:provisionedOnDemandCapacity:InstanceFleet' :: InstanceFleet -> Maybe Natural
$sel:name:InstanceFleet' :: InstanceFleet -> Maybe Text
$sel:launchSpecifications:InstanceFleet' :: InstanceFleet -> Maybe InstanceFleetProvisioningSpecifications
$sel:instanceTypeSpecifications:InstanceFleet' :: InstanceFleet -> Maybe [InstanceTypeSpecification]
$sel:instanceFleetType:InstanceFleet' :: InstanceFleet -> Maybe InstanceFleetType
$sel:id:InstanceFleet' :: InstanceFleet -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InstanceFleetType
instanceFleetType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [InstanceTypeSpecification]
instanceTypeSpecifications
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InstanceFleetProvisioningSpecifications
launchSpecifications
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
provisionedOnDemandCapacity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
provisionedSpotCapacity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InstanceFleetStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
targetOnDemandCapacity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
targetSpotCapacity