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

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

-- | Provides the current status of the entity.
--
-- /See:/ 'newOptionStatus' smart constructor.
data OptionStatus = OptionStatus'
  { -- | Indicates whether the domain is being deleted.
    OptionStatus -> Maybe Bool
pendingDeletion :: Prelude.Maybe Prelude.Bool,
    -- | The latest version of the entity.
    OptionStatus -> Maybe Natural
updateVersion :: Prelude.Maybe Prelude.Natural,
    -- | The timestamp of when the entity was created.
    OptionStatus -> POSIX
creationDate :: Core.POSIX,
    -- | The timestamp of the last time the entity was updated.
    OptionStatus -> POSIX
updateDate :: Core.POSIX,
    -- | Provides the @OptionState@ for the domain.
    OptionStatus -> OptionState
state :: OptionState
  }
  deriving (OptionStatus -> OptionStatus -> Bool
(OptionStatus -> OptionStatus -> Bool)
-> (OptionStatus -> OptionStatus -> Bool) -> Eq OptionStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OptionStatus -> OptionStatus -> Bool
$c/= :: OptionStatus -> OptionStatus -> Bool
== :: OptionStatus -> OptionStatus -> Bool
$c== :: OptionStatus -> OptionStatus -> Bool
Prelude.Eq, ReadPrec [OptionStatus]
ReadPrec OptionStatus
Int -> ReadS OptionStatus
ReadS [OptionStatus]
(Int -> ReadS OptionStatus)
-> ReadS [OptionStatus]
-> ReadPrec OptionStatus
-> ReadPrec [OptionStatus]
-> Read OptionStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OptionStatus]
$creadListPrec :: ReadPrec [OptionStatus]
readPrec :: ReadPrec OptionStatus
$creadPrec :: ReadPrec OptionStatus
readList :: ReadS [OptionStatus]
$creadList :: ReadS [OptionStatus]
readsPrec :: Int -> ReadS OptionStatus
$creadsPrec :: Int -> ReadS OptionStatus
Prelude.Read, Int -> OptionStatus -> ShowS
[OptionStatus] -> ShowS
OptionStatus -> String
(Int -> OptionStatus -> ShowS)
-> (OptionStatus -> String)
-> ([OptionStatus] -> ShowS)
-> Show OptionStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OptionStatus] -> ShowS
$cshowList :: [OptionStatus] -> ShowS
show :: OptionStatus -> String
$cshow :: OptionStatus -> String
showsPrec :: Int -> OptionStatus -> ShowS
$cshowsPrec :: Int -> OptionStatus -> ShowS
Prelude.Show, (forall x. OptionStatus -> Rep OptionStatus x)
-> (forall x. Rep OptionStatus x -> OptionStatus)
-> Generic OptionStatus
forall x. Rep OptionStatus x -> OptionStatus
forall x. OptionStatus -> Rep OptionStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OptionStatus x -> OptionStatus
$cfrom :: forall x. OptionStatus -> Rep OptionStatus x
Prelude.Generic)

-- |
-- Create a value of 'OptionStatus' 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', 'optionStatus_pendingDeletion' - Indicates whether the domain is being deleted.
--
-- 'updateVersion', 'optionStatus_updateVersion' - The latest version of the entity.
--
-- 'creationDate', 'optionStatus_creationDate' - The timestamp of when the entity was created.
--
-- 'updateDate', 'optionStatus_updateDate' - The timestamp of the last time the entity was updated.
--
-- 'state', 'optionStatus_state' - Provides the @OptionState@ for the domain.
newOptionStatus ::
  -- | 'creationDate'
  Prelude.UTCTime ->
  -- | 'updateDate'
  Prelude.UTCTime ->
  -- | 'state'
  OptionState ->
  OptionStatus
newOptionStatus :: UTCTime -> UTCTime -> OptionState -> OptionStatus
newOptionStatus UTCTime
pCreationDate_ UTCTime
pUpdateDate_ OptionState
pState_ =
  OptionStatus' :: Maybe Bool
-> Maybe Natural -> POSIX -> POSIX -> OptionState -> OptionStatus
OptionStatus'
    { $sel:pendingDeletion:OptionStatus' :: Maybe Bool
pendingDeletion = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:updateVersion:OptionStatus' :: Maybe Natural
updateVersion = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:OptionStatus' :: 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:OptionStatus' :: 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:OptionStatus' :: OptionState
state = OptionState
pState_
    }

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

