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

-- | 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'
  { -- | 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 Data.ISO8601,
    -- | 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
  }
  deriving (StatusReport -> StatusReport -> Bool
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]
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
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. 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:
--
-- '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.
--
-- 'status', 'statusReport_status' - A description of the status of the health check endpoint as reported by
-- one of the Amazon Route 53 health checkers.
newStatusReport ::
  StatusReport
newStatusReport :: StatusReport
newStatusReport =
  StatusReport'
    { $sel:checkedTime:StatusReport' :: Maybe ISO8601
checkedTime = forall a. Maybe a
Prelude.Nothing,
      $sel:status:StatusReport' :: Maybe Text
status = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' StatusReport (Maybe UTCTime)
statusReport_checkedTime = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | 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 :: Lens' StatusReport (Maybe Text)
statusReport_status = 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)

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

instance Prelude.Hashable StatusReport where
  hashWithSalt :: Int -> StatusReport -> Int
hashWithSalt Int
_salt StatusReport' {Maybe Text
Maybe ISO8601
status :: Maybe Text
checkedTime :: Maybe ISO8601
$sel:status:StatusReport' :: StatusReport -> Maybe Text
$sel:checkedTime:StatusReport' :: StatusReport -> Maybe ISO8601
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
checkedTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
status

instance Prelude.NFData StatusReport where
  rnf :: StatusReport -> ()
rnf StatusReport' {Maybe Text
Maybe ISO8601
status :: Maybe Text
checkedTime :: Maybe ISO8601
$sel:status:StatusReport' :: StatusReport -> Maybe Text
$sel:checkedTime:StatusReport' :: StatusReport -> Maybe ISO8601
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
checkedTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
status