{-# 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.Redshift.Types.SnapshotErrorMessage
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Redshift.Types.SnapshotErrorMessage where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.Internal

-- | Describes the errors returned by a snapshot.
--
-- /See:/ 'newSnapshotErrorMessage' smart constructor.
data SnapshotErrorMessage = SnapshotErrorMessage'
  { -- | The failure code for the error.
    SnapshotErrorMessage -> Maybe Text
failureCode :: Prelude.Maybe Prelude.Text,
    -- | The text message describing the error.
    SnapshotErrorMessage -> Maybe Text
failureReason :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for the cluster.
    SnapshotErrorMessage -> Maybe Text
snapshotClusterIdentifier :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for the snapshot returning the error.
    SnapshotErrorMessage -> Maybe Text
snapshotIdentifier :: Prelude.Maybe Prelude.Text
  }
  deriving (SnapshotErrorMessage -> SnapshotErrorMessage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SnapshotErrorMessage -> SnapshotErrorMessage -> Bool
$c/= :: SnapshotErrorMessage -> SnapshotErrorMessage -> Bool
== :: SnapshotErrorMessage -> SnapshotErrorMessage -> Bool
$c== :: SnapshotErrorMessage -> SnapshotErrorMessage -> Bool
Prelude.Eq, ReadPrec [SnapshotErrorMessage]
ReadPrec SnapshotErrorMessage
Int -> ReadS SnapshotErrorMessage
ReadS [SnapshotErrorMessage]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SnapshotErrorMessage]
$creadListPrec :: ReadPrec [SnapshotErrorMessage]
readPrec :: ReadPrec SnapshotErrorMessage
$creadPrec :: ReadPrec SnapshotErrorMessage
readList :: ReadS [SnapshotErrorMessage]
$creadList :: ReadS [SnapshotErrorMessage]
readsPrec :: Int -> ReadS SnapshotErrorMessage
$creadsPrec :: Int -> ReadS SnapshotErrorMessage
Prelude.Read, Int -> SnapshotErrorMessage -> ShowS
[SnapshotErrorMessage] -> ShowS
SnapshotErrorMessage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SnapshotErrorMessage] -> ShowS
$cshowList :: [SnapshotErrorMessage] -> ShowS
show :: SnapshotErrorMessage -> String
$cshow :: SnapshotErrorMessage -> String
showsPrec :: Int -> SnapshotErrorMessage -> ShowS
$cshowsPrec :: Int -> SnapshotErrorMessage -> ShowS
Prelude.Show, forall x. Rep SnapshotErrorMessage x -> SnapshotErrorMessage
forall x. SnapshotErrorMessage -> Rep SnapshotErrorMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SnapshotErrorMessage x -> SnapshotErrorMessage
$cfrom :: forall x. SnapshotErrorMessage -> Rep SnapshotErrorMessage x
Prelude.Generic)

-- |
-- Create a value of 'SnapshotErrorMessage' 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:
--
-- 'failureCode', 'snapshotErrorMessage_failureCode' - The failure code for the error.
--
-- 'failureReason', 'snapshotErrorMessage_failureReason' - The text message describing the error.
--
-- 'snapshotClusterIdentifier', 'snapshotErrorMessage_snapshotClusterIdentifier' - A unique identifier for the cluster.
--
-- 'snapshotIdentifier', 'snapshotErrorMessage_snapshotIdentifier' - A unique identifier for the snapshot returning the error.
newSnapshotErrorMessage ::
  SnapshotErrorMessage
newSnapshotErrorMessage :: SnapshotErrorMessage
newSnapshotErrorMessage =
  SnapshotErrorMessage'
    { $sel:failureCode:SnapshotErrorMessage' :: Maybe Text
failureCode =
        forall a. Maybe a
Prelude.Nothing,
      $sel:failureReason:SnapshotErrorMessage' :: Maybe Text
failureReason = forall a. Maybe a
Prelude.Nothing,
      $sel:snapshotClusterIdentifier:SnapshotErrorMessage' :: Maybe Text
snapshotClusterIdentifier = forall a. Maybe a
Prelude.Nothing,
      $sel:snapshotIdentifier:SnapshotErrorMessage' :: Maybe Text
snapshotIdentifier = forall a. Maybe a
Prelude.Nothing
    }

-- | The failure code for the error.
snapshotErrorMessage_failureCode :: Lens.Lens' SnapshotErrorMessage (Prelude.Maybe Prelude.Text)
snapshotErrorMessage_failureCode :: Lens' SnapshotErrorMessage (Maybe Text)
snapshotErrorMessage_failureCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotErrorMessage' {Maybe Text
failureCode :: Maybe Text
$sel:failureCode:SnapshotErrorMessage' :: SnapshotErrorMessage -> Maybe Text
failureCode} -> Maybe Text
failureCode) (\s :: SnapshotErrorMessage
s@SnapshotErrorMessage' {} Maybe Text
a -> SnapshotErrorMessage
s {$sel:failureCode:SnapshotErrorMessage' :: Maybe Text
failureCode = Maybe Text
a} :: SnapshotErrorMessage)

