{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.PutScalingPolicy
-- 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)
--
-- Creates or updates a scaling policy for a fleet. Scaling policies are
-- used to automatically scale a fleet\'s hosting capacity to meet player
-- demand. An active scaling policy instructs Amazon GameLift to track a
-- fleet metric and automatically change the fleet\'s capacity when a
-- certain threshold is reached. There are two types of scaling policies:
-- target-based and rule-based. Use a target-based policy to quickly and
-- efficiently manage fleet scaling; this option is the most commonly used.
-- Use rule-based policies when you need to exert fine-grained control over
-- auto-scaling.
--
-- Fleets can have multiple scaling policies of each type in force at the
-- same time; you can have one target-based policy, one or multiple
-- rule-based scaling policies, or both. We recommend caution, however,
-- because multiple auto-scaling policies can have unintended consequences.
--
-- You can temporarily suspend all scaling policies for a fleet by calling
-- StopFleetActions with the fleet action AUTO_SCALING. To resume scaling
-- policies, call StartFleetActions with the same fleet action. To stop
-- just one scaling policy--or to permanently remove it, you must delete
-- the policy with DeleteScalingPolicy.
--
-- Learn more about how to work with auto-scaling in
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/fleets-autoscaling.html Set Up Fleet Automatic Scaling>.
--
-- __Target-based policy__
--
-- A target-based policy tracks a single metric:
-- PercentAvailableGameSessions. This metric tells us how much of a
-- fleet\'s hosting capacity is ready to host game sessions but is not
-- currently in use. This is the fleet\'s buffer; it measures the
-- additional player demand that the fleet could handle at current
-- capacity. With a target-based policy, you set your ideal buffer size and
-- leave it to Amazon GameLift to take whatever action is needed to
-- maintain that target.
--
-- For example, you might choose to maintain a 10% buffer for a fleet that
-- has the capacity to host 100 simultaneous game sessions. This policy
-- tells Amazon GameLift to take action whenever the fleet\'s available
-- capacity falls below or rises above 10 game sessions. Amazon GameLift
-- will start new instances or stop unused instances in order to return to
-- the 10% buffer.
--
-- To create or update a target-based policy, specify a fleet ID and name,
-- and set the policy type to \"TargetBased\". Specify the metric to track
-- (PercentAvailableGameSessions) and reference a TargetConfiguration
-- object with your desired buffer value. Exclude all other parameters. On
-- a successful request, the policy name is returned. The scaling policy is
-- automatically in force as soon as it\'s successfully created. If the
-- fleet\'s auto-scaling actions are temporarily suspended, the new policy
-- will be in force once the fleet actions are restarted.
--
-- __Rule-based policy__
--
-- A rule-based policy tracks specified fleet metric, sets a threshold
-- value, and specifies the type of action to initiate when triggered. With
-- a rule-based policy, you can select from several available fleet
-- metrics. Each policy specifies whether to scale up or scale down (and by
-- how much), so you need one policy for each type of action.
--
-- For example, a policy may make the following statement: \"If the
-- percentage of idle instances is greater than 20% for more than 15
-- minutes, then reduce the fleet capacity by 10%.\"
--
-- A policy\'s rule statement has the following structure:
--
-- If @[MetricName]@ is @[ComparisonOperator]@ @[Threshold]@ for
-- @[EvaluationPeriods]@ minutes, then @[ScalingAdjustmentType]@ to\/by
-- @[ScalingAdjustment]@.
--
-- To implement the example, the rule statement would look like this:
--
-- If @[PercentIdleInstances]@ is @[GreaterThanThreshold]@ @[20]@ for
-- @[15]@ minutes, then @[PercentChangeInCapacity]@ to\/by @[10]@.
--
-- To create or update a scaling policy, specify a unique combination of
-- name and fleet ID, and set the policy type to \"RuleBased\". Specify the
-- parameter values for a policy rule statement. On a successful request,
-- the policy name is returned. Scaling policies are automatically in force
-- as soon as they\'re successfully created. If the fleet\'s auto-scaling
-- actions are temporarily suspended, the new policy will be in force once
-- the fleet actions are restarted.
--
-- __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>
module Amazonka.GameLift.PutScalingPolicy
  ( -- * Creating a Request
    PutScalingPolicy (..),
    newPutScalingPolicy,

    -- * Request Lenses
    putScalingPolicy_scalingAdjustmentType,
    putScalingPolicy_evaluationPeriods,
    putScalingPolicy_policyType,
    putScalingPolicy_comparisonOperator,
    putScalingPolicy_threshold,
    putScalingPolicy_scalingAdjustment,
    putScalingPolicy_targetConfiguration,
    putScalingPolicy_name,
    putScalingPolicy_fleetId,
    putScalingPolicy_metricName,

    -- * Destructuring the Response
    PutScalingPolicyResponse (..),
    newPutScalingPolicyResponse,

    -- * Response Lenses
    putScalingPolicyResponse_name,
    putScalingPolicyResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.GameLift.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Represents the input for a request operation.
--
-- /See:/ 'newPutScalingPolicy' smart constructor.
data PutScalingPolicy = PutScalingPolicy'
  { -- | 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; for
    --     example, a value of \"-10\" scales the fleet down by 10%.
    PutScalingPolicy -> Maybe ScalingAdjustmentType
scalingAdjustmentType :: Prelude.Maybe ScalingAdjustmentType,
    -- | Length of time (in minutes) the metric must be at or beyond the
    -- threshold before a scaling event is triggered.
    PutScalingPolicy -> 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/.
    PutScalingPolicy -> Maybe PolicyType
policyType :: Prelude.Maybe PolicyType,
    -- | Comparison operator to use when measuring the metric against the
    -- threshold value.
    PutScalingPolicy -> Maybe ComparisonOperatorType
comparisonOperator :: Prelude.Maybe ComparisonOperatorType,
    -- | Metric value used to trigger a scaling event.
    PutScalingPolicy -> Maybe Double
threshold :: Prelude.Maybe Prelude.Double,
    -- | Amount of adjustment to make, based on the scaling adjustment type.
    PutScalingPolicy -> Maybe Int
scalingAdjustment :: Prelude.Maybe Prelude.Int,
    -- | An object that contains settings for a target-based scaling policy.
    PutScalingPolicy -> Maybe TargetConfiguration
targetConfiguration :: Prelude.Maybe TargetConfiguration,
    -- | A descriptive label that is associated with a fleet\'s scaling policy.
    -- Policy names do not need to be unique. A fleet can have only one scaling
    -- policy with the same name.
    PutScalingPolicy -> Text
name :: Prelude.Text,
    -- | A unique identifier for the fleet to apply this policy to. You can use
    -- either the fleet ID or ARN value. The fleet cannot be in any of the
    -- following statuses: ERROR or DELETING.
    PutScalingPolicy -> Text
fleetId :: Prelude.Text,
    -- | 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.
    PutScalingPolicy -> MetricName
metricName :: MetricName
  }
  deriving (PutScalingPolicy -> PutScalingPolicy -> Bool
(PutScalingPolicy -> PutScalingPolicy -> Bool)
-> (PutScalingPolicy -> PutScalingPolicy -> Bool)
-> Eq PutScalingPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutScalingPolicy -> PutScalingPolicy -> Bool
$c/= :: PutScalingPolicy -> PutScalingPolicy -> Bool
== :: PutScalingPolicy -> PutScalingPolicy -> Bool
$c== :: PutScalingPolicy -> PutScalingPolicy -> Bool
Prelude.Eq, ReadPrec [PutScalingPolicy]
ReadPrec PutScalingPolicy
Int -> ReadS PutScalingPolicy
ReadS [PutScalingPolicy]
(Int -> ReadS PutScalingPolicy)
-> ReadS [PutScalingPolicy]
-> ReadPrec PutScalingPolicy
-> ReadPrec [PutScalingPolicy]
-> Read PutScalingPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutScalingPolicy]
$creadListPrec :: ReadPrec [PutScalingPolicy]
readPrec :: ReadPrec PutScalingPolicy
$creadPrec :: ReadPrec PutScalingPolicy
readList :: ReadS [PutScalingPolicy]
$creadList :: ReadS [PutScalingPolicy]
readsPrec :: Int -> ReadS PutScalingPolicy
$creadsPrec :: Int -> ReadS PutScalingPolicy
Prelude.Read, Int -> PutScalingPolicy -> ShowS
[PutScalingPolicy] -> ShowS
PutScalingPolicy -> String
(Int -> PutScalingPolicy -> ShowS)
-> (PutScalingPolicy -> String)
-> ([PutScalingPolicy] -> ShowS)
-> Show PutScalingPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutScalingPolicy] -> ShowS
$cshowList :: [PutScalingPolicy] -> ShowS
show :: PutScalingPolicy -> String
$cshow :: PutScalingPolicy -> String
showsPrec :: Int -> PutScalingPolicy -> ShowS
$cshowsPrec :: Int -> PutScalingPolicy -> ShowS
Prelude.Show, (forall x. PutScalingPolicy -> Rep PutScalingPolicy x)
-> (forall x. Rep PutScalingPolicy x -> PutScalingPolicy)
-> Generic PutScalingPolicy
forall x. Rep PutScalingPolicy x -> PutScalingPolicy
forall x. PutScalingPolicy -> Rep PutScalingPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutScalingPolicy x -> PutScalingPolicy
$cfrom :: forall x. PutScalingPolicy -> Rep PutScalingPolicy x
Prelude.Generic)

