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

-- | Describes a block device mapping for a Scheduled Instance.
--
-- /See:/ 'newScheduledInstancesBlockDeviceMapping' smart constructor.
data ScheduledInstancesBlockDeviceMapping = ScheduledInstancesBlockDeviceMapping'
  { -- | The device name (for example, @\/dev\/sdh@ or @xvdh@).
    ScheduledInstancesBlockDeviceMapping -> Maybe Text
deviceName :: Prelude.Maybe Prelude.Text,
    -- | Parameters used to set up EBS volumes automatically when the instance is
    -- launched.
    ScheduledInstancesBlockDeviceMapping -> Maybe ScheduledInstancesEbs
ebs :: Prelude.Maybe ScheduledInstancesEbs,
    -- | To omit the device from the block device mapping, specify an empty
    -- string.
    ScheduledInstancesBlockDeviceMapping -> Maybe Text
noDevice :: Prelude.Maybe Prelude.Text,
    -- | The virtual device name (@ephemeral@N). Instance store volumes are
    -- numbered starting from 0. An instance type with two available instance
    -- store volumes can specify mappings for @ephemeral0@ and @ephemeral1@.
    -- The number of available instance store volumes depends on the instance
    -- type. After you connect to the instance, you must mount the volume.
    --
    -- Constraints: For M3 instances, you must specify instance store volumes
    -- in the block device mapping for the instance. When you launch an M3
    -- instance, we ignore any instance store volumes specified in the block
    -- device mapping for the AMI.
    ScheduledInstancesBlockDeviceMapping -> Maybe Text
virtualName :: Prelude.Maybe Prelude.Text
  }
  deriving (ScheduledInstancesBlockDeviceMapping
-> ScheduledInstancesBlockDeviceMapping -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScheduledInstancesBlockDeviceMapping
-> ScheduledInstancesBlockDeviceMapping -> Bool
$c/= :: ScheduledInstancesBlockDeviceMapping
-> ScheduledInstancesBlockDeviceMapping -> Bool
== :: ScheduledInstancesBlockDeviceMapping
-> ScheduledInstancesBlockDeviceMapping -> Bool
$c== :: ScheduledInstancesBlockDeviceMapping
-> ScheduledInstancesBlockDeviceMapping -> Bool
Prelude.Eq, ReadPrec [ScheduledInstancesBlockDeviceMapping]
ReadPrec ScheduledInstancesBlockDeviceMapping
Int -> ReadS ScheduledInstancesBlockDeviceMapping
ReadS [ScheduledInstancesBlockDeviceMapping]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScheduledInstancesBlockDeviceMapping]
$creadListPrec :: ReadPrec [ScheduledInstancesBlockDeviceMapping]
readPrec :: ReadPrec ScheduledInstancesBlockDeviceMapping
$creadPrec :: ReadPrec ScheduledInstancesBlockDeviceMapping
readList :: ReadS [ScheduledInstancesBlockDeviceMapping]
$creadList :: ReadS [ScheduledInstancesBlockDeviceMapping]
readsPrec :: Int -> ReadS ScheduledInstancesBlockDeviceMapping
$creadsPrec :: Int -> ReadS ScheduledInstancesBlockDeviceMapping
Prelude.Read, Int -> ScheduledInstancesBlockDeviceMapping -> ShowS
[ScheduledInstancesBlockDeviceMapping] -> ShowS
ScheduledInstancesBlockDeviceMapping -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScheduledInstancesBlockDeviceMapping] -> ShowS
$cshowList :: [ScheduledInstancesBlockDeviceMapping] -> ShowS
show :: ScheduledInstancesBlockDeviceMapping -> String
$cshow :: ScheduledInstancesBlockDeviceMapping -> String
showsPrec :: Int -> ScheduledInstancesBlockDeviceMapping -> ShowS
$cshowsPrec :: Int -> ScheduledInstancesBlockDeviceMapping -> ShowS
Prelude.Show, forall x.
Rep ScheduledInstancesBlockDeviceMapping x
-> ScheduledInstancesBlockDeviceMapping
forall x.
ScheduledInstancesBlockDeviceMapping
-> Rep ScheduledInstancesBlockDeviceMapping x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ScheduledInstancesBlockDeviceMapping x
-> ScheduledInstancesBlockDeviceMapping
$cfrom :: forall x.
ScheduledInstancesBlockDeviceMapping
-> Rep ScheduledInstancesBlockDeviceMapping x
Prelude.Generic)

-- |
-- Create a value of 'ScheduledInstancesBlockDeviceMapping' 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:
--
-- 'deviceName', 'scheduledInstancesBlockDeviceMapping_deviceName' - The device name (for example, @\/dev\/sdh@ or @xvdh@).
--
-- 'ebs', 'scheduledInstancesBlockDeviceMapping_ebs' - Parameters used to set up EBS volumes automatically when the instance is
-- launched.
--
-- 'noDevice', 'scheduledInstancesBlockDeviceMapping_noDevice' - To omit the device from the block device mapping, specify an empty
-- string.
--
-- 'virtualName', 'scheduledInstancesBlockDeviceMapping_virtualName' - The virtual device name (@ephemeral@N). Instance store volumes are
-- numbered starting from 0. An instance type with two available instance
-- store volumes can specify mappings for @ephemeral0@ and @ephemeral1@.
-- The number of available instance store volumes depends on the instance
-- type. After you connect to the instance, you must mount the volume.
--
-- Constraints: For M3 instances, you must specify instance store volumes
-- in the block device mapping for the instance. When you launch an M3
-- instance, we ignore any instance store volumes specified in the block
-- device mapping for the AMI.
newScheduledInstancesBlockDeviceMapping ::
  ScheduledInstancesBlockDeviceMapping
