{-# 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.DisableFastSnapshotRestoreErrorItem
-- 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.DisableFastSnapshotRestoreErrorItem 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 Amazonka.EC2.Types.DisableFastSnapshotRestoreStateErrorItem
import qualified Amazonka.Prelude as Prelude

-- | Contains information about the errors that occurred when disabling fast
-- snapshot restores.
--
-- /See:/ 'newDisableFastSnapshotRestoreErrorItem' smart constructor.
data DisableFastSnapshotRestoreErrorItem = DisableFastSnapshotRestoreErrorItem'
  { -- | The errors.
    DisableFastSnapshotRestoreErrorItem
-> Maybe [DisableFastSnapshotRestoreStateErrorItem]
fastSnapshotRestoreStateErrors :: Prelude.Maybe [DisableFastSnapshotRestoreStateErrorItem],
    -- | The ID of the snapshot.
    DisableFastSnapshotRestoreErrorItem -> Maybe Text
snapshotId :: Prelude.Maybe Prelude.Text
  }
  deriving (DisableFastSnapshotRestoreErrorItem
-> DisableFastSnapshotRestoreErrorItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisableFastSnapshotRestoreErrorItem
-> DisableFastSnapshotRestoreErrorItem -> Bool
$c/= :: DisableFastSnapshotRestoreErrorItem
-> DisableFastSnapshotRestoreErrorItem -> Bool
== :: DisableFastSnapshotRestoreErrorItem
-> DisableFastSnapshotRestoreErrorItem -> Bool
$c== :: DisableFastSnapshotRestoreErrorItem
-> DisableFastSnapshotRestoreErrorItem -> Bool
Prelude.Eq, ReadPrec [DisableFastSnapshotRestoreErrorItem]
ReadPrec DisableFastSnapshotRestoreErrorItem
Int -> ReadS DisableFastSnapshotRestoreErrorItem
ReadS [DisableFastSnapshotRestoreErrorItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisableFastSnapshotRestoreErrorItem]
$creadListPrec :: ReadPrec [DisableFastSnapshotRestoreErrorItem]
readPrec :: ReadPrec DisableFastSnapshotRestoreErrorItem
$creadPrec :: ReadPrec DisableFastSnapshotRestoreErrorItem
readList :: ReadS [DisableFastSnapshotRestoreErrorItem]
$creadList :: ReadS [DisableFastSnapshotRestoreErrorItem]
readsPrec :: Int -> ReadS DisableFastSnapshotRestoreErrorItem
$creadsPrec :: Int -> ReadS DisableFastSnapshotRestoreErrorItem
Prelude.Read, Int -> DisableFastSnapshotRestoreErrorItem -> ShowS
[DisableFastSnapshotRestoreErrorItem] -> ShowS
DisableFastSnapshotRestoreErrorItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisableFastSnapshotRestoreErrorItem] -> ShowS
$cshowList :: [DisableFastSnapshotRestoreErrorItem] -> ShowS
show :: DisableFastSnapshotRestoreErrorItem -> String
$cshow :: DisableFastSnapshotRestoreErrorItem -> String
showsPrec :: Int -> DisableFastSnapshotRestoreErrorItem -> ShowS
$cshowsPrec :: Int -> DisableFastSnapshotRestoreErrorItem -> ShowS
Prelude.Show, forall x.
Rep DisableFastSnapshotRestoreErrorItem x
-> DisableFastSnapshotRestoreErrorItem
forall x.
DisableFastSnapshotRestoreErrorItem
-> Rep DisableFastSnapshotRestoreErrorItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisableFastSnapshotRestoreErrorItem x
-> DisableFastSnapshotRestoreErrorItem
$cfrom :: forall x.
DisableFastSnapshotRestoreErrorItem
-> Rep DisableFastSnapshotRestoreErrorItem x
Prelude.Generic)

-- |
-- Create a value of 'DisableFastSnapshotRestoreErrorItem' 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:
--
-- 'fastSnapshotRestoreStateErrors', 'disableFastSnapshotRestoreErrorItem_fastSnapshotRestoreStateErrors' - The errors.
--
-- 'snapshotId', 'disableFastSnapshotRestoreErrorItem_snapshotId' - The ID of the snapshot.
newDisableFastSnapshotRestoreErrorItem ::
  DisableFastSnapshotRestoreErrorItem
newDisableFastSnapshotRestoreErrorItem :: DisableFastSnapshotRestoreErrorItem
newDisableFastSnapshotRestoreErrorItem =
  DisableFastSnapshotRestoreErrorItem'
    { $sel:fastSnapshotRestoreStateErrors:DisableFastSnapshotRestoreErrorItem' :: Maybe [DisableFastSnapshotRestoreStateErrorItem]
fastSnapshotRestoreStateErrors =
        forall a. Maybe a
Prelude.Nothing,
      $sel:snapshotId:DisableFastSnapshotRestoreErrorItem' :: Maybe Text
snapshotId = forall a. Maybe a
Prelude.Nothing
    }

