{-# 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.SnapshotDetail
-- 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.SnapshotDetail 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.UserBucketDetails
import qualified Amazonka.Prelude as Prelude

-- | Describes the snapshot created from the imported disk.
--
-- /See:/ 'newSnapshotDetail' smart constructor.
data SnapshotDetail = SnapshotDetail'
  { -- | A description for the snapshot.
    SnapshotDetail -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The block device mapping for the snapshot.
    SnapshotDetail -> Maybe Text
deviceName :: Prelude.Maybe Prelude.Text,
    -- | The size of the disk in the snapshot, in GiB.
    SnapshotDetail -> Maybe Double
diskImageSize :: Prelude.Maybe Prelude.Double,
    -- | The format of the disk image from which the snapshot is created.
    SnapshotDetail -> Maybe Text
format :: Prelude.Maybe Prelude.Text,
    -- | The percentage of progress for the task.
    SnapshotDetail -> Maybe Text
progress :: Prelude.Maybe Prelude.Text,
    -- | The snapshot ID of the disk being imported.
    SnapshotDetail -> Maybe Text
snapshotId :: Prelude.Maybe Prelude.Text,
    -- | A brief status of the snapshot creation.
    SnapshotDetail -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | A detailed status message for the snapshot creation.
    SnapshotDetail -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text,
    -- | The URL used to access the disk image.
    SnapshotDetail -> Maybe Text
url :: Prelude.Maybe Prelude.Text,
    -- | The Amazon S3 bucket for the disk image.
    SnapshotDetail -> Maybe UserBucketDetails
userBucket :: Prelude.Maybe UserBucketDetails
  }
  deriving (SnapshotDetail -> SnapshotDetail -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SnapshotDetail -> SnapshotDetail -> Bool
$c/= :: SnapshotDetail -> SnapshotDetail -> Bool
== :: SnapshotDetail -> SnapshotDetail -> Bool
$c== :: SnapshotDetail -> SnapshotDetail -> Bool
Prelude.Eq, ReadPrec [SnapshotDetail]
ReadPrec SnapshotDetail
Int -> ReadS SnapshotDetail
ReadS [SnapshotDetail]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SnapshotDetail]
$creadListPrec :: ReadPrec [SnapshotDetail]
readPrec :: ReadPrec SnapshotDetail
$creadPrec :: ReadPrec SnapshotDetail
readList :: ReadS [SnapshotDetail]
$creadList :: ReadS [SnapshotDetail]
readsPrec :: Int -> ReadS SnapshotDetail
$creadsPrec :: Int -> ReadS SnapshotDetail
Prelude.Read, Int -> SnapshotDetail -> ShowS
[SnapshotDetail] -> ShowS
SnapshotDetail -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SnapshotDetail] -> ShowS
$cshowList :: [SnapshotDetail] -> ShowS
show :: SnapshotDetail -> String
$cshow :: SnapshotDetail -> String
showsPrec :: Int -> SnapshotDetail -> ShowS
$cshowsPrec :: Int -> SnapshotDetail -> ShowS
Prelude.Show, forall x. Rep SnapshotDetail x -> SnapshotDetail
forall x. SnapshotDetail -> Rep SnapshotDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SnapshotDetail x -> SnapshotDetail
$cfrom :: forall x. SnapshotDetail -> Rep SnapshotDetail x
Prelude.Generic)

-- |
-- Create a value of 'SnapshotDetail' 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:
--
-- 'description', 'snapshotDetail_description' - A description for the snapshot.
--
-- 'deviceName', 'snapshotDetail_deviceName' - The block device mapping for the snapshot.
--
-- 'diskImageSize', 'snapshotDetail_diskImageSize' - The size of the disk in the snapshot, in GiB.
--
-- 'format', 'snapshotDetail_format' - The format of the disk image from which the snapshot is created.
--
-- 'progress', 'snapshotDetail_progress' - The percentage of progress for the task.
--
-- 'snapshotId', 'snapshotDetail_snapshotId' - The snapshot ID of the disk being imported.
--
-- 'status', 'snapshotDetail_status' - A brief status of the snapshot creation.
--
-- 'statusMessage', 'snapshotDetail_statusMessage' - A detailed status message for the snapshot creation.
--
-- 'url', 'snapshotDetail_url' - The URL used to access the disk image.
--
-- 'userBucket', 'snapshotDetail_userBucket' - The Amazon S3 bucket for the disk image.
newSnapshotDetail ::
  SnapshotDetail
