{-# 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.AutoTune
-- 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.AutoTune where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpenSearch.Types.AutoTuneDetails
import Amazonka.OpenSearch.Types.AutoTuneType
import qualified Amazonka.Prelude as Prelude

-- | Specifies the Auto-Tune type and Auto-Tune action details.
--
-- /See:/ 'newAutoTune' smart constructor.
data AutoTune = AutoTune'
  { -- | Specifies details about the Auto-Tune action. See
    -- <https://docs.aws.amazon.com/opensearch-service/latest/developerguide/auto-tune.html Auto-Tune for Amazon OpenSearch Service>
    -- for more information.
    AutoTune -> Maybe AutoTuneDetails
autoTuneDetails :: Prelude.Maybe AutoTuneDetails,
    -- | Specifies the Auto-Tune type. Valid value is SCHEDULED_ACTION.
    AutoTune -> Maybe AutoTuneType
autoTuneType :: Prelude.Maybe AutoTuneType
  }
  deriving (AutoTune -> AutoTune -> Bool
(AutoTune -> AutoTune -> Bool)
-> (AutoTune -> AutoTune -> Bool) -> Eq AutoTune
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutoTune -> AutoTune -> Bool
$c/= :: AutoTune -> AutoTune -> Bool
== :: AutoTune -> AutoTune -> Bool
$c== :: AutoTune -> AutoTune -> Bool
Prelude.Eq, ReadPrec [AutoTune]
ReadPrec AutoTune
Int -> ReadS AutoTune
ReadS [AutoTune]
(Int -> ReadS AutoTune)
-> ReadS [AutoTune]
-> ReadPrec AutoTune
-> ReadPrec [AutoTune]
-> Read AutoTune
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutoTune]
$creadListPrec :: ReadPrec [AutoTune]
readPrec :: ReadPrec AutoTune
$creadPrec :: ReadPrec AutoTune
readList :: ReadS [AutoTune]
$creadList :: ReadS [AutoTune]
readsPrec :: Int -> ReadS AutoTune
$creadsPrec :: Int -> ReadS AutoTune
Prelude.Read, Int -> AutoTune -> ShowS
[AutoTune] -> ShowS
AutoTune -> String
(Int -> AutoTune -> ShowS)
-> (AutoTune -> String) -> ([AutoTune] -> ShowS) -> Show AutoTune
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutoTune] -> ShowS
$cshowList :: [AutoTune] -> ShowS
show :: AutoTune -> String
$cshow :: AutoTune -> String
showsPrec :: Int -> AutoTune -> ShowS
$cshowsPrec :: Int -> AutoTune -> ShowS
Prelude.Show, (forall x. AutoTune -> Rep AutoTune x)
-> (forall x. Rep AutoTune x -> AutoTune) -> Generic AutoTune
forall x. Rep AutoTune x -> AutoTune
forall x. AutoTune -> Rep AutoTune x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AutoTune x -> AutoTune
$cfrom :: forall x. AutoTune -> Rep AutoTune x
Prelude.Generic)

-- |
-- Create a value of 'AutoTune' 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:
--
-- 'autoTuneDetails', 'autoTune_autoTuneDetails' - Specifies details about the Auto-Tune action. See
-- <https://docs.aws.amazon.com/opensearch-service/latest/developerguide/auto-tune.html Auto-Tune for Amazon OpenSearch Service>
-- for more information.
--
-- 'autoTuneType', 'autoTune_autoTuneType' - Specifies the Auto-Tune type. Valid value is SCHEDULED_ACTION.
newAutoTune ::
  AutoTune
newAutoTune :: AutoTune
newAutoTune =
  AutoTune' :: Maybe AutoTuneDetails -> Maybe AutoTuneType -> AutoTune
AutoTune'
    { $sel:autoTuneDetails:AutoTune' :: Maybe AutoTuneDetails
autoTuneDetails = Maybe AutoTuneDetails
forall a. Maybe a
Prelude.Nothing,
      $sel:autoTuneType:AutoTune' :: Maybe AutoTuneType
autoTuneType = Maybe AutoTuneType
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies details about the Auto-Tune action. See
-- <https://docs.aws.amazon.com/opensearch-service/latest/developerguide/auto-tune.html Auto-Tune for Amazon OpenSearch Service>
-- for more information.
autoTune_autoTuneDetails :: Lens.Lens' AutoTune (Prelude.Maybe AutoTuneDetails)
autoTune_autoTuneDetails :: (Maybe AutoTuneDetails -> f (Maybe AutoTuneDetails))
-> AutoTune -> f AutoTune
autoTune_autoTuneDetails = (AutoTune -> Maybe AutoTuneDetails)
-> (AutoTune -> Maybe AutoTuneDetails -> AutoTune)
-> Lens
     AutoTune AutoTune (Maybe AutoTuneDetails) (Maybe AutoTuneDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoTune' {Maybe AutoTuneDetails
autoTuneDetails :: Maybe AutoTuneDetails
$sel:autoTuneDetails:AutoTune' :: AutoTune -> Maybe AutoTuneDetails
autoTuneDetails} -> Maybe AutoTuneDetails
autoTuneDetails) (\s :: AutoTune
s@AutoTune' {} Maybe AutoTuneDetails
a -> AutoTune
s {$sel:autoTuneDetails:AutoTune' :: Maybe AutoTuneDetails
autoTuneDetails = Maybe AutoTuneDetails
a} :: AutoTune)

-- | Specifies the Auto-Tune type. Valid value is SCHEDULED_ACTION.
autoTune_autoTuneType :: Lens.Lens' AutoTune (Prelude.Maybe AutoTuneType)
autoTune_autoTuneType :: (Maybe AutoTuneType -> f (Maybe AutoTuneType))
-> AutoTune -> f AutoTune
autoTune_autoTuneType = (AutoTune -> Maybe AutoTuneType)
-> (AutoTune -> Maybe AutoTuneType -> AutoTune)
-> Lens AutoTune AutoTune (Maybe AutoTuneType) (Maybe AutoTuneType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoTune' {Maybe AutoTuneType
autoTuneType :: Maybe AutoTuneType
$sel:autoTuneType:AutoTune' :: AutoTune -> Maybe AutoTuneType
autoTuneType} -> Maybe AutoTuneType
autoTuneType) (\s :: AutoTune
s@AutoTune' {} Maybe AutoTuneType
a -> AutoTune
s {$sel:autoTuneType:AutoTune' :: Maybe AutoTuneType
autoTuneType = Maybe AutoTuneType
a} :: AutoTune)

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

instance Prelude.Hashable AutoTune

instance Prelude.NFData AutoTune