{-# 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.EC2.Types.MetricPoint
-- 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.EC2.Types.MetricPoint where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import qualified Amazonka.Prelude as Prelude

-- | Indicates whether the network was healthy or unhealthy at a particular
-- point. The value is aggregated from the @startDate@ to the @endDate@.
-- Currently only @five_minutes@ is supported.
--
-- /See:/ 'newMetricPoint' smart constructor.
data MetricPoint = MetricPoint'
  { -- | The end date for the metric point. The ending time must be formatted as
    -- @yyyy-mm-ddThh:mm:ss@. For example, @2022-06-12T12:00:00.000Z@.
    MetricPoint -> Maybe ISO8601
endDate :: Prelude.Maybe Data.ISO8601,
    -- | The start date for the metric point. The starting date for the metric
    -- point. The starting time must be formatted as @yyyy-mm-ddThh:mm:ss@. For
    -- example, @2022-06-10T12:00:00.000Z@.
    MetricPoint -> Maybe ISO8601
startDate :: Prelude.Maybe Data.ISO8601,
    -- | The status of the metric point.
    MetricPoint -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    MetricPoint -> Maybe Double
value :: Prelude.Maybe Prelude.Double
  }
  deriving (MetricPoint -> MetricPoint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MetricPoint -> MetricPoint -> Bool
$c/= :: MetricPoint -> MetricPoint -> Bool
== :: MetricPoint -> MetricPoint -> Bool
$c== :: MetricPoint -> MetricPoint -> Bool
Prelude.Eq, ReadPrec [MetricPoint]
ReadPrec MetricPoint
Int -> ReadS MetricPoint
ReadS [MetricPoint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MetricPoint]
$creadListPrec :: ReadPrec [MetricPoint]
readPrec :: ReadPrec MetricPoint
$creadPrec :: ReadPrec MetricPoint
readList :: ReadS [MetricPoint]
$creadList :: ReadS [MetricPoint]
readsPrec :: Int -> ReadS MetricPoint
$creadsPrec :: Int -> ReadS MetricPoint
Prelude.Read, Int -> MetricPoint -> ShowS
[MetricPoint] -> ShowS
MetricPoint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MetricPoint] -> ShowS
$cshowList :: [MetricPoint] -> ShowS
show :: MetricPoint -> String
$cshow :: MetricPoint -> String
showsPrec :: Int -> MetricPoint -> ShowS
$cshowsPrec :: Int -> MetricPoint -> ShowS
Prelude.Show, forall x. Rep MetricPoint x -> MetricPoint
forall x. MetricPoint -> Rep MetricPoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MetricPoint x -> MetricPoint
$cfrom :: forall x. MetricPoint -> Rep MetricPoint x
Prelude.Generic)

-- |
-- Create a value of 'MetricPoint' 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:
--
-- 'endDate', 'metricPoint_endDate' - The end date for the metric point. The ending time must be formatted as
-- @yyyy-mm-ddThh:mm:ss@. For example, @2022-06-12T12:00:00.000Z@.
--
-- 'startDate', 'metricPoint_startDate' - The start date for the metric point. The starting date for the metric
-- point. The starting time must be formatted as @yyyy-mm-ddThh:mm:ss@. For
-- example, @2022-06-10T12:00:00.000Z@.
--
-- 'status', 'metricPoint_status' - The status of the metric point.
--
-- 'value', 'metricPoint_value' - Undocumented member.
newMetricPoint ::
  MetricPoint
newMetricPoint :: MetricPoint
newMetricPoint =
  MetricPoint'
    { $sel:endDate:MetricPoint' :: Maybe ISO8601
endDate = forall a. Maybe a
Prelude.Nothing,
      $sel:startDate:MetricPoint' :: Maybe ISO8601
startDate = forall a. Maybe a
Prelude.Nothing,
      $sel:status:MetricPoint' :: Maybe Text
status = forall a. Maybe a
Prelude.Nothing,
      $sel:value:MetricPoint' :: Maybe Double
value = forall a. Maybe a
Prelude.Nothing
    }

