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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53.Internal

-- | A complex type that contains the status that one Amazon Route 53 health
-- checker reports and the time of the health check.
--
-- /See:/ 'newStatusReport' smart constructor.
data StatusReport = StatusReport'
  { -- | A description of the status of the health check endpoint as reported by
    -- one of the Amazon Route 53 health checkers.
    StatusReport -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The date and time that the health checker performed the health check 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.
    StatusReport -> Maybe ISO8601
checkedTime :: Prelude.Maybe Core.ISO8601
  }
  deriving (StatusReport -> StatusReport -> Bool
(StatusReport -> StatusReport -> Bool)
-> (StatusReport -> StatusReport -> Bool) -> Eq StatusReport
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StatusReport -> StatusReport -> Bool
$c/= :: StatusReport -> StatusReport -> Bool
== :: StatusReport -> StatusReport -> Bool
$c== :: StatusReport -> StatusReport -> Bool
Prelude.Eq, ReadPrec [StatusReport]
ReadPrec StatusReport
Int -> ReadS StatusReport
ReadS [StatusReport]
(Int -> ReadS StatusReport)
-> ReadS [StatusReport]
-> ReadPrec StatusReport
-> ReadPrec [StatusReport]
-> Read StatusReport
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StatusReport]
$creadListPrec :: ReadPrec [StatusReport]
readPrec :: ReadPrec StatusReport
$creadPrec :: ReadPrec StatusReport
readList :: ReadS [StatusReport]
$creadList :: ReadS [StatusReport]
readsPrec :: Int -> ReadS StatusReport
$creadsPrec :: Int -> ReadS StatusReport
Prelude.Read, Int -> StatusReport -> ShowS
[StatusReport] -> ShowS
StatusReport -> String
(Int -> StatusReport -> ShowS)
-> (StatusReport -> String)
-> ([StatusReport] -> ShowS)
-> Show StatusReport
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StatusReport] -> ShowS
$cshowList :: [StatusReport] -> ShowS
show :: StatusReport -> String
$cshow :: StatusReport -> String
showsPrec :: Int -> StatusReport -> ShowS
$cshowsPrec :: Int -> StatusReport -> ShowS
Prelude.Show, (forall x. StatusReport -> Rep StatusReport x)
-> (forall x. Rep StatusReport x -> StatusReport)
-> Generic StatusReport
forall x. Rep StatusReport x -> StatusReport
forall x. StatusReport -> Rep StatusReport x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StatusReport x -> StatusReport
$cfrom :: forall x. StatusReport -> Rep StatusReport x
Prelude.Generic)

-- |
-- Create a value of 'StatusReport' 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:
--
-- 'status', 'statusReport_status' - A description of the status of the health check endpoint as reported by
-- one of the Amazon Route 53 health checkers.
--
-- 'checkedTime', 'statusReport_checkedTime' - The date and time that the health checker performed the health check 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.
newStatusReport ::
  StatusReport
newStatusReport :: StatusReport
newStatusReport =
  StatusReport' :: Maybe Text -> Maybe ISO8601 -> StatusReport
StatusReport'
    { $sel:status:StatusReport' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:checkedTime:StatusReport' :: Maybe ISO8601
checkedTime = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing
    }

-- | A description of the status of the health check endpoint as reported by
-- one of the Amazon Route 53 health checkers.
statusReport_status :: Lens.Lens' StatusReport (Prelude.Maybe Prelude.Text)
statusReport_status :: (Maybe Text -> f (Maybe Text)) -> StatusReport -> f StatusReport
statusReport_status = (StatusReport -> Maybe Text)
-> (StatusReport -> Maybe Text -> StatusReport)
-> Lens StatusReport StatusReport (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StatusReport' {Maybe Text
status :: Maybe Text
$sel:status:StatusReport' :: StatusReport -> Maybe Text
status} -> Maybe Text
status) (\s :: StatusReport
s@StatusReport' {} Maybe Text
a -> StatusReport
s {$sel:status:StatusReport' :: Maybe Text
status = Maybe Text
a} :: StatusReport)

-- | The date and time that the health checker performed the health check 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.
statusReport_checkedTime :: Lens.Lens' StatusReport (Prelude.Maybe Prelude.UTCTime)
statusReport_checkedTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> StatusReport -> f StatusReport
statusReport_checkedTime = (StatusReport -> Maybe ISO8601)
-> (StatusReport -> Maybe ISO8601 -> StatusReport)
-> Lens StatusReport StatusReport (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StatusReport' {Maybe ISO8601
checkedTime :: Maybe ISO8601
$sel:checkedTime:StatusReport' :: StatusReport -> Maybe ISO8601
checkedTime} -> Maybe ISO8601
checkedTime) (\s :: StatusReport
s@StatusReport' {} Maybe ISO8601
a -> StatusReport
s {$sel:checkedTime:StatusReport' :: Maybe ISO8601
checkedTime = Maybe ISO8601
a} :: StatusReport) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> StatusReport -> f StatusReport)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> StatusReport
-> f StatusReport
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromXML StatusReport where
  parseXML :: [Node] -> Either String StatusReport
parseXML [Node]
x =
    Maybe Text -> Maybe ISO8601 -> StatusReport
StatusReport'
      (Maybe Text -> Maybe ISO8601 -> StatusReport)
-> Either String (Maybe Text)
-> Either String (Maybe ISO8601 -> StatusReport)
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
"Status")
      Either String (Maybe ISO8601 -> StatusReport)
-> Either String (Maybe ISO8601) -> Either String StatusReport
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"CheckedTime")

instance Prelude.Hashable StatusReport

instance Prelude.NFData StatusReport