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

import Amazonka.ComputeOptimizer.Types.ContainerRecommendation
import Amazonka.ComputeOptimizer.Types.ECSServiceProjectedUtilizationMetric
import Amazonka.ComputeOptimizer.Types.SavingsOpportunity
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 the recommendation options for an Amazon ECS service.
--
-- /See:/ 'newECSServiceRecommendationOption' smart constructor.
data ECSServiceRecommendationOption = ECSServiceRecommendationOption'
  { -- | The CPU and memory size recommendations for the containers within the
    -- task of your ECS service.
    ECSServiceRecommendationOption -> Maybe [ContainerRecommendation]
containerRecommendations :: Prelude.Maybe [ContainerRecommendation],
    -- | The CPU size of the ECS service recommendation option.
    ECSServiceRecommendationOption -> Maybe Int
cpu :: Prelude.Maybe Prelude.Int,
    -- | The memory size of the ECS service recommendation option.
    ECSServiceRecommendationOption -> Maybe Int
memory :: Prelude.Maybe Prelude.Int,
    -- | An array of objects that describe the projected utilization metrics of
    -- the ECS service recommendation option.
    ECSServiceRecommendationOption
-> Maybe [ECSServiceProjectedUtilizationMetric]
projectedUtilizationMetrics :: Prelude.Maybe [ECSServiceProjectedUtilizationMetric],
    ECSServiceRecommendationOption -> Maybe SavingsOpportunity
savingsOpportunity :: Prelude.Maybe SavingsOpportunity
  }
  deriving (ECSServiceRecommendationOption
-> ECSServiceRecommendationOption -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ECSServiceRecommendationOption
-> ECSServiceRecommendationOption -> Bool
$c/= :: ECSServiceRecommendationOption
-> ECSServiceRecommendationOption -> Bool
== :: ECSServiceRecommendationOption
-> ECSServiceRecommendationOption -> Bool
$c== :: ECSServiceRecommendationOption
-> ECSServiceRecommendationOption -> Bool
Prelude.Eq, ReadPrec [ECSServiceRecommendationOption]
ReadPrec ECSServiceRecommendationOption
Int -> ReadS ECSServiceRecommendationOption
ReadS [ECSServiceRecommendationOption]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ECSServiceRecommendationOption]
$creadListPrec :: ReadPrec [ECSServiceRecommendationOption]
readPrec :: ReadPrec ECSServiceRecommendationOption
$creadPrec :: ReadPrec ECSServiceRecommendationOption
readList :: ReadS [ECSServiceRecommendationOption]
$creadList :: ReadS [ECSServiceRecommendationOption]
readsPrec :: Int -> ReadS ECSServiceRecommendationOption
$creadsPrec :: Int -> ReadS ECSServiceRecommendationOption
Prelude.Read, Int -> ECSServiceRecommendationOption -> ShowS
[ECSServiceRecommendationOption] -> ShowS
ECSServiceRecommendationOption -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ECSServiceRecommendationOption] -> ShowS
$cshowList :: [ECSServiceRecommendationOption] -> ShowS
show :: ECSServiceRecommendationOption -> String
$cshow :: ECSServiceRecommendationOption -> String
showsPrec :: Int -> ECSServiceRecommendationOption -> ShowS
$cshowsPrec :: Int -> ECSServiceRecommendationOption -> ShowS
Prelude.Show, forall x.
Rep ECSServiceRecommendationOption x
-> ECSServiceRecommendationOption
forall x.
ECSServiceRecommendationOption
-> Rep ECSServiceRecommendationOption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ECSServiceRecommendationOption x
-> ECSServiceRecommendationOption
$cfrom :: forall x.
ECSServiceRecommendationOption
-> Rep ECSServiceRecommendationOption x
Prelude.Generic)

-- |
-- Create a value of 'ECSServiceRecommendationOption' 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:
--
-- 'containerRecommendations', 'eCSServiceRecommendationOption_containerRecommendations' - The CPU and memory size recommendations for the containers within the
-- task of your ECS service.
--
-- 'cpu', 'eCSServiceRecommendationOption_cpu' - The CPU size of the ECS service recommendation option.
--
-- 'memory', 'eCSServiceRecommendationOption_memory' - The memory size of the ECS service recommendation option.
--
-- 'projectedUtilizationMetrics', 'eCSServiceRecommendationOption_projectedUtilizationMetrics' - An array of objects that describe the projected utilization metrics of
-- the ECS service recommendation option.
--
-- 'savingsOpportunity', 'eCSServiceRecommendationOption_savingsOpportunity' - Undocumented member.
newECSServiceRecommendationOption ::
  ECSServiceRecommendationOption
