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