文档目录

共享带宽相关接口

创建VPC共享带宽组(CreateVpcSharedQos)

API请求

URLs
POST zstack/v1/vips/sharedqos
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "sharedQos",
    "description": "sharedQos description",
    "vpcUuid": "65be8c77be7e3e548075ec8384b7784e",
    "l3NetworkUuid": "960b85b1e9933f198e342fd338badcf7",
    "bandwidth": 1048576
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"sharedQos","description":"sharedQos description","vpcUuid":"65be8c77be7e3e548075ec8384b7784e","l3NetworkUuid":"960b85b1e9933f198e342fd338badcf7","bandwidth":1048576}}' http://localhost:8080/zstack/v1/vips/sharedqos
参数列表
名字 类型 位置 描述 可选值 起始版本
description (可选) String body(包含在params结构中) 资源的详细描述 5.1.0
vpcUuid String body(包含在params结构中) 5.1.0
l3NetworkUuid String body(包含在params结构中) 三层网络UUID 5.1.0
bandwidth (可选) Long body(包含在params结构中) 5.1.0
resourceUuid (可选) String body(包含在params结构中) 资源UUID 5.1.0
tagUuids (可选) List body(包含在params结构中) 5.1.0
systemTags (可选) List body 系统标签 5.1.0
userTags (可选) List body 用户标签 5.1.0

API返回

返回示例
{
  "inventory": {
    "uuid": "c4e66289d5a03734b38492b4ca2fde64",
    "l3NetworkUuid": "ed1507b673f433cd8d3be4f652d621bd",
    "vpcUuid": "ed008a7099ef3137bf58b85232cbf804"
  }
}
名字 类型 描述 起始版本
success boolean 5.1.0
inventory VpcSharedQosInventory 详情参考inventory 5.1.0
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 5.1.0
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 5.1.0
name String 资源名称 5.1.0
description String 资源的详细描述 5.1.0
l3NetworkUuid String 三层网络UUID 5.1.0
vpcUuid String 5.1.0
bandwidth Long 5.1.0
createDate Timestamp 创建时间 5.1.0
lastOpDate Timestamp 最后一次修改时间 5.1.0
vips List 详情参考vips 5.1.0
#vips
名字 类型 描述 起始版本
id Long 5.1.0
sharedQosUuid String 5.1.0
vipUuid String VIP UUID 5.1.0
createDate Timestamp 创建时间 5.1.0
lastOpDate Timestamp 最后一次修改时间 5.1.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 5.1.0
description String 错误的概要描述 5.1.0
details String 错误的详细信息 5.1.0
elaboration String 保留字段,默认为null 5.1.0
opaque LinkedHashMap 保留字段,默认为null 5.1.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 5.1.0

SDK示例

Java SDK
CreateVpcSharedQosAction action = new CreateVpcSharedQosAction();
action.name = "sharedQos";
action.description = "sharedQos description";
action.vpcUuid = "65be8c77be7e3e548075ec8384b7784e";
action.l3NetworkUuid = "960b85b1e9933f198e342fd338badcf7";
action.bandwidth = 1048576;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateVpcSharedQosAction.Result res = action.call();
Python SDK
CreateVpcSharedQosAction action = CreateVpcSharedQosAction()
action.name = "sharedQos"
action.description = "sharedQos description"
action.vpcUuid = "65be8c77be7e3e548075ec8384b7784e"
action.l3NetworkUuid = "960b85b1e9933f198e342fd338badcf7"
action.bandwidth = 1048576
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateVpcSharedQosAction.Result res = action.call()

删除VPC共享带宽组(DeleteVpcSharedQos)

API请求

URLs
DELETE zstack/v1/vips/sharedqos/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/vips/sharedqos/ce4a4da17366304baa95bd30dbbee4be
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 5.1.0
deleteMode (可选) String body 删除模式
  • Permissive / Enforcing
  • Permissive
5.1.0
systemTags (可选) List body 系统标签 5.1.0
userTags (可选) List body 用户标签 5.1.0

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK示例

Java SDK
DeleteVpcSharedQosAction action = new DeleteVpcSharedQosAction();
action.uuid = "ce4a4da17366304baa95bd30dbbee4be";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteVpcSharedQosAction.Result res = action.call();
Python SDK
DeleteVpcSharedQosAction action = DeleteVpcSharedQosAction()
action.uuid = "ce4a4da17366304baa95bd30dbbee4be"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteVpcSharedQosAction.Result res = action.call()

查询VPC共享带宽组(QueryVpcSharedQos)

API请求

URLs
GET zstack/v1/vips/sharedqos
GET zstack/v1/vips/sharedqos/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vips/sharedqos?q=uuid=b15a3578c3933804bece500f809ebdcc
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vips/sharedqos/862a52a400c23d5cbccef438c957a5f8
可查询字段
Note: 运行CLI命令行工具,输入QueryVpcSharedQos并按Tab键查看所有可查询字段以及可跨表查询的资源名。

API返回

