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

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

-- | Provides the current status of the Auto-Tune options.
--
-- /See:/ 'newAutoTuneStatus' smart constructor.
data AutoTuneStatus = AutoTuneStatus'
  { -- | Indicates whether the Elasticsearch domain is being deleted.
    AutoTuneStatus -> Maybe Bool
pendingDeletion :: Prelude.Maybe Prelude.Bool,
    -- | Specifies the error message while enabling or disabling the Auto-Tune
    -- options.
    AutoTuneStatus -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text,
    -- | Specifies the Auto-Tune options latest version.
    AutoTuneStatus -> Maybe Natural
updateVersion :: Prelude.Maybe Prelude.Natural,
    -- | Timestamp which tells Auto-Tune options creation date .
    AutoTuneStatus -> POSIX
creationDate :: Core.POSIX,
    -- | Timestamp which tells Auto-Tune options last updated time.
    AutoTuneStatus -> POSIX
updateDate :: Core.POSIX,
    -- | Specifies the @AutoTuneState@ for the Elasticsearch domain.
    AutoTuneStatus -> AutoTuneState
state :: AutoTuneState
  }
  deriving (AutoTuneStatus -> AutoTuneStatus -> Bool
(AutoTuneStatus -> AutoTuneStatus -> Bool)
-> (AutoTuneStatus -> AutoTuneStatus -> Bool) -> Eq AutoTuneStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutoTuneStatus -> AutoTuneStatus -> Bool
$c/= :: AutoTuneStatus -> AutoTuneStatus -> Bool
== :: AutoTuneStatus -> AutoTuneStatus -> Bool
$c== :: AutoTuneStatus -> AutoTuneStatus -> Bool
Prelude.Eq, ReadPrec [AutoTuneStatus]
ReadPrec AutoTuneStatus
Int -> ReadS AutoTuneStatus
ReadS [AutoTuneStatus]
(Int -> ReadS AutoTuneStatus)
-> ReadS [AutoTuneStatus]
-> ReadPrec AutoTuneStatus
-> ReadPrec [AutoTuneStatus]
-> Read AutoTuneStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutoTuneStatus]
$creadListPrec :: ReadPrec [AutoTuneStatus]
readPrec :: ReadPrec AutoTuneStatus
$creadPrec :: ReadPrec AutoTuneStatus
readList :: ReadS [AutoTuneStatus]
$creadList :: ReadS [AutoTuneStatus]
readsPrec :: Int -> ReadS AutoTuneStatus
$creadsPrec :: Int -> ReadS AutoTuneStatus
Prelude.Read, Int -> AutoTuneStatus -> ShowS
[AutoTuneStatus] -> ShowS
AutoTuneStatus -> String
(Int -> AutoTuneStatus -> ShowS)
-> (AutoTuneStatus -> String)
-> ([AutoTuneStatus] -> ShowS)
-> Show AutoTuneStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutoTuneStatus] -> ShowS
$cshowList :: [AutoTuneStatus] -> ShowS
show :: AutoTuneStatus -> String
$cshow :: AutoTuneStatus -> String
showsPrec :: Int -> AutoTuneStatus -> ShowS
$cshowsPrec :: Int -> AutoTuneStatus -> ShowS
Prelude.Show, (forall x. AutoTuneStatus -> Rep AutoTuneStatus x)
-> (forall x. Rep AutoTuneStatus x -> AutoTuneStatus)
-> Generic AutoTuneStatus
forall x. Rep AutoTuneStatus x -> AutoTuneStatus
forall x. AutoTuneStatus -> Rep AutoTuneStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AutoTuneStatus x -> AutoTuneStatus
$cfrom :: forall x. AutoTuneStatus -> Rep AutoTuneStatus x
Prelude.Generic)

-- |
-- Create a value of 'AutoTuneStatus' 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:
--
-- 'pendingDeletion', 'autoTuneStatus_pendingDeletion' - Indicates whether the Elasticsearch domain is being deleted.
--
-- 'errorMessage', 'autoTuneStatus_errorMessage' - Specifies the error message while enabling or disabling the Auto-Tune
-- options.
--
-- 'updateVersion', 'autoTuneStatus_updateVersion' - Specifies the Auto-Tune options latest version.
--
-- 'creationDate', 'autoTuneStatus_creationDate' - Timestamp which tells Auto-Tune options creation date .
--
-- 'updateDate', 'autoTuneStatus_updateDate' - Timestamp which tells Auto-Tune options last updated time.
--
-- 'state', 'autoTuneStatus_state' - Specifies the @AutoTuneState@ for the Elasticsearch domain.
newAutoTuneStatus ::
  -- | 'creationDate'
  Prelude.UTCTime ->
  -- | 'updateDate'
  Prelude.UTCTime ->
  -- | 'state'
  AutoTuneState ->
  AutoTuneStatus
