{-# 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.GameLift.Types.ScalingPolicy
-- 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.GameLift.Types.ScalingPolicy where

import qualified Amazonka.Core as Core
import Amazonka.GameLift.Types.ComparisonOperatorType
import Amazonka.GameLift.Types.LocationUpdateStatus
import Amazonka.GameLift.Types.MetricName
import Amazonka.GameLift.Types.PolicyType
import Amazonka.GameLift.Types.ScalingAdjustmentType
import Amazonka.GameLift.Types.ScalingStatusType
import Amazonka.GameLift.Types.TargetConfiguration
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Rule that controls how a fleet is scaled. Scaling policies are uniquely
-- identified by the combination of name and fleet ID.
--
-- __Related actions__
--
-- DescribeFleetCapacity | UpdateFleetCapacity | DescribeEC2InstanceLimits
-- | PutScalingPolicy | DescribeScalingPolicies | DeleteScalingPolicy |
-- StopFleetActions | StartFleetActions |
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/reference-awssdk.html#reference-awssdk-resources-fleets All APIs by task>
--
-- /See:/ 'newScalingPolicy' smart constructor.
data ScalingPolicy = ScalingPolicy'
  { -- | Current status of the scaling policy. The scaling policy can be in force
    -- only when in an @ACTIVE@ status. Scaling policies can be suspended for
    -- individual fleets (see StopFleetActions; if suspended for a fleet, the
    -- policy status does not change. View a fleet\'s stopped actions by
    -- calling DescribeFleetCapacity.
    --
    -- -   __ACTIVE__ -- The scaling policy can be used for auto-scaling a
    --     fleet.
    --
    -- -   __UPDATE_REQUESTED__ -- A request to update the scaling policy has
    --     been received.
    --
    -- -   __UPDATING__ -- A change is being made to the scaling policy.
    --
    -- -   __DELETE_REQUESTED__ -- A request to delete the scaling policy has
    --     been received.
    --
    -- -   __DELETING__ -- The scaling policy is being deleted.
    --
    -- -   __DELETED__ -- The scaling policy has been deleted.
    --
    -- -   __ERROR__ -- An error occurred in creating the policy. It should be
    --     removed and recreated.
    ScalingPolicy -> Maybe ScalingStatusType
status :: Prelude.Maybe ScalingStatusType,
    -- | The type of adjustment to make to a fleet\'s instance count (see
    -- FleetCapacity):
    --
    -- -   __ChangeInCapacity__ -- add (or subtract) the scaling adjustment
    --     value from the current instance count. Positive values scale up
    --     while negative values scale down.
    --
    -- -   __ExactCapacity__ -- set the instance count to the scaling
    --     adjustment value.
    --
    -- -   __PercentChangeInCapacity__ -- increase or reduce the current
    --     instance count by the scaling adjustment, read as a percentage.
    --     Positive values scale up while negative values scale down.
    ScalingPolicy -> Maybe ScalingAdjustmentType
scalingAdjustmentType :: Prelude.Maybe ScalingAdjustmentType,
    ScalingPolicy -> Maybe Text
location :: Prelude.Maybe Prelude.Text,
    -- | Length of time (in minutes) the metric must be at or beyond the
    -- threshold before a scaling event is triggered.
    ScalingPolicy -> Maybe Natural
evaluationPeriods :: Prelude.Maybe Prelude.Natural,
    -- | The type of scaling policy to create. For a target-based policy, set the
    -- parameter /MetricName/ to \'PercentAvailableGameSessions\' and specify a
    -- /TargetConfiguration/. For a rule-based policy set the following
    -- parameters: /MetricName/, /ComparisonOperator/, /Threshold/,
    -- /EvaluationPeriods/, /ScalingAdjustmentType/, and /ScalingAdjustment/.
    ScalingPolicy -> Maybe PolicyType
policyType :: Prelude.Maybe PolicyType,
    -- | Name of the Amazon GameLift-defined metric that is used to trigger a
    -- scaling adjustment. For detailed descriptions of fleet metrics, see
    -- <https://docs.aws.amazon.com/gamelift/latest/developerguide/monitoring-cloudwatch.html Monitor Amazon GameLift with Amazon CloudWatch>.
    --
    -- -   __ActivatingGameSessions__ -- Game sessions in the process of being
    --     created.
    --
    -- -   __ActiveGameSessions__ -- Game sessions that are currently running.
    --
    -- -   __ActiveInstances__ -- Fleet instances that are currently running at
    --     least one game session.
    --
    -- -   __AvailableGameSessions__ -- Additional game sessions that fleet
    --     could host simultaneously, given current capacity.
    --
    -- -   __AvailablePlayerSessions__ -- Empty player slots in currently
    --     active game sessions. This includes game sessions that are not
    --     currently accepting players. Reserved player slots are not included.
    --
    -- -   __CurrentPlayerSessions__ -- Player slots in active game sessions
    --     that are being used by a player or are reserved for a player.
    --
    -- -   __IdleInstances__ -- Active instances that are currently hosting
    --     zero game sessions.
    --
    -- -   __PercentAvailableGameSessions__ -- Unused percentage of the total
    --     number of game sessions that a fleet could host simultaneously,
    --     given current capacity. Use this metric for a target-based scaling
    --     policy.
    --
    -- -   __PercentIdleInstances__ -- Percentage of the total number of active
    --     instances that are hosting zero game sessions.
    --
    -- -   __QueueDepth__ -- Pending game session placement requests, in any
    --     queue, where the current fleet is the top-priority destination.
    --
    -- -   __WaitTime__ -- Current wait time for pending game session placement
    --     requests, in any queue, where the current fleet is the top-priority
    --     destination.
    ScalingPolicy -> Maybe MetricName
metricName :: Prelude.Maybe MetricName,
    -- | The Amazon Resource Name
    -- (<https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html ARN>)
    -- that is assigned to a GameLift fleet resource and uniquely identifies
    -- it. ARNs are unique across all Regions. Format is
    -- @arn:aws:gamelift:\<region>::fleet\/fleet-a1234567-b8c9-0d1e-2fa3-b45c6d7e8912@.
    ScalingPolicy -> Maybe Text
fleetArn :: Prelude.Maybe Prelude.Text,
    -- | Comparison operator to use when measuring a metric against the threshold
    -- value.
    ScalingPolicy -> Maybe ComparisonOperatorType
comparisonOperator :: Prelude.Maybe ComparisonOperatorType,
    -- | A descriptive label that is associated with a fleet\'s scaling policy.
    -- Policy names do not need to be unique.
    ScalingPolicy -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Metric value used to trigger a scaling event.
    ScalingPolicy -> Maybe Double
threshold :: Prelude.Maybe Prelude.Double,
    -- | Amount of adjustment to make, based on the scaling adjustment type.
    ScalingPolicy -> Maybe Int
scalingAdjustment :: Prelude.Maybe Prelude.Int,
    -- | The current status of the fleet\'s scaling policies in a requested fleet
    -- location. The status @PENDING_UPDATE@ indicates that an update was
    -- requested for the fleet but has not yet been completed for the location.
    ScalingPolicy -> Maybe LocationUpdateStatus
updateStatus :: Prelude.Maybe LocationUpdateStatus,
    -- | A unique identifier for the fleet that is associated with this scaling
    -- policy.
    ScalingPolicy -> Maybe Text
fleetId :: Prelude.Maybe Prelude.Text,
    -- | An object that contains settings for a target-based scaling policy.
    ScalingPolicy -> Maybe TargetConfiguration
targetConfiguration :: Prelude.Maybe TargetConfiguration
  }
  deriving (ScalingPolicy -> ScalingPolicy -> Bool
(ScalingPolicy -> ScalingPolicy -> Bool)
-> (ScalingPolicy -> ScalingPolicy -> Bool) -> Eq ScalingPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScalingPolicy -> ScalingPolicy -> Bool
$c/= :: ScalingPolicy -> ScalingPolicy -> Bool
== :: ScalingPolicy -> ScalingPolicy -> Bool
$c== :: ScalingPolicy -> ScalingPolicy -> Bool
Prelude.Eq, ReadPrec [ScalingPolicy]
ReadPrec ScalingPolicy
Int -> ReadS ScalingPolicy
ReadS [ScalingPolicy]
(Int -> ReadS ScalingPolicy)
-> ReadS [ScalingPolicy]
-> ReadPrec ScalingPolicy
-> ReadPrec [ScalingPolicy]
-> Read ScalingPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScalingPolicy]
$creadListPrec :: ReadPrec [ScalingPolicy]
readPrec :: ReadPrec ScalingPolicy
$creadPrec :: ReadPrec ScalingPolicy
readList :: ReadS [ScalingPolicy]
$creadList :: ReadS [ScalingPolicy]
readsPrec :: Int -> ReadS ScalingPolicy
$creadsPrec :: Int -> ReadS ScalingPolicy
Prelude.Read, Int -> ScalingPolicy -> ShowS
[ScalingPolicy] -> ShowS
ScalingPolicy -> String
(Int -> ScalingPolicy -> ShowS)
-> (ScalingPolicy -> String)
-> ([ScalingPolicy] -> ShowS)
-> Show ScalingPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScalingPolicy] -> ShowS
$cshowList :: [ScalingPolicy] -> ShowS
show :: ScalingPolicy -> String
$cshow :: ScalingPolicy -> String
showsPrec :: Int -> ScalingPolicy -> ShowS
$cshowsPrec :: Int -> ScalingPolicy -> ShowS
Prelude.Show, (forall x. ScalingPolicy -> Rep ScalingPolicy x)
-> (forall x. Rep ScalingPolicy x -> ScalingPolicy)
-> Generic ScalingPolicy
forall x. Rep ScalingPolicy x -> ScalingPolicy
forall x. ScalingPolicy -> Rep ScalingPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScalingPolicy x -> ScalingPolicy
$cfrom :: forall x. ScalingPolicy -> Rep ScalingPolicy x
Prelude.Generic)

