{-# 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.ComputeOptimizer.Types.ECSServiceRecommendation
-- 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.ComputeOptimizer.Types.ECSServiceRecommendation where

import Amazonka.ComputeOptimizer.Types.CurrentPerformanceRisk
import Amazonka.ComputeOptimizer.Types.ECSServiceLaunchType
import Amazonka.ComputeOptimizer.Types.ECSServiceRecommendationFinding
import Amazonka.ComputeOptimizer.Types.ECSServiceRecommendationFindingReasonCode
import Amazonka.ComputeOptimizer.Types.ECSServiceRecommendationOption
import Amazonka.ComputeOptimizer.Types.ECSServiceUtilizationMetric
import Amazonka.ComputeOptimizer.Types.ServiceConfiguration
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

-- | Describes an Amazon ECS service recommendation.
--
-- /See:/ 'newECSServiceRecommendation' smart constructor.
data ECSServiceRecommendation = ECSServiceRecommendation'
  { -- | The Amazon Web Services account ID of the ECS service.
    ECSServiceRecommendation -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | The risk of the current ECS service not meeting the performance needs of
    -- its workloads. The higher the risk, the more likely the current service
    -- can\'t meet the performance requirements of its workload.
    ECSServiceRecommendation -> Maybe CurrentPerformanceRisk
currentPerformanceRisk :: Prelude.Maybe CurrentPerformanceRisk,
    -- | The configuration of the current ECS service.
    ECSServiceRecommendation -> Maybe ServiceConfiguration
currentServiceConfiguration :: Prelude.Maybe ServiceConfiguration,
    -- | The finding classification of an ECS service.
    --
    -- Findings for ECS services include:
    --
    -- -   __@Underprovisioned@__ — When Compute Optimizer detects that there’s
    --     not enough memory or CPU, an ECS service is considered
    --     under-provisioned. An under-provisioned ECS service might result in
    --     poor application performance.
    --
    -- -   __@Overprovisioned@__ — When Compute Optimizer detects that there’s
    --     excessive memory or CPU, an ECS service is considered
    --     over-provisioned. An over-provisioned ECS service might result in
    --     additional infrastructure costs.
    --
    -- -   __@Optimized@__ — When both the CPU and memory of your ECS service
    --     meet the performance requirements of your workload, the service is
    --     considered optimized.
    ECSServiceRecommendation -> Maybe ECSServiceRecommendationFinding
finding :: Prelude.Maybe ECSServiceRecommendationFinding,
    -- | The reason for the finding classification of an ECS service.
    --
    -- Finding reason codes for ECS services include:
    --
    -- -   __@CPUUnderprovisioned@__ — The ECS service CPU configuration can be
    --     sized up to enhance the performance of your workload. This is
    --     identified by analyzing the @CPUUtilization@ metric of the current
    --     service during the look-back period.
    --
    -- -   __@CPUOverprovisioned@__ — The ECS service CPU configuration can be
    --     sized down while still meeting the performance requirements of your
    --     workload. This is identified by analyzing the @CPUUtilization@
    --     metric of the current service during the look-back period.
    --
    -- -   __@MemoryUnderprovisioned@__ — The ECS service memory configuration
    --     can be sized up to enhance the performance of your workload. This is
    --     identified by analyzing the @MemoryUtilization@ metric of the
    --     current service during the look-back period.
    --
    -- -   __@MemoryOverprovisioned@__ — The ECS service memory configuration
    --     can be sized down while still meeting the performance requirements
    --     of your workload. This is identified by analyzing the
    --     @MemoryUtilization@ metric of the current service during the
    --     look-back period.
    ECSServiceRecommendation
-> Maybe [ECSServiceRecommendationFindingReasonCode]
findingReasonCodes :: Prelude.Maybe [ECSServiceRecommendationFindingReasonCode],
    -- | The timestamp of when the ECS service recommendation was last generated.
    ECSServiceRecommendation -> Maybe POSIX
lastRefreshTimestamp :: Prelude.Maybe Data.POSIX,
    -- | The launch type the ECS service is using.
    --
    -- Compute Optimizer only supports the Fargate launch type.
    ECSServiceRecommendation -> Maybe ECSServiceLaunchType
launchType :: Prelude.Maybe ECSServiceLaunchType,
    -- | The number of days the ECS service utilization metrics were analyzed.
    ECSServiceRecommendation -> Maybe Double
lookbackPeriodInDays :: Prelude.Maybe Prelude.Double,
    -- | The Amazon Resource Name (ARN) of the current ECS service.
    --
    -- The following is the format of the ARN:
    --
    -- @arn:aws:ecs:region:aws_account_id:service\/cluster-name\/service-name@
    ECSServiceRecommendation -> Maybe Text
serviceArn :: Prelude.Maybe Prelude.Text,
    -- | An array of objects that describe the recommendation options for the ECS
    -- service.
    ECSServiceRecommendation -> Maybe [ECSServiceRecommendationOption]
serviceRecommendationOptions :: Prelude.Maybe [ECSServiceRecommendationOption],
    -- | An array of objects that describe the utilization metrics of the ECS
    -- service.
    ECSServiceRecommendation -> Maybe [ECSServiceUtilizationMetric]
utilizationMetrics :: Prelude.Maybe [ECSServiceUtilizationMetric]
  }
  deriving (ECSServiceRecommendation -> ECSServiceRecommendation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ECSServiceRecommendation -> ECSServiceRecommendation -> Bool
$c/= :: ECSServiceRecommendation -> ECSServiceRecommendation -> Bool
== :: ECSServiceRecommendation -> ECSServiceRecommendation -> Bool
$c== :: ECSServiceRecommendation -> ECSServiceRecommendation -> Bool
Prelude.Eq, ReadPrec [ECSServiceRecommendation]
ReadPrec ECSServiceRecommendation
Int -> ReadS ECSServiceRecommendation
ReadS [ECSServiceRecommendation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ECSServiceRecommendation]
$creadListPrec :: ReadPrec [ECSServiceRecommendation]
readPrec :: ReadPrec ECSServiceRecommendation
$creadPrec :: ReadPrec ECSServiceRecommendation
readList :: ReadS [ECSServiceRecommendation]
$creadList :: ReadS [ECSServiceRecommendation]
readsPrec :: Int -> ReadS ECSServiceRecommendation
$creadsPrec :: Int -> ReadS ECSServiceRecommendation
Prelude.Read, Int -> ECSServiceRecommendation -> ShowS
[ECSServiceRecommendation] -> ShowS
ECSServiceRecommendation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ECSServiceRecommendation] -> ShowS
$cshowList :: [ECSServiceRecommendation] -> ShowS
show :: ECSServiceRecommendation -> String
$cshow :: ECSServiceRecommendation -> String
showsPrec :: Int -> ECSServiceRecommendation -> ShowS
$cshowsPrec :: Int -> ECSServiceRecommendation -> ShowS
Prelude.Show, forall x.
Rep ECSServiceRecommendation x -> ECSServiceRecommendation
forall x.
ECSServiceRecommendation -> Rep ECSServiceRecommendation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ECSServiceRecommendation x -> ECSServiceRecommendation
$cfrom :: forall x.
ECSServiceRecommendation -> Rep ECSServiceRecommendation x
Prelude.Generic)

