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

import Amazonka.ComputeOptimizer.Types.ECSServiceProjectedMetric
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 projected metrics of an Amazon ECS service recommendation
-- option.
--
-- To determine the performance difference between your current ECS service
-- and the recommended option, compare the metric data of your service
-- against its projected metric data.
--
-- /See:/ 'newECSServiceRecommendedOptionProjectedMetric' smart constructor.
data ECSServiceRecommendedOptionProjectedMetric = ECSServiceRecommendedOptionProjectedMetric'
  { -- | An array of objects that describe the projected metric.
    ECSServiceRecommendedOptionProjectedMetric
-> Maybe [ECSServiceProjectedMetric]
projectedMetrics :: Prelude.Maybe [ECSServiceProjectedMetric],
    -- | The recommended CPU size for the ECS service.
    ECSServiceRecommendedOptionProjectedMetric -> Maybe Int
recommendedCpuUnits :: Prelude.Maybe Prelude.Int,
    -- | The recommended memory size for the ECS service.
    ECSServiceRecommendedOptionProjectedMetric -> Maybe Int
recommendedMemorySize :: Prelude.Maybe Prelude.Int
  }
  deriving (ECSServiceRecommendedOptionProjectedMetric
-> ECSServiceRecommendedOptionProjectedMetric -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ECSServiceRecommendedOptionProjectedMetric
-> ECSServiceRecommendedOptionProjectedMetric -> Bool
$c/= :: ECSServiceRecommendedOptionProjectedMetric
-> ECSServiceRecommendedOptionProjectedMetric -> Bool
== :: ECSServiceRecommendedOptionProjectedMetric
-> ECSServiceRecommendedOptionProjectedMetric -> Bool
$c== :: ECSServiceRecommendedOptionProjectedMetric
-> ECSServiceRecommendedOptionProjectedMetric -> Bool
Prelude.Eq, ReadPrec [ECSServiceRecommendedOptionProjectedMetric]
ReadPrec ECSServiceRecommendedOptionProjectedMetric
Int -> ReadS ECSServiceRecommendedOptionProjectedMetric
ReadS [ECSServiceRecommendedOptionProjectedMetric]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ECSServiceRecommendedOptionProjectedMetric]
$creadListPrec :: ReadPrec [ECSServiceRecommendedOptionProjectedMetric]
readPrec :: ReadPrec ECSServiceRecommendedOptionProjectedMetric
$creadPrec :: ReadPrec ECSServiceRecommendedOptionProjectedMetric
readList :: ReadS [ECSServiceRecommendedOptionProjectedMetric]
$creadList :: ReadS [ECSServiceRecommendedOptionProjectedMetric]
readsPrec :: Int -> ReadS ECSServiceRecommendedOptionProjectedMetric
$creadsPrec :: Int -> ReadS ECSServiceRecommendedOptionProjectedMetric
Prelude.Read, Int -> ECSServiceRecommendedOptionProjectedMetric -> ShowS
[ECSServiceRecommendedOptionProjectedMetric] -> ShowS
ECSServiceRecommendedOptionProjectedMetric -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ECSServiceRecommendedOptionProjectedMetric] -> ShowS
$cshowList :: [ECSServiceRecommendedOptionProjectedMetric] -> ShowS
show :: ECSServiceRecommendedOptionProjectedMetric -> String
$cshow :: ECSServiceRecommendedOptionProjectedMetric -> String
showsPrec :: Int -> ECSServiceRecommendedOptionProjectedMetric -> ShowS
$cshowsPrec :: Int -> ECSServiceRecommendedOptionProjectedMetric -> ShowS
Prelude.Show, forall x.
Rep ECSServiceRecommendedOptionProjectedMetric x
-> ECSServiceRecommendedOptionProjectedMetric
forall x.
ECSServiceRecommendedOptionProjectedMetric
-> Rep ECSServiceRecommendedOptionProjectedMetric x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ECSServiceRecommendedOptionProjectedMetric x
-> ECSServiceRecommendedOptionProjectedMetric
$cfrom :: forall x.
ECSServiceRecommendedOptionProjectedMetric
-> Rep ECSServiceRecommendedOptionProjectedMetric x
Prelude.Generic)

