{-# 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.MQ.Types.SanitizationWarning
-- 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.MQ.Types.SanitizationWarning where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MQ.Types.SanitizationWarningReason
import qualified Amazonka.Prelude as Prelude

-- | Returns information about the XML element or attribute that was
-- sanitized in the configuration.
--
-- /See:/ 'newSanitizationWarning' smart constructor.
data SanitizationWarning = SanitizationWarning'
  { -- | The name of the XML attribute that has been sanitized.
    SanitizationWarning -> Maybe Text
attributeName :: Prelude.Maybe Prelude.Text,
    -- | The name of the XML element that has been sanitized.
    SanitizationWarning -> Maybe Text
elementName :: Prelude.Maybe Prelude.Text,
    -- | Required. The reason for which the XML elements or attributes were
    -- sanitized.
    SanitizationWarning -> SanitizationWarningReason
reason :: SanitizationWarningReason
  }
  deriving (SanitizationWarning -> SanitizationWarning -> Bool
(SanitizationWarning -> SanitizationWarning -> Bool)
-> (SanitizationWarning -> SanitizationWarning -> Bool)
-> Eq SanitizationWarning
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SanitizationWarning -> SanitizationWarning -> Bool
$c/= :: SanitizationWarning -> SanitizationWarning -> Bool
== :: SanitizationWarning -> SanitizationWarning -> Bool
$c== :: SanitizationWarning -> SanitizationWarning -> Bool
Prelude.Eq, ReadPrec [SanitizationWarning]
ReadPrec SanitizationWarning
Int -> ReadS SanitizationWarning
ReadS [SanitizationWarning]
(Int -> ReadS SanitizationWarning)
-> ReadS [SanitizationWarning]
-> ReadPrec SanitizationWarning
-> ReadPrec [SanitizationWarning]
-> Read SanitizationWarning
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SanitizationWarning]
$creadListPrec :: ReadPrec [SanitizationWarning]
readPrec :: ReadPrec SanitizationWarning
$creadPrec :: ReadPrec SanitizationWarning
readList :: ReadS [SanitizationWarning]
$creadList :: ReadS [SanitizationWarning]
readsPrec :: Int -> ReadS SanitizationWarning
$creadsPrec :: Int -> ReadS SanitizationWarning
Prelude.Read, Int -> SanitizationWarning -> ShowS
[SanitizationWarning] -> ShowS
SanitizationWarning -> String
(Int -> SanitizationWarning -> ShowS)
-> (SanitizationWarning -> String)
-> ([SanitizationWarning] -> ShowS)
-> Show SanitizationWarning
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SanitizationWarning] -> ShowS
$cshowList :: [SanitizationWarning] -> ShowS
show :: SanitizationWarning -> String
$cshow :: SanitizationWarning -> String
showsPrec :: Int -> SanitizationWarning -> ShowS
$cshowsPrec :: Int -> SanitizationWarning -> ShowS
Prelude.Show, (forall x. SanitizationWarning -> Rep SanitizationWarning x)
-> (forall x. Rep SanitizationWarning x -> SanitizationWarning)
-> Generic SanitizationWarning
forall x. Rep SanitizationWarning x -> SanitizationWarning
forall x. SanitizationWarning -> Rep SanitizationWarning x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SanitizationWarning x -> SanitizationWarning
$cfrom :: forall x. SanitizationWarning -> Rep SanitizationWarning x
Prelude.Generic)

-- |
-- Create a value of 'SanitizationWarning' 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:
--
-- 'attributeName', 'sanitizationWarning_attributeName' - The name of the XML attribute that has been sanitized.
--
-- 'elementName', 'sanitizationWarning_elementName' - The name of the XML element that has been sanitized.
--
-- 'reason', 'sanitizationWarning_reason' - Required. The reason for which the XML elements or attributes were
-- sanitized.
newSanitizationWarning ::
  -- | 'reason'
  SanitizationWarningReason ->
  SanitizationWarning
newSanitizationWarning :: SanitizationWarningReason -> SanitizationWarning
newSanitizationWarning SanitizationWarningReason
pReason_ =
  SanitizationWarning' :: Maybe Text
-> Maybe Text -> SanitizationWarningReason -> SanitizationWarning
SanitizationWarning'
    { $sel:attributeName:SanitizationWarning' :: Maybe Text
attributeName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:elementName:SanitizationWarning' :: Maybe Text
elementName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:reason:SanitizationWarning' :: SanitizationWarningReason
reason = SanitizationWarningReason
pReason_
    }

