{-# 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 #-}
module Amazonka.ECS.Types.Ulimit where
import qualified Amazonka.Core as Core
import Amazonka.ECS.Types.UlimitName
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Ulimit = Ulimit'
{
Ulimit -> UlimitName
name :: UlimitName,
Ulimit -> Int
softLimit :: Prelude.Int,
Ulimit -> Int
hardLimit :: Prelude.Int
}
deriving (Ulimit -> Ulimit -> Bool
(Ulimit -> Ulimit -> Bool)
-> (Ulimit -> Ulimit -> Bool) -> Eq Ulimit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Ulimit -> Ulimit -> Bool
$c/= :: Ulimit -> Ulimit -> Bool
== :: Ulimit -> Ulimit -> Bool
$c== :: Ulimit -> Ulimit -> Bool
Prelude.Eq, ReadPrec [Ulimit]
ReadPrec Ulimit
Int -> ReadS Ulimit
ReadS [Ulimit]
(Int -> ReadS Ulimit)
-> ReadS [Ulimit]
-> ReadPrec Ulimit
-> ReadPrec [Ulimit]
-> Read Ulimit
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Ulimit]
$creadListPrec :: ReadPrec [Ulimit]
readPrec :: ReadPrec Ulimit
$creadPrec :: ReadPrec Ulimit
readList :: ReadS [Ulimit]
$creadList :: ReadS [Ulimit]
readsPrec :: Int -> ReadS Ulimit
$creadsPrec :: Int -> ReadS Ulimit
Prelude.Read, Int -> Ulimit -> ShowS
[Ulimit] -> ShowS
Ulimit -> String
(Int -> Ulimit -> ShowS)
-> (Ulimit -> String) -> ([Ulimit] -> ShowS) -> Show Ulimit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Ulimit] -> ShowS
$cshowList :: [Ulimit] -> ShowS
show :: Ulimit -> String
$cshow :: Ulimit -> String
showsPrec :: Int -> Ulimit -> ShowS
$cshowsPrec :: Int -> Ulimit -> ShowS
Prelude.Show, (forall x. Ulimit -> Rep Ulimit x)
-> (forall x. Rep Ulimit x -> Ulimit) -> Generic Ulimit
forall x. Rep Ulimit x -> Ulimit
forall x. Ulimit -> Rep Ulimit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Ulimit x -> Ulimit
$cfrom :: forall x. Ulimit -> Rep Ulimit x
Prelude.Generic)
newUlimit ::
UlimitName ->
Prelude.Int ->
Prelude.Int ->
Ulimit
newUlimit :: UlimitName -> Int -> Int -> Ulimit
newUlimit UlimitName
pName_ Int
pSoftLimit_ Int
pHardLimit_ =
Ulimit' :: UlimitName -> Int -> Int -> Ulimit
Ulimit'
{ $sel:name:Ulimit' :: UlimitName
name = UlimitName
pName_,
$sel:softLimit:Ulimit' :: Int
softLimit = Int
pSoftLimit_,
$sel:hardLimit:Ulimit' :: Int
hardLimit = Int
pHardLimit_
}
ulimit_name :: Lens.Lens' Ulimit UlimitName
ulimit_name :: (UlimitName -> f UlimitName) -> Ulimit -> f Ulimit
ulimit_name = (Ulimit -> UlimitName)
-> (Ulimit -> UlimitName -> Ulimit)
-> Lens Ulimit Ulimit UlimitName UlimitName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Ulimit' {UlimitName
name :: UlimitName
$sel:name:Ulimit' :: Ulimit -> UlimitName
name} -> UlimitName
name) (\s :: Ulimit
s@Ulimit' {} UlimitName
a -> Ulimit
s {$sel:name:Ulimit' :: UlimitName
name = UlimitName
a} :: Ulimit)
ulimit_softLimit :: Lens.Lens' Ulimit Prelude.Int
ulimit_softLimit :: (Int -> f Int) -> Ulimit -> f Ulimit
ulimit_softLimit = (Ulimit -> Int)
-> (Ulimit -> Int -> Ulimit) -> Lens Ulimit Ulimit Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Ulimit' {Int
softLimit :: Int
$sel:softLimit:Ulimit' :: Ulimit -> Int
softLimit} -> Int
softLimit) (\s :: Ulimit
s@Ulimit' {} Int
a -> Ulimit
s {$sel:softLimit:Ulimit' :: Int
softLimit = Int
a} :: Ulimit)
ulimit_hardLimit :: Lens.Lens' Ulimit Prelude.Int
ulimit_hardLimit :: (Int -> f Int) -> Ulimit -> f Ulimit
ulimit_hardLimit = (Ulimit -> Int)
-> (Ulimit -> Int -> Ulimit) -> Lens Ulimit Ulimit Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Ulimit' {Int
hardLimit :: Int
$sel:hardLimit:Ulimit' :: Ulimit -> Int
hardLimit} -> Int
hardLimit) (\s :: Ulimit
s@Ulimit' {} Int
a -> Ulimit
s {$sel:hardLimit:Ulimit' :: Int
hardLimit = Int
a} :: Ulimit)
instance Core.FromJSON Ulimit where
parseJSON :: Value -> Parser Ulimit
parseJSON =
String -> (Object -> Parser Ulimit) -> Value -> Parser Ulimit
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Ulimit"
( \Object
x ->
UlimitName -> Int -> Int -> Ulimit
Ulimit'
(UlimitName -> Int -> Int -> Ulimit)
-> Parser UlimitName -> Parser (Int -> Int -> Ulimit)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser UlimitName
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"name")
Parser (Int -> Int -> Ulimit)
-> Parser Int -> Parser (Int -> Ulimit)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"softLimit")
Parser (Int -> Ulimit) -> Parser Int -> Parser Ulimit
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"hardLimit")
)
instance Prelude.Hashable Ulimit
instance Prelude.NFData Ulimit
instance Core.ToJSON Ulimit where
toJSON :: Ulimit -> Value
toJSON Ulimit' {Int
UlimitName
hardLimit :: Int
softLimit :: Int
name :: UlimitName
$sel:hardLimit:Ulimit' :: Ulimit -> Int
$sel:softLimit:Ulimit' :: Ulimit -> Int
$sel:name:Ulimit' :: Ulimit -> UlimitName
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> UlimitName -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= UlimitName
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"softLimit" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
softLimit),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"hardLimit" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
hardLimit)
]
)