-- |
-- Create a value of 'ECSServiceRecommendation' 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:
--
-- 'accountId', 'eCSServiceRecommendation_accountId' - The Amazon Web Services account ID of the ECS service.
--
-- 'currentPerformanceRisk', 'eCSServiceRecommendation_currentPerformanceRisk' - The risk of the current ECS service not meeting the performance needs of
-- its workloads. The higher the risk, the more likely the current service
-- can\'t meet the performance requirements of its workload.
--
-- 'currentServiceConfiguration', 'eCSServiceRecommendation_currentServiceConfiguration' - The configuration of the current ECS service.
--
-- 'finding', 'eCSServiceRecommendation_finding' - The finding classification of an ECS service.
--
-- Findings for ECS services include:
--
-- -   __@Underprovisioned@__ — When Compute Optimizer detects that there’s
--     not enough memory or CPU, an ECS service is considered
--     under-provisioned. An under-provisioned ECS service might result in
--     poor application performance.
--
-- -   __@Overprovisioned@__ — When Compute Optimizer detects that there’s
--     excessive memory or CPU, an ECS service is considered
--     over-provisioned. An over-provisioned ECS service might result in
--     additional infrastructure costs.
--
-- -   __@Optimized@__ — When both the CPU and memory of your ECS service
--     meet the performance requirements of your workload, the service is
--     considered optimized.
--
-- 'findingReasonCodes', 'eCSServiceRecommendation_findingReasonCodes' - The reason for the finding classification of an ECS service.
--
-- Finding reason codes for ECS services include:
--
-- -   __@CPUUnderprovisioned@__ — The ECS service CPU configuration can be
--     sized up to enhance the performance of your workload. This is
--     identified by analyzing the @CPUUtilization@ metric of the current
--     service during the look-back period.
--
-- -   __@CPUOverprovisioned@__ — The ECS service CPU configuration can be
--     sized down while still meeting the performance requirements of your
--     workload. This is identified by analyzing the @CPUUtilization@
--     metric of the current service during the look-back period.
--
-- -   __@MemoryUnderprovisioned@__ — The ECS service memory configuration
--     can be sized up to enhance the performance of your workload. This is
--     identified by analyzing the @MemoryUtilization@ metric of the
--     current service during the look-back period.
--
-- -   __@MemoryOverprovisioned@__ — The ECS service memory configuration
--     can be sized down while still meeting the performance requirements
--     of your workload. This is identified by analyzing the
--     @MemoryUtilization@ metric of the current service during the
--     look-back period.
--
-- 'lastRefreshTimestamp', 'eCSServiceRecommendation_lastRefreshTimestamp' - The timestamp of when the ECS service recommendation was last generated.
--
-- 'launchType', 'eCSServiceRecommendation_launchType' - The launch type the ECS service is using.
--
-- Compute Optimizer only supports the Fargate launch type.
--
-- 'lookbackPeriodInDays', 'eCSServiceRecommendation_lookbackPeriodInDays' - The number of days the ECS service utilization metrics were analyzed.
--
-- 'serviceArn', 'eCSServiceRecommendation_serviceArn' - The Amazon Resource Name (ARN) of the current ECS service.
--
-- The following is the format of the ARN:
--
-- @arn:aws:ecs:region:aws_account_id:service\/cluster-name\/service-name@
--
-- 'serviceRecommendationOptions', 'eCSServiceRecommendation_serviceRecommendationOptions' - An array of objects that describe the recommendation options for the ECS
-- service.
--
-- 'utilizationMetrics', 'eCSServiceRecommendation_utilizationMetrics' - An array of objects that describe the utilization metrics of the ECS
-- service.
newECSServiceRecommendation ::
  ECSServiceRecommendation
