云服务器内容精选

  • 请求参数 表2 请求参数 名称 是否必选 参数类型 说明 routetable 是 routetable object 路由表对象,参见表3。 表3 routetable字段说明 名称 是否必选 参数类型 说明 subnets 是 subnet object 功能说明:路由表所关联的子网。 约束:只能关联路由表所属vpc下的子网 表4 subnet字段说明 名称 是否必选 参数类型 说明 associate 否 Array of strings 路由表关联子网ID列表 disassociate 否 Array of strings 路由表解除关联子网ID列表
  • 请求示例 关联路由表3d42a0d4-a980-4613-ae76-a2cddecff054和子网1a8b8c98-3976-401b-a735-8b058109268c。 POST https://{Endpoint}/v1/6fbe9263116a4b68818cf1edce16bc4f/routetables/3d42a0d4-a980-4613-ae76-a2cddecff054/action { "routetable": { "subnets": { "associate": [ "1a8b8c98-3976-401b-a735-8b058109268c" ] } } }
  • 响应示例 { "routetable": { "id": "3d42a0d4-a980-4613-ae76-a2cddecff054", "vpc_id": "ab78be2d-782f-42a5-aa72-35879f6890ff", "description": "abc", "routes": [ { "type": "ecs", "destination": "10.10.10.0/24", "nexthop": "7c50463d-d36c-4417-aa85-cc11fa10f341", "description": "abc" } ], "subnets": [ { "id": "8d4ce32f-d68a-4c4c-9f18-c68d8a5c7f2f" } ], "tenant_id": "6fbe9263116a4b68818cf1edce16bc4f", "created_at": "2022-12-15T02:56:40", "updated_at": "2022-12-15T03:05:10" } }
  • 响应示例 { "vpcs": [ { "id": "13551d6b-755d-4757-b956-536f674975c0", "name": "default", "description": "test", "cidr": "172.16.0.0/16", "status": "OK", "enterprise_project_id": "0", "routes": [], "tenant_id": "087679f0aa80d32a2f4ec0172f5e902b", "created_at": "2022-12-15T02:11:13", "updated_at": "2022-12-15T02:11:13" }, { "id": "3ec3b33f-ac1c-4630-ad1c-7dba1ed79d85", "name": "222", "description": "test", "cidr": "192.168.0.0/16", "status": "OK", "enterprise_project_id": "0635d733-c12d-4308-ba5a-4dc27ec21038", "routes": [], "tenant_id": "087679f0aa80d32a2f4ec0172f5e902b", "created_at": "2022-12-15T04:01:21", "updated_at": "2022-12-15T04:01:21" }, { "id": "99d9d709-8478-4b46-9f3f-2206b1023fd3", "name": "vpc", "description": "test", "cidr": "192.168.0.0/16", "status": "OK", "enterprise_project_id": "0", "routes": [], "enable_shared_snat": false, "tenant_id": "087679f0aa80d32a2f4ec0172f5e902b", "created_at": "2022-12-15T05:36:29", "updated_at": "2022-12-15T05:36:29" } ] }
  • URI GET /v1/{project_id}/vpcs 样例: GET https://{Endpoint}/v1/{project_id}/vpcs?limit=10&marker=13551d6b-755d-4757-b956-536f674975c0 参数说明请参见表1。 表1 参数说明 名称 是否必选 参数类型 说明 project_id 是 String 项目ID,获取项目ID请参见获取项目ID。 id 否 String 按照VPC ID过滤查询。 marker 否 String 分页查询的起始资源ID,表示从指定资源的下一条记录开始查询。 marker需要和limit配合使用: 若不传入marker和limit参数,查询结果返回第一页全部资源记录。 若不传入marker参数,limit为10,查询结果返回第1~10条资源记录。 若marker为第10条记录的资源ID,limit为10,查询结果返回第11~20条资源记录。 若marker为第10条记录的资源ID,不传入limit参数,查询结果返回第11条及之后的所有资源记录。 limit 否 Integer 分页查询每页返回的记录个数,取值范围为0~intmax(2^31-1),默认值2000。 limit需要和marker配合使用,详细规则请见marker的参数说明。 enterprise_project_id 否 String 功能说明:按照企业项目ID过滤查询,可以使用该字段过滤某个企业项目下的虚拟私有云。 取值范围:最大长度36字节,带“-”连字符的UUID格式,或者是字符串“0”。“0”表示默认企业项目。若需要查询当前用户所有企业项目绑定的虚拟私有云,请传参all_granted_eps。 说明: 关于企业项目ID的获取及企业项目特性的详细信息,请参见《企业管理用户指南》。
  • URI GET /v3/{project_id}/vpc/vpcs 表1 参数说明 名称 是否必选 参数类型 说明 project_id 是 String 项目ID。 获取方法请参见获取项目ID。 表2 Query参数 参数 是否必选 参数类型 描述 limit 否 Integer 功能说明:每页返回的个数 取值范围:0-2000 marker 否 String 分页查询起始的资源ID,为空时查询第一页。 id 否 Array of strings VPC资源ID。可以使用该字段过滤VPC。 name 否 Array of strings VPC的name信息,可以使用该字段过滤VPC。 description 否 Array of strings VPC的描述信息。可以使用该字段过滤VPC。 cidr 否 Array of strings VPC的CIDR。可以使用该字段过滤VPC。
  • 请求示例 查询VPC列表 GET https://{Endpoint}/v3/{project_id}/vpc/vpcs 使用ID过滤查询VPC列表 GET https://{Endpoint}/v3/{project_id}/vpc/vpcs?id=01ab4be1-4447-45fb-94be-3ee787ed4ebe&id=02cd5ef2-4447-36fb-75be-3ee787ed6adf 使用name过滤查询VPC列表 GET https://{Endpoint}/v3/{project_id}/vpc/vpcs?name=vpc-test 分页查询VPC列表 GET https://{Endpoint}/v3/{project_id}/vpc/vpcs?limit=2&marker=01ab4be1-4447-45fb-94be-3ee787ed4ebe
  • 响应示例 { "request_id": "9c1838ba498249547be43dd618b58d27", "vpcs": [ { "id": "01da5a65-0bb9-4638-8ab7-74c64e24a9a7", "name": "API-PERF-TEST-14bd44c121", "description": "", "cidr": "192.168.0.0/16", "extend_cidrs": [ ], "status": "ACTIVE", "project_id": "087679f0aa80d32a2f4ec0172f5e902b", "enterprise_project_id": "0", "tags": [ ], "created_at": "2020-06-16T02:32:18Z", "updated_at": "2020-06-16T02:32:18Z", "cloud_resources": [ { "resource_type": "routetable", "resource_count": 1 }, { "resource_type": "virsubnet", "resource_count": 0 } ] }, { "id": "43fd79b0-f7d7-4e9b-828b-2d4d7bfae428", "name": "API-PERF-TEST_m2n33", "description": "", "cidr": "192.168.0.0/16", "extend_cidrs": [ ], "status": "ACTIVE", "project_id": "087679f0aa80d32a2f4ec0172f5e902b", "enterprise_project_id": "0", "tags": [ ], "created_at": "2020-06-15T06:29:40Z", "updated_at": "2020-06-15T06:29:41Z", "cloud_resources": [ { "resource_type": "routetable", "resource_count": 1 }, { "resource_type": "virsubnet", "resource_count": 1 } ] }, { "id": "5ed053ba-b46c-4dce-a1ae-e9d8a7015f21", "name": "API-PERF-TEST-c34b1c4b12", "description": "", "cidr": "192.168.0.0/16", "extend_cidrs": [ ], "status": "ACTIVE", "project_id": "087679f0aa80d32a2f4ec0172f5e902b", "enterprise_project_id": "0", "tags": [ ], "created_at": "2020-06-16T02:32:33Z", "updated_at": "2020-06-16T02:32:33Z", "cloud_resources": [ { "resource_type": "routetable", "resource_count": 1 }, { "resource_type": "virsubnet", "resource_count": 0 } ] } ], "page_info": { "previous_marker": "01da5a65-0bb9-4638-8ab7-74c64e24a9a7", "current_count": 3 } }
  • 请求示例 创建辅助弹性网卡,虚拟子网id为08278e6c-61ca-46c1-9fc3-0d4f6c12f193,宿主网络接口id为637748df-2986-4350-8303-95d259580fb3,关联安全组6727c950-9f01-47a2-a7aa-7d3686c4c95b。 POST https://{Endpoint}/v3/8c6fb137a48a428aaf9a0229dca4edb3/vpc/sub-network-interfaces { "sub_network_interface" : { "virsubnet_id" : "08278e6c-61ca-46c1-9fc3-0d4f6c12f193", "parent_id" : "637748df-2986-4350-8303-95d259580fb3", "security_groups" : [ "6727c950-9f01-47a2-a7aa-7d3686c4c95b" ] } }
  • 响应示例 状态码为 201 时: Created { "sub_network_interface" : { "id" : "2be868f2-f7c9-48db-abc0-eea0b9105b0d", "project_id" : "8c6fb137a48a428aaf9a0229dca4edb3", "virsubnet_id" : "08278e6c-61ca-46c1-9fc3-0d4f6c12f193", "private_ip_address" : "10.0.0.225", "ipv6_ip_address" : null, "mac_address" : "fa:16:3e:48:f8:6f", "parent_device_id" : "1ab01f1d-4ef7-4d83-82be-802b3aca0223", "security_groups" : [ "6727c950-9f01-47a2-a7aa-7d3686c4c95b" ], "vpc_id" : "63b97e6b-3598-430f-9eb8-1caf06937be8", "description" : null, "parent_id" : "637748df-2986-4350-8303-95d259580fb3", "vlan_id" : 2787, "tags" : [ ], "created_at" : "2020-05-19T01:16:25Z" }, "request_id" : "ceb6273e-1ec9-4168-ac11-3dfeaacfc889" }
  • 响应示例 状态码为 201 时: Created { "security_group": { "id": "69c999ad-d9ef-4d79-94fd-35e6ceb75325", "name": "security_group_1", "project_id": "060576782980d5762f9ec014dd2f1148", "description": "security group description", "enterprise_project_id": "0", "security_group_rules": [ { "id": "f11a3824-ac19-4fad-b4f1-c5f4a6dd0a80", "project_id": "060576782980d5762f9ec014dd2f1148", "security_group_id": "69c999ad-d9ef-4d79-94fd-35e6ceb75325", "remote_group_id": "69c999ad-d9ef-4d79-94fd-35e6ceb75325", "direction": "ingress", "protocol": null, "description": "", "created_at": "2020-07-09T05:56:27Z", "updated_at": "2020-07-09T05:56:27Z", "ethertype": "IPv6", "remote_ip_prefix": null, "multiport": null, "remote_address_group_id": null, "action": "allow", "priority": 100 }, { "id": "3d6480e8-9ea4-46dc-bb1b-8db190cd5677", "project_id": "060576782980d5762f9ec014dd2f1148", "security_group_id": "69c999ad-d9ef-4d79-94fd-35e6ceb75325", "remote_group_id": null, "direction": "egress", "protocol": null, "description": "", "created_at": "2020-07-09T05:56:27Z", "updated_at": "2020-07-09T05:56:27Z", "ethertype": "IPv6", "remote_ip_prefix": null, "multiport": null, "remote_address_group_id": null, "action": "allow", "priority": 100 }, { "id": "9581f18c-1fdd-43da-ace9-7758a56ef28a", "project_id": "060576782980d5762f9ec014dd2f1148", "security_group_id": "69c999ad-d9ef-4d79-94fd-35e6ceb75325", "remote_group_id": null, "direction": "egress", "protocol": null, "description": "", "created_at": "2020-07-09T05:56:27Z", "updated_at": "2020-07-09T05:56:27Z", "ethertype": "IPv4", "remote_ip_prefix": null, "multiport": null, "remote_address_group_id": null, "action": "allow", "priority": 100 }, { "id": "a3ba270e-e58b-432d-a912-aeb7eace9fb8", "project_id": "060576782980d5762f9ec014dd2f1148", "security_group_id": "69c999ad-d9ef-4d79-94fd-35e6ceb75325", "remote_group_id": "69c999ad-d9ef-4d79-94fd-35e6ceb75325", "direction": "ingress", "protocol": null, "description": "", "created_at": "2020-07-09T05:56:27Z", "updated_at": "2020-07-09T05:56:27Z", "ethertype": "IPv4", "remote_ip_prefix": null, "multiport": null, "remote_address_group_id": null, "action": "allow", "priority": 100 } ], "created_at": "2020-07-09T05:56:27Z", "updated_at": "2020-07-09T05:56:27Z" }, "request_id": "a8cf4f79ca3c22ca685e7e8872e8c20b" }
  • 请求示例 创建安全组,指定名称为security_group_1,描述为security group description。 "POST https://{Endpoint}/v3/{project_id}/vpc/security-groups" { "security_group": { "name": "security_group_1", "description": "security group description" } } 创建安全组,指定名称为security_group_1,描述为security group description,指定预检该请求。 "POST https://{Endpoint}/v3/{project_id}/vpc/security-groups" { "security_group": { "name": "security_group_1", "description": "security group description", "tags": [] }, "dry_run": true }
  • 响应示例 { "routetable": { "id": "05250d7e-0396-4fc9-9c9c-e4d5594784e4", "name": "rtb-vpc-l2cg-1", "routes": [ { "type": "local", "destination": "192.168.4.0/24", "nexthop": "-" }, { "type": "local", "destination": "192.168.1.0/24", "nexthop": "-" }, { "type": "local", "destination": "198.19.128.0/20", "nexthop": "-" }, { "type": "local", "destination": "127.0.0.0/8", "nexthop": "-" }, { "type": "local", "destination": "100.64.0.0/10", "nexthop": "-" } ], "subnets": [ { "id": "0e0faa8f-ea73-47aa-b919-8c133e98d5ac" }, { "id": "e007e005-10aa-4614-b439-c9a14e55130e" } ], "vpc_id": "7978e43c-f892-49d8-9fab-9bb90a51709b", "default": true, "tenant_id": "05e369f07a800f802f41c002632ba5f9", "created_at": "2022-12-15T02:56:40", "updated_at": "2022-12-15T02:56:40" } }
  • 请求示例 更新id为1d8b19c7-7c56-48f7-a99b-4b40eb390967的安全组,名称更新为security_group_2,描述更新为modified description。 "PUT https://{Endpoint}/v3/{project_id}/vpc/security-groups/1d8b19c7-7c56-48f7-a99b-4b40eb390967" { "security_group" : { "name" : "security_group_2", "description" : "modified description" } }
  • 响应示例 状态码为 200 时: OK { "security_group" : { "id" : "69c999ad-d9ef-4d79-94fd-35e6ceb75325", "name" : "security_group_2", "project_id" : "060576782980d5762f9ec014dd2f1148", "description" : "modified description", "enterprise_project_id" : "0", "security_group_rules" : [ { "id" : "f11a3824-ac19-4fad-b4f1-c5f4a6dd0a80", "project_id" : "060576782980d5762f9ec014dd2f1148", "security_group_id" : "69c999ad-d9ef-4d79-94fd-35e6ceb75325", "remote_group_id" : "69c999ad-d9ef-4d79-94fd-35e6ceb75325", "direction" : "ingress", "protocol" : null, "description" : "", "created_at" : "2020-07-09T05:56:27Z", "updated_at" : "2020-07-09T05:56:27Z", "ethertype" : "IPv6", "remote_ip_prefix" : null, "multiport" : null, "remote_address_group_id" : null, "action" : "allow", "priority" : 100 }, { "id" : "3d6480e8-9ea4-46dc-bb1b-8db190cd5677", "project_id" : "060576782980d5762f9ec014dd2f1148", "security_group_id" : "69c999ad-d9ef-4d79-94fd-35e6ceb75325", "remote_group_id" : null, "direction" : "egress", "protocol" : null, "description" : "", "created_at" : "2020-07-09T05:56:27Z", "updated_at" : "2020-07-09T05:56:27Z", "ethertype" : "IPv6", "remote_ip_prefix" : null, "multiport" : null, "remote_address_group_id" : null, "action" : "allow", "priority" : 100 }, { "id" : "9581f18c-1fdd-43da-ace9-7758a56ef28a", "project_id" : "060576782980d5762f9ec014dd2f1148", "security_group_id" : "69c999ad-d9ef-4d79-94fd-35e6ceb75325", "remote_group_id" : null, "direction" : "egress", "protocol" : null, "description" : "", "created_at" : "2020-07-09T05:56:27Z", "updated_at" : "2020-07-09T05:56:27Z", "ethertype" : "IPv4", "remote_ip_prefix" : null, "multiport" : null, "remote_address_group_id" : null, "action" : "allow", "priority" : 100 }, { "id" : "a3ba270e-e58b-432d-a912-aeb7eace9fb8", "project_id" : "060576782980d5762f9ec014dd2f1148", "security_group_id" : "69c999ad-d9ef-4d79-94fd-35e6ceb75325", "remote_group_id" : "69c999ad-d9ef-4d79-94fd-35e6ceb75325", "direction" : "ingress", "protocol" : null, "description" : "", "created_at" : "2020-07-09T05:56:27Z", "updated_at" : "2020-07-09T05:56:27Z", "ethertype" : "IPv4", "remote_ip_prefix" : null, "multiport" : null, "remote_address_group_id" : null, "action" : "allow", "priority" : 100 } ], "created_at" : "2020-07-09T05:56:27Z", "updated_at" : "2020-07-09T05:56:27Z", "tags": [] }, "request_id" : "a8cf4f79ca3c22ca685e7e8872e8c20b" }