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