newECSServiceRecommendation :: ECSServiceRecommendation
newECSServiceRecommendation =
  ECSServiceRecommendation'
    { $sel:accountId:ECSServiceRecommendation' :: Maybe Text
accountId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:currentPerformanceRisk:ECSServiceRecommendation' :: Maybe CurrentPerformanceRisk
currentPerformanceRisk = forall a. Maybe a
Prelude.Nothing,
      $sel:currentServiceConfiguration:ECSServiceRecommendation' :: Maybe ServiceConfiguration
currentServiceConfiguration = forall a. Maybe a
Prelude.Nothing,
      $sel:finding:ECSServiceRecommendation' :: Maybe ECSServiceRecommendationFinding
finding = forall a. Maybe a
Prelude.Nothing,
      $sel:findingReasonCodes:ECSServiceRecommendation' :: Maybe [ECSServiceRecommendationFindingReasonCode]
findingReasonCodes = forall a. Maybe a
Prelude.Nothing,
      $sel:lastRefreshTimestamp:ECSServiceRecommendation' :: Maybe POSIX
lastRefreshTimestamp = forall a. Maybe a
Prelude.Nothing,
      $sel:launchType:ECSServiceRecommendation' :: Maybe ECSServiceLaunchType
launchType = forall a. Maybe a
Prelude.Nothing,
      $sel:lookbackPeriodInDays:ECSServiceRecommendation' :: Maybe Double
lookbackPeriodInDays = forall a. Maybe a
Prelude.Nothing,
      $sel:serviceArn:ECSServiceRecommendation' :: Maybe Text
serviceArn = forall a. Maybe a
Prelude.Nothing,
      $sel:serviceRecommendationOptions:ECSServiceRecommendation' :: Maybe [ECSServiceRecommendationOption]
serviceRecommendationOptions = forall a. Maybe a
Prelude.Nothing,
      $sel:utilizationMetrics:ECSServiceRecommendation' :: Maybe [ECSServiceUtilizationMetric]
utilizationMetrics = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Web Services account ID of the ECS service.
eCSServiceRecommendation_accountId :: Lens.Lens' ECSServiceRecommendation (Prelude.Maybe Prelude.Text)
eCSServiceRecommendation_accountId :: Lens' ECSServiceRecommendation (Maybe Text)
eCSServiceRecommendation_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ECSServiceRecommendation' {Maybe Text
accountId :: Maybe Text
$sel:accountId:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: ECSServiceRecommendation
s@ECSServiceRecommendation' {} Maybe Text
a -> ECSServiceRecommendation
s {$sel:accountId:ECSServiceRecommendation' :: Maybe Text
accountId = Maybe Text
a} :: ECSServiceRecommendation)

