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

-- | Describes a block device for an EBS volume.
--
-- /See:/ 'newEbsBlockDevice' smart constructor.
data EbsBlockDevice = EbsBlockDevice'
  { -- | Indicates whether the EBS volume is deleted on instance termination. For
    -- more information, see
    -- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/terminating-instances.html#preserving-volumes-on-termination Preserving Amazon EBS volumes on instance termination>
    -- in the /Amazon EC2 User Guide/.
    EbsBlockDevice -> Maybe Bool
deleteOnTermination :: Prelude.Maybe Prelude.Bool,
    -- | Indicates whether the encryption state of an EBS volume is changed while
    -- being restored from a backing snapshot. The effect of setting the
    -- encryption state to @true@ depends on the volume origin (new or from a
    -- snapshot), starting encryption state, ownership, and whether encryption
    -- by default is enabled. For more information, see
    -- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#encryption-parameters Amazon EBS encryption>
    -- in the /Amazon EC2 User Guide/.
    --
    -- In no case can you remove encryption from an encrypted volume.
    --
    -- Encrypted volumes can only be attached to instances that support Amazon
    -- EBS encryption. For more information, see
    -- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#EBSEncryption_supported_instances Supported instance types>.
    --
    -- This parameter is not returned by
    -- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeImageAttribute.html DescribeImageAttribute>.
    EbsBlockDevice -> Maybe Bool
encrypted :: Prelude.Maybe Prelude.Bool,
    -- | The number of I\/O operations per second (IOPS). For @gp3@, @io1@, and
    -- @io2@ volumes, this represents the number of IOPS that are provisioned
    -- for the volume. For @gp2@ volumes, this represents the baseline
    -- performance of the volume and the rate at which the volume accumulates
    -- I\/O credits for bursting.
    --
    -- The following are the supported values for each volume type:
    --
    -- -   @gp3@: 3,000-16,000 IOPS
    --
    -- -   @io1@: 100-64,000 IOPS
    --
    -- -   @io2@: 100-64,000 IOPS
    --
    -- For @io1@ and @io2@ volumes, we guarantee 64,000 IOPS only for
    -- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#ec2-nitro-instances Instances built on the Nitro System>.
    -- Other instance families guarantee performance up to 32,000 IOPS.
    --
    -- This parameter is required for @io1@ and @io2@ volumes. The default for
    -- @gp3@ volumes is 3,000 IOPS. This parameter is not supported for @gp2@,
    -- @st1@, @sc1@, or @standard@ volumes.
    EbsBlockDevice -> Maybe Int
iops :: Prelude.Maybe Prelude.Int,
    -- | Identifier (key ID, key alias, ID ARN, or alias ARN) for a customer
    -- managed CMK under which the EBS volume is encrypted.
    --
    -- This parameter is only supported on @BlockDeviceMapping@ objects called
    -- by
    -- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html RunInstances>,
    -- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestSpotFleet.html RequestSpotFleet>,
    -- and
    -- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestSpotInstances.html RequestSpotInstances>.
    EbsBlockDevice -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the Outpost on which the snapshot is stored.
    --
    -- This parameter is only supported on @BlockDeviceMapping@ objects called
    -- by
    -- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateImage.html CreateImage>.
    EbsBlockDevice -> Maybe Text
outpostArn :: Prelude.Maybe Prelude.Text,
    -- | The ID of the snapshot.
    EbsBlockDevice -> Maybe Text
snapshotId :: Prelude.Maybe Prelude.Text,
    -- | The throughput that the volume supports, in MiB\/s.
    --
    -- This parameter is valid only for @gp3@ volumes.
    --
    -- Valid Range: Minimum value of 125. Maximum value of 1000.
    EbsBlockDevice -> Maybe Int
throughput :: Prelude.Maybe Prelude.Int,
    -- | The size of the volume, in GiBs. You must specify either a snapshot ID
    -- or a volume size. If you specify a snapshot, the default is the snapshot
    -- size. You can specify a volume size that is equal to or larger than the
    -- snapshot size.
    --
    -- The following are the supported volumes sizes for each volume type:
    --
    -- -   @gp2@ and @gp3@:1-16,384
    --
    -- -   @io1@ and @io2@: 4-16,384
    --
    -- -   @st1@ and @sc1@: 125-16,384
    --
    -- -   @standard@: 1-1,024
    EbsBlockDevice -> Maybe Int
volumeSize :: Prelude.Maybe Prelude.Int,
    -- | The volume type. For more information, see
    -- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html Amazon EBS volume types>
    -- in the /Amazon EC2 User Guide/. If the volume type is @io1@ or @io2@,
    -- you must specify the IOPS that the volume supports.
    EbsBlockDevice -> Maybe VolumeType
volumeType :: Prelude.Maybe VolumeType
  }
  deriving (EbsBlockDevice -> EbsBlockDevice -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EbsBlockDevice -> EbsBlockDevice -> Bool
$c/= :: EbsBlockDevice -> EbsBlockDevice -> Bool
== :: EbsBlockDevice -> EbsBlockDevice -> Bool
$c== :: EbsBlockDevice -> EbsBlockDevice -> Bool
Prelude.Eq, ReadPrec [EbsBlockDevice]
ReadPrec EbsBlockDevice
Int -> ReadS EbsBlockDevice
ReadS [EbsBlockDevice]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EbsBlockDevice]
$creadListPrec :: ReadPrec [EbsBlockDevice]
readPrec :: ReadPrec EbsBlockDevice
$creadPrec :: ReadPrec EbsBlockDevice
readList :: ReadS [EbsBlockDevice]
$creadList :: ReadS [EbsBlockDevice]
readsPrec :: Int -> ReadS EbsBlockDevice
$creadsPrec :: Int -> ReadS EbsBlockDevice
Prelude.Read, Int -> EbsBlockDevice -> ShowS
[EbsBlockDevice] -> ShowS
EbsBlockDevice -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EbsBlockDevice] -> ShowS
$cshowList :: [EbsBlockDevice] -> ShowS
show :: EbsBlockDevice -> String
$cshow :: EbsBlockDevice -> String
showsPrec :: Int -> EbsBlockDevice -> ShowS
$cshowsPrec :: Int -> EbsBlockDevice -> ShowS
Prelude.Show, forall x. Rep EbsBlockDevice x -> EbsBlockDevice
forall x. EbsBlockDevice -> Rep EbsBlockDevice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EbsBlockDevice x -> EbsBlockDevice
$cfrom :: forall x. EbsBlockDevice -> Rep EbsBlockDevice x
Prelude.Generic)

