{-# 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.CloudWatch.Types.DashboardEntry
-- 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.CloudWatch.Types.DashboardEntry where

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

-- | Represents a specific dashboard.
--
-- /See:/ 'newDashboardEntry' smart constructor.
data DashboardEntry = DashboardEntry'
  { -- | The size of the dashboard, in bytes.
    DashboardEntry -> Maybe Integer
size :: Prelude.Maybe Prelude.Integer,
    -- | The name of the dashboard.
    DashboardEntry -> Maybe Text
dashboardName :: Prelude.Maybe Prelude.Text,
    -- | The time stamp of when the dashboard was last modified, either by an API
    -- call or through the console. This number is expressed as the number of
    -- milliseconds since Jan 1, 1970 00:00:00 UTC.
    DashboardEntry -> Maybe ISO8601
lastModified :: Prelude.Maybe Core.ISO8601,
    -- | The Amazon Resource Name (ARN) of the dashboard.
    DashboardEntry -> Maybe Text
dashboardArn :: Prelude.Maybe Prelude.Text
  }
  deriving (DashboardEntry -> DashboardEntry -> Bool
(DashboardEntry -> DashboardEntry -> Bool)
-> (DashboardEntry -> DashboardEntry -> Bool) -> Eq DashboardEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DashboardEntry -> DashboardEntry -> Bool
$c/= :: DashboardEntry -> DashboardEntry -> Bool
== :: DashboardEntry -> DashboardEntry -> Bool
$c== :: DashboardEntry -> DashboardEntry -> Bool
Prelude.Eq, ReadPrec [DashboardEntry]
ReadPrec DashboardEntry
Int -> ReadS DashboardEntry
ReadS [DashboardEntry]
(Int -> ReadS DashboardEntry)
-> ReadS [DashboardEntry]
-> ReadPrec DashboardEntry
-> ReadPrec [DashboardEntry]
-> Read DashboardEntry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DashboardEntry]
$creadListPrec :: ReadPrec [DashboardEntry]
readPrec :: ReadPrec DashboardEntry
$creadPrec :: ReadPrec DashboardEntry
readList :: ReadS [DashboardEntry]
$creadList :: ReadS [DashboardEntry]
readsPrec :: Int -> ReadS DashboardEntry
$creadsPrec :: Int -> ReadS DashboardEntry
Prelude.Read, Int -> DashboardEntry -> ShowS
[DashboardEntry] -> ShowS
DashboardEntry -> String
(Int -> DashboardEntry -> ShowS)
-> (DashboardEntry -> String)
-> ([DashboardEntry] -> ShowS)
-> Show DashboardEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DashboardEntry] -> ShowS
$cshowList :: [DashboardEntry] -> ShowS
show :: DashboardEntry -> String
$cshow :: DashboardEntry -> String
showsPrec :: Int -> DashboardEntry -> ShowS
$cshowsPrec :: Int -> DashboardEntry -> ShowS
Prelude.Show, (forall x. DashboardEntry -> Rep DashboardEntry x)
-> (forall x. Rep DashboardEntry x -> DashboardEntry)
-> Generic DashboardEntry
forall x. Rep DashboardEntry x -> DashboardEntry
forall x. DashboardEntry -> Rep DashboardEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DashboardEntry x -> DashboardEntry
$cfrom :: forall x. DashboardEntry -> Rep DashboardEntry x
Prelude.Generic)

-- |
-- Create a value of 'DashboardEntry' 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:
--
-- 'size', 'dashboardEntry_size' - The size of the dashboard, in bytes.
--
-- 'dashboardName', 'dashboardEntry_dashboardName' - The name of the dashboard.
--
-- 'lastModified', 'dashboardEntry_lastModified' - The time stamp of when the dashboard was last modified, either by an API
-- call or through the console. This number is expressed as the number of
-- milliseconds since Jan 1, 1970 00:00:00 UTC.
--
-- 'dashboardArn', 'dashboardEntry_dashboardArn' - The Amazon Resource Name (ARN) of the dashboard.
newDashboardEntry ::
  DashboardEntry
newDashboardEntry :: DashboardEntry
newDashboardEntry =
  DashboardEntry' :: Maybe Integer
-> Maybe Text -> Maybe ISO8601 -> Maybe Text -> DashboardEntry
DashboardEntry'
    { $sel:size:DashboardEntry' :: Maybe Integer
size = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:dashboardName:DashboardEntry' :: Maybe Text
dashboardName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastModified:DashboardEntry' :: Maybe ISO8601
lastModified = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
      $sel:dashboardArn:DashboardEntry' :: Maybe Text
dashboardArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The size of the dashboard, in bytes.
dashboardEntry_size :: Lens.Lens' DashboardEntry (Prelude.Maybe Prelude.Integer)
dashboardEntry_size :: (Maybe Integer -> f (Maybe Integer))
-> DashboardEntry -> f DashboardEntry
dashboardEntry_size = (DashboardEntry -> Maybe Integer)
-> (DashboardEntry -> Maybe Integer -> DashboardEntry)
-> Lens
     DashboardEntry DashboardEntry (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashboardEntry' {Maybe Integer
size :: Maybe Integer
$sel:size:DashboardEntry' :: DashboardEntry -> Maybe Integer
size} -> Maybe Integer
size) (\s :: DashboardEntry
s@DashboardEntry' {} Maybe Integer
a -> DashboardEntry
s {$sel:size:DashboardEntry' :: Maybe Integer
size = Maybe Integer
a} :: DashboardEntry)

