功能介绍
该接口用于查询并显示集群列表以及集群的状态。
URI
GET /v1.0/{project_id}/clusters
表5-13 参数说明
参数 是否为必选 类型 说明
project_id 是 String 项目编号。详细请参考获取项目ID/
账号ID。
start 否 Integer 指定查询起始值,默认值为1,即从 第1个集群开始查询。
limit 否 Integer 指定查询个数,默认值为10,即一 次查询10个集群信息。
请求消息
无。
响应消息
响应参数如表5-14所示。
表5-14 响应参数
参数 类型 说明
clusters Array of
clusters
objects集群对象列表。
表5-15 clusters 字段数据结构说明
参数 类型 说明
datastore Object 数据搜索引擎类型。详细请参考表
5-16。
instances Array of instance
objects 节点对象列表。
updated String 集群上次修改时间,格式为ISO8601:
CCYY-MM-DDThh:mm:ss。
name String 集群名称。
created String 集群创建时间,格式为ISO8601: CCYY-MM-DDThh:mm:ss。
说明
返回的集群列表信息按照创建时间降序排 序,即创建时间最新的集群排在最前。
id String 集群ID。
status String 查询返回值。
● 100:创建中。
● 200:可用。
● 303:不可用,如创建失败。
endpoint String 用户VPC访问IP地址和端口号。
actionProgress Object 集群行为进度,显示创建和扩容进度的 百分比。CREATING表示创建的百分 比。
actions Array of strings 集群当前行为,REBOOTING表示重 启,GROWING表示扩容,RESTORING 表示恢复集群,SNAPSHOTTING表示 创建快照。
failed_reasons Object 失败原因。如果集群处于正常状态,则 不返回该参数。详细请参考表5-18。
参数 类型 说明
authorityEnable String 是否开启认证,取值范围为true或 false。默认关闭认证功能。当开启认证 时,httpsEnable需要设置为true。
● true:表示集群开启认证。
● false:表示集群不开启认证。
vpcId String VPC ID。
subnetId String 子网ID。
securityGroupId String 安全组ID。
enterprise_project_
id String 集群所属的企业项目ID。
如果集群所属用户没有开通企业项目,
则不会返回该参数。
tags Array of tag
objects 集群标签。
表5-16 datastore 字段数据结构说明
参数 类型 说明
type String 支持类型:elasticsearch。
version String 引擎版本号。当前引擎版本为5.5.1、
6.2.3、6.5.4、7.1.1、7.6.2、7.9.3。
表5-17 instances 字段数据结构说明
参数 类型 说明
type String 支持类型:ess(Elasticsearch节点)。
id String 实例ID。
name String 实例名字。
status String 状态。
● 100:创建中。
● 200:可用。
● 303:不可用,如创建失败。
specCode String 节点规格名称。
azCode String 节点所属AZ信息。
表5-18 failed_reasons 字段数据结构说明
参数 类型 说明
error_code String 错误码。
● CSS.6000:表示集群创建失败。
● CSS.6001:表示集群扩容失败。
● CSS.6002:表示集群重启失败。
● CSS.6004:表示集群节点创建失败。
● CSS.6005:表示服务初始化失败。
error_msg String 详细错误信息。
表5-19 tags 字段数据结构说明
参数 类型 说明
key String 集群标签的key值。
value String 集群标签的value值。
示例
● 请求样例
– 查询请求样例,默认最多查询10个集群。
GET /v1.0/6204a5bd270343b5885144cf9c8c158d/clusters
– 分页查询请求样例
示例一:查询前2个集群。
方法1
GET /v1.0/6204a5bd270343b5885144cf9c8c158d/clusters?start=1&limit=2
方法2GET /v1.0/6204a5bd270343b5885144cf9c8c158d/clusters?limit=2
示例二:查询前10个集群。
方法1GET /v1.0/6204a5bd270343b5885144cf9c8c158d/clusters?start=1&limit=10
方法2GET /v1.0/6204a5bd270343b5885144cf9c8c158d/clusters?start=1
● 响应样例
{ "clusters": [ {
"datastore": {
"type": "elasticsearch", "version": "6.2.3"
},
"instances": [ {
"status": "200", "type": "ess",
"id": "a8922be2-5e41-4cd1-8486-630c04c2d1e3",
"name": "ES-new1-ess-esn-1-1"
} ],
"updated": "2017-11-27T10:36:18", "name": "ES-new1",
"created": "2017-11-27T10:36:18",
"id": "306e5597-d7a9-4cbe-866c-33428440d0e3", "status": "200",
"endpoint": "192.168.0.219:9200", "actionProgress": {
"CREATING": "5%"
},
"actions": [],
"enterprise_project_id":"3e1c74a0-86a0-40e9-bdc9-c6b9e46cf81b", "tags": []
"id": "9635de45-895c-45e1-ba0b-d9f497c8ce52", "name": "Es-Test1-ess-esn-1-1"
} ],
"updated": "2017-11-14T12:32:00", "name": "Es-Test1",
"created": "2017-11-14T12:32:00",
"id": "c99b1514-647e-4418-8b6d-2748255f2f95", "status": "200",
"endpoint": "192.168.0.127:9200", "actionProgress": {},
"actions": [ "REBOOTING"
],
"enterprise_project_id":"0", "tags": [
状态码 编码 状态码说明
404 NotFound 所请求的资源不存在。
建议直接修改该请求,不要重试该请求。
200 OK 请求已成功。