-- |
-- Create a value of 'EbsBlockDevice' 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:
--
-- 'deleteOnTermination', 'ebsBlockDevice_deleteOnTermination' - Indicates whether the EBS volume is deleted on instance termination. For
-- more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/terminating-instances.html#preserving-volumes-on-termination Preserving Amazon EBS volumes on instance termination>
-- in the /Amazon EC2 User Guide/.
--
-- 'encrypted', 'ebsBlockDevice_encrypted' - Indicates whether the encryption state of an EBS volume is changed while
-- being restored from a backing snapshot. The effect of setting the
-- encryption state to @true@ depends on the volume origin (new or from a
-- snapshot), starting encryption state, ownership, and whether encryption
-- by default is enabled. For more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#encryption-parameters Amazon EBS encryption>
-- in the /Amazon EC2 User Guide/.
--
-- In no case can you remove encryption from an encrypted volume.
--
-- Encrypted volumes can only be attached to instances that support Amazon
-- EBS encryption. For more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#EBSEncryption_supported_instances Supported instance types>.
--
-- This parameter is not returned by
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeImageAttribute.html DescribeImageAttribute>.
--
-- 'iops', 'ebsBlockDevice_iops' - The number of I\/O operations per second (IOPS). For @gp3@, @io1@, and
-- @io2@ volumes, this represents the number of IOPS that are provisioned
-- for the volume. For @gp2@ volumes, this represents the baseline
-- performance of the volume and the rate at which the volume accumulates
-- I\/O credits for bursting.
--
-- The following are the supported values for each volume type:
--
-- -   @gp3@: 3,000-16,000 IOPS
--
-- -   @io1@: 100-64,000 IOPS
--
-- -   @io2@: 100-64,000 IOPS
--
-- For @io1@ and @io2@ volumes, we guarantee 64,000 IOPS only for
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#ec2-nitro-instances Instances built on the Nitro System>.
-- Other instance families guarantee performance up to 32,000 IOPS.
--
-- This parameter is required for @io1@ and @io2@ volumes. The default for
-- @gp3@ volumes is 3,000 IOPS. This parameter is not supported for @gp2@,
-- @st1@, @sc1@, or @standard@ volumes.
--
-- 'kmsKeyId', 'ebsBlockDevice_kmsKeyId' - Identifier (key ID, key alias, ID ARN, or alias ARN) for a customer
-- managed CMK under which the EBS volume is encrypted.
--
-- This parameter is only supported on @BlockDeviceMapping@ objects called
-- by
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html RunInstances>,
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestSpotFleet.html RequestSpotFleet>,
-- and
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestSpotInstances.html RequestSpotInstances>.
--
-- 'outpostArn', 'ebsBlockDevice_outpostArn' - The ARN of the Outpost on which the snapshot is stored.
--
-- This parameter is only supported on @BlockDeviceMapping@ objects called
-- by
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateImage.html CreateImage>.
--
-- 'snapshotId', 'ebsBlockDevice_snapshotId' - The ID of the snapshot.
--
-- 'throughput', 'ebsBlockDevice_throughput' - The throughput that the volume supports, in MiB\/s.
--
-- This parameter is valid only for @gp3@ volumes.
--
-- Valid Range: Minimum value of 125. Maximum value of 1000.
--
-- 'volumeSize', 'ebsBlockDevice_volumeSize' - The size of the volume, in GiBs. You must specify either a snapshot ID
-- or a volume size. If you specify a snapshot, the default is the snapshot
-- size. You can specify a volume size that is equal to or larger than the
-- snapshot size.
--
-- The following are the supported volumes sizes for each volume type:
--
-- -   @gp2@ and @gp3@:1-16,384
--
-- -   @io1@ and @io2@: 4-16,384
--
-- -   @st1@ and @sc1@: 125-16,384
--
-- -   @standard@: 1-1,024
--
-- 'volumeType', 'ebsBlockDevice_volumeType' - The volume type. For more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html Amazon EBS volume types>
-- in the /Amazon EC2 User Guide/. If the volume type is @io1@ or @io2@,
-- you must specify the IOPS that the volume supports.
newEbsBlockDevice ::
  EbsBlockDevice
