{-# 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.ApplicationAutoScaling.Types.ScalingActivity
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ApplicationAutoScaling.Types.ScalingActivity where

import Amazonka.ApplicationAutoScaling.Types.NotScaledReason
import Amazonka.ApplicationAutoScaling.Types.ScalableDimension
import Amazonka.ApplicationAutoScaling.Types.ScalingActivityStatusCode
import Amazonka.ApplicationAutoScaling.Types.ServiceNamespace
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Represents a scaling activity.
--
-- /See:/ 'newScalingActivity' smart constructor.
data ScalingActivity = ScalingActivity'
  { -- | The details about the scaling activity.
    ScalingActivity -> Maybe Text
details :: Prelude.Maybe Prelude.Text,
    -- | The Unix timestamp for when the scaling activity ended.
    ScalingActivity -> Maybe POSIX
endTime :: Prelude.Maybe Data.POSIX,
    -- | Machine-readable data that describes the reason for a not scaled
    -- activity. Only available when
    -- <https://docs.aws.amazon.com/autoscaling/application/APIReference/API_DescribeScalingActivities.html DescribeScalingActivities>
    -- includes not scaled activities.
    ScalingActivity -> Maybe [NotScaledReason]
notScaledReasons :: Prelude.Maybe [NotScaledReason],
    -- | A simple message about the current status of the scaling activity.
    ScalingActivity -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier of the scaling activity.
    ScalingActivity -> Text
activityId :: Prelude.Text,
    -- | The namespace of the Amazon Web Services service that provides the
    -- resource, or a @custom-resource@.
    ScalingActivity -> ServiceNamespace
serviceNamespace :: ServiceNamespace,
    -- | The identifier of the resource associated with the scaling activity.
    -- This string consists of the resource type and unique identifier.
    --
    -- -   ECS service - The resource type is @service@ and the unique
    --     identifier is the cluster name and service name. Example:
    --     @service\/default\/sample-webapp@.
    --
    -- -   Spot Fleet - The resource type is @spot-fleet-request@ and the
    --     unique identifier is the Spot Fleet request ID. Example:
    --     @spot-fleet-request\/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE@.
    --
    -- -   EMR cluster - The resource type is @instancegroup@ and the unique
    --     identifier is the cluster ID and instance group ID. Example:
    --     @instancegroup\/j-2EEZNYKUA1NTV\/ig-1791Y4E1L8YI0@.
    --
    -- -   AppStream 2.0 fleet - The resource type is @fleet@ and the unique
    --     identifier is the fleet name. Example: @fleet\/sample-fleet@.
    --
    -- -   DynamoDB table - The resource type is @table@ and the unique
    --     identifier is the table name. Example: @table\/my-table@.
    --
    -- -   DynamoDB global secondary index - The resource type is @index@ and
    --     the unique identifier is the index name. Example:
    --     @table\/my-table\/index\/my-table-index@.
    --
    -- -   Aurora DB cluster - The resource type is @cluster@ and the unique
    --     identifier is the cluster name. Example: @cluster:my-db-cluster@.
    --
    -- -   SageMaker endpoint variant - The resource type is @variant@ and the
    --     unique identifier is the resource ID. Example:
    --     @endpoint\/my-end-point\/variant\/KMeansClustering@.
    --
    -- -   Custom resources are not supported with a resource type. This
    --     parameter must specify the @OutputValue@ from the CloudFormation
    --     template stack used to access the resources. The unique identifier
    --     is defined by the service provider. More information is available in
    --     our
    --     <https://github.com/aws/aws-auto-scaling-custom-resource GitHub repository>.
    --
    -- -   Amazon Comprehend document classification endpoint - The resource
    --     type and unique identifier are specified using the endpoint ARN.
    --     Example:
    --     @arn:aws:comprehend:us-west-2:123456789012:document-classifier-endpoint\/EXAMPLE@.
    --
    -- -   Amazon Comprehend entity recognizer endpoint - The resource type and
    --     unique identifier are specified using the endpoint ARN. Example:
    --     @arn:aws:comprehend:us-west-2:123456789012:entity-recognizer-endpoint\/EXAMPLE@.
    --
    -- -   Lambda provisioned concurrency - The resource type is @function@ and
    --     the unique identifier is the function name with a function version
    --     or alias name suffix that is not @$LATEST@. Example:
    --     @function:my-function:prod@ or @function:my-function:1@.
    --
    -- -   Amazon Keyspaces table - The resource type is @table@ and the unique
    --     identifier is the table name. Example:
    --     @keyspace\/mykeyspace\/table\/mytable@.
    --
    -- -   Amazon MSK cluster - The resource type and unique identifier are
    --     specified using the cluster ARN. Example:
    --     @arn:aws:kafka:us-east-1:123456789012:cluster\/demo-cluster-1\/6357e0b2-0e6a-4b86-a0b4-70df934c2e31-5@.
    --
    -- -   Amazon ElastiCache replication group - The resource type is
    --     @replication-group@ and the unique identifier is the replication
    --     group name. Example: @replication-group\/mycluster@.
    --
    -- -   Neptune cluster - The resource type is @cluster@ and the unique
    --     identifier is the cluster name. Example: @cluster:mycluster@.
    ScalingActivity -> Text
resourceId :: Prelude.Text,
    -- | The scalable dimension. This string consists of the service namespace,
    -- resource type, and scaling property.
    --
    -- -   @ecs:service:DesiredCount@ - The desired task count of an ECS
    --     service.
    --
    -- -   @elasticmapreduce:instancegroup:InstanceCount@ - The instance count
    --     of an EMR Instance Group.
    --
    -- -   @ec2:spot-fleet-request:TargetCapacity@ - The target capacity of a
    --     Spot Fleet.
    --
    -- -   @appstream:fleet:DesiredCapacity@ - The desired capacity of an
    --     AppStream 2.0 fleet.
    --
    -- -   @dynamodb:table:ReadCapacityUnits@ - The provisioned read capacity
    --     for a DynamoDB table.
    --
    -- -   @dynamodb:table:WriteCapacityUnits@ - The provisioned write capacity
    --     for a DynamoDB table.
    --
    -- -   @dynamodb:index:ReadCapacityUnits@ - The provisioned read capacity
    --     for a DynamoDB global secondary index.
    --
    -- -   @dynamodb:index:WriteCapacityUnits@ - The provisioned write capacity
    --     for a DynamoDB global secondary index.
    --
    -- -   @rds:cluster:ReadReplicaCount@ - The count of Aurora Replicas in an
    --     Aurora DB cluster. Available for Aurora MySQL-compatible edition and
    --     Aurora PostgreSQL-compatible edition.
    --
    -- -   @sagemaker:variant:DesiredInstanceCount@ - The number of EC2
    --     instances for a SageMaker model endpoint variant.
    --
    -- -   @custom-resource:ResourceType:Property@ - The scalable dimension for
    --     a custom resource provided by your own application or service.
    --
    -- -   @comprehend:document-classifier-endpoint:DesiredInferenceUnits@ -
    --     The number of inference units for an Amazon Comprehend document
    --     classification endpoint.
    --
    -- -   @comprehend:entity-recognizer-endpoint:DesiredInferenceUnits@ - The
    --     number of inference units for an Amazon Comprehend entity recognizer
    --     endpoint.
    --
    -- -   @lambda:function:ProvisionedConcurrency@ - The provisioned
    --     concurrency for a Lambda function.
    --
    -- -   @cassandra:table:ReadCapacityUnits@ - The provisioned read capacity
    --     for an Amazon Keyspaces table.
    --
    -- -   @cassandra:table:WriteCapacityUnits@ - The provisioned write
    --     capacity for an Amazon Keyspaces table.
    --
    -- -   @kafka:broker-storage:VolumeSize@ - The provisioned volume size (in
    --     GiB) for brokers in an Amazon MSK cluster.
    --
    -- -   @elasticache:replication-group:NodeGroups@ - The number of node
    --     groups for an Amazon ElastiCache replication group.
    --
    -- -   @elasticache:replication-group:Replicas@ - The number of replicas
    --     per node group for an Amazon ElastiCache replication group.
    --
    -- -   @neptune:cluster:ReadReplicaCount@ - The count of read replicas in
    --     an Amazon Neptune DB cluster.
    ScalingActivity -> ScalableDimension
scalableDimension :: ScalableDimension,
    -- | A simple description of what action the scaling activity intends to
    -- accomplish.
    ScalingActivity -> Text
description :: Prelude.Text,
    -- | A simple description of what caused the scaling activity to happen.
    ScalingActivity -> Text
cause :: Prelude.Text,
    -- | The Unix timestamp for when the scaling activity began.
    ScalingActivity -> POSIX
startTime :: Data.POSIX,
    -- | Indicates the status of the scaling activity.
    ScalingActivity -> ScalingActivityStatusCode
statusCode :: ScalingActivityStatusCode
  }
  deriving (ScalingActivity -> ScalingActivity -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScalingActivity -> ScalingActivity -> Bool
$c/= :: ScalingActivity -> ScalingActivity -> Bool
== :: ScalingActivity -> ScalingActivity -> Bool
$c== :: ScalingActivity -> ScalingActivity -> Bool
Prelude.Eq, ReadPrec [ScalingActivity]
ReadPrec ScalingActivity
Int -> ReadS ScalingActivity
ReadS [ScalingActivity]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScalingActivity]
$creadListPrec :: ReadPrec [ScalingActivity]
readPrec :: ReadPrec ScalingActivity
$creadPrec :: ReadPrec ScalingActivity
readList :: ReadS [ScalingActivity]
$creadList :: ReadS [ScalingActivity]
readsPrec :: Int -> ReadS ScalingActivity
$creadsPrec :: Int -> ReadS ScalingActivity
Prelude.Read, Int -> ScalingActivity -> ShowS
[ScalingActivity] -> ShowS
ScalingActivity -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScalingActivity] -> ShowS
$cshowList :: [ScalingActivity] -> ShowS
show :: ScalingActivity -> String
$cshow :: ScalingActivity -> String
showsPrec :: Int -> ScalingActivity -> ShowS
$cshowsPrec :: Int -> ScalingActivity -> ShowS
Prelude.Show, forall x. Rep ScalingActivity x -> ScalingActivity
forall x. ScalingActivity -> Rep ScalingActivity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScalingActivity x -> ScalingActivity
$cfrom :: forall x. ScalingActivity -> Rep ScalingActivity x
Prelude.Generic)

