{-# 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.AutoTuneOptionsInput
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ElasticSearch.Types.AutoTuneOptionsInput where

import qualified Amazonka.Core as Core
import Amazonka.ElasticSearch.Types.AutoTuneDesiredState
import Amazonka.ElasticSearch.Types.AutoTuneMaintenanceSchedule
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Specifies the Auto-Tune options: the Auto-Tune desired state for the
-- domain and list of maintenance schedules.
--
-- /See:/ 'newAutoTuneOptionsInput' smart constructor.
data AutoTuneOptionsInput = AutoTuneOptionsInput'
  { -- | Specifies the Auto-Tune desired state. Valid values are ENABLED,
    -- DISABLED.
    AutoTuneOptionsInput -> Maybe AutoTuneDesiredState
desiredState :: Prelude.Maybe AutoTuneDesiredState,
    -- | Specifies list of maitenance schedules. See the
    -- <https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/auto-tune.html Developer Guide>
    -- for more information.
    AutoTuneOptionsInput -> Maybe [AutoTuneMaintenanceSchedule]
maintenanceSchedules :: Prelude.Maybe [AutoTuneMaintenanceSchedule]
  }
  deriving (AutoTuneOptionsInput -> AutoTuneOptionsInput -> Bool
(AutoTuneOptionsInput -> AutoTuneOptionsInput -> Bool)
-> (AutoTuneOptionsInput -> AutoTuneOptionsInput -> Bool)
-> Eq AutoTuneOptionsInput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutoTuneOptionsInput -> AutoTuneOptionsInput -> Bool
$c/= :: AutoTuneOptionsInput -> AutoTuneOptionsInput -> Bool
== :: AutoTuneOptionsInput -> AutoTuneOptionsInput -> Bool
$c== :: AutoTuneOptionsInput -> AutoTuneOptionsInput -> Bool
Prelude.Eq, ReadPrec [AutoTuneOptionsInput]
ReadPrec AutoTuneOptionsInput
Int -> ReadS AutoTuneOptionsInput
ReadS [AutoTuneOptionsInput]
(Int -> ReadS AutoTuneOptionsInput)
-> ReadS [AutoTuneOptionsInput]
-> ReadPrec AutoTuneOptionsInput
-> ReadPrec [AutoTuneOptionsInput]
-> Read AutoTuneOptionsInput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutoTuneOptionsInput]
$creadListPrec :: ReadPrec [AutoTuneOptionsInput]
readPrec :: ReadPrec AutoTuneOptionsInput
$creadPrec :: ReadPrec AutoTuneOptionsInput
readList :: ReadS [AutoTuneOptionsInput]
$creadList :: ReadS [AutoTuneOptionsInput]
readsPrec :: Int -> ReadS AutoTuneOptionsInput
$creadsPrec :: Int -> ReadS AutoTuneOptionsInput
Prelude.Read, Int -> AutoTuneOptionsInput -> ShowS
[AutoTuneOptionsInput] -> ShowS
AutoTuneOptionsInput -> String
(Int -> AutoTuneOptionsInput -> ShowS)
-> (AutoTuneOptionsInput -> String)
-> ([AutoTuneOptionsInput] -> ShowS)
-> Show AutoTuneOptionsInput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutoTuneOptionsInput] -> ShowS
$cshowList :: [AutoTuneOptionsInput] -> ShowS
show :: AutoTuneOptionsInput -> String
$cshow :: AutoTuneOptionsInput -> String
showsPrec :: Int -> AutoTuneOptionsInput -> ShowS
$cshowsPrec :: Int -> AutoTuneOptionsInput -> ShowS
Prelude.Show, (forall x. AutoTuneOptionsInput -> Rep AutoTuneOptionsInput x)
-> (forall x. Rep AutoTuneOptionsInput x -> AutoTuneOptionsInput)
-> Generic AutoTuneOptionsInput
forall x. Rep AutoTuneOptionsInput x -> AutoTuneOptionsInput
forall x. AutoTuneOptionsInput -> Rep AutoTuneOptionsInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AutoTuneOptionsInput x -> AutoTuneOptionsInput
$cfrom :: forall x. AutoTuneOptionsInput -> Rep AutoTuneOptionsInput x
Prelude.Generic)