newEbsBlockDevice :: EbsBlockDevice
newEbsBlockDevice =
  EbsBlockDevice'
    { $sel:deleteOnTermination:EbsBlockDevice' :: Maybe Bool
deleteOnTermination =
        forall a. Maybe a
Prelude.Nothing,
      $sel:encrypted:EbsBlockDevice' :: Maybe Bool
encrypted = forall a. Maybe a
Prelude.Nothing,
      $sel:iops:EbsBlockDevice' :: Maybe Int
iops = forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyId:EbsBlockDevice' :: Maybe Text
kmsKeyId = forall a. Maybe a
Prelude.Nothing,
      $sel:outpostArn:EbsBlockDevice' :: Maybe Text
outpostArn = forall a. Maybe a
Prelude.Nothing,
      $sel:snapshotId:EbsBlockDevice' :: Maybe Text
snapshotId = forall a. Maybe a
Prelude.Nothing,
      $sel:throughput:EbsBlockDevice' :: Maybe Int
throughput = forall a. Maybe a
Prelude.Nothing,
      $sel:volumeSize:EbsBlockDevice' :: Maybe Int
volumeSize = forall a. Maybe a
Prelude.Nothing,
      $sel:volumeType:EbsBlockDevice' :: Maybe VolumeType
volumeType = forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates whether the EBS volume is deleted on instance termination. For
-- more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/terminating-instances.html#preserving-volumes-on-termination Preserving Amazon EBS volumes on instance termination>
-- in the /Amazon EC2 User Guide/.
ebsBlockDevice_deleteOnTermination :: Lens.Lens' EbsBlockDevice (Prelude.Maybe Prelude.Bool)
ebsBlockDevice_deleteOnTermination :: Lens' EbsBlockDevice (Maybe Bool)
ebsBlockDevice_deleteOnTermination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EbsBlockDevice' {Maybe Bool
deleteOnTermination :: Maybe Bool
$sel:deleteOnTermination:EbsBlockDevice' :: EbsBlockDevice -> Maybe Bool
deleteOnTermination} -> Maybe Bool
deleteOnTermination) (\s :: EbsBlockDevice
s@EbsBlockDevice' {} Maybe Bool
a -> EbsBlockDevice
s {$sel:deleteOnTermination:EbsBlockDevice' :: Maybe Bool
deleteOnTermination = Maybe Bool
a} :: EbsBlockDevice)