-- | The risk of the current ECS service not meeting the performance needs of
-- its workloads. The higher the risk, the more likely the current service
-- can\'t meet the performance requirements of its workload.
eCSServiceRecommendation_currentPerformanceRisk :: Lens.Lens' ECSServiceRecommendation (Prelude.Maybe CurrentPerformanceRisk)
eCSServiceRecommendation_currentPerformanceRisk :: Lens' ECSServiceRecommendation (Maybe CurrentPerformanceRisk)
eCSServiceRecommendation_currentPerformanceRisk = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ECSServiceRecommendation' {Maybe CurrentPerformanceRisk
currentPerformanceRisk :: Maybe CurrentPerformanceRisk
$sel:currentPerformanceRisk:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe CurrentPerformanceRisk
currentPerformanceRisk} -> Maybe CurrentPerformanceRisk
currentPerformanceRisk) (\s :: ECSServiceRecommendation
s@ECSServiceRecommendation' {} Maybe CurrentPerformanceRisk
a -> ECSServiceRecommendation
s {$sel:currentPerformanceRisk:ECSServiceRecommendation' :: Maybe CurrentPerformanceRisk
currentPerformanceRisk = Maybe CurrentPerformanceRisk
a} :: ECSServiceRecommendation)

-- | The configuration of the current ECS service.
eCSServiceRecommendation_currentServiceConfiguration :: Lens.Lens' ECSServiceRecommendation (Prelude.Maybe ServiceConfiguration)
eCSServiceRecommendation_currentServiceConfiguration :: Lens' ECSServiceRecommendation (Maybe ServiceConfiguration)
eCSServiceRecommendation_currentServiceConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ECSServiceRecommendation' {Maybe ServiceConfiguration
currentServiceConfiguration :: Maybe ServiceConfiguration
$sel:currentServiceConfiguration:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe ServiceConfiguration
currentServiceConfiguration} -> Maybe ServiceConfiguration
currentServiceConfiguration) (\s :: ECSServiceRecommendation
s@ECSServiceRecommendation' {} Maybe ServiceConfiguration
a -> ECSServiceRecommendation
s {$sel:currentServiceConfiguration:ECSServiceRecommendation' :: Maybe ServiceConfiguration
currentServiceConfiguration = Maybe ServiceConfiguration
a} :: ECSServiceRecommendation)

