更新时间:2024-01-04 GMT+08:00
分享

API概览

MRS提供的符合RESTful API的设计规范的接口,如表1表2所示。如何选择不同版本的接口请参见API版本选择建议

MRS版本演进过程中逐步废弃部分接口,具体请参见表3

表1 V2接口

接口

功能

API URI

集群管理接口

创建集群

POST /v2/{project_id}/clusters

修改集群名称

PUT /v2/{project_id}/clusters/{cluster_id}/cluster-name

创建集群并提交作业

POST /v2/{project_id}/run-job-flow

扩容集群

POST /v2/{project_id}/clusters/{cluster_id}/expand

缩容集群

POST /v2/{project_id}/clusters/{cluster_id}/shrink

集群添加组件

POST /v2/{project_id}/clusters/{cluster_id}/components

作业对象接口

新增并执行作业

POST /v2/{project_id}/clusters/{cluster_id}/job-executions

查询作业列表信息

GET /v2/{project_id}/clusters/{cluster_id}/job-executions

查询单个作业信息

GET /v2/{project_id}/clusters/{cluster_id}/job-executions/{job_execution_id}

终止作业

POST /v2/{project_id}/clusters/{cluster_id}/job-executions/{job_execution_id}/kill

获取SQL结果

GET /v2/{project_id}/clusters/{cluster_id}/job-executions/{job_execution_id}/sql-result

批量删除作业

POST /v2/{project_id}/clusters/{cluster_id}/job-executions/batch-delete

弹性伸缩接口

查看弹性伸缩策略

GET /v2/{project_id}/autoscaling-policy/{cluster_id}

更新弹性伸缩策略

PUT /v2/{project_id}/autoscaling-policy/{cluster_id}

删除弹性伸缩策略

DELETE /v2/{project_id}/autoscaling-policy/{cluster_id}

创建弹性伸缩策略

POST /v2/{project_id}/autoscaling-policy/{cluster_id}

集群HDFS文件接口

获取指定目录文件列表

GET /v2/{project_id}/clusters/{cluster_id}/files?path={directory}&offset={offset}&limit={limit}&sort_key={sort_key}&order={order}

SQL接口

提交SQL语句

POST /v2/{project_id}/clusters/{cluster_id}/sql-execution

查询SQL结果

GET /v2/{project_id}/clusters/{cluster_id}/sql-execution/{sql_id}

取消SQL执行任务

POST /v2/{project_id}/clusters/{cluster_id}/sql-execution/{sql_id}/cancel

委托管理(V2)

查询用户(组)与IAM委托的映射关系

GET /v2/{project_id}/clusters/{cluster_id}/agency-mapping

更新用户(组)与IAM委托的映射关系

PUT /v2/{project_id}/clusters/{cluster_id}/agency-mapping

数据连接管理

创建数据连接

POST /v2/{project_id}/data-connectors

查询数据连接列表

GET /v2/{project_id}/data-connectors

更新数据连接

PUT /v2/{project_id}/data-connectors/{connector_id}

删除数据连接

DELETE /v2/{project_id}/data-connectors/{connector_id}

版本元数据查询

展示MRS版本列表

GET /v2/{project_id}/metadata/versions

查询MRS集群版本可用的规格

GET /v2/{project_id}/metadata/version/{version_name}/available-flavor

IAM同步管理接口

获取已经同步的IAM用户和用户组

GET /v2/{project_id}/clusters/{cluster_id}/iam-sync-user

IAM同步

POST /v2/{project_id}/clusters/{cluster_id}/iam-sync-user

指定用户、用户组取消同步

DELETE /v2/{project_id}/clusters/{cluster_id}/iam-sync-user

标签管理接口

集群操作默认标签

POST /v2/{project_id}/clusters/{cluster_id}/tags/switch

查询默认标签状态

GET /v2/{project_id}/clusters/{cluster_id}/tags/status

查询标签配额

GET /v2/{project_id}/clusters/{cluster_id}/tags/quota

表2 V1.1接口

接口

功能

API URI

集群管理接口

创建集群并执行作业

POST /v1.1/{project_id}/run-job-flow

调整集群节点

PUT /v1.1/{project_id}/cluster_infos/{cluster_id}

查询集群列表

GET /v1.1/{project_id}/cluster_infos

查询集群详情

GET /v1.1/{project_id}/cluster_infos/{cluster_id}

查询主机列表

GET /v1.1/{project_id}/clusters/{cluster_id}/hosts

删除集群

DELETE /v1.1/{project_id}/clusters/{cluster_id}

弹性伸缩接口

配置弹性伸缩规则

POST /v1.1/{project_id}/autoscaling-policy/{cluster_id}

标签管理接口

给指定集群添加标签

POST /v1.1/{project_id}/clusters/{cluster_id}/tags

删除指定集群的标签

DELETE /v1.1/{project_id}/clusters/{cluster_id}/tags/{key}

查询指定集群的标签

GET /v1.1/{project_id}/clusters/{cluster_id}/tags

批量添加集群标签

POST /v1.1/{project_id}/clusters/{cluster_id}/tags/action

批量删除集群标签

POST /v1.1/{project_id}/clusters/{cluster_id}/tags/action

查询所有标签

GET /v1.1/{project_id}/clusters/tags

查询特定标签的集群列表

POST /v1.1/{project_id}/clusters/resource_instances/action

可用区

查询可用区信息

GET /v1.1/{region_id}/available-zones

版本元数据查询

查询对应版本元数据

GET /v1.1/{project_id}/metadata/versions/{version_name}

表3 历史API接口

接口

功能

API URI

V1.1 作业管理接口

新增作业并执行

POST /v1.1/{project_id}/jobs/submit-job

查询作业exe对象列表

GET /v1.1/{project_id}/job-exes

查询作业exe对象详情

GET /v1.1/{project_id}/job-exes/{job_exe_id}

删除作业执行对象

DELETE /v1.1/{project_id}/job-executions/{job_execution_id}

相关文档