-- | Indicates whether the encryption state of an EBS volume is changed while
-- being restored from a backing snapshot. The effect of setting the
-- encryption state to @true@ depends on the volume origin (new or from a
-- snapshot), starting encryption state, ownership, and whether encryption
-- by default is enabled. For more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#encryption-parameters Amazon EBS encryption>
-- in the /Amazon EC2 User Guide/.
--
-- In no case can you remove encryption from an encrypted volume.
--
-- Encrypted volumes can only be attached to instances that support Amazon
-- EBS encryption. For more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#EBSEncryption_supported_instances Supported instance types>.
--
-- This parameter is not returned by
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeImageAttribute.html DescribeImageAttribute>.
ebsBlockDevice_encrypted :: Lens.Lens' EbsBlockDevice (Prelude.Maybe Prelude.Bool)
ebsBlockDevice_encrypted :: Lens' EbsBlockDevice (Maybe Bool)
ebsBlockDevice_encrypted = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EbsBlockDevice' {Maybe Bool
encrypted :: Maybe Bool
$sel:encrypted:EbsBlockDevice' :: EbsBlockDevice -> Maybe Bool
encrypted} -> Maybe Bool
encrypted) (\s :: EbsBlockDevice
s@EbsBlockDevice' {} Maybe Bool
a -> EbsBlockDevice
s {$sel:encrypted:EbsBlockDevice' :: Maybe Bool
encrypted = Maybe Bool
a} :: EbsBlockDevice)

-- | The number of I\/O operations per second (IOPS). For @gp3@, @io1@, and
-- @io2@ volumes, this represents the number of IOPS that are provisioned
-- for the volume. For @gp2@ volumes, this represents the baseline
-- performance of the volume and the rate at which the volume accumulates
-- I\/O credits for bursting.
--
-- The following are the supported values for each volume type:
--
-- -   @gp3@: 3,000-16,000 IOPS
--
-- -   @io1@: 100-64,000 IOPS
--
-- -   @io2@: 100-64,000 IOPS
--
-- For @io1@ and @io2@ volumes, we guarantee 64,000 IOPS only for
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#ec2-nitro-instances Instances built on the Nitro System>.
-- Other instance families guarantee performance up to 32,000 IOPS.
--
-- This parameter is required for @io1@ and @io2@ volumes. The default for
-- @gp3@ volumes is 3,000 IOPS. This parameter is not supported for @gp2@,
-- @st1@, @sc1@, or @standard@ volumes.
ebsBlockDevice_iops :: Lens.Lens' EbsBlockDevice (Prelude.Maybe Prelude.Int)
ebsBlockDevice_iops :: Lens' EbsBlockDevice (Maybe Int)
ebsBlockDevice_iops = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EbsBlockDevice' {Maybe Int
iops :: Maybe Int
$sel:iops:EbsBlockDevice' :: EbsBlockDevice -> Maybe Int
iops} -> Maybe Int
iops) (\s :: EbsBlockDevice
s@EbsBlockDevice' {} Maybe Int
a -> EbsBlockDevice
s {$sel:iops:EbsBlockDevice' :: Maybe Int
iops = Maybe Int
a} :: EbsBlockDevice)

