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

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

-- | The status of domain configuration option.
--
-- /See:/ 'newOptionStatus' smart constructor.
data OptionStatus = OptionStatus'
  { -- | Indicates that the option will be deleted once processing is complete.
    OptionStatus -> Maybe Bool
pendingDeletion :: Prelude.Maybe Prelude.Bool,
    -- | A unique integer that indicates when this option was last updated.
    OptionStatus -> Maybe Natural
updateVersion :: Prelude.Maybe Prelude.Natural,
    -- | A timestamp for when this option was created.
    OptionStatus -> ISO8601
creationDate :: Core.ISO8601,
    -- | A timestamp for when this option was last updated.
    OptionStatus -> ISO8601
updateDate :: Core.ISO8601,
    -- | The state of processing a change to an option. Possible values:
    --
    -- -   @RequiresIndexDocuments@: the option\'s latest value will not be
    --     deployed until IndexDocuments has been called and indexing is
    --     complete.
    -- -   @Processing@: the option\'s latest value is in the process of being
    --     activated.
    -- -   @Active@: the option\'s latest value is completely deployed.
    -- -   @FailedToValidate@: the option value is not compatible with the
    --     domain\'s data and cannot be used to index the data. You must either
    --     modify the option value or update or remove the incompatible
    --     documents.
    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 that the option will be deleted once processing is complete.
--
-- 'updateVersion', 'optionStatus_updateVersion' - A unique integer that indicates when this option was last updated.
--
-- 'creationDate', 'optionStatus_creationDate' - A timestamp for when this option was created.
--
-- 'updateDate', 'optionStatus_updateDate' - A timestamp for when this option was last updated.
--
-- 'state', 'optionStatus_state' - The state of processing a change to an option. Possible values:
--
-- -   @RequiresIndexDocuments@: the option\'s latest value will not be
--     deployed until IndexDocuments has been called and indexing is
--     complete.
-- -   @Processing@: the option\'s latest value is in the process of being
--     activated.
-- -   @Active@: the option\'s latest value is completely deployed.
-- -   @FailedToValidate@: the option value is not compatible with the
--     domain\'s data and cannot be used to index the data. You must either
--     modify the option value or update or remove the incompatible
--     documents.
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
-> ISO8601
-> ISO8601
-> 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' :: ISO8601
creationDate = Tagged UTCTime (Identity UTCTime)
-> Tagged ISO8601 (Identity ISO8601)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged ISO8601 (Identity ISO8601))
-> UTCTime -> ISO8601
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreationDate_,
      $sel:updateDate:OptionStatus' :: ISO8601
updateDate = Tagged UTCTime (Identity UTCTime)
-> Tagged ISO8601 (Identity ISO8601)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged ISO8601 (Identity ISO8601))
-> UTCTime -> ISO8601
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pUpdateDate_,
      $sel:state:OptionStatus' :: OptionState
state = OptionState
pState_
    }

-- | Indicates that the option will be deleted once processing is complete.
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)

-- | A unique integer that indicates when this option was last updated.
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)

-- | A timestamp for when this option was created.
optionStatus_creationDate :: Lens.Lens' OptionStatus Prelude.UTCTime
optionStatus_creationDate :: (UTCTime -> f UTCTime) -> OptionStatus -> f OptionStatus
optionStatus_creationDate = (OptionStatus -> ISO8601)
-> (OptionStatus -> ISO8601 -> OptionStatus)
-> Lens OptionStatus OptionStatus ISO8601 ISO8601
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionStatus' {ISO8601
creationDate :: ISO8601
$sel:creationDate:OptionStatus' :: OptionStatus -> ISO8601
creationDate} -> ISO8601
creationDate) (\s :: OptionStatus
s@OptionStatus' {} ISO8601
a -> OptionStatus
s {$sel:creationDate:OptionStatus' :: ISO8601
creationDate = ISO8601
a} :: OptionStatus) ((ISO8601 -> f ISO8601) -> OptionStatus -> f OptionStatus)
-> ((UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601)
-> (UTCTime -> f UTCTime)
-> OptionStatus
-> f OptionStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | A timestamp for when this option was last updated.
optionStatus_updateDate :: Lens.Lens' OptionStatus Prelude.UTCTime
optionStatus_updateDate :: (UTCTime -> f UTCTime) -> OptionStatus -> f OptionStatus
optionStatus_updateDate = (OptionStatus -> ISO8601)
-> (OptionStatus -> ISO8601 -> OptionStatus)
-> Lens OptionStatus OptionStatus ISO8601 ISO8601
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptionStatus' {ISO8601
updateDate :: ISO8601
$sel:updateDate:OptionStatus' :: OptionStatus -> ISO8601
updateDate} -> ISO8601
updateDate) (\s :: OptionStatus
s@OptionStatus' {} ISO8601
a -> OptionStatus
s {$sel:updateDate:OptionStatus' :: ISO8601
updateDate = ISO8601
a} :: OptionStatus) ((ISO8601 -> f ISO8601) -> OptionStatus -> f OptionStatus)
-> ((UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601)
-> (UTCTime -> f UTCTime)
-> OptionStatus
-> f OptionStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The state of processing a change to an option. Possible values:
--
-- -   @RequiresIndexDocuments@: the option\'s latest value will not be
--     deployed until IndexDocuments has been called and indexing is
--     complete.
-- -   @Processing@: the option\'s latest value is in the process of being
--     activated.
-- -   @Active@: the option\'s latest value is completely deployed.
-- -   @FailedToValidate@: the option value is not compatible with the
--     domain\'s data and cannot be used to index the data. You must either
--     modify the option value or update or remove the incompatible
--     documents.
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.FromXML OptionStatus where
  parseXML :: [Node] -> Either String OptionStatus
parseXML [Node]
x =
    Maybe Bool
-> Maybe Natural
-> ISO8601
-> ISO8601
-> OptionState
-> OptionStatus
OptionStatus'
      (Maybe Bool
 -> Maybe Natural
 -> ISO8601
 -> ISO8601
 -> OptionState
 -> OptionStatus)
-> Either String (Maybe Bool)
-> Either
     String
     (Maybe Natural
      -> ISO8601 -> ISO8601 -> OptionState -> OptionStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PendingDeletion")
      Either
  String
  (Maybe Natural
   -> ISO8601 -> ISO8601 -> OptionState -> OptionStatus)
-> Either String (Maybe Natural)
-> Either
     String (ISO8601 -> ISO8601 -> OptionState -> OptionStatus)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Natural)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"UpdateVersion")
      Either String (ISO8601 -> ISO8601 -> OptionState -> OptionStatus)
-> Either String ISO8601
-> Either String (ISO8601 -> OptionState -> OptionStatus)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ISO8601
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"CreationDate")
      Either String (ISO8601 -> OptionState -> OptionStatus)
-> Either String ISO8601
-> Either String (OptionState -> OptionStatus)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ISO8601
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"UpdateDate")
      Either String (OptionState -> OptionStatus)
-> Either String OptionState -> Either String OptionStatus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String OptionState
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"State")

instance Prelude.Hashable OptionStatus

instance Prelude.NFData OptionStatus