-- |
-- Create a value of 'ScalingPolicy' 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:
--
-- 'status', 'scalingPolicy_status' - Current status of the scaling policy. The scaling policy can be in force
-- only when in an @ACTIVE@ status. Scaling policies can be suspended for
-- individual fleets (see StopFleetActions; if suspended for a fleet, the
-- policy status does not change. View a fleet\'s stopped actions by
-- calling DescribeFleetCapacity.
--
-- -   __ACTIVE__ -- The scaling policy can be used for auto-scaling a
--     fleet.
--
-- -   __UPDATE_REQUESTED__ -- A request to update the scaling policy has
--     been received.
--
-- -   __UPDATING__ -- A change is being made to the scaling policy.
--
-- -   __DELETE_REQUESTED__ -- A request to delete the scaling policy has
--     been received.
--
-- -   __DELETING__ -- The scaling policy is being deleted.
--
-- -   __DELETED__ -- The scaling policy has been deleted.
--
-- -   __ERROR__ -- An error occurred in creating the policy. It should be
--     removed and recreated.
--
-- 'scalingAdjustmentType', 'scalingPolicy_scalingAdjustmentType' - The type of adjustment to make to a fleet\'s instance count (see
-- FleetCapacity):
--
-- -   __ChangeInCapacity__ -- add (or subtract) the scaling adjustment
--     value from the current instance count. Positive values scale up
--     while negative values scale down.
--
-- -   __ExactCapacity__ -- set the instance count to the scaling
--     adjustment value.
--
-- -   __PercentChangeInCapacity__ -- increase or reduce the current
--     instance count by the scaling adjustment, read as a percentage.
--     Positive values scale up while negative values scale down.
--
-- 'location', 'scalingPolicy_location' -
--
-- 'evaluationPeriods', 'scalingPolicy_evaluationPeriods' - Length of time (in minutes) the metric must be at or beyond the
-- threshold before a scaling event is triggered.
--
-- 'policyType', 'scalingPolicy_policyType' - The type of scaling policy to create. For a target-based policy, set the
-- parameter /MetricName/ to \'PercentAvailableGameSessions\' and specify a
-- /TargetConfiguration/. For a rule-based policy set the following
-- parameters: /MetricName/, /ComparisonOperator/, /Threshold/,
-- /EvaluationPeriods/, /ScalingAdjustmentType/, and /ScalingAdjustment/.
--
-- 'metricName', 'scalingPolicy_metricName' - Name of the Amazon GameLift-defined metric that is used to trigger a
-- scaling adjustment. For detailed descriptions of fleet metrics, see
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/monitoring-cloudwatch.html Monitor Amazon GameLift with Amazon CloudWatch>.
--
-- -   __ActivatingGameSessions__ -- Game sessions in the process of being
--     created.
--
-- -   __ActiveGameSessions__ -- Game sessions that are currently running.
--
-- -   __ActiveInstances__ -- Fleet instances that are currently running at
--     least one game session.
--
-- -   __AvailableGameSessions__ -- Additional game sessions that fleet
--     could host simultaneously, given current capacity.
--
-- -   __AvailablePlayerSessions__ -- Empty player slots in currently
--     active game sessions. This includes game sessions that are not
--     currently accepting players. Reserved player slots are not included.
--
-- -   __CurrentPlayerSessions__ -- Player slots in active game sessions
--     that are being used by a player or are reserved for a player.
--
-- -   __IdleInstances__ -- Active instances that are currently hosting
--     zero game sessions.
--
-- -   __PercentAvailableGameSessions__ -- Unused percentage of the total
--     number of game sessions that a fleet could host simultaneously,
--     given current capacity. Use this metric for a target-based scaling
--     policy.
--
-- -   __PercentIdleInstances__ -- Percentage of the total number of active
--     instances that are hosting zero game sessions.
--
-- -   __QueueDepth__ -- Pending game session placement requests, in any
--     queue, where the current fleet is the top-priority destination.
--
-- -   __WaitTime__ -- Current wait time for pending game session placement
--     requests, in any queue, where the current fleet is the top-priority
--     destination.
--
-- 'fleetArn', 'scalingPolicy_fleetArn' - The Amazon Resource Name
-- (<https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html ARN>)
-- that is assigned to a GameLift fleet resource and uniquely identifies
-- it. ARNs are unique across all Regions. Format is
-- @arn:aws:gamelift:\<region>::fleet\/fleet-a1234567-b8c9-0d1e-2fa3-b45c6d7e8912@.
--
-- 'comparisonOperator', 'scalingPolicy_comparisonOperator' - Comparison operator to use when measuring a metric against the threshold
-- value.
--
-- 'name', 'scalingPolicy_name' - A descriptive label that is associated with a fleet\'s scaling policy.
-- Policy names do not need to be unique.
--
-- 'threshold', 'scalingPolicy_threshold' - Metric value used to trigger a scaling event.
--
-- 'scalingAdjustment', 'scalingPolicy_scalingAdjustment' - Amount of adjustment to make, based on the scaling adjustment type.
--
-- 'updateStatus', 'scalingPolicy_updateStatus' - The current status of the fleet\'s scaling policies in a requested fleet
-- location. The status @PENDING_UPDATE@ indicates that an update was
-- requested for the fleet but has not yet been completed for the location.
--
-- 'fleetId', 'scalingPolicy_fleetId' - A unique identifier for the fleet that is associated with this scaling
-- policy.
--
-- 'targetConfiguration', 'scalingPolicy_targetConfiguration' - An object that contains settings for a target-based scaling policy.
newScalingPolicy ::
  ScalingPolicy