-- |
-- Create a value of 'AutoTuneOptionsInput' 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:
--
-- 'desiredState', 'autoTuneOptionsInput_desiredState' - Specifies the Auto-Tune desired state. Valid values are ENABLED,
-- DISABLED.
--
-- 'maintenanceSchedules', 'autoTuneOptionsInput_maintenanceSchedules' - Specifies list of maitenance schedules. See the
-- <https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/auto-tune.html Developer Guide>
-- for more information.
newAutoTuneOptionsInput ::
  AutoTuneOptionsInput
newAutoTuneOptionsInput :: AutoTuneOptionsInput
newAutoTuneOptionsInput =
  AutoTuneOptionsInput' :: Maybe AutoTuneDesiredState
-> Maybe [AutoTuneMaintenanceSchedule] -> AutoTuneOptionsInput
AutoTuneOptionsInput'
    { $sel:desiredState:AutoTuneOptionsInput' :: Maybe AutoTuneDesiredState
desiredState =
        Maybe AutoTuneDesiredState
forall a. Maybe a
Prelude.Nothing,
      $sel:maintenanceSchedules:AutoTuneOptionsInput' :: Maybe [AutoTuneMaintenanceSchedule]
maintenanceSchedules = Maybe [AutoTuneMaintenanceSchedule]
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the Auto-Tune desired state. Valid values are ENABLED,
-- DISABLED.
autoTuneOptionsInput_desiredState :: Lens.Lens' AutoTuneOptionsInput (Prelude.Maybe AutoTuneDesiredState)
autoTuneOptionsInput_desiredState :: (Maybe AutoTuneDesiredState -> f (Maybe AutoTuneDesiredState))
-> AutoTuneOptionsInput -> f AutoTuneOptionsInput
autoTuneOptionsInput_desiredState = (AutoTuneOptionsInput -> Maybe AutoTuneDesiredState)
-> (AutoTuneOptionsInput
    -> Maybe AutoTuneDesiredState -> AutoTuneOptionsInput)
-> Lens
     AutoTuneOptionsInput
     AutoTuneOptionsInput
     (Maybe AutoTuneDesiredState)
     (Maybe AutoTuneDesiredState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoTuneOptionsInput' {Maybe AutoTuneDesiredState
desiredState :: Maybe AutoTuneDesiredState
$sel:desiredState:AutoTuneOptionsInput' :: AutoTuneOptionsInput -> Maybe AutoTuneDesiredState
desiredState} -> Maybe AutoTuneDesiredState
desiredState) (\s :: AutoTuneOptionsInput
s@AutoTuneOptionsInput' {} Maybe AutoTuneDesiredState
a -> AutoTuneOptionsInput
s {$sel:desiredState:AutoTuneOptionsInput' :: Maybe AutoTuneDesiredState
desiredState = Maybe AutoTuneDesiredState
a} :: AutoTuneOptionsInput)

-- | Specifies list of maitenance schedules. See the
-- <https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/auto-tune.html Developer Guide>
-- for more information.
autoTuneOptionsInput_maintenanceSchedules :: Lens.Lens' AutoTuneOptionsInput (Prelude.Maybe [AutoTuneMaintenanceSchedule])
autoTuneOptionsInput_maintenanceSchedules :: (Maybe [AutoTuneMaintenanceSchedule]
 -> f (Maybe [AutoTuneMaintenanceSchedule]))
-> AutoTuneOptionsInput -> f AutoTuneOptionsInput
autoTuneOptionsInput_maintenanceSchedules = (AutoTuneOptionsInput -> Maybe [AutoTuneMaintenanceSchedule])
-> (AutoTuneOptionsInput
    -> Maybe [AutoTuneMaintenanceSchedule] -> AutoTuneOptionsInput)
