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