{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.ElasticSearch.Types.SnapshotOptions
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ElasticSearch.Types.SnapshotOptions where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Specifies the time, in UTC format, when the service takes a daily
-- automated snapshot of the specified Elasticsearch domain. Default value
-- is @0@ hours.
--
-- /See:/ 'newSnapshotOptions' smart constructor.
data SnapshotOptions = SnapshotOptions'
  { -- | Specifies the time, in UTC format, when the service takes a daily
    -- automated snapshot of the specified Elasticsearch domain. Default value
    -- is @0@ hours.
    SnapshotOptions -> Maybe Int
automatedSnapshotStartHour :: Prelude.Maybe Prelude.Int
  }
  deriving (SnapshotOptions -> SnapshotOptions -> Bool
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]
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
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. 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)

-- |
-- Create a value of 'SnapshotOptions' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'automatedSnapshotStartHour', 'snapshotOptions_automatedSnapshotStartHour' - Specifies the time, in UTC format, when the service takes a daily
-- automated snapshot of the specified Elasticsearch domain. Default value
-- is @0@ hours.
newSnapshotOptions ::
  SnapshotOptions
newSnapshotOptions :: SnapshotOptions
newSnapshotOptions =
  SnapshotOptions'
    { $sel:automatedSnapshotStartHour:SnapshotOptions' :: Maybe Int
automatedSnapshotStartHour =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the time, in UTC format, when the service takes a daily
-- automated snapshot of the specified Elasticsearch domain. Default value
-- is @0@ hours.
snapshotOptions_automatedSnapshotStartHour :: Lens.Lens' SnapshotOptions (Prelude.Maybe Prelude.Int)
snapshotOptions_automatedSnapshotStartHour :: Lens' SnapshotOptions (Maybe Int)
snapshotOptions_automatedSnapshotStartHour = 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 Data.FromJSON SnapshotOptions where
  parseJSON :: Value -> Parser SnapshotOptions
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SnapshotOptions"
      ( \Object
x ->
          Maybe Int -> SnapshotOptions
SnapshotOptions'
            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
"AutomatedSnapshotStartHour")
      )

instance Prelude.Hashable SnapshotOptions where
  hashWithSalt :: Int -> SnapshotOptions -> Int
hashWithSalt Int
_salt SnapshotOptions' {Maybe Int
automatedSnapshotStartHour :: Maybe Int
$sel:automatedSnapshotStartHour:SnapshotOptions' :: SnapshotOptions -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
automatedSnapshotStartHour

instance Prelude.NFData SnapshotOptions where
  rnf :: SnapshotOptions -> ()
rnf SnapshotOptions' {Maybe Int
automatedSnapshotStartHour :: Maybe Int
$sel:automatedSnapshotStartHour:SnapshotOptions' :: SnapshotOptions -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
automatedSnapshotStartHour

instance Data.ToJSON SnapshotOptions where
  toJSON :: SnapshotOptions -> Value
toJSON SnapshotOptions' {Maybe Int
automatedSnapshotStartHour :: Maybe Int
$sel:automatedSnapshotStartHour:SnapshotOptions' :: SnapshotOptions -> Maybe Int
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AutomatedSnapshotStartHour" 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 Int
automatedSnapshotStartHour
          ]
      )