-- | The finding classification of an ECS service.
--
-- Findings for ECS services include:
--
-- -   __@Underprovisioned@__ — When Compute Optimizer detects that there’s
--     not enough memory or CPU, an ECS service is considered
--     under-provisioned. An under-provisioned ECS service might result in
--     poor application performance.
--
-- -   __@Overprovisioned@__ — When Compute Optimizer detects that there’s
--     excessive memory or CPU, an ECS service is considered
--     over-provisioned. An over-provisioned ECS service might result in
--     additional infrastructure costs.
--
-- -   __@Optimized@__ — When both the CPU and memory of your ECS service
--     meet the performance requirements of your workload, the service is
--     considered optimized.
eCSServiceRecommendation_finding :: Lens.Lens' ECSServiceRecommendation (Prelude.Maybe ECSServiceRecommendationFinding)
eCSServiceRecommendation_finding :: Lens'
  ECSServiceRecommendation (Maybe ECSServiceRecommendationFinding)
eCSServiceRecommendation_finding = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ECSServiceRecommendation' {Maybe ECSServiceRecommendationFinding
finding :: Maybe ECSServiceRecommendationFinding
$sel:finding:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe ECSServiceRecommendationFinding
finding} -> Maybe ECSServiceRecommendationFinding
finding) (\s :: ECSServiceRecommendation
s@ECSServiceRecommendation' {} Maybe ECSServiceRecommendationFinding
a -> ECSServiceRecommendation
s {$sel:finding:ECSServiceRecommendation' :: Maybe ECSServiceRecommendationFinding
finding = Maybe ECSServiceRecommendationFinding
a} :: ECSServiceRecommendation)

-- | The reason for the finding classification of an ECS service.
--
-- Finding reason codes for ECS services include:
--
-- -   __@CPUUnderprovisioned@__ — The ECS service CPU configuration can be
--     sized up to enhance the performance of your workload. This is
--     identified by analyzing the @CPUUtilization@ metric of the current
--     service during the look-back period.
--
-- -   __@CPUOverprovisioned@__ — The ECS service CPU configuration can be
--     sized down while still meeting the performance requirements of your
--     workload. This is identified by analyzing the @CPUUtilization@
--     metric of the current service during the look-back period.
--
-- -   __@MemoryUnderprovisioned@__ — The ECS service memory configuration
--     can be sized up to enhance the performance of your workload. This is
--     identified by analyzing the @MemoryUtilization@ metric of the
--     current service during the look-back period.
--
-- -   __@MemoryOverprovisioned@__ — The ECS service memory configuration
--     can be sized down while still meeting the performance requirements
--     of your workload. This is identified by analyzing the
--     @MemoryUtilization@ metric of the current service during the
--     look-back period.
eCSServiceRecommendation_findingReasonCodes :: Lens.Lens' ECSServiceRecommendation (Prelude.Maybe [ECSServiceRecommendationFindingReasonCode])
eCSServiceRecommendation_findingReasonCodes :: Lens'
  ECSServiceRecommendation
  (Maybe [ECSServiceRecommendationFindingReasonCode])
eCSServiceRecommendation_findingReasonCodes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ECSServiceRecommendation' {Maybe [ECSServiceRecommendationFindingReasonCode]
findingReasonCodes :: Maybe [ECSServiceRecommendationFindingReasonCode]
$sel:findingReasonCodes:ECSServiceRecommendation' :: ECSServiceRecommendation
-> Maybe [ECSServiceRecommendationFindingReasonCode]
findingReasonCodes} -> Maybe [ECSServiceRecommendationFindingReasonCode]
findingReasonCodes) (\s :: ECSServiceRecommendation
s@ECSServiceRecommendation' {} Maybe [ECSServiceRecommendationFindingReasonCode]
a -> ECSServiceRecommendation
s {$sel:findingReasonCodes:ECSServiceRecommendation' :: Maybe [ECSServiceRecommendationFindingReasonCode]
findingReasonCodes = Maybe [ECSServiceRecommendationFindingReasonCode]
a} :: ECSServiceRecommendation) 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

