{-# 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.AppRunner.Types.InstanceConfiguration where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data InstanceConfiguration = InstanceConfiguration'
{
InstanceConfiguration -> Maybe Text
memory :: Prelude.Maybe Prelude.Text,
InstanceConfiguration -> Maybe Text
instanceRoleArn :: Prelude.Maybe Prelude.Text,
InstanceConfiguration -> Maybe Text
cpu :: Prelude.Maybe Prelude.Text
}
deriving (InstanceConfiguration -> InstanceConfiguration -> Bool
(InstanceConfiguration -> InstanceConfiguration -> Bool)
-> (InstanceConfiguration -> InstanceConfiguration -> Bool)
-> Eq InstanceConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceConfiguration -> InstanceConfiguration -> Bool
$c/= :: InstanceConfiguration -> InstanceConfiguration -> Bool
== :: InstanceConfiguration -> InstanceConfiguration -> Bool
$c== :: InstanceConfiguration -> InstanceConfiguration -> Bool
Prelude.Eq, ReadPrec [InstanceConfiguration]
ReadPrec InstanceConfiguration
Int -> ReadS InstanceConfiguration
ReadS [InstanceConfiguration]
(Int -> ReadS InstanceConfiguration)
-> ReadS [InstanceConfiguration]
-> ReadPrec InstanceConfiguration
-> ReadPrec [InstanceConfiguration]
-> Read InstanceConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceConfiguration]
$creadListPrec :: ReadPrec [InstanceConfiguration]
readPrec :: ReadPrec InstanceConfiguration
$creadPrec :: ReadPrec InstanceConfiguration
readList :: ReadS [InstanceConfiguration]
$creadList :: ReadS [InstanceConfiguration]
readsPrec :: Int -> ReadS InstanceConfiguration
$creadsPrec :: Int -> ReadS InstanceConfiguration
Prelude.Read, Int -> InstanceConfiguration -> ShowS
[InstanceConfiguration] -> ShowS
InstanceConfiguration -> String
(Int -> InstanceConfiguration -> ShowS)
-> (InstanceConfiguration -> String)
-> ([InstanceConfiguration] -> ShowS)
-> Show InstanceConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceConfiguration] -> ShowS
$cshowList :: [InstanceConfiguration] -> ShowS
show :: InstanceConfiguration -> String
$cshow :: InstanceConfiguration -> String
showsPrec :: Int -> InstanceConfiguration -> ShowS
$cshowsPrec :: Int -> InstanceConfiguration -> ShowS
Prelude.Show, (forall x. InstanceConfiguration -> Rep InstanceConfiguration x)
-> (forall x. Rep InstanceConfiguration x -> InstanceConfiguration)
-> Generic InstanceConfiguration
forall x. Rep InstanceConfiguration x -> InstanceConfiguration
forall x. InstanceConfiguration -> Rep InstanceConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstanceConfiguration x -> InstanceConfiguration
$cfrom :: forall x. InstanceConfiguration -> Rep InstanceConfiguration x
Prelude.Generic)
newInstanceConfiguration ::
InstanceConfiguration
newInstanceConfiguration :: InstanceConfiguration
newInstanceConfiguration =
InstanceConfiguration' :: Maybe Text -> Maybe Text -> Maybe Text -> InstanceConfiguration
InstanceConfiguration'
{ $sel:memory:InstanceConfiguration' :: Maybe Text
memory = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:instanceRoleArn:InstanceConfiguration' :: Maybe Text
instanceRoleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:cpu:InstanceConfiguration' :: Maybe Text
cpu = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
instanceConfiguration_memory :: Lens.Lens' InstanceConfiguration (Prelude.Maybe Prelude.Text)
instanceConfiguration_memory :: (Maybe Text -> f (Maybe Text))
-> InstanceConfiguration -> f InstanceConfiguration
instanceConfiguration_memory = (InstanceConfiguration -> Maybe Text)
-> (InstanceConfiguration -> Maybe Text -> InstanceConfiguration)
-> Lens
InstanceConfiguration
InstanceConfiguration
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceConfiguration' {Maybe Text
memory :: Maybe Text
$sel:memory:InstanceConfiguration' :: InstanceConfiguration -> Maybe Text
memory} -> Maybe Text
memory) (\s :: InstanceConfiguration
s@InstanceConfiguration' {} Maybe Text
a -> InstanceConfiguration
s {$sel:memory:InstanceConfiguration' :: Maybe Text
memory = Maybe Text
a} :: InstanceConfiguration)
instanceConfiguration_instanceRoleArn :: Lens.Lens' InstanceConfiguration (Prelude.Maybe Prelude.Text)
instanceConfiguration_instanceRoleArn :: (Maybe Text -> f (Maybe Text))
-> InstanceConfiguration -> f InstanceConfiguration
instanceConfiguration_instanceRoleArn = (InstanceConfiguration -> Maybe Text)
-> (InstanceConfiguration -> Maybe Text -> InstanceConfiguration)
-> Lens
InstanceConfiguration
InstanceConfiguration
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceConfiguration' {Maybe Text
instanceRoleArn :: Maybe Text
$sel:instanceRoleArn:InstanceConfiguration' :: InstanceConfiguration -> Maybe Text
instanceRoleArn} -> Maybe Text
instanceRoleArn) (\s :: InstanceConfiguration
s@InstanceConfiguration' {} Maybe Text
a -> InstanceConfiguration
s {$sel:instanceRoleArn:InstanceConfiguration' :: Maybe Text
instanceRoleArn = Maybe Text
a} :: InstanceConfiguration)
instanceConfiguration_cpu :: Lens.Lens' InstanceConfiguration (Prelude.Maybe Prelude.Text)
instanceConfiguration_cpu :: (Maybe Text -> f (Maybe Text))
-> InstanceConfiguration -> f InstanceConfiguration
instanceConfiguration_cpu = (InstanceConfiguration -> Maybe Text)
-> (InstanceConfiguration -> Maybe Text -> InstanceConfiguration)
-> Lens
InstanceConfiguration
InstanceConfiguration
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceConfiguration' {Maybe Text
cpu :: Maybe Text
$sel:cpu:InstanceConfiguration' :: InstanceConfiguration -> Maybe Text
cpu} -> Maybe Text
cpu) (\s :: InstanceConfiguration
s@InstanceConfiguration' {} Maybe Text
a -> InstanceConfiguration
s {$sel:cpu:InstanceConfiguration' :: Maybe Text
cpu = Maybe Text
a} :: InstanceConfiguration)
instance Core.FromJSON InstanceConfiguration where
parseJSON :: Value -> Parser InstanceConfiguration
parseJSON =
String
-> (Object -> Parser InstanceConfiguration)
-> Value
-> Parser InstanceConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"InstanceConfiguration"
( \Object
x ->
Maybe Text -> Maybe Text -> Maybe Text -> InstanceConfiguration
InstanceConfiguration'
(Maybe Text -> Maybe Text -> Maybe Text -> InstanceConfiguration)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> InstanceConfiguration)
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
"Memory")
Parser (Maybe Text -> Maybe Text -> InstanceConfiguration)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> InstanceConfiguration)
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
"InstanceRoleArn")
Parser (Maybe Text -> InstanceConfiguration)
-> Parser (Maybe Text) -> Parser InstanceConfiguration
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
"Cpu")
)
instance Prelude.Hashable InstanceConfiguration
instance Prelude.NFData InstanceConfiguration
instance Core.ToJSON InstanceConfiguration where
toJSON :: InstanceConfiguration -> Value
toJSON InstanceConfiguration' {Maybe Text
cpu :: Maybe Text
instanceRoleArn :: Maybe Text
memory :: Maybe Text
$sel:cpu:InstanceConfiguration' :: InstanceConfiguration -> Maybe Text
$sel:instanceRoleArn:InstanceConfiguration' :: InstanceConfiguration -> Maybe Text
$sel:memory:InstanceConfiguration' :: InstanceConfiguration -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Memory" 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
memory,
(Text
"InstanceRoleArn" 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
instanceRoleArn,
(Text
"Cpu" 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
cpu
]
)