newScalingPolicy :: ScalingPolicy
newScalingPolicy =
  ScalingPolicy' :: Maybe ScalingStatusType
-> Maybe ScalingAdjustmentType
-> Maybe Text
-> Maybe Natural
-> Maybe PolicyType
-> Maybe MetricName
-> Maybe Text
-> Maybe ComparisonOperatorType
-> Maybe Text
-> Maybe Double
-> Maybe Int
-> Maybe LocationUpdateStatus
-> Maybe Text
-> Maybe TargetConfiguration
-> ScalingPolicy
ScalingPolicy'
    { $sel:status:ScalingPolicy' :: Maybe ScalingStatusType
status = Maybe ScalingStatusType
forall a. Maybe a
Prelude.Nothing,
      $sel:scalingAdjustmentType:ScalingPolicy' :: Maybe ScalingAdjustmentType
scalingAdjustmentType = Maybe ScalingAdjustmentType
forall a. Maybe a
Prelude.Nothing,
      $sel:location:ScalingPolicy' :: Maybe Text
location = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:evaluationPeriods:ScalingPolicy' :: Maybe Natural
evaluationPeriods = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:policyType:ScalingPolicy' :: Maybe PolicyType
policyType = Maybe PolicyType
forall a. Maybe a
Prelude.Nothing,
      $sel:metricName:ScalingPolicy' :: Maybe MetricName
metricName = Maybe MetricName
forall a. Maybe a
Prelude.Nothing,
      $sel:fleetArn:ScalingPolicy' :: Maybe Text
fleetArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:comparisonOperator:ScalingPolicy' :: Maybe ComparisonOperatorType
comparisonOperator = Maybe ComparisonOperatorType
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ScalingPolicy' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:threshold:ScalingPolicy' :: Maybe Double
threshold = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:scalingAdjustment:ScalingPolicy' :: Maybe Int
scalingAdjustment = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:updateStatus:ScalingPolicy' :: Maybe LocationUpdateStatus
updateStatus = Maybe LocationUpdateStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:fleetId:ScalingPolicy' :: Maybe Text
fleetId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:targetConfiguration:ScalingPolicy' :: Maybe TargetConfiguration
targetConfiguration = Maybe TargetConfiguration
forall a. Maybe a
Prelude.Nothing
    }