-- | The timestamp of when the ECS service recommendation was last generated.
eCSServiceRecommendation_lastRefreshTimestamp :: Lens.Lens' ECSServiceRecommendation (Prelude.Maybe Prelude.UTCTime)
eCSServiceRecommendation_lastRefreshTimestamp :: Lens' ECSServiceRecommendation (Maybe UTCTime)
eCSServiceRecommendation_lastRefreshTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ECSServiceRecommendation' {Maybe POSIX
lastRefreshTimestamp :: Maybe POSIX
$sel:lastRefreshTimestamp:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe POSIX
lastRefreshTimestamp} -> Maybe POSIX
lastRefreshTimestamp) (\s :: ECSServiceRecommendation
s@ECSServiceRecommendation' {} Maybe POSIX
a -> ECSServiceRecommendation
s {$sel:lastRefreshTimestamp:ECSServiceRecommendation' :: Maybe POSIX
lastRefreshTimestamp = Maybe POSIX
a} :: ECSServiceRecommendation) 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

-- | The launch type the ECS service is using.
--
-- Compute Optimizer only supports the Fargate launch type.
eCSServiceRecommendation_launchType :: Lens.Lens' ECSServiceRecommendation (Prelude.Maybe ECSServiceLaunchType)
eCSServiceRecommendation_launchType :: Lens' ECSServiceRecommendation (Maybe ECSServiceLaunchType)
eCSServiceRecommendation_launchType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ECSServiceRecommendation' {Maybe ECSServiceLaunchType
launchType :: Maybe ECSServiceLaunchType
$sel:launchType:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe ECSServiceLaunchType
launchType} -> Maybe ECSServiceLaunchType
launchType) (\s :: ECSServiceRecommendation
s@ECSServiceRecommendation' {} Maybe ECSServiceLaunchType
a -> ECSServiceRecommendation
s {$sel:launchType:ECSServiceRecommendation' :: Maybe ECSServiceLaunchType
launchType = Maybe ECSServiceLaunchType
a} :: ECSServiceRecommendation)

-- | The number of days the ECS service utilization metrics were analyzed.
eCSServiceRecommendation_lookbackPeriodInDays :: Lens.Lens' ECSServiceRecommendation (Prelude.Maybe Prelude.Double)
eCSServiceRecommendation_lookbackPeriodInDays :: Lens' ECSServiceRecommendation (Maybe Double)
eCSServiceRecommendation_lookbackPeriodInDays = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ECSServiceRecommendation' {Maybe Double
lookbackPeriodInDays :: Maybe Double
$sel:lookbackPeriodInDays:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe Double
lookbackPeriodInDays} -> Maybe Double
lookbackPeriodInDays) (\s :: ECSServiceRecommendation
s@ECSServiceRecommendation' {} Maybe Double
a -> ECSServiceRecommendation
s {$sel:lookbackPeriodInDays:ECSServiceRecommendation' :: Maybe Double
lookbackPeriodInDays = Maybe Double
a} :: ECSServiceRecommendation)

-- | The Amazon Resource Name (ARN) of the current ECS service.
--
-- The following is the format of the ARN:
--
-- @arn:aws:ecs:region:aws_account_id:service\/cluster-name\/service-name@
eCSServiceRecommendation_serviceArn :: Lens.Lens' ECSServiceRecommendation (Prelude.Maybe Prelude.Text)
eCSServiceRecommendation_serviceArn :: Lens' ECSServiceRecommendation (Maybe Text)
eCSServiceRecommendation_serviceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ECSServiceRecommendation' {Maybe Text
serviceArn :: Maybe Text
$sel:serviceArn:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe Text
serviceArn} -> Maybe Text
serviceArn) (\s :: ECSServiceRecommendation
s@ECSServiceRecommendation' {} Maybe Text
a -> ECSServiceRecommendation
s {$sel:serviceArn:ECSServiceRecommendation' :: Maybe Text
serviceArn = Maybe Text
a} :: ECSServiceRecommendation)

-- | An array of objects that describe the recommendation options for the ECS
-- service.
eCSServiceRecommendation_serviceRecommendationOptions :: Lens.Lens' ECSServiceRecommendation (Prelude.Maybe [ECSServiceRecommendationOption])
eCSServiceRecommendation_serviceRecommendationOptions :: Lens'
  ECSServiceRecommendation (Maybe [ECSServiceRecommendationOption])