返回示例
{
  "inventories": [
    {
      "uuid": "f7f905bb22ca3c7fbb3f683737718289",
      "name": "shared-qos-name",
      "description": "description",
      "l3NetworkUuid": "06ce8adcb1ff3f05803aeaa47765b088",
      "vpcUuid": "f3de6c11b69038f194708d0e70ed7774",
      "bandwidth": 1000,
      "createDate": "Apr 16, 2024 6:06:18 PM",
      "lastOpDate": "Apr 16, 2024 6:06:18 PM"
    }
  ]
}
名字 类型 描述 起始版本
success boolean 5.1.0
inventories List 详情参考inventories 5.1.0
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 5.1.0
#inventories
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 5.1.0
name String 资源名称 5.1.0
description String 资源的详细描述 5.1.0
l3NetworkUuid String 三层网络UUID 5.1.0
vpcUuid String 5.1.0
bandwidth Long 5.1.0
createDate Timestamp 创建时间 5.1.0
lastOpDate Timestamp 最后一次修改时间 5.1.0
vips List 详情参考vips 5.1.0
#vips
名字 类型 描述 起始版本
id Long 5.1.0
sharedQosUuid String 5.1.0
vipUuid String VIP UUID 5.1.0
createDate Timestamp 创建时间 5.1.0
lastOpDate Timestamp 最后一次修改时间 5.1.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 5.1.0
description String 错误的概要描述 5.1.0
details String 错误的详细信息 5.1.0
elaboration String 保留字段,默认为null 5.1.0
opaque LinkedHashMap 保留字段,默认为null 5.1.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 5.1.0

SDK示例