-- | Identifier (key ID, key alias, ID ARN, or alias ARN) for a customer
-- managed CMK under which the EBS volume is encrypted.
--
-- This parameter is only supported on @BlockDeviceMapping@ objects called
-- by
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html RunInstances>,
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestSpotFleet.html RequestSpotFleet>,
-- and
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestSpotInstances.html RequestSpotInstances>.
ebsBlockDevice_kmsKeyId :: Lens.Lens' EbsBlockDevice (Prelude.Maybe Prelude.Text)
ebsBlockDevice_kmsKeyId :: Lens' EbsBlockDevice (Maybe Text)
ebsBlockDevice_kmsKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EbsBlockDevice' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:EbsBlockDevice' :: EbsBlockDevice -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: EbsBlockDevice
s@EbsBlockDevice' {} Maybe Text
a -> EbsBlockDevice
s {$sel:kmsKeyId:EbsBlockDevice' :: Maybe Text
kmsKeyId = Maybe Text
a} :: EbsBlockDevice)

-- | The ARN of the Outpost on which the snapshot is stored.
--
-- This parameter is only supported on @BlockDeviceMapping@ objects called
-- by
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateImage.html CreateImage>.
ebsBlockDevice_outpostArn :: Lens.Lens' EbsBlockDevice (Prelude.Maybe Prelude.Text)
ebsBlockDevice_outpostArn :: Lens' EbsBlockDevice (Maybe Text)
ebsBlockDevice_outpostArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EbsBlockDevice' {Maybe Text
outpostArn :: Maybe Text
$sel:outpostArn:EbsBlockDevice' :: EbsBlockDevice -> Maybe Text
outpostArn} -> Maybe Text
outpostArn) (\s :: EbsBlockDevice
s@EbsBlockDevice' {} Maybe Text
a -> EbsBlockDevice
s {$sel:outpostArn:EbsBlockDevice' :: Maybe Text
outpostArn = Maybe Text
a} :: EbsBlockDevice)

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

-- | The throughput that the volume supports, in MiB\/s.
--
-- This parameter is valid only for @gp3@ volumes.
--
-- Valid Range: Minimum value of 125. Maximum value of 1000.
ebsBlockDevice_throughput :: Lens.Lens' EbsBlockDevice (Prelude.Maybe Prelude.Int)
ebsBlockDevice_throughput :: Lens' EbsBlockDevice (Maybe Int)
ebsBlockDevice_throughput = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EbsBlockDevice' {Maybe Int
throughput :: Maybe Int
$sel:throughput:EbsBlockDevice' :: EbsBlockDevice -> Maybe Int
throughput} -> Maybe Int
throughput) (\s :: EbsBlockDevice
s@EbsBlockDevice' {} Maybe Int
a -> EbsBlockDevice
s {$sel:throughput:EbsBlockDevice' :: Maybe Int
throughput = Maybe Int
a} :: EbsBlockDevice)