eCSServiceRecommendation_serviceRecommendationOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ECSServiceRecommendation' {Maybe [ECSServiceRecommendationOption]
serviceRecommendationOptions :: Maybe [ECSServiceRecommendationOption]
$sel:serviceRecommendationOptions:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe [ECSServiceRecommendationOption]
serviceRecommendationOptions} -> Maybe [ECSServiceRecommendationOption]
serviceRecommendationOptions) (\s :: ECSServiceRecommendation
s@ECSServiceRecommendation' {} Maybe [ECSServiceRecommendationOption]
a -> ECSServiceRecommendation
s {$sel:serviceRecommendationOptions:ECSServiceRecommendation' :: Maybe [ECSServiceRecommendationOption]
serviceRecommendationOptions = Maybe [ECSServiceRecommendationOption]
a} :: ECSServiceRecommendation) 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

-- | An array of objects that describe the utilization metrics of the ECS
-- service.
eCSServiceRecommendation_utilizationMetrics :: Lens.Lens' ECSServiceRecommendation (Prelude.Maybe [ECSServiceUtilizationMetric])
eCSServiceRecommendation_utilizationMetrics :: Lens'
  ECSServiceRecommendation (Maybe [ECSServiceUtilizationMetric])
eCSServiceRecommendation_utilizationMetrics = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ECSServiceRecommendation' {Maybe [ECSServiceUtilizationMetric]
utilizationMetrics :: Maybe [ECSServiceUtilizationMetric]
$sel:utilizationMetrics:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe [ECSServiceUtilizationMetric]
utilizationMetrics} -> Maybe [ECSServiceUtilizationMetric]
utilizationMetrics) (\s :: ECSServiceRecommendation
s@ECSServiceRecommendation' {} Maybe [ECSServiceUtilizationMetric]
a -> ECSServiceRecommendation
s {$sel:utilizationMetrics:ECSServiceRecommendation' :: Maybe [ECSServiceUtilizationMetric]
utilizationMetrics = Maybe [ECSServiceUtilizationMetric]
a} :: ECSServiceRecommendation) 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

instance Data.FromJSON ECSServiceRecommendation where
  parseJSON :: Value -> Parser ECSServiceRecommendation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ECSServiceRecommendation"
      ( \Object
x ->
          Maybe Text
-> Maybe CurrentPerformanceRisk
-> Maybe ServiceConfiguration
-> Maybe ECSServiceRecommendationFinding
-> Maybe [ECSServiceRecommendationFindingReasonCode]
-> Maybe POSIX
-> Maybe ECSServiceLaunchType
-> Maybe Double
-> Maybe Text
-> Maybe [ECSServiceRecommendationOption]
-> Maybe [ECSServiceUtilizationMetric]
-> ECSServiceRecommendation
ECSServiceRecommendation'
            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
"accountId")
            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
"currentPerformanceRisk")
            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
"currentServiceConfiguration")
            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
"finding")
            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
"findingReasonCodes"
                            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
"lastRefreshTimestamp")
            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
"launchType")
            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
"lookbackPeriodInDays")
            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
"serviceArn")
            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
"serviceRecommendationOptions"
                            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
"utilizationMetrics"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable ECSServiceRecommendation where
  hashWithSalt :: Int -> ECSServiceRecommendation -> Int
