{-# 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.Route53.Types.ChangeInfo
-- 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.Route53.Types.ChangeInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53.Internal
import Amazonka.Route53.Types.ChangeStatus

-- | A complex type that describes change information about changes made to
-- your hosted zone.
--
-- /See:/ 'newChangeInfo' smart constructor.
data ChangeInfo = ChangeInfo'
  { -- | A comment you can provide.
    ChangeInfo -> Maybe Text
comment :: Prelude.Maybe Prelude.Text,
    -- | This element contains an ID that you use when performing a
    -- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetChange.html GetChange>
    -- action to get detailed information about the change.
    ChangeInfo -> ResourceId
id :: ResourceId,
    -- | The current state of the request. @PENDING@ indicates that this request
    -- has not yet been applied to all Amazon Route 53 DNS servers.
    ChangeInfo -> ChangeStatus
status :: ChangeStatus,
    -- | The date and time that the change request was submitted in
    -- <https://en.wikipedia.org/wiki/ISO_8601 ISO 8601 format> and Coordinated
    -- Universal Time (UTC). For example, the value @2017-03-27T17:48:16.751Z@
    -- represents March 27, 2017 at 17:48:16.751 UTC.
    ChangeInfo -> ISO8601
submittedAt :: Data.ISO8601
  }
  deriving (ChangeInfo -> ChangeInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChangeInfo -> ChangeInfo -> Bool
$c/= :: ChangeInfo -> ChangeInfo -> Bool
== :: ChangeInfo -> ChangeInfo -> Bool
$c== :: ChangeInfo -> ChangeInfo -> Bool
Prelude.Eq, ReadPrec [ChangeInfo]
ReadPrec ChangeInfo
Int -> ReadS ChangeInfo
ReadS [ChangeInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChangeInfo]
$creadListPrec :: ReadPrec [ChangeInfo]
readPrec :: ReadPrec ChangeInfo
$creadPrec :: ReadPrec ChangeInfo
readList :: ReadS [ChangeInfo]
$creadList :: ReadS [ChangeInfo]
readsPrec :: Int -> ReadS ChangeInfo
$creadsPrec :: Int -> ReadS ChangeInfo
Prelude.Read, Int -> ChangeInfo -> ShowS
[ChangeInfo] -> ShowS
ChangeInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChangeInfo] -> ShowS
$cshowList :: [ChangeInfo] -> ShowS
show :: ChangeInfo -> String
$cshow :: ChangeInfo -> String
showsPrec :: Int -> ChangeInfo -> ShowS
$cshowsPrec :: Int -> ChangeInfo -> ShowS
Prelude.Show, forall x. Rep ChangeInfo x -> ChangeInfo
forall x. ChangeInfo -> Rep ChangeInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChangeInfo x -> ChangeInfo
$cfrom :: forall x. ChangeInfo -> Rep ChangeInfo x
Prelude.Generic)

-- |
-- Create a value of 'ChangeInfo' 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:
--
-- 'comment', 'changeInfo_comment' - A comment you can provide.
--
-- 'id', 'changeInfo_id' - This element contains an ID that you use when performing a
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetChange.html GetChange>
-- action to get detailed information about the change.
--
-- 'status', 'changeInfo_status' - The current state of the request. @PENDING@ indicates that this request
-- has not yet been applied to all Amazon Route 53 DNS servers.
--
-- 'submittedAt', 'changeInfo_submittedAt' - The date and time that the change request was submitted in
-- <https://en.wikipedia.org/wiki/ISO_8601 ISO 8601 format> and Coordinated
-- Universal Time (UTC). For example, the value @2017-03-27T17:48:16.751Z@
-- represents March 27, 2017 at 17:48:16.751 UTC.
newChangeInfo ::
  -- | 'id'
  ResourceId ->
  -- | 'status'
  ChangeStatus ->
  -- | 'submittedAt'
  Prelude.UTCTime ->
  ChangeInfo
newChangeInfo :: ResourceId -> ChangeStatus -> UTCTime -> ChangeInfo
newChangeInfo ResourceId
pId_ ChangeStatus
pStatus_ UTCTime
pSubmittedAt_ =
  ChangeInfo'
    { $sel:comment:ChangeInfo' :: Maybe Text
comment = forall a. Maybe a
Prelude.Nothing,
      $sel:id:ChangeInfo' :: ResourceId
id = ResourceId
pId_,
      $sel:status:ChangeInfo' :: ChangeStatus
status = ChangeStatus
pStatus_,
      $sel:submittedAt:ChangeInfo' :: ISO8601
submittedAt = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pSubmittedAt_
    }

