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

import Amazonka.ComputeOptimizer.Types.MemorySizeConfiguration
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

-- | The CPU and memory recommendations for a container within the tasks of
-- your Amazon ECS service.
--
-- /See:/ 'newContainerRecommendation' smart constructor.
data ContainerRecommendation = ContainerRecommendation'
  { -- | The name of the container.
    ContainerRecommendation -> Maybe Text
containerName :: Prelude.Maybe Prelude.Text,
    -- | The recommended number of CPU units reserved for the container.
    ContainerRecommendation -> Maybe Int
cpu :: Prelude.Maybe Prelude.Int,
    -- | The recommended memory size configurations for the container.
    ContainerRecommendation -> Maybe MemorySizeConfiguration
memorySizeConfiguration :: Prelude.Maybe MemorySizeConfiguration
  }
  deriving (ContainerRecommendation -> ContainerRecommendation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContainerRecommendation -> ContainerRecommendation -> Bool
$c/= :: ContainerRecommendation -> ContainerRecommendation -> Bool
== :: ContainerRecommendation -> ContainerRecommendation -> Bool
$c== :: ContainerRecommendation -> ContainerRecommendation -> Bool
Prelude.Eq, ReadPrec [ContainerRecommendation]
ReadPrec ContainerRecommendation
Int -> ReadS ContainerRecommendation
ReadS [ContainerRecommendation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContainerRecommendation]
$creadListPrec :: ReadPrec [ContainerRecommendation]
readPrec :: ReadPrec ContainerRecommendation
$creadPrec :: ReadPrec ContainerRecommendation
readList :: ReadS [ContainerRecommendation]
$creadList :: ReadS [ContainerRecommendation]
readsPrec :: Int -> ReadS ContainerRecommendation
$creadsPrec :: Int -> ReadS ContainerRecommendation
Prelude.Read, Int -> ContainerRecommendation -> ShowS
[ContainerRecommendation] -> ShowS
ContainerRecommendation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContainerRecommendation] -> ShowS
$cshowList :: [ContainerRecommendation] -> ShowS
show :: ContainerRecommendation -> String
$cshow :: ContainerRecommendation -> String
showsPrec :: Int -> ContainerRecommendation -> ShowS
$cshowsPrec :: Int -> ContainerRecommendation -> ShowS
Prelude.Show, forall x. Rep ContainerRecommendation x -> ContainerRecommendation
forall x. ContainerRecommendation -> Rep ContainerRecommendation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ContainerRecommendation x -> ContainerRecommendation
$cfrom :: forall x. ContainerRecommendation -> Rep ContainerRecommendation x
Prelude.Generic)

-- |
-- Create a value of 'ContainerRecommendation' 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:
--
-- 'containerName', 'containerRecommendation_containerName' - The name of the container.
--
-- 'cpu', 'containerRecommendation_cpu' - The recommended number of CPU units reserved for the container.
--
-- 'memorySizeConfiguration', 'containerRecommendation_memorySizeConfiguration' - The recommended memory size configurations for the container.
newContainerRecommendation ::
  ContainerRecommendation
newContainerRecommendation :: ContainerRecommendation
newContainerRecommendation =
  ContainerRecommendation'
    { $sel:containerName:ContainerRecommendation' :: Maybe Text
containerName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:cpu:ContainerRecommendation' :: Maybe Int
cpu = forall a. Maybe a
Prelude.Nothing,
      $sel:memorySizeConfiguration:ContainerRecommendation' :: Maybe MemorySizeConfiguration
memorySizeConfiguration = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the container.
containerRecommendation_containerName :: Lens.Lens' ContainerRecommendation (Prelude.Maybe Prelude.Text)
containerRecommendation_containerName :: Lens' ContainerRecommendation (Maybe Text)
containerRecommendation_containerName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerRecommendation' {Maybe Text
containerName :: Maybe Text
$sel:containerName:ContainerRecommendation' :: ContainerRecommendation -> Maybe Text
containerName} -> Maybe Text
containerName) (\s :: ContainerRecommendation
s@ContainerRecommendation' {} Maybe Text
a -> ContainerRecommendation
s {$sel:containerName:ContainerRecommendation' :: Maybe Text
containerName = Maybe Text
a} :: ContainerRecommendation)