newSnapshotDetail :: SnapshotDetail
newSnapshotDetail =
  SnapshotDetail'
    { $sel:description:SnapshotDetail' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:deviceName:SnapshotDetail' :: Maybe Text
deviceName = forall a. Maybe a
Prelude.Nothing,
      $sel:diskImageSize:SnapshotDetail' :: Maybe Double
diskImageSize = forall a. Maybe a
Prelude.Nothing,
      $sel:format:SnapshotDetail' :: Maybe Text
format = forall a. Maybe a
Prelude.Nothing,
      $sel:progress:SnapshotDetail' :: Maybe Text
progress = forall a. Maybe a
Prelude.Nothing,
      $sel:snapshotId:SnapshotDetail' :: Maybe Text
snapshotId = forall a. Maybe a
Prelude.Nothing,
      $sel:status:SnapshotDetail' :: Maybe Text
status = forall a. Maybe a
Prelude.Nothing,
      $sel:statusMessage:SnapshotDetail' :: Maybe Text
statusMessage = forall a. Maybe a
Prelude.Nothing,
      $sel:url:SnapshotDetail' :: Maybe Text
url = forall a. Maybe a
Prelude.Nothing,
      $sel:userBucket:SnapshotDetail' :: Maybe UserBucketDetails
userBucket = forall a. Maybe a
Prelude.Nothing
    }

-- | A description for the snapshot.
snapshotDetail_description :: Lens.Lens' SnapshotDetail (Prelude.Maybe Prelude.Text)
snapshotDetail_description :: Lens' SnapshotDetail (Maybe Text)
snapshotDetail_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotDetail' {Maybe Text
description :: Maybe Text
$sel:description:SnapshotDetail' :: SnapshotDetail -> Maybe Text
description} -> Maybe Text
description) (\s :: SnapshotDetail
s@SnapshotDetail' {} Maybe Text
a -> SnapshotDetail
s {$sel:description:SnapshotDetail' :: Maybe Text
description = Maybe Text
a} :: SnapshotDetail)

-- | The block device mapping for the snapshot.
snapshotDetail_deviceName :: Lens.Lens' SnapshotDetail (Prelude.Maybe Prelude.Text)
snapshotDetail_deviceName :: Lens' SnapshotDetail (Maybe Text)
snapshotDetail_deviceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotDetail' {Maybe Text
deviceName :: Maybe Text
$sel:deviceName:SnapshotDetail' :: SnapshotDetail -> Maybe Text
deviceName} -> Maybe Text
deviceName) (\s :: SnapshotDetail
s@SnapshotDetail' {} Maybe Text
a -> SnapshotDetail
s {$sel:deviceName:SnapshotDetail' :: Maybe Text
deviceName = Maybe Text
a} :: SnapshotDetail)

-- | The size of the disk in the snapshot, in GiB.
snapshotDetail_diskImageSize :: Lens.Lens' SnapshotDetail (Prelude.Maybe Prelude.Double)
snapshotDetail_diskImageSize :: Lens' SnapshotDetail (Maybe Double)
snapshotDetail_diskImageSize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotDetail' {Maybe Double
diskImageSize :: Maybe Double
$sel:diskImageSize:SnapshotDetail' :: SnapshotDetail -> Maybe Double
diskImageSize} -> Maybe Double
diskImageSize) (\s :: SnapshotDetail
s@SnapshotDetail' {} Maybe Double
a -> SnapshotDetail
s {$sel:diskImageSize:SnapshotDetail' :: Maybe Double
diskImageSize = Maybe Double
a} :: SnapshotDetail)

