{-# 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.ElasticTranscoder.Types.Warning
-- 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.ElasticTranscoder.Types.Warning where

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

-- | Elastic Transcoder returns a warning if the resources used by your
-- pipeline are not in the same region as the pipeline.
--
-- Using resources in the same region, such as your Amazon S3 buckets,
-- Amazon SNS notification topics, and AWS KMS key, reduces processing time
-- and prevents cross-regional charges.
--
-- /See:/ 'newWarning' smart constructor.
data Warning = Warning'
  { -- | The code of the cross-regional warning.
    Warning -> Maybe Text
code :: Prelude.Maybe Prelude.Text,
    -- | The message explaining what resources are in a different region from the
    -- pipeline.
    --
    -- AWS KMS keys must be in the same region as the pipeline.
    Warning -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (Warning -> Warning -> Bool
(Warning -> Warning -> Bool)
-> (Warning -> Warning -> Bool) -> Eq Warning
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Warning -> Warning -> Bool
$c/= :: Warning -> Warning -> Bool
== :: Warning -> Warning -> Bool
$c== :: Warning -> Warning -> Bool
Prelude.Eq, ReadPrec [Warning]
ReadPrec Warning
Int -> ReadS Warning
ReadS [Warning]
(Int -> ReadS Warning)
-> ReadS [Warning]
-> ReadPrec Warning
-> ReadPrec [Warning]
-> Read Warning
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Warning]
$creadListPrec :: ReadPrec [Warning]
readPrec :: ReadPrec Warning
$creadPrec :: ReadPrec Warning
readList :: ReadS [Warning]
$creadList :: ReadS [Warning]
readsPrec :: Int -> ReadS Warning
$creadsPrec :: Int -> ReadS Warning
Prelude.Read, Int -> Warning -> ShowS
[Warning] -> ShowS
Warning -> String
(Int -> Warning -> ShowS)
-> (Warning -> String) -> ([Warning] -> ShowS) -> Show Warning
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Warning] -> ShowS
$cshowList :: [Warning] -> ShowS
show :: Warning -> String
$cshow :: Warning -> String
showsPrec :: Int -> Warning -> ShowS
$cshowsPrec :: Int -> Warning -> ShowS
Prelude.Show, (forall x. Warning -> Rep Warning x)
-> (forall x. Rep Warning x -> Warning) -> Generic Warning
forall x. Rep Warning x -> Warning
forall x. Warning -> Rep Warning x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Warning x -> Warning
$cfrom :: forall x. Warning -> Rep Warning x
Prelude.Generic)

-- |
-- Create a value of 'Warning' 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:
--
-- 'code', 'warning_code' - The code of the cross-regional warning.
--
-- 'message', 'warning_message' - The message explaining what resources are in a different region from the
-- pipeline.
--
-- AWS KMS keys must be in the same region as the pipeline.
newWarning ::
  Warning
newWarning :: Warning
newWarning =
  Warning' :: Maybe Text -> Maybe Text -> Warning
Warning'
    { $sel:code:Warning' :: Maybe Text
code = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:message:Warning' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The code of the cross-regional warning.
warning_code :: Lens.Lens' Warning (Prelude.Maybe Prelude.Text)
warning_code :: (Maybe Text -> f (Maybe Text)) -> Warning -> f Warning
warning_code = (Warning -> Maybe Text)
-> (Warning -> Maybe Text -> Warning)
-> Lens Warning Warning (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Warning' {Maybe Text
code :: Maybe Text
$sel:code:Warning' :: Warning -> Maybe Text
code} -> Maybe Text
code) (\s :: Warning
s@Warning' {} Maybe Text
a -> Warning
s {$sel:code:Warning' :: Maybe Text
code = Maybe Text
a} :: Warning)

-- | The message explaining what resources are in a different region from the
-- pipeline.
--
-- AWS KMS keys must be in the same region as the pipeline.
warning_message :: Lens.Lens' Warning (Prelude.Maybe Prelude.Text)
warning_message :: (Maybe Text -> f (Maybe Text)) -> Warning -> f Warning
warning_message = (Warning -> Maybe Text)
-> (Warning -> Maybe Text -> Warning)
-> Lens Warning Warning (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Warning' {Maybe Text
message :: Maybe Text
$sel:message:Warning' :: Warning -> Maybe Text
message} -> Maybe Text
message) (\s :: Warning
s@Warning' {} Maybe Text
a -> Warning
s {$sel:message:Warning' :: Maybe Text
message = Maybe Text
a} :: Warning)

instance Core.FromJSON Warning where
  parseJSON :: Value -> Parser Warning
parseJSON =
    String -> (Object -> Parser Warning) -> Value -> Parser Warning
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Warning"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Warning
Warning'
            (Maybe Text -> Maybe Text -> Warning)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Warning)
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
"Code")
            Parser (Maybe Text -> Warning)
-> Parser (Maybe Text) -> Parser Warning
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
"Message")
      )

instance Prelude.Hashable Warning

instance Prelude.NFData Warning