newAutoTuneStatus :: UTCTime -> UTCTime -> AutoTuneState -> AutoTuneStatus
newAutoTuneStatus UTCTime
pCreationDate_ UTCTime
pUpdateDate_ AutoTuneState
pState_ =
  AutoTuneStatus' :: Maybe Bool
-> Maybe Text
-> Maybe Natural
-> POSIX
-> POSIX
-> AutoTuneState
-> AutoTuneStatus
AutoTuneStatus'
    { $sel:pendingDeletion:AutoTuneStatus' :: Maybe Bool
pendingDeletion = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:AutoTuneStatus' :: Maybe Text
errorMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:updateVersion:AutoTuneStatus' :: Maybe Natural
updateVersion = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:AutoTuneStatus' :: POSIX
creationDate = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreationDate_,
      $sel:updateDate:AutoTuneStatus' :: POSIX
updateDate = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pUpdateDate_,
      $sel:state:AutoTuneStatus' :: AutoTuneState
state = AutoTuneState
pState_
    }

-- | Indicates whether the Elasticsearch domain is being deleted.
autoTuneStatus_pendingDeletion :: Lens.Lens' AutoTuneStatus (Prelude.Maybe Prelude.Bool)
autoTuneStatus_pendingDeletion :: (Maybe Bool -> f (Maybe Bool))
-> AutoTuneStatus -> f AutoTuneStatus
autoTuneStatus_pendingDeletion = (AutoTuneStatus -> Maybe Bool)
-> (AutoTuneStatus -> Maybe Bool -> AutoTuneStatus)
-> Lens AutoTuneStatus AutoTuneStatus (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoTuneStatus' {Maybe Bool
pendingDeletion :: Maybe Bool
$sel:pendingDeletion:AutoTuneStatus' :: AutoTuneStatus -> Maybe Bool
pendingDeletion} -> Maybe Bool
pendingDeletion) (\s :: AutoTuneStatus
s@AutoTuneStatus' {} Maybe Bool
a -> AutoTuneStatus
s {$sel:pendingDeletion:AutoTuneStatus' :: Maybe Bool
pendingDeletion = Maybe Bool
a} :: AutoTuneStatus)

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

-- | Specifies the Auto-Tune options latest version.
autoTuneStatus_updateVersion :: Lens.Lens' AutoTuneStatus (Prelude.Maybe Prelude.Natural)
autoTuneStatus_updateVersion :: (Maybe Natural -> f (Maybe Natural))
-> AutoTuneStatus -> f AutoTuneStatus
autoTuneStatus_updateVersion = (AutoTuneStatus -> Maybe Natural)
-> (AutoTuneStatus -> Maybe Natural -> AutoTuneStatus)
-> Lens
     AutoTuneStatus AutoTuneStatus (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoTuneStatus' {Maybe Natural
updateVersion :: Maybe Natural
$sel:updateVersion:AutoTuneStatus' :: AutoTuneStatus -> Maybe Natural
updateVersion} -> Maybe Natural
updateVersion) (\s :: AutoTuneStatus
s@AutoTuneStatus' {} Maybe Natural
a -> AutoTuneStatus
s {$sel:updateVersion:AutoTuneStatus' :: Maybe Natural
updateVersion = Maybe Natural
a} :: AutoTuneStatus)

