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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(DashboardValidationMessage -> DashboardValidationMessage -> Bool)
-> (DashboardValidationMessage
    -> DashboardValidationMessage -> Bool)
-> Eq DashboardValidationMessage
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]
(Int -> ReadS DashboardValidationMessage)
-> ReadS [DashboardValidationMessage]
-> ReadPrec DashboardValidationMessage
-> ReadPrec [DashboardValidationMessage]
-> Read 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
(Int -> DashboardValidationMessage -> ShowS)
-> (DashboardValidationMessage -> String)
-> ([DashboardValidationMessage] -> ShowS)
-> Show DashboardValidationMessage
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.
 DashboardValidationMessage -> Rep DashboardValidationMessage x)
-> (forall x.
    Rep DashboardValidationMessage x -> DashboardValidationMessage)
-> Generic DashboardValidationMessage
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' :: Maybe Text -> Maybe Text -> DashboardValidationMessage
DashboardValidationMessage'
    { $sel:dataPath:DashboardValidationMessage' :: Maybe Text
dataPath =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:message:DashboardValidationMessage' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The data path related to the message.
dashboardValidationMessage_dataPath :: Lens.Lens' DashboardValidationMessage (Prelude.Maybe Prelude.Text)
dashboardValidationMessage_dataPath :: (Maybe Text -> f (Maybe Text))
-> DashboardValidationMessage -> f DashboardValidationMessage
dashboardValidationMessage_dataPath = (DashboardValidationMessage -> Maybe Text)
-> (DashboardValidationMessage
    -> Maybe Text -> DashboardValidationMessage)
-> Lens
     DashboardValidationMessage
     DashboardValidationMessage
     (Maybe Text)
     (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> DashboardValidationMessage -> f DashboardValidationMessage
dashboardValidationMessage_message = (DashboardValidationMessage -> Maybe Text)
-> (DashboardValidationMessage
    -> Maybe Text -> DashboardValidationMessage)
-> Lens
     DashboardValidationMessage
     DashboardValidationMessage
     (Maybe Text)
     (Maybe Text)
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 Core.FromXML DashboardValidationMessage where
  parseXML :: [Node] -> Either String DashboardValidationMessage
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> DashboardValidationMessage
DashboardValidationMessage'
      (Maybe Text -> Maybe Text -> DashboardValidationMessage)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> DashboardValidationMessage)
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
"DataPath")
      Either String (Maybe Text -> DashboardValidationMessage)
-> Either String (Maybe Text)
-> Either String DashboardValidationMessage
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
"Message")

instance Prelude.Hashable DashboardValidationMessage

instance Prelude.NFData DashboardValidationMessage