Java SDK
QueryVpcSharedQosAction action = new QueryVpcSharedQosAction();
action.conditions = asList("uuid=777d07580d263f95a881ad8523c42806");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryVpcSharedQosAction.Result res = action.call();
Python SDK
QueryVpcSharedQosAction action = QueryVpcSharedQosAction()
action.conditions = ["uuid=0b5a3b10bab03322a30cbbbcff00a17c"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryVpcSharedQosAction.Result res = action.call()

修改VPC共享带宽组带宽(ChangeVpcSharedQos)

API请求

URLs
POST zstack/v1/vips/sharedqos/{sharedQosUuid}/bandwidth/actions
Headers
Authorization: OAuth the-session-uuid
body
{
  "params": {
    "bandwidth": 2097152
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"bandwidth":2097152}}' http://localhost:8080/zstack/v1/vips/sharedqos/221cb152078d30fca39190556ceec683/bandwidth/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
sharedQosUuid String url 5.1.0
bandwidth Long body(包含在params结构中) 5.1.0
systemTags (可选) List body 系统标签 5.1.0
userTags (可选) List body 用户标签 5.1.0

API返回

返回示例
{
  "inventory": {
    "uuid": "2286509f52943894bf33f6aa917ffc29",
    "l3NetworkUuid": "2ceb65d30e7e3deab7db9355e7dee0dd",
    "vpcUuid": "6ab0048c38103fbe9efc8eb8f8ff5bbf"
  }
}
名字 类型 描述 起始版本
success boolean 5.1.0
inventory VpcSharedQosInventory 详情参考inventory 5.1.0
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 5.1.0
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 5.1.0
name String 资源名称 5.1.0
description String 资源的详细描述 5.1.0
l3NetworkUuid String 三层网络UUID 5.1.0
vpcUuid String 5.1.0
bandwidth Long 5.1.0
createDate Timestamp 创建时间 5.1.0
lastOpDate Timestamp 最后一次修改时间 5.1.0
vips List 详情参考vips 5.1.0
#vips
名字 类型 描述 起始版本
id Long 5.1.0
sharedQosUuid String 5.1.0
vipUuid String VIP UUID 5.1.0
createDate Timestamp 创建时间 5.1.0
lastOpDate Timestamp 最后一次修改时间 5.1.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 5.1.0
description String 错误的概要描述 5.1.0
details String 错误的详细信息 5.1.0
elaboration String 保留字段,默认为null 5.1.0
opaque LinkedHashMap 保留字段,默认为null 5.1.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 5.1.0

SDK示例

Java SDK
ChangeVpcSharedQosBandwidthAction action = new ChangeVpcSharedQosBandwidthAction();
action.sharedQosUuid = "221cb152078d30fca39190556ceec683";
action.bandwidth = 2097152;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeVpcSharedQosBandwidthAction.Result res = action.call();
Python SDK
ChangeVpcSharedQosBandwidthAction action = ChangeVpcSharedQosBandwidthAction()
action.sharedQosUuid = "221cb152078d30fca39190556ceec683"
action.bandwidth = 2097152
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeVpcSharedQosBandwidthAction.Result res = action.call()

更新VPC共享带宽组(UpdateVpcSharedQos)

API请求

URLs
PUT zstack/v1/vips/sharedqos/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
body
{
  "updateVpcSharedQos": {
    "name": "Updated Shared QoS",
    "description": "This is an updated description for the Shared QoS."
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateVpcSharedQos":{"name":"Updated Shared QoS","description":"This is an updated description for the Shared QoS."}}' http://localhost:8080zstack/v1/vips/sharedqos/ab6601fa1df73c05a562fcde20f889ce/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 5.1.0
name String body(包含在updateVpcSharedQos结构中) 资源名称 5.1.0
description (可选) String body(包含在updateVpcSharedQos结构中) 资源的详细描述 5.1.0
systemTags (可选) List body 系统标签 5.1.0
userTags (可选) List body 用户标签 5.1.0

API返回

返回示例
{
  "inventory": {
    "uuid": "979cefee9f9d334c881c4329756517a5",
    "l3NetworkUuid": "3e8164ec051030dfadfd1046e6042745",
    "vpcUuid": "7895911a13203a00ba5cec0362bc199f"
  }
}
名字 类型 描述 起始版本
success boolean 5.1.0
inventory VpcSharedQosInventory 详情参考inventory 5.1.0
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 5.1.0
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 5.1.0
name String 资源名称 5.1.0
description String 资源的详细描述 5.1.0
l3NetworkUuid String 三层网络UUID 5.1.0
vpcUuid String 5.1.0
bandwidth Long 5.1.0
createDate Timestamp 创建时间 5.1.0
lastOpDate Timestamp 最后一次修改时间 5.1.0
vips List 详情参考vips 5.1.0
#vips
名字 类型 描述 起始版本
id Long 5.1.0
sharedQosUuid String 5.1.0
vipUuid String VIP UUID 5.1.0
createDate Timestamp 创建时间 5.1.0
lastOpDate Timestamp 最后一次修改时间 5.1.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 5.1.0
description String 错误的概要描述 5.1.0
details String 错误的详细信息 5.1.0
elaboration String 保留字段,默认为null 5.1.0
opaque LinkedHashMap 保留字段,默认为null 5.1.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 5.1.0

SDK示例

Java SDK
UpdateVpcSharedQosAction action = new UpdateVpcSharedQosAction();
action.uuid = "ab6601fa1df73c05a562fcde20f889ce";
action.name = "Updated Shared QoS";
action.description = "This is an updated description for the Shared QoS.";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateVpcSharedQosAction.Result res = action.call();
Python SDK
UpdateVpcSharedQosAction action = UpdateVpcSharedQosAction()
action.uuid = "ab6601fa1df73c05a562fcde20f889ce"
action.name = "Updated Shared QoS"
action.description = "This is an updated description for the Shared QoS."
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateVpcSharedQosAction.Result res = action.call()

从VPC共享带宽组加载VIP(AttachVipToVpcSharedQos)

API请求

URLs
POST zstack/v1/vips/sharedqos/{sharedQosUuid}/vips
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "vipLists": [
      "175767a19c2d376183863dee3408b1f6"
    ]
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
url -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"vipLists":["175767a19c2d376183863dee3408b1f6"]}}' http://localhost:8080/zstack/v1/vips/sharedqos/d4559c8d9f76391b9d8eb30f74698949/vips
参数列表
名字 类型 位置 描述 可选值 起始版本
sharedQosUuid String url 5.1.0
vipLists List body(包含在params结构中) 5.1.0
systemTags (可选) List body 系统标签 5.1.0
userTags (可选) List body 用户标签 5.1.0

API返回

返回示例
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK示例

Java SDK
AttachVipToVpcSharedQosAction action = new AttachVipToVpcSharedQosAction();
action.sharedQosUuid = "d4559c8d9f76391b9d8eb30f74698949";
action.vipLists = asList("175767a19c2d376183863dee3408b1f6");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachVipToVpcSharedQosAction.Result res = action.call();
Python SDK
AttachVipToVpcSharedQosAction action = AttachVipToVpcSharedQosAction()
action.sharedQosUuid = "d4559c8d9f76391b9d8eb30f74698949"
action.vipLists = [175767a19c2d376183863dee3408b1f6]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AttachVipToVpcSharedQosAction.Result res = action.call()

从VPC共享带宽组卸载VIP(DetachVipFromVpcSharedQos)

API请求

URLs
POST zstack/v1/vips/sharedqos/{sharedQosUuid}/vips
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/vips/sharedqos/85800cac6a5f36c89867c24c73001f10/vips?
参数列表
名字 类型 位置 描述 可选值 起始版本
sharedQosUuid String url 5.1.0
vipLists List body 5.1.0
systemTags (可选) List body 系统标签 5.1.0
userTags (可选) List body 用户标签 5.1.0

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK示例

Java SDK
DetachVipFromVpcSharedQosAction action = new DetachVipFromVpcSharedQosAction();
action.sharedQosUuid = "85800cac6a5f36c89867c24c73001f10";
action.vipLists = asList("3358e3d0355b3b498ed4d80e7e40d6b3");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachVipFromVpcSharedQosAction.Result res = action.call();
Python SDK
DetachVipFromVpcSharedQosAction action = DetachVipFromVpcSharedQosAction()
action.sharedQosUuid = "85800cac6a5f36c89867c24c73001f10"
action.vipLists = [3358e3d0355b3b498ed4d80e7e40d6b3]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DetachVipFromVpcSharedQosAction.Result res = action.call()
开发手册 | 5.5.30 | ZStack Cloud · ZCF | ZStack 资源中心