{-# 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.AutoScaling.Types.DesiredConfiguration where
import Amazonka.AutoScaling.Types.LaunchTemplateSpecification
import Amazonka.AutoScaling.Types.MixedInstancesPolicy
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DesiredConfiguration = DesiredConfiguration'
{ DesiredConfiguration -> Maybe MixedInstancesPolicy
mixedInstancesPolicy :: Prelude.Maybe MixedInstancesPolicy,
DesiredConfiguration -> Maybe LaunchTemplateSpecification
launchTemplate :: Prelude.Maybe LaunchTemplateSpecification
}
deriving (DesiredConfiguration -> DesiredConfiguration -> Bool
(DesiredConfiguration -> DesiredConfiguration -> Bool)
-> (DesiredConfiguration -> DesiredConfiguration -> Bool)
-> Eq DesiredConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DesiredConfiguration -> DesiredConfiguration -> Bool
$c/= :: DesiredConfiguration -> DesiredConfiguration -> Bool
== :: DesiredConfiguration -> DesiredConfiguration -> Bool
$c== :: DesiredConfiguration -> DesiredConfiguration -> Bool
Prelude.Eq, ReadPrec [DesiredConfiguration]
ReadPrec DesiredConfiguration
Int -> ReadS DesiredConfiguration
ReadS [DesiredConfiguration]
(Int -> ReadS DesiredConfiguration)
-> ReadS [DesiredConfiguration]
-> ReadPrec DesiredConfiguration
-> ReadPrec [DesiredConfiguration]
-> Read DesiredConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DesiredConfiguration]
$creadListPrec :: ReadPrec [DesiredConfiguration]
readPrec :: ReadPrec DesiredConfiguration
$creadPrec :: ReadPrec DesiredConfiguration
readList :: ReadS [DesiredConfiguration]
$creadList :: ReadS [DesiredConfiguration]
readsPrec :: Int -> ReadS DesiredConfiguration
$creadsPrec :: Int -> ReadS DesiredConfiguration
Prelude.Read, Int -> DesiredConfiguration -> ShowS
[DesiredConfiguration] -> ShowS
DesiredConfiguration -> String
(Int -> DesiredConfiguration -> ShowS)
-> (DesiredConfiguration -> String)
-> ([DesiredConfiguration] -> ShowS)
-> Show DesiredConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DesiredConfiguration] -> ShowS
$cshowList :: [DesiredConfiguration] -> ShowS
show :: DesiredConfiguration -> String
$cshow :: DesiredConfiguration -> String
showsPrec :: Int -> DesiredConfiguration -> ShowS
$cshowsPrec :: Int -> DesiredConfiguration -> ShowS
Prelude.Show, (forall x. DesiredConfiguration -> Rep DesiredConfiguration x)
-> (forall x. Rep DesiredConfiguration x -> DesiredConfiguration)
-> Generic DesiredConfiguration
forall x. Rep DesiredConfiguration x -> DesiredConfiguration
forall x. DesiredConfiguration -> Rep DesiredConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DesiredConfiguration x -> DesiredConfiguration
$cfrom :: forall x. DesiredConfiguration -> Rep DesiredConfiguration x
Prelude.Generic)
newDesiredConfiguration ::
DesiredConfiguration
newDesiredConfiguration :: DesiredConfiguration
newDesiredConfiguration =
DesiredConfiguration' :: Maybe MixedInstancesPolicy
-> Maybe LaunchTemplateSpecification -> DesiredConfiguration
DesiredConfiguration'
{ $sel:mixedInstancesPolicy:DesiredConfiguration' :: Maybe MixedInstancesPolicy
mixedInstancesPolicy =
Maybe MixedInstancesPolicy
forall a. Maybe a
Prelude.Nothing,
$sel:launchTemplate:DesiredConfiguration' :: Maybe LaunchTemplateSpecification
launchTemplate = Maybe LaunchTemplateSpecification
forall a. Maybe a
Prelude.Nothing
}
desiredConfiguration_mixedInstancesPolicy :: Lens.Lens' DesiredConfiguration (Prelude.Maybe MixedInstancesPolicy)
desiredConfiguration_mixedInstancesPolicy :: (Maybe MixedInstancesPolicy -> f (Maybe MixedInstancesPolicy))
-> DesiredConfiguration -> f DesiredConfiguration
desiredConfiguration_mixedInstancesPolicy = (DesiredConfiguration -> Maybe MixedInstancesPolicy)
-> (DesiredConfiguration
-> Maybe MixedInstancesPolicy -> DesiredConfiguration)
-> Lens
DesiredConfiguration
DesiredConfiguration
(Maybe MixedInstancesPolicy)
(Maybe MixedInstancesPolicy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DesiredConfiguration' {Maybe MixedInstancesPolicy
mixedInstancesPolicy :: Maybe MixedInstancesPolicy
$sel:mixedInstancesPolicy:DesiredConfiguration' :: DesiredConfiguration -> Maybe MixedInstancesPolicy
mixedInstancesPolicy} -> Maybe MixedInstancesPolicy
mixedInstancesPolicy) (\s :: DesiredConfiguration
s@DesiredConfiguration' {} Maybe MixedInstancesPolicy
a -> DesiredConfiguration
s {$sel:mixedInstancesPolicy:DesiredConfiguration' :: Maybe MixedInstancesPolicy
mixedInstancesPolicy = Maybe MixedInstancesPolicy
a} :: DesiredConfiguration)
desiredConfiguration_launchTemplate :: Lens.Lens' DesiredConfiguration (Prelude.Maybe LaunchTemplateSpecification)
desiredConfiguration_launchTemplate :: (Maybe LaunchTemplateSpecification
-> f (Maybe LaunchTemplateSpecification))
-> DesiredConfiguration -> f DesiredConfiguration
desiredConfiguration_launchTemplate = (DesiredConfiguration -> Maybe LaunchTemplateSpecification)
-> (DesiredConfiguration
-> Maybe LaunchTemplateSpecification -> DesiredConfiguration)
-> Lens
DesiredConfiguration
DesiredConfiguration
(Maybe LaunchTemplateSpecification)
(Maybe LaunchTemplateSpecification)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DesiredConfiguration' {Maybe LaunchTemplateSpecification
launchTemplate :: Maybe LaunchTemplateSpecification
$sel:launchTemplate:DesiredConfiguration' :: DesiredConfiguration -> Maybe LaunchTemplateSpecification
launchTemplate} -> Maybe LaunchTemplateSpecification
launchTemplate) (\s :: DesiredConfiguration
s@DesiredConfiguration' {} Maybe LaunchTemplateSpecification
a -> DesiredConfiguration
s {$sel:launchTemplate:DesiredConfiguration' :: Maybe LaunchTemplateSpecification
launchTemplate = Maybe LaunchTemplateSpecification
a} :: DesiredConfiguration)
instance Core.FromXML DesiredConfiguration where
parseXML :: [Node] -> Either String DesiredConfiguration
parseXML [Node]
x =
Maybe MixedInstancesPolicy
-> Maybe LaunchTemplateSpecification -> DesiredConfiguration
DesiredConfiguration'
(Maybe MixedInstancesPolicy
-> Maybe LaunchTemplateSpecification -> DesiredConfiguration)
-> Either String (Maybe MixedInstancesPolicy)
-> Either
String (Maybe LaunchTemplateSpecification -> DesiredConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe MixedInstancesPolicy)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"MixedInstancesPolicy")
Either
String (Maybe LaunchTemplateSpecification -> DesiredConfiguration)
-> Either String (Maybe LaunchTemplateSpecification)
-> Either String DesiredConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe LaunchTemplateSpecification)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"LaunchTemplate")
instance Prelude.Hashable DesiredConfiguration
instance Prelude.NFData DesiredConfiguration
instance Core.ToQuery DesiredConfiguration where
toQuery :: DesiredConfiguration -> QueryString
toQuery DesiredConfiguration' {Maybe LaunchTemplateSpecification
Maybe MixedInstancesPolicy
launchTemplate :: Maybe LaunchTemplateSpecification
mixedInstancesPolicy :: Maybe MixedInstancesPolicy
$sel:launchTemplate:DesiredConfiguration' :: DesiredConfiguration -> Maybe LaunchTemplateSpecification
$sel:mixedInstancesPolicy:DesiredConfiguration' :: DesiredConfiguration -> Maybe MixedInstancesPolicy
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"MixedInstancesPolicy" ByteString -> Maybe MixedInstancesPolicy -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe MixedInstancesPolicy
mixedInstancesPolicy,
ByteString
"LaunchTemplate" ByteString -> Maybe LaunchTemplateSpecification -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe LaunchTemplateSpecification
launchTemplate
]