-- |
-- Create a value of 'ScalingActivity' 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:
--
-- 'details', 'scalingActivity_details' - The details about the scaling activity.
--
-- 'endTime', 'scalingActivity_endTime' - The Unix timestamp for when the scaling activity ended.
--
-- 'notScaledReasons', 'scalingActivity_notScaledReasons' - Machine-readable data that describes the reason for a not scaled
-- activity. Only available when
-- <https://docs.aws.amazon.com/autoscaling/application/APIReference/API_DescribeScalingActivities.html DescribeScalingActivities>
-- includes not scaled activities.
--
-- 'statusMessage', 'scalingActivity_statusMessage' - A simple message about the current status of the scaling activity.
--
-- 'activityId', 'scalingActivity_activityId' - The unique identifier of the scaling activity.
--
-- 'serviceNamespace', 'scalingActivity_serviceNamespace' - The namespace of the Amazon Web Services service that provides the
-- resource, or a @custom-resource@.
--
-- 'resourceId', 'scalingActivity_resourceId' - The identifier of the resource associated with the scaling activity.
-- This string consists of the resource type and unique identifier.
--
-- -   ECS service - The resource type is @service@ and the unique
--     identifier is the cluster name and service name. Example:
--     @service\/default\/sample-webapp@.
--
-- -   Spot Fleet - The resource type is @spot-fleet-request@ and the
--     unique identifier is the Spot Fleet request ID. Example:
--     @spot-fleet-request\/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE@.
--
-- -   EMR cluster - The resource type is @instancegroup@ and the unique
--     identifier is the cluster ID and instance group ID. Example:
--     @instancegroup\/j-2EEZNYKUA1NTV\/ig-1791Y4E1L8YI0@.
--
-- -   AppStream 2.0 fleet - The resource type is @fleet@ and the unique
--     identifier is the fleet name. Example: @fleet\/sample-fleet@.
--
-- -   DynamoDB table - The resource type is @table@ and the unique
--     identifier is the table name. Example: @table\/my-table@.
--
-- -   DynamoDB global secondary index - The resource type is @index@ and
--     the unique identifier is the index name. Example:
--     @table\/my-table\/index\/my-table-index@.
--
-- -   Aurora DB cluster - The resource type is @cluster@ and the unique
--     identifier is the cluster name. Example: @cluster:my-db-cluster@.
--
-- -   SageMaker endpoint variant - The resource type is @variant@ and the
--     unique identifier is the resource ID. Example:
--     @endpoint\/my-end-point\/variant\/KMeansClustering@.
--
-- -   Custom resources are not supported with a resource type. This
--     parameter must specify the @OutputValue@ from the CloudFormation
--     template stack used to access the resources. The unique identifier
--     is defined by the service provider. More information is available in
--     our
--     <https://github.com/aws/aws-auto-scaling-custom-resource GitHub repository>.
--
-- -   Amazon Comprehend document classification endpoint - The resource
--     type and unique identifier are specified using the endpoint ARN.
--     Example:
--     @arn:aws:comprehend:us-west-2:123456789012:document-classifier-endpoint\/EXAMPLE@.
--
-- -   Amazon Comprehend entity recognizer endpoint - The resource type and
--     unique identifier are specified using the endpoint ARN. Example:
--     @arn:aws:comprehend:us-west-2:123456789012:entity-recognizer-endpoint\/EXAMPLE@.
--
-- -   Lambda provisioned concurrency - The resource type is @function@ and
--     the unique identifier is the function name with a function version
--     or alias name suffix that is not @$LATEST@. Example:
--     @function:my-function:prod@ or @function:my-function:1@.
--
-- -   Amazon Keyspaces table - The resource type is @table@ and the unique
--     identifier is the table name. Example:
--     @keyspace\/mykeyspace\/table\/mytable@.
--
-- -   Amazon MSK cluster - The resource type and unique identifier are
--     specified using the cluster ARN. Example:
--     @arn:aws:kafka:us-east-1:123456789012:cluster\/demo-cluster-1\/6357e0b2-0e6a-4b86-a0b4-70df934c2e31-5@.
--
-- -   Amazon ElastiCache replication group - The resource type is
--     @replication-group@ and the unique identifier is the replication
--     group name. Example: @replication-group\/mycluster@.
--
-- -   Neptune cluster - The resource type is @cluster@ and the unique
--     identifier is the cluster name. Example: @cluster:mycluster@.
--
-- 'scalableDimension', 'scalingActivity_scalableDimension' - The scalable dimension. This string consists of the service namespace,
-- resource type, and scaling property.
--
-- -   @ecs:service:DesiredCount@ - The desired task count of an ECS
--     service.
--
-- -   @elasticmapreduce:instancegroup:InstanceCount@ - The instance count
--     of an EMR Instance Group.
--
-- -   @ec2:spot-fleet-request:TargetCapacity@ - The target capacity of a
--     Spot Fleet.
--
-- -   @appstream:fleet:DesiredCapacity@ - The desired capacity of an
--     AppStream 2.0 fleet.
--
-- -   @dynamodb:table:ReadCapacityUnits@ - The provisioned read capacity
--     for a DynamoDB table.
--
-- -   @dynamodb:table:WriteCapacityUnits@ - The provisioned write capacity
--     for a DynamoDB table.
--
-- -   @dynamodb:index:ReadCapacityUnits@ - The provisioned read capacity
--     for a DynamoDB global secondary index.
--
-- -   @dynamodb:index:WriteCapacityUnits@ - The provisioned write capacity
--     for a DynamoDB global secondary index.
--
-- -   @rds:cluster:ReadReplicaCount@ - The count of Aurora Replicas in an
--     Aurora DB cluster. Available for Aurora MySQL-compatible edition and
--     Aurora PostgreSQL-compatible edition.
--
-- -   @sagemaker:variant:DesiredInstanceCount@ - The number of EC2
--     instances for a SageMaker model endpoint variant.
--
-- -   @custom-resource:ResourceType:Property@ - The scalable dimension for
--     a custom resource provided by your own application or service.
--
-- -   @comprehend:document-classifier-endpoint:DesiredInferenceUnits@ -
--     The number of inference units for an Amazon Comprehend document
--     classification endpoint.
--
-- -   @comprehend:entity-recognizer-endpoint:DesiredInferenceUnits@ - The
--     number of inference units for an Amazon Comprehend entity recognizer
--     endpoint.
--
-- -   @lambda:function:ProvisionedConcurrency@ - The provisioned
--     concurrency for a Lambda function.
--
-- -   @cassandra:table:ReadCapacityUnits@ - The provisioned read capacity
--     for an Amazon Keyspaces table.
--
-- -   @cassandra:table:WriteCapacityUnits@ - The provisioned write
--     capacity for an Amazon Keyspaces table.
--
-- -   @kafka:broker-storage:VolumeSize@ - The provisioned volume size (in
--     GiB) for brokers in an Amazon MSK cluster.
--
-- -   @elasticache:replication-group:NodeGroups@ - The number of node
--     groups for an Amazon ElastiCache replication group.
--
-- -   @elasticache:replication-group:Replicas@ - The number of replicas
--     per node group for an Amazon ElastiCache replication group.
--
-- -   @neptune:cluster:ReadReplicaCount@ - The count of read replicas in
--     an Amazon Neptune DB cluster.
--
-- 'description', 'scalingActivity_description' - A simple description of what action the scaling activity intends to
-- accomplish.
--
-- 'cause', 'scalingActivity_cause' - A simple description of what caused the scaling activity to happen.
--
-- 'startTime', 'scalingActivity_startTime' - The Unix timestamp for when the scaling activity began.
--
-- 'statusCode', 'scalingActivity_statusCode' - Indicates the status of the scaling activity.
newScalingActivity ::
  -- | 'activityId'
  Prelude.Text ->
  -- | 'serviceNamespace'
  ServiceNamespace ->
  -- | 'resourceId'
  Prelude.Text ->
  -- | 'scalableDimension'
  ScalableDimension ->
  -- | 'description'
  Prelude.Text ->
  -- | 'cause'
  Prelude.Text ->
  -- | 'startTime'
  Prelude.UTCTime ->
  -- | 'statusCode'
  ScalingActivityStatusCode ->
  ScalingActivity