-- | The format of the disk image from which the snapshot is created.
snapshotDetail_format :: Lens.Lens' SnapshotDetail (Prelude.Maybe Prelude.Text)
snapshotDetail_format :: Lens' SnapshotDetail (Maybe Text)
snapshotDetail_format = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotDetail' {Maybe Text
format :: Maybe Text
$sel:format:SnapshotDetail' :: SnapshotDetail -> Maybe Text
format} -> Maybe Text
format) (\s :: SnapshotDetail
s@SnapshotDetail' {} Maybe Text
a -> SnapshotDetail
s {$sel:format:SnapshotDetail' :: Maybe Text
format = Maybe Text
a} :: SnapshotDetail)

-- | The percentage of progress for the task.
snapshotDetail_progress :: Lens.Lens' SnapshotDetail (Prelude.Maybe Prelude.Text)
snapshotDetail_progress :: Lens' SnapshotDetail (Maybe Text)
snapshotDetail_progress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotDetail' {Maybe Text
progress :: Maybe Text
$sel:progress:SnapshotDetail' :: SnapshotDetail -> Maybe Text
progress} -> Maybe Text
progress) (\s :: SnapshotDetail
s@SnapshotDetail' {} Maybe Text
a -> SnapshotDetail
s {$sel:progress:SnapshotDetail' :: Maybe Text
progress = Maybe Text
a} :: SnapshotDetail)

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

-- | A brief status of the snapshot creation.
snapshotDetail_status :: Lens.Lens' SnapshotDetail (Prelude.Maybe Prelude.Text)
snapshotDetail_status :: Lens' SnapshotDetail (Maybe Text)
snapshotDetail_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotDetail' {Maybe Text
status :: Maybe Text
$sel:status:SnapshotDetail' :: SnapshotDetail -> Maybe Text
status} -> Maybe Text
status) (\s :: SnapshotDetail
s@SnapshotDetail' {} Maybe Text
a -> SnapshotDetail
s {$sel:status:SnapshotDetail' :: Maybe Text
status = Maybe Text
a} :: SnapshotDetail)

-- | A detailed status message for the snapshot creation.
snapshotDetail_statusMessage :: Lens.Lens' SnapshotDetail (Prelude.Maybe Prelude.Text)
snapshotDetail_statusMessage :: Lens' SnapshotDetail (Maybe Text)
snapshotDetail_statusMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotDetail' {Maybe Text
statusMessage :: Maybe Text
$sel:statusMessage:SnapshotDetail' :: SnapshotDetail -> Maybe Text
statusMessage} -> Maybe Text
statusMessage) (\s :: SnapshotDetail
s@SnapshotDetail' {} Maybe Text
a -> SnapshotDetail
s {$sel:statusMessage:SnapshotDetail' :: Maybe Text
statusMessage = Maybe Text
a} :: SnapshotDetail)

-- | The URL used to access the disk image.
snapshotDetail_url :: Lens.Lens' SnapshotDetail (Prelude.Maybe Prelude.Text)
snapshotDetail_url :: Lens' SnapshotDetail (Maybe Text)
snapshotDetail_url = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotDetail' {Maybe Text
url :: Maybe Text
$sel:url:SnapshotDetail' :: SnapshotDetail -> Maybe Text
url} -> Maybe Text
url) (\s :: SnapshotDetail
s@SnapshotDetail' {} Maybe Text
a -> SnapshotDetail
s {$sel:url:SnapshotDetail' :: Maybe Text
url = Maybe Text
a} :: SnapshotDetail)

-- | The Amazon S3 bucket for the disk image.
snapshotDetail_userBucket :: Lens.Lens' SnapshotDetail (Prelude.Maybe UserBucketDetails)
snapshotDetail_userBucket :: Lens' SnapshotDetail (Maybe UserBucketDetails)
snapshotDetail_userBucket = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotDetail' {Maybe UserBucketDetails
userBucket :: Maybe UserBucketDetails
$sel:userBucket:SnapshotDetail' :: SnapshotDetail -> Maybe UserBucketDetails
userBucket} -> Maybe UserBucketDetails
userBucket) (\s :: SnapshotDetail
s@SnapshotDetail' {} Maybe UserBucketDetails
a -> SnapshotDetail
s {$sel:userBucket:SnapshotDetail' :: Maybe UserBucketDetails
userBucket = Maybe UserBucketDetails
a} :: SnapshotDetail)