-- | The name of the XML attribute that has been sanitized.
sanitizationWarning_attributeName :: Lens.Lens' SanitizationWarning (Prelude.Maybe Prelude.Text)
sanitizationWarning_attributeName :: (Maybe Text -> f (Maybe Text))
-> SanitizationWarning -> f SanitizationWarning
sanitizationWarning_attributeName = (SanitizationWarning -> Maybe Text)
-> (SanitizationWarning -> Maybe Text -> SanitizationWarning)
-> Lens
     SanitizationWarning SanitizationWarning (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SanitizationWarning' {Maybe Text
attributeName :: Maybe Text
$sel:attributeName:SanitizationWarning' :: SanitizationWarning -> Maybe Text
attributeName} -> Maybe Text
attributeName) (\s :: SanitizationWarning
s@SanitizationWarning' {} Maybe Text
a -> SanitizationWarning
s {$sel:attributeName:SanitizationWarning' :: Maybe Text
attributeName = Maybe Text
a} :: SanitizationWarning)

-- | The name of the XML element that has been sanitized.
sanitizationWarning_elementName :: Lens.Lens' SanitizationWarning (Prelude.Maybe Prelude.Text)
sanitizationWarning_elementName :: (Maybe Text -> f (Maybe Text))
-> SanitizationWarning -> f SanitizationWarning
sanitizationWarning_elementName = (SanitizationWarning -> Maybe Text)
-> (SanitizationWarning -> Maybe Text -> SanitizationWarning)
-> Lens
     SanitizationWarning SanitizationWarning (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SanitizationWarning' {Maybe Text
elementName :: Maybe Text
$sel:elementName:SanitizationWarning' :: SanitizationWarning -> Maybe Text
elementName} -> Maybe Text
elementName) (\s :: SanitizationWarning
s@SanitizationWarning' {} Maybe Text
a -> SanitizationWarning
s {$sel:elementName:SanitizationWarning' :: Maybe Text
elementName = Maybe Text
a} :: SanitizationWarning)

-- | Required. The reason for which the XML elements or attributes were
-- sanitized.
sanitizationWarning_reason :: Lens.Lens' SanitizationWarning SanitizationWarningReason
sanitizationWarning_reason :: (SanitizationWarningReason -> f SanitizationWarningReason)
-> SanitizationWarning -> f SanitizationWarning
sanitizationWarning_reason = (SanitizationWarning -> SanitizationWarningReason)
-> (SanitizationWarning
    -> SanitizationWarningReason -> SanitizationWarning)
-> Lens
     SanitizationWarning
     SanitizationWarning
     SanitizationWarningReason
     SanitizationWarningReason
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SanitizationWarning' {SanitizationWarningReason
reason :: SanitizationWarningReason
$sel:reason:SanitizationWarning' :: SanitizationWarning -> SanitizationWarningReason
reason} -> SanitizationWarningReason
reason) (\s :: SanitizationWarning
s@SanitizationWarning' {} SanitizationWarningReason
a -> SanitizationWarning
s {$sel:reason:SanitizationWarning' :: SanitizationWarningReason
reason = SanitizationWarningReason
a} :: SanitizationWarning)

instance Core.FromJSON SanitizationWarning where
  parseJSON :: Value -> Parser SanitizationWarning
parseJSON =
    String
-> (Object -> Parser SanitizationWarning)
-> Value
-> Parser SanitizationWarning
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SanitizationWarning"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> SanitizationWarningReason -> SanitizationWarning
SanitizationWarning'
            (Maybe Text
 -> Maybe Text -> SanitizationWarningReason -> SanitizationWarning)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> SanitizationWarningReason -> SanitizationWarning)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"attributeName")
            Parser
  (Maybe Text -> SanitizationWarningReason -> SanitizationWarning)
-> Parser (Maybe Text)
-> Parser (SanitizationWarningReason -> SanitizationWarning)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"elementName")
            Parser (SanitizationWarningReason -> SanitizationWarning)
-> Parser SanitizationWarningReason -> Parser SanitizationWarning
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser SanitizationWarningReason
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"reason")
      )

instance Prelude.Hashable SanitizationWarning

instance Prelude.NFData SanitizationWarning