{-# 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.OpenSearch.Types.AutoTuneOptionsOutput
-- 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.OpenSearch.Types.AutoTuneOptionsOutput where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpenSearch.Types.AutoTuneState
import qualified Amazonka.Prelude as Prelude

-- | The Auto-Tune options: the Auto-Tune desired state for the domain and
-- list of maintenance schedules.
--
-- /See:/ 'newAutoTuneOptionsOutput' smart constructor.
data AutoTuneOptionsOutput = AutoTuneOptionsOutput'
  { -- | The @AutoTuneState@ for the domain.
    AutoTuneOptionsOutput -> Maybe AutoTuneState
state :: Prelude.Maybe AutoTuneState,
    -- | The error message while enabling or disabling Auto-Tune.
    AutoTuneOptionsOutput -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (AutoTuneOptionsOutput -> AutoTuneOptionsOutput -> Bool
(AutoTuneOptionsOutput -> AutoTuneOptionsOutput -> Bool)
-> (AutoTuneOptionsOutput -> AutoTuneOptionsOutput -> Bool)
-> Eq AutoTuneOptionsOutput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutoTuneOptionsOutput -> AutoTuneOptionsOutput -> Bool
$c/= :: AutoTuneOptionsOutput -> AutoTuneOptionsOutput -> Bool
== :: AutoTuneOptionsOutput -> AutoTuneOptionsOutput -> Bool
$c== :: AutoTuneOptionsOutput -> AutoTuneOptionsOutput -> Bool
Prelude.Eq, ReadPrec [AutoTuneOptionsOutput]
ReadPrec AutoTuneOptionsOutput
Int -> ReadS AutoTuneOptionsOutput
ReadS [AutoTuneOptionsOutput]
(Int -> ReadS AutoTuneOptionsOutput)
-> ReadS [AutoTuneOptionsOutput]
-> ReadPrec AutoTuneOptionsOutput
-> ReadPrec [AutoTuneOptionsOutput]
-> Read AutoTuneOptionsOutput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutoTuneOptionsOutput]
$creadListPrec :: ReadPrec [AutoTuneOptionsOutput]
readPrec :: ReadPrec AutoTuneOptionsOutput
$creadPrec :: ReadPrec AutoTuneOptionsOutput
readList :: ReadS [AutoTuneOptionsOutput]
$creadList :: ReadS [AutoTuneOptionsOutput]
readsPrec :: Int -> ReadS AutoTuneOptionsOutput
$creadsPrec :: Int -> ReadS AutoTuneOptionsOutput
Prelude.Read, Int -> AutoTuneOptionsOutput -> ShowS
[AutoTuneOptionsOutput] -> ShowS
AutoTuneOptionsOutput -> String
(Int -> AutoTuneOptionsOutput -> ShowS)
-> (AutoTuneOptionsOutput -> String)
-> ([AutoTuneOptionsOutput] -> ShowS)
-> Show AutoTuneOptionsOutput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutoTuneOptionsOutput] -> ShowS
$cshowList :: [AutoTuneOptionsOutput] -> ShowS
show :: AutoTuneOptionsOutput -> String
$cshow :: AutoTuneOptionsOutput -> String
showsPrec :: Int -> AutoTuneOptionsOutput -> ShowS
$cshowsPrec :: Int -> AutoTuneOptionsOutput -> ShowS
Prelude.Show, (forall x. AutoTuneOptionsOutput -> Rep AutoTuneOptionsOutput x)
-> (forall x. Rep AutoTuneOptionsOutput x -> AutoTuneOptionsOutput)
-> Generic AutoTuneOptionsOutput
forall x. Rep AutoTuneOptionsOutput x -> AutoTuneOptionsOutput
forall x. AutoTuneOptionsOutput -> Rep AutoTuneOptionsOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AutoTuneOptionsOutput x -> AutoTuneOptionsOutput
$cfrom :: forall x. AutoTuneOptionsOutput -> Rep AutoTuneOptionsOutput x
Prelude.Generic)

-- |
-- Create a value of 'AutoTuneOptionsOutput' 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:
--
-- 'state', 'autoTuneOptionsOutput_state' - The @AutoTuneState@ for the domain.
--
-- 'errorMessage', 'autoTuneOptionsOutput_errorMessage' - The error message while enabling or disabling Auto-Tune.
newAutoTuneOptionsOutput ::
  AutoTuneOptionsOutput
