{-# 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.LexModels.Types.MigrationAlert
-- 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.LexModels.Types.MigrationAlert where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LexModels.Types.MigrationAlertType
import qualified Amazonka.Prelude as Prelude

-- | Provides information about alerts and warnings that Amazon Lex sends
-- during a migration. The alerts include information about how to resolve
-- the issue.
--
-- /See:/ 'newMigrationAlert' smart constructor.
data MigrationAlert = MigrationAlert'
  { -- | A link to the Amazon Lex documentation that describes how to resolve the
    -- alert.
    MigrationAlert -> Maybe [Text]
referenceURLs :: Prelude.Maybe [Prelude.Text],
    -- | Additional details about the alert.
    MigrationAlert -> Maybe [Text]
details :: Prelude.Maybe [Prelude.Text],
    -- | The type of alert. There are two kinds of alerts:
    --
    -- -   @ERROR@ - There was an issue with the migration that can\'t be
    --     resolved. The migration stops.
    --
    -- -   @WARN@ - There was an issue with the migration that requires manual
    --     changes to the new Amazon Lex V2 bot. The migration continues.
    MigrationAlert -> Maybe MigrationAlertType
type' :: Prelude.Maybe MigrationAlertType,
    -- | A message that describes why the alert was issued.
    MigrationAlert -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (MigrationAlert -> MigrationAlert -> Bool
(MigrationAlert -> MigrationAlert -> Bool)
-> (MigrationAlert -> MigrationAlert -> Bool) -> Eq MigrationAlert
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MigrationAlert -> MigrationAlert -> Bool
$c/= :: MigrationAlert -> MigrationAlert -> Bool
== :: MigrationAlert -> MigrationAlert -> Bool
$c== :: MigrationAlert -> MigrationAlert -> Bool
Prelude.Eq, ReadPrec [MigrationAlert]
ReadPrec MigrationAlert
Int -> ReadS MigrationAlert
ReadS [MigrationAlert]
(Int -> ReadS MigrationAlert)
-> ReadS [MigrationAlert]
-> ReadPrec MigrationAlert
-> ReadPrec [MigrationAlert]
-> Read MigrationAlert
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MigrationAlert]
$creadListPrec :: ReadPrec [MigrationAlert]
readPrec :: ReadPrec MigrationAlert
$creadPrec :: ReadPrec MigrationAlert
readList :: ReadS [MigrationAlert]
$creadList :: ReadS [MigrationAlert]
readsPrec :: Int -> ReadS MigrationAlert
$creadsPrec :: Int -> ReadS MigrationAlert
Prelude.Read, Int -> MigrationAlert -> ShowS
[MigrationAlert] -> ShowS
MigrationAlert -> String
(Int -> MigrationAlert -> ShowS)
-> (MigrationAlert -> String)
-> ([MigrationAlert] -> ShowS)
-> Show MigrationAlert
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MigrationAlert] -> ShowS
$cshowList :: [MigrationAlert] -> ShowS
show :: MigrationAlert -> String
$cshow :: MigrationAlert -> String
showsPrec :: Int -> MigrationAlert -> ShowS
$cshowsPrec :: Int -> MigrationAlert -> ShowS
Prelude.Show, (forall x. MigrationAlert -> Rep MigrationAlert x)
-> (forall x. Rep MigrationAlert x -> MigrationAlert)
-> Generic MigrationAlert
forall x. Rep MigrationAlert x -> MigrationAlert
forall x. MigrationAlert -> Rep MigrationAlert x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MigrationAlert x -> MigrationAlert
$cfrom :: forall x. MigrationAlert -> Rep MigrationAlert x
Prelude.Generic)

-- |
-- Create a value of 'MigrationAlert' 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:
--
-- 'referenceURLs', 'migrationAlert_referenceURLs' - A link to the Amazon Lex documentation that describes how to resolve the
-- alert.
--
-- 'details', 'migrationAlert_details' - Additional details about the alert.
--
-- 'type'', 'migrationAlert_type' - The type of alert. There are two kinds of alerts:
--
-- -   @ERROR@ - There was an issue with the migration that can\'t be
--     resolved. The migration stops.
--
-- -   @WARN@ - There was an issue with the migration that requires manual
--     changes to the new Amazon Lex V2 bot. The migration continues.
--
-- 'message', 'migrationAlert_message' - A message that describes why the alert was issued.
newMigrationAlert ::
  MigrationAlert
newMigrationAlert :: MigrationAlert
newMigrationAlert =
  MigrationAlert' :: Maybe [Text]
-> Maybe [Text]
-> Maybe MigrationAlertType
-> Maybe Text
-> MigrationAlert
MigrationAlert'
    { $sel:referenceURLs:MigrationAlert' :: Maybe [Text]
referenceURLs = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:details:MigrationAlert' :: Maybe [Text]
details = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:type':MigrationAlert' :: Maybe MigrationAlertType
type' = Maybe MigrationAlertType
forall a. Maybe a
Prelude.Nothing,
      $sel:message:MigrationAlert' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A link to the Amazon Lex documentation that describes how to resolve the
-- alert.
migrationAlert_referenceURLs :: Lens.Lens' MigrationAlert (Prelude.Maybe [Prelude.Text])
migrationAlert_referenceURLs :: (Maybe [Text] -> f (Maybe [Text]))
-> MigrationAlert -> f MigrationAlert
migrationAlert_referenceURLs = (MigrationAlert -> Maybe [Text])
-> (MigrationAlert -> Maybe [Text] -> MigrationAlert)
-> Lens MigrationAlert MigrationAlert (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MigrationAlert' {Maybe [Text]
referenceURLs :: Maybe [Text]
$sel:referenceURLs:MigrationAlert' :: MigrationAlert -> Maybe [Text]
referenceURLs} -> Maybe [Text]
referenceURLs) (\s :: MigrationAlert
s@MigrationAlert' {} Maybe [Text]
a -> MigrationAlert
s {$sel:referenceURLs:MigrationAlert' :: Maybe [Text]
referenceURLs = Maybe [Text]
a} :: MigrationAlert) ((Maybe [Text] -> f (Maybe [Text]))
 -> MigrationAlert -> f MigrationAlert)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> MigrationAlert
