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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(EbsVolume -> EbsVolume -> Bool)
-> (EbsVolume -> EbsVolume -> Bool) -> Eq EbsVolume
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]
(Int -> ReadS EbsVolume)
-> ReadS [EbsVolume]
-> ReadPrec EbsVolume
-> ReadPrec [EbsVolume]
-> Read 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
(Int -> EbsVolume -> ShowS)
-> (EbsVolume -> String)
-> ([EbsVolume] -> ShowS)
-> Show EbsVolume
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. EbsVolume -> Rep EbsVolume x)
-> (forall x. Rep EbsVolume x -> EbsVolume) -> Generic EbsVolume
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' :: Maybe Text -> Maybe Text -> EbsVolume
EbsVolume'
    { $sel:device:EbsVolume' :: Maybe Text
device = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:volumeId:EbsVolume' :: Maybe Text
volumeId = Maybe Text
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 :: (Maybe Text -> f (Maybe Text)) -> EbsVolume -> f EbsVolume
ebsVolume_device = (EbsVolume -> Maybe Text)
-> (EbsVolume -> Maybe Text -> EbsVolume)
-> Lens EbsVolume EbsVolume (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text)) -> EbsVolume -> f EbsVolume
ebsVolume_volumeId = (EbsVolume -> Maybe Text)
-> (EbsVolume -> Maybe Text -> EbsVolume)
-> Lens EbsVolume EbsVolume (Maybe Text) (Maybe Text)
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 Core.FromJSON EbsVolume where
  parseJSON :: Value -> Parser EbsVolume
parseJSON =
    String -> (Object -> Parser EbsVolume) -> Value -> Parser EbsVolume
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EbsVolume"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> EbsVolume
EbsVolume'
            (Maybe Text -> Maybe Text -> EbsVolume)
-> Parser (Maybe Text) -> Parser (Maybe Text -> EbsVolume)
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 Text -> EbsVolume)
-> Parser (Maybe Text) -> Parser EbsVolume
forall (f :: * -> *) a b. Applicative f => 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
"VolumeId")
      )

instance Prelude.Hashable EbsVolume

instance Prelude.NFData EbsVolume