{-# 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.EMRContainers.Types.SparkSubmitJobDriver
-- 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.EMRContainers.Types.SparkSubmitJobDriver where

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

-- | The information about job driver for Spark submit.
--
-- /See:/ 'newSparkSubmitJobDriver' smart constructor.
data SparkSubmitJobDriver = SparkSubmitJobDriver'
  { -- | The Spark submit parameters that are used for job runs.
    SparkSubmitJobDriver -> Maybe (Sensitive Text)
sparkSubmitParameters :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The arguments for job application.
    SparkSubmitJobDriver -> Maybe [Sensitive Text]
entryPointArguments :: Prelude.Maybe [Core.Sensitive Prelude.Text],
    -- | The entry point of job application.
    SparkSubmitJobDriver -> Sensitive Text
entryPoint :: Core.Sensitive Prelude.Text
  }
  deriving (SparkSubmitJobDriver -> SparkSubmitJobDriver -> Bool
(SparkSubmitJobDriver -> SparkSubmitJobDriver -> Bool)
-> (SparkSubmitJobDriver -> SparkSubmitJobDriver -> Bool)
-> Eq SparkSubmitJobDriver
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SparkSubmitJobDriver -> SparkSubmitJobDriver -> Bool
$c/= :: SparkSubmitJobDriver -> SparkSubmitJobDriver -> Bool
== :: SparkSubmitJobDriver -> SparkSubmitJobDriver -> Bool
$c== :: SparkSubmitJobDriver -> SparkSubmitJobDriver -> Bool
Prelude.Eq, Int -> SparkSubmitJobDriver -> ShowS
[SparkSubmitJobDriver] -> ShowS
SparkSubmitJobDriver -> String
(Int -> SparkSubmitJobDriver -> ShowS)
-> (SparkSubmitJobDriver -> String)
-> ([SparkSubmitJobDriver] -> ShowS)
-> Show SparkSubmitJobDriver
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SparkSubmitJobDriver] -> ShowS
$cshowList :: [SparkSubmitJobDriver] -> ShowS
show :: SparkSubmitJobDriver -> String
$cshow :: SparkSubmitJobDriver -> String
showsPrec :: Int -> SparkSubmitJobDriver -> ShowS
$cshowsPrec :: Int -> SparkSubmitJobDriver -> ShowS
Prelude.Show, (forall x. SparkSubmitJobDriver -> Rep SparkSubmitJobDriver x)
-> (forall x. Rep SparkSubmitJobDriver x -> SparkSubmitJobDriver)
-> Generic SparkSubmitJobDriver
forall x. Rep SparkSubmitJobDriver x -> SparkSubmitJobDriver
forall x. SparkSubmitJobDriver -> Rep SparkSubmitJobDriver x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SparkSubmitJobDriver x -> SparkSubmitJobDriver
$cfrom :: forall x. SparkSubmitJobDriver -> Rep SparkSubmitJobDriver x
Prelude.Generic)

-- |
-- Create a value of 'SparkSubmitJobDriver' 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:
--
-- 'sparkSubmitParameters', 'sparkSubmitJobDriver_sparkSubmitParameters' - The Spark submit parameters that are used for job runs.
--
-- 'entryPointArguments', 'sparkSubmitJobDriver_entryPointArguments' - The arguments for job application.
--
-- 'entryPoint', 'sparkSubmitJobDriver_entryPoint' - The entry point of job application.
newSparkSubmitJobDriver ::
  -- | 'entryPoint'
  Prelude.Text ->
  SparkSubmitJobDriver
newSparkSubmitJobDriver :: Text -> SparkSubmitJobDriver
newSparkSubmitJobDriver Text
pEntryPoint_ =
  SparkSubmitJobDriver' :: Maybe (Sensitive Text)
-> Maybe [Sensitive Text] -> Sensitive Text -> SparkSubmitJobDriver
SparkSubmitJobDriver'
    { $sel:sparkSubmitParameters:SparkSubmitJobDriver' :: Maybe (Sensitive Text)
sparkSubmitParameters =
        Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:entryPointArguments:SparkSubmitJobDriver' :: Maybe [Sensitive Text]
entryPointArguments = Maybe [Sensitive Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:entryPoint:SparkSubmitJobDriver' :: Sensitive Text
entryPoint = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pEntryPoint_
    }

-- | The Spark submit parameters that are used for job runs.
sparkSubmitJobDriver_sparkSubmitParameters :: Lens.Lens' SparkSubmitJobDriver (Prelude.Maybe Prelude.Text)
sparkSubmitJobDriver_sparkSubmitParameters :: (Maybe Text -> f (Maybe Text))
-> SparkSubmitJobDriver -> f SparkSubmitJobDriver
sparkSubmitJobDriver_sparkSubmitParameters = (SparkSubmitJobDriver -> Maybe (Sensitive Text))
-> (SparkSubmitJobDriver
    -> Maybe (Sensitive Text) -> SparkSubmitJobDriver)
-> Lens
     SparkSubmitJobDriver
     SparkSubmitJobDriver
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SparkSubmitJobDriver' {Maybe (Sensitive Text)
sparkSubmitParameters :: Maybe (Sensitive Text)
$sel:sparkSubmitParameters:SparkSubmitJobDriver' :: SparkSubmitJobDriver -> Maybe (Sensitive Text)
sparkSubmitParameters} -> Maybe (Sensitive Text)
sparkSubmitParameters) (\s :: SparkSubmitJobDriver
s@SparkSubmitJobDriver' {} Maybe (Sensitive Text)
a -> SparkSubmitJobDriver
s {$sel:sparkSubmitParameters:SparkSubmitJobDriver' :: Maybe (Sensitive Text)
sparkSubmitParameters = Maybe (Sensitive Text)
a} :: SparkSubmitJobDriver) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> SparkSubmitJobDriver -> f SparkSubmitJobDriver)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> SparkSubmitJobDriver
-> f SparkSubmitJobDriver
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The arguments for job application.
sparkSubmitJobDriver_entryPointArguments :: Lens.Lens' SparkSubmitJobDriver (Prelude.Maybe [Prelude.Text])
sparkSubmitJobDriver_entryPointArguments :: (Maybe [Text] -> f (Maybe [Text]))
-> SparkSubmitJobDriver -> f SparkSubmitJobDriver
sparkSubmitJobDriver_entryPointArguments = (SparkSubmitJobDriver -> Maybe [Sensitive Text])
-> (SparkSubmitJobDriver
    -> Maybe [Sensitive Text] -> SparkSubmitJobDriver)
