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

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

-- | A ulimit to set in the container.
--
-- /See:/ 'newAwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails' smart constructor.
data AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails = AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails'
  { -- | The type of the ulimit.
    AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
-> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The hard limit for the ulimit type.
    AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails -> Maybe Int
hardLimit :: Prelude.Maybe Prelude.Int,
    -- | The soft limit for the ulimit type.
    AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails -> Maybe Int
softLimit :: Prelude.Maybe Prelude.Int
  }
  deriving (AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
-> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails -> Bool
(AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
 -> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails -> Bool)
-> (AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
    -> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails -> Bool)
-> Eq AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
-> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails -> Bool
$c/= :: AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
-> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails -> Bool
== :: AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
-> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails -> Bool
$c== :: AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
-> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails -> Bool
Prelude.Eq, ReadPrec [AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails]
ReadPrec AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
Int -> ReadS AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
ReadS [AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails]
(Int
 -> ReadS AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails)
-> ReadS [AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails]
-> ReadPrec AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
-> ReadPrec
     [AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails]
-> Read AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails]
$creadListPrec :: ReadPrec [AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails]
readPrec :: ReadPrec AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
$creadPrec :: ReadPrec AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
readList :: ReadS [AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails]
$creadList :: ReadS [AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails]
readsPrec :: Int -> ReadS AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
$creadsPrec :: Int -> ReadS AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
Prelude.Read, Int
-> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails -> ShowS
[AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails] -> ShowS
AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails -> String
(Int
 -> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails -> ShowS)
-> (AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
    -> String)
-> ([AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails]
    -> ShowS)
-> Show AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails] -> ShowS
$cshowList :: [AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails] -> ShowS
show :: AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails -> String
$cshow :: AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails -> String
showsPrec :: Int
-> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails -> ShowS
$cshowsPrec :: Int
-> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails -> ShowS
Prelude.Show, (forall x.
 AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
 -> Rep AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails x)
-> (forall x.
    Rep AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails x
    -> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails)
-> Generic AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
forall x.
Rep AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails x
-> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
forall x.
AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
-> Rep AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails x
-> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
$cfrom :: forall x.
AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
-> Rep AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails' 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:
--
-- 'name', 'awsEcsTaskDefinitionContainerDefinitionsUlimitsDetails_name' - The type of the ulimit.
--
-- 'hardLimit', 'awsEcsTaskDefinitionContainerDefinitionsUlimitsDetails_hardLimit' - The hard limit for the ulimit type.
--
-- 'softLimit', 'awsEcsTaskDefinitionContainerDefinitionsUlimitsDetails_softLimit' - The soft limit for the ulimit type.
newAwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails ::
  AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
newAwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails :: AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
newAwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails =
  AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails' :: Maybe Text
-> Maybe Int
-> Maybe Int
-> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails'
    { $sel:name:AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails' :: Maybe Text
name =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:hardLimit:AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails' :: Maybe Int
hardLimit =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:softLimit:AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails' :: Maybe Int
softLimit =
        Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The type of the ulimit.
awsEcsTaskDefinitionContainerDefinitionsUlimitsDetails_name :: Lens.Lens' AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails (Prelude.Maybe Prelude.Text)
awsEcsTaskDefinitionContainerDefinitionsUlimitsDetails_name :: (Maybe Text -> f (Maybe Text))
-> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
-> f AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
awsEcsTaskDefinitionContainerDefinitionsUlimitsDetails_name = (AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
 -> Maybe Text)
-> (AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
    -> Maybe Text
    -> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails)
-> Lens
     AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
     AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails' {Maybe Text
name :: Maybe Text
$sel:name:AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails' :: AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
-> Maybe Text
name} -> Maybe Text
name) (\s :: AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
s@AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails' {} Maybe Text
a -> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
s {$sel:name:AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails' :: Maybe Text
name = Maybe Text
a} :: AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails)

-- | The hard limit for the ulimit type.
awsEcsTaskDefinitionContainerDefinitionsUlimitsDetails_hardLimit :: Lens.Lens' AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails (Prelude.Maybe Prelude.Int)
awsEcsTaskDefinitionContainerDefinitionsUlimitsDetails_hardLimit :: (Maybe Int -> f (Maybe Int))
-> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
-> f AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
awsEcsTaskDefinitionContainerDefinitionsUlimitsDetails_hardLimit = (AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
 -> Maybe Int)
-> (AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
    -> Maybe Int
    -> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails)
-> Lens
     AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
     AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails' {Maybe Int
hardLimit :: Maybe Int
$sel:hardLimit:AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails' :: AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails -> Maybe Int
hardLimit} -> Maybe Int
hardLimit) (\s :: AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
s@AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails' {} Maybe Int
a -> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
s {$sel:hardLimit:AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails' :: Maybe Int
hardLimit = Maybe Int
a} :: AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails)

-- | The soft limit for the ulimit type.
awsEcsTaskDefinitionContainerDefinitionsUlimitsDetails_softLimit :: Lens.Lens' AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails (Prelude.Maybe Prelude.Int)
awsEcsTaskDefinitionContainerDefinitionsUlimitsDetails_softLimit :: (Maybe Int -> f (Maybe Int))
-> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
-> f AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
awsEcsTaskDefinitionContainerDefinitionsUlimitsDetails_softLimit = (AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
 -> Maybe Int)
-> (AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
    -> Maybe Int
    -> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails)
-> Lens
     AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
     AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails' {Maybe Int
softLimit :: Maybe Int
$sel:softLimit:AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails' :: AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails -> Maybe Int
softLimit} -> Maybe Int
softLimit) (\s :: AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
s@AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails' {} Maybe Int
a -> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
s {$sel:softLimit:AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails' :: Maybe Int
softLimit = Maybe Int
a} :: AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails)

instance
  Core.FromJSON
    AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
  where
  parseJSON :: Value
-> Parser AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
parseJSON =
    String
-> (Object
    -> Parser AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails)
-> Value
-> Parser AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails"
      ( \Object
x ->
          Maybe Text
-> Maybe Int
-> Maybe Int
-> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails'
            (Maybe Text
 -> Maybe Int
 -> Maybe Int
 -> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Int
      -> Maybe Int
      -> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails)
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
"Name")
              Parser
  (Maybe Int
   -> Maybe Int
   -> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"HardLimit")
              Parser
  (Maybe Int
   -> AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails)
-> Parser (Maybe Int)
-> Parser AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SoftLimit")
      )

instance
  Prelude.Hashable
    AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails

instance
  Prelude.NFData
    AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails

instance
  Core.ToJSON
    AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
  where
  toJSON :: AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails -> Value
toJSON
    AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails' {Maybe Int
Maybe Text
softLimit :: Maybe Int
hardLimit :: Maybe Int
name :: Maybe Text
$sel:softLimit:AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails' :: AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails -> Maybe Int
$sel:hardLimit:AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails' :: AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails -> Maybe Int
$sel:name:AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails' :: AwsEcsTaskDefinitionContainerDefinitionsUlimitsDetails
-> Maybe Text
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ (Text
"Name" 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
name,
              (Text
"HardLimit" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
hardLimit,
              (Text
"SoftLimit" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
softLimit
            ]
        )