-- | The size of the volume, in GiBs. You must specify either a snapshot ID
-- or a volume size. If you specify a snapshot, the default is the snapshot
-- size. You can specify a volume size that is equal to or larger than the
-- snapshot size.
--
-- The following are the supported volumes sizes for each volume type:
--
-- -   @gp2@ and @gp3@:1-16,384
--
-- -   @io1@ and @io2@: 4-16,384
--
-- -   @st1@ and @sc1@: 125-16,384
--
-- -   @standard@: 1-1,024
ebsBlockDevice_volumeSize :: Lens.Lens' EbsBlockDevice (Prelude.Maybe Prelude.Int)
ebsBlockDevice_volumeSize :: Lens' EbsBlockDevice (Maybe Int)
ebsBlockDevice_volumeSize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EbsBlockDevice' {Maybe Int
volumeSize :: Maybe Int
$sel:volumeSize:EbsBlockDevice' :: EbsBlockDevice -> Maybe Int
volumeSize} -> Maybe Int
volumeSize) (\s :: EbsBlockDevice
s@EbsBlockDevice' {} Maybe Int
a -> EbsBlockDevice
s {$sel:volumeSize:EbsBlockDevice' :: Maybe Int
volumeSize = Maybe Int
a} :: EbsBlockDevice)

-- | The volume type. For more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html Amazon EBS volume types>
-- in the /Amazon EC2 User Guide/. If the volume type is @io1@ or @io2@,
-- you must specify the IOPS that the volume supports.
ebsBlockDevice_volumeType :: Lens.Lens' EbsBlockDevice (Prelude.Maybe VolumeType)
ebsBlockDevice_volumeType :: Lens' EbsBlockDevice (Maybe VolumeType)
ebsBlockDevice_volumeType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EbsBlockDevice' {Maybe VolumeType
volumeType :: Maybe VolumeType
$sel:volumeType:EbsBlockDevice' :: EbsBlockDevice -> Maybe VolumeType
volumeType} -> Maybe VolumeType
volumeType) (\s :: EbsBlockDevice
s@EbsBlockDevice' {} Maybe VolumeType
a -> EbsBlockDevice
s {$sel:volumeType:EbsBlockDevice' :: Maybe VolumeType
volumeType = Maybe VolumeType
a} :: EbsBlockDevice)

instance Data.FromXML EbsBlockDevice where
  parseXML :: [Node] -> Either String EbsBlockDevice
parseXML [Node]
x =
    Maybe Bool
-> Maybe Bool
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Int
-> Maybe VolumeType
-> EbsBlockDevice
EbsBlockDevice'
      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
"deleteOnTermination")
      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
"encrypted")
      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
"iops")
      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
"kmsKeyId")
      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
"outpostArn")
      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
"throughput")
      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
"volumeSize")
      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
"volumeType")

instance Prelude.Hashable EbsBlockDevice where
  hashWithSalt :: Int -> EbsBlockDevice -> Int
hashWithSalt Int
_salt EbsBlockDevice' {Maybe Bool
Maybe Int
Maybe Text
Maybe VolumeType
volumeType :: Maybe VolumeType
volumeSize :: Maybe Int
throughput :: Maybe Int
snapshotId :: Maybe Text
outpostArn :: Maybe Text
kmsKeyId :: Maybe Text
iops :: Maybe Int
encrypted :: Maybe Bool
deleteOnTermination :: Maybe Bool
$sel:volumeType:EbsBlockDevice' :: EbsBlockDevice -> Maybe VolumeType
$sel:volumeSize:EbsBlockDevice' :: EbsBlockDevice -> Maybe Int
$sel:throughput:EbsBlockDevice' :: EbsBlockDevice -> Maybe Int
$sel:snapshotId:EbsBlockDevice' :: EbsBlockDevice -> Maybe Text
$sel:outpostArn:EbsBlockDevice' :: EbsBlockDevice -> Maybe Text
$sel:kmsKeyId:EbsBlockDevice' :: EbsBlockDevice -> Maybe Text
$sel:iops:EbsBlockDevice' :: EbsBlockDevice -> Maybe Int
$sel:encrypted:EbsBlockDevice' :: EbsBlockDevice -> Maybe Bool
$sel:deleteOnTermination:EbsBlockDevice' :: EbsBlockDevice -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
deleteOnTermination
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
encrypted
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
iops
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
kmsKeyId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
outpostArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
snapshotId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
throughput
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
volumeSize
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VolumeType
volumeType