-- | A comment you can provide.
changeInfo_comment :: Lens.Lens' ChangeInfo (Prelude.Maybe Prelude.Text)
changeInfo_comment :: Lens' ChangeInfo (Maybe Text)
changeInfo_comment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChangeInfo' {Maybe Text
comment :: Maybe Text
$sel:comment:ChangeInfo' :: ChangeInfo -> Maybe Text
comment} -> Maybe Text
comment) (\s :: ChangeInfo
s@ChangeInfo' {} Maybe Text
a -> ChangeInfo
s {$sel:comment:ChangeInfo' :: Maybe Text
comment = Maybe Text
a} :: ChangeInfo)

-- | This element contains an ID that you use when performing a
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetChange.html GetChange>
-- action to get detailed information about the change.
changeInfo_id :: Lens.Lens' ChangeInfo ResourceId
changeInfo_id :: Lens' ChangeInfo ResourceId
changeInfo_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChangeInfo' {ResourceId
id :: ResourceId
$sel:id:ChangeInfo' :: ChangeInfo -> ResourceId
id} -> ResourceId
id) (\s :: ChangeInfo
s@ChangeInfo' {} ResourceId
a -> ChangeInfo
s {$sel:id:ChangeInfo' :: ResourceId
id = ResourceId
a} :: ChangeInfo)

-- | The current state of the request. @PENDING@ indicates that this request
-- has not yet been applied to all Amazon Route 53 DNS servers.
changeInfo_status :: Lens.Lens' ChangeInfo ChangeStatus
changeInfo_status :: Lens' ChangeInfo ChangeStatus
changeInfo_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChangeInfo' {ChangeStatus
status :: ChangeStatus
$sel:status:ChangeInfo' :: ChangeInfo -> ChangeStatus
status} -> ChangeStatus
status) (\s :: ChangeInfo
s@ChangeInfo' {} ChangeStatus
a -> ChangeInfo
s {$sel:status:ChangeInfo' :: ChangeStatus
status = ChangeStatus
a} :: ChangeInfo)

-- | The date and time that the change request was submitted in
-- <https://en.wikipedia.org/wiki/ISO_8601 ISO 8601 format> and Coordinated
-- Universal Time (UTC). For example, the value @2017-03-27T17:48:16.751Z@
-- represents March 27, 2017 at 17:48:16.751 UTC.
changeInfo_submittedAt :: Lens.Lens' ChangeInfo Prelude.UTCTime
changeInfo_submittedAt :: Lens' ChangeInfo UTCTime
changeInfo_submittedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChangeInfo' {ISO8601
submittedAt :: ISO8601
$sel:submittedAt:ChangeInfo' :: ChangeInfo -> ISO8601
submittedAt} -> ISO8601
submittedAt) (\s :: ChangeInfo
s@ChangeInfo' {} ISO8601
a -> ChangeInfo
s {$sel:submittedAt:ChangeInfo' :: ISO8601
submittedAt = ISO8601
a} :: ChangeInfo) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromXML ChangeInfo where
  parseXML :: [Node] -> Either String ChangeInfo
parseXML [Node]
x =
    Maybe Text -> ResourceId -> ChangeStatus -> ISO8601 -> ChangeInfo
ChangeInfo'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Comment")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"Id")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"Status")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"SubmittedAt")

instance Prelude.Hashable ChangeInfo where
  hashWithSalt :: Int -> ChangeInfo -> Int
hashWithSalt Int
_salt ChangeInfo' {Maybe Text
ISO8601
ResourceId
ChangeStatus
submittedAt :: ISO8601
status :: ChangeStatus
id :: ResourceId
comment :: Maybe Text
$sel:submittedAt:ChangeInfo' :: ChangeInfo -> ISO8601
$sel:status:ChangeInfo' :: ChangeInfo -> ChangeStatus
$sel:id:ChangeInfo' :: ChangeInfo -> ResourceId
$sel:comment:ChangeInfo' :: ChangeInfo -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
comment
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ResourceId
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ChangeStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
submittedAt

instance Prelude.NFData ChangeInfo where
  rnf :: ChangeInfo -> ()
rnf ChangeInfo' {Maybe Text
ISO8601
ResourceId
ChangeStatus
submittedAt :: ISO8601
status :: ChangeStatus
id :: ResourceId
comment :: Maybe Text
$sel:submittedAt:ChangeInfo' :: ChangeInfo -> ISO8601
$sel:status:ChangeInfo' :: ChangeInfo -> ChangeStatus
$sel:id:ChangeInfo' :: ChangeInfo -> ResourceId
$sel:comment:ChangeInfo' :: ChangeInfo -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
comment
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ResourceId
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ChangeStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
submittedAt