{-# 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.SparkSubmit
-- 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.SparkSubmit 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

-- | The configurations for the Spark submit job driver.
--
-- /See:/ 'newSparkSubmit' smart constructor.
data SparkSubmit = SparkSubmit'
  { -- | The arguments for the Spark submit job run.
    SparkSubmit -> Maybe [Sensitive Text]
entryPointArguments :: Prelude.Maybe [Data.Sensitive Prelude.Text],
    -- | The parameters for the Spark submit job run.
    SparkSubmit -> Maybe (Sensitive Text)
sparkSubmitParameters :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The entry point for the Spark submit job run.
    SparkSubmit -> Sensitive Text
entryPoint :: Data.Sensitive Prelude.Text
  }
  deriving (SparkSubmit -> SparkSubmit -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SparkSubmit -> SparkSubmit -> Bool
$c/= :: SparkSubmit -> SparkSubmit -> Bool
== :: SparkSubmit -> SparkSubmit -> Bool
$c== :: SparkSubmit -> SparkSubmit -> Bool
Prelude.Eq, Int -> SparkSubmit -> ShowS
[SparkSubmit] -> ShowS
SparkSubmit -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SparkSubmit] -> ShowS
$cshowList :: [SparkSubmit] -> ShowS
show :: SparkSubmit -> String
$cshow :: SparkSubmit -> String
showsPrec :: Int -> SparkSubmit -> ShowS
$cshowsPrec :: Int -> SparkSubmit -> ShowS
Prelude.Show, forall x. Rep SparkSubmit x -> SparkSubmit
forall x. SparkSubmit -> Rep SparkSubmit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SparkSubmit x -> SparkSubmit
$cfrom :: forall x. SparkSubmit -> Rep SparkSubmit x
Prelude.Generic)

-- |
-- Create a value of 'SparkSubmit' 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:
--
-- 'entryPointArguments', 'sparkSubmit_entryPointArguments' - The arguments for the Spark submit job run.
--
-- 'sparkSubmitParameters', 'sparkSubmit_sparkSubmitParameters' - The parameters for the Spark submit job run.
--
-- 'entryPoint', 'sparkSubmit_entryPoint' - The entry point for the Spark submit job run.
newSparkSubmit ::
  -- | 'entryPoint'
  Prelude.Text ->
  SparkSubmit
newSparkSubmit :: Text -> SparkSubmit
newSparkSubmit Text
pEntryPoint_ =
  SparkSubmit'
    { $sel:entryPointArguments:SparkSubmit' :: Maybe [Sensitive Text]
entryPointArguments = forall a. Maybe a
Prelude.Nothing,
      $sel:sparkSubmitParameters:SparkSubmit' :: Maybe (Sensitive Text)
sparkSubmitParameters = forall a. Maybe a
Prelude.Nothing,
      $sel:entryPoint:SparkSubmit' :: Sensitive Text
entryPoint = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pEntryPoint_
    }

-- | The arguments for the Spark submit job run.
sparkSubmit_entryPointArguments :: Lens.Lens' SparkSubmit (Prelude.Maybe [Prelude.Text])
sparkSubmit_entryPointArguments :: Lens' SparkSubmit (Maybe [Text])
sparkSubmit_entryPointArguments = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SparkSubmit' {Maybe [Sensitive Text]
entryPointArguments :: Maybe [Sensitive Text]
$sel:entryPointArguments:SparkSubmit' :: SparkSubmit -> Maybe [Sensitive Text]
entryPointArguments} -> Maybe [Sensitive Text]
entryPointArguments) (\s :: SparkSubmit
s@SparkSubmit' {} Maybe [Sensitive Text]
a -> SparkSubmit
s {$sel:entryPointArguments:SparkSubmit' :: Maybe [Sensitive Text]
entryPointArguments = Maybe [Sensitive Text]
a} :: SparkSubmit) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The parameters for the Spark submit job run.
sparkSubmit_sparkSubmitParameters :: Lens.Lens' SparkSubmit (Prelude.Maybe Prelude.Text)
sparkSubmit_sparkSubmitParameters :: Lens' SparkSubmit (Maybe Text)
sparkSubmit_sparkSubmitParameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SparkSubmit' {Maybe (Sensitive Text)
sparkSubmitParameters :: Maybe (Sensitive Text)
$sel:sparkSubmitParameters:SparkSubmit' :: SparkSubmit -> Maybe (Sensitive Text)
sparkSubmitParameters} -> Maybe (Sensitive Text)
sparkSubmitParameters) (\s :: SparkSubmit
s@SparkSubmit' {} Maybe (Sensitive Text)
a -> SparkSubmit
s {$sel:sparkSubmitParameters:SparkSubmit' :: Maybe (Sensitive Text)
sparkSubmitParameters = Maybe (Sensitive Text)
a} :: SparkSubmit) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The entry point for the Spark submit job run.
sparkSubmit_entryPoint :: Lens.Lens' SparkSubmit Prelude.Text
sparkSubmit_entryPoint :: Lens' SparkSubmit Text
sparkSubmit_entryPoint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SparkSubmit' {Sensitive Text
entryPoint :: Sensitive Text
$sel:entryPoint:SparkSubmit' :: SparkSubmit -> Sensitive Text
entryPoint} -> Sensitive Text
entryPoint) (\s :: SparkSubmit
s@SparkSubmit' {} Sensitive Text
a -> SparkSubmit
s {$sel:entryPoint:SparkSubmit' :: Sensitive Text
entryPoint = Sensitive Text
a} :: SparkSubmit) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive

instance Data.FromJSON SparkSubmit where
  parseJSON :: Value -> Parser SparkSubmit
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SparkSubmit"
      ( \Object
x ->
          Maybe [Sensitive Text]
-> Maybe (Sensitive Text) -> Sensitive Text -> SparkSubmit
SparkSubmit'
            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
"entryPointArguments"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"sparkSubmitParameters")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"entryPoint")
      )

instance Prelude.Hashable SparkSubmit where
  hashWithSalt :: Int -> SparkSubmit -> Int
hashWithSalt Int
_salt SparkSubmit' {Maybe [Sensitive Text]
Maybe (Sensitive Text)
Sensitive Text
entryPoint :: Sensitive Text
sparkSubmitParameters :: Maybe (Sensitive Text)
entryPointArguments :: Maybe [Sensitive Text]
$sel:entryPoint:SparkSubmit' :: SparkSubmit -> Sensitive Text
$sel:sparkSubmitParameters:SparkSubmit' :: SparkSubmit -> Maybe (Sensitive Text)
$sel:entryPointArguments:SparkSubmit' :: SparkSubmit -> Maybe [Sensitive Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Sensitive Text]
entryPointArguments
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
sparkSubmitParameters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
entryPoint

instance Prelude.NFData SparkSubmit where
  rnf :: SparkSubmit -> ()
rnf SparkSubmit' {Maybe [Sensitive Text]
Maybe (Sensitive Text)
Sensitive Text
entryPoint :: Sensitive Text
sparkSubmitParameters :: Maybe (Sensitive Text)
entryPointArguments :: Maybe [Sensitive Text]
$sel:entryPoint:SparkSubmit' :: SparkSubmit -> Sensitive Text
$sel:sparkSubmitParameters:SparkSubmit' :: SparkSubmit -> Maybe (Sensitive Text)
$sel:entryPointArguments:SparkSubmit' :: SparkSubmit -> Maybe [Sensitive Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Sensitive Text]
entryPointArguments
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
sparkSubmitParameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
entryPoint

instance Data.ToJSON SparkSubmit where
  toJSON :: SparkSubmit -> Value
toJSON SparkSubmit' {Maybe [Sensitive Text]
Maybe (Sensitive Text)
Sensitive Text
entryPoint :: Sensitive Text
sparkSubmitParameters :: Maybe (Sensitive Text)
entryPointArguments :: Maybe [Sensitive Text]
$sel:entryPoint:SparkSubmit' :: SparkSubmit -> Sensitive Text
$sel:sparkSubmitParameters:SparkSubmit' :: SparkSubmit -> Maybe (Sensitive Text)
$sel:entryPointArguments:SparkSubmit' :: SparkSubmit -> Maybe [Sensitive Text]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"entryPointArguments" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Sensitive Text]
entryPointArguments,
            (Key
"sparkSubmitParameters" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
sparkSubmitParameters,
            forall a. a -> Maybe a
Prelude.Just (Key
"entryPoint" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
entryPoint)
          ]
      )