class_docstr: Creates sparkApplication object in kubernetes cluster.
  
  .. seealso::
      For more detail about Spark Application Object have a look at the reference:
      https://github.com/GoogleCloudPlatform/spark-on-k8s-operator/blob/v1beta2-1.3.3-3.1.1/docs/api-docs.md#sparkapplication
  
  :param application_file: filepath to kubernetes custom_resource_definition of sparkApplication
  :param kubernetes_conn_id: the connection to Kubernetes cluster
  :param image: Docker image you wish to launch. Defaults to hub.docker.com,
  :param code_path: path to the spark code in image,
  :param namespace: kubernetes namespace to put sparkApplication
  :param cluster_context: context of the cluster
  :param application_file: yaml file if passed
  :param get_logs: get the stdout of the container as logs of the tasks.
  :param do_xcom_push: If True, the content of the file
      /airflow/xcom/return.json in the container will also be pushed to an
      XCom when the container completes.
  :param success_run_history_limit: Number of past successful runs of the application to keep.
  :param delete_on_termination: What to do when the pod reaches its final
      state, or the execution is interrupted. If True (default), delete the
      pod; if False, leave the pod.
  :param startup_timeout_seconds: timeout in seconds to startup the pod.
  :param log_events_on_failure: Log the pod's events if a failure occurs
  :param reattach_on_restart: if the scheduler dies while the pod is running, reattach and monitor
class_docstr_tok: ["Creates","sparkApplication","object","in","kubernetes","cluster",".","..","seealso",":",":","For","more","detail","about","Spark","Application","Object","have","a","look","at","the","reference",":","https",":","\/\/github.com\/GoogleCloudPlatform\/spark-on-k8s-operator\/blob\/v1beta2-1.3.3-3.1.1\/docs\/api-docs.md","#","sparkapplication",":","param","application_file",":","filepath","to","kubernetes","custom_resource_definition","of","sparkApplication",":","param","kubernetes_conn_id",":","the","connection","to","Kubernetes","cluster",":","param","image",":","Docker","image","you","wish","to","launch",".","Defaults","to","hub.docker.com",",",":","param","code_path",":","path","to","the","spark","code","in","image",",",":","param","namespace",":","kubernetes","namespace","to","put","sparkApplication",":","param","cluster_context",":","context","of","the","cluster",":","param","application_file",":","yaml","file","if","passed",":","param","get_logs",":","get","the","stdout","of","the","container","as","logs","of","the","tasks",".",":","param","do_xcom_push",":","If","True",",","the","content","of","the","file","\/airflow\/xcom\/return.json","in","the","container","will","also","be","pushed","to","an","XCom","when","the","container","completes",".",":","param","success_run_history_limit",":","Number","of","past","successful","runs","of","the","application","to","keep",".",":","param","delete_on_termination",":","What","to","do","when","the","pod","reaches","its","final","state",",","or","the","execution","is","interrupted",".","If","True","(","default",")",",","delete","the","pod",";","if","False",",","leave","the","pod",".",":","param","startup_timeout_seconds",":","timeout","in","seconds","to","startup","the","pod",".",":","param","log_events_on_failure",":","Log","the","pod","'s","events","if","a","failure","occurs",":","param","reattach_on_restart",":","if","the","scheduler","dies","while","the","pod","is","running",",","reattach","and","monitor"]
code: def hook(self) -> KubernetesHook:
      hook = KubernetesHook(
          conn_id=self.kubernetes_conn_id,
          in_cluster=self.in_cluster
          or self.template_body.get("kubernetes", {}).get(
              "in_cluster", False
          ),
          config_file=self.config_file
          or self.template_body.get("kubernetes", {}).get(
              "kube_config_file", None
          ),
          cluster_context=self.cluster_context
          or self.template_body.get("kubernetes", {}).get(
              "cluster_context", None
          ),
      )
      return hook
  
imports: from __future__ import annotations
  import re
  from functools import cached_property
  from typing import TYPE_CHECKING, Any
  from kubernetes.client import CoreV1Api, CustomObjectsApi, models
  from airflow.exceptions import AirflowException
  from airflow.providers.cncf.kubernetes import pod_generator
  from airflow.providers.cncf.kubernetes.hooks.kubernetes import KubernetesHook, _load_body_to_dict
  from airflow.providers.cncf.kubernetes.operators.custom_object_launcher import CustomObjectLauncher
  from airflow.providers.cncf.kubernetes.operators.pod import KubernetesPodOperator
  from airflow.providers.cncf.kubernetes.pod_generator import MAX_LABEL_LEN, PodGenerator
  from airflow.providers.cncf.kubernetes.utils.pod_manager import PodManager
  from airflow.utils.helpers import prune_dict
label_desc: Use image node_id 12 for calling the SparkKubernetesOperator obj's underlying member method code with example usage: obj.hook() and returns: hook