newScheduledInstancesBlockDeviceMapping :: ScheduledInstancesBlockDeviceMapping
newScheduledInstancesBlockDeviceMapping =
  ScheduledInstancesBlockDeviceMapping'
    { $sel:deviceName:ScheduledInstancesBlockDeviceMapping' :: Maybe Text
deviceName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:ebs:ScheduledInstancesBlockDeviceMapping' :: Maybe ScheduledInstancesEbs
ebs = forall a. Maybe a
Prelude.Nothing,
      $sel:noDevice:ScheduledInstancesBlockDeviceMapping' :: Maybe Text
noDevice = forall a. Maybe a
Prelude.Nothing,
      $sel:virtualName:ScheduledInstancesBlockDeviceMapping' :: Maybe Text
virtualName = forall a. Maybe a
Prelude.Nothing
    }

-- | The device name (for example, @\/dev\/sdh@ or @xvdh@).
scheduledInstancesBlockDeviceMapping_deviceName :: Lens.Lens' ScheduledInstancesBlockDeviceMapping (Prelude.Maybe Prelude.Text)
scheduledInstancesBlockDeviceMapping_deviceName :: Lens' ScheduledInstancesBlockDeviceMapping (Maybe Text)
scheduledInstancesBlockDeviceMapping_deviceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledInstancesBlockDeviceMapping' {Maybe Text
deviceName :: Maybe Text
$sel:deviceName:ScheduledInstancesBlockDeviceMapping' :: ScheduledInstancesBlockDeviceMapping -> Maybe Text
deviceName} -> Maybe Text
deviceName) (\s :: ScheduledInstancesBlockDeviceMapping
s@ScheduledInstancesBlockDeviceMapping' {} Maybe Text
a -> ScheduledInstancesBlockDeviceMapping
s {$sel:deviceName:ScheduledInstancesBlockDeviceMapping' :: Maybe Text
deviceName = Maybe Text
a} :: ScheduledInstancesBlockDeviceMapping)

-- | Parameters used to set up EBS volumes automatically when the instance is
-- launched.
scheduledInstancesBlockDeviceMapping_ebs :: Lens.Lens' ScheduledInstancesBlockDeviceMapping (Prelude.Maybe ScheduledInstancesEbs)
scheduledInstancesBlockDeviceMapping_ebs :: Lens'
  ScheduledInstancesBlockDeviceMapping (Maybe ScheduledInstancesEbs)
scheduledInstancesBlockDeviceMapping_ebs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledInstancesBlockDeviceMapping' {Maybe ScheduledInstancesEbs
ebs :: Maybe ScheduledInstancesEbs
$sel:ebs:ScheduledInstancesBlockDeviceMapping' :: ScheduledInstancesBlockDeviceMapping -> Maybe ScheduledInstancesEbs
ebs} -> Maybe ScheduledInstancesEbs
ebs) (\s :: ScheduledInstancesBlockDeviceMapping
s@ScheduledInstancesBlockDeviceMapping' {} Maybe ScheduledInstancesEbs
a -> ScheduledInstancesBlockDeviceMapping
s {$sel:ebs:ScheduledInstancesBlockDeviceMapping' :: Maybe ScheduledInstancesEbs
ebs = Maybe ScheduledInstancesEbs
a} :: ScheduledInstancesBlockDeviceMapping)

-- | To omit the device from the block device mapping, specify an empty
-- string.
scheduledInstancesBlockDeviceMapping_noDevice :: Lens.Lens' ScheduledInstancesBlockDeviceMapping (Prelude.Maybe Prelude.Text)
scheduledInstancesBlockDeviceMapping_noDevice :: Lens' ScheduledInstancesBlockDeviceMapping (Maybe Text)
scheduledInstancesBlockDeviceMapping_noDevice = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledInstancesBlockDeviceMapping' {Maybe Text
noDevice :: Maybe Text
$sel:noDevice:ScheduledInstancesBlockDeviceMapping' :: ScheduledInstancesBlockDeviceMapping -> Maybe Text
noDevice} -> Maybe Text
noDevice) (\s :: ScheduledInstancesBlockDeviceMapping
s@ScheduledInstancesBlockDeviceMapping' {} Maybe Text
a -> ScheduledInstancesBlockDeviceMapping
s {$sel:noDevice:ScheduledInstancesBlockDeviceMapping' :: Maybe Text
noDevice = Maybe Text
a} :: ScheduledInstancesBlockDeviceMapping)