-> Lens
     SparkSubmitJobDriver
     SparkSubmitJobDriver
     (Maybe [Sensitive Text])
     (Maybe [Sensitive Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SparkSubmitJobDriver' {Maybe [Sensitive Text]
entryPointArguments :: Maybe [Sensitive Text]
$sel:entryPointArguments:SparkSubmitJobDriver' :: SparkSubmitJobDriver -> Maybe [Sensitive Text]
entryPointArguments} -> Maybe [Sensitive Text]
entryPointArguments) (\s :: SparkSubmitJobDriver
s@SparkSubmitJobDriver' {} Maybe [Sensitive Text]
a -> SparkSubmitJobDriver
s {$sel:entryPointArguments:SparkSubmitJobDriver' :: Maybe [Sensitive Text]
entryPointArguments = Maybe [Sensitive Text]
a} :: SparkSubmitJobDriver) ((Maybe [Sensitive Text] -> f (Maybe [Sensitive Text]))
 -> SparkSubmitJobDriver -> f SparkSubmitJobDriver)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Sensitive Text] -> f (Maybe [Sensitive Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> SparkSubmitJobDriver
-> f SparkSubmitJobDriver
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Sensitive Text] [Sensitive Text] [Text] [Text]
-> Iso
     (Maybe [Sensitive Text])
     (Maybe [Sensitive Text])
     (Maybe [Text])
     (Maybe [Text])
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 [Sensitive Text] [Sensitive Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The entry point of job application.
sparkSubmitJobDriver_entryPoint :: Lens.Lens' SparkSubmitJobDriver Prelude.Text
sparkSubmitJobDriver_entryPoint :: (Text -> f Text) -> SparkSubmitJobDriver -> f SparkSubmitJobDriver
sparkSubmitJobDriver_entryPoint = (SparkSubmitJobDriver -> Sensitive Text)
-> (SparkSubmitJobDriver -> Sensitive Text -> SparkSubmitJobDriver)
-> Lens
     SparkSubmitJobDriver
     SparkSubmitJobDriver
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SparkSubmitJobDriver' {Sensitive Text
entryPoint :: Sensitive Text
$sel:entryPoint:SparkSubmitJobDriver' :: SparkSubmitJobDriver -> Sensitive Text
entryPoint} -> Sensitive Text
entryPoint) (\s :: SparkSubmitJobDriver
s@SparkSubmitJobDriver' {} Sensitive Text
a -> SparkSubmitJobDriver
s {$sel:entryPoint:SparkSubmitJobDriver' :: Sensitive Text
entryPoint = Sensitive Text
a} :: SparkSubmitJobDriver) ((Sensitive Text -> f (Sensitive Text))
 -> SparkSubmitJobDriver -> f SparkSubmitJobDriver)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> SparkSubmitJobDriver
-> f SparkSubmitJobDriver
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance Core.FromJSON SparkSubmitJobDriver where
  parseJSON :: Value -> Parser SparkSubmitJobDriver
parseJSON =
    String
-> (Object -> Parser SparkSubmitJobDriver)
-> Value
-> Parser SparkSubmitJobDriver
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SparkSubmitJobDriver"
      ( \Object
x ->
          Maybe (Sensitive Text)
-> Maybe [Sensitive Text] -> Sensitive Text -> SparkSubmitJobDriver
SparkSubmitJobDriver'
            (Maybe (Sensitive Text)
 -> Maybe [Sensitive Text]
 -> Sensitive Text
 -> SparkSubmitJobDriver)
-> Parser (Maybe (Sensitive Text))
-> Parser
     (Maybe [Sensitive Text] -> Sensitive Text -> SparkSubmitJobDriver)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"sparkSubmitParameters")
            Parser
  (Maybe [Sensitive Text] -> Sensitive Text -> SparkSubmitJobDriver)
-> Parser (Maybe [Sensitive Text])
-> Parser (Sensitive Text -> SparkSubmitJobDriver)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Sensitive Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"entryPointArguments"
                            Parser (Maybe (Maybe [Sensitive Text]))
-> Maybe [Sensitive Text] -> Parser (Maybe [Sensitive Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Sensitive Text]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Sensitive Text -> SparkSubmitJobDriver)
-> Parser (Sensitive Text) -> Parser SparkSubmitJobDriver
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Sensitive Text)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"entryPoint")
      )

instance Prelude.Hashable SparkSubmitJobDriver

instance Prelude.NFData SparkSubmitJobDriver

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