hashWithSalt Int
_salt ECSServiceRecommendation' {Maybe Double
Maybe [ECSServiceRecommendationFindingReasonCode]
Maybe [ECSServiceUtilizationMetric]
Maybe [ECSServiceRecommendationOption]
Maybe Text
Maybe POSIX
Maybe CurrentPerformanceRisk
Maybe ECSServiceLaunchType
Maybe ECSServiceRecommendationFinding
Maybe ServiceConfiguration
utilizationMetrics :: Maybe [ECSServiceUtilizationMetric]
serviceRecommendationOptions :: Maybe [ECSServiceRecommendationOption]
serviceArn :: Maybe Text
lookbackPeriodInDays :: Maybe Double
launchType :: Maybe ECSServiceLaunchType
lastRefreshTimestamp :: Maybe POSIX
findingReasonCodes :: Maybe [ECSServiceRecommendationFindingReasonCode]
finding :: Maybe ECSServiceRecommendationFinding
currentServiceConfiguration :: Maybe ServiceConfiguration
currentPerformanceRisk :: Maybe CurrentPerformanceRisk
accountId :: Maybe Text
$sel:utilizationMetrics:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe [ECSServiceUtilizationMetric]
$sel:serviceRecommendationOptions:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe [ECSServiceRecommendationOption]
$sel:serviceArn:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe Text
$sel:lookbackPeriodInDays:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe Double
$sel:launchType:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe ECSServiceLaunchType
$sel:lastRefreshTimestamp:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe POSIX
$sel:findingReasonCodes:ECSServiceRecommendation' :: ECSServiceRecommendation
-> Maybe [ECSServiceRecommendationFindingReasonCode]
$sel:finding:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe ECSServiceRecommendationFinding
$sel:currentServiceConfiguration:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe ServiceConfiguration
$sel:currentPerformanceRisk:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe CurrentPerformanceRisk
$sel:accountId:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CurrentPerformanceRisk
currentPerformanceRisk
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ServiceConfiguration
currentServiceConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ECSServiceRecommendationFinding
finding
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ECSServiceRecommendationFindingReasonCode]
findingReasonCodes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastRefreshTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ECSServiceLaunchType
launchType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
lookbackPeriodInDays
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
serviceArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ECSServiceRecommendationOption]
serviceRecommendationOptions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ECSServiceUtilizationMetric]
utilizationMetrics

instance Prelude.NFData ECSServiceRecommendation where
  rnf :: ECSServiceRecommendation -> ()
rnf ECSServiceRecommendation' {Maybe Double
Maybe [ECSServiceRecommendationFindingReasonCode]
Maybe [ECSServiceUtilizationMetric]
Maybe [ECSServiceRecommendationOption]
Maybe Text
Maybe POSIX
Maybe CurrentPerformanceRisk
Maybe ECSServiceLaunchType
Maybe ECSServiceRecommendationFinding
Maybe ServiceConfiguration
utilizationMetrics :: Maybe [ECSServiceUtilizationMetric]
serviceRecommendationOptions :: Maybe [ECSServiceRecommendationOption]
serviceArn :: Maybe Text
lookbackPeriodInDays :: Maybe Double
launchType :: Maybe ECSServiceLaunchType
lastRefreshTimestamp :: Maybe POSIX
findingReasonCodes :: Maybe [ECSServiceRecommendationFindingReasonCode]
finding :: Maybe ECSServiceRecommendationFinding
currentServiceConfiguration :: Maybe ServiceConfiguration
currentPerformanceRisk :: Maybe CurrentPerformanceRisk
accountId :: Maybe Text
$sel:utilizationMetrics:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe [ECSServiceUtilizationMetric]
$sel:serviceRecommendationOptions:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe [ECSServiceRecommendationOption]
$sel:serviceArn:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe Text
$sel:lookbackPeriodInDays:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe Double
$sel:launchType:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe ECSServiceLaunchType
$sel:lastRefreshTimestamp:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe POSIX
$sel:findingReasonCodes:ECSServiceRecommendation' :: ECSServiceRecommendation
-> Maybe [ECSServiceRecommendationFindingReasonCode]
$sel:finding:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe ECSServiceRecommendationFinding
$sel:currentServiceConfiguration:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe ServiceConfiguration
$sel:currentPerformanceRisk:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe CurrentPerformanceRisk
$sel:accountId:ECSServiceRecommendation' :: ECSServiceRecommendation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CurrentPerformanceRisk
currentPerformanceRisk
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ServiceConfiguration
currentServiceConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ECSServiceRecommendationFinding
finding
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ECSServiceRecommendationFindingReasonCode]
findingReasonCodes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastRefreshTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ECSServiceLaunchType
launchType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
lookbackPeriodInDays
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
serviceArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ECSServiceRecommendationOption]
serviceRecommendationOptions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ECSServiceUtilizationMetric]
utilizationMetrics