{-# 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.SecurityHub.Types.AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SecurityHub.Types.AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A resource to assign to a container.
--
-- /See:/ 'newAwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails' smart constructor.
data AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails = AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails'
  { -- | The value for the specified resource type.
    --
    -- For @GPU@, the value is the number of physical GPUs the Amazon ECS
    -- container agent reserves for the container.
    --
    -- For @InferenceAccelerator@, the value should match the @DeviceName@
    -- attribute of an entry in @InferenceAccelerators@.
    AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> Maybe Text
value :: Prelude.Maybe Prelude.Text,
    -- | The type of resource to assign to a container.
    AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> Maybe Text
type' :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> Bool
(AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
 -> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
 -> Bool)
-> (AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
    -> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
    -> Bool)
-> Eq
     AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> Bool
$c/= :: AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> Bool
== :: AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> Bool
$c== :: AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> Bool
Prelude.Eq, ReadPrec
  [AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails]
ReadPrec
  AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
Int
-> ReadS
     AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
ReadS
  [AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails]
(Int
 -> ReadS
      AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails)
-> ReadS
     [AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails]
-> ReadPrec
     AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> ReadPrec
     [AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails]
-> Read
     AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec
  [AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails]
$creadListPrec :: ReadPrec
  [AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails]
readPrec :: ReadPrec
  AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
$creadPrec :: ReadPrec
  AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
readList :: ReadS
  [AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails]
$creadList :: ReadS
  [AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails]
readsPrec :: Int
-> ReadS
     AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
$creadsPrec :: Int
-> ReadS
     AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
Prelude.Read, Int
-> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> ShowS
[AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails]
-> ShowS
AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> String
(Int
 -> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
 -> ShowS)
-> (AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
    -> String)
-> ([AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails]
    -> ShowS)
-> Show
     AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails]
-> ShowS
$cshowList :: [AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails]
-> ShowS
show :: AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> String
$cshow :: AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> String
showsPrec :: Int
-> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> ShowS
$cshowsPrec :: Int
-> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> ShowS
Prelude.Show, (forall x.
 AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
 -> Rep
      AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
      x)
-> (forall x.
    Rep
      AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
      x
    -> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails)
-> Generic
     AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
forall x.
Rep
  AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
  x
-> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
forall x.
AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> Rep
     AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
     x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep
  AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
  x
-> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
$cfrom :: forall x.
AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> Rep
     AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
     x
Prelude.Generic)

-- |
-- Create a value of 'AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails' 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:
--
-- 'value', 'awsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails_value' - The value for the specified resource type.
--
-- For @GPU@, the value is the number of physical GPUs the Amazon ECS
-- container agent reserves for the container.
--
-- For @InferenceAccelerator@, the value should match the @DeviceName@
-- attribute of an entry in @InferenceAccelerators@.
--
-- 'type'', 'awsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails_type' - The type of resource to assign to a container.
newAwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails ::
  AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
newAwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails :: AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
newAwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails =
  AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails' :: Maybe Text
-> Maybe Text
-> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails'
    { $sel:value:AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails' :: Maybe Text
value =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails' :: Maybe Text
type' =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The value for the specified resource type.
--
-- For @GPU@, the value is the number of physical GPUs the Amazon ECS
-- container agent reserves for the container.
--
-- For @InferenceAccelerator@, the value should match the @DeviceName@
-- attribute of an entry in @InferenceAccelerators@.
awsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails_value :: Lens.Lens' AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails (Prelude.Maybe Prelude.Text)
awsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails_value :: (Maybe Text -> f (Maybe Text))
-> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> f AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
awsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails_value = (AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
 -> Maybe Text)
-> (AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
    -> Maybe Text
    -> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails)
-> Lens
     AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
     AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails' {Maybe Text
value :: Maybe Text
$sel:value:AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails' :: AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> Maybe Text
value} -> Maybe Text
value) (\s :: AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
s@AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails' {} Maybe Text
a -> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
s {$sel:value:AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails' :: Maybe Text
value = Maybe Text
a} :: AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails)

-- | The type of resource to assign to a container.
awsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails_type :: Lens.Lens' AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails (Prelude.Maybe Prelude.Text)
awsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails_type :: (Maybe Text -> f (Maybe Text))
-> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> f AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
awsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails_type = (AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
 -> Maybe Text)
-> (AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
    -> Maybe Text
    -> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails)
-> Lens
     AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
     AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails' {Maybe Text
type' :: Maybe Text
$sel:type':AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails' :: AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> Maybe Text
type'} -> Maybe Text
type') (\s :: AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
s@AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails' {} Maybe Text
a -> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
s {$sel:type':AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails' :: Maybe Text
type' = Maybe Text
a} :: AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails)

instance
  Core.FromJSON
    AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
  where
  parseJSON :: Value
-> Parser
     AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
parseJSON =
    String
-> (Object
    -> Parser
         AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails)
-> Value
-> Parser
     AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails'
            (Maybe Text
 -> Maybe Text
 -> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Value") Parser
  (Maybe Text
   -> AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails)
-> Parser (Maybe Text)
-> Parser
     AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
      )

instance
  Prelude.Hashable
    AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails

instance
  Prelude.NFData
    AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails

instance
  Core.ToJSON
    AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
  where
  toJSON :: AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> Value
toJSON
    AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails' {Maybe Text
type' :: Maybe Text
value :: Maybe Text
$sel:type':AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails' :: AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> Maybe Text
$sel:value:AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails' :: AwsEcsTaskDefinitionContainerDefinitionsResourceRequirementsDetails
-> Maybe Text
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ (Text
"Value" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
value,
              (Text
"Type" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
type'
            ]
        )