{-# 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.ElasticBeanstalk.Types.ValidationMessage
-- 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.ElasticBeanstalk.Types.ValidationMessage where

import qualified Amazonka.Core as Core
import Amazonka.ElasticBeanstalk.Types.ValidationSeverity
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An error or warning for a desired configuration option value.
--
-- /See:/ 'newValidationMessage' smart constructor.
data ValidationMessage = ValidationMessage'
  { -- | The name of the option.
    ValidationMessage -> Maybe Text
optionName :: Prelude.Maybe Prelude.Text,
    -- | An indication of the severity of this message:
    --
    -- -   @error@: This message indicates that this is not a valid setting for
    --     an option.
    --
    -- -   @warning@: This message is providing information you should take
    --     into account.
    ValidationMessage -> Maybe ValidationSeverity
severity :: Prelude.Maybe ValidationSeverity,
    -- | The namespace to which the option belongs.
    ValidationMessage -> Maybe Text
namespace :: Prelude.Maybe Prelude.Text,
    -- | A message describing the error or warning.
    ValidationMessage -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (ValidationMessage -> ValidationMessage -> Bool
(ValidationMessage -> ValidationMessage -> Bool)
-> (ValidationMessage -> ValidationMessage -> Bool)
-> Eq ValidationMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ValidationMessage -> ValidationMessage -> Bool
$c/= :: ValidationMessage -> ValidationMessage -> Bool
== :: ValidationMessage -> ValidationMessage -> Bool
$c== :: ValidationMessage -> ValidationMessage -> Bool
Prelude.Eq, ReadPrec [ValidationMessage]
ReadPrec ValidationMessage
Int -> ReadS ValidationMessage
ReadS [ValidationMessage]
(Int -> ReadS ValidationMessage)
-> ReadS [ValidationMessage]
-> ReadPrec ValidationMessage
-> ReadPrec [ValidationMessage]
-> Read ValidationMessage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ValidationMessage]
$creadListPrec :: ReadPrec [ValidationMessage]
readPrec :: ReadPrec ValidationMessage
$creadPrec :: ReadPrec ValidationMessage
readList :: ReadS [ValidationMessage]
$creadList :: ReadS [ValidationMessage]
readsPrec :: Int -> ReadS ValidationMessage
$creadsPrec :: Int -> ReadS ValidationMessage
Prelude.Read, Int -> ValidationMessage -> ShowS
[ValidationMessage] -> ShowS
ValidationMessage -> String
(Int -> ValidationMessage -> ShowS)
-> (ValidationMessage -> String)
-> ([ValidationMessage] -> ShowS)
-> Show ValidationMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ValidationMessage] -> ShowS
$cshowList :: [ValidationMessage] -> ShowS
show :: ValidationMessage -> String
$cshow :: ValidationMessage -> String
showsPrec :: Int -> ValidationMessage -> ShowS
$cshowsPrec :: Int -> ValidationMessage -> ShowS
Prelude.Show, (forall x. ValidationMessage -> Rep ValidationMessage x)
-> (forall x. Rep ValidationMessage x -> ValidationMessage)
-> Generic ValidationMessage
forall x. Rep ValidationMessage x -> ValidationMessage
forall x. ValidationMessage -> Rep ValidationMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ValidationMessage x -> ValidationMessage
$cfrom :: forall x. ValidationMessage -> Rep ValidationMessage x
Prelude.Generic)

-- |
-- Create a value of 'ValidationMessage' 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:
--
-- 'optionName', 'validationMessage_optionName' - The name of the option.
--
-- 'severity', 'validationMessage_severity' - An indication of the severity of this message:
--
-- -   @error@: This message indicates that this is not a valid setting for
--     an option.
--
-- -   @warning@: This message is providing information you should take
--     into account.
--
-- 'namespace', 'validationMessage_namespace' - The namespace to which the option belongs.
--
-- 'message', 'validationMessage_message' - A message describing the error or warning.
newValidationMessage ::
  ValidationMessage
newValidationMessage :: ValidationMessage
newValidationMessage =
  ValidationMessage' :: Maybe Text