-- | Current status of the scaling policy. The scaling policy can be in force
-- only when in an @ACTIVE@ status. Scaling policies can be suspended for
-- individual fleets (see StopFleetActions; if suspended for a fleet, the
-- policy status does not change. View a fleet\'s stopped actions by
-- calling DescribeFleetCapacity.
--
-- -   __ACTIVE__ -- The scaling policy can be used for auto-scaling a
--     fleet.
--
-- -   __UPDATE_REQUESTED__ -- A request to update the scaling policy has
--     been received.
--
-- -   __UPDATING__ -- A change is being made to the scaling policy.
--
-- -   __DELETE_REQUESTED__ -- A request to delete the scaling policy has
--     been received.
--
-- -   __DELETING__ -- The scaling policy is being deleted.
--
-- -   __DELETED__ -- The scaling policy has been deleted.
--
-- -   __ERROR__ -- An error occurred in creating the policy. It should be
--     removed and recreated.
scalingPolicy_status :: Lens.Lens' ScalingPolicy (Prelude.Maybe ScalingStatusType)
scalingPolicy_status :: (Maybe ScalingStatusType -> f (Maybe ScalingStatusType))
-> ScalingPolicy -> f ScalingPolicy
scalingPolicy_status = (ScalingPolicy -> Maybe ScalingStatusType)
-> (ScalingPolicy -> Maybe ScalingStatusType -> ScalingPolicy)
-> Lens
     ScalingPolicy
     ScalingPolicy
     (Maybe ScalingStatusType)
     (Maybe ScalingStatusType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe ScalingStatusType
status :: Maybe ScalingStatusType
$sel:status:ScalingPolicy' :: ScalingPolicy -> Maybe ScalingStatusType
status} -> Maybe ScalingStatusType
status) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe ScalingStatusType
a -> ScalingPolicy
s {$sel:status:ScalingPolicy' :: Maybe ScalingStatusType
status = Maybe ScalingStatusType
a} :: ScalingPolicy)

-- | The type of adjustment to make to a fleet\'s instance count (see
-- FleetCapacity):
--
-- -   __ChangeInCapacity__ -- add (or subtract) the scaling adjustment
--     value from the current instance count. Positive values scale up
--     while negative values scale down.
--
-- -   __ExactCapacity__ -- set the instance count to the scaling
--     adjustment value.
--
-- -   __PercentChangeInCapacity__ -- increase or reduce the current
--     instance count by the scaling adjustment, read as a percentage.
--     Positive values scale up while negative values scale down.
scalingPolicy_scalingAdjustmentType :: Lens.Lens' ScalingPolicy (Prelude.Maybe ScalingAdjustmentType)
scalingPolicy_scalingAdjustmentType :: (Maybe ScalingAdjustmentType -> f (Maybe ScalingAdjustmentType))
-> ScalingPolicy -> f ScalingPolicy
scalingPolicy_scalingAdjustmentType = (ScalingPolicy -> Maybe ScalingAdjustmentType)
-> (ScalingPolicy -> Maybe ScalingAdjustmentType -> ScalingPolicy)
-> Lens
     ScalingPolicy
     ScalingPolicy
     (Maybe ScalingAdjustmentType)
     (Maybe ScalingAdjustmentType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe ScalingAdjustmentType
scalingAdjustmentType :: Maybe ScalingAdjustmentType
$sel:scalingAdjustmentType:ScalingPolicy' :: ScalingPolicy -> Maybe ScalingAdjustmentType
scalingAdjustmentType} -> Maybe ScalingAdjustmentType
scalingAdjustmentType) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe ScalingAdjustmentType
a -> ScalingPolicy
s {$sel:scalingAdjustmentType:ScalingPolicy' :: Maybe ScalingAdjustmentType
scalingAdjustmentType = Maybe ScalingAdjustmentType
a} :: ScalingPolicy)