instance Data.FromXML SnapshotDetail where
  parseXML :: [Node] -> Either String SnapshotDetail
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe Double
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe UserBucketDetails
-> SnapshotDetail
SnapshotDetail'
      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
"description")
      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
"deviceName")
      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
"diskImageSize")
      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
"format")
      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
"progress")
      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")
      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
"status")
      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
"statusMessage")
      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
"url")
      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
"userBucket")

instance Prelude.Hashable SnapshotDetail where
  hashWithSalt :: Int -> SnapshotDetail -> Int
hashWithSalt Int
_salt SnapshotDetail' {Maybe Double
Maybe Text
Maybe UserBucketDetails
userBucket :: Maybe UserBucketDetails
url :: Maybe Text
statusMessage :: Maybe Text
status :: Maybe Text
snapshotId :: Maybe Text
progress :: Maybe Text
format :: Maybe Text
diskImageSize :: Maybe Double
deviceName :: Maybe Text
description :: Maybe Text
$sel:userBucket:SnapshotDetail' :: SnapshotDetail -> Maybe UserBucketDetails
$sel:url:SnapshotDetail' :: SnapshotDetail -> Maybe Text
$sel:statusMessage:SnapshotDetail' :: SnapshotDetail -> Maybe Text
$sel:status:SnapshotDetail' :: SnapshotDetail -> Maybe Text
$sel:snapshotId:SnapshotDetail' :: SnapshotDetail -> Maybe Text
$sel:progress:SnapshotDetail' :: SnapshotDetail -> Maybe Text
$sel:format:SnapshotDetail' :: SnapshotDetail -> Maybe Text
$sel:diskImageSize:SnapshotDetail' :: SnapshotDetail -> Maybe Double
$sel:deviceName:SnapshotDetail' :: SnapshotDetail -> Maybe Text
$sel:description:SnapshotDetail' :: SnapshotDetail -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deviceName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
diskImageSize
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
format
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
progress
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
snapshotId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
statusMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
url
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UserBucketDetails
userBucket

instance Prelude.NFData SnapshotDetail where
  rnf :: SnapshotDetail -> ()
rnf SnapshotDetail' {Maybe Double
Maybe Text
Maybe UserBucketDetails
userBucket :: Maybe UserBucketDetails
url :: Maybe Text
statusMessage :: Maybe Text
status :: Maybe Text
snapshotId :: Maybe Text
progress :: Maybe Text
format :: Maybe Text
diskImageSize :: Maybe Double
deviceName :: Maybe Text
description :: Maybe Text
$sel:userBucket:SnapshotDetail' :: SnapshotDetail -> Maybe UserBucketDetails
$sel:url:SnapshotDetail' :: SnapshotDetail -> Maybe Text
$sel:statusMessage:SnapshotDetail' :: SnapshotDetail -> Maybe Text
$sel:status:SnapshotDetail' :: SnapshotDetail -> Maybe Text
$sel:snapshotId:SnapshotDetail' :: SnapshotDetail -> Maybe Text
$sel:progress:SnapshotDetail' :: SnapshotDetail -> Maybe Text
$sel:format:SnapshotDetail' :: SnapshotDetail -> Maybe Text
$sel:diskImageSize:SnapshotDetail' :: SnapshotDetail -> Maybe Double
$sel:deviceName:SnapshotDetail' :: SnapshotDetail -> Maybe Text
$sel:description:SnapshotDetail' :: SnapshotDetail -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deviceName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
diskImageSize
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
format
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
progress
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
snapshotId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
statusMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
url
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe UserBucketDetails
userBucket