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

import qualified Amazonka.Core as Core
import Amazonka.EMR.Types.EbsBlockDeviceConfig
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The Amazon EBS configuration of a cluster instance.
--
-- /See:/ 'newEbsConfiguration' smart constructor.
data EbsConfiguration = EbsConfiguration'
  { -- | Indicates whether an Amazon EBS volume is EBS-optimized.
    EbsConfiguration -> Maybe Bool
ebsOptimized :: Prelude.Maybe Prelude.Bool,
    -- | An array of Amazon EBS volume specifications attached to a cluster
    -- instance.
    EbsConfiguration -> Maybe [EbsBlockDeviceConfig]
ebsBlockDeviceConfigs :: Prelude.Maybe [EbsBlockDeviceConfig]
  }
  deriving (EbsConfiguration -> EbsConfiguration -> Bool
(EbsConfiguration -> EbsConfiguration -> Bool)
-> (EbsConfiguration -> EbsConfiguration -> Bool)
-> Eq EbsConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EbsConfiguration -> EbsConfiguration -> Bool
$c/= :: EbsConfiguration -> EbsConfiguration -> Bool
== :: EbsConfiguration -> EbsConfiguration -> Bool
$c== :: EbsConfiguration -> EbsConfiguration -> Bool
Prelude.Eq, ReadPrec [EbsConfiguration]
ReadPrec EbsConfiguration
Int -> ReadS EbsConfiguration
ReadS [EbsConfiguration]
(Int -> ReadS EbsConfiguration)
-> ReadS [EbsConfiguration]
-> ReadPrec EbsConfiguration
-> ReadPrec [EbsConfiguration]
-> Read EbsConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EbsConfiguration]
$creadListPrec :: ReadPrec [EbsConfiguration]
readPrec :: ReadPrec EbsConfiguration
$creadPrec :: ReadPrec EbsConfiguration
readList :: ReadS [EbsConfiguration]
$creadList :: ReadS [EbsConfiguration]
readsPrec :: Int -> ReadS EbsConfiguration
$creadsPrec :: Int -> ReadS EbsConfiguration
Prelude.Read, Int -> EbsConfiguration -> ShowS
[EbsConfiguration] -> ShowS
EbsConfiguration -> String
(Int -> EbsConfiguration -> ShowS)
-> (EbsConfiguration -> String)
-> ([EbsConfiguration] -> ShowS)
-> Show EbsConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EbsConfiguration] -> ShowS
$cshowList :: [EbsConfiguration] -> ShowS
show :: EbsConfiguration -> String
$cshow :: EbsConfiguration -> String
showsPrec :: Int -> EbsConfiguration -> ShowS
$cshowsPrec :: Int -> EbsConfiguration -> ShowS
Prelude.Show, (forall x. EbsConfiguration -> Rep EbsConfiguration x)
-> (forall x. Rep EbsConfiguration x -> EbsConfiguration)
-> Generic EbsConfiguration
forall x. Rep EbsConfiguration x -> EbsConfiguration
forall x. EbsConfiguration -> Rep EbsConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EbsConfiguration x -> EbsConfiguration
$cfrom :: forall x. EbsConfiguration -> Rep EbsConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'EbsConfiguration' 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:
--
-- 'ebsOptimized', 'ebsConfiguration_ebsOptimized' - Indicates whether an Amazon EBS volume is EBS-optimized.
--
-- 'ebsBlockDeviceConfigs', 'ebsConfiguration_ebsBlockDeviceConfigs' - An array of Amazon EBS volume specifications attached to a cluster
-- instance.
newEbsConfiguration ::
  EbsConfiguration
newEbsConfiguration :: EbsConfiguration
newEbsConfiguration =
  EbsConfiguration' :: Maybe Bool -> Maybe [EbsBlockDeviceConfig] -> EbsConfiguration
EbsConfiguration'
    { $sel:ebsOptimized:EbsConfiguration' :: Maybe Bool
ebsOptimized = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:ebsBlockDeviceConfigs:EbsConfiguration' :: Maybe [EbsBlockDeviceConfig]
ebsBlockDeviceConfigs = Maybe [EbsBlockDeviceConfig]
forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates whether an Amazon EBS volume is EBS-optimized.
ebsConfiguration_ebsOptimized :: Lens.Lens' EbsConfiguration (Prelude.Maybe Prelude.Bool)
ebsConfiguration_ebsOptimized :: (Maybe Bool -> f (Maybe Bool))
-> EbsConfiguration -> f EbsConfiguration
ebsConfiguration_ebsOptimized = (EbsConfiguration -> Maybe Bool)
-> (EbsConfiguration -> Maybe Bool -> EbsConfiguration)
-> Lens EbsConfiguration EbsConfiguration (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EbsConfiguration' {Maybe Bool
ebsOptimized :: Maybe Bool
$sel:ebsOptimized:EbsConfiguration' :: EbsConfiguration -> Maybe Bool
ebsOptimized} -> Maybe Bool
ebsOptimized) (\s :: EbsConfiguration
s@EbsConfiguration' {} Maybe Bool
a -> EbsConfiguration
s {$sel:ebsOptimized:EbsConfiguration' :: Maybe Bool
ebsOptimized = Maybe Bool
a} :: EbsConfiguration)