-- | The recommended number of CPU units reserved for the container.
containerRecommendation_cpu :: Lens.Lens' ContainerRecommendation (Prelude.Maybe Prelude.Int)
containerRecommendation_cpu :: Lens' ContainerRecommendation (Maybe Int)
containerRecommendation_cpu = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerRecommendation' {Maybe Int
cpu :: Maybe Int
$sel:cpu:ContainerRecommendation' :: ContainerRecommendation -> Maybe Int
cpu} -> Maybe Int
cpu) (\s :: ContainerRecommendation
s@ContainerRecommendation' {} Maybe Int
a -> ContainerRecommendation
s {$sel:cpu:ContainerRecommendation' :: Maybe Int
cpu = Maybe Int
a} :: ContainerRecommendation)

-- | The recommended memory size configurations for the container.
containerRecommendation_memorySizeConfiguration :: Lens.Lens' ContainerRecommendation (Prelude.Maybe MemorySizeConfiguration)
containerRecommendation_memorySizeConfiguration :: Lens' ContainerRecommendation (Maybe MemorySizeConfiguration)
containerRecommendation_memorySizeConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerRecommendation' {Maybe MemorySizeConfiguration
memorySizeConfiguration :: Maybe MemorySizeConfiguration
$sel:memorySizeConfiguration:ContainerRecommendation' :: ContainerRecommendation -> Maybe MemorySizeConfiguration
memorySizeConfiguration} -> Maybe MemorySizeConfiguration
memorySizeConfiguration) (\s :: ContainerRecommendation
s@ContainerRecommendation' {} Maybe MemorySizeConfiguration
a -> ContainerRecommendation
s {$sel:memorySizeConfiguration:ContainerRecommendation' :: Maybe MemorySizeConfiguration
memorySizeConfiguration = Maybe MemorySizeConfiguration
a} :: ContainerRecommendation)

instance Data.FromJSON ContainerRecommendation where
  parseJSON :: Value -> Parser ContainerRecommendation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ContainerRecommendation"
      ( \Object
x ->
          Maybe Text
-> Maybe Int
-> Maybe MemorySizeConfiguration
-> ContainerRecommendation
ContainerRecommendation'
            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
"containerName")
            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
"memorySizeConfiguration")
      )

instance Prelude.Hashable ContainerRecommendation where
  hashWithSalt :: Int -> ContainerRecommendation -> Int
hashWithSalt Int
_salt ContainerRecommendation' {Maybe Int
Maybe Text
Maybe MemorySizeConfiguration
memorySizeConfiguration :: Maybe MemorySizeConfiguration
cpu :: Maybe Int
containerName :: Maybe Text
$sel:memorySizeConfiguration:ContainerRecommendation' :: ContainerRecommendation -> Maybe MemorySizeConfiguration
$sel:cpu:ContainerRecommendation' :: ContainerRecommendation -> Maybe Int
$sel:containerName:ContainerRecommendation' :: ContainerRecommendation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
containerName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
cpu
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MemorySizeConfiguration
memorySizeConfiguration

instance Prelude.NFData ContainerRecommendation where
  rnf :: ContainerRecommendation -> ()
rnf ContainerRecommendation' {Maybe Int
Maybe Text
Maybe MemorySizeConfiguration
memorySizeConfiguration :: Maybe MemorySizeConfiguration
cpu :: Maybe Int
containerName :: Maybe Text
$sel:memorySizeConfiguration:ContainerRecommendation' :: ContainerRecommendation -> Maybe MemorySizeConfiguration
$sel:cpu:ContainerRecommendation' :: ContainerRecommendation -> Maybe Int
$sel:containerName:ContainerRecommendation' :: ContainerRecommendation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
containerName
      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 MemorySizeConfiguration
memorySizeConfiguration