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

import qualified Amazonka.Core as Core
import Amazonka.EMR.Types.InstanceFleetProvisioningSpecifications
import Amazonka.EMR.Types.InstanceFleetStatus
import Amazonka.EMR.Types.InstanceFleetType
import Amazonka.EMR.Types.InstanceTypeSpecification
import qualified Amazonka.Lens as Lens
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 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 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],
    -- | 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 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,
    -- | The unique identifier of the instance fleet.
    InstanceFleet -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | Describes the launch specification for an instance fleet.
    InstanceFleet -> Maybe InstanceFleetProvisioningSpecifications
launchSpecifications :: Prelude.Maybe InstanceFleetProvisioningSpecifications
  }
  deriving (InstanceFleet -> InstanceFleet -> Bool
(InstanceFleet -> InstanceFleet -> Bool)
-> (InstanceFleet -> InstanceFleet -> Bool) -> Eq InstanceFleet
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]
(Int -> ReadS InstanceFleet)
-> ReadS [InstanceFleet]
-> ReadPrec InstanceFleet
-> ReadPrec [InstanceFleet]
-> Read 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
(Int -> InstanceFleet -> ShowS)
-> (InstanceFleet -> String)
-> ([InstanceFleet] -> ShowS)
-> Show InstanceFleet
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. InstanceFleet -> Rep InstanceFleet x)
-> (forall x. Rep InstanceFleet x -> InstanceFleet)
-> Generic InstanceFleet
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:
--
-- '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.
--
-- '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.
--
-- '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@.
--
-- '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.
--
-- 'id', 'instanceFleet_id' - The unique identifier of the instance fleet.
--
-- 'launchSpecifications', 'instanceFleet_launchSpecifications' - Describes the launch specification for an instance fleet.
newInstanceFleet ::
  InstanceFleet
newInstanceFleet :: InstanceFleet
newInstanceFleet =
  InstanceFleet' :: Maybe Natural
-> Maybe InstanceFleetStatus
-> Maybe Natural
-> Maybe InstanceFleetType
-> Maybe [InstanceTypeSpecification]
-> Maybe Text
-> Maybe Natural
-> Maybe Natural
-> Maybe Text
-> Maybe InstanceFleetProvisioningSpecifications
-> InstanceFleet
InstanceFleet'
    { $sel:provisionedSpotCapacity:InstanceFleet' :: Maybe Natural
provisionedSpotCapacity =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:status:InstanceFleet' :: Maybe InstanceFleetStatus
status = Maybe InstanceFleetStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:targetOnDemandCapacity:InstanceFleet' :: Maybe Natural
targetOnDemandCapacity = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceFleetType:InstanceFleet' :: Maybe InstanceFleetType
instanceFleetType = Maybe InstanceFleetType
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceTypeSpecifications:InstanceFleet' :: Maybe [InstanceTypeSpecification]
instanceTypeSpecifications = Maybe [InstanceTypeSpecification]
forall a. Maybe a
Prelude.Nothing,
      $sel:name:InstanceFleet' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:provisionedOnDemandCapacity:InstanceFleet' :: Maybe Natural
provisionedOnDemandCapacity = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:targetSpotCapacity:InstanceFleet' :: Maybe Natural
targetSpotCapacity = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:id:InstanceFleet' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:launchSpecifications:InstanceFleet' :: Maybe InstanceFleetProvisioningSpecifications
launchSpecifications = Maybe InstanceFleetProvisioningSpecifications
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Natural -> f (Maybe Natural))
-> InstanceFleet -> f InstanceFleet
instanceFleet_provisionedSpotCapacity = (InstanceFleet -> Maybe Natural)
-> (InstanceFleet -> Maybe Natural -> InstanceFleet)
-> Lens InstanceFleet InstanceFleet (Maybe Natural) (Maybe Natural)
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 :: (Maybe InstanceFleetStatus -> f (Maybe InstanceFleetStatus))
-> InstanceFleet -> f InstanceFleet
instanceFleet_status = (InstanceFleet -> Maybe InstanceFleetStatus)
-> (InstanceFleet -> Maybe InstanceFleetStatus -> InstanceFleet)
-> Lens
     InstanceFleet
     InstanceFleet
     (Maybe InstanceFleetStatus)
     (Maybe InstanceFleetStatus)
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 :: (Maybe Natural -> f (Maybe Natural))
-> InstanceFleet -> f InstanceFleet
instanceFleet_targetOnDemandCapacity = (InstanceFleet -> Maybe Natural)
-> (InstanceFleet -> Maybe Natural -> InstanceFleet)
-> Lens InstanceFleet InstanceFleet (Maybe Natural) (Maybe Natural)
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 node type that the instance fleet hosts. Valid values are MASTER,
-- CORE, or TASK.
instanceFleet_instanceFleetType :: Lens.Lens' InstanceFleet (Prelude.Maybe InstanceFleetType)
instanceFleet_instanceFleetType :: (Maybe InstanceFleetType -> f (Maybe InstanceFleetType))
-> InstanceFleet -> f InstanceFleet
instanceFleet_instanceFleetType = (InstanceFleet -> Maybe InstanceFleetType)
-> (InstanceFleet -> Maybe InstanceFleetType -> InstanceFleet)
-> Lens
     InstanceFleet
     InstanceFleet
     (Maybe InstanceFleetType)
     (Maybe 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 :: (Maybe [InstanceTypeSpecification]
 -> f (Maybe [InstanceTypeSpecification]))
-> InstanceFleet -> f InstanceFleet
instanceFleet_instanceTypeSpecifications = (InstanceFleet -> Maybe [InstanceTypeSpecification])
-> (InstanceFleet
    -> Maybe [InstanceTypeSpecification] -> InstanceFleet)
-> Lens
     InstanceFleet
     InstanceFleet
     (Maybe [InstanceTypeSpecification])
     (Maybe [InstanceTypeSpecification])
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) ((Maybe [InstanceTypeSpecification]
  -> f (Maybe [InstanceTypeSpecification]))
 -> InstanceFleet -> f InstanceFleet)
