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

-- | Describes a disk.
--
-- /See:/ 'newDiskInfo' smart constructor.
data DiskInfo = DiskInfo'
  { -- | The number of disks with this configuration.
    DiskInfo -> Maybe Int
count :: Prelude.Maybe Prelude.Int,
    -- | The size of the disk in GB.
    DiskInfo -> Maybe Integer
sizeInGB :: Prelude.Maybe Prelude.Integer,
    -- | The type of disk.
    DiskInfo -> Maybe DiskType
type' :: Prelude.Maybe DiskType
  }
  deriving (DiskInfo -> DiskInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DiskInfo -> DiskInfo -> Bool
$c/= :: DiskInfo -> DiskInfo -> Bool
== :: DiskInfo -> DiskInfo -> Bool
$c== :: DiskInfo -> DiskInfo -> Bool
Prelude.Eq, ReadPrec [DiskInfo]
ReadPrec DiskInfo
Int -> ReadS DiskInfo
ReadS [DiskInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DiskInfo]
$creadListPrec :: ReadPrec [DiskInfo]
readPrec :: ReadPrec DiskInfo
$creadPrec :: ReadPrec DiskInfo
readList :: ReadS [DiskInfo]
$creadList :: ReadS [DiskInfo]
readsPrec :: Int -> ReadS DiskInfo
$creadsPrec :: Int -> ReadS DiskInfo
Prelude.Read, Int -> DiskInfo -> ShowS
[DiskInfo] -> ShowS
DiskInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DiskInfo] -> ShowS
$cshowList :: [DiskInfo] -> ShowS
show :: DiskInfo -> String
$cshow :: DiskInfo -> String
showsPrec :: Int -> DiskInfo -> ShowS
$cshowsPrec :: Int -> DiskInfo -> ShowS
Prelude.Show, forall x. Rep DiskInfo x -> DiskInfo
forall x. DiskInfo -> Rep DiskInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DiskInfo x -> DiskInfo
$cfrom :: forall x. DiskInfo -> Rep DiskInfo x
Prelude.Generic)

-- |
-- Create a value of 'DiskInfo' 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:
--
-- 'count', 'diskInfo_count' - The number of disks with this configuration.
--
-- 'sizeInGB', 'diskInfo_sizeInGB' - The size of the disk in GB.
--
-- 'type'', 'diskInfo_type' - The type of disk.
newDiskInfo ::
  DiskInfo
newDiskInfo :: DiskInfo
newDiskInfo =
  DiskInfo'
    { $sel:count:DiskInfo' :: Maybe Int
count = forall a. Maybe a
Prelude.Nothing,
      $sel:sizeInGB:DiskInfo' :: Maybe Integer
sizeInGB = forall a. Maybe a
Prelude.Nothing,
      $sel:type':DiskInfo' :: Maybe DiskType
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | The number of disks with this configuration.
diskInfo_count :: Lens.Lens' DiskInfo (Prelude.Maybe Prelude.Int)
diskInfo_count :: Lens' DiskInfo (Maybe Int)
diskInfo_count = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiskInfo' {Maybe Int
count :: Maybe Int
$sel:count:DiskInfo' :: DiskInfo -> Maybe Int
count} -> Maybe Int
count) (\s :: DiskInfo
s@DiskInfo' {} Maybe Int
a -> DiskInfo
s {$sel:count:DiskInfo' :: Maybe Int
count = Maybe Int
a} :: DiskInfo)

-- | The size of the disk in GB.
diskInfo_sizeInGB :: Lens.Lens' DiskInfo (Prelude.Maybe Prelude.Integer)
diskInfo_sizeInGB :: Lens' DiskInfo (Maybe Integer)
diskInfo_sizeInGB = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiskInfo' {Maybe Integer
sizeInGB :: Maybe Integer
$sel:sizeInGB:DiskInfo' :: DiskInfo -> Maybe Integer
sizeInGB} -> Maybe Integer
sizeInGB) (\s :: DiskInfo
s@DiskInfo' {} Maybe Integer
a -> DiskInfo
s {$sel:sizeInGB:DiskInfo' :: Maybe Integer
sizeInGB = Maybe Integer
a} :: DiskInfo)

-- | The type of disk.
diskInfo_type :: Lens.Lens' DiskInfo (Prelude.Maybe DiskType)
diskInfo_type :: Lens' DiskInfo (Maybe DiskType)
diskInfo_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiskInfo' {Maybe DiskType
type' :: Maybe DiskType
$sel:type':DiskInfo' :: DiskInfo -> Maybe DiskType
type'} -> Maybe DiskType
type') (\s :: DiskInfo
s@DiskInfo' {} Maybe DiskType
a -> DiskInfo
s {$sel:type':DiskInfo' :: Maybe DiskType
type' = Maybe DiskType
a} :: DiskInfo)

instance Data.FromXML DiskInfo where
  parseXML :: [Node] -> Either String DiskInfo
parseXML [Node]
x =
    Maybe Int -> Maybe Integer -> Maybe DiskType -> DiskInfo
DiskInfo'
      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
"count")
      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
"sizeInGB")
      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
"type")

instance Prelude.Hashable DiskInfo where
  hashWithSalt :: Int -> DiskInfo -> Int
hashWithSalt Int
_salt DiskInfo' {Maybe Int
Maybe Integer
Maybe DiskType
type' :: Maybe DiskType
sizeInGB :: Maybe Integer
count :: Maybe Int
$sel:type':DiskInfo' :: DiskInfo -> Maybe DiskType
$sel:sizeInGB:DiskInfo' :: DiskInfo -> Maybe Integer
$sel:count:DiskInfo' :: DiskInfo -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
count
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
sizeInGB
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DiskType
type'

instance Prelude.NFData DiskInfo where
  rnf :: DiskInfo -> ()
rnf DiskInfo' {Maybe Int
Maybe Integer
Maybe DiskType
type' :: Maybe DiskType
sizeInGB :: Maybe Integer
count :: Maybe Int
$sel:type':DiskInfo' :: DiskInfo -> Maybe DiskType
$sel:sizeInGB:DiskInfo' :: DiskInfo -> Maybe Integer
$sel:count:DiskInfo' :: DiskInfo -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
count
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
sizeInGB
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DiskType
type'