newScalingActivity :: Text
-> ServiceNamespace
-> Text
-> ScalableDimension
-> Text
-> Text
-> UTCTime
-> ScalingActivityStatusCode
-> ScalingActivity
newScalingActivity
  Text
pActivityId_
  ServiceNamespace
pServiceNamespace_
  Text
pResourceId_
  ScalableDimension
pScalableDimension_
  Text
pDescription_
  Text
pCause_
  UTCTime
pStartTime_
  ScalingActivityStatusCode
pStatusCode_ =
    ScalingActivity'
      { $sel:details:ScalingActivity' :: Maybe Text
details = forall a. Maybe a
Prelude.Nothing,
        $sel:endTime:ScalingActivity' :: Maybe POSIX
endTime = forall a. Maybe a
Prelude.Nothing,
        $sel:notScaledReasons:ScalingActivity' :: Maybe [NotScaledReason]
notScaledReasons = forall a. Maybe a
Prelude.Nothing,
        $sel:statusMessage:ScalingActivity' :: Maybe Text
statusMessage = forall a. Maybe a
Prelude.Nothing,
        $sel:activityId:ScalingActivity' :: Text
activityId = Text
pActivityId_,
        $sel:serviceNamespace:ScalingActivity' :: ServiceNamespace
serviceNamespace = ServiceNamespace
pServiceNamespace_,
        $sel:resourceId:ScalingActivity' :: Text
resourceId = Text
pResourceId_,
        $sel:scalableDimension:ScalingActivity' :: ScalableDimension
scalableDimension = ScalableDimension
pScalableDimension_,
        $sel:description:ScalingActivity' :: Text
description = Text
pDescription_,
        $sel:cause:ScalingActivity' :: Text
cause = Text
pCause_,
        $sel:startTime:ScalingActivity' :: POSIX
startTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pStartTime_,
        $sel:statusCode:ScalingActivity' :: ScalingActivityStatusCode
statusCode = ScalingActivityStatusCode
pStatusCode_
      }