-> Maybe ValidationSeverity
-> Maybe Text
-> Maybe Text
-> ValidationMessage
ValidationMessage'
    { $sel:optionName:ValidationMessage' :: Maybe Text
optionName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:severity:ValidationMessage' :: Maybe ValidationSeverity
severity = Maybe ValidationSeverity
forall a. Maybe a
Prelude.Nothing,
      $sel:namespace:ValidationMessage' :: Maybe Text
namespace = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:message:ValidationMessage' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the option.
validationMessage_optionName :: Lens.Lens' ValidationMessage (Prelude.Maybe Prelude.Text)
validationMessage_optionName :: (Maybe Text -> f (Maybe Text))
-> ValidationMessage -> f ValidationMessage
validationMessage_optionName = (ValidationMessage -> Maybe Text)
-> (ValidationMessage -> Maybe Text -> ValidationMessage)
-> Lens
     ValidationMessage ValidationMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidationMessage' {Maybe Text
optionName :: Maybe Text
$sel:optionName:ValidationMessage' :: ValidationMessage -> Maybe Text
optionName} -> Maybe Text
optionName) (\s :: ValidationMessage
s@ValidationMessage' {} Maybe Text
a -> ValidationMessage
s {$sel:optionName:ValidationMessage' :: Maybe Text
optionName = Maybe Text
a} :: ValidationMessage)

-- | An indication of the severity of this message:
--
-- -   @error@: This message indicates that this is not a valid setting for
--     an option.
--
-- -   @warning@: This message is providing information you should take
--     into account.
validationMessage_severity :: Lens.Lens' ValidationMessage (Prelude.Maybe ValidationSeverity)
validationMessage_severity :: (Maybe ValidationSeverity -> f (Maybe ValidationSeverity))
-> ValidationMessage -> f ValidationMessage
validationMessage_severity = (ValidationMessage -> Maybe ValidationSeverity)
-> (ValidationMessage
    -> Maybe ValidationSeverity -> ValidationMessage)
-> Lens
     ValidationMessage
     ValidationMessage
     (Maybe ValidationSeverity)
     (Maybe ValidationSeverity)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidationMessage' {Maybe ValidationSeverity
severity :: Maybe ValidationSeverity
$sel:severity:ValidationMessage' :: ValidationMessage -> Maybe ValidationSeverity
severity} -> Maybe ValidationSeverity
severity) (\s :: ValidationMessage
s@ValidationMessage' {} Maybe ValidationSeverity
a -> ValidationMessage
s {$sel:severity:ValidationMessage' :: Maybe ValidationSeverity
severity = Maybe ValidationSeverity
a} :: ValidationMessage)

-- | The namespace to which the option belongs.
validationMessage_namespace :: Lens.Lens' ValidationMessage (Prelude.Maybe Prelude.Text)
validationMessage_namespace :: (Maybe Text -> f (Maybe Text))
-> ValidationMessage -> f ValidationMessage
validationMessage_namespace = (ValidationMessage -> Maybe Text)
-> (ValidationMessage -> Maybe Text -> ValidationMessage)
-> Lens
     ValidationMessage ValidationMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidationMessage' {Maybe Text
namespace :: Maybe Text
$sel:namespace:ValidationMessage' :: ValidationMessage -> Maybe Text
namespace} -> Maybe Text
namespace) (\s :: ValidationMessage
s@ValidationMessage' {} Maybe Text
a -> ValidationMessage
s {$sel:namespace:ValidationMessage' :: Maybe Text
namespace = Maybe Text
a} :: ValidationMessage)

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

instance Core.FromXML ValidationMessage where
  parseXML :: [Node] -> Either String ValidationMessage
parseXML [Node]
x =
    Maybe Text
-> Maybe ValidationSeverity
-> Maybe Text
-> Maybe Text
-> ValidationMessage
ValidationMessage'
      (Maybe Text
 -> Maybe ValidationSeverity
 -> Maybe Text
 -> Maybe Text
 -> ValidationMessage)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe ValidationSeverity
      -> Maybe Text -> Maybe Text -> ValidationMessage)
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
"OptionName")
      Either
  String
  (Maybe ValidationSeverity
   -> Maybe Text -> Maybe Text -> ValidationMessage)
-> Either String (Maybe ValidationSeverity)
-> Either String (Maybe Text -> Maybe Text -> ValidationMessage)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ValidationSeverity)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Severity")
      Either String (Maybe Text -> Maybe Text -> ValidationMessage)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> ValidationMessage)
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
"Namespace")
      Either String (Maybe Text -> ValidationMessage)
-> Either String (Maybe Text) -> Either String ValidationMessage
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 ValidationMessage

instance Prelude.NFData ValidationMessage