-- |
scalingPolicy_location :: Lens.Lens' ScalingPolicy (Prelude.Maybe Prelude.Text)
scalingPolicy_location :: (Maybe Text -> f (Maybe Text)) -> ScalingPolicy -> f ScalingPolicy
scalingPolicy_location = (ScalingPolicy -> Maybe Text)
-> (ScalingPolicy -> Maybe Text -> ScalingPolicy)
-> Lens ScalingPolicy ScalingPolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe Text
location :: Maybe Text
$sel:location:ScalingPolicy' :: ScalingPolicy -> Maybe Text
location} -> Maybe Text
location) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe Text
a -> ScalingPolicy
s {$sel:location:ScalingPolicy' :: Maybe Text
location = Maybe Text
a} :: ScalingPolicy)

-- | Length of time (in minutes) the metric must be at or beyond the
-- threshold before a scaling event is triggered.
scalingPolicy_evaluationPeriods :: Lens.Lens' ScalingPolicy (Prelude.Maybe Prelude.Natural)
scalingPolicy_evaluationPeriods :: (Maybe Natural -> f (Maybe Natural))
-> ScalingPolicy -> f ScalingPolicy
scalingPolicy_evaluationPeriods = (ScalingPolicy -> Maybe Natural)
-> (ScalingPolicy -> Maybe Natural -> ScalingPolicy)
-> Lens ScalingPolicy ScalingPolicy (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe Natural
evaluationPeriods :: Maybe Natural
$sel:evaluationPeriods:ScalingPolicy' :: ScalingPolicy -> Maybe Natural
evaluationPeriods} -> Maybe Natural
evaluationPeriods) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe Natural
a -> ScalingPolicy
s {$sel:evaluationPeriods:ScalingPolicy' :: Maybe Natural
evaluationPeriods = Maybe Natural
a} :: ScalingPolicy)

-- | The type of scaling policy to create. For a target-based policy, set the
-- parameter /MetricName/ to \'PercentAvailableGameSessions\' and specify a
-- /TargetConfiguration/. For a rule-based policy set the following
-- parameters: /MetricName/, /ComparisonOperator/, /Threshold/,
-- /EvaluationPeriods/, /ScalingAdjustmentType/, and /ScalingAdjustment/.
scalingPolicy_policyType :: Lens.Lens' ScalingPolicy (Prelude.Maybe PolicyType)
scalingPolicy_policyType :: (Maybe PolicyType -> f (Maybe PolicyType))
-> ScalingPolicy -> f ScalingPolicy
scalingPolicy_policyType = (ScalingPolicy -> Maybe PolicyType)
-> (ScalingPolicy -> Maybe PolicyType -> ScalingPolicy)
-> Lens
     ScalingPolicy ScalingPolicy (Maybe PolicyType) (Maybe PolicyType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe PolicyType
policyType :: Maybe PolicyType
$sel:policyType:ScalingPolicy' :: ScalingPolicy -> Maybe PolicyType
policyType} -> Maybe PolicyType
policyType) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe PolicyType
a -> ScalingPolicy
s {$sel:policyType:ScalingPolicy' :: Maybe PolicyType
policyType = Maybe PolicyType
a} :: ScalingPolicy)

-- | Name of the Amazon GameLift-defined metric that is used to trigger a
-- scaling adjustment. For detailed descriptions of fleet metrics, see
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/monitoring-cloudwatch.html Monitor Amazon GameLift with Amazon CloudWatch>.
--
-- -   __ActivatingGameSessions__ -- Game sessions in the process of being
--     created.
--
-- -   __ActiveGameSessions__ -- Game sessions that are currently running.
--
-- -   __ActiveInstances__ -- Fleet instances that are currently running at
--     least one game session.
--
-- -   __AvailableGameSessions__ -- Additional game sessions that fleet
--     could host simultaneously, given current capacity.
--
-- -   __AvailablePlayerSessions__ -- Empty player slots in currently
--     active game sessions. This includes game sessions that are not
--     currently accepting players. Reserved player slots are not included.
--
-- -   __CurrentPlayerSessions__ -- Player slots in active game sessions
--     that are being used by a player or are reserved for a player.
--
-- -   __IdleInstances__ -- Active instances that are currently hosting
--     zero game sessions.
--
-- -   __PercentAvailableGameSessions__ -- Unused percentage of the total
--     number of game sessions that a fleet could host simultaneously,
--     given current capacity. Use this metric for a target-based scaling
--     policy.
--
-- -   __PercentIdleInstances__ -- Percentage of the total number of active
--     instances that are hosting zero game sessions.
--
-- -   __QueueDepth__ -- Pending game session placement requests, in any
--     queue, where the current fleet is the top-priority destination.
--
-- -   __WaitTime__ -- Current wait time for pending game session placement
--     requests, in any queue, where the current fleet is the top-priority
--     destination.
scalingPolicy_metricName :: Lens.Lens' ScalingPolicy (Prelude.Maybe MetricName)
scalingPolicy_metricName :: (Maybe MetricName -> f (Maybe MetricName))
-> ScalingPolicy -> f ScalingPolicy
scalingPolicy_metricName = (ScalingPolicy -> Maybe MetricName)
-> (ScalingPolicy -> Maybe MetricName -> ScalingPolicy)
-> Lens
     ScalingPolicy ScalingPolicy (Maybe MetricName) (Maybe MetricName)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe MetricName
metricName :: Maybe MetricName
$sel:metricName:ScalingPolicy' :: ScalingPolicy -> Maybe MetricName
metricName} -> Maybe MetricName
metricName) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe MetricName
a -> ScalingPolicy
s {$sel:metricName:ScalingPolicy' :: Maybe MetricName
metricName = Maybe MetricName
a} :: ScalingPolicy)

