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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 :: Core.ISO8601
  }
  deriving (ChangeInfo -> ChangeInfo -> Bool
(ChangeInfo -> ChangeInfo -> Bool)
-> (ChangeInfo -> ChangeInfo -> Bool) -> Eq ChangeInfo
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]
(Int -> ReadS ChangeInfo)
-> ReadS [ChangeInfo]
-> ReadPrec ChangeInfo
-> ReadPrec [ChangeInfo]
-> Read 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
(Int -> ChangeInfo -> ShowS)
-> (ChangeInfo -> String)
-> ([ChangeInfo] -> ShowS)
-> Show ChangeInfo
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. ChangeInfo -> Rep ChangeInfo x)
-> (forall x. Rep ChangeInfo x -> ChangeInfo) -> Generic ChangeInfo
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' :: Maybe Text -> ResourceId -> ChangeStatus -> ISO8601 -> ChangeInfo
ChangeInfo'
    { $sel:comment:ChangeInfo' :: Maybe Text
comment = Maybe Text
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 = 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
pSubmittedAt_
    }

-- | A comment you can provide.
changeInfo_comment :: Lens.Lens' ChangeInfo (Prelude.Maybe Prelude.Text)
changeInfo_comment :: (Maybe Text -> f (Maybe Text)) -> ChangeInfo -> f ChangeInfo
changeInfo_comment = (ChangeInfo -> Maybe Text)
-> (ChangeInfo -> Maybe Text -> ChangeInfo)
-> Lens ChangeInfo ChangeInfo (Maybe Text) (Maybe Text)
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 :: (ResourceId -> f ResourceId) -> ChangeInfo -> f ChangeInfo
changeInfo_id = (ChangeInfo -> ResourceId)
-> (ChangeInfo -> ResourceId -> ChangeInfo)
-> Lens ChangeInfo ChangeInfo ResourceId ResourceId
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 :: (ChangeStatus -> f ChangeStatus) -> ChangeInfo -> f ChangeInfo
changeInfo_status = (ChangeInfo -> ChangeStatus)
-> (ChangeInfo -> ChangeStatus -> ChangeInfo)
-> Lens ChangeInfo ChangeInfo ChangeStatus ChangeStatus
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 :: (UTCTime -> f UTCTime) -> ChangeInfo -> f ChangeInfo
changeInfo_submittedAt = (ChangeInfo -> ISO8601)
-> (ChangeInfo -> ISO8601 -> ChangeInfo)
-> Lens ChangeInfo ChangeInfo ISO8601 ISO8601
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) ((ISO8601 -> f ISO8601) -> ChangeInfo -> f ChangeInfo)
-> ((UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601)
-> (UTCTime -> f UTCTime)
-> ChangeInfo
-> f ChangeInfo
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

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

instance Prelude.Hashable ChangeInfo

instance Prelude.NFData ChangeInfo