-- | The end date for the metric point. The ending time must be formatted as
-- @yyyy-mm-ddThh:mm:ss@. For example, @2022-06-12T12:00:00.000Z@.
metricPoint_endDate :: Lens.Lens' MetricPoint (Prelude.Maybe Prelude.UTCTime)
metricPoint_endDate :: Lens' MetricPoint (Maybe UTCTime)
metricPoint_endDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricPoint' {Maybe ISO8601
endDate :: Maybe ISO8601
$sel:endDate:MetricPoint' :: MetricPoint -> Maybe ISO8601
endDate} -> Maybe ISO8601
endDate) (\s :: MetricPoint
s@MetricPoint' {} Maybe ISO8601
a -> MetricPoint
s {$sel:endDate:MetricPoint' :: Maybe ISO8601
endDate = Maybe ISO8601
a} :: MetricPoint) 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

-- | The start date for the metric point. The starting date for the metric
-- point. The starting time must be formatted as @yyyy-mm-ddThh:mm:ss@. For
-- example, @2022-06-10T12:00:00.000Z@.
metricPoint_startDate :: Lens.Lens' MetricPoint (Prelude.Maybe Prelude.UTCTime)
metricPoint_startDate :: Lens' MetricPoint (Maybe UTCTime)
metricPoint_startDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricPoint' {Maybe ISO8601
startDate :: Maybe ISO8601
$sel:startDate:MetricPoint' :: MetricPoint -> Maybe ISO8601
startDate} -> Maybe ISO8601
startDate) (\s :: MetricPoint
s@MetricPoint' {} Maybe ISO8601
a -> MetricPoint
s {$sel:startDate:MetricPoint' :: Maybe ISO8601
startDate = Maybe ISO8601
a} :: MetricPoint) 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

-- | The status of the metric point.
metricPoint_status :: Lens.Lens' MetricPoint (Prelude.Maybe Prelude.Text)
metricPoint_status :: Lens' MetricPoint (Maybe Text)
metricPoint_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricPoint' {Maybe Text
status :: Maybe Text
$sel:status:MetricPoint' :: MetricPoint -> Maybe Text
status} -> Maybe Text
status) (\s :: MetricPoint
s@MetricPoint' {} Maybe Text
a -> MetricPoint
s {$sel:status:MetricPoint' :: Maybe Text
status = Maybe Text
a} :: MetricPoint)

-- | Undocumented member.
metricPoint_value :: Lens.Lens' MetricPoint (Prelude.Maybe Prelude.Double)
metricPoint_value :: Lens' MetricPoint (Maybe Double)
metricPoint_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricPoint' {Maybe Double
value :: Maybe Double
$sel:value:MetricPoint' :: MetricPoint -> Maybe Double
value} -> Maybe Double
value) (\s :: MetricPoint
s@MetricPoint' {} Maybe Double
a -> MetricPoint
s {$sel:value:MetricPoint' :: Maybe Double
value = Maybe Double
a} :: MetricPoint)

instance Data.FromXML MetricPoint where
  parseXML :: [Node] -> Either String MetricPoint
parseXML [Node]
x =
    Maybe ISO8601
-> Maybe ISO8601 -> Maybe Text -> Maybe Double -> MetricPoint
MetricPoint'
      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
"endDate")
      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
"startDate")
      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")
      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
"value")

instance Prelude.Hashable MetricPoint where
  hashWithSalt :: Int -> MetricPoint -> Int
hashWithSalt Int
_salt MetricPoint' {Maybe Double
Maybe Text
Maybe ISO8601
value :: Maybe Double
status :: Maybe Text
startDate :: Maybe ISO8601
endDate :: Maybe ISO8601
$sel:value:MetricPoint' :: MetricPoint -> Maybe Double
$sel:status:MetricPoint' :: MetricPoint -> Maybe Text
$sel:startDate:MetricPoint' :: MetricPoint -> Maybe ISO8601
$sel:endDate:MetricPoint' :: MetricPoint -> Maybe ISO8601
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
endDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
startDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
value

instance Prelude.NFData MetricPoint where
  rnf :: MetricPoint -> ()
rnf MetricPoint' {Maybe Double
Maybe Text
Maybe ISO8601
value :: Maybe Double
status :: Maybe Text
startDate :: Maybe ISO8601
endDate :: Maybe ISO8601
$sel:value:MetricPoint' :: MetricPoint -> Maybe Double
$sel:status:MetricPoint' :: MetricPoint -> Maybe Text
$sel:startDate:MetricPoint' :: MetricPoint -> Maybe ISO8601
$sel:endDate:MetricPoint' :: MetricPoint -> Maybe ISO8601
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
endDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
startDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
value