
# 查询作业 - ShowJobs
#### 功能介绍
查询作业接口。
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-dataartsstudio/making_request.html)。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-dataartsstudio/abcd.html)。
- 如果使用身份策略授权，当前API调用无需身份策略权限。
 
#### URI
GET /v1.1/{project_id}/clusters/{cluster_id}/cdm/job/{job_name}
表1路径参数 
| 参数         | 是否必选 | 参数类型   | 描述                                                                                                    |
|:---|:---|:---|:---|
| project_id | 是    | String | 项目ID，获取方法请参见[项目ID和账号ID](https://support.huaweicloud.com/api-dataartsstudio/projectid_accountid.html)。 |
| cluster_id | 是    | String | 集群ID，获取方法请参见[获取集群列表](https://support.huaweicloud.com/api-dataartsstudio/ListClusters.html)。           |
| job_name   | 是    | String | 查询多个作业用all，查询单个作业输入作业名。                                                                               |
   
表2Query参数 
| 参数        | 是否必选 | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
|:---|:---|:---|:---|
| filter    | 否    | String  | 当"job_name"为"all"时，此参数用于模糊过滤作业。                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| page_no   | 否    | Integer | 指定作业页号。                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| page_size | 否    | Integer | 每页作业数，值在10-100之间。                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| jobType   | 否    | String  | 作业类型: - jobType=NORMAL_JOB：表示查询表/文件迁移的作业。   - jobType=BATCH_JOB：表示查询整库迁移的作业。   - 不指定该参数时，默认只查询表/文件迁移的作业。    |
   
#### 请求参数
表3请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                                                                                       |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | 用户Token，使用[Token认证](https://support.huaweicloud.com/api-dataartsstudio/dataartsstudio_02_0010.html)时必选。通过调用IAM服务的"获取用户Token"接口获取响应消息头中X-Subject-Token的值。 |
   
#### 响应参数
**状态码：200**
表4响应Body参数 
| 参数        | 参数类型                                            | 描述             |
|:---|:---|:---|
| total     | Integer                                         | 作业数，查询单个作业时为0。 |
| jobs      | Array of [Job] objects | 作业列表。          |
| page_no   | Integer                                         | 返回指定页号的作业。     |
| page_size | Integer                                         | 每页作业数。         |
   
 表5Job 
| 参数                   | 参数类型                                                    | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
|:---|:---|:---|
| job_type             | String                                                  | 作业类型： - NORMAL_JOB：表/文件迁移。   - BATCH_JOB：整库迁移。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| from-connector-name  | String                                                  | 源端连接类型，对应的连接参数如下： - generic-jdbc-connector：关系数据库连接。   - obs-connector：OBS连接。   - hdfs-connector：HDFS连接。   - hbase-connector：HBase连接、CloudTable连接。   - hive-connector：Hive连接。   - ftp-connector/sftp-connector：FTP/SFTP连接。   - mongodb-connector：MongoDB连接。   - redis-connector：Redis/DCS连接。   - kafka-connector：Kafka连接。   - dis-connector：DIS连接。   - elasticsearch-connector：Elasticsearch/云搜索服务连接。   - dli-connector：DLI连接。   - http-connector：HTTP/HTTPS连接，该连接暂无连接参数。   - dms-kafka-connector：DMS Kafka连接。     |
| to-config-values     | [ConfigValues] object | 目的连接参数配置。根据不同目的端有不同的参数配置，具体可参考[目的端作业参数说明](https://support.huaweicloud.com/api-dataartsstudio/destination_job_parameters.html)下相应的目的端参数配置。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| to-link-name         | String                                                  | 目的端连接名称，即为通过"创建连接"接口创建的连接对应的连接名。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| driver-config-values | [ConfigValues] object | 作业任务参数配置。例如配置作业失败重试、抽取并发数，具体可参考[作业任务参数说明](https://support.huaweicloud.com/api-dataartsstudio/job_parameter.html)。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| from-config-values   | [ConfigValues] object | 源连接参数配置。根据不同源端有不同的参数配置，具体可参考[源端作业参数说明](https://support.huaweicloud.com/api-dataartsstudio/source_job_parameters.html)下相应的源端参数配置。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| to-connector-name    | String                                                  | 目的端连接类型，对应的连接参数如下： - generic-jdbc-connector：关系数据库连接。   - obs-connector：OBS连接。   - hdfs-connector：HDFS连接。   - hbase-connector：HBase连接、CloudTable连接。   - hive-connector：Hive连接。   - ftp-connector/sftp-connector：FTP/SFTP连接。   - mongodb-connector：MongoDB连接。   - redis-connector：Redis/DCS连接。   - kafka-connector：Kafka连接。   - dis-connector：DIS连接。   - elasticsearch-connector：Elasticsearch/云搜索服务连接。   - dli-connector：DLI连接。   - http-connector：HTTP/HTTPS连接，该连接暂无连接参数。   - dms-kafka-connector：DMS Kafka连接。    |
| name                 | String                                                  | 作业名称，长度在1到240个字符之间。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| from-link-name       | String                                                  | 源连接名称，即为通过"创建连接"接口创建的连接对应的连接名。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| creation-user        | String                                                  | 创建作业的用户。由系统生成，用户无需填写。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| creation-date        | Long                                                    | 作业创建的时间，单位：毫秒。由系统生成，用户无需填写。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| update-date          | Long                                                    | 作业最后更新的时间，单位：毫秒。由系统生成，用户无需填写。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| is_incre_job         | Boolean                                                 | 是否是增量作业。已废弃。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| flag                 | Integer                                                 | 是否是定时作业标记，如果是定时作业则为1，否则为0。由系统根据定时任务配置生成，用户无需填写。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| files_read           | Integer                                                 | 已读文件数。由系统生成，用户无需填写。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| update-user          | String                                                  | 最后更新作业的用户。由系统生成，用户无需填写。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| external_id          | String                                                  | 具体执行的作业ID，如果是本地作业，则一般为"job_local1202051771_0002"形式，如果是DLI作业，则为DLI作业ID，比如"12345"。由系统生成，用户无需填写。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| type                 | String                                                  | 与job_type一致，作业类型： - NORMAL_JOB：表/文件迁移。   - BATCH_JOB：整库迁移。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| execute_start_date   | Long                                                    | 最近一次执行任务开始时间，单位：毫秒。由系统生成，用户无需填写。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| delete_rows          | Integer                                                 | 增量作业删除行数，已废弃。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| enabled              | Boolean                                                 | 是否激活连接。由系统生成，用户无需填写。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| bytes_written        | Long                                                    | 作业写入的字节。由系统生成，用户无需填写。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| id                   | Integer                                                 | 作业ID。由系统生成，用户无需填写。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| is_use_sql           | Boolean                                                 | 用户是否使用sql。由系统根据源端抽取是否使用sql语句生成，用户无需填写。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| update_rows          | Integer                                                 | 增量作业更新行数，已废弃。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| group_name           | String                                                  | 组名。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| bytes_read           | Long                                                    | 作业读取的字节。由系统生成，用户无需填写。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| execute_update_date  | Long                                                    | 最近一次执行任务更新时间，单位：毫秒。由系统生成，用户无需填写。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| write_rows           | Integer                                                 | 增量作业写入行数，已废弃。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| rows_written         | Integer                                                 | 作业写入的行数。由系统生成，用户无需填写。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| rows_read            | Long                                                    | 作业读取的行数。由系统生成，用户无需填写。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| files_written        | Integer                                                 | 写入文件数。由系统生成，用户无需填写。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| is_incrementing      | Boolean                                                 | 是否是增量作业，同is_incre_job，已废弃。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| execute_create_date  | Long                                                    | 最近一次执行任务创建时间，单位：毫秒。由系统生成，用户无需填写。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| status               | String                                                  | 作业最后的执行状态： - BOOTING：启动中。   - RUNNING：运行中。   - SUCCEEDED：成功。   - FAILED：失败。   - NEW：未被执行。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
   
 表6ConfigValues 
| 参数               | 参数类型                                                            | 描述                                                 |
|:---|:---|:---|
| configs          | Array of [configs] objects         | 源连接参数、目的连接参数和作业任务参数，它们的配置数据结构相同，其中"inputs"里的参数不一样。 |
| extended-configs | [extended-configs] object | 扩展配置。扩展配置暂不对外开放，用户无需填写。                            |
   
 表7configs 
| 参数     | 参数类型                                                | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
|:---|:---|:---|
| inputs | Array of [Input] objects | 输入参数列表，列表中的每个参数为"name,value"结构。在"from-config-values"数据结构中，不同的源连接类型有不同的"inputs"参数列表，请参见[源端作业参数说明](https://support.huaweicloud.com/api-dataartsstudio/source_job_parameters.html)下的章节。在"to-config-values"数据结构中，不同的目的连接类型有不同的"inputs"参数列表，请参见[目的端作业参数说明](https://support.huaweicloud.com/api-dataartsstudio/destination_job_parameters.html)下面的子章节。在"driver-config-values"数据结构中，"inputs"具体参数请参见[作业任务参数说明](https://support.huaweicloud.com/api-dataartsstudio/job_parameter.html)。 |
| name   | String                                              | 配置名称：源端作业的配置名称为"fromJobConfig"。目的端作业的配置名称为"toJobConfig"，连接的配置名称固定为"linkConfig"。                                                                                                                                                                                                                                                                                                                                                                                                |
| id     | Integer                                             | 配置ID，由系统生成，用户无需填写。                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| type   | String                                              | 配置类型，由系统生成，用户无需填写。值为LINK或者JOB，如果是连接管理API，则为LINK；如果是作业管理API，则为JOB。                                                                                                                                                                                                                                                                                                                                                                                                              |
   
 表8Input 
| 参数    | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
|:---|:---|:---|
| name  | String | 参数名: - 如果是连接管理API，则以"linkConfig."开头，对于不同连接类型有不同的参数，具体可参见[连接参数说明](https://support.huaweicloud.com/api-dataartsstudio/link_parameter.html)下相应连接的参数说明。   - 如果是作业管理API，对于源端连接参数，则以"fromJobConfig."开头，具体可参见[源端作业参数说明](https://support.huaweicloud.com/api-dataartsstudio/source_job_parameters.html)下相应的源端参数说明；对于目的端连接参数，则以"toJobConfig."开头，具体可参见[目的端作业参数说明](https://support.huaweicloud.com/api-dataartsstudio/destination_job_parameters.html)下相应的目的端参数说明；对于作业任务参数，请参见[作业任务参数说明](https://support.huaweicloud.com/api-dataartsstudio/job_parameter.html)下相应的任务参数说明。    |
| value | Object | 参数值，参数名对应的值，必须填写为字符串。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| type  | String | 值类型，如STRING、INTEGER，由系统设定，用户无需填写。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
   
 表9extended-configs 
| 参数    | 参数类型   | 描述                    |
|:---|:---|:---|
| name  | String | 扩展配置名称，暂不对外开放，用户无需填写。 |
| value | String | 扩展配置值，暂不对外开放，用户无需填写。  |
   
#### 请求示例
```
GET /v1.1/1551c7f6c808414d8e9f3c514a170f2e/clusters/6ec9a0a4-76be-4262-8697-e7af1fac7920/cdm/job/all?jobType=NORMAL_JOB
```
#### 响应示例
**状态码：200**
OK。
```
{
  "total" : 1,
  "jobs" : [ {
    "job_type" : "NORMAL_JOB",
    "from-connector-name" : "elasticsearch-connector",
    "to-config-values" : {
      "configs" : [ {
        "inputs" : [ {
          "name" : "toJobConfig.streamName",
          "value" : "dis-lkGm"
        }, {
          "name" : "toJobConfig.separator",
          "value" : "|"
        }, {
          "name" : "toJobConfig.columnList",
          "value" : "1&2&3"
        } ],
        "name" : "toJobConfig"
      } ]
    },
    "to-link-name" : "dis",
    "driver-config-values" : {
      "configs" : [ {
        "inputs" : [ {
          "name" : "throttlingConfig.numExtractors",
          "value" : "1"
        }, {
          "name" : "throttlingConfig.submitToCluster",
          "value" : "false"
        }, {
          "name" : "throttlingConfig.numLoaders",
          "value" : "1"
        }, {
          "name" : "throttlingConfig.recordDirtyData",
          "value" : "false"
        } ],
        "name" : "throttlingConfig"
      }, {
        "inputs" : [ ],
        "name" : "jarConfig"
      }, {
        "inputs" : [ {
          "name" : "schedulerConfig.isSchedulerJob",
          "value" : "false"
        }, {
          "name" : "schedulerConfig.disposableType",
          "value" : "NONE"
        } ],
        "name" : "schedulerConfig"
      }, {
        "inputs" : [ ],
        "name" : "transformConfig"
      }, {
        "inputs" : [ {
          "name" : "retryJobConfig.retryJobType",
          "value" : "NONE"
        } ],
        "name" : "retryJobConfig"
      } ]
    },
    "from-config-values" : {
      "configs" : [ {
        "inputs" : [ {
          "name" : "fromJobConfig.index",
          "value" : "52est"
        }, {
          "name" : "fromJobConfig.type",
          "value" : "est_array"
        }, {
          "name" : "fromJobConfig.columnList",
          "value" : "array_f1_int:long&array_f2_text:string&array_f3_object:nested"
        }, {
          "name" : "fromJobConfig.splitNestedField",
          "value" : "false"
        } ],
        "name" : "fromJobConfig"
      } ]
    },
    "to-connector-name" : "dis-connector",
    "name" : "es_css",
    "from-link-name" : "css"
  } ],
  "page_no" : 1,
  "page_size" : 10
}
```
#### SDK代码示例
SDK代码示例如下。
- [Java]
  ```
  package com.huaweicloud.sdk.test;
  import com.huaweicloud.sdk.core.auth.ICredential;
  import com.huaweicloud.sdk.core.auth.BasicCredentials;
  import com.huaweicloud.sdk.core.exception.ConnectionException;
  import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
  import com.huaweicloud.sdk.core.exception.ServiceResponseException;
  import com.huaweicloud.sdk.cdm.v1.region.CdmRegion;
  import com.huaweicloud.sdk.cdm.v1.*;
  import com.huaweicloud.sdk.cdm.v1.model.*;
  public class ShowJobsSolution {
      public static void main(String[] args) {
          // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
          // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
          String ak = System.getenv("CLOUD_SDK_AK");
          String sk = System.getenv("CLOUD_SDK_SK");
          String projectId = "{project_id}";
          ICredential auth = new BasicCredentials()
                  .withProjectId(projectId)
                  .withAk(ak)
                  .withSk(sk);
          CdmClient client = CdmClient.newBuilder()
                  .withCredential(auth)
                  .withRegion(CdmRegion.valueOf("<YOUR REGION>"))
                  .build();
          ShowJobsRequest request = new ShowJobsRequest();
          request.withClusterId("{cluster_id}");
          request.withJobName("{job_name}");
          try {
              ShowJobsResponse response = client.showJobs(request);
              System.out.println(response.toString());
          } catch (ConnectionException e) {
              e.printStackTrace();
          } catch (RequestTimeoutException e) {
              e.printStackTrace();
          } catch (ServiceResponseException e) {
              e.printStackTrace();
              System.out.println(e.getHttpStatusCode());
              System.out.println(e.getRequestId());
              System.out.println(e.getErrorCode());
              System.out.println(e.getErrorMsg());
          }
      }
  }
  ```
- [Python]
  ```
  # coding: utf-8
  import os
  from huaweicloudsdkcore.auth.credentials import BasicCredentials
  from huaweicloudsdkcdm.v1.region.cdm_region import CdmRegion
  from huaweicloudsdkcore.exceptions import exceptions
  from huaweicloudsdkcdm.v1 import *
  if __name__ == "__main__":
      # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
      # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
      ak = os.environ["CLOUD_SDK_AK"]
      sk = os.environ["CLOUD_SDK_SK"]
      projectId = "{project_id}"
      credentials = BasicCredentials(ak, sk, projectId)
      client = CdmClient.new_builder() \
          .with_credentials(credentials) \
          .with_region(CdmRegion.value_of("<YOUR REGION>")) \
          .build()
      try:
          request = ShowJobsRequest()
          request.cluster_id = "{cluster_id}"
          request.job_name = "{job_name}"
          response = client.show_jobs(request)
          print(response)
      except exceptions.ClientRequestException as e:
          print(e.status_code)
          print(e.request_id)
          print(e.error_code)
          print(e.error_msg)
  ```
- [Go]
  ```
  package main
  import (
  "fmt"
  "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
      cdm "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdm/v1"
  "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdm/v1/model"
      region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdm/v1/region"
  )
  func main() {
      // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
      // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
      ak := os.Getenv("CLOUD_SDK_AK")
      sk := os.Getenv("CLOUD_SDK_SK")
      projectId := "{project_id}"
      auth, err := basic.NewCredentialsBuilder().
          WithAk(ak).
          WithSk(sk).
          WithProjectId(projectId).
          SafeBuild()
      if err != nil {
          fmt.Println(err)
          return
      }
      hcClient, err := cdm.CdmClientBuilder().
           WithRegion(region.ValueOf("<YOUR REGION>")).
           WithCredential(auth).
           SafeBuild()
      if err != nil {
          fmt.Println(err)
          return
      }
      client := cdm.NewCdmClient(hcClient)
      request := &model.ShowJobsRequest{}
  request.ClusterId = "{cluster_id}"
  request.JobName = "{job_name}"
  response, err := client.ShowJobs(request)
  if err == nil {
          fmt.Printf("%+v\n", response)
      } else {
          fmt.Println(err)
      }
  }
  ```
- [更多]
  更多编程语言的SDK代码示例，请参见[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/CDM/sdk?api=ShowJobs)的代码示例页签，可生成自动对应的SDK代码示例。
#### 状态码
| 状态码 | 描述  |
|:---|:---|
| 200 | OK。 |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-dataartsstudio/ErrorCode.html)。
