{-# 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.EC2.Types.EnableFastSnapshotRestoreStateError
-- 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.EC2.Types.EnableFastSnapshotRestoreStateError where

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

-- | Describes an error that occurred when enabling fast snapshot restores.
--
-- /See:/ 'newEnableFastSnapshotRestoreStateError' smart constructor.
data EnableFastSnapshotRestoreStateError = EnableFastSnapshotRestoreStateError'
  { -- | The error code.
    EnableFastSnapshotRestoreStateError -> Maybe Text
code :: Prelude.Maybe Prelude.Text,
    -- | The error message.
    EnableFastSnapshotRestoreStateError -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (EnableFastSnapshotRestoreStateError
-> EnableFastSnapshotRestoreStateError -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnableFastSnapshotRestoreStateError
-> EnableFastSnapshotRestoreStateError -> Bool
$c/= :: EnableFastSnapshotRestoreStateError
-> EnableFastSnapshotRestoreStateError -> Bool
== :: EnableFastSnapshotRestoreStateError
-> EnableFastSnapshotRestoreStateError -> Bool
$c== :: EnableFastSnapshotRestoreStateError
-> EnableFastSnapshotRestoreStateError -> Bool
Prelude.Eq, ReadPrec [EnableFastSnapshotRestoreStateError]
ReadPrec EnableFastSnapshotRestoreStateError
Int -> ReadS EnableFastSnapshotRestoreStateError
ReadS [EnableFastSnapshotRestoreStateError]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnableFastSnapshotRestoreStateError]
$creadListPrec :: ReadPrec [EnableFastSnapshotRestoreStateError]
readPrec :: ReadPrec EnableFastSnapshotRestoreStateError
$creadPrec :: ReadPrec EnableFastSnapshotRestoreStateError
readList :: ReadS [EnableFastSnapshotRestoreStateError]
$creadList :: ReadS [EnableFastSnapshotRestoreStateError]
readsPrec :: Int -> ReadS EnableFastSnapshotRestoreStateError
$creadsPrec :: Int -> ReadS EnableFastSnapshotRestoreStateError
Prelude.Read, Int -> EnableFastSnapshotRestoreStateError -> ShowS
[EnableFastSnapshotRestoreStateError] -> ShowS
EnableFastSnapshotRestoreStateError -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnableFastSnapshotRestoreStateError] -> ShowS
$cshowList :: [EnableFastSnapshotRestoreStateError] -> ShowS
show :: EnableFastSnapshotRestoreStateError -> String
$cshow :: EnableFastSnapshotRestoreStateError -> String
showsPrec :: Int -> EnableFastSnapshotRestoreStateError -> ShowS
$cshowsPrec :: Int -> EnableFastSnapshotRestoreStateError -> ShowS
Prelude.Show, forall x.
Rep EnableFastSnapshotRestoreStateError x
-> EnableFastSnapshotRestoreStateError
forall x.
EnableFastSnapshotRestoreStateError
-> Rep EnableFastSnapshotRestoreStateError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EnableFastSnapshotRestoreStateError x
-> EnableFastSnapshotRestoreStateError
$cfrom :: forall x.
EnableFastSnapshotRestoreStateError
-> Rep EnableFastSnapshotRestoreStateError x
Prelude.Generic)

-- |
-- Create a value of 'EnableFastSnapshotRestoreStateError' 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', 'enableFastSnapshotRestoreStateError_code' - The error code.
--
-- 'message', 'enableFastSnapshotRestoreStateError_message' - The error message.
newEnableFastSnapshotRestoreStateError ::
  EnableFastSnapshotRestoreStateError
newEnableFastSnapshotRestoreStateError :: EnableFastSnapshotRestoreStateError
newEnableFastSnapshotRestoreStateError =
  EnableFastSnapshotRestoreStateError'
    { $sel:code:EnableFastSnapshotRestoreStateError' :: Maybe Text
code =
        forall a. Maybe a
Prelude.Nothing,
      $sel:message:EnableFastSnapshotRestoreStateError' :: Maybe Text
message = forall a. Maybe a
Prelude.Nothing
    }

-- | The error code.
enableFastSnapshotRestoreStateError_code :: Lens.Lens' EnableFastSnapshotRestoreStateError (Prelude.Maybe Prelude.Text)
enableFastSnapshotRestoreStateError_code :: Lens' EnableFastSnapshotRestoreStateError (Maybe Text)
enableFastSnapshotRestoreStateError_code = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableFastSnapshotRestoreStateError' {Maybe Text
code :: Maybe Text
$sel:code:EnableFastSnapshotRestoreStateError' :: EnableFastSnapshotRestoreStateError -> Maybe Text
code} -> Maybe Text
code) (\s :: EnableFastSnapshotRestoreStateError
s@EnableFastSnapshotRestoreStateError' {} Maybe Text
a -> EnableFastSnapshotRestoreStateError
s {$sel:code:EnableFastSnapshotRestoreStateError' :: Maybe Text
code = Maybe Text
a} :: EnableFastSnapshotRestoreStateError)

-- | The error message.
enableFastSnapshotRestoreStateError_message :: Lens.Lens' EnableFastSnapshotRestoreStateError (Prelude.Maybe Prelude.Text)
enableFastSnapshotRestoreStateError_message :: Lens' EnableFastSnapshotRestoreStateError (Maybe Text)
enableFastSnapshotRestoreStateError_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableFastSnapshotRestoreStateError' {Maybe Text
message :: Maybe Text
$sel:message:EnableFastSnapshotRestoreStateError' :: EnableFastSnapshotRestoreStateError -> Maybe Text
message} -> Maybe Text
message) (\s :: EnableFastSnapshotRestoreStateError
s@EnableFastSnapshotRestoreStateError' {} Maybe Text
a -> EnableFastSnapshotRestoreStateError
s {$sel:message:EnableFastSnapshotRestoreStateError' :: Maybe Text
message = Maybe Text
a} :: EnableFastSnapshotRestoreStateError)

instance
  Data.FromXML
    EnableFastSnapshotRestoreStateError
  where
  parseXML :: [Node] -> Either String EnableFastSnapshotRestoreStateError
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> EnableFastSnapshotRestoreStateError
EnableFastSnapshotRestoreStateError'
      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
"code")
      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
"message")

instance
  Prelude.Hashable
    EnableFastSnapshotRestoreStateError
  where
  hashWithSalt :: Int -> EnableFastSnapshotRestoreStateError -> Int
hashWithSalt
    Int
_salt
    EnableFastSnapshotRestoreStateError' {Maybe Text
message :: Maybe Text
code :: Maybe Text
$sel:message:EnableFastSnapshotRestoreStateError' :: EnableFastSnapshotRestoreStateError -> Maybe Text
$sel:code:EnableFastSnapshotRestoreStateError' :: EnableFastSnapshotRestoreStateError -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
code
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message

instance
  Prelude.NFData
    EnableFastSnapshotRestoreStateError
  where
  rnf :: EnableFastSnapshotRestoreStateError -> ()
rnf EnableFastSnapshotRestoreStateError' {Maybe Text
message :: Maybe Text
code :: Maybe Text
$sel:message:EnableFastSnapshotRestoreStateError' :: EnableFastSnapshotRestoreStateError -> Maybe Text
$sel:code:EnableFastSnapshotRestoreStateError' :: EnableFastSnapshotRestoreStateError -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
code seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message