-- | The details about the scaling activity.
scalingActivity_details :: Lens.Lens' ScalingActivity (Prelude.Maybe Prelude.Text)
scalingActivity_details :: Lens' ScalingActivity (Maybe Text)
scalingActivity_details = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingActivity' {Maybe Text
details :: Maybe Text
$sel:details:ScalingActivity' :: ScalingActivity -> Maybe Text
details} -> Maybe Text
details) (\s :: ScalingActivity
s@ScalingActivity' {} Maybe Text
a -> ScalingActivity
s {$sel:details:ScalingActivity' :: Maybe Text
details = Maybe Text
a} :: ScalingActivity)

-- | The Unix timestamp for when the scaling activity ended.
scalingActivity_endTime :: Lens.Lens' ScalingActivity (Prelude.Maybe Prelude.UTCTime)
scalingActivity_endTime :: Lens' ScalingActivity (Maybe UTCTime)
scalingActivity_endTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingActivity' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:ScalingActivity' :: ScalingActivity -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: ScalingActivity
s@ScalingActivity' {} Maybe POSIX
a -> ScalingActivity
s {$sel:endTime:ScalingActivity' :: Maybe POSIX
endTime = Maybe POSIX
a} :: ScalingActivity) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Machine-readable data that describes the reason for a not scaled
-- activity. Only available when
-- <https://docs.aws.amazon.com/autoscaling/application/APIReference/API_DescribeScalingActivities.html DescribeScalingActivities>
-- includes not scaled activities.
scalingActivity_notScaledReasons :: Lens.Lens' ScalingActivity (Prelude.Maybe [NotScaledReason])
scalingActivity_notScaledReasons :: Lens' ScalingActivity (Maybe [NotScaledReason])
scalingActivity_notScaledReasons = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingActivity' {Maybe [NotScaledReason]
notScaledReasons :: Maybe [NotScaledReason]
$sel:notScaledReasons:ScalingActivity' :: ScalingActivity -> Maybe [NotScaledReason]
notScaledReasons} -> Maybe [NotScaledReason]
notScaledReasons) (\s :: ScalingActivity
s@ScalingActivity' {} Maybe [NotScaledReason]
a -> ScalingActivity
s {$sel:notScaledReasons:ScalingActivity' :: Maybe [NotScaledReason]
notScaledReasons = Maybe [NotScaledReason]
a} :: ScalingActivity) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A simple message about the current status of the scaling activity.
scalingActivity_statusMessage :: Lens.Lens' ScalingActivity (Prelude.Maybe Prelude.Text)
scalingActivity_statusMessage :: Lens' ScalingActivity (Maybe Text)
scalingActivity_statusMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingActivity' {Maybe Text
statusMessage :: Maybe Text
$sel:statusMessage:ScalingActivity' :: ScalingActivity -> Maybe Text
statusMessage} -> Maybe Text
statusMessage) (\s :: ScalingActivity
s@ScalingActivity' {} Maybe Text
a -> ScalingActivity
s {$sel:statusMessage:ScalingActivity' :: Maybe Text
statusMessage = Maybe Text
a} :: ScalingActivity)