-> Lens
     AutoTuneOptionsInput
     AutoTuneOptionsInput
     (Maybe [AutoTuneMaintenanceSchedule])
     (Maybe [AutoTuneMaintenanceSchedule])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoTuneOptionsInput' {Maybe [AutoTuneMaintenanceSchedule]
maintenanceSchedules :: Maybe [AutoTuneMaintenanceSchedule]
$sel:maintenanceSchedules:AutoTuneOptionsInput' :: AutoTuneOptionsInput -> Maybe [AutoTuneMaintenanceSchedule]
maintenanceSchedules} -> Maybe [AutoTuneMaintenanceSchedule]
maintenanceSchedules) (\s :: AutoTuneOptionsInput
s@AutoTuneOptionsInput' {} Maybe [AutoTuneMaintenanceSchedule]
a -> AutoTuneOptionsInput
s {$sel:maintenanceSchedules:AutoTuneOptionsInput' :: Maybe [AutoTuneMaintenanceSchedule]
maintenanceSchedules = Maybe [AutoTuneMaintenanceSchedule]
a} :: AutoTuneOptionsInput) ((Maybe [AutoTuneMaintenanceSchedule]
  -> f (Maybe [AutoTuneMaintenanceSchedule]))
 -> AutoTuneOptionsInput -> f AutoTuneOptionsInput)
-> ((Maybe [AutoTuneMaintenanceSchedule]
     -> f (Maybe [AutoTuneMaintenanceSchedule]))
    -> Maybe [AutoTuneMaintenanceSchedule]
    -> f (Maybe [AutoTuneMaintenanceSchedule]))
-> (Maybe [AutoTuneMaintenanceSchedule]
    -> f (Maybe [AutoTuneMaintenanceSchedule]))
-> AutoTuneOptionsInput
-> f AutoTuneOptionsInput
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AutoTuneMaintenanceSchedule]
  [AutoTuneMaintenanceSchedule]
  [AutoTuneMaintenanceSchedule]
  [AutoTuneMaintenanceSchedule]
-> Iso
     (Maybe [AutoTuneMaintenanceSchedule])
     (Maybe [AutoTuneMaintenanceSchedule])
     (Maybe [AutoTuneMaintenanceSchedule])
     (Maybe [AutoTuneMaintenanceSchedule])
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 AnIso
  [AutoTuneMaintenanceSchedule]
  [AutoTuneMaintenanceSchedule]
  [AutoTuneMaintenanceSchedule]
  [AutoTuneMaintenanceSchedule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable AutoTuneOptionsInput

instance Prelude.NFData AutoTuneOptionsInput

instance Core.ToJSON AutoTuneOptionsInput where
  toJSON :: AutoTuneOptionsInput -> Value
toJSON AutoTuneOptionsInput' {Maybe [AutoTuneMaintenanceSchedule]
Maybe AutoTuneDesiredState
maintenanceSchedules :: Maybe [AutoTuneMaintenanceSchedule]
desiredState :: Maybe AutoTuneDesiredState
$sel:maintenanceSchedules:AutoTuneOptionsInput' :: AutoTuneOptionsInput -> Maybe [AutoTuneMaintenanceSchedule]
$sel:desiredState:AutoTuneOptionsInput' :: AutoTuneOptionsInput -> Maybe AutoTuneDesiredState
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DesiredState" Text -> AutoTuneDesiredState -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AutoTuneDesiredState -> Pair)
-> Maybe AutoTuneDesiredState -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AutoTuneDesiredState
desiredState,
            (Text
"MaintenanceSchedules" Text -> [AutoTuneMaintenanceSchedule] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([AutoTuneMaintenanceSchedule] -> Pair)
-> Maybe [AutoTuneMaintenanceSchedule] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AutoTuneMaintenanceSchedule]
maintenanceSchedules
          ]
      )