newECSServiceRecommendationOption :: ECSServiceRecommendationOption
newECSServiceRecommendationOption =
  ECSServiceRecommendationOption'
    { $sel:containerRecommendations:ECSServiceRecommendationOption' :: Maybe [ContainerRecommendation]
containerRecommendations =
        forall a. Maybe a
Prelude.Nothing,
      $sel:cpu:ECSServiceRecommendationOption' :: Maybe Int
cpu = forall a. Maybe a
Prelude.Nothing,
      $sel:memory:ECSServiceRecommendationOption' :: Maybe Int
memory = forall a. Maybe a
Prelude.Nothing,
      $sel:projectedUtilizationMetrics:ECSServiceRecommendationOption' :: Maybe [ECSServiceProjectedUtilizationMetric]
projectedUtilizationMetrics =
        forall a. Maybe a
Prelude.Nothing,
      $sel:savingsOpportunity:ECSServiceRecommendationOption' :: Maybe SavingsOpportunity
savingsOpportunity = forall a. Maybe a
Prelude.Nothing
    }

-- | The CPU and memory size recommendations for the containers within the
-- task of your ECS service.
eCSServiceRecommendationOption_containerRecommendations :: Lens.Lens' ECSServiceRecommendationOption (Prelude.Maybe [ContainerRecommendation])
eCSServiceRecommendationOption_containerRecommendations :: Lens'
  ECSServiceRecommendationOption (Maybe [ContainerRecommendation])
eCSServiceRecommendationOption_containerRecommendations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ECSServiceRecommendationOption' {Maybe [ContainerRecommendation]
containerRecommendations :: Maybe [ContainerRecommendation]
$sel:containerRecommendations:ECSServiceRecommendationOption' :: ECSServiceRecommendationOption -> Maybe [ContainerRecommendation]
containerRecommendations} -> Maybe [ContainerRecommendation]
containerRecommendations) (\s :: ECSServiceRecommendationOption
s@ECSServiceRecommendationOption' {} Maybe [ContainerRecommendation]
a -> ECSServiceRecommendationOption
s {$sel:containerRecommendations:ECSServiceRecommendationOption' :: Maybe [ContainerRecommendation]
containerRecommendations = Maybe [ContainerRecommendation]
a} :: ECSServiceRecommendationOption) 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 CPU size of the ECS service recommendation option.
eCSServiceRecommendationOption_cpu :: Lens.Lens' ECSServiceRecommendationOption (Prelude.Maybe Prelude.Int)
eCSServiceRecommendationOption_cpu :: Lens' ECSServiceRecommendationOption (Maybe Int)
eCSServiceRecommendationOption_cpu = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ECSServiceRecommendationOption' {Maybe Int
cpu :: Maybe Int
$sel:cpu:ECSServiceRecommendationOption' :: ECSServiceRecommendationOption -> Maybe Int
cpu} -> Maybe Int
cpu) (\s :: ECSServiceRecommendationOption
s@ECSServiceRecommendationOption' {} Maybe Int
a -> ECSServiceRecommendationOption
s {$sel:cpu:ECSServiceRecommendationOption' :: Maybe Int
cpu = Maybe Int
a} :: ECSServiceRecommendationOption)

-- | The memory size of the ECS service recommendation option.
eCSServiceRecommendationOption_memory :: Lens.Lens' ECSServiceRecommendationOption (Prelude.Maybe Prelude.Int)
eCSServiceRecommendationOption_memory :: Lens' ECSServiceRecommendationOption (Maybe Int)
eCSServiceRecommendationOption_memory = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ECSServiceRecommendationOption' {Maybe Int
memory :: Maybe Int
$sel:memory:ECSServiceRecommendationOption' :: ECSServiceRecommendationOption -> Maybe Int
memory} -> Maybe Int
memory) (\s :: ECSServiceRecommendationOption
s@ECSServiceRecommendationOption' {} Maybe Int
a -> ECSServiceRecommendationOption
s {$sel:memory:ECSServiceRecommendationOption' :: Maybe Int
memory = Maybe Int
a} :: ECSServiceRecommendationOption)

-- | An array of objects that describe the projected utilization metrics of
-- the ECS service recommendation option.
eCSServiceRecommendationOption_projectedUtilizationMetrics :: Lens.Lens' ECSServiceRecommendationOption (Prelude.Maybe [ECSServiceProjectedUtilizationMetric])
eCSServiceRecommendationOption_projectedUtilizationMetrics :: Lens'
  ECSServiceRecommendationOption
  (Maybe [ECSServiceProjectedUtilizationMetric])
eCSServiceRecommendationOption_projectedUtilizationMetrics = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ECSServiceRecommendationOption' {Maybe [ECSServiceProjectedUtilizationMetric]
projectedUtilizationMetrics :: Maybe [ECSServiceProjectedUtilizationMetric]
$sel:projectedUtilizationMetrics:ECSServiceRecommendationOption' :: ECSServiceRecommendationOption
-> Maybe [ECSServiceProjectedUtilizationMetric]
projectedUtilizationMetrics} -> Maybe [ECSServiceProjectedUtilizationMetric]
projectedUtilizationMetrics) (\s :: ECSServiceRecommendationOption
s@ECSServiceRecommendationOption' {} Maybe [ECSServiceProjectedUtilizationMetric]
a -> ECSServiceRecommendationOption
s {$sel:projectedUtilizationMetrics:ECSServiceRecommendationOption' :: Maybe [ECSServiceProjectedUtilizationMetric]
projectedUtilizationMetrics = Maybe [ECSServiceProjectedUtilizationMetric]
a} :: ECSServiceRecommendationOption) 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