-- | The errors.
disableFastSnapshotRestoreErrorItem_fastSnapshotRestoreStateErrors :: Lens.Lens' DisableFastSnapshotRestoreErrorItem (Prelude.Maybe [DisableFastSnapshotRestoreStateErrorItem])
disableFastSnapshotRestoreErrorItem_fastSnapshotRestoreStateErrors :: Lens'
  DisableFastSnapshotRestoreErrorItem
  (Maybe [DisableFastSnapshotRestoreStateErrorItem])
disableFastSnapshotRestoreErrorItem_fastSnapshotRestoreStateErrors = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisableFastSnapshotRestoreErrorItem' {Maybe [DisableFastSnapshotRestoreStateErrorItem]
fastSnapshotRestoreStateErrors :: Maybe [DisableFastSnapshotRestoreStateErrorItem]
$sel:fastSnapshotRestoreStateErrors:DisableFastSnapshotRestoreErrorItem' :: DisableFastSnapshotRestoreErrorItem
-> Maybe [DisableFastSnapshotRestoreStateErrorItem]
fastSnapshotRestoreStateErrors} -> Maybe [DisableFastSnapshotRestoreStateErrorItem]
fastSnapshotRestoreStateErrors) (\s :: DisableFastSnapshotRestoreErrorItem
s@DisableFastSnapshotRestoreErrorItem' {} Maybe [DisableFastSnapshotRestoreStateErrorItem]
a -> DisableFastSnapshotRestoreErrorItem
s {$sel:fastSnapshotRestoreStateErrors:DisableFastSnapshotRestoreErrorItem' :: Maybe [DisableFastSnapshotRestoreStateErrorItem]
fastSnapshotRestoreStateErrors = Maybe [DisableFastSnapshotRestoreStateErrorItem]
a} :: DisableFastSnapshotRestoreErrorItem) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the snapshot.
disableFastSnapshotRestoreErrorItem_snapshotId :: Lens.Lens' DisableFastSnapshotRestoreErrorItem (Prelude.Maybe Prelude.Text)
disableFastSnapshotRestoreErrorItem_snapshotId :: Lens' DisableFastSnapshotRestoreErrorItem (Maybe Text)
disableFastSnapshotRestoreErrorItem_snapshotId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisableFastSnapshotRestoreErrorItem' {Maybe Text
snapshotId :: Maybe Text
$sel:snapshotId:DisableFastSnapshotRestoreErrorItem' :: DisableFastSnapshotRestoreErrorItem -> Maybe Text
snapshotId} -> Maybe Text
snapshotId) (\s :: DisableFastSnapshotRestoreErrorItem
s@DisableFastSnapshotRestoreErrorItem' {} Maybe Text
a -> DisableFastSnapshotRestoreErrorItem
s {$sel:snapshotId:DisableFastSnapshotRestoreErrorItem' :: Maybe Text
snapshotId = Maybe Text
a} :: DisableFastSnapshotRestoreErrorItem)

instance
  Data.FromXML
    DisableFastSnapshotRestoreErrorItem
  where
  parseXML :: [Node] -> Either String DisableFastSnapshotRestoreErrorItem
parseXML [Node]
x =
    Maybe [DisableFastSnapshotRestoreStateErrorItem]
-> Maybe Text -> DisableFastSnapshotRestoreErrorItem
DisableFastSnapshotRestoreErrorItem'
      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
"fastSnapshotRestoreStateErrorSet"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
                  )
      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
"snapshotId")

instance
  Prelude.Hashable
    DisableFastSnapshotRestoreErrorItem
  where
  hashWithSalt :: Int -> DisableFastSnapshotRestoreErrorItem -> Int
hashWithSalt
    Int
_salt
    DisableFastSnapshotRestoreErrorItem' {Maybe [DisableFastSnapshotRestoreStateErrorItem]
Maybe Text
snapshotId :: Maybe Text
fastSnapshotRestoreStateErrors :: Maybe [DisableFastSnapshotRestoreStateErrorItem]
$sel:snapshotId:DisableFastSnapshotRestoreErrorItem' :: DisableFastSnapshotRestoreErrorItem -> Maybe Text
$sel:fastSnapshotRestoreStateErrors:DisableFastSnapshotRestoreErrorItem' :: DisableFastSnapshotRestoreErrorItem
-> Maybe [DisableFastSnapshotRestoreStateErrorItem]
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [DisableFastSnapshotRestoreStateErrorItem]
fastSnapshotRestoreStateErrors
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
snapshotId

instance
  Prelude.NFData
    DisableFastSnapshotRestoreErrorItem
  where
  rnf :: DisableFastSnapshotRestoreErrorItem -> ()
rnf DisableFastSnapshotRestoreErrorItem' {Maybe [DisableFastSnapshotRestoreStateErrorItem]
Maybe Text
snapshotId :: Maybe Text
fastSnapshotRestoreStateErrors :: Maybe [DisableFastSnapshotRestoreStateErrorItem]
$sel:snapshotId:DisableFastSnapshotRestoreErrorItem' :: DisableFastSnapshotRestoreErrorItem -> Maybe Text
$sel:fastSnapshotRestoreStateErrors:DisableFastSnapshotRestoreErrorItem' :: DisableFastSnapshotRestoreErrorItem
-> Maybe [DisableFastSnapshotRestoreStateErrorItem]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [DisableFastSnapshotRestoreStateErrorItem]
fastSnapshotRestoreStateErrors
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
snapshotId