-- | The unique identifier of the scaling activity.
scalingActivity_activityId :: Lens.Lens' ScalingActivity Prelude.Text
scalingActivity_activityId :: Lens' ScalingActivity Text
scalingActivity_activityId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingActivity' {Text
activityId :: Text
$sel:activityId:ScalingActivity' :: ScalingActivity -> Text
activityId} -> Text
activityId) (\s :: ScalingActivity
s@ScalingActivity' {} Text
a -> ScalingActivity
s {$sel:activityId:ScalingActivity' :: Text
activityId = Text
a} :: ScalingActivity)

-- | The namespace of the Amazon Web Services service that provides the
-- resource, or a @custom-resource@.
scalingActivity_serviceNamespace :: Lens.Lens' ScalingActivity ServiceNamespace
scalingActivity_serviceNamespace :: Lens' ScalingActivity ServiceNamespace
scalingActivity_serviceNamespace = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingActivity' {ServiceNamespace
serviceNamespace :: ServiceNamespace
$sel:serviceNamespace:ScalingActivity' :: ScalingActivity -> ServiceNamespace
serviceNamespace} -> ServiceNamespace
serviceNamespace) (\s :: ScalingActivity
s@ScalingActivity' {} ServiceNamespace
a -> ScalingActivity
s {$sel:serviceNamespace:ScalingActivity' :: ServiceNamespace
serviceNamespace = ServiceNamespace
a} :: ScalingActivity)