newAutoTuneOptionsOutput :: AutoTuneOptionsOutput
newAutoTuneOptionsOutput =
  AutoTuneOptionsOutput' :: Maybe AutoTuneState -> Maybe Text -> AutoTuneOptionsOutput
AutoTuneOptionsOutput'
    { $sel:state:AutoTuneOptionsOutput' :: Maybe AutoTuneState
state = Maybe AutoTuneState
forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:AutoTuneOptionsOutput' :: Maybe Text
errorMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The @AutoTuneState@ for the domain.
autoTuneOptionsOutput_state :: Lens.Lens' AutoTuneOptionsOutput (Prelude.Maybe AutoTuneState)
autoTuneOptionsOutput_state :: (Maybe AutoTuneState -> f (Maybe AutoTuneState))
-> AutoTuneOptionsOutput -> f AutoTuneOptionsOutput
autoTuneOptionsOutput_state = (AutoTuneOptionsOutput -> Maybe AutoTuneState)
-> (AutoTuneOptionsOutput
    -> Maybe AutoTuneState -> AutoTuneOptionsOutput)
-> Lens
     AutoTuneOptionsOutput
     AutoTuneOptionsOutput
     (Maybe AutoTuneState)
     (Maybe AutoTuneState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoTuneOptionsOutput' {Maybe AutoTuneState
state :: Maybe AutoTuneState
$sel:state:AutoTuneOptionsOutput' :: AutoTuneOptionsOutput -> Maybe AutoTuneState
state} -> Maybe AutoTuneState
state) (\s :: AutoTuneOptionsOutput
s@AutoTuneOptionsOutput' {} Maybe AutoTuneState
a -> AutoTuneOptionsOutput
s {$sel:state:AutoTuneOptionsOutput' :: Maybe AutoTuneState
state = Maybe AutoTuneState
a} :: AutoTuneOptionsOutput)

-- | The error message while enabling or disabling Auto-Tune.
autoTuneOptionsOutput_errorMessage :: Lens.Lens' AutoTuneOptionsOutput (Prelude.Maybe Prelude.Text)
autoTuneOptionsOutput_errorMessage :: (Maybe Text -> f (Maybe Text))
-> AutoTuneOptionsOutput -> f AutoTuneOptionsOutput
autoTuneOptionsOutput_errorMessage = (AutoTuneOptionsOutput -> Maybe Text)
-> (AutoTuneOptionsOutput -> Maybe Text -> AutoTuneOptionsOutput)
-> Lens
     AutoTuneOptionsOutput
     AutoTuneOptionsOutput
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoTuneOptionsOutput' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:AutoTuneOptionsOutput' :: AutoTuneOptionsOutput -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: AutoTuneOptionsOutput
s@AutoTuneOptionsOutput' {} Maybe Text
a -> AutoTuneOptionsOutput
s {$sel:errorMessage:AutoTuneOptionsOutput' :: Maybe Text
errorMessage = Maybe Text
a} :: AutoTuneOptionsOutput)

instance Core.FromJSON AutoTuneOptionsOutput where
  parseJSON :: Value -> Parser AutoTuneOptionsOutput
parseJSON =
    String
-> (Object -> Parser AutoTuneOptionsOutput)
-> Value
-> Parser AutoTuneOptionsOutput
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AutoTuneOptionsOutput"
      ( \Object
x ->
          Maybe AutoTuneState -> Maybe Text -> AutoTuneOptionsOutput
AutoTuneOptionsOutput'
            (Maybe AutoTuneState -> Maybe Text -> AutoTuneOptionsOutput)
-> Parser (Maybe AutoTuneState)
-> Parser (Maybe Text -> AutoTuneOptionsOutput)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AutoTuneState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
            Parser (Maybe Text -> AutoTuneOptionsOutput)
-> Parser (Maybe Text) -> Parser AutoTuneOptionsOutput
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ErrorMessage")
      )

instance Prelude.Hashable AutoTuneOptionsOutput

instance Prelude.NFData AutoTuneOptionsOutput