instance Prelude.NFData EbsBlockDevice where
  rnf :: EbsBlockDevice -> ()
rnf EbsBlockDevice' {Maybe Bool
Maybe Int
Maybe Text
Maybe VolumeType
volumeType :: Maybe VolumeType
volumeSize :: Maybe Int
throughput :: Maybe Int
snapshotId :: Maybe Text
outpostArn :: Maybe Text
kmsKeyId :: Maybe Text
iops :: Maybe Int
encrypted :: Maybe Bool
deleteOnTermination :: Maybe Bool
$sel:volumeType:EbsBlockDevice' :: EbsBlockDevice -> Maybe VolumeType
$sel:volumeSize:EbsBlockDevice' :: EbsBlockDevice -> Maybe Int
$sel:throughput:EbsBlockDevice' :: EbsBlockDevice -> Maybe Int
$sel:snapshotId:EbsBlockDevice' :: EbsBlockDevice -> Maybe Text
$sel:outpostArn:EbsBlockDevice' :: EbsBlockDevice -> Maybe Text
$sel:kmsKeyId:EbsBlockDevice' :: EbsBlockDevice -> Maybe Text
$sel:iops:EbsBlockDevice' :: EbsBlockDevice -> Maybe Int
$sel:encrypted:EbsBlockDevice' :: EbsBlockDevice -> Maybe Bool
$sel:deleteOnTermination:EbsBlockDevice' :: EbsBlockDevice -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
deleteOnTermination
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
encrypted
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
iops
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
kmsKeyId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
outpostArn
      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 Int
throughput
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
volumeSize
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VolumeType
volumeType

instance Data.ToQuery EbsBlockDevice where
  toQuery :: EbsBlockDevice -> QueryString
toQuery EbsBlockDevice' {Maybe Bool
Maybe Int
Maybe Text
Maybe VolumeType
volumeType :: Maybe VolumeType
volumeSize :: Maybe Int
throughput :: Maybe Int
snapshotId :: Maybe Text
outpostArn :: Maybe Text
kmsKeyId :: Maybe Text
iops :: Maybe Int
encrypted :: Maybe Bool
deleteOnTermination :: Maybe Bool
$sel:volumeType:EbsBlockDevice' :: EbsBlockDevice -> Maybe VolumeType
$sel:volumeSize:EbsBlockDevice' :: EbsBlockDevice -> Maybe Int
$sel:throughput:EbsBlockDevice' :: EbsBlockDevice -> Maybe Int
$sel:snapshotId:EbsBlockDevice' :: EbsBlockDevice -> Maybe Text
$sel:outpostArn:EbsBlockDevice' :: EbsBlockDevice -> Maybe Text
$sel:kmsKeyId:EbsBlockDevice' :: EbsBlockDevice -> Maybe Text
$sel:iops:EbsBlockDevice' :: EbsBlockDevice -> Maybe Int
$sel:encrypted:EbsBlockDevice' :: EbsBlockDevice -> Maybe Bool
$sel:deleteOnTermination:EbsBlockDevice' :: EbsBlockDevice -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"DeleteOnTermination" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
deleteOnTermination,
        ByteString
"Encrypted" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
encrypted,
        ByteString
"Iops" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Int
iops,
        ByteString
"KmsKeyId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
kmsKeyId,
        ByteString
"OutpostArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
outpostArn,
        ByteString
"SnapshotId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
snapshotId,
        ByteString
"Throughput" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Int
throughput,
        ByteString
"VolumeSize" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Int
volumeSize,
        ByteString
"VolumeType" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe VolumeType
volumeType
      ]