-- | The identifier of the resource associated with the scaling activity.
-- This string consists of the resource type and unique identifier.
--
-- -   ECS service - The resource type is @service@ and the unique
--     identifier is the cluster name and service name. Example:
--     @service\/default\/sample-webapp@.
--
-- -   Spot Fleet - The resource type is @spot-fleet-request@ and the
--     unique identifier is the Spot Fleet request ID. Example:
--     @spot-fleet-request\/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE@.
--
-- -   EMR cluster - The resource type is @instancegroup@ and the unique
--     identifier is the cluster ID and instance group ID. Example:
--     @instancegroup\/j-2EEZNYKUA1NTV\/ig-1791Y4E1L8YI0@.
--
-- -   AppStream 2.0 fleet - The resource type is @fleet@ and the unique
--     identifier is the fleet name. Example: @fleet\/sample-fleet@.
--
-- -   DynamoDB table - The resource type is @table@ and the unique
--     identifier is the table name. Example: @table\/my-table@.
--
-- -   DynamoDB global secondary index - The resource type is @index@ and
--     the unique identifier is the index name. Example:
--     @table\/my-table\/index\/my-table-index@.
--
-- -   Aurora DB cluster - The resource type is @cluster@ and the unique
--     identifier is the cluster name. Example: @cluster:my-db-cluster@.
--
-- -   SageMaker endpoint variant - The resource type is @variant@ and the
--     unique identifier is the resource ID. Example:
--     @endpoint\/my-end-point\/variant\/KMeansClustering@.
--
-- -   Custom resources are not supported with a resource type. This
--     parameter must specify the @OutputValue@ from the CloudFormation
--     template stack used to access the resources. The unique identifier
--     is defined by the service provider. More information is available in
--     our
--     <https://github.com/aws/aws-auto-scaling-custom-resource GitHub repository>.
--
-- -   Amazon Comprehend document classification endpoint - The resource
--     type and unique identifier are specified using the endpoint ARN.
--     Example:
--     @arn:aws:comprehend:us-west-2:123456789012:document-classifier-endpoint\/EXAMPLE@.
--
-- -   Amazon Comprehend entity recognizer endpoint - The resource type and
--     unique identifier are specified using the endpoint ARN. Example:
--     @arn:aws:comprehend:us-west-2:123456789012:entity-recognizer-endpoint\/EXAMPLE@.
--
-- -   Lambda provisioned concurrency - The resource type is @function@ and
--     the unique identifier is the function name with a function version
--     or alias name suffix that is not @$LATEST@. Example:
--     @function:my-function:prod@ or @function:my-function:1@.
--
-- -   Amazon Keyspaces table - The resource type is @table@ and the unique
--     identifier is the table name. Example:
--     @keyspace\/mykeyspace\/table\/mytable@.
--
-- -   Amazon MSK cluster - The resource type and unique identifier are
--     specified using the cluster ARN. Example:
--     @arn:aws:kafka:us-east-1:123456789012:cluster\/demo-cluster-1\/6357e0b2-0e6a-4b86-a0b4-70df934c2e31-5@.
--
-- -   Amazon ElastiCache replication group - The resource type is
--     @replication-group@ and the unique identifier is the replication
--     group name. Example: @replication-group\/mycluster@.
--
-- -   Neptune cluster - The resource type is @cluster@ and the unique
--     identifier is the cluster name. Example: @cluster:mycluster@.
scalingActivity_resourceId :: Lens.Lens' ScalingActivity Prelude.Text
scalingActivity_resourceId :: Lens' ScalingActivity Text
scalingActivity_resourceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingActivity' {Text
resourceId :: Text
$sel:resourceId:ScalingActivity' :: ScalingActivity -> Text
resourceId} -> Text
resourceId) (\s :: ScalingActivity
s@ScalingActivity' {} Text
a -> ScalingActivity
s {$sel:resourceId:ScalingActivity' :: Text
resourceId = Text
a} :: ScalingActivity)

