{-# 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.AutoScalingGroupProvider where
import qualified Amazonka.Core as Core
import Amazonka.ECS.Types.ManagedScaling
import Amazonka.ECS.Types.ManagedTerminationProtection
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AutoScalingGroupProvider = AutoScalingGroupProvider'
{
AutoScalingGroupProvider -> Maybe ManagedScaling
managedScaling :: Prelude.Maybe ManagedScaling,
AutoScalingGroupProvider -> Maybe ManagedTerminationProtection
managedTerminationProtection :: Prelude.Maybe ManagedTerminationProtection,
AutoScalingGroupProvider -> Text
autoScalingGroupArn :: Prelude.Text
}
deriving (AutoScalingGroupProvider -> AutoScalingGroupProvider -> Bool
(AutoScalingGroupProvider -> AutoScalingGroupProvider -> Bool)
-> (AutoScalingGroupProvider -> AutoScalingGroupProvider -> Bool)
-> Eq AutoScalingGroupProvider
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutoScalingGroupProvider -> AutoScalingGroupProvider -> Bool
$c/= :: AutoScalingGroupProvider -> AutoScalingGroupProvider -> Bool
== :: AutoScalingGroupProvider -> AutoScalingGroupProvider -> Bool
$c== :: AutoScalingGroupProvider -> AutoScalingGroupProvider -> Bool
Prelude.Eq, ReadPrec [AutoScalingGroupProvider]
ReadPrec AutoScalingGroupProvider
Int -> ReadS AutoScalingGroupProvider
ReadS [AutoScalingGroupProvider]
(Int -> ReadS AutoScalingGroupProvider)
-> ReadS [AutoScalingGroupProvider]
-> ReadPrec AutoScalingGroupProvider
-> ReadPrec [AutoScalingGroupProvider]
-> Read AutoScalingGroupProvider
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutoScalingGroupProvider]
$creadListPrec :: ReadPrec [AutoScalingGroupProvider]
readPrec :: ReadPrec AutoScalingGroupProvider
$creadPrec :: ReadPrec AutoScalingGroupProvider
readList :: ReadS [AutoScalingGroupProvider]
$creadList :: ReadS [AutoScalingGroupProvider]
readsPrec :: Int -> ReadS AutoScalingGroupProvider
$creadsPrec :: Int -> ReadS AutoScalingGroupProvider
Prelude.Read, Int -> AutoScalingGroupProvider -> ShowS
[AutoScalingGroupProvider] -> ShowS
AutoScalingGroupProvider -> String
(Int -> AutoScalingGroupProvider -> ShowS)
-> (AutoScalingGroupProvider -> String)
-> ([AutoScalingGroupProvider] -> ShowS)
-> Show AutoScalingGroupProvider
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutoScalingGroupProvider] -> ShowS
$cshowList :: [AutoScalingGroupProvider] -> ShowS
show :: AutoScalingGroupProvider -> String
$cshow :: AutoScalingGroupProvider -> String
showsPrec :: Int -> AutoScalingGroupProvider -> ShowS
$cshowsPrec :: Int -> AutoScalingGroupProvider -> ShowS
Prelude.Show, (forall x.
AutoScalingGroupProvider -> Rep AutoScalingGroupProvider x)
-> (forall x.
Rep AutoScalingGroupProvider x -> AutoScalingGroupProvider)
-> Generic AutoScalingGroupProvider
forall x.
Rep AutoScalingGroupProvider x -> AutoScalingGroupProvider
forall x.
AutoScalingGroupProvider -> Rep AutoScalingGroupProvider x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AutoScalingGroupProvider x -> AutoScalingGroupProvider
$cfrom :: forall x.
AutoScalingGroupProvider -> Rep AutoScalingGroupProvider x
Prelude.Generic)
newAutoScalingGroupProvider ::
Prelude.Text ->
AutoScalingGroupProvider
newAutoScalingGroupProvider :: Text -> AutoScalingGroupProvider
newAutoScalingGroupProvider Text
pAutoScalingGroupArn_ =
AutoScalingGroupProvider' :: Maybe ManagedScaling
-> Maybe ManagedTerminationProtection
-> Text
-> AutoScalingGroupProvider
AutoScalingGroupProvider'
{ $sel:managedScaling:AutoScalingGroupProvider' :: Maybe ManagedScaling
managedScaling =
Maybe ManagedScaling
forall a. Maybe a
Prelude.Nothing,
$sel:managedTerminationProtection:AutoScalingGroupProvider' :: Maybe ManagedTerminationProtection
managedTerminationProtection = Maybe ManagedTerminationProtection
forall a. Maybe a
Prelude.Nothing,
$sel:autoScalingGroupArn:AutoScalingGroupProvider' :: Text
autoScalingGroupArn = Text
pAutoScalingGroupArn_
}
autoScalingGroupProvider_managedScaling :: Lens.Lens' AutoScalingGroupProvider (Prelude.Maybe ManagedScaling)
autoScalingGroupProvider_managedScaling :: (Maybe ManagedScaling -> f (Maybe ManagedScaling))
-> AutoScalingGroupProvider -> f AutoScalingGroupProvider
autoScalingGroupProvider_managedScaling = (AutoScalingGroupProvider -> Maybe ManagedScaling)
-> (AutoScalingGroupProvider
-> Maybe ManagedScaling -> AutoScalingGroupProvider)
-> Lens
AutoScalingGroupProvider
AutoScalingGroupProvider
(Maybe ManagedScaling)
(Maybe ManagedScaling)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingGroupProvider' {Maybe ManagedScaling
managedScaling :: Maybe ManagedScaling
$sel:managedScaling:AutoScalingGroupProvider' :: AutoScalingGroupProvider -> Maybe ManagedScaling
managedScaling} -> Maybe ManagedScaling
managedScaling) (\s :: AutoScalingGroupProvider
s@AutoScalingGroupProvider' {} Maybe ManagedScaling
a -> AutoScalingGroupProvider
s {$sel:managedScaling:AutoScalingGroupProvider' :: Maybe ManagedScaling
managedScaling = Maybe ManagedScaling
a} :: AutoScalingGroupProvider)
autoScalingGroupProvider_managedTerminationProtection :: Lens.Lens' AutoScalingGroupProvider (Prelude.Maybe ManagedTerminationProtection)
autoScalingGroupProvider_managedTerminationProtection :: (Maybe ManagedTerminationProtection
-> f (Maybe ManagedTerminationProtection))
-> AutoScalingGroupProvider -> f AutoScalingGroupProvider
autoScalingGroupProvider_managedTerminationProtection = (AutoScalingGroupProvider -> Maybe ManagedTerminationProtection)
-> (AutoScalingGroupProvider
-> Maybe ManagedTerminationProtection -> AutoScalingGroupProvider)
-> Lens
AutoScalingGroupProvider
AutoScalingGroupProvider
(Maybe ManagedTerminationProtection)
(Maybe ManagedTerminationProtection)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingGroupProvider' {Maybe ManagedTerminationProtection
managedTerminationProtection :: Maybe ManagedTerminationProtection
$sel:managedTerminationProtection:AutoScalingGroupProvider' :: AutoScalingGroupProvider -> Maybe ManagedTerminationProtection
managedTerminationProtection} -> Maybe ManagedTerminationProtection
managedTerminationProtection) (\s :: AutoScalingGroupProvider
s@AutoScalingGroupProvider' {} Maybe ManagedTerminationProtection
a -> AutoScalingGroupProvider
s {$sel:managedTerminationProtection:AutoScalingGroupProvider' :: Maybe ManagedTerminationProtection
managedTerminationProtection = Maybe ManagedTerminationProtection
a} :: AutoScalingGroupProvider)
autoScalingGroupProvider_autoScalingGroupArn :: Lens.Lens' AutoScalingGroupProvider Prelude.Text
autoScalingGroupProvider_autoScalingGroupArn :: (Text -> f Text)
-> AutoScalingGroupProvider -> f AutoScalingGroupProvider
autoScalingGroupProvider_autoScalingGroupArn = (AutoScalingGroupProvider -> Text)
-> (AutoScalingGroupProvider -> Text -> AutoScalingGroupProvider)
-> Lens AutoScalingGroupProvider AutoScalingGroupProvider Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingGroupProvider' {Text
autoScalingGroupArn :: Text
$sel:autoScalingGroupArn:AutoScalingGroupProvider' :: AutoScalingGroupProvider -> Text
autoScalingGroupArn} -> Text
autoScalingGroupArn) (\s :: AutoScalingGroupProvider
s@AutoScalingGroupProvider' {} Text
a -> AutoScalingGroupProvider
s {$sel:autoScalingGroupArn:AutoScalingGroupProvider' :: Text
autoScalingGroupArn = Text
a} :: AutoScalingGroupProvider)
instance Core.FromJSON AutoScalingGroupProvider where
parseJSON :: Value -> Parser AutoScalingGroupProvider
parseJSON =
String
-> (Object -> Parser AutoScalingGroupProvider)
-> Value
-> Parser AutoScalingGroupProvider
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AutoScalingGroupProvider"
( \Object
x ->
Maybe ManagedScaling
-> Maybe ManagedTerminationProtection
-> Text
-> AutoScalingGroupProvider
AutoScalingGroupProvider'
(Maybe ManagedScaling
-> Maybe ManagedTerminationProtection
-> Text
-> AutoScalingGroupProvider)
-> Parser (Maybe ManagedScaling)
-> Parser
(Maybe ManagedTerminationProtection
-> Text -> AutoScalingGroupProvider)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ManagedScaling)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"managedScaling")
Parser
(Maybe ManagedTerminationProtection
-> Text -> AutoScalingGroupProvider)
-> Parser (Maybe ManagedTerminationProtection)
-> Parser (Text -> AutoScalingGroupProvider)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ManagedTerminationProtection)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"managedTerminationProtection")
Parser (Text -> AutoScalingGroupProvider)
-> Parser Text -> Parser AutoScalingGroupProvider
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"autoScalingGroupArn")
)
instance Prelude.Hashable AutoScalingGroupProvider
instance Prelude.NFData AutoScalingGroupProvider
instance Core.ToJSON AutoScalingGroupProvider where
toJSON :: AutoScalingGroupProvider -> Value
toJSON AutoScalingGroupProvider' {Maybe ManagedScaling
Maybe ManagedTerminationProtection
Text
autoScalingGroupArn :: Text
managedTerminationProtection :: Maybe ManagedTerminationProtection
managedScaling :: Maybe ManagedScaling
$sel:autoScalingGroupArn:AutoScalingGroupProvider' :: AutoScalingGroupProvider -> Text
$sel:managedTerminationProtection:AutoScalingGroupProvider' :: AutoScalingGroupProvider -> Maybe ManagedTerminationProtection
$sel:managedScaling:AutoScalingGroupProvider' :: AutoScalingGroupProvider -> Maybe ManagedScaling
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"managedScaling" Text -> ManagedScaling -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(ManagedScaling -> Pair) -> Maybe ManagedScaling -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ManagedScaling
managedScaling,
(Text
"managedTerminationProtection" Text -> ManagedTerminationProtection -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(ManagedTerminationProtection -> Pair)
-> Maybe ManagedTerminationProtection -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ManagedTerminationProtection
managedTerminationProtection,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"autoScalingGroupArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
autoScalingGroupArn)
]
)