{-# 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.InstanceStorageInfo
-- 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.InstanceStorageInfo 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.DiskInfo
import Amazonka.EC2.Types.EphemeralNvmeSupport
import Amazonka.EC2.Types.InstanceStorageEncryptionSupport
import qualified Amazonka.Prelude as Prelude

-- | Describes the instance store features that are supported by the instance
-- type.
--
-- /See:/ 'newInstanceStorageInfo' smart constructor.
data InstanceStorageInfo = InstanceStorageInfo'
  { -- | Describes the disks that are available for the instance type.
    InstanceStorageInfo -> Maybe [DiskInfo]
disks :: Prelude.Maybe [DiskInfo],
    -- | Indicates whether data is encrypted at rest.
    InstanceStorageInfo -> Maybe InstanceStorageEncryptionSupport
encryptionSupport :: Prelude.Maybe InstanceStorageEncryptionSupport,
    -- | Indicates whether non-volatile memory express (NVMe) is supported.
    InstanceStorageInfo -> Maybe EphemeralNvmeSupport
nvmeSupport :: Prelude.Maybe EphemeralNvmeSupport,
    -- | The total size of the disks, in GB.
    InstanceStorageInfo -> Maybe Integer
totalSizeInGB :: Prelude.Maybe Prelude.Integer
  }
  deriving (InstanceStorageInfo -> InstanceStorageInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceStorageInfo -> InstanceStorageInfo -> Bool
$c/= :: InstanceStorageInfo -> InstanceStorageInfo -> Bool
== :: InstanceStorageInfo -> InstanceStorageInfo -> Bool
$c== :: InstanceStorageInfo -> InstanceStorageInfo -> Bool
Prelude.Eq, ReadPrec [InstanceStorageInfo]
ReadPrec InstanceStorageInfo
Int -> ReadS InstanceStorageInfo
ReadS [InstanceStorageInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceStorageInfo]
$creadListPrec :: ReadPrec [InstanceStorageInfo]
readPrec :: ReadPrec InstanceStorageInfo
$creadPrec :: ReadPrec InstanceStorageInfo
readList :: ReadS [InstanceStorageInfo]
$creadList :: ReadS [InstanceStorageInfo]
readsPrec :: Int -> ReadS InstanceStorageInfo
$creadsPrec :: Int -> ReadS InstanceStorageInfo
Prelude.Read, Int -> InstanceStorageInfo -> ShowS
[InstanceStorageInfo] -> ShowS
InstanceStorageInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceStorageInfo] -> ShowS
$cshowList :: [InstanceStorageInfo] -> ShowS
show :: InstanceStorageInfo -> String
$cshow :: InstanceStorageInfo -> String
showsPrec :: Int -> InstanceStorageInfo -> ShowS
$cshowsPrec :: Int -> InstanceStorageInfo -> ShowS
Prelude.Show, forall x. Rep InstanceStorageInfo x -> InstanceStorageInfo
forall x. InstanceStorageInfo -> Rep InstanceStorageInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstanceStorageInfo x -> InstanceStorageInfo
$cfrom :: forall x. InstanceStorageInfo -> Rep InstanceStorageInfo x
Prelude.Generic)

-- |
-- Create a value of 'InstanceStorageInfo' 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:
--
-- 'disks', 'instanceStorageInfo_disks' - Describes the disks that are available for the instance type.
--
-- 'encryptionSupport', 'instanceStorageInfo_encryptionSupport' - Indicates whether data is encrypted at rest.
--
-- 'nvmeSupport', 'instanceStorageInfo_nvmeSupport' - Indicates whether non-volatile memory express (NVMe) is supported.
--
-- 'totalSizeInGB', 'instanceStorageInfo_totalSizeInGB' - The total size of the disks, in GB.
newInstanceStorageInfo ::
  InstanceStorageInfo