-- | The text message describing the error.
snapshotErrorMessage_failureReason :: Lens.Lens' SnapshotErrorMessage (Prelude.Maybe Prelude.Text)
snapshotErrorMessage_failureReason :: Lens' SnapshotErrorMessage (Maybe Text)
snapshotErrorMessage_failureReason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotErrorMessage' {Maybe Text
failureReason :: Maybe Text
$sel:failureReason:SnapshotErrorMessage' :: SnapshotErrorMessage -> Maybe Text
failureReason} -> Maybe Text
failureReason) (\s :: SnapshotErrorMessage
s@SnapshotErrorMessage' {} Maybe Text
a -> SnapshotErrorMessage
s {$sel:failureReason:SnapshotErrorMessage' :: Maybe Text
failureReason = Maybe Text
a} :: SnapshotErrorMessage)

-- | A unique identifier for the cluster.
snapshotErrorMessage_snapshotClusterIdentifier :: Lens.Lens' SnapshotErrorMessage (Prelude.Maybe Prelude.Text)
snapshotErrorMessage_snapshotClusterIdentifier :: Lens' SnapshotErrorMessage (Maybe Text)
snapshotErrorMessage_snapshotClusterIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotErrorMessage' {Maybe Text
snapshotClusterIdentifier :: Maybe Text
$sel:snapshotClusterIdentifier:SnapshotErrorMessage' :: SnapshotErrorMessage -> Maybe Text
snapshotClusterIdentifier} -> Maybe Text
snapshotClusterIdentifier) (\s :: SnapshotErrorMessage
s@SnapshotErrorMessage' {} Maybe Text
a -> SnapshotErrorMessage
s {$sel:snapshotClusterIdentifier:SnapshotErrorMessage' :: Maybe Text
snapshotClusterIdentifier = Maybe Text
a} :: SnapshotErrorMessage)

-- | A unique identifier for the snapshot returning the error.
snapshotErrorMessage_snapshotIdentifier :: Lens.Lens' SnapshotErrorMessage (Prelude.Maybe Prelude.Text)
snapshotErrorMessage_snapshotIdentifier :: Lens' SnapshotErrorMessage (Maybe Text)
snapshotErrorMessage_snapshotIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotErrorMessage' {Maybe Text
snapshotIdentifier :: Maybe Text
$sel:snapshotIdentifier:SnapshotErrorMessage' :: SnapshotErrorMessage -> Maybe Text
snapshotIdentifier} -> Maybe Text
snapshotIdentifier) (\s :: SnapshotErrorMessage
s@SnapshotErrorMessage' {} Maybe Text
a -> SnapshotErrorMessage
s {$sel:snapshotIdentifier:SnapshotErrorMessage' :: Maybe Text
snapshotIdentifier = Maybe Text
a} :: SnapshotErrorMessage)

instance Data.FromXML SnapshotErrorMessage where
  parseXML :: [Node] -> Either String SnapshotErrorMessage
parseXML [Node]
x =
    Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> SnapshotErrorMessage
SnapshotErrorMessage'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"FailureCode")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"FailureReason")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"SnapshotClusterIdentifier")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"SnapshotIdentifier")

instance Prelude.Hashable SnapshotErrorMessage where
  hashWithSalt :: Int -> SnapshotErrorMessage -> Int
hashWithSalt Int
_salt SnapshotErrorMessage' {Maybe Text
snapshotIdentifier :: Maybe Text
snapshotClusterIdentifier :: Maybe Text
failureReason :: Maybe Text
failureCode :: Maybe Text
$sel:snapshotIdentifier:SnapshotErrorMessage' :: SnapshotErrorMessage -> Maybe Text
$sel:snapshotClusterIdentifier:SnapshotErrorMessage' :: SnapshotErrorMessage -> Maybe Text
$sel:failureReason:SnapshotErrorMessage' :: SnapshotErrorMessage -> Maybe Text
$sel:failureCode:SnapshotErrorMessage' :: SnapshotErrorMessage -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
failureCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
failureReason
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
snapshotClusterIdentifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
snapshotIdentifier

instance Prelude.NFData SnapshotErrorMessage where
  rnf :: SnapshotErrorMessage -> ()
rnf SnapshotErrorMessage' {Maybe Text
snapshotIdentifier :: Maybe Text
snapshotClusterIdentifier :: Maybe Text
failureReason :: Maybe Text
failureCode :: Maybe Text
$sel:snapshotIdentifier:SnapshotErrorMessage' :: SnapshotErrorMessage -> Maybe Text
$sel:snapshotClusterIdentifier:SnapshotErrorMessage' :: SnapshotErrorMessage -> Maybe Text
$sel:failureReason:SnapshotErrorMessage' :: SnapshotErrorMessage -> Maybe Text
$sel:failureCode:SnapshotErrorMessage' :: SnapshotErrorMessage -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
failureCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
failureReason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
snapshotClusterIdentifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
snapshotIdentifier