{-# 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.DataPipeline.Types.ValidationWarning
-- 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.DataPipeline.Types.ValidationWarning where

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

-- | Defines a validation warning. Validation warnings do not prevent
-- pipeline activation. The set of validation warnings that can be returned
-- are defined by AWS Data Pipeline.
--
-- /See:/ 'newValidationWarning' smart constructor.
data ValidationWarning = ValidationWarning'
  { -- | A description of the validation warning.
    ValidationWarning -> Maybe [Text]
warnings :: Prelude.Maybe [Prelude.Text],
    -- | The identifier of the object that contains the validation warning.
    ValidationWarning -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (ValidationWarning -> ValidationWarning -> Bool
(ValidationWarning -> ValidationWarning -> Bool)
-> (ValidationWarning -> ValidationWarning -> Bool)
-> Eq ValidationWarning
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ValidationWarning -> ValidationWarning -> Bool
$c/= :: ValidationWarning -> ValidationWarning -> Bool
== :: ValidationWarning -> ValidationWarning -> Bool
$c== :: ValidationWarning -> ValidationWarning -> Bool
Prelude.Eq, ReadPrec [ValidationWarning]
ReadPrec ValidationWarning
Int -> ReadS ValidationWarning
ReadS [ValidationWarning]
(Int -> ReadS ValidationWarning)
-> ReadS [ValidationWarning]
-> ReadPrec ValidationWarning
-> ReadPrec [ValidationWarning]
-> Read ValidationWarning
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ValidationWarning]
$creadListPrec :: ReadPrec [ValidationWarning]
readPrec :: ReadPrec ValidationWarning
$creadPrec :: ReadPrec ValidationWarning
readList :: ReadS [ValidationWarning]
$creadList :: ReadS [ValidationWarning]
readsPrec :: Int -> ReadS ValidationWarning
$creadsPrec :: Int -> ReadS ValidationWarning
Prelude.Read, Int -> ValidationWarning -> ShowS
[ValidationWarning] -> ShowS
ValidationWarning -> String
(Int -> ValidationWarning -> ShowS)
-> (ValidationWarning -> String)
-> ([ValidationWarning] -> ShowS)
-> Show ValidationWarning
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ValidationWarning] -> ShowS
$cshowList :: [ValidationWarning] -> ShowS
show :: ValidationWarning -> String
$cshow :: ValidationWarning -> String
showsPrec :: Int -> ValidationWarning -> ShowS
$cshowsPrec :: Int -> ValidationWarning -> ShowS
Prelude.Show, (forall x. ValidationWarning -> Rep ValidationWarning x)
-> (forall x. Rep ValidationWarning x -> ValidationWarning)
-> Generic ValidationWarning
forall x. Rep ValidationWarning x -> ValidationWarning
forall x. ValidationWarning -> Rep ValidationWarning x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ValidationWarning x -> ValidationWarning
$cfrom :: forall x. ValidationWarning -> Rep ValidationWarning x
Prelude.Generic)

-- |
-- Create a value of 'ValidationWarning' 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:
--
-- 'warnings', 'validationWarning_warnings' - A description of the validation warning.
--
-- 'id', 'validationWarning_id' - The identifier of the object that contains the validation warning.
newValidationWarning ::
  ValidationWarning
newValidationWarning :: ValidationWarning
newValidationWarning =
  ValidationWarning' :: Maybe [Text] -> Maybe Text -> ValidationWarning
ValidationWarning'
    { $sel:warnings:ValidationWarning' :: Maybe [Text]
warnings = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:id:ValidationWarning' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A description of the validation warning.
validationWarning_warnings :: Lens.Lens' ValidationWarning (Prelude.Maybe [Prelude.Text])
validationWarning_warnings :: (Maybe [Text] -> f (Maybe [Text]))
-> ValidationWarning -> f ValidationWarning
validationWarning_warnings = (ValidationWarning -> Maybe [Text])
-> (ValidationWarning -> Maybe [Text] -> ValidationWarning)
-> Lens
     ValidationWarning ValidationWarning (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidationWarning' {Maybe [Text]
warnings :: Maybe [Text]
$sel:warnings:ValidationWarning' :: ValidationWarning -> Maybe [Text]
warnings} -> Maybe [Text]
warnings) (\s :: ValidationWarning
s@ValidationWarning' {} Maybe [Text]
a -> ValidationWarning
s {$sel:warnings:ValidationWarning' :: Maybe [Text]
warnings = Maybe [Text]
a} :: ValidationWarning) ((Maybe [Text] -> f (Maybe [Text]))
 -> ValidationWarning -> f ValidationWarning)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ValidationWarning
-> f ValidationWarning
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The identifier of the object that contains the validation warning.
validationWarning_id :: Lens.Lens' ValidationWarning (Prelude.Maybe Prelude.Text)
validationWarning_id :: (Maybe Text -> f (Maybe Text))
-> ValidationWarning -> f ValidationWarning
validationWarning_id = (ValidationWarning -> Maybe Text)
-> (ValidationWarning -> Maybe Text -> ValidationWarning)
-> Lens
     ValidationWarning ValidationWarning (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidationWarning' {Maybe Text
id :: Maybe Text
$sel:id:ValidationWarning' :: ValidationWarning -> Maybe Text
id} -> Maybe Text
id) (\s :: ValidationWarning
s@ValidationWarning' {} Maybe Text
a -> ValidationWarning
s {$sel:id:ValidationWarning' :: Maybe Text
id = Maybe Text
a} :: ValidationWarning)

instance Core.FromJSON ValidationWarning where
  parseJSON :: Value -> Parser ValidationWarning
parseJSON =
    String
-> (Object -> Parser ValidationWarning)
-> Value
-> Parser ValidationWarning
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ValidationWarning"
      ( \Object
x ->
          Maybe [Text] -> Maybe Text -> ValidationWarning
ValidationWarning'
            (Maybe [Text] -> Maybe Text -> ValidationWarning)
-> Parser (Maybe [Text])
-> Parser (Maybe Text -> ValidationWarning)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"warnings" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Text -> ValidationWarning)
-> Parser (Maybe Text) -> Parser ValidationWarning
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
"id")
      )

instance Prelude.Hashable ValidationWarning

instance Prelude.NFData ValidationWarning