{-# 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.Lambda.Types.AliasRoutingConfiguration where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AliasRoutingConfiguration = AliasRoutingConfiguration'
{
AliasRoutingConfiguration -> Maybe (HashMap Text Double)
additionalVersionWeights :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Double)
}
deriving (AliasRoutingConfiguration -> AliasRoutingConfiguration -> Bool
(AliasRoutingConfiguration -> AliasRoutingConfiguration -> Bool)
-> (AliasRoutingConfiguration -> AliasRoutingConfiguration -> Bool)
-> Eq AliasRoutingConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AliasRoutingConfiguration -> AliasRoutingConfiguration -> Bool
$c/= :: AliasRoutingConfiguration -> AliasRoutingConfiguration -> Bool
== :: AliasRoutingConfiguration -> AliasRoutingConfiguration -> Bool
$c== :: AliasRoutingConfiguration -> AliasRoutingConfiguration -> Bool
Prelude.Eq, ReadPrec [AliasRoutingConfiguration]
ReadPrec AliasRoutingConfiguration
Int -> ReadS AliasRoutingConfiguration
ReadS [AliasRoutingConfiguration]
(Int -> ReadS AliasRoutingConfiguration)
-> ReadS [AliasRoutingConfiguration]
-> ReadPrec AliasRoutingConfiguration
-> ReadPrec [AliasRoutingConfiguration]
-> Read AliasRoutingConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AliasRoutingConfiguration]
$creadListPrec :: ReadPrec [AliasRoutingConfiguration]
readPrec :: ReadPrec AliasRoutingConfiguration
$creadPrec :: ReadPrec AliasRoutingConfiguration
readList :: ReadS [AliasRoutingConfiguration]
$creadList :: ReadS [AliasRoutingConfiguration]
readsPrec :: Int -> ReadS AliasRoutingConfiguration
$creadsPrec :: Int -> ReadS AliasRoutingConfiguration
Prelude.Read, Int -> AliasRoutingConfiguration -> ShowS
[AliasRoutingConfiguration] -> ShowS
AliasRoutingConfiguration -> String
(Int -> AliasRoutingConfiguration -> ShowS)
-> (AliasRoutingConfiguration -> String)
-> ([AliasRoutingConfiguration] -> ShowS)
-> Show AliasRoutingConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AliasRoutingConfiguration] -> ShowS
$cshowList :: [AliasRoutingConfiguration] -> ShowS
show :: AliasRoutingConfiguration -> String
$cshow :: AliasRoutingConfiguration -> String
showsPrec :: Int -> AliasRoutingConfiguration -> ShowS
$cshowsPrec :: Int -> AliasRoutingConfiguration -> ShowS
Prelude.Show, (forall x.
AliasRoutingConfiguration -> Rep AliasRoutingConfiguration x)
-> (forall x.
Rep AliasRoutingConfiguration x -> AliasRoutingConfiguration)
-> Generic AliasRoutingConfiguration
forall x.
Rep AliasRoutingConfiguration x -> AliasRoutingConfiguration
forall x.
AliasRoutingConfiguration -> Rep AliasRoutingConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AliasRoutingConfiguration x -> AliasRoutingConfiguration
$cfrom :: forall x.
AliasRoutingConfiguration -> Rep AliasRoutingConfiguration x
Prelude.Generic)
newAliasRoutingConfiguration ::
AliasRoutingConfiguration
newAliasRoutingConfiguration :: AliasRoutingConfiguration
newAliasRoutingConfiguration =
AliasRoutingConfiguration' :: Maybe (HashMap Text Double) -> AliasRoutingConfiguration
AliasRoutingConfiguration'
{ $sel:additionalVersionWeights:AliasRoutingConfiguration' :: Maybe (HashMap Text Double)
additionalVersionWeights =
Maybe (HashMap Text Double)
forall a. Maybe a
Prelude.Nothing
}
aliasRoutingConfiguration_additionalVersionWeights :: Lens.Lens' AliasRoutingConfiguration (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Double))
aliasRoutingConfiguration_additionalVersionWeights :: (Maybe (HashMap Text Double) -> f (Maybe (HashMap Text Double)))
-> AliasRoutingConfiguration -> f AliasRoutingConfiguration
aliasRoutingConfiguration_additionalVersionWeights = (AliasRoutingConfiguration -> Maybe (HashMap Text Double))
-> (AliasRoutingConfiguration
-> Maybe (HashMap Text Double) -> AliasRoutingConfiguration)
-> Lens
AliasRoutingConfiguration
AliasRoutingConfiguration
(Maybe (HashMap Text Double))
(Maybe (HashMap Text Double))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AliasRoutingConfiguration' {Maybe (HashMap Text Double)
additionalVersionWeights :: Maybe (HashMap Text Double)
$sel:additionalVersionWeights:AliasRoutingConfiguration' :: AliasRoutingConfiguration -> Maybe (HashMap Text Double)
additionalVersionWeights} -> Maybe (HashMap Text Double)
additionalVersionWeights) (\s :: AliasRoutingConfiguration
s@AliasRoutingConfiguration' {} Maybe (HashMap Text Double)
a -> AliasRoutingConfiguration
s {$sel:additionalVersionWeights:AliasRoutingConfiguration' :: Maybe (HashMap Text Double)
additionalVersionWeights = Maybe (HashMap Text Double)
a} :: AliasRoutingConfiguration) ((Maybe (HashMap Text Double) -> f (Maybe (HashMap Text Double)))
-> AliasRoutingConfiguration -> f AliasRoutingConfiguration)
-> ((Maybe (HashMap Text Double)
-> f (Maybe (HashMap Text Double)))
-> Maybe (HashMap Text Double) -> f (Maybe (HashMap Text Double)))
-> (Maybe (HashMap Text Double) -> f (Maybe (HashMap Text Double)))
-> AliasRoutingConfiguration
-> f AliasRoutingConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Double)
(HashMap Text Double)
(HashMap Text Double)
(HashMap Text Double)
-> Iso
(Maybe (HashMap Text Double))
(Maybe (HashMap Text Double))
(Maybe (HashMap Text Double))
(Maybe (HashMap Text Double))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text Double)
(HashMap Text Double)
(HashMap Text Double)
(HashMap Text Double)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON AliasRoutingConfiguration where
parseJSON :: Value -> Parser AliasRoutingConfiguration
parseJSON =
String
-> (Object -> Parser AliasRoutingConfiguration)
-> Value
-> Parser AliasRoutingConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AliasRoutingConfiguration"
( \Object
x ->
Maybe (HashMap Text Double) -> AliasRoutingConfiguration
AliasRoutingConfiguration'
(Maybe (HashMap Text Double) -> AliasRoutingConfiguration)
-> Parser (Maybe (HashMap Text Double))
-> Parser AliasRoutingConfiguration
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Double)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AdditionalVersionWeights"
Parser (Maybe (Maybe (HashMap Text Double)))
-> Maybe (HashMap Text Double)
-> Parser (Maybe (HashMap Text Double))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Double)
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable AliasRoutingConfiguration
instance Prelude.NFData AliasRoutingConfiguration
instance Core.ToJSON AliasRoutingConfiguration where
toJSON :: AliasRoutingConfiguration -> Value
toJSON AliasRoutingConfiguration' {Maybe (HashMap Text Double)
additionalVersionWeights :: Maybe (HashMap Text Double)
$sel:additionalVersionWeights:AliasRoutingConfiguration' :: AliasRoutingConfiguration -> Maybe (HashMap Text Double)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"AdditionalVersionWeights" Text -> HashMap Text Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(HashMap Text Double -> Pair)
-> Maybe (HashMap Text Double) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Double)
additionalVersionWeights
]
)