-- | An array of Amazon EBS volume specifications attached to a cluster
-- instance.
ebsConfiguration_ebsBlockDeviceConfigs :: Lens.Lens' EbsConfiguration (Prelude.Maybe [EbsBlockDeviceConfig])
ebsConfiguration_ebsBlockDeviceConfigs :: (Maybe [EbsBlockDeviceConfig] -> f (Maybe [EbsBlockDeviceConfig]))
-> EbsConfiguration -> f EbsConfiguration
ebsConfiguration_ebsBlockDeviceConfigs = (EbsConfiguration -> Maybe [EbsBlockDeviceConfig])
-> (EbsConfiguration
    -> Maybe [EbsBlockDeviceConfig] -> EbsConfiguration)
-> Lens
     EbsConfiguration
     EbsConfiguration
     (Maybe [EbsBlockDeviceConfig])
     (Maybe [EbsBlockDeviceConfig])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EbsConfiguration' {Maybe [EbsBlockDeviceConfig]
ebsBlockDeviceConfigs :: Maybe [EbsBlockDeviceConfig]
$sel:ebsBlockDeviceConfigs:EbsConfiguration' :: EbsConfiguration -> Maybe [EbsBlockDeviceConfig]
ebsBlockDeviceConfigs} -> Maybe [EbsBlockDeviceConfig]
ebsBlockDeviceConfigs) (\s :: EbsConfiguration
s@EbsConfiguration' {} Maybe [EbsBlockDeviceConfig]
a -> EbsConfiguration
s {$sel:ebsBlockDeviceConfigs:EbsConfiguration' :: Maybe [EbsBlockDeviceConfig]
ebsBlockDeviceConfigs = Maybe [EbsBlockDeviceConfig]
a} :: EbsConfiguration) ((Maybe [EbsBlockDeviceConfig] -> f (Maybe [EbsBlockDeviceConfig]))
 -> EbsConfiguration -> f EbsConfiguration)
-> ((Maybe [EbsBlockDeviceConfig]
     -> f (Maybe [EbsBlockDeviceConfig]))
    -> Maybe [EbsBlockDeviceConfig]
    -> f (Maybe [EbsBlockDeviceConfig]))
-> (Maybe [EbsBlockDeviceConfig]
    -> f (Maybe [EbsBlockDeviceConfig]))
-> EbsConfiguration
-> f EbsConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [EbsBlockDeviceConfig]
  [EbsBlockDeviceConfig]
  [EbsBlockDeviceConfig]
  [EbsBlockDeviceConfig]
-> Iso
     (Maybe [EbsBlockDeviceConfig])
     (Maybe [EbsBlockDeviceConfig])
     (Maybe [EbsBlockDeviceConfig])
     (Maybe [EbsBlockDeviceConfig])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [EbsBlockDeviceConfig]
  [EbsBlockDeviceConfig]
  [EbsBlockDeviceConfig]
  [EbsBlockDeviceConfig]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable EbsConfiguration

instance Prelude.NFData EbsConfiguration

instance Core.ToJSON EbsConfiguration where
  toJSON :: EbsConfiguration -> Value
toJSON EbsConfiguration' {Maybe Bool
Maybe [EbsBlockDeviceConfig]
ebsBlockDeviceConfigs :: Maybe [EbsBlockDeviceConfig]
ebsOptimized :: Maybe Bool
$sel:ebsBlockDeviceConfigs:EbsConfiguration' :: EbsConfiguration -> Maybe [EbsBlockDeviceConfig]
$sel:ebsOptimized:EbsConfiguration' :: EbsConfiguration -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"EbsOptimized" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
ebsOptimized,
            (Text
"EbsBlockDeviceConfigs" Text -> [EbsBlockDeviceConfig] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([EbsBlockDeviceConfig] -> Pair)
-> Maybe [EbsBlockDeviceConfig] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [EbsBlockDeviceConfig]
ebsBlockDeviceConfigs
          ]
      )