-- |
-- Create a value of 'ECSServiceRecommendedOptionProjectedMetric' 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:
--
-- 'projectedMetrics', 'eCSServiceRecommendedOptionProjectedMetric_projectedMetrics' - An array of objects that describe the projected metric.
--
-- 'recommendedCpuUnits', 'eCSServiceRecommendedOptionProjectedMetric_recommendedCpuUnits' - The recommended CPU size for the ECS service.
--
-- 'recommendedMemorySize', 'eCSServiceRecommendedOptionProjectedMetric_recommendedMemorySize' - The recommended memory size for the ECS service.
newECSServiceRecommendedOptionProjectedMetric ::
  ECSServiceRecommendedOptionProjectedMetric
newECSServiceRecommendedOptionProjectedMetric :: ECSServiceRecommendedOptionProjectedMetric
newECSServiceRecommendedOptionProjectedMetric =
  ECSServiceRecommendedOptionProjectedMetric'
    { $sel:projectedMetrics:ECSServiceRecommendedOptionProjectedMetric' :: Maybe [ECSServiceProjectedMetric]
projectedMetrics =
        forall a. Maybe a
Prelude.Nothing,
      $sel:recommendedCpuUnits:ECSServiceRecommendedOptionProjectedMetric' :: Maybe Int
recommendedCpuUnits =
        forall a. Maybe a
Prelude.Nothing,
      $sel:recommendedMemorySize:ECSServiceRecommendedOptionProjectedMetric' :: Maybe Int
recommendedMemorySize =
        forall a. Maybe a
Prelude.Nothing
    }

-- | An array of objects that describe the projected metric.
eCSServiceRecommendedOptionProjectedMetric_projectedMetrics :: Lens.Lens' ECSServiceRecommendedOptionProjectedMetric (Prelude.Maybe [ECSServiceProjectedMetric])
eCSServiceRecommendedOptionProjectedMetric_projectedMetrics :: Lens'
  ECSServiceRecommendedOptionProjectedMetric
  (Maybe [ECSServiceProjectedMetric])
eCSServiceRecommendedOptionProjectedMetric_projectedMetrics = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ECSServiceRecommendedOptionProjectedMetric' {Maybe [ECSServiceProjectedMetric]
projectedMetrics :: Maybe [ECSServiceProjectedMetric]
$sel:projectedMetrics:ECSServiceRecommendedOptionProjectedMetric' :: ECSServiceRecommendedOptionProjectedMetric
-> Maybe [ECSServiceProjectedMetric]
projectedMetrics} -> Maybe [ECSServiceProjectedMetric]
projectedMetrics) (\s :: ECSServiceRecommendedOptionProjectedMetric
s@ECSServiceRecommendedOptionProjectedMetric' {} Maybe [ECSServiceProjectedMetric]
a -> ECSServiceRecommendedOptionProjectedMetric
s {$sel:projectedMetrics:ECSServiceRecommendedOptionProjectedMetric' :: Maybe [ECSServiceProjectedMetric]
projectedMetrics = Maybe [ECSServiceProjectedMetric]
a} :: ECSServiceRecommendedOptionProjectedMetric) 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 recommended CPU size for the ECS service.
eCSServiceRecommendedOptionProjectedMetric_recommendedCpuUnits :: Lens.Lens' ECSServiceRecommendedOptionProjectedMetric (Prelude.Maybe Prelude.Int)
eCSServiceRecommendedOptionProjectedMetric_recommendedCpuUnits :: Lens' ECSServiceRecommendedOptionProjectedMetric (Maybe Int)
eCSServiceRecommendedOptionProjectedMetric_recommendedCpuUnits = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ECSServiceRecommendedOptionProjectedMetric' {Maybe Int
recommendedCpuUnits :: Maybe Int
$sel:recommendedCpuUnits:ECSServiceRecommendedOptionProjectedMetric' :: ECSServiceRecommendedOptionProjectedMetric -> Maybe Int
recommendedCpuUnits} -> Maybe Int
recommendedCpuUnits) (\s :: ECSServiceRecommendedOptionProjectedMetric
s@ECSServiceRecommendedOptionProjectedMetric' {} Maybe Int
a -> ECSServiceRecommendedOptionProjectedMetric
s {$sel:recommendedCpuUnits:ECSServiceRecommendedOptionProjectedMetric' :: Maybe Int
recommendedCpuUnits = Maybe Int
a} :: ECSServiceRecommendedOptionProjectedMetric)