-- | The scalable dimension. This string consists of the service namespace,
-- resource type, and scaling property.
--
-- -   @ecs:service:DesiredCount@ - The desired task count of an ECS
--     service.
--
-- -   @elasticmapreduce:instancegroup:InstanceCount@ - The instance count
--     of an EMR Instance Group.
--
-- -   @ec2:spot-fleet-request:TargetCapacity@ - The target capacity of a
--     Spot Fleet.
--
-- -   @appstream:fleet:DesiredCapacity@ - The desired capacity of an
--     AppStream 2.0 fleet.
--
-- -   @dynamodb:table:ReadCapacityUnits@ - The provisioned read capacity
--     for a DynamoDB table.
--
-- -   @dynamodb:table:WriteCapacityUnits@ - The provisioned write capacity
--     for a DynamoDB table.
--
-- -   @dynamodb:index:ReadCapacityUnits@ - The provisioned read capacity
--     for a DynamoDB global secondary index.
--
-- -   @dynamodb:index:WriteCapacityUnits@ - The provisioned write capacity
--     for a DynamoDB global secondary index.
--
-- -   @rds:cluster:ReadReplicaCount@ - The count of Aurora Replicas in an
--     Aurora DB cluster. Available for Aurora MySQL-compatible edition and
--     Aurora PostgreSQL-compatible edition.
--
-- -   @sagemaker:variant:DesiredInstanceCount@ - The number of EC2
--     instances for a SageMaker model endpoint variant.
--
-- -   @custom-resource:ResourceType:Property@ - The scalable dimension for
--     a custom resource provided by your own application or service.
--
-- -   @comprehend:document-classifier-endpoint:DesiredInferenceUnits@ -
--     The number of inference units for an Amazon Comprehend document
--     classification endpoint.
--
-- -   @comprehend:entity-recognizer-endpoint:DesiredInferenceUnits@ - The
--     number of inference units for an Amazon Comprehend entity recognizer
--     endpoint.
--
-- -   @lambda:function:ProvisionedConcurrency@ - The provisioned
--     concurrency for a Lambda function.
--
-- -   @cassandra:table:ReadCapacityUnits@ - The provisioned read capacity
--     for an Amazon Keyspaces table.
--
-- -   @cassandra:table:WriteCapacityUnits@ - The provisioned write
--     capacity for an Amazon Keyspaces table.
--
-- -   @kafka:broker-storage:VolumeSize@ - The provisioned volume size (in
--     GiB) for brokers in an Amazon MSK cluster.
--
-- -   @elasticache:replication-group:NodeGroups@ - The number of node
--     groups for an Amazon ElastiCache replication group.
--
-- -   @elasticache:replication-group:Replicas@ - The number of replicas
--     per node group for an Amazon ElastiCache replication group.
--
-- -   @neptune:cluster:ReadReplicaCount@ - The count of read replicas in
--     an Amazon Neptune DB cluster.
scalingActivity_scalableDimension :: Lens.Lens' ScalingActivity ScalableDimension
scalingActivity_scalableDimension :: Lens' ScalingActivity ScalableDimension
scalingActivity_scalableDimension = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingActivity' {ScalableDimension
scalableDimension :: ScalableDimension
$sel:scalableDimension:ScalingActivity' :: ScalingActivity -> ScalableDimension
scalableDimension} -> ScalableDimension
scalableDimension) (\s :: ScalingActivity
s@ScalingActivity' {} ScalableDimension
a -> ScalingActivity
s {$sel:scalableDimension:ScalingActivity' :: ScalableDimension
scalableDimension = ScalableDimension
a} :: ScalingActivity)

-- | A simple description of what action the scaling activity intends to
-- accomplish.
scalingActivity_description :: Lens.Lens' ScalingActivity Prelude.Text
scalingActivity_description :: Lens' ScalingActivity Text
scalingActivity_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingActivity' {Text
description :: Text
$sel:description:ScalingActivity' :: ScalingActivity -> Text
description} -> Text
description) (\s :: ScalingActivity
s@ScalingActivity' {} Text
a -> ScalingActivity
s {$sel:description:ScalingActivity' :: Text
description = Text
a} :: ScalingActivity)

-- | A simple description of what caused the scaling activity to happen.
scalingActivity_cause :: Lens.Lens' ScalingActivity Prelude.Text
scalingActivity_cause :: Lens' ScalingActivity Text
scalingActivity_cause = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingActivity' {Text
cause :: Text
$sel:cause:ScalingActivity' :: ScalingActivity -> Text
cause} -> Text
cause) (\s :: ScalingActivity
s@ScalingActivity' {} Text
a -> ScalingActivity
s {$sel:cause:ScalingActivity' :: Text
cause = Text
a} :: ScalingActivity)

-- | The Unix timestamp for when the scaling activity began.
scalingActivity_startTime :: Lens.Lens' ScalingActivity Prelude.UTCTime
scalingActivity_startTime :: Lens' ScalingActivity UTCTime
scalingActivity_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingActivity' {POSIX
startTime :: POSIX
$sel:startTime:ScalingActivity' :: ScalingActivity -> POSIX
startTime} -> POSIX
startTime) (\s :: ScalingActivity
s@ScalingActivity' {} POSIX
a -> ScalingActivity
s {$sel:startTime:ScalingActivity' :: POSIX
startTime = POSIX
a} :: ScalingActivity) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Indicates the status of the scaling activity.
scalingActivity_statusCode :: Lens.Lens' ScalingActivity ScalingActivityStatusCode
scalingActivity_statusCode :: Lens' ScalingActivity ScalingActivityStatusCode
scalingActivity_statusCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingActivity' {ScalingActivityStatusCode
statusCode :: ScalingActivityStatusCode
$sel:statusCode:ScalingActivity' :: ScalingActivity -> ScalingActivityStatusCode
statusCode} -> ScalingActivityStatusCode
statusCode) (\s :: ScalingActivity
s@ScalingActivity' {} ScalingActivityStatusCode
a -> ScalingActivity
s {$sel:statusCode:ScalingActivity' :: ScalingActivityStatusCode
statusCode = ScalingActivityStatusCode
a} :: ScalingActivity)