-- | Undocumented member.
eCSServiceRecommendationOption_savingsOpportunity :: Lens.Lens' ECSServiceRecommendationOption (Prelude.Maybe SavingsOpportunity)
eCSServiceRecommendationOption_savingsOpportunity :: Lens' ECSServiceRecommendationOption (Maybe SavingsOpportunity)
eCSServiceRecommendationOption_savingsOpportunity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ECSServiceRecommendationOption' {Maybe SavingsOpportunity
savingsOpportunity :: Maybe SavingsOpportunity
$sel:savingsOpportunity:ECSServiceRecommendationOption' :: ECSServiceRecommendationOption -> Maybe SavingsOpportunity
savingsOpportunity} -> Maybe SavingsOpportunity
savingsOpportunity) (\s :: ECSServiceRecommendationOption
s@ECSServiceRecommendationOption' {} Maybe SavingsOpportunity
a -> ECSServiceRecommendationOption
s {$sel:savingsOpportunity:ECSServiceRecommendationOption' :: Maybe SavingsOpportunity
savingsOpportunity = Maybe SavingsOpportunity
a} :: ECSServiceRecommendationOption)

instance Data.FromJSON ECSServiceRecommendationOption where
  parseJSON :: Value -> Parser ECSServiceRecommendationOption
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ECSServiceRecommendationOption"
      ( \Object
x ->
          Maybe [ContainerRecommendation]
-> Maybe Int
-> Maybe Int
-> Maybe [ECSServiceProjectedUtilizationMetric]
-> Maybe SavingsOpportunity
-> ECSServiceRecommendationOption
ECSServiceRecommendationOption'
            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
"containerRecommendations"
                            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
"cpu")
            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
"memory")
            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
"projectedUtilizationMetrics"
                            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
"savingsOpportunity")
      )

instance
  Prelude.Hashable
    ECSServiceRecommendationOption
  where
  hashWithSalt :: Int -> ECSServiceRecommendationOption -> Int
hashWithSalt
    Int
_salt
    ECSServiceRecommendationOption' {Maybe Int
Maybe [ECSServiceProjectedUtilizationMetric]
Maybe [ContainerRecommendation]
Maybe SavingsOpportunity
savingsOpportunity :: Maybe SavingsOpportunity
projectedUtilizationMetrics :: Maybe [ECSServiceProjectedUtilizationMetric]
memory :: Maybe Int
cpu :: Maybe Int
containerRecommendations :: Maybe [ContainerRecommendation]
$sel:savingsOpportunity:ECSServiceRecommendationOption' :: ECSServiceRecommendationOption -> Maybe SavingsOpportunity
$sel:projectedUtilizationMetrics:ECSServiceRecommendationOption' :: ECSServiceRecommendationOption
-> Maybe [ECSServiceProjectedUtilizationMetric]
$sel:memory:ECSServiceRecommendationOption' :: ECSServiceRecommendationOption -> Maybe Int
$sel:cpu:ECSServiceRecommendationOption' :: ECSServiceRecommendationOption -> Maybe Int
$sel:containerRecommendations:ECSServiceRecommendationOption' :: ECSServiceRecommendationOption -> Maybe [ContainerRecommendation]
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ContainerRecommendation]
containerRecommendations
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
cpu
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
memory
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ECSServiceProjectedUtilizationMetric]
projectedUtilizationMetrics
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SavingsOpportunity
savingsOpportunity

instance
  Prelude.NFData
    ECSServiceRecommendationOption
  where
  rnf :: ECSServiceRecommendationOption -> ()
rnf ECSServiceRecommendationOption' {Maybe Int
Maybe [ECSServiceProjectedUtilizationMetric]
Maybe [ContainerRecommendation]
Maybe SavingsOpportunity
savingsOpportunity :: Maybe SavingsOpportunity
projectedUtilizationMetrics :: Maybe [ECSServiceProjectedUtilizationMetric]
memory :: Maybe Int
cpu :: Maybe Int
containerRecommendations :: Maybe [ContainerRecommendation]
$sel:savingsOpportunity:ECSServiceRecommendationOption' :: ECSServiceRecommendationOption -> Maybe SavingsOpportunity
$sel:projectedUtilizationMetrics:ECSServiceRecommendationOption' :: ECSServiceRecommendationOption
-> Maybe [ECSServiceProjectedUtilizationMetric]
$sel:memory:ECSServiceRecommendationOption' :: ECSServiceRecommendationOption -> Maybe Int
$sel:cpu:ECSServiceRecommendationOption' :: ECSServiceRecommendationOption -> Maybe Int
$sel:containerRecommendations:ECSServiceRecommendationOption' :: ECSServiceRecommendationOption -> Maybe [ContainerRecommendation]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [ContainerRecommendation]
containerRecommendations
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
cpu
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
memory
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ECSServiceProjectedUtilizationMetric]
projectedUtilizationMetrics
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SavingsOpportunity
savingsOpportunity