-- | The latest version of the entity.
optionStatus_updateVersion :: Lens.Lens' OptionStatus (Prelude.Maybe Prelude.Natural)
optionStatus_updateVersion :: (Maybe Natural -> f (Maybe Natural))
-> OptionStatus -> f OptionStatus
optionStatus_updateVersion = (OptionStatus -> Maybe Natural)
-> (OptionStatus -> Maybe Natural -> OptionStatus)
-> Lens OptionStatus OptionStatus (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionStatus' {Maybe Natural
updateVersion :: Maybe Natural
$sel:updateVersion:OptionStatus' :: OptionStatus -> Maybe Natural
updateVersion} -> Maybe Natural
updateVersion) (\s :: OptionStatus
s@OptionStatus' {} Maybe Natural
a -> OptionStatus
s {$sel:updateVersion:OptionStatus' :: Maybe Natural
updateVersion = Maybe Natural
a} :: OptionStatus)

-- | The timestamp of when the entity was created.
optionStatus_creationDate :: Lens.Lens' OptionStatus Prelude.UTCTime
optionStatus_creationDate :: (UTCTime -> f UTCTime) -> OptionStatus -> f OptionStatus
optionStatus_creationDate = (OptionStatus -> POSIX)
-> (OptionStatus -> POSIX -> OptionStatus)
-> Lens OptionStatus OptionStatus POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionStatus' {POSIX
creationDate :: POSIX
$sel:creationDate:OptionStatus' :: OptionStatus -> POSIX
creationDate} -> POSIX
creationDate) (\s :: OptionStatus
s@OptionStatus' {} POSIX
a -> OptionStatus
s {$sel:creationDate:OptionStatus' :: POSIX
creationDate = POSIX
a} :: OptionStatus) ((POSIX -> f POSIX) -> OptionStatus -> f OptionStatus)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> OptionStatus
-> f OptionStatus
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

-- | The timestamp of the last time the entity was updated.
optionStatus_updateDate :: Lens.Lens' OptionStatus Prelude.UTCTime
optionStatus_updateDate :: (UTCTime -> f UTCTime) -> OptionStatus -> f OptionStatus
optionStatus_updateDate = (OptionStatus -> POSIX)
-> (OptionStatus -> POSIX -> OptionStatus)
-> Lens OptionStatus OptionStatus POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionStatus' {POSIX
updateDate :: POSIX
$sel:updateDate:OptionStatus' :: OptionStatus -> POSIX
updateDate} -> POSIX
updateDate) (\s :: OptionStatus
s@OptionStatus' {} POSIX
a -> OptionStatus
s {$sel:updateDate:OptionStatus' :: POSIX
updateDate = POSIX
a} :: OptionStatus) ((POSIX -> f POSIX) -> OptionStatus -> f OptionStatus)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> OptionStatus
-> f OptionStatus
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

-- | Provides the @OptionState@ for the domain.
optionStatus_state :: Lens.Lens' OptionStatus OptionState
optionStatus_state :: (OptionState -> f OptionState) -> OptionStatus -> f OptionStatus
optionStatus_state = (OptionStatus -> OptionState)
-> (OptionStatus -> OptionState -> OptionStatus)
-> Lens OptionStatus OptionStatus OptionState OptionState
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionStatus' {OptionState
state :: OptionState
$sel:state:OptionStatus' :: OptionStatus -> OptionState
state} -> OptionState
state) (\s :: OptionStatus
s@OptionStatus' {} OptionState
a -> OptionStatus
s {$sel:state:OptionStatus' :: OptionState
state = OptionState
a} :: OptionStatus)

instance Core.FromJSON OptionStatus where
  parseJSON :: Value -> Parser OptionStatus
parseJSON =
    String
-> (Object -> Parser OptionStatus) -> Value -> Parser OptionStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OptionStatus"
      ( \Object
x ->
          Maybe Bool
-> Maybe Natural -> POSIX -> POSIX -> OptionState -> OptionStatus
OptionStatus'
            (Maybe Bool
 -> Maybe Natural -> POSIX -> POSIX -> OptionState -> OptionStatus)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Natural -> POSIX -> POSIX -> OptionState -> OptionStatus)
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 Natural -> POSIX -> POSIX -> OptionState -> OptionStatus)
-> Parser (Maybe Natural)
-> Parser (POSIX -> POSIX -> OptionState -> OptionStatus)
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 -> OptionState -> OptionStatus)
-> Parser POSIX -> Parser (POSIX -> OptionState -> OptionStatus)
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 -> OptionState -> OptionStatus)
-> Parser POSIX -> Parser (OptionState -> OptionStatus)
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 (OptionState -> OptionStatus)
-> Parser OptionState -> Parser OptionStatus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser OptionState
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"State")
      )

instance Prelude.Hashable OptionStatus

instance Prelude.NFData OptionStatus