-- | The virtual device name (@ephemeral@N). Instance store volumes are
-- numbered starting from 0. An instance type with two available instance
-- store volumes can specify mappings for @ephemeral0@ and @ephemeral1@.
-- The number of available instance store volumes depends on the instance
-- type. After you connect to the instance, you must mount the volume.
--
-- Constraints: For M3 instances, you must specify instance store volumes
-- in the block device mapping for the instance. When you launch an M3
-- instance, we ignore any instance store volumes specified in the block
-- device mapping for the AMI.
scheduledInstancesBlockDeviceMapping_virtualName :: Lens.Lens' ScheduledInstancesBlockDeviceMapping (Prelude.Maybe Prelude.Text)
scheduledInstancesBlockDeviceMapping_virtualName :: Lens' ScheduledInstancesBlockDeviceMapping (Maybe Text)
scheduledInstancesBlockDeviceMapping_virtualName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledInstancesBlockDeviceMapping' {Maybe Text
virtualName :: Maybe Text
$sel:virtualName:ScheduledInstancesBlockDeviceMapping' :: ScheduledInstancesBlockDeviceMapping -> Maybe Text
virtualName} -> Maybe Text
virtualName) (\s :: ScheduledInstancesBlockDeviceMapping
s@ScheduledInstancesBlockDeviceMapping' {} Maybe Text
a -> ScheduledInstancesBlockDeviceMapping
s {$sel:virtualName:ScheduledInstancesBlockDeviceMapping' :: Maybe Text
virtualName = Maybe Text
a} :: ScheduledInstancesBlockDeviceMapping)

instance
  Prelude.Hashable
    ScheduledInstancesBlockDeviceMapping
  where
  hashWithSalt :: Int -> ScheduledInstancesBlockDeviceMapping -> Int
hashWithSalt
    Int
_salt
    ScheduledInstancesBlockDeviceMapping' {Maybe Text
Maybe ScheduledInstancesEbs
virtualName :: Maybe Text
noDevice :: Maybe Text
ebs :: Maybe ScheduledInstancesEbs
deviceName :: Maybe Text
$sel:virtualName:ScheduledInstancesBlockDeviceMapping' :: ScheduledInstancesBlockDeviceMapping -> Maybe Text
$sel:noDevice:ScheduledInstancesBlockDeviceMapping' :: ScheduledInstancesBlockDeviceMapping -> Maybe Text
$sel:ebs:ScheduledInstancesBlockDeviceMapping' :: ScheduledInstancesBlockDeviceMapping -> Maybe ScheduledInstancesEbs
$sel:deviceName:ScheduledInstancesBlockDeviceMapping' :: ScheduledInstancesBlockDeviceMapping -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deviceName
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ScheduledInstancesEbs
ebs
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
noDevice
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
virtualName

instance
  Prelude.NFData
    ScheduledInstancesBlockDeviceMapping
  where
  rnf :: ScheduledInstancesBlockDeviceMapping -> ()
rnf ScheduledInstancesBlockDeviceMapping' {Maybe Text
Maybe ScheduledInstancesEbs
virtualName :: Maybe Text
noDevice :: Maybe Text
ebs :: Maybe ScheduledInstancesEbs
deviceName :: Maybe Text
$sel:virtualName:ScheduledInstancesBlockDeviceMapping' :: ScheduledInstancesBlockDeviceMapping -> Maybe Text
$sel:noDevice:ScheduledInstancesBlockDeviceMapping' :: ScheduledInstancesBlockDeviceMapping -> Maybe Text
$sel:ebs:ScheduledInstancesBlockDeviceMapping' :: ScheduledInstancesBlockDeviceMapping -> Maybe ScheduledInstancesEbs
$sel:deviceName:ScheduledInstancesBlockDeviceMapping' :: ScheduledInstancesBlockDeviceMapping -> Maybe Text
..} =
    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 ScheduledInstancesEbs
ebs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
noDevice
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
virtualName

instance
  Data.ToQuery
    ScheduledInstancesBlockDeviceMapping
  where
  toQuery :: ScheduledInstancesBlockDeviceMapping -> QueryString
toQuery ScheduledInstancesBlockDeviceMapping' {Maybe Text
Maybe ScheduledInstancesEbs
virtualName :: Maybe Text
noDevice :: Maybe Text
ebs :: Maybe ScheduledInstancesEbs
deviceName :: Maybe Text
$sel:virtualName:ScheduledInstancesBlockDeviceMapping' :: ScheduledInstancesBlockDeviceMapping -> Maybe Text
$sel:noDevice:ScheduledInstancesBlockDeviceMapping' :: ScheduledInstancesBlockDeviceMapping -> Maybe Text
$sel:ebs:ScheduledInstancesBlockDeviceMapping' :: ScheduledInstancesBlockDeviceMapping -> Maybe ScheduledInstancesEbs
$sel:deviceName:ScheduledInstancesBlockDeviceMapping' :: ScheduledInstancesBlockDeviceMapping -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"DeviceName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
deviceName,
        ByteString
"Ebs" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe ScheduledInstancesEbs
ebs,
        ByteString
"NoDevice" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
noDevice,
        ByteString
"VirtualName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
virtualName
      ]