{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.EMR.Types.EbsBlockDevice where

import qualified Amazonka.Core as Core
import Amazonka.EMR.Types.VolumeSpecification
import qualified Amazonka.Lens as Lens
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, and size (GiB) that
    -- will be requested for the EBS volume attached to an EC2 instance in the
    -- cluster.
    EbsBlockDevice -> Maybe VolumeSpecification
volumeSpecification :: Prelude.Maybe VolumeSpecification
  }
  deriving (EbsBlockDevice -> EbsBlockDevice -> Bool
(EbsBlockDevice -> EbsBlockDevice -> Bool)
-> (EbsBlockDevice -> EbsBlockDevice -> Bool) -> Eq EbsBlockDevice
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]
(Int -> ReadS EbsBlockDevice)
-> ReadS [EbsBlockDevice]
-> ReadPrec EbsBlockDevice
-> ReadPrec [EbsBlockDevice]
-> Read 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
(Int -> EbsBlockDevice -> ShowS)
-> (EbsBlockDevice -> String)
-> ([EbsBlockDevice] -> ShowS)
-> Show EbsBlockDevice
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. EbsBlockDevice -> Rep EbsBlockDevice x)
-> (forall x. Rep EbsBlockDevice x -> EbsBlockDevice)
-> Generic EbsBlockDevice
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, and size (GiB) that
-- will be requested for the EBS volume attached to an EC2 instance in the
-- cluster.
newEbsBlockDevice ::
  EbsBlockDevice
newEbsBlockDevice :: EbsBlockDevice
newEbsBlockDevice =
  EbsBlockDevice' :: Maybe Text -> Maybe VolumeSpecification -> EbsBlockDevice
EbsBlockDevice'
    { $sel:device:EbsBlockDevice' :: Maybe Text
device = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:volumeSpecification:EbsBlockDevice' :: Maybe VolumeSpecification
volumeSpecification = Maybe 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 :: (Maybe Text -> f (Maybe Text))
-> EbsBlockDevice -> f EbsBlockDevice
ebsBlockDevice_device = (EbsBlockDevice -> Maybe Text)
-> (EbsBlockDevice -> Maybe Text -> EbsBlockDevice)
-> Lens EbsBlockDevice EbsBlockDevice (Maybe Text) (Maybe Text)
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, and size (GiB) that
-- will be requested for the EBS volume attached to an EC2 instance in the
-- cluster.
ebsBlockDevice_volumeSpecification :: Lens.Lens' EbsBlockDevice (Prelude.Maybe VolumeSpecification)
ebsBlockDevice_volumeSpecification :: (Maybe VolumeSpecification -> f (Maybe VolumeSpecification))
-> EbsBlockDevice -> f EbsBlockDevice
ebsBlockDevice_volumeSpecification = (EbsBlockDevice -> Maybe VolumeSpecification)
-> (EbsBlockDevice -> Maybe VolumeSpecification -> EbsBlockDevice)
-> Lens
     EbsBlockDevice
     EbsBlockDevice
     (Maybe VolumeSpecification)
     (Maybe 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 Core.FromJSON EbsBlockDevice where
  parseJSON :: Value -> Parser EbsBlockDevice
parseJSON =
    String
-> (Object -> Parser EbsBlockDevice)
-> Value
-> Parser EbsBlockDevice
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EbsBlockDevice"
      ( \Object
x ->
          Maybe Text -> Maybe VolumeSpecification -> EbsBlockDevice
EbsBlockDevice'
            (Maybe Text -> Maybe VolumeSpecification -> EbsBlockDevice)
-> Parser (Maybe Text)
-> Parser (Maybe VolumeSpecification -> EbsBlockDevice)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Device")
            Parser (Maybe VolumeSpecification -> EbsBlockDevice)
-> Parser (Maybe VolumeSpecification) -> Parser EbsBlockDevice
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe VolumeSpecification)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"VolumeSpecification")
      )

instance Prelude.Hashable EbsBlockDevice

instance Prelude.NFData EbsBlockDevice