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