-> f MigrationAlert
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

-- | Additional details about the alert.
migrationAlert_details :: Lens.Lens' MigrationAlert (Prelude.Maybe [Prelude.Text])
migrationAlert_details :: (Maybe [Text] -> f (Maybe [Text]))
-> MigrationAlert -> f MigrationAlert
migrationAlert_details = (MigrationAlert -> Maybe [Text])
-> (MigrationAlert -> Maybe [Text] -> MigrationAlert)
-> Lens MigrationAlert MigrationAlert (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MigrationAlert' {Maybe [Text]
details :: Maybe [Text]
$sel:details:MigrationAlert' :: MigrationAlert -> Maybe [Text]
details} -> Maybe [Text]
details) (\s :: MigrationAlert
s@MigrationAlert' {} Maybe [Text]
a -> MigrationAlert
s {$sel:details:MigrationAlert' :: Maybe [Text]
details = Maybe [Text]
a} :: MigrationAlert) ((Maybe [Text] -> f (Maybe [Text]))
 -> MigrationAlert -> f MigrationAlert)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> MigrationAlert
-> f MigrationAlert
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 type of alert. There are two kinds of alerts:
--
-- -   @ERROR@ - There was an issue with the migration that can\'t be
--     resolved. The migration stops.
--
-- -   @WARN@ - There was an issue with the migration that requires manual
--     changes to the new Amazon Lex V2 bot. The migration continues.
migrationAlert_type :: Lens.Lens' MigrationAlert (Prelude.Maybe MigrationAlertType)
migrationAlert_type :: (Maybe MigrationAlertType -> f (Maybe MigrationAlertType))
-> MigrationAlert -> f MigrationAlert
migrationAlert_type = (MigrationAlert -> Maybe MigrationAlertType)
-> (MigrationAlert -> Maybe MigrationAlertType -> MigrationAlert)
-> Lens
     MigrationAlert
     MigrationAlert
     (Maybe MigrationAlertType)
     (Maybe MigrationAlertType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MigrationAlert' {Maybe MigrationAlertType
type' :: Maybe MigrationAlertType
$sel:type':MigrationAlert' :: MigrationAlert -> Maybe MigrationAlertType
type'} -> Maybe MigrationAlertType
type') (\s :: MigrationAlert
s@MigrationAlert' {} Maybe MigrationAlertType
a -> MigrationAlert
s {$sel:type':MigrationAlert' :: Maybe MigrationAlertType
type' = Maybe MigrationAlertType
a} :: MigrationAlert)

-- | A message that describes why the alert was issued.
migrationAlert_message :: Lens.Lens' MigrationAlert (Prelude.Maybe Prelude.Text)
migrationAlert_message :: (Maybe Text -> f (Maybe Text))
-> MigrationAlert -> f MigrationAlert
migrationAlert_message = (MigrationAlert -> Maybe Text)
-> (MigrationAlert -> Maybe Text -> MigrationAlert)
-> Lens MigrationAlert MigrationAlert (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MigrationAlert' {Maybe Text
message :: Maybe Text
$sel:message:MigrationAlert' :: MigrationAlert -> Maybe Text
message} -> Maybe Text
message) (\s :: MigrationAlert
s@MigrationAlert' {} Maybe Text
a -> MigrationAlert
s {$sel:message:MigrationAlert' :: Maybe Text
message = Maybe Text
a} :: MigrationAlert)

instance Core.FromJSON MigrationAlert where
  parseJSON :: Value -> Parser MigrationAlert
parseJSON =
    String
-> (Object -> Parser MigrationAlert)
-> Value
-> Parser MigrationAlert
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MigrationAlert"
      ( \Object
x ->
          Maybe [Text]
-> Maybe [Text]
-> Maybe MigrationAlertType
-> Maybe Text
-> MigrationAlert
MigrationAlert'
            (Maybe [Text]
 -> Maybe [Text]
 -> Maybe MigrationAlertType
 -> Maybe Text
 -> MigrationAlert)
-> Parser (Maybe [Text])
-> Parser
     (Maybe [Text]
      -> Maybe MigrationAlertType -> Maybe Text -> MigrationAlert)
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
"referenceURLs" 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]
   -> Maybe MigrationAlertType -> Maybe Text -> MigrationAlert)
-> Parser (Maybe [Text])
-> Parser
     (Maybe MigrationAlertType -> Maybe Text -> MigrationAlert)
forall (f :: * -> *) a b. Applicative f => 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
"details" 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 MigrationAlertType -> Maybe Text -> MigrationAlert)
-> Parser (Maybe MigrationAlertType)
-> Parser (Maybe Text -> MigrationAlert)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MigrationAlertType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"type")
            Parser (Maybe Text -> MigrationAlert)
-> Parser (Maybe Text) -> Parser MigrationAlert
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 MigrationAlert

instance Prelude.NFData MigrationAlert