-- |
-- Create a value of 'PutScalingPolicy' 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:
--
-- 'scalingAdjustmentType', 'putScalingPolicy_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; for
--     example, a value of \"-10\" scales the fleet down by 10%.
--
-- 'evaluationPeriods', 'putScalingPolicy_evaluationPeriods' - Length of time (in minutes) the metric must be at or beyond the
-- threshold before a scaling event is triggered.
--
-- 'policyType', 'putScalingPolicy_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/.
--
-- 'comparisonOperator', 'putScalingPolicy_comparisonOperator' - Comparison operator to use when measuring the metric against the
-- threshold value.
--
-- 'threshold', 'putScalingPolicy_threshold' - Metric value used to trigger a scaling event.
--
-- 'scalingAdjustment', 'putScalingPolicy_scalingAdjustment' - Amount of adjustment to make, based on the scaling adjustment type.
--
-- 'targetConfiguration', 'putScalingPolicy_targetConfiguration' - An object that contains settings for a target-based scaling policy.
--
-- 'name', 'putScalingPolicy_name' - A descriptive label that is associated with a fleet\'s scaling policy.
-- Policy names do not need to be unique. A fleet can have only one scaling
-- policy with the same name.
--
-- 'fleetId', 'putScalingPolicy_fleetId' - A unique identifier for the fleet to apply this policy to. You can use
-- either the fleet ID or ARN value. The fleet cannot be in any of the
-- following statuses: ERROR or DELETING.
--
-- 'metricName', 'putScalingPolicy_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.
newPutScalingPolicy ::
  -- | 'name'
  Prelude.Text ->
  -- | 'fleetId'
  Prelude.Text ->
  -- | 'metricName'
  MetricName ->
  PutScalingPolicy
