{-# 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.EMRServerless.Types.WorkerTypeSpecification
-- 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.EMRServerless.Types.WorkerTypeSpecification where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EMRServerless.Types.ImageConfiguration
import qualified Amazonka.Prelude as Prelude

-- | The specifications for a worker type.
--
-- /See:/ 'newWorkerTypeSpecification' smart constructor.
data WorkerTypeSpecification = WorkerTypeSpecification'
  { -- | The image configuration for a worker type.
    WorkerTypeSpecification -> Maybe ImageConfiguration
imageConfiguration :: Prelude.Maybe ImageConfiguration
  }
  deriving (WorkerTypeSpecification -> WorkerTypeSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkerTypeSpecification -> WorkerTypeSpecification -> Bool
$c/= :: WorkerTypeSpecification -> WorkerTypeSpecification -> Bool
== :: WorkerTypeSpecification -> WorkerTypeSpecification -> Bool
$c== :: WorkerTypeSpecification -> WorkerTypeSpecification -> Bool
Prelude.Eq, ReadPrec [WorkerTypeSpecification]
ReadPrec WorkerTypeSpecification
Int -> ReadS WorkerTypeSpecification
ReadS [WorkerTypeSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkerTypeSpecification]
$creadListPrec :: ReadPrec [WorkerTypeSpecification]
readPrec :: ReadPrec WorkerTypeSpecification
$creadPrec :: ReadPrec WorkerTypeSpecification
readList :: ReadS [WorkerTypeSpecification]
$creadList :: ReadS [WorkerTypeSpecification]
readsPrec :: Int -> ReadS WorkerTypeSpecification
$creadsPrec :: Int -> ReadS WorkerTypeSpecification
Prelude.Read, Int -> WorkerTypeSpecification -> ShowS
[WorkerTypeSpecification] -> ShowS
WorkerTypeSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkerTypeSpecification] -> ShowS
$cshowList :: [WorkerTypeSpecification] -> ShowS
show :: WorkerTypeSpecification -> String
$cshow :: WorkerTypeSpecification -> String
showsPrec :: Int -> WorkerTypeSpecification -> ShowS
$cshowsPrec :: Int -> WorkerTypeSpecification -> ShowS
Prelude.Show, forall x. Rep WorkerTypeSpecification x -> WorkerTypeSpecification
forall x. WorkerTypeSpecification -> Rep WorkerTypeSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WorkerTypeSpecification x -> WorkerTypeSpecification
$cfrom :: forall x. WorkerTypeSpecification -> Rep WorkerTypeSpecification x
Prelude.Generic)

-- |
-- Create a value of 'WorkerTypeSpecification' 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:
--
-- 'imageConfiguration', 'workerTypeSpecification_imageConfiguration' - The image configuration for a worker type.
newWorkerTypeSpecification ::
  WorkerTypeSpecification
newWorkerTypeSpecification :: WorkerTypeSpecification
newWorkerTypeSpecification =
  WorkerTypeSpecification'
    { $sel:imageConfiguration:WorkerTypeSpecification' :: Maybe ImageConfiguration
imageConfiguration =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The image configuration for a worker type.
workerTypeSpecification_imageConfiguration :: Lens.Lens' WorkerTypeSpecification (Prelude.Maybe ImageConfiguration)
workerTypeSpecification_imageConfiguration :: Lens' WorkerTypeSpecification (Maybe ImageConfiguration)
workerTypeSpecification_imageConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkerTypeSpecification' {Maybe ImageConfiguration
imageConfiguration :: Maybe ImageConfiguration
$sel:imageConfiguration:WorkerTypeSpecification' :: WorkerTypeSpecification -> Maybe ImageConfiguration
imageConfiguration} -> Maybe ImageConfiguration
imageConfiguration) (\s :: WorkerTypeSpecification
s@WorkerTypeSpecification' {} Maybe ImageConfiguration
a -> WorkerTypeSpecification
s {$sel:imageConfiguration:WorkerTypeSpecification' :: Maybe ImageConfiguration
imageConfiguration = Maybe ImageConfiguration
a} :: WorkerTypeSpecification)

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

instance Prelude.Hashable WorkerTypeSpecification where
  hashWithSalt :: Int -> WorkerTypeSpecification -> Int
hashWithSalt Int
_salt WorkerTypeSpecification' {Maybe ImageConfiguration
imageConfiguration :: Maybe ImageConfiguration
$sel:imageConfiguration:WorkerTypeSpecification' :: WorkerTypeSpecification -> Maybe ImageConfiguration
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ImageConfiguration
imageConfiguration

instance Prelude.NFData WorkerTypeSpecification where
  rnf :: WorkerTypeSpecification -> ()
rnf WorkerTypeSpecification' {Maybe ImageConfiguration
imageConfiguration :: Maybe ImageConfiguration
$sel:imageConfiguration:WorkerTypeSpecification' :: WorkerTypeSpecification -> Maybe ImageConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ImageConfiguration
imageConfiguration