{-# 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.EbsVolume
-- 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.EbsVolume where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | EBS block device that\'s attached to an EC2 instance.
--
-- /See:/ 'newEbsVolume' smart constructor.
data EbsVolume = EbsVolume'
  { -- | The device name that is exposed to the instance, such as \/dev\/sdh.
    EbsVolume -> Maybe Text
device :: Prelude.Maybe Prelude.Text,
    -- | The volume identifier of the EBS volume.
    EbsVolume -> Maybe Text
volumeId :: Prelude.Maybe Prelude.Text
  }
  deriving (EbsVolume -> EbsVolume -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EbsVolume -> EbsVolume -> Bool
$c/= :: EbsVolume -> EbsVolume -> Bool
== :: EbsVolume -> EbsVolume -> Bool
$c== :: EbsVolume -> EbsVolume -> Bool
Prelude.Eq, ReadPrec [EbsVolume]
ReadPrec EbsVolume
Int -> ReadS EbsVolume
ReadS [EbsVolume]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EbsVolume]
$creadListPrec :: ReadPrec [EbsVolume]
readPrec :: ReadPrec EbsVolume
$creadPrec :: ReadPrec EbsVolume
readList :: ReadS [EbsVolume]
$creadList :: ReadS [EbsVolume]
readsPrec :: Int -> ReadS EbsVolume
$creadsPrec :: Int -> ReadS EbsVolume
Prelude.Read, Int -> EbsVolume -> ShowS
[EbsVolume] -> ShowS
EbsVolume -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EbsVolume] -> ShowS
$cshowList :: [EbsVolume] -> ShowS
show :: EbsVolume -> String
$cshow :: EbsVolume -> String
showsPrec :: Int -> EbsVolume -> ShowS
$cshowsPrec :: Int -> EbsVolume -> ShowS
Prelude.Show, forall x. Rep EbsVolume x -> EbsVolume
forall x. EbsVolume -> Rep EbsVolume x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EbsVolume x -> EbsVolume
$cfrom :: forall x. EbsVolume -> Rep EbsVolume x
Prelude.Generic)

-- |
-- Create a value of 'EbsVolume' 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', 'ebsVolume_device' - The device name that is exposed to the instance, such as \/dev\/sdh.
--
-- 'volumeId', 'ebsVolume_volumeId' - The volume identifier of the EBS volume.
newEbsVolume ::
  EbsVolume
newEbsVolume :: EbsVolume
newEbsVolume =
  EbsVolume'
    { $sel:device:EbsVolume' :: Maybe Text
device = forall a. Maybe a
Prelude.Nothing,
      $sel:volumeId:EbsVolume' :: Maybe Text
volumeId = forall a. Maybe a
Prelude.Nothing
    }

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

-- | The volume identifier of the EBS volume.
ebsVolume_volumeId :: Lens.Lens' EbsVolume (Prelude.Maybe Prelude.Text)
ebsVolume_volumeId :: Lens' EbsVolume (Maybe Text)
ebsVolume_volumeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EbsVolume' {Maybe Text
volumeId :: Maybe Text
$sel:volumeId:EbsVolume' :: EbsVolume -> Maybe Text
volumeId} -> Maybe Text
volumeId) (\s :: EbsVolume
s@EbsVolume' {} Maybe Text
a -> EbsVolume
s {$sel:volumeId:EbsVolume' :: Maybe Text
volumeId = Maybe Text
a} :: EbsVolume)

instance Data.FromJSON EbsVolume where
  parseJSON :: Value -> Parser EbsVolume
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EbsVolume"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> EbsVolume
EbsVolume'
            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
"VolumeId")
      )

instance Prelude.Hashable EbsVolume where
  hashWithSalt :: Int -> EbsVolume -> Int
hashWithSalt Int
_salt EbsVolume' {Maybe Text
volumeId :: Maybe Text
device :: Maybe Text
$sel:volumeId:EbsVolume' :: EbsVolume -> Maybe Text
$sel:device:EbsVolume' :: EbsVolume -> 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 Text
volumeId

instance Prelude.NFData EbsVolume where
  rnf :: EbsVolume -> ()
rnf EbsVolume' {Maybe Text
volumeId :: Maybe Text
device :: Maybe Text
$sel:volumeId:EbsVolume' :: EbsVolume -> Maybe Text
$sel:device:EbsVolume' :: EbsVolume -> 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 Text
volumeId