{-# 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.EMR.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.EMR.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.EMR.Types.VolumeSpecification
import qualified Amazonka.Prelude as Prelude

-- | Configuration of requested EBS block device associated with the instance
-- group.
--
-- /See:/ 'newEbsBlockDevice' smart constructor.
data EbsBlockDevice = EbsBlockDevice'
  { -- | The device name that is exposed to the instance, such as \/dev\/sdh.
    EbsBlockDevice -> Maybe Text
device :: Prelude.Maybe Prelude.Text,
    -- | EBS volume specifications such as volume type, IOPS, size (GiB) and
    -- throughput (MiB\/s) that are requested for the EBS volume attached to an
    -- EC2 instance in the cluster.
    EbsBlockDevice -> Maybe VolumeSpecification
volumeSpecification :: Prelude.Maybe VolumeSpecification
  }
  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:
--
-- 'device', 'ebsBlockDevice_device' - The device name that is exposed to the instance, such as \/dev\/sdh.
--
-- 'volumeSpecification', 'ebsBlockDevice_volumeSpecification' - EBS volume specifications such as volume type, IOPS, size (GiB) and
-- throughput (MiB\/s) that are requested for the EBS volume attached to an
-- EC2 instance in the cluster.
newEbsBlockDevice ::
  EbsBlockDevice
newEbsBlockDevice :: EbsBlockDevice
newEbsBlockDevice =
  EbsBlockDevice'
    { $sel:device:EbsBlockDevice' :: Maybe Text
device = forall a. Maybe a
Prelude.Nothing,
      $sel:volumeSpecification:EbsBlockDevice' :: Maybe VolumeSpecification
volumeSpecification = forall a. Maybe a
Prelude.Nothing
    }

-- | The device name that is exposed to the instance, such as \/dev\/sdh.
ebsBlockDevice_device :: Lens.Lens' EbsBlockDevice (Prelude.Maybe Prelude.Text)
ebsBlockDevice_device :: Lens' EbsBlockDevice (Maybe Text)
ebsBlockDevice_device = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EbsBlockDevice' {Maybe Text
device :: Maybe Text
$sel:device:EbsBlockDevice' :: EbsBlockDevice -> Maybe Text
device} -> Maybe Text
device) (\s :: EbsBlockDevice
s@EbsBlockDevice' {} Maybe Text
a -> EbsBlockDevice
s {$sel:device:EbsBlockDevice' :: Maybe Text
device = Maybe Text
a} :: EbsBlockDevice)

-- | EBS volume specifications such as volume type, IOPS, size (GiB) and
-- throughput (MiB\/s) that are requested for the EBS volume attached to an
-- EC2 instance in the cluster.
ebsBlockDevice_volumeSpecification :: Lens.Lens' EbsBlockDevice (Prelude.Maybe VolumeSpecification)
ebsBlockDevice_volumeSpecification :: Lens' EbsBlockDevice (Maybe VolumeSpecification)
ebsBlockDevice_volumeSpecification = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EbsBlockDevice' {Maybe VolumeSpecification
volumeSpecification :: Maybe VolumeSpecification
$sel:volumeSpecification:EbsBlockDevice' :: EbsBlockDevice -> Maybe VolumeSpecification
volumeSpecification} -> Maybe VolumeSpecification
volumeSpecification) (\s :: EbsBlockDevice
s@EbsBlockDevice' {} Maybe VolumeSpecification
a -> EbsBlockDevice
s {$sel:volumeSpecification:EbsBlockDevice' :: Maybe VolumeSpecification
volumeSpecification = Maybe VolumeSpecification
a} :: EbsBlockDevice)

instance Data.FromJSON EbsBlockDevice where
  parseJSON :: Value -> Parser EbsBlockDevice
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EbsBlockDevice"
      ( \Object
x ->
          Maybe Text -> Maybe VolumeSpecification -> EbsBlockDevice
EbsBlockDevice'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Device")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"VolumeSpecification")
      )

instance Prelude.Hashable EbsBlockDevice where
  hashWithSalt :: Int -> EbsBlockDevice -> Int
hashWithSalt Int
_salt EbsBlockDevice' {Maybe Text
Maybe VolumeSpecification
volumeSpecification :: Maybe VolumeSpecification
device :: Maybe Text
$sel:volumeSpecification:EbsBlockDevice' :: EbsBlockDevice -> Maybe VolumeSpecification
$sel:device:EbsBlockDevice' :: EbsBlockDevice -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
device
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VolumeSpecification
volumeSpecification

instance Prelude.NFData EbsBlockDevice where
  rnf :: EbsBlockDevice -> ()
rnf EbsBlockDevice' {Maybe Text
Maybe VolumeSpecification
volumeSpecification :: Maybe VolumeSpecification
device :: Maybe Text
$sel:volumeSpecification:EbsBlockDevice' :: EbsBlockDevice -> Maybe VolumeSpecification
$sel:device:EbsBlockDevice' :: EbsBlockDevice -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
device
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VolumeSpecification
volumeSpecification