-- | Timestamp which tells Auto-Tune options creation date .
autoTuneStatus_creationDate :: Lens.Lens' AutoTuneStatus Prelude.UTCTime
autoTuneStatus_creationDate :: (UTCTime -> f UTCTime) -> AutoTuneStatus -> f AutoTuneStatus
autoTuneStatus_creationDate = (AutoTuneStatus -> POSIX)
-> (AutoTuneStatus -> POSIX -> AutoTuneStatus)
-> Lens AutoTuneStatus AutoTuneStatus POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoTuneStatus' {POSIX
creationDate :: POSIX
$sel:creationDate:AutoTuneStatus' :: AutoTuneStatus -> POSIX
creationDate} -> POSIX
creationDate) (\s :: AutoTuneStatus
s@AutoTuneStatus' {} POSIX
a -> AutoTuneStatus
s {$sel:creationDate:AutoTuneStatus' :: POSIX
creationDate = POSIX
a} :: AutoTuneStatus) ((POSIX -> f POSIX) -> AutoTuneStatus -> f AutoTuneStatus)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> AutoTuneStatus
-> f AutoTuneStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Timestamp which tells Auto-Tune options last updated time.
autoTuneStatus_updateDate :: Lens.Lens' AutoTuneStatus Prelude.UTCTime
autoTuneStatus_updateDate :: (UTCTime -> f UTCTime) -> AutoTuneStatus -> f AutoTuneStatus
autoTuneStatus_updateDate = (AutoTuneStatus -> POSIX)
-> (AutoTuneStatus -> POSIX -> AutoTuneStatus)
-> Lens AutoTuneStatus AutoTuneStatus POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoTuneStatus' {POSIX
updateDate :: POSIX
$sel:updateDate:AutoTuneStatus' :: AutoTuneStatus -> POSIX
updateDate} -> POSIX
updateDate) (\s :: AutoTuneStatus
s@AutoTuneStatus' {} POSIX
a -> AutoTuneStatus
s {$sel:updateDate:AutoTuneStatus' :: POSIX
updateDate = POSIX
a} :: AutoTuneStatus) ((POSIX -> f POSIX) -> AutoTuneStatus -> f AutoTuneStatus)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> AutoTuneStatus
-> f AutoTuneStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Specifies the @AutoTuneState@ for the Elasticsearch domain.
autoTuneStatus_state :: Lens.Lens' AutoTuneStatus AutoTuneState
autoTuneStatus_state :: (AutoTuneState -> f AutoTuneState)
-> AutoTuneStatus -> f AutoTuneStatus
autoTuneStatus_state = (AutoTuneStatus -> AutoTuneState)
-> (AutoTuneStatus -> AutoTuneState -> AutoTuneStatus)
-> Lens AutoTuneStatus AutoTuneStatus AutoTuneState AutoTuneState
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoTuneStatus' {AutoTuneState
state :: AutoTuneState
$sel:state:AutoTuneStatus' :: AutoTuneStatus -> AutoTuneState
state} -> AutoTuneState
state) (\s :: AutoTuneStatus
s@AutoTuneStatus' {} AutoTuneState
a -> AutoTuneStatus
s {$sel:state:AutoTuneStatus' :: AutoTuneState
state = AutoTuneState
a} :: AutoTuneStatus)

instance Core.FromJSON AutoTuneStatus where
  parseJSON :: Value -> Parser AutoTuneStatus
parseJSON =
    String
-> (Object -> Parser AutoTuneStatus)
-> Value
-> Parser AutoTuneStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AutoTuneStatus"
      ( \Object
x ->
          Maybe Bool
-> Maybe Text
-> Maybe Natural
-> POSIX
-> POSIX
-> AutoTuneState
-> AutoTuneStatus
AutoTuneStatus'
            (Maybe Bool
 -> Maybe Text
 -> Maybe Natural
 -> POSIX
 -> POSIX
 -> AutoTuneState
 -> AutoTuneStatus)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Natural
      -> POSIX
      -> POSIX
      -> AutoTuneState
      -> AutoTuneStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PendingDeletion")
            Parser
  (Maybe Text
   -> Maybe Natural
   -> POSIX
   -> POSIX
   -> AutoTuneState
   -> AutoTuneStatus)
-> Parser (Maybe Text)
-> Parser
     (Maybe Natural
      -> POSIX -> POSIX -> AutoTuneState -> AutoTuneStatus)
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")
            Parser
  (Maybe Natural
   -> POSIX -> POSIX -> AutoTuneState -> AutoTuneStatus)
-> Parser (Maybe Natural)
-> Parser (POSIX -> POSIX -> AutoTuneState -> AutoTuneStatus)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UpdateVersion")
            Parser (POSIX -> POSIX -> AutoTuneState -> AutoTuneStatus)
-> Parser POSIX
-> Parser (POSIX -> AutoTuneState -> AutoTuneStatus)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"CreationDate")
            Parser (POSIX -> AutoTuneState -> AutoTuneStatus)
-> Parser POSIX -> Parser (AutoTuneState -> AutoTuneStatus)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"UpdateDate")
            Parser (AutoTuneState -> AutoTuneStatus)
-> Parser AutoTuneState -> Parser AutoTuneStatus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser AutoTuneState
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"State")
      )

instance Prelude.Hashable AutoTuneStatus

instance Prelude.NFData AutoTuneStatus