newPutScalingPolicy :: Text -> Text -> MetricName -> PutScalingPolicy
newPutScalingPolicy Text
pName_ Text
pFleetId_ MetricName
pMetricName_ =
  PutScalingPolicy' :: Maybe ScalingAdjustmentType
-> Maybe Natural
-> Maybe PolicyType
-> Maybe ComparisonOperatorType
-> Maybe Double
-> Maybe Int
-> Maybe TargetConfiguration
-> Text
-> Text
-> MetricName
-> PutScalingPolicy
PutScalingPolicy'
    { $sel:scalingAdjustmentType:PutScalingPolicy' :: Maybe ScalingAdjustmentType
scalingAdjustmentType =
        Maybe ScalingAdjustmentType
forall a. Maybe a
Prelude.Nothing,
      $sel:evaluationPeriods:PutScalingPolicy' :: Maybe Natural
evaluationPeriods = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:policyType:PutScalingPolicy' :: Maybe PolicyType
policyType = Maybe PolicyType
forall a. Maybe a
Prelude.Nothing,
      $sel:comparisonOperator:PutScalingPolicy' :: Maybe ComparisonOperatorType
comparisonOperator = Maybe ComparisonOperatorType
forall a. Maybe a
Prelude.Nothing,
      $sel:threshold:PutScalingPolicy' :: Maybe Double
threshold = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:scalingAdjustment:PutScalingPolicy' :: Maybe Int
scalingAdjustment = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:targetConfiguration:PutScalingPolicy' :: Maybe TargetConfiguration
targetConfiguration = Maybe TargetConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:name:PutScalingPolicy' :: Text
name = Text
pName_,
      $sel:fleetId:PutScalingPolicy' :: Text
fleetId = Text
pFleetId_,
      $sel:metricName:PutScalingPolicy' :: MetricName
metricName = MetricName
pMetricName_
    }

