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