-> ((Maybe [InstanceTypeSpecification]
     -> f (Maybe [InstanceTypeSpecification]))
    -> Maybe [InstanceTypeSpecification]
    -> f (Maybe [InstanceTypeSpecification]))
-> (Maybe [InstanceTypeSpecification]
    -> f (Maybe [InstanceTypeSpecification]))
-> InstanceFleet
-> f InstanceFleet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [InstanceTypeSpecification]
  [InstanceTypeSpecification]
  [InstanceTypeSpecification]
  [InstanceTypeSpecification]
-> Iso
     (Maybe [InstanceTypeSpecification])
     (Maybe [InstanceTypeSpecification])
     (Maybe [InstanceTypeSpecification])
     (Maybe [InstanceTypeSpecification])
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
  [InstanceTypeSpecification]
  [InstanceTypeSpecification]
  [InstanceTypeSpecification]
  [InstanceTypeSpecification]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A friendly name for the instance fleet.
instanceFleet_name :: Lens.Lens' InstanceFleet (Prelude.Maybe Prelude.Text)
instanceFleet_name :: (Maybe Text -> f (Maybe Text)) -> InstanceFleet -> f InstanceFleet
instanceFleet_name = (InstanceFleet -> Maybe Text)
-> (InstanceFleet -> Maybe Text -> InstanceFleet)
-> Lens InstanceFleet InstanceFleet (Maybe Text) (Maybe Text)
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 :: (Maybe Natural -> f (Maybe Natural))
-> InstanceFleet -> f InstanceFleet
instanceFleet_provisionedOnDemandCapacity = (InstanceFleet -> Maybe Natural)
-> (InstanceFleet -> Maybe Natural -> InstanceFleet)
-> Lens InstanceFleet InstanceFleet (Maybe Natural) (Maybe Natural)
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 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 :: (Maybe Natural -> f (Maybe Natural))
-> InstanceFleet -> f InstanceFleet
instanceFleet_targetSpotCapacity = (InstanceFleet -> Maybe Natural)
-> (InstanceFleet -> Maybe Natural -> InstanceFleet)
-> Lens InstanceFleet InstanceFleet (Maybe Natural) (Maybe Natural)
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)

-- | The unique identifier of the instance fleet.
instanceFleet_id :: Lens.Lens' InstanceFleet (Prelude.Maybe Prelude.Text)
instanceFleet_id :: (Maybe Text -> f (Maybe Text)) -> InstanceFleet -> f InstanceFleet
instanceFleet_id = (InstanceFleet -> Maybe Text)
-> (InstanceFleet -> Maybe Text -> InstanceFleet)
-> Lens InstanceFleet InstanceFleet (Maybe Text) (Maybe Text)
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)

-- | Describes the launch specification for an instance fleet.
instanceFleet_launchSpecifications :: Lens.Lens' InstanceFleet (Prelude.Maybe InstanceFleetProvisioningSpecifications)
instanceFleet_launchSpecifications :: (Maybe InstanceFleetProvisioningSpecifications
 -> f (Maybe InstanceFleetProvisioningSpecifications))
-> InstanceFleet -> f InstanceFleet
instanceFleet_launchSpecifications = (InstanceFleet -> Maybe InstanceFleetProvisioningSpecifications)
-> (InstanceFleet
    -> Maybe InstanceFleetProvisioningSpecifications -> InstanceFleet)
-> Lens
     InstanceFleet
     InstanceFleet
     (Maybe InstanceFleetProvisioningSpecifications)
     (Maybe InstanceFleetProvisioningSpecifications)
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)

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

instance Prelude.Hashable InstanceFleet

instance Prelude.NFData InstanceFleet