-- | The name of the dashboard.
dashboardEntry_dashboardName :: Lens.Lens' DashboardEntry (Prelude.Maybe Prelude.Text)
dashboardEntry_dashboardName :: (Maybe Text -> f (Maybe Text))
-> DashboardEntry -> f DashboardEntry
dashboardEntry_dashboardName = (DashboardEntry -> Maybe Text)
-> (DashboardEntry -> Maybe Text -> DashboardEntry)
-> Lens DashboardEntry DashboardEntry (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashboardEntry' {Maybe Text
dashboardName :: Maybe Text
$sel:dashboardName:DashboardEntry' :: DashboardEntry -> Maybe Text
dashboardName} -> Maybe Text
dashboardName) (\s :: DashboardEntry
s@DashboardEntry' {} Maybe Text
a -> DashboardEntry
s {$sel:dashboardName:DashboardEntry' :: Maybe Text
dashboardName = Maybe Text
a} :: DashboardEntry)

-- | The time stamp of when the dashboard was last modified, either by an API
-- call or through the console. This number is expressed as the number of
-- milliseconds since Jan 1, 1970 00:00:00 UTC.
dashboardEntry_lastModified :: Lens.Lens' DashboardEntry (Prelude.Maybe Prelude.UTCTime)
dashboardEntry_lastModified :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DashboardEntry -> f DashboardEntry
dashboardEntry_lastModified = (DashboardEntry -> Maybe ISO8601)
-> (DashboardEntry -> Maybe ISO8601 -> DashboardEntry)
-> Lens
     DashboardEntry DashboardEntry (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashboardEntry' {Maybe ISO8601
lastModified :: Maybe ISO8601
$sel:lastModified:DashboardEntry' :: DashboardEntry -> Maybe ISO8601
lastModified} -> Maybe ISO8601
lastModified) (\s :: DashboardEntry
s@DashboardEntry' {} Maybe ISO8601
a -> DashboardEntry
s {$sel:lastModified:DashboardEntry' :: Maybe ISO8601
lastModified = Maybe ISO8601
a} :: DashboardEntry) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> DashboardEntry -> f DashboardEntry)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DashboardEntry
-> f DashboardEntry
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

-- | The Amazon Resource Name (ARN) of the dashboard.
dashboardEntry_dashboardArn :: Lens.Lens' DashboardEntry (Prelude.Maybe Prelude.Text)
dashboardEntry_dashboardArn :: (Maybe Text -> f (Maybe Text))
-> DashboardEntry -> f DashboardEntry
dashboardEntry_dashboardArn = (DashboardEntry -> Maybe Text)
-> (DashboardEntry -> Maybe Text -> DashboardEntry)
-> Lens DashboardEntry DashboardEntry (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashboardEntry' {Maybe Text
dashboardArn :: Maybe Text
$sel:dashboardArn:DashboardEntry' :: DashboardEntry -> Maybe Text
dashboardArn} -> Maybe Text
dashboardArn) (\s :: DashboardEntry
s@DashboardEntry' {} Maybe Text
a -> DashboardEntry
s {$sel:dashboardArn:DashboardEntry' :: Maybe Text
dashboardArn = Maybe Text
a} :: DashboardEntry)

instance Core.FromXML DashboardEntry where
  parseXML :: [Node] -> Either String DashboardEntry
parseXML [Node]
x =
    Maybe Integer
-> Maybe Text -> Maybe ISO8601 -> Maybe Text -> DashboardEntry
DashboardEntry'
      (Maybe Integer
 -> Maybe Text -> Maybe ISO8601 -> Maybe Text -> DashboardEntry)
-> Either String (Maybe Integer)
-> Either
     String
     (Maybe Text -> Maybe ISO8601 -> Maybe Text -> DashboardEntry)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Integer)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Size")
      Either
  String
  (Maybe Text -> Maybe ISO8601 -> Maybe Text -> DashboardEntry)
-> Either String (Maybe Text)
-> Either String (Maybe ISO8601 -> Maybe Text -> DashboardEntry)
forall (f :: * -> *) a b. Applicative f => 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
"DashboardName")
      Either String (Maybe ISO8601 -> Maybe Text -> DashboardEntry)
-> Either String (Maybe ISO8601)
-> Either String (Maybe Text -> DashboardEntry)
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
"LastModified")
      Either String (Maybe Text -> DashboardEntry)
-> Either String (Maybe Text) -> Either String DashboardEntry
forall (f :: * -> *) a b. Applicative f => 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
"DashboardArn")

instance Prelude.Hashable DashboardEntry

instance Prelude.NFData DashboardEntry