newInstanceStorageInfo :: InstanceStorageInfo
newInstanceStorageInfo =
  InstanceStorageInfo'
    { $sel:disks:InstanceStorageInfo' :: Maybe [DiskInfo]
disks = forall a. Maybe a
Prelude.Nothing,
      $sel:encryptionSupport:InstanceStorageInfo' :: Maybe InstanceStorageEncryptionSupport
encryptionSupport = forall a. Maybe a
Prelude.Nothing,
      $sel:nvmeSupport:InstanceStorageInfo' :: Maybe EphemeralNvmeSupport
nvmeSupport = forall a. Maybe a
Prelude.Nothing,
      $sel:totalSizeInGB:InstanceStorageInfo' :: Maybe Integer
totalSizeInGB = forall a. Maybe a
Prelude.Nothing
    }

-- | Describes the disks that are available for the instance type.
instanceStorageInfo_disks :: Lens.Lens' InstanceStorageInfo (Prelude.Maybe [DiskInfo])
instanceStorageInfo_disks :: Lens' InstanceStorageInfo (Maybe [DiskInfo])
instanceStorageInfo_disks = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceStorageInfo' {Maybe [DiskInfo]
disks :: Maybe [DiskInfo]
$sel:disks:InstanceStorageInfo' :: InstanceStorageInfo -> Maybe [DiskInfo]
disks} -> Maybe [DiskInfo]
disks) (\s :: InstanceStorageInfo
s@InstanceStorageInfo' {} Maybe [DiskInfo]
a -> InstanceStorageInfo
s {$sel:disks:InstanceStorageInfo' :: Maybe [DiskInfo]
disks = Maybe [DiskInfo]
a} :: InstanceStorageInfo) 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

-- | Indicates whether data is encrypted at rest.
instanceStorageInfo_encryptionSupport :: Lens.Lens' InstanceStorageInfo (Prelude.Maybe InstanceStorageEncryptionSupport)
instanceStorageInfo_encryptionSupport :: Lens' InstanceStorageInfo (Maybe InstanceStorageEncryptionSupport)
instanceStorageInfo_encryptionSupport = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceStorageInfo' {Maybe InstanceStorageEncryptionSupport
encryptionSupport :: Maybe InstanceStorageEncryptionSupport
$sel:encryptionSupport:InstanceStorageInfo' :: InstanceStorageInfo -> Maybe InstanceStorageEncryptionSupport
encryptionSupport} -> Maybe InstanceStorageEncryptionSupport
encryptionSupport) (\s :: InstanceStorageInfo
s@InstanceStorageInfo' {} Maybe InstanceStorageEncryptionSupport
a -> InstanceStorageInfo
s {$sel:encryptionSupport:InstanceStorageInfo' :: Maybe InstanceStorageEncryptionSupport
encryptionSupport = Maybe InstanceStorageEncryptionSupport
a} :: InstanceStorageInfo)

-- | Indicates whether non-volatile memory express (NVMe) is supported.
instanceStorageInfo_nvmeSupport :: Lens.Lens' InstanceStorageInfo (Prelude.Maybe EphemeralNvmeSupport)
instanceStorageInfo_nvmeSupport :: Lens' InstanceStorageInfo (Maybe EphemeralNvmeSupport)
instanceStorageInfo_nvmeSupport = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceStorageInfo' {Maybe EphemeralNvmeSupport
nvmeSupport :: Maybe EphemeralNvmeSupport
$sel:nvmeSupport:InstanceStorageInfo' :: InstanceStorageInfo -> Maybe EphemeralNvmeSupport
nvmeSupport} -> Maybe EphemeralNvmeSupport
nvmeSupport) (\s :: InstanceStorageInfo
s@InstanceStorageInfo' {} Maybe EphemeralNvmeSupport
a -> InstanceStorageInfo
s {$sel:nvmeSupport:InstanceStorageInfo' :: Maybe EphemeralNvmeSupport
nvmeSupport = Maybe EphemeralNvmeSupport
a} :: InstanceStorageInfo)