-- | 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; for
--     example, a value of \"-10\" scales the fleet down by 10%.
putScalingPolicy_scalingAdjustmentType :: Lens.Lens' PutScalingPolicy (Prelude.Maybe ScalingAdjustmentType)
putScalingPolicy_scalingAdjustmentType :: (Maybe ScalingAdjustmentType -> f (Maybe ScalingAdjustmentType))
-> PutScalingPolicy -> f PutScalingPolicy
putScalingPolicy_scalingAdjustmentType = (PutScalingPolicy -> Maybe ScalingAdjustmentType)
-> (PutScalingPolicy
    -> Maybe ScalingAdjustmentType -> PutScalingPolicy)
-> Lens
     PutScalingPolicy
     PutScalingPolicy
     (Maybe ScalingAdjustmentType)
     (Maybe ScalingAdjustmentType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutScalingPolicy' {Maybe ScalingAdjustmentType
scalingAdjustmentType :: Maybe ScalingAdjustmentType
$sel:scalingAdjustmentType:PutScalingPolicy' :: PutScalingPolicy -> Maybe ScalingAdjustmentType
scalingAdjustmentType} -> Maybe ScalingAdjustmentType
scalingAdjustmentType) (\s :: PutScalingPolicy
s@PutScalingPolicy' {} Maybe ScalingAdjustmentType
a -> PutScalingPolicy
s {$sel:scalingAdjustmentType:PutScalingPolicy' :: Maybe ScalingAdjustmentType
scalingAdjustmentType = Maybe ScalingAdjustmentType
a} :: PutScalingPolicy)

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

-- | 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/.
putScalingPolicy_policyType :: Lens.Lens' PutScalingPolicy (Prelude.Maybe PolicyType)
putScalingPolicy_policyType :: (Maybe PolicyType -> f (Maybe PolicyType))
-> PutScalingPolicy -> f PutScalingPolicy
putScalingPolicy_policyType = (PutScalingPolicy -> Maybe PolicyType)
-> (PutScalingPolicy -> Maybe PolicyType -> PutScalingPolicy)
-> Lens
     PutScalingPolicy
     PutScalingPolicy
     (Maybe PolicyType)
     (Maybe PolicyType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutScalingPolicy' {Maybe PolicyType
policyType :: Maybe PolicyType
$sel:policyType:PutScalingPolicy' :: PutScalingPolicy -> Maybe PolicyType
policyType} -> Maybe PolicyType
policyType) (\s :: PutScalingPolicy
s@PutScalingPolicy' {} Maybe PolicyType
a -> PutScalingPolicy
s {$sel:policyType:PutScalingPolicy' :: Maybe PolicyType
policyType = Maybe PolicyType
a} :: PutScalingPolicy)

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

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

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

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

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

