{-# 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.Glue.Types.SessionCommand
-- 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.Glue.Types.SessionCommand 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 @SessionCommand@ that runs the job.
--
-- /See:/ 'newSessionCommand' smart constructor.
data SessionCommand = SessionCommand'
  { -- | Specifies the name of the SessionCommand. Can be \'glueetl\' or
    -- \'gluestreaming\'.
    SessionCommand -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Specifies the Python version. The Python version indicates the version
    -- supported for jobs of type Spark.
    SessionCommand -> Maybe Text
pythonVersion :: Prelude.Maybe Prelude.Text
  }
  deriving (SessionCommand -> SessionCommand -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SessionCommand -> SessionCommand -> Bool
$c/= :: SessionCommand -> SessionCommand -> Bool
== :: SessionCommand -> SessionCommand -> Bool
$c== :: SessionCommand -> SessionCommand -> Bool
Prelude.Eq, ReadPrec [SessionCommand]
ReadPrec SessionCommand
Int -> ReadS SessionCommand
ReadS [SessionCommand]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SessionCommand]
$creadListPrec :: ReadPrec [SessionCommand]
readPrec :: ReadPrec SessionCommand
$creadPrec :: ReadPrec SessionCommand
readList :: ReadS [SessionCommand]
$creadList :: ReadS [SessionCommand]
readsPrec :: Int -> ReadS SessionCommand
$creadsPrec :: Int -> ReadS SessionCommand
Prelude.Read, Int -> SessionCommand -> ShowS
[SessionCommand] -> ShowS
SessionCommand -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SessionCommand] -> ShowS
$cshowList :: [SessionCommand] -> ShowS
show :: SessionCommand -> String
$cshow :: SessionCommand -> String
showsPrec :: Int -> SessionCommand -> ShowS
$cshowsPrec :: Int -> SessionCommand -> ShowS
Prelude.Show, forall x. Rep SessionCommand x -> SessionCommand
forall x. SessionCommand -> Rep SessionCommand x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SessionCommand x -> SessionCommand
$cfrom :: forall x. SessionCommand -> Rep SessionCommand x
Prelude.Generic)

-- |
-- Create a value of 'SessionCommand' 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:
--
-- 'name', 'sessionCommand_name' - Specifies the name of the SessionCommand. Can be \'glueetl\' or
-- \'gluestreaming\'.
--
-- 'pythonVersion', 'sessionCommand_pythonVersion' - Specifies the Python version. The Python version indicates the version
-- supported for jobs of type Spark.
newSessionCommand ::
  SessionCommand
newSessionCommand :: SessionCommand
newSessionCommand =
  SessionCommand'
    { $sel:name:SessionCommand' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:pythonVersion:SessionCommand' :: Maybe Text
pythonVersion = forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the name of the SessionCommand. Can be \'glueetl\' or
-- \'gluestreaming\'.
sessionCommand_name :: Lens.Lens' SessionCommand (Prelude.Maybe Prelude.Text)
sessionCommand_name :: Lens' SessionCommand (Maybe Text)
sessionCommand_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SessionCommand' {Maybe Text
name :: Maybe Text
$sel:name:SessionCommand' :: SessionCommand -> Maybe Text
name} -> Maybe Text
name) (\s :: SessionCommand
s@SessionCommand' {} Maybe Text
a -> SessionCommand
s {$sel:name:SessionCommand' :: Maybe Text
name = Maybe Text
a} :: SessionCommand)

-- | Specifies the Python version. The Python version indicates the version
-- supported for jobs of type Spark.
sessionCommand_pythonVersion :: Lens.Lens' SessionCommand (Prelude.Maybe Prelude.Text)
sessionCommand_pythonVersion :: Lens' SessionCommand (Maybe Text)
sessionCommand_pythonVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SessionCommand' {Maybe Text
pythonVersion :: Maybe Text
$sel:pythonVersion:SessionCommand' :: SessionCommand -> Maybe Text
pythonVersion} -> Maybe Text
pythonVersion) (\s :: SessionCommand
s@SessionCommand' {} Maybe Text
a -> SessionCommand
s {$sel:pythonVersion:SessionCommand' :: Maybe Text
pythonVersion = Maybe Text
a} :: SessionCommand)

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

instance Prelude.Hashable SessionCommand where
  hashWithSalt :: Int -> SessionCommand -> Int
hashWithSalt Int
_salt SessionCommand' {Maybe Text
pythonVersion :: Maybe Text
name :: Maybe Text
$sel:pythonVersion:SessionCommand' :: SessionCommand -> Maybe Text
$sel:name:SessionCommand' :: SessionCommand -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
pythonVersion

instance Prelude.NFData SessionCommand where
  rnf :: SessionCommand -> ()
rnf SessionCommand' {Maybe Text
pythonVersion :: Maybe Text
name :: Maybe Text
$sel:pythonVersion:SessionCommand' :: SessionCommand -> Maybe Text
$sel:name:SessionCommand' :: SessionCommand -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
pythonVersion

instance Data.ToJSON SessionCommand where
  toJSON :: SessionCommand -> Value
toJSON SessionCommand' {Maybe Text
pythonVersion :: Maybe Text
name :: Maybe Text
$sel:pythonVersion:SessionCommand' :: SessionCommand -> Maybe Text
$sel:name:SessionCommand' :: SessionCommand -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Name" 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 Text
name,
            (Key
"PythonVersion" 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 Text
pythonVersion
          ]
      )