{-# 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.DiskImageVolumeDescription
-- 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.DiskImageVolumeDescription 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 a disk image volume.
--
-- /See:/ 'newDiskImageVolumeDescription' smart constructor.
data DiskImageVolumeDescription = DiskImageVolumeDescription'
  { -- | The volume identifier.
    DiskImageVolumeDescription -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The size of the volume, in GiB.
    DiskImageVolumeDescription -> Maybe Integer
size :: Prelude.Maybe Prelude.Integer
  }
  deriving (DiskImageVolumeDescription -> DiskImageVolumeDescription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DiskImageVolumeDescription -> DiskImageVolumeDescription -> Bool
$c/= :: DiskImageVolumeDescription -> DiskImageVolumeDescription -> Bool
== :: DiskImageVolumeDescription -> DiskImageVolumeDescription -> Bool
$c== :: DiskImageVolumeDescription -> DiskImageVolumeDescription -> Bool
Prelude.Eq, ReadPrec [DiskImageVolumeDescription]
ReadPrec DiskImageVolumeDescription
Int -> ReadS DiskImageVolumeDescription
ReadS [DiskImageVolumeDescription]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DiskImageVolumeDescription]
$creadListPrec :: ReadPrec [DiskImageVolumeDescription]
readPrec :: ReadPrec DiskImageVolumeDescription
$creadPrec :: ReadPrec DiskImageVolumeDescription
readList :: ReadS [DiskImageVolumeDescription]
$creadList :: ReadS [DiskImageVolumeDescription]
readsPrec :: Int -> ReadS DiskImageVolumeDescription
$creadsPrec :: Int -> ReadS DiskImageVolumeDescription
Prelude.Read, Int -> DiskImageVolumeDescription -> ShowS
[DiskImageVolumeDescription] -> ShowS
DiskImageVolumeDescription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DiskImageVolumeDescription] -> ShowS
$cshowList :: [DiskImageVolumeDescription] -> ShowS
show :: DiskImageVolumeDescription -> String
$cshow :: DiskImageVolumeDescription -> String
showsPrec :: Int -> DiskImageVolumeDescription -> ShowS
$cshowsPrec :: Int -> DiskImageVolumeDescription -> ShowS
Prelude.Show, forall x.
Rep DiskImageVolumeDescription x -> DiskImageVolumeDescription
forall x.
DiskImageVolumeDescription -> Rep DiskImageVolumeDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DiskImageVolumeDescription x -> DiskImageVolumeDescription
$cfrom :: forall x.
DiskImageVolumeDescription -> Rep DiskImageVolumeDescription x
Prelude.Generic)

-- |
-- Create a value of 'DiskImageVolumeDescription' 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:
--
-- 'id', 'diskImageVolumeDescription_id' - The volume identifier.
--
-- 'size', 'diskImageVolumeDescription_size' - The size of the volume, in GiB.
newDiskImageVolumeDescription ::
  DiskImageVolumeDescription
newDiskImageVolumeDescription :: DiskImageVolumeDescription
newDiskImageVolumeDescription =
  DiskImageVolumeDescription'
    { $sel:id:DiskImageVolumeDescription' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:size:DiskImageVolumeDescription' :: Maybe Integer
size = forall a. Maybe a
Prelude.Nothing
    }

-- | The volume identifier.
diskImageVolumeDescription_id :: Lens.Lens' DiskImageVolumeDescription (Prelude.Maybe Prelude.Text)
diskImageVolumeDescription_id :: Lens' DiskImageVolumeDescription (Maybe Text)
diskImageVolumeDescription_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiskImageVolumeDescription' {Maybe Text
id :: Maybe Text
$sel:id:DiskImageVolumeDescription' :: DiskImageVolumeDescription -> Maybe Text
id} -> Maybe Text
id) (\s :: DiskImageVolumeDescription
s@DiskImageVolumeDescription' {} Maybe Text
a -> DiskImageVolumeDescription
s {$sel:id:DiskImageVolumeDescription' :: Maybe Text
id = Maybe Text
a} :: DiskImageVolumeDescription)

-- | The size of the volume, in GiB.
diskImageVolumeDescription_size :: Lens.Lens' DiskImageVolumeDescription (Prelude.Maybe Prelude.Integer)
diskImageVolumeDescription_size :: Lens' DiskImageVolumeDescription (Maybe Integer)
diskImageVolumeDescription_size = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiskImageVolumeDescription' {Maybe Integer
size :: Maybe Integer
$sel:size:DiskImageVolumeDescription' :: DiskImageVolumeDescription -> Maybe Integer
size} -> Maybe Integer
size) (\s :: DiskImageVolumeDescription
s@DiskImageVolumeDescription' {} Maybe Integer
a -> DiskImageVolumeDescription
s {$sel:size:DiskImageVolumeDescription' :: Maybe Integer
size = Maybe Integer
a} :: DiskImageVolumeDescription)

instance Data.FromXML DiskImageVolumeDescription where
  parseXML :: [Node] -> Either String DiskImageVolumeDescription
parseXML [Node]
x =
    Maybe Text -> Maybe Integer -> DiskImageVolumeDescription
DiskImageVolumeDescription'
      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
"id")
      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
"size")

instance Prelude.Hashable DiskImageVolumeDescription where
  hashWithSalt :: Int -> DiskImageVolumeDescription -> Int
hashWithSalt Int
_salt DiskImageVolumeDescription' {Maybe Integer
Maybe Text
size :: Maybe Integer
id :: Maybe Text
$sel:size:DiskImageVolumeDescription' :: DiskImageVolumeDescription -> Maybe Integer
$sel:id:DiskImageVolumeDescription' :: DiskImageVolumeDescription -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
size

instance Prelude.NFData DiskImageVolumeDescription where
  rnf :: DiskImageVolumeDescription -> ()
rnf DiskImageVolumeDescription' {Maybe Integer
Maybe Text
size :: Maybe Integer
id :: Maybe Text
$sel:size:DiskImageVolumeDescription' :: DiskImageVolumeDescription -> Maybe Integer
$sel:id:DiskImageVolumeDescription' :: DiskImageVolumeDescription -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
size