{-# 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.Lightsail.Types.NameServersUpdateState
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Lightsail.Types.NameServersUpdateState where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Lightsail.Types.NameServersUpdateStateCode
import qualified Amazonka.Prelude as Prelude

-- | Describes the state of the name server records update made by Amazon
-- Lightsail to an Amazon Route 53 registered domain.
--
-- For more information, see
-- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/understanding-dns-in-amazon-lightsail DNS in Amazon Lightsail>
-- in the /Amazon Lightsail Developer Guide/.
--
-- /See:/ 'newNameServersUpdateState' smart constructor.
data NameServersUpdateState = NameServersUpdateState'
  { -- | The status code for the name servers update.
    --
    -- Following are the possible values:
    --
    -- -   @SUCCEEDED@ - The name server records were successfully updated.
    --
    -- -   @PENDING@ - The name server record update is in progress.
    --
    -- -   @FAILED@ - The name server record update failed.
    --
    -- -   @STARTED@ - The automatic name server record update started.
    NameServersUpdateState -> Maybe NameServersUpdateStateCode
code :: Prelude.Maybe NameServersUpdateStateCode,
    -- | The message that describes the reason for the status code.
    NameServersUpdateState -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (NameServersUpdateState -> NameServersUpdateState -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NameServersUpdateState -> NameServersUpdateState -> Bool
$c/= :: NameServersUpdateState -> NameServersUpdateState -> Bool
== :: NameServersUpdateState -> NameServersUpdateState -> Bool
$c== :: NameServersUpdateState -> NameServersUpdateState -> Bool
Prelude.Eq, ReadPrec [NameServersUpdateState]
ReadPrec NameServersUpdateState
Int -> ReadS NameServersUpdateState
ReadS [NameServersUpdateState]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NameServersUpdateState]
$creadListPrec :: ReadPrec [NameServersUpdateState]
readPrec :: ReadPrec NameServersUpdateState
$creadPrec :: ReadPrec NameServersUpdateState
readList :: ReadS [NameServersUpdateState]
$creadList :: ReadS [NameServersUpdateState]
readsPrec :: Int -> ReadS NameServersUpdateState
$creadsPrec :: Int -> ReadS NameServersUpdateState
Prelude.Read, Int -> NameServersUpdateState -> ShowS
[NameServersUpdateState] -> ShowS
NameServersUpdateState -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NameServersUpdateState] -> ShowS
$cshowList :: [NameServersUpdateState] -> ShowS
show :: NameServersUpdateState -> String
$cshow :: NameServersUpdateState -> String
showsPrec :: Int -> NameServersUpdateState -> ShowS
$cshowsPrec :: Int -> NameServersUpdateState -> ShowS
Prelude.Show, forall x. Rep NameServersUpdateState x -> NameServersUpdateState
forall x. NameServersUpdateState -> Rep NameServersUpdateState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NameServersUpdateState x -> NameServersUpdateState
$cfrom :: forall x. NameServersUpdateState -> Rep NameServersUpdateState x
Prelude.Generic)

-- |
-- Create a value of 'NameServersUpdateState' 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:
--
-- 'code', 'nameServersUpdateState_code' - The status code for the name servers update.
--
-- Following are the possible values:
--
-- -   @SUCCEEDED@ - The name server records were successfully updated.
--
-- -   @PENDING@ - The name server record update is in progress.
--
-- -   @FAILED@ - The name server record update failed.
--
-- -   @STARTED@ - The automatic name server record update started.
--
-- 'message', 'nameServersUpdateState_message' - The message that describes the reason for the status code.
newNameServersUpdateState ::
  NameServersUpdateState
newNameServersUpdateState :: NameServersUpdateState
newNameServersUpdateState =
  NameServersUpdateState'
    { $sel:code:NameServersUpdateState' :: Maybe NameServersUpdateStateCode
code = forall a. Maybe a
Prelude.Nothing,
      $sel:message:NameServersUpdateState' :: Maybe Text
message = forall a. Maybe a
Prelude.Nothing
    }

-- | The status code for the name servers update.
--
-- Following are the possible values:
--
-- -   @SUCCEEDED@ - The name server records were successfully updated.
--
-- -   @PENDING@ - The name server record update is in progress.
--
-- -   @FAILED@ - The name server record update failed.
--
-- -   @STARTED@ - The automatic name server record update started.
nameServersUpdateState_code :: Lens.Lens' NameServersUpdateState (Prelude.Maybe NameServersUpdateStateCode)
nameServersUpdateState_code :: Lens' NameServersUpdateState (Maybe NameServersUpdateStateCode)
nameServersUpdateState_code = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NameServersUpdateState' {Maybe NameServersUpdateStateCode
code :: Maybe NameServersUpdateStateCode
$sel:code:NameServersUpdateState' :: NameServersUpdateState -> Maybe NameServersUpdateStateCode
code} -> Maybe NameServersUpdateStateCode
code) (\s :: NameServersUpdateState
s@NameServersUpdateState' {} Maybe NameServersUpdateStateCode
a -> NameServersUpdateState
s {$sel:code:NameServersUpdateState' :: Maybe NameServersUpdateStateCode
code = Maybe NameServersUpdateStateCode
a} :: NameServersUpdateState)

-- | The message that describes the reason for the status code.
nameServersUpdateState_message :: Lens.Lens' NameServersUpdateState (Prelude.Maybe Prelude.Text)
nameServersUpdateState_message :: Lens' NameServersUpdateState (Maybe Text)
nameServersUpdateState_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NameServersUpdateState' {Maybe Text
message :: Maybe Text
$sel:message:NameServersUpdateState' :: NameServersUpdateState -> Maybe Text
message} -> Maybe Text
message) (\s :: NameServersUpdateState
s@NameServersUpdateState' {} Maybe Text
a -> NameServersUpdateState
s {$sel:message:NameServersUpdateState' :: Maybe Text
message = Maybe Text
a} :: NameServersUpdateState)

instance Data.FromJSON NameServersUpdateState where
  parseJSON :: Value -> Parser NameServersUpdateState
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NameServersUpdateState"
      ( \Object
x ->
          Maybe NameServersUpdateStateCode
-> Maybe Text -> NameServersUpdateState
NameServersUpdateState'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"code")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"message")
      )

instance Prelude.Hashable NameServersUpdateState where
  hashWithSalt :: Int -> NameServersUpdateState -> Int
hashWithSalt Int
_salt NameServersUpdateState' {Maybe Text
Maybe NameServersUpdateStateCode
message :: Maybe Text
code :: Maybe NameServersUpdateStateCode
$sel:message:NameServersUpdateState' :: NameServersUpdateState -> Maybe Text
$sel:code:NameServersUpdateState' :: NameServersUpdateState -> Maybe NameServersUpdateStateCode
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NameServersUpdateStateCode
code
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message

instance Prelude.NFData NameServersUpdateState where
  rnf :: NameServersUpdateState -> ()
rnf NameServersUpdateState' {Maybe Text
Maybe NameServersUpdateStateCode
message :: Maybe Text
code :: Maybe NameServersUpdateStateCode
$sel:message:NameServersUpdateState' :: NameServersUpdateState -> Maybe Text
$sel:code:NameServersUpdateState' :: NameServersUpdateState -> Maybe NameServersUpdateStateCode
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe NameServersUpdateStateCode
code seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message