{-# 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.DLM.Types.CreateRule where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.DLM.Types.IntervalUnitValues
import Amazonka.DLM.Types.LocationValues
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data CreateRule = CreateRule'
{
CreateRule -> Maybe Text
cronExpression :: Prelude.Maybe Prelude.Text,
CreateRule -> Maybe Natural
interval :: Prelude.Maybe Prelude.Natural,
CreateRule -> Maybe IntervalUnitValues
intervalUnit :: Prelude.Maybe IntervalUnitValues,
CreateRule -> Maybe LocationValues
location :: Prelude.Maybe LocationValues,
CreateRule -> Maybe [Text]
times :: Prelude.Maybe [Prelude.Text]
}
deriving (CreateRule -> CreateRule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRule -> CreateRule -> Bool
$c/= :: CreateRule -> CreateRule -> Bool
== :: CreateRule -> CreateRule -> Bool
$c== :: CreateRule -> CreateRule -> Bool
Prelude.Eq, ReadPrec [CreateRule]
ReadPrec CreateRule
Int -> ReadS CreateRule
ReadS [CreateRule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRule]
$creadListPrec :: ReadPrec [CreateRule]
readPrec :: ReadPrec CreateRule
$creadPrec :: ReadPrec CreateRule
readList :: ReadS [CreateRule]
$creadList :: ReadS [CreateRule]
readsPrec :: Int -> ReadS CreateRule
$creadsPrec :: Int -> ReadS CreateRule
Prelude.Read, Int -> CreateRule -> ShowS
[CreateRule] -> ShowS
CreateRule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRule] -> ShowS
$cshowList :: [CreateRule] -> ShowS
show :: CreateRule -> String
$cshow :: CreateRule -> String
showsPrec :: Int -> CreateRule -> ShowS
$cshowsPrec :: Int -> CreateRule -> ShowS
Prelude.Show, forall x. Rep CreateRule x -> CreateRule
forall x. CreateRule -> Rep CreateRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateRule x -> CreateRule
$cfrom :: forall x. CreateRule -> Rep CreateRule x
Prelude.Generic)
newCreateRule ::
CreateRule
newCreateRule :: CreateRule
newCreateRule =
CreateRule'
{ $sel:cronExpression:CreateRule' :: Maybe Text
cronExpression = forall a. Maybe a
Prelude.Nothing,
$sel:interval:CreateRule' :: Maybe Natural
interval = forall a. Maybe a
Prelude.Nothing,
$sel:intervalUnit:CreateRule' :: Maybe IntervalUnitValues
intervalUnit = forall a. Maybe a
Prelude.Nothing,
$sel:location:CreateRule' :: Maybe LocationValues
location = forall a. Maybe a
Prelude.Nothing,
$sel:times:CreateRule' :: Maybe [Text]
times = forall a. Maybe a
Prelude.Nothing
}
createRule_cronExpression :: Lens.Lens' CreateRule (Prelude.Maybe Prelude.Text)
createRule_cronExpression :: Lens' CreateRule (Maybe Text)
createRule_cronExpression = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRule' {Maybe Text
cronExpression :: Maybe Text
$sel:cronExpression:CreateRule' :: CreateRule -> Maybe Text
cronExpression} -> Maybe Text
cronExpression) (\s :: CreateRule
s@CreateRule' {} Maybe Text
a -> CreateRule
s {$sel:cronExpression:CreateRule' :: Maybe Text
cronExpression = Maybe Text
a} :: CreateRule)
createRule_interval :: Lens.Lens' CreateRule (Prelude.Maybe Prelude.Natural)
createRule_interval :: Lens' CreateRule (Maybe Natural)
createRule_interval = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRule' {Maybe Natural
interval :: Maybe Natural
$sel:interval:CreateRule' :: CreateRule -> Maybe Natural
interval} -> Maybe Natural
interval) (\s :: CreateRule
s@CreateRule' {} Maybe Natural
a -> CreateRule
s {$sel:interval:CreateRule' :: Maybe Natural
interval = Maybe Natural
a} :: CreateRule)
createRule_intervalUnit :: Lens.Lens' CreateRule (Prelude.Maybe IntervalUnitValues)
createRule_intervalUnit :: Lens' CreateRule (Maybe IntervalUnitValues)
createRule_intervalUnit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRule' {Maybe IntervalUnitValues
intervalUnit :: Maybe IntervalUnitValues
$sel:intervalUnit:CreateRule' :: CreateRule -> Maybe IntervalUnitValues
intervalUnit} -> Maybe IntervalUnitValues
intervalUnit) (\s :: CreateRule
s@CreateRule' {} Maybe IntervalUnitValues
a -> CreateRule
s {$sel:intervalUnit:CreateRule' :: Maybe IntervalUnitValues
intervalUnit = Maybe IntervalUnitValues
a} :: CreateRule)
createRule_location :: Lens.Lens' CreateRule (Prelude.Maybe LocationValues)
createRule_location :: Lens' CreateRule (Maybe LocationValues)
createRule_location = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRule' {Maybe LocationValues
location :: Maybe LocationValues
$sel:location:CreateRule' :: CreateRule -> Maybe LocationValues
location} -> Maybe LocationValues
location) (\s :: CreateRule
s@CreateRule' {} Maybe LocationValues
a -> CreateRule
s {$sel:location:CreateRule' :: Maybe LocationValues
location = Maybe LocationValues
a} :: CreateRule)
createRule_times :: Lens.Lens' CreateRule (Prelude.Maybe [Prelude.Text])
createRule_times :: Lens' CreateRule (Maybe [Text])
createRule_times = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRule' {Maybe [Text]
times :: Maybe [Text]
$sel:times:CreateRule' :: CreateRule -> Maybe [Text]
times} -> Maybe [Text]
times) (\s :: CreateRule
s@CreateRule' {} Maybe [Text]
a -> CreateRule
s {$sel:times:CreateRule' :: Maybe [Text]
times = Maybe [Text]
a} :: CreateRule) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON CreateRule where
parseJSON :: Value -> Parser CreateRule
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"CreateRule"
( \Object
x ->
Maybe Text
-> Maybe Natural
-> Maybe IntervalUnitValues
-> Maybe LocationValues
-> Maybe [Text]
-> CreateRule
CreateRule'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CronExpression")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Interval")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"IntervalUnit")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Location")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Times" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable CreateRule where
hashWithSalt :: Int -> CreateRule -> Int
hashWithSalt Int
_salt CreateRule' {Maybe Natural
Maybe [Text]
Maybe Text
Maybe IntervalUnitValues
Maybe LocationValues
times :: Maybe [Text]
location :: Maybe LocationValues
intervalUnit :: Maybe IntervalUnitValues
interval :: Maybe Natural
cronExpression :: Maybe Text
$sel:times:CreateRule' :: CreateRule -> Maybe [Text]
$sel:location:CreateRule' :: CreateRule -> Maybe LocationValues
$sel:intervalUnit:CreateRule' :: CreateRule -> Maybe IntervalUnitValues
$sel:interval:CreateRule' :: CreateRule -> Maybe Natural
$sel:cronExpression:CreateRule' :: CreateRule -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cronExpression
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
interval
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe IntervalUnitValues
intervalUnit
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LocationValues
location
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
times
instance Prelude.NFData CreateRule where
rnf :: CreateRule -> ()
rnf CreateRule' {Maybe Natural
Maybe [Text]
Maybe Text
Maybe IntervalUnitValues
Maybe LocationValues
times :: Maybe [Text]
location :: Maybe LocationValues
intervalUnit :: Maybe IntervalUnitValues
interval :: Maybe Natural
cronExpression :: Maybe Text
$sel:times:CreateRule' :: CreateRule -> Maybe [Text]
$sel:location:CreateRule' :: CreateRule -> Maybe LocationValues
$sel:intervalUnit:CreateRule' :: CreateRule -> Maybe IntervalUnitValues
$sel:interval:CreateRule' :: CreateRule -> Maybe Natural
$sel:cronExpression:CreateRule' :: CreateRule -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cronExpression
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
interval
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe IntervalUnitValues
intervalUnit
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LocationValues
location
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
times
instance Data.ToJSON CreateRule where
toJSON :: CreateRule -> Value
toJSON CreateRule' {Maybe Natural
Maybe [Text]
Maybe Text
Maybe IntervalUnitValues
Maybe LocationValues
times :: Maybe [Text]
location :: Maybe LocationValues
intervalUnit :: Maybe IntervalUnitValues
interval :: Maybe Natural
cronExpression :: Maybe Text
$sel:times:CreateRule' :: CreateRule -> Maybe [Text]
$sel:location:CreateRule' :: CreateRule -> Maybe LocationValues
$sel:intervalUnit:CreateRule' :: CreateRule -> Maybe IntervalUnitValues
$sel:interval:CreateRule' :: CreateRule -> Maybe Natural
$sel:cronExpression:CreateRule' :: CreateRule -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"CronExpression" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
cronExpression,
(Key
"Interval" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
interval,
(Key
"IntervalUnit" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe IntervalUnitValues
intervalUnit,
(Key
"Location" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LocationValues
location,
(Key
"Times" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
times
]
)