-- | A unique identifier for the fleet to apply this policy to. You can use
-- either the fleet ID or ARN value. The fleet cannot be in any of the
-- following statuses: ERROR or DELETING.
putScalingPolicy_fleetId :: Lens.Lens' PutScalingPolicy Prelude.Text
putScalingPolicy_fleetId :: (Text -> f Text) -> PutScalingPolicy -> f PutScalingPolicy
putScalingPolicy_fleetId = (PutScalingPolicy -> Text)
-> (PutScalingPolicy -> Text -> PutScalingPolicy)
-> Lens PutScalingPolicy PutScalingPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutScalingPolicy' {Text
fleetId :: Text
$sel:fleetId:PutScalingPolicy' :: PutScalingPolicy -> Text
fleetId} -> Text
fleetId) (\s :: PutScalingPolicy
s@PutScalingPolicy' {} Text
a -> PutScalingPolicy
s {$sel:fleetId:PutScalingPolicy' :: Text
fleetId = Text
a} :: PutScalingPolicy)

-- | 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.
putScalingPolicy_metricName :: Lens.Lens' PutScalingPolicy MetricName
putScalingPolicy_metricName :: (MetricName -> f MetricName)
-> PutScalingPolicy -> f PutScalingPolicy
putScalingPolicy_metricName = (PutScalingPolicy -> MetricName)
-> (PutScalingPolicy -> MetricName -> PutScalingPolicy)
-> Lens PutScalingPolicy PutScalingPolicy MetricName MetricName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutScalingPolicy' {MetricName
metricName :: MetricName
$sel:metricName:PutScalingPolicy' :: PutScalingPolicy -> MetricName
metricName} -> MetricName
metricName) (\s :: PutScalingPolicy
s@PutScalingPolicy' {} MetricName
a -> PutScalingPolicy
s {$sel:metricName:PutScalingPolicy' :: MetricName
metricName = MetricName
a} :: PutScalingPolicy)

instance Core.AWSRequest PutScalingPolicy where
  type
    AWSResponse PutScalingPolicy =
      PutScalingPolicyResponse
  request :: PutScalingPolicy -> Request PutScalingPolicy
request = Service -> PutScalingPolicy -> Request PutScalingPolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy PutScalingPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutScalingPolicy)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse PutScalingPolicy))
-> Logger
-> Service
-> Proxy PutScalingPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutScalingPolicy)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> PutScalingPolicyResponse
PutScalingPolicyResponse'
            (Maybe Text -> Int -> PutScalingPolicyResponse)
-> Either String (Maybe Text)
-> Either String (Int -> PutScalingPolicyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Name")
            Either String (Int -> PutScalingPolicyResponse)
-> Either String Int -> Either String PutScalingPolicyResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable PutScalingPolicy

instance Prelude.NFData PutScalingPolicy

instance Core.ToHeaders PutScalingPolicy where
  toHeaders :: PutScalingPolicy -> ResponseHeaders
toHeaders =
    ResponseHeaders -> PutScalingPolicy -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"GameLift.PutScalingPolicy" :: Prelude.ByteString),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON PutScalingPolicy where
  toJSON :: PutScalingPolicy -> Value