-- | The recommended memory size for the ECS service.
eCSServiceRecommendedOptionProjectedMetric_recommendedMemorySize :: Lens.Lens' ECSServiceRecommendedOptionProjectedMetric (Prelude.Maybe Prelude.Int)
eCSServiceRecommendedOptionProjectedMetric_recommendedMemorySize :: Lens' ECSServiceRecommendedOptionProjectedMetric (Maybe Int)
eCSServiceRecommendedOptionProjectedMetric_recommendedMemorySize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ECSServiceRecommendedOptionProjectedMetric' {Maybe Int
recommendedMemorySize :: Maybe Int
$sel:recommendedMemorySize:ECSServiceRecommendedOptionProjectedMetric' :: ECSServiceRecommendedOptionProjectedMetric -> Maybe Int
recommendedMemorySize} -> Maybe Int
recommendedMemorySize) (\s :: ECSServiceRecommendedOptionProjectedMetric
s@ECSServiceRecommendedOptionProjectedMetric' {} Maybe Int
a -> ECSServiceRecommendedOptionProjectedMetric
s {$sel:recommendedMemorySize:ECSServiceRecommendedOptionProjectedMetric' :: Maybe Int
recommendedMemorySize = Maybe Int
a} :: ECSServiceRecommendedOptionProjectedMetric)

instance
  Data.FromJSON
    ECSServiceRecommendedOptionProjectedMetric
  where
  parseJSON :: Value -> Parser ECSServiceRecommendedOptionProjectedMetric
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ECSServiceRecommendedOptionProjectedMetric"
      ( \Object
x ->
          Maybe [ECSServiceProjectedMetric]
-> Maybe Int
-> Maybe Int
-> ECSServiceRecommendedOptionProjectedMetric
ECSServiceRecommendedOptionProjectedMetric'
            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
"projectedMetrics"
                            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
"recommendedCpuUnits")
            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
"recommendedMemorySize")
      )

instance
  Prelude.Hashable
    ECSServiceRecommendedOptionProjectedMetric
  where
  hashWithSalt :: Int -> ECSServiceRecommendedOptionProjectedMetric -> Int
hashWithSalt
    Int
_salt
    ECSServiceRecommendedOptionProjectedMetric' {Maybe Int
Maybe [ECSServiceProjectedMetric]
recommendedMemorySize :: Maybe Int
recommendedCpuUnits :: Maybe Int
projectedMetrics :: Maybe [ECSServiceProjectedMetric]
$sel:recommendedMemorySize:ECSServiceRecommendedOptionProjectedMetric' :: ECSServiceRecommendedOptionProjectedMetric -> Maybe Int
$sel:recommendedCpuUnits:ECSServiceRecommendedOptionProjectedMetric' :: ECSServiceRecommendedOptionProjectedMetric -> Maybe Int
$sel:projectedMetrics:ECSServiceRecommendedOptionProjectedMetric' :: ECSServiceRecommendedOptionProjectedMetric
-> Maybe [ECSServiceProjectedMetric]
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ECSServiceProjectedMetric]
projectedMetrics
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
recommendedCpuUnits
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
recommendedMemorySize

instance
  Prelude.NFData
    ECSServiceRecommendedOptionProjectedMetric
  where
  rnf :: ECSServiceRecommendedOptionProjectedMetric -> ()
rnf ECSServiceRecommendedOptionProjectedMetric' {Maybe Int
Maybe [ECSServiceProjectedMetric]
recommendedMemorySize :: Maybe Int
recommendedCpuUnits :: Maybe Int
projectedMetrics :: Maybe [ECSServiceProjectedMetric]
$sel:recommendedMemorySize:ECSServiceRecommendedOptionProjectedMetric' :: ECSServiceRecommendedOptionProjectedMetric -> Maybe Int
$sel:recommendedCpuUnits:ECSServiceRecommendedOptionProjectedMetric' :: ECSServiceRecommendedOptionProjectedMetric -> Maybe Int
$sel:projectedMetrics:ECSServiceRecommendedOptionProjectedMetric' :: ECSServiceRecommendedOptionProjectedMetric
-> Maybe [ECSServiceProjectedMetric]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [ECSServiceProjectedMetric]
projectedMetrics
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
recommendedCpuUnits
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
recommendedMemorySize