-- | The total size of the disks, in GB.
instanceStorageInfo_totalSizeInGB :: Lens.Lens' InstanceStorageInfo (Prelude.Maybe Prelude.Integer)
instanceStorageInfo_totalSizeInGB :: Lens' InstanceStorageInfo (Maybe Integer)
instanceStorageInfo_totalSizeInGB = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceStorageInfo' {Maybe Integer
totalSizeInGB :: Maybe Integer
$sel:totalSizeInGB:InstanceStorageInfo' :: InstanceStorageInfo -> Maybe Integer
totalSizeInGB} -> Maybe Integer
totalSizeInGB) (\s :: InstanceStorageInfo
s@InstanceStorageInfo' {} Maybe Integer
a -> InstanceStorageInfo
s {$sel:totalSizeInGB:InstanceStorageInfo' :: Maybe Integer
totalSizeInGB = Maybe Integer
a} :: InstanceStorageInfo)

instance Data.FromXML InstanceStorageInfo where
  parseXML :: [Node] -> Either String InstanceStorageInfo
parseXML [Node]
x =
    Maybe [DiskInfo]
-> Maybe InstanceStorageEncryptionSupport
-> Maybe EphemeralNvmeSupport
-> Maybe Integer
-> InstanceStorageInfo
InstanceStorageInfo'
      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
"disks"
                      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
"encryptionSupport")
      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
"nvmeSupport")
      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
"totalSizeInGB")

instance Prelude.Hashable InstanceStorageInfo where
  hashWithSalt :: Int -> InstanceStorageInfo -> Int
hashWithSalt Int
_salt InstanceStorageInfo' {Maybe Integer
Maybe [DiskInfo]
Maybe EphemeralNvmeSupport
Maybe InstanceStorageEncryptionSupport
totalSizeInGB :: Maybe Integer
nvmeSupport :: Maybe EphemeralNvmeSupport
encryptionSupport :: Maybe InstanceStorageEncryptionSupport
disks :: Maybe [DiskInfo]
$sel:totalSizeInGB:InstanceStorageInfo' :: InstanceStorageInfo -> Maybe Integer
$sel:nvmeSupport:InstanceStorageInfo' :: InstanceStorageInfo -> Maybe EphemeralNvmeSupport
$sel:encryptionSupport:InstanceStorageInfo' :: InstanceStorageInfo -> Maybe InstanceStorageEncryptionSupport
$sel:disks:InstanceStorageInfo' :: InstanceStorageInfo -> Maybe [DiskInfo]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [DiskInfo]
disks
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InstanceStorageEncryptionSupport
encryptionSupport
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EphemeralNvmeSupport
nvmeSupport
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
totalSizeInGB

instance Prelude.NFData InstanceStorageInfo where
  rnf :: InstanceStorageInfo -> ()
rnf InstanceStorageInfo' {Maybe Integer
Maybe [DiskInfo]
Maybe EphemeralNvmeSupport
Maybe InstanceStorageEncryptionSupport
totalSizeInGB :: Maybe Integer
nvmeSupport :: Maybe EphemeralNvmeSupport
encryptionSupport :: Maybe InstanceStorageEncryptionSupport
disks :: Maybe [DiskInfo]
$sel:totalSizeInGB:InstanceStorageInfo' :: InstanceStorageInfo -> Maybe Integer
$sel:nvmeSupport:InstanceStorageInfo' :: InstanceStorageInfo -> Maybe EphemeralNvmeSupport
$sel:encryptionSupport:InstanceStorageInfo' :: InstanceStorageInfo -> Maybe InstanceStorageEncryptionSupport
$sel:disks:InstanceStorageInfo' :: InstanceStorageInfo -> Maybe [DiskInfo]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [DiskInfo]
disks
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InstanceStorageEncryptionSupport
encryptionSupport
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EphemeralNvmeSupport
nvmeSupport
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
totalSizeInGB