-- | The Amazon Resource Name
-- (<https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html ARN>)
-- that is assigned to a GameLift fleet resource and uniquely identifies
-- it. ARNs are unique across all Regions. Format is
-- @arn:aws:gamelift:\<region>::fleet\/fleet-a1234567-b8c9-0d1e-2fa3-b45c6d7e8912@.
scalingPolicy_fleetArn :: Lens.Lens' ScalingPolicy (Prelude.Maybe Prelude.Text)
scalingPolicy_fleetArn :: (Maybe Text -> f (Maybe Text)) -> ScalingPolicy -> f ScalingPolicy
scalingPolicy_fleetArn = (ScalingPolicy -> Maybe Text)
-> (ScalingPolicy -> Maybe Text -> ScalingPolicy)
-> Lens ScalingPolicy ScalingPolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe Text
fleetArn :: Maybe Text
$sel:fleetArn:ScalingPolicy' :: ScalingPolicy -> Maybe Text
fleetArn} -> Maybe Text
fleetArn) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe Text
a -> ScalingPolicy
s {$sel:fleetArn:ScalingPolicy' :: Maybe Text
fleetArn = Maybe Text
a} :: ScalingPolicy)

-- | Comparison operator to use when measuring a metric against the threshold
-- value.
scalingPolicy_comparisonOperator :: Lens.Lens' ScalingPolicy (Prelude.Maybe ComparisonOperatorType)
scalingPolicy_comparisonOperator :: (Maybe ComparisonOperatorType -> f (Maybe ComparisonOperatorType))
-> ScalingPolicy -> f ScalingPolicy
scalingPolicy_comparisonOperator = (ScalingPolicy -> Maybe ComparisonOperatorType)
-> (ScalingPolicy -> Maybe ComparisonOperatorType -> ScalingPolicy)
-> Lens
     ScalingPolicy
     ScalingPolicy
     (Maybe ComparisonOperatorType)
     (Maybe ComparisonOperatorType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe ComparisonOperatorType
comparisonOperator :: Maybe ComparisonOperatorType
$sel:comparisonOperator:ScalingPolicy' :: ScalingPolicy -> Maybe ComparisonOperatorType
comparisonOperator} -> Maybe ComparisonOperatorType
comparisonOperator) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe ComparisonOperatorType
a -> ScalingPolicy
s {$sel:comparisonOperator:ScalingPolicy' :: Maybe ComparisonOperatorType
comparisonOperator = Maybe ComparisonOperatorType
a} :: ScalingPolicy)

-- | A descriptive label that is associated with a fleet\'s scaling policy.
-- Policy names do not need to be unique.
scalingPolicy_name :: Lens.Lens' ScalingPolicy (Prelude.Maybe Prelude.Text)
scalingPolicy_name :: (Maybe Text -> f (Maybe Text)) -> ScalingPolicy -> f ScalingPolicy
scalingPolicy_name = (ScalingPolicy -> Maybe Text)
-> (ScalingPolicy -> Maybe Text -> ScalingPolicy)
-> Lens ScalingPolicy ScalingPolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe Text
name :: Maybe Text
$sel:name:ScalingPolicy' :: ScalingPolicy -> Maybe Text
name} -> Maybe Text
name) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe Text
a -> ScalingPolicy
s {$sel:name:ScalingPolicy' :: Maybe Text
name = Maybe Text
a} :: ScalingPolicy)

-- | Metric value used to trigger a scaling event.
scalingPolicy_threshold :: Lens.Lens' ScalingPolicy (Prelude.Maybe Prelude.Double)
scalingPolicy_threshold :: (Maybe Double -> f (Maybe Double))
-> ScalingPolicy -> f ScalingPolicy
scalingPolicy_threshold = (ScalingPolicy -> Maybe Double)
-> (ScalingPolicy -> Maybe Double -> ScalingPolicy)
-> Lens ScalingPolicy ScalingPolicy (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe Double
threshold :: Maybe Double
$sel:threshold:ScalingPolicy' :: ScalingPolicy -> Maybe Double
threshold} -> Maybe Double
threshold) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe Double
a -> ScalingPolicy
s {$sel:threshold:ScalingPolicy' :: Maybe Double
threshold = Maybe Double
a} :: ScalingPolicy)

-- | Amount of adjustment to make, based on the scaling adjustment type.
scalingPolicy_scalingAdjustment :: Lens.Lens' ScalingPolicy (Prelude.Maybe Prelude.Int)
scalingPolicy_scalingAdjustment :: (Maybe Int -> f (Maybe Int)) -> ScalingPolicy -> f ScalingPolicy
scalingPolicy_scalingAdjustment = (ScalingPolicy -> Maybe Int)
-> (ScalingPolicy -> Maybe Int -> ScalingPolicy)
-> Lens ScalingPolicy ScalingPolicy (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe Int
scalingAdjustment :: Maybe Int
$sel:scalingAdjustment:ScalingPolicy' :: ScalingPolicy -> Maybe Int
scalingAdjustment} -> Maybe Int
scalingAdjustment) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe Int
a -> ScalingPolicy
s {$sel:scalingAdjustment:ScalingPolicy' :: Maybe Int
scalingAdjustment = Maybe Int
a} :: ScalingPolicy)

