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

-- | An error or warning for the operation.
--
-- /See:/ 'newDashboardValidationMessage' smart constructor.
data DashboardValidationMessage = DashboardValidationMessage'
  { -- | The data path related to the message.
    DashboardValidationMessage -> Maybe Text
dataPath :: Prelude.Maybe Prelude.Text,
    -- | A message describing the error or warning.
    DashboardValidationMessage -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (DashboardValidationMessage -> DashboardValidationMessage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DashboardValidationMessage -> DashboardValidationMessage -> Bool
$c/= :: DashboardValidationMessage -> DashboardValidationMessage -> Bool
== :: DashboardValidationMessage -> DashboardValidationMessage -> Bool
$c== :: DashboardValidationMessage -> DashboardValidationMessage -> Bool
Prelude.Eq, ReadPrec [DashboardValidationMessage]
ReadPrec DashboardValidationMessage
Int -> ReadS DashboardValidationMessage
ReadS [DashboardValidationMessage]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DashboardValidationMessage]
$creadListPrec :: ReadPrec [DashboardValidationMessage]
readPrec :: ReadPrec DashboardValidationMessage
$creadPrec :: ReadPrec DashboardValidationMessage
readList :: ReadS [DashboardValidationMessage]
$creadList :: ReadS [DashboardValidationMessage]
readsPrec :: Int -> ReadS DashboardValidationMessage
$creadsPrec :: Int -> ReadS DashboardValidationMessage
Prelude.Read, Int -> DashboardValidationMessage -> ShowS
[DashboardValidationMessage] -> ShowS
DashboardValidationMessage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DashboardValidationMessage] -> ShowS
$cshowList :: [DashboardValidationMessage] -> ShowS
show :: DashboardValidationMessage -> String
$cshow :: DashboardValidationMessage -> String
showsPrec :: Int -> DashboardValidationMessage -> ShowS
$cshowsPrec :: Int -> DashboardValidationMessage -> ShowS
Prelude.Show, forall x.
Rep DashboardValidationMessage x -> DashboardValidationMessage
forall x.
DashboardValidationMessage -> Rep DashboardValidationMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DashboardValidationMessage x -> DashboardValidationMessage
$cfrom :: forall x.
DashboardValidationMessage -> Rep DashboardValidationMessage x
Prelude.Generic)

-- |
-- Create a value of 'DashboardValidationMessage' 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:
--
-- 'dataPath', 'dashboardValidationMessage_dataPath' - The data path related to the message.
--
-- 'message', 'dashboardValidationMessage_message' - A message describing the error or warning.
newDashboardValidationMessage ::
  DashboardValidationMessage
newDashboardValidationMessage :: DashboardValidationMessage
newDashboardValidationMessage =
  DashboardValidationMessage'
    { $sel:dataPath:DashboardValidationMessage' :: Maybe Text
dataPath =
        forall a. Maybe a
Prelude.Nothing,
      $sel:message:DashboardValidationMessage' :: Maybe Text
message = forall a. Maybe a
Prelude.Nothing
    }

-- | The data path related to the message.
dashboardValidationMessage_dataPath :: Lens.Lens' DashboardValidationMessage (Prelude.Maybe Prelude.Text)
dashboardValidationMessage_dataPath :: Lens' DashboardValidationMessage (Maybe Text)
dashboardValidationMessage_dataPath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashboardValidationMessage' {Maybe Text
dataPath :: Maybe Text
$sel:dataPath:DashboardValidationMessage' :: DashboardValidationMessage -> Maybe Text
dataPath} -> Maybe Text
dataPath) (\s :: DashboardValidationMessage
s@DashboardValidationMessage' {} Maybe Text
a -> DashboardValidationMessage
s {$sel:dataPath:DashboardValidationMessage' :: Maybe Text
dataPath = Maybe Text
a} :: DashboardValidationMessage)

-- | A message describing the error or warning.
dashboardValidationMessage_message :: Lens.Lens' DashboardValidationMessage (Prelude.Maybe Prelude.Text)
dashboardValidationMessage_message :: Lens' DashboardValidationMessage (Maybe Text)
dashboardValidationMessage_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashboardValidationMessage' {Maybe Text
message :: Maybe Text
$sel:message:DashboardValidationMessage' :: DashboardValidationMessage -> Maybe Text
message} -> Maybe Text
message) (\s :: DashboardValidationMessage
s@DashboardValidationMessage' {} Maybe Text
a -> DashboardValidationMessage
s {$sel:message:DashboardValidationMessage' :: Maybe Text
message = Maybe Text
a} :: DashboardValidationMessage)

instance Data.FromXML DashboardValidationMessage where
  parseXML :: [Node] -> Either String DashboardValidationMessage
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> DashboardValidationMessage
DashboardValidationMessage'
      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
"DataPath")
      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
"Message")

instance Prelude.Hashable DashboardValidationMessage where
  hashWithSalt :: Int -> DashboardValidationMessage -> Int
hashWithSalt Int
_salt DashboardValidationMessage' {Maybe Text
message :: Maybe Text
dataPath :: Maybe Text
$sel:message:DashboardValidationMessage' :: DashboardValidationMessage -> Maybe Text
$sel:dataPath:DashboardValidationMessage' :: DashboardValidationMessage -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dataPath
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message

instance Prelude.NFData DashboardValidationMessage where
  rnf :: DashboardValidationMessage -> ()
rnf DashboardValidationMessage' {Maybe Text
message :: Maybe Text
dataPath :: Maybe Text
$sel:message:DashboardValidationMessage' :: DashboardValidationMessage -> Maybe Text
$sel:dataPath:DashboardValidationMessage' :: DashboardValidationMessage -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dataPath
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message