toJSON PutScalingPolicy' {Maybe Double
Maybe Int
Maybe Natural
Maybe ComparisonOperatorType
Maybe PolicyType
Maybe ScalingAdjustmentType
Maybe TargetConfiguration
Text
MetricName
metricName :: MetricName
fleetId :: Text
name :: Text
targetConfiguration :: Maybe TargetConfiguration
scalingAdjustment :: Maybe Int
threshold :: Maybe Double
comparisonOperator :: Maybe ComparisonOperatorType
policyType :: Maybe PolicyType
evaluationPeriods :: Maybe Natural
scalingAdjustmentType :: Maybe ScalingAdjustmentType
$sel:metricName:PutScalingPolicy' :: PutScalingPolicy -> MetricName
$sel:fleetId:PutScalingPolicy' :: PutScalingPolicy -> Text
$sel:name:PutScalingPolicy' :: PutScalingPolicy -> Text
$sel:targetConfiguration:PutScalingPolicy' :: PutScalingPolicy -> Maybe TargetConfiguration
$sel:scalingAdjustment:PutScalingPolicy' :: PutScalingPolicy -> Maybe Int
$sel:threshold:PutScalingPolicy' :: PutScalingPolicy -> Maybe Double
$sel:comparisonOperator:PutScalingPolicy' :: PutScalingPolicy -> Maybe ComparisonOperatorType
$sel:policyType:PutScalingPolicy' :: PutScalingPolicy -> Maybe PolicyType
$sel:evaluationPeriods:PutScalingPolicy' :: PutScalingPolicy -> Maybe Natural
$sel:scalingAdjustmentType:PutScalingPolicy' :: PutScalingPolicy -> Maybe ScalingAdjustmentType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ScalingAdjustmentType" Text -> ScalingAdjustmentType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ScalingAdjustmentType -> Pair)
-> Maybe ScalingAdjustmentType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ScalingAdjustmentType
scalingAdjustmentType,
            (Text
"EvaluationPeriods" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
evaluationPeriods,
            (Text
"PolicyType" Text -> PolicyType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (PolicyType -> Pair) -> Maybe PolicyType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PolicyType
policyType,
            (Text
"ComparisonOperator" Text -> ComparisonOperatorType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ComparisonOperatorType -> Pair)
-> Maybe ComparisonOperatorType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ComparisonOperatorType
comparisonOperator,
            (Text
"Threshold" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
threshold,
            (Text
"ScalingAdjustment" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
scalingAdjustment,
            (Text
"TargetConfiguration" Text -> TargetConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (TargetConfiguration -> Pair)
-> Maybe TargetConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TargetConfiguration
targetConfiguration,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"FleetId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
fleetId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MetricName" Text -> MetricName -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= MetricName
metricName)
          ]
      )

instance Core.ToPath PutScalingPolicy where
  toPath :: PutScalingPolicy -> ByteString
toPath = ByteString -> PutScalingPolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery PutScalingPolicy where
  toQuery :: PutScalingPolicy -> QueryString
toQuery = QueryString -> PutScalingPolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | Represents the returned data in response to a request operation.
--
-- /See:/ 'newPutScalingPolicyResponse' smart constructor.
data PutScalingPolicyResponse = PutScalingPolicyResponse'
  { -- | A descriptive label that is associated with a fleet\'s scaling policy.
    -- Policy names do not need to be unique.
    PutScalingPolicyResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    PutScalingPolicyResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (PutScalingPolicyResponse -> PutScalingPolicyResponse -> Bool
(PutScalingPolicyResponse -> PutScalingPolicyResponse -> Bool)
-> (PutScalingPolicyResponse -> PutScalingPolicyResponse -> Bool)
-> Eq PutScalingPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutScalingPolicyResponse -> PutScalingPolicyResponse -> Bool
$c/= :: PutScalingPolicyResponse -> PutScalingPolicyResponse -> Bool
== :: PutScalingPolicyResponse -> PutScalingPolicyResponse -> Bool
$c== :: PutScalingPolicyResponse -> PutScalingPolicyResponse -> Bool
Prelude.Eq, ReadPrec [PutScalingPolicyResponse]
ReadPrec PutScalingPolicyResponse
Int -> ReadS PutScalingPolicyResponse
ReadS [PutScalingPolicyResponse]
(Int -> ReadS PutScalingPolicyResponse)
-> ReadS [PutScalingPolicyResponse]
-> ReadPrec PutScalingPolicyResponse
-> ReadPrec [PutScalingPolicyResponse]
-> Read PutScalingPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutScalingPolicyResponse]
$creadListPrec :: ReadPrec [PutScalingPolicyResponse]
readPrec :: ReadPrec PutScalingPolicyResponse
$creadPrec :: ReadPrec PutScalingPolicyResponse
readList :: ReadS [PutScalingPolicyResponse]
$creadList :: ReadS [PutScalingPolicyResponse]
readsPrec :: Int -> ReadS PutScalingPolicyResponse
$creadsPrec :: Int -> ReadS PutScalingPolicyResponse
Prelude.Read, Int -> PutScalingPolicyResponse -> ShowS
[PutScalingPolicyResponse] -> ShowS
PutScalingPolicyResponse -> String
(Int -> PutScalingPolicyResponse -> ShowS)
-> (PutScalingPolicyResponse -> String)
-> ([PutScalingPolicyResponse] -> ShowS)
-> Show PutScalingPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutScalingPolicyResponse] -> ShowS
$cshowList :: [PutScalingPolicyResponse] -> ShowS
show :: PutScalingPolicyResponse -> String
$cshow :: PutScalingPolicyResponse -> String
showsPrec :: Int -> PutScalingPolicyResponse -> ShowS
$cshowsPrec :: Int -> PutScalingPolicyResponse -> ShowS
Prelude.Show, (forall x.
 PutScalingPolicyResponse -> Rep PutScalingPolicyResponse x)
-> (forall x.
    Rep PutScalingPolicyResponse x -> PutScalingPolicyResponse)
-> Generic PutScalingPolicyResponse
forall x.
Rep PutScalingPolicyResponse x -> PutScalingPolicyResponse
forall x.
PutScalingPolicyResponse -> Rep PutScalingPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutScalingPolicyResponse x -> PutScalingPolicyResponse
$cfrom :: forall x.
PutScalingPolicyResponse -> Rep PutScalingPolicyResponse x
Prelude.Generic)

-- |
-- Create a value of 'PutScalingPolicyResponse' 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:
--
-- 'name', 'putScalingPolicyResponse_name' - A descriptive label that is associated with a fleet\'s scaling policy.
-- Policy names do not need to be unique.
--
-- 'httpStatus', 'putScalingPolicyResponse_httpStatus' - The response's http status code.
newPutScalingPolicyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PutScalingPolicyResponse
newPutScalingPolicyResponse :: Int -> PutScalingPolicyResponse
newPutScalingPolicyResponse Int
pHttpStatus_ =
  PutScalingPolicyResponse' :: Maybe Text -> Int -> PutScalingPolicyResponse
PutScalingPolicyResponse'
    { $sel:name:PutScalingPolicyResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:PutScalingPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | The response's http status code.
putScalingPolicyResponse_httpStatus :: Lens.Lens' PutScalingPolicyResponse Prelude.Int
putScalingPolicyResponse_httpStatus :: (Int -> f Int)
-> PutScalingPolicyResponse -> f PutScalingPolicyResponse
putScalingPolicyResponse_httpStatus = (PutScalingPolicyResponse -> Int)
-> (PutScalingPolicyResponse -> Int -> PutScalingPolicyResponse)
-> Lens PutScalingPolicyResponse PutScalingPolicyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutScalingPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutScalingPolicyResponse' :: PutScalingPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutScalingPolicyResponse
s@PutScalingPolicyResponse' {} Int
a -> PutScalingPolicyResponse
s {$sel:httpStatus:PutScalingPolicyResponse' :: Int
httpStatus = Int
a} :: PutScalingPolicyResponse)

instance Prelude.NFData PutScalingPolicyResponse