-- | The current status of the fleet\'s scaling policies in a requested fleet
-- location. The status @PENDING_UPDATE@ indicates that an update was
-- requested for the fleet but has not yet been completed for the location.
scalingPolicy_updateStatus :: Lens.Lens' ScalingPolicy (Prelude.Maybe LocationUpdateStatus)
scalingPolicy_updateStatus :: (Maybe LocationUpdateStatus -> f (Maybe LocationUpdateStatus))
-> ScalingPolicy -> f ScalingPolicy
scalingPolicy_updateStatus = (ScalingPolicy -> Maybe LocationUpdateStatus)
-> (ScalingPolicy -> Maybe LocationUpdateStatus -> ScalingPolicy)
-> Lens
     ScalingPolicy
     ScalingPolicy
     (Maybe LocationUpdateStatus)
     (Maybe LocationUpdateStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe LocationUpdateStatus
updateStatus :: Maybe LocationUpdateStatus
$sel:updateStatus:ScalingPolicy' :: ScalingPolicy -> Maybe LocationUpdateStatus
updateStatus} -> Maybe LocationUpdateStatus
updateStatus) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe LocationUpdateStatus
a -> ScalingPolicy
s {$sel:updateStatus:ScalingPolicy' :: Maybe LocationUpdateStatus
updateStatus = Maybe LocationUpdateStatus
a} :: ScalingPolicy)

-- | A unique identifier for the fleet that is associated with this scaling
-- policy.
scalingPolicy_fleetId :: Lens.Lens' ScalingPolicy (Prelude.Maybe Prelude.Text)
scalingPolicy_fleetId :: (Maybe Text -> f (Maybe Text)) -> ScalingPolicy -> f ScalingPolicy
scalingPolicy_fleetId = (ScalingPolicy -> Maybe Text)
-> (ScalingPolicy -> Maybe Text -> ScalingPolicy)
-> Lens ScalingPolicy ScalingPolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe Text
fleetId :: Maybe Text
$sel:fleetId:ScalingPolicy' :: ScalingPolicy -> Maybe Text
fleetId} -> Maybe Text
fleetId) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe Text
a -> ScalingPolicy
s {$sel:fleetId:ScalingPolicy' :: Maybe Text
fleetId = Maybe Text
a} :: ScalingPolicy)

-- | An object that contains settings for a target-based scaling policy.
scalingPolicy_targetConfiguration :: Lens.Lens' ScalingPolicy (Prelude.Maybe TargetConfiguration)
scalingPolicy_targetConfiguration :: (Maybe TargetConfiguration -> f (Maybe TargetConfiguration))
-> ScalingPolicy -> f ScalingPolicy
scalingPolicy_targetConfiguration = (ScalingPolicy -> Maybe TargetConfiguration)
-> (ScalingPolicy -> Maybe TargetConfiguration -> ScalingPolicy)
-> Lens
     ScalingPolicy
     ScalingPolicy
     (Maybe TargetConfiguration)
     (Maybe TargetConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe TargetConfiguration
targetConfiguration :: Maybe TargetConfiguration
$sel:targetConfiguration:ScalingPolicy' :: ScalingPolicy -> Maybe TargetConfiguration
targetConfiguration} -> Maybe TargetConfiguration
targetConfiguration) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe TargetConfiguration
a -> ScalingPolicy
s {$sel:targetConfiguration:ScalingPolicy' :: Maybe TargetConfiguration
targetConfiguration = Maybe TargetConfiguration
a} :: ScalingPolicy)

instance Core.FromJSON ScalingPolicy where
  parseJSON :: Value -> Parser ScalingPolicy
parseJSON =
    String
-> (Object -> Parser ScalingPolicy)
-> Value
-> Parser ScalingPolicy
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ScalingPolicy"
      ( \Object
x ->
          Maybe ScalingStatusType
-> Maybe ScalingAdjustmentType
-> Maybe Text
-> Maybe Natural
-> Maybe PolicyType
-> Maybe MetricName
-> Maybe Text
-> Maybe ComparisonOperatorType
-> Maybe Text
-> Maybe Double
-> Maybe Int
-> Maybe LocationUpdateStatus
-> Maybe Text
-> Maybe TargetConfiguration
-> ScalingPolicy
ScalingPolicy'
            (Maybe ScalingStatusType
 -> Maybe ScalingAdjustmentType
 -> Maybe Text
 -> Maybe Natural
 -> Maybe PolicyType
 -> Maybe MetricName
 -> Maybe Text
 -> Maybe ComparisonOperatorType
 -> Maybe Text
 -> Maybe Double
 -> Maybe Int
 -> Maybe LocationUpdateStatus
 -> Maybe Text
 -> Maybe TargetConfiguration
 -> ScalingPolicy)
-> Parser (Maybe ScalingStatusType)
-> Parser
     (Maybe ScalingAdjustmentType
      -> Maybe Text
      -> Maybe Natural
      -> Maybe PolicyType
      -> Maybe MetricName
      -> Maybe Text
      -> Maybe ComparisonOperatorType
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe LocationUpdateStatus
      -> Maybe Text
      -> Maybe TargetConfiguration
      -> ScalingPolicy)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ScalingStatusType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe ScalingAdjustmentType
   -> Maybe Text
   -> Maybe Natural
   -> Maybe PolicyType
   -> Maybe MetricName
   -> Maybe Text
   -> Maybe ComparisonOperatorType
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe LocationUpdateStatus
   -> Maybe Text
   -> Maybe TargetConfiguration
   -> ScalingPolicy)