instance Data.FromJSON ScalingActivity where
  parseJSON :: Value -> Parser ScalingActivity
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ScalingActivity"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe [NotScaledReason]
-> Maybe Text
-> Text
-> ServiceNamespace
-> Text
-> ScalableDimension
-> Text
-> Text
-> POSIX
-> ScalingActivityStatusCode
-> ScalingActivity
ScalingActivity'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Details")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"EndTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"NotScaledReasons"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"StatusMessage")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ActivityId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ServiceNamespace")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ResourceId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ScalableDimension")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Description")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Cause")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"StartTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"StatusCode")
      )

instance Prelude.Hashable ScalingActivity where
  hashWithSalt :: Int -> ScalingActivity -> Int
hashWithSalt Int
_salt ScalingActivity' {Maybe [NotScaledReason]
Maybe Text
Maybe POSIX
Text
POSIX
ScalableDimension
ScalingActivityStatusCode
ServiceNamespace
statusCode :: ScalingActivityStatusCode
startTime :: POSIX
cause :: Text
description :: Text
scalableDimension :: ScalableDimension
resourceId :: Text
serviceNamespace :: ServiceNamespace
activityId :: Text
statusMessage :: Maybe Text
notScaledReasons :: Maybe [NotScaledReason]
endTime :: Maybe POSIX
details :: Maybe Text
$sel:statusCode:ScalingActivity' :: ScalingActivity -> ScalingActivityStatusCode
$sel:startTime:ScalingActivity' :: ScalingActivity -> POSIX
$sel:cause:ScalingActivity' :: ScalingActivity -> Text
$sel:description:ScalingActivity' :: ScalingActivity -> Text
$sel:scalableDimension:ScalingActivity' :: ScalingActivity -> ScalableDimension
$sel:resourceId:ScalingActivity' :: ScalingActivity -> Text
$sel:serviceNamespace:ScalingActivity' :: ScalingActivity -> ServiceNamespace
$sel:activityId:ScalingActivity' :: ScalingActivity -> Text
$sel:statusMessage:ScalingActivity' :: ScalingActivity -> Maybe Text
$sel:notScaledReasons:ScalingActivity' :: ScalingActivity -> Maybe [NotScaledReason]
$sel:endTime:ScalingActivity' :: ScalingActivity -> Maybe POSIX
$sel:details:ScalingActivity' :: ScalingActivity -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
details
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
endTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [NotScaledReason]
notScaledReasons
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
statusMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
activityId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ServiceNamespace
serviceNamespace
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ScalableDimension
scalableDimension
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
cause
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
startTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ScalingActivityStatusCode
statusCode

instance Prelude.NFData ScalingActivity where
  rnf :: ScalingActivity -> ()
rnf ScalingActivity' {Maybe [NotScaledReason]
Maybe Text
Maybe POSIX
Text
POSIX
ScalableDimension
ScalingActivityStatusCode
ServiceNamespace
statusCode :: ScalingActivityStatusCode
startTime :: POSIX
cause :: Text
description :: Text
scalableDimension :: ScalableDimension
resourceId :: Text
serviceNamespace :: ServiceNamespace
activityId :: Text
statusMessage :: Maybe Text
notScaledReasons :: Maybe [NotScaledReason]
endTime :: Maybe POSIX
details :: Maybe Text
$sel:statusCode:ScalingActivity' :: ScalingActivity -> ScalingActivityStatusCode
$sel:startTime:ScalingActivity' :: ScalingActivity -> POSIX
$sel:cause:ScalingActivity' :: ScalingActivity -> Text
$sel:description:ScalingActivity' :: ScalingActivity -> Text
$sel:scalableDimension:ScalingActivity' :: ScalingActivity -> ScalableDimension
$sel:resourceId:ScalingActivity' :: ScalingActivity -> Text
$sel:serviceNamespace:ScalingActivity' :: ScalingActivity -> ServiceNamespace
$sel:activityId:ScalingActivity' :: ScalingActivity -> Text
$sel:statusMessage:ScalingActivity' :: ScalingActivity -> Maybe Text
$sel:notScaledReasons:ScalingActivity' :: ScalingActivity -> Maybe [NotScaledReason]
$sel:endTime:ScalingActivity' :: ScalingActivity -> Maybe POSIX
$sel:details:ScalingActivity' :: ScalingActivity -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
details
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
endTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [NotScaledReason]
notScaledReasons
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
statusMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
activityId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ServiceNamespace
serviceNamespace
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
resourceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ScalableDimension
scalableDimension
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
cause
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
startTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ScalingActivityStatusCode
statusCode