class_docstr: Hook for AnalyticDB MySQL Spark through the REST API.
  
  :param adb_spark_conn_id: The Airflow connection used for AnalyticDB MySQL Spark credentials.
  :param region: AnalyticDB MySQL region you want to submit spark application.
class_docstr_tok: ["Hook","for","AnalyticDB","MySQL","Spark","through","the","REST","API",".",":","param","adb_spark_conn_id",":","The","Airflow","connection","used","for","AnalyticDB","MySQL","Spark","credentials",".",":","param","region",":","AnalyticDB","MySQL","region","you","want","to","submit","spark","application","."]
docstr: Get valid AnalyticDB MySQL Spark client.
docstr_tok: ["Get","valid","AnalyticDB","MySQL","Spark","client","."]
code: def get_adb_spark_client(self) -> Client:
      """Get valid AnalyticDB MySQL Spark client."""
      assert self.region is not None
  
      extra_config = self.adb_spark_conn.extra_dejson
      auth_type = extra_config.get("auth_type", None)
      if not auth_type:
          raise ValueError("No auth_type specified in extra_config.")
  
      if auth_type != "AK":
          raise ValueError(f"Unsupported auth_type: {auth_type}")
      adb_spark_access_key_id = extra_config.get("access_key_id", None)
      adb_spark_access_secret = extra_config.get(
          "access_key_secret", None
      )
      if not adb_spark_access_key_id:
          raise ValueError(
              f"No access_key_id is specified for connection: {self.adb_spark_conn_id}"
          )
  
      if not adb_spark_access_secret:
          raise ValueError(
              f"No access_key_secret is specified for connection: {self.adb_spark_conn_id}"
          )
  
      return Client(
          Config(
              access_key_id=adb_spark_access_key_id,
              access_key_secret=adb_spark_access_secret,
              endpoint=f"adb.{self.region}.aliyuncs.com",
          )
      )
  
imports: from __future__ import annotations
  import json
  from enum import Enum
  from typing import Any, Sequence
  from alibabacloud_adb20211201.client import Client
  from alibabacloud_adb20211201.models import GetSparkAppLogRequest, GetSparkAppStateRequest, GetSparkAppWebUiAddressRequest, KillSparkAppRequest, SubmitSparkAppRequest, SubmitSparkAppResponse
  from alibabacloud_tea_openapi.models import Config
  from airflow.exceptions import AirflowException
  from airflow.hooks.base import BaseHook
  from airflow.utils.log.logging_mixin import LoggingMixin
label_desc: Use image node_id 12 for calling the AnalyticDBSparkHook obj's underlying member method code with example usage: obj.get_adb_spark_client() and returns: Client