-> Parser (Maybe ScalingAdjustmentType)
-> Parser
     (Maybe Text
      -> Maybe Natural
      -> Maybe PolicyType
      -> Maybe MetricName
      -> Maybe Text
      -> Maybe ComparisonOperatorType
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe LocationUpdateStatus
      -> Maybe Text
      -> Maybe TargetConfiguration
      -> ScalingPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ScalingAdjustmentType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ScalingAdjustmentType")
            Parser
  (Maybe Text
   -> Maybe Natural
   -> Maybe PolicyType
   -> Maybe MetricName
   -> Maybe Text
   -> Maybe ComparisonOperatorType
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe LocationUpdateStatus
   -> Maybe Text
   -> Maybe TargetConfiguration
   -> ScalingPolicy)
-> Parser (Maybe Text)
-> Parser
     (Maybe Natural
      -> Maybe PolicyType
      -> Maybe MetricName
      -> Maybe Text
      -> Maybe ComparisonOperatorType
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe LocationUpdateStatus
      -> Maybe Text
      -> Maybe TargetConfiguration
      -> ScalingPolicy)
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
"Location")
            Parser
  (Maybe Natural
   -> Maybe PolicyType
   -> Maybe MetricName
   -> Maybe Text
   -> Maybe ComparisonOperatorType
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe LocationUpdateStatus
   -> Maybe Text
   -> Maybe TargetConfiguration
   -> ScalingPolicy)
-> Parser (Maybe Natural)
-> Parser
     (Maybe PolicyType
      -> Maybe MetricName
      -> Maybe Text
      -> Maybe ComparisonOperatorType
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe LocationUpdateStatus
      -> Maybe Text
      -> Maybe TargetConfiguration
      -> ScalingPolicy)
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
"EvaluationPeriods")
            Parser
  (Maybe PolicyType
   -> Maybe MetricName
   -> Maybe Text
   -> Maybe ComparisonOperatorType
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe LocationUpdateStatus
   -> Maybe Text
   -> Maybe TargetConfiguration
   -> ScalingPolicy)
-> Parser (Maybe PolicyType)
-> Parser
     (Maybe MetricName
      -> Maybe Text
      -> Maybe ComparisonOperatorType
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe LocationUpdateStatus
      -> Maybe Text
      -> Maybe TargetConfiguration
      -> ScalingPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PolicyType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PolicyType")
            Parser
  (Maybe MetricName
   -> Maybe Text
   -> Maybe ComparisonOperatorType
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe LocationUpdateStatus
   -> Maybe Text
   -> Maybe TargetConfiguration
   -> ScalingPolicy)
-> Parser (Maybe MetricName)
-> Parser
     (Maybe Text
      -> Maybe ComparisonOperatorType
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe LocationUpdateStatus
      -> Maybe Text
      -> Maybe TargetConfiguration
      -> ScalingPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MetricName)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MetricName")
            Parser
  (Maybe Text
   -> Maybe ComparisonOperatorType
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe LocationUpdateStatus
   -> Maybe Text
   -> Maybe TargetConfiguration
   -> ScalingPolicy)
-> Parser (Maybe Text)
-> Parser
     (Maybe ComparisonOperatorType
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe LocationUpdateStatus
      -> Maybe Text
      -> Maybe TargetConfiguration
      -> ScalingPolicy)
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
"FleetArn")
            Parser
  (Maybe ComparisonOperatorType
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe LocationUpdateStatus
   -> Maybe Text
   -> Maybe TargetConfiguration
   -> ScalingPolicy)
-> Parser (Maybe ComparisonOperatorType)
-> Parser
     (Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe LocationUpdateStatus
      -> Maybe Text
      -> Maybe TargetConfiguration
      -> ScalingPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ComparisonOperatorType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ComparisonOperator")
            Parser
  (Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe LocationUpdateStatus
   -> Maybe Text
   -> Maybe TargetConfiguration
   -> ScalingPolicy)
-> Parser (Maybe Text)
-> Parser
     (Maybe Double
      -> Maybe Int
      -> Maybe LocationUpdateStatus
      -> Maybe Text
      -> Maybe TargetConfiguration
      -> ScalingPolicy)
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 Double
   -> Maybe Int
   -> Maybe LocationUpdateStatus
   -> Maybe Text
   -> Maybe TargetConfiguration
   -> ScalingPolicy)
-> Parser (Maybe Double)
-> Parser
     (Maybe Int
      -> Maybe LocationUpdateStatus
      -> Maybe Text
      -> Maybe TargetConfiguration
      -> ScalingPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Threshold")
            Parser
  (Maybe Int
   -> Maybe LocationUpdateStatus
   -> Maybe Text
   -> Maybe TargetConfiguration
   -> ScalingPolicy)
-> Parser (Maybe Int)
-> Parser
     (Maybe LocationUpdateStatus
      -> Maybe Text -> Maybe TargetConfiguration -> ScalingPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ScalingAdjustment")
            Parser
  (Maybe LocationUpdateStatus
   -> Maybe Text -> Maybe TargetConfiguration -> ScalingPolicy)
-> Parser (Maybe LocationUpdateStatus)
-> Parser
     (Maybe Text -> Maybe TargetConfiguration -> ScalingPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe LocationUpdateStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UpdateStatus")
            Parser (Maybe Text -> Maybe TargetConfiguration -> ScalingPolicy)
-> Parser (Maybe Text)
-> Parser (Maybe TargetConfiguration -> ScalingPolicy)
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
"FleetId")
            Parser (Maybe TargetConfiguration -> ScalingPolicy)
-> Parser (Maybe TargetConfiguration) -> Parser ScalingPolicy
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe TargetConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TargetConfiguration")
      )

instance Prelude.Hashable ScalingPolicy

instance Prelude.NFData ScalingPolicy