华为云用户手册

  • 响应示例 { "privateip": { "status": "DOWN", "id": "d600542a-b231-45ed-af05-e9930cb14f78", "subnet_id": "531dec0f-3116-411b-a21b-e612e42349fd", "tenant_id": "8b7e35ad379141fc9df3e178bd64f55c", "device_owner": "", "ip_address": "192.168.1.11" }}
  • 请求消息 请求参数 表2 请求参数 名称 是否必选 参数类型 说明 port 是 port object 端口对象,请参见表3。 表3 port字段说明 名称 是否必选 参数类型 说明 name 否 String 功能说明:端口名称 取值:默认为空,最大长度不超过255 security_groups 否 Array of strings 安全组的UUID allowed_address_pairs 否 Array of allow_address_pair objects 功能说明:IP/Mac对列表,allow_address_pair参见表4。 约束: IP地址不允许为 “0.0.0.0”。 如果allowed_address_pairs配置地址池较大的CIDR(掩码小于24位),建议为该port配置一个单独的安全组。 如果allowed_address_pairs为“1.1.1.1/0”,表示关闭源目地址检查开关。 为虚拟IP配置后端ECS场景,allowed_address_pairs中配置的IP地址,必须为ECS网卡已有的IP地址,否则可能会导致虚拟IP通信异常。 extra_dhcp_opts 否 Array of extra_dhcp_opt objects DHCP的扩展Option(扩展属性),请参见表5。 表4 allow_address_pair对象 名称 参数类型 说明 ip_address String 功能说明:IP地址 约束:不支持0.0.0.0 如果allowed_address_pairs配置地址池较大的CIDR(掩码小于24位),建议为该port配置一个单独的安全组。 mac_address String MAC地址 表5 extra_dhcp_opt对象 名称 是否必选 参数类型 说明 opt_name 否 String Option名称 opt_value 否 String Option值 请求样例: { "port": { "name": "adc" }}
  • 响应消息 响应参数 表6 响应参数 名称 参数类型 说明 port port object 端口对象,请参见表7。 表7 port字段说明 名称 参数类型 说明 id String 端口唯一标识 name String 功能说明:端口名称 取值:默认为空,最大长度不超过255 network_id String 功能说明:端口所属网络的ID 约束:必须是存在的网络ID admin_state_up Boolean 功能说明:管理状态 约束:只支持true,默认为true mac_address String 功能说明:端口MAC地址 约束:由系统分配,不支持指定 fixed_ips Array of fixed_ip objects 功能说明:端口IP。例如:"fixed_ips": [{"subnet_id": "4dc70db6-cb7f-4200-9790-a6a910776bba", "ip_address": "192.169.25.79"}] 约束:一个端口只支持一个fixed_ip,且不支持更新。 device_id String 功能说明:端口所属设备ID 约束:不支持设置和更新,由系统自动维护 device_owner String 功能说明:设备所属(DHCP/Router/ lb/Nova) 约束:不支持设置和更新,由系统自动维护 tenant_id String 项目ID。 status String 功能说明:端口状态,Hana硬直通虚拟机端口状态总为DOWN 取值范围:ACTIVE、BUILD、DOWN security_groups Array of strings 安全组的UUID(扩展属性) allowed_address_pairs Array of allow_address_pairobjects 功能说明:IP/Mac对列表,allow_address_pair参见表9(扩展属性)。 约束:IP地址不允许为 “0.0.0.0” 如果allowed_address_pairs配置地址池较大的CIDR(掩码小于24位),建议为该port配置一个单独的安全组 如果allowed_address_pairs为“1.1.1.1/0”,表示关闭源目地址检查开关 extra_dhcp_opts Array of extra_dhcp_opt objects DHCP的扩展Option(扩展属性),请参见表10 binding:vif_details Object vif的详细信息, "ovs_hybrid_plug": 是否为ovs/bridge混合模式 binding:profile Object 扩展属性:提供用户设置自定义信息 【使用说明】 internal_elb字段,布尔类型,普通租户可见。只有在创建内网ELB的虚拟IP的网卡时设置为true。普通租户没有权限更改该字段,由系统维护。 举例: {"internal_elb": true} disable_security_groups字段,布尔类型,普通租户可见。默认为false高性能通信场景下,允许指定为true普通租户可见。仅支持创建port和读取时指定。当前仅支持指定为true,不支持指定为false 举例: {"disable_security_groups":true }, 当前仅支持指定为true,不支持指定为false,指定为true时,FWaaS功能不生效。 binding:vnic_type String 功能说明:绑定的vNIC类型 取值范围:normal或者direct。normal: 软交换,direct: SRIOV硬直通(不支持) port_security_enabled Boolean 端口安全使能标记,如果不使能则安全组和dhcp防欺骗不生效,默认为true 表8 fixed_ip对象 名称 参数类型 说明 subnet_id String 功能说明:所属子网ID 约束:不支持更新 ip_address String 端口IP地址 表9 allow_address_pair对象 名称 参数类型 说明 ip_address String 功能说明:IP地址 约束:不支持0.0.0.0 如果allowed_address_pairs配置地址池较大的CIDR(掩码小于24位),建议为该port配置一个单独的安全组。 mac_address String MAC地址 表10 extra_dhcp_opt对象 名称 参数类型 说明 opt_name String Option名称 opt_value String Option值 响应样例: { "port": { "id": "7204e0da-40de-4207-a536-6f59b84f6f0e", "name": "adc", "status": "DOWN", "admin_state_up": "true", "fixed_ips": [ { "subnet_id": "689156ca-038f-4478-b265-fd26aa8bbe31", "ip_address": "192.168.0.9" } ], "mac_address": "fa:16:3e:d7:f2:6c", "network_id": "b4152e98-e3af-4e49-bb7f-7766e2b5ec63", "tenant_id": "caa6cf4337ea47fb823b15709ebe8591", "device_id": "", "device_owner": "", "security_groups": [ "59b39002-e79b-4bac-8e27-aa884ab1beb6" ], "extra_dhcp_opts": [], "allowed_address_pairs": [], "binding:vnic_type": "normal", "binding:vif_details": {}, "binding:profile": {}, "port_security_enabled":true }}
  • 请求消息 请求参数 表1 请求参数 名称 是否必选 参数类型 说明 port 是 port object 端口对象,请参见表2。 表2 port字段说明 名称 是否必选 参数类型 说明 name 否 String 功能说明:端口名称 取值:默认为空,最大长度不超过255 network_id 是 String 功能说明:端口所属网络的ID 约束:必须是存在的网络ID admin_state_up 否 Boolean 功能说明:管理状态 约束:只支持true,默认为true fixed_ips 否 Array of fixed_ip objects 功能说明:端口IP。请参见表3。 例如:"fixed_ips": [{"subnet_id": "4dc70db6-cb7f-4200-9790-a6a910776bba", "ip_address": "192.169.25.79"}] 约束:一个端口只支持一个fixed_ip,且不支持更新。 tenant_id 否 String 项目ID。 security_groups 否 Array of strings 安全组的UUID,例如:"security_groups": ["a0608cbf-d047-4f54-8b28-cd7b59853fff"](扩展属性) allowed_address_pairs 否 Array of allow_address_pair objects 功能说明:IP/Mac对列表,allow_address_pair参见表4(扩展属性) 约束:IP地址不允许为 “0.0.0.0” 如果allowed_address_pairs配置地址池较大的CIDR(掩码小于24位),建议为该port配置一个单独的安全组 如果allowed_address_pairs为“1.1.1.1/0”,表示关闭源目地址检查开关 extra_dhcp_opts 否 Array of extra_dhcp_opt objects DHCP的扩展Option(扩展属性) port_security_enabled 否 Boolean 端口安全使能标记,如果不使能则安全组和dhcp防欺骗不生效,默认为true 表3 fixed_ip对象 名称 是否必选 参数类型 说明 subnet_id 否 String 功能说明:所属子网ID 约束:不支持更新 ip_address 否 String 功能说明:端口IP地址 约束:不支持更新 表4 allow_address_pair对象 名称 是否必选 参数类型 说明 ip_address 否 String 功能说明:IP地址 约束:不支持0.0.0.0 如果allowed_address_pairs配置地址池较大的CIDR(掩码小于24位),建议为该port配置一个单独的安全组 如果allowed_address_pairs为“1.1.1.1/0”,表示关闭源目地址检查开关 mac_address 否 String MAC地址 表5 extra_dhcp_opt对象 名称 是否必选 参数类型 说明 opt_name 否 String Option名称 opt_value 否 String Option值 请求样例 POST https://{Endpoint}/v1/ports{ "port": { "fixed_ips": [ { "ip_address": "192.168.0.38", "subnet_id": "06bc2359-d75e-4f96-82f4-313e39c7148c" } ], "network_id": "28a1c93c-9a5e-4a9f-813b-e495bdef7d34", "security_groups": [ "f2c5b3fc-b971-4a86-87b9-032586260e3e" ] }}
  • 响应消息 响应参数 表6 响应参数 名称 参数类型 说明 port port object 端口对象,请参见表7。 表7 port字段说明 名称 参数类型 说明 id String 端口唯一标识 name String 功能说明:端口名称 取值:默认为空,最大长度不超过255 network_id String 功能说明:端口所属网络的ID 约束:必须是存在的网络ID admin_state_up Boolean 功能说明:管理状态 约束:只支持true,默认为true mac_address String 功能说明:端口MAC地址 约束:由系统分配,不支持指定 fixed_ips Array of fixed_ip objects 功能说明:端口IP。例如:"fixed_ips": [{"subnet_id": "4dc70db6-cb7f-4200-9790-a6a910776bba", "ip_address": "192.169.25.79"}] 约束:一个端口只支持一个fixed_ip,且不支持更新。 device_id String 功能说明:端口所属设备ID 约束:不支持设置和更新,由系统自动维护 device_owner String 功能说明:设备所属(DHCP/Router/ lb/Nova) 约束:不支持设置和更新,由系统自动维护 tenant_id String 项目ID。 status String 功能说明:端口状态,Hana硬直通虚拟机端口状态总为DOWN 取值范围:ACTIVE、BUILD、DOWN security_groups Array of strings 安全组的UUID(扩展属性) allowed_address_pairs Array of allow_address_pairobjects 功能说明:IP/Mac对列表,allow_address_pair参见表9(扩展属性)。 约束:IP地址不允许为 “0.0.0.0” 如果allowed_address_pairs配置地址池较大的CIDR(掩码小于24位),建议为该port配置一个单独的安全组 如果allowed_address_pairs为“1.1.1.1/0”,表示关闭源目地址检查开关 extra_dhcp_opts Array of extra_dhcp_opt objects DHCP的扩展Option(扩展属性),请参见表10 binding:vif_details Object vif的详细信息, "ovs_hybrid_plug": 是否为ovs/bridge混合模式 binding:profile Object 扩展属性:提供用户设置自定义信息 【使用说明】 internal_elb字段,布尔类型,普通租户可见。只有在创建内网ELB的虚拟IP的网卡时设置为true。普通租户没有权限更改该字段,由系统维护。 举例: {"internal_elb": true} disable_security_groups字段,布尔类型,普通租户可见。默认为false高性能通信场景下,允许指定为true普通租户可见。仅支持创建port和读取时指定。当前仅支持指定为true,不支持指定为false 举例: {"disable_security_groups":true }, 当前仅支持指定为true,不支持指定为false,指定为true时,FWaaS功能不生效。 binding:vnic_type String 功能说明:绑定的vNIC类型 取值范围:normal或者direct。normal: 软交换,direct: SRIOV硬直通(不支持) port_security_enabled Boolean 端口安全使能标记,如果不使能则安全组和dhcp防欺骗不生效,默认为true 表8 fixed_ip对象 名称 参数类型 说明 subnet_id String 功能说明:所属子网ID 约束:不支持更新 ip_address String 端口IP地址 表9 allow_address_pair对象 名称 参数类型 说明 ip_address String 功能说明:IP地址 约束:不支持0.0.0.0 如果allowed_address_pairs配置地址池较大的CIDR(掩码小于24位),建议为该port配置一个单独的安全组。 mac_address String MAC地址 表10 extra_dhcp_opt对象 名称 参数类型 说明 opt_name String Option名称 opt_value String Option值 响应样例 { "port": { "id": "d00f9c13-412f-4855-8af3-de5d8c24cd60", "name": "test", "status": "DOWN", "admin_state_up": "true", "fixed_ips": [ { "subnet_id": "70f2e74b-e660-410a-b754-0ca46744348a", "ip_address": "10.128.1.10" } ], "mac_address": "fa:16:3e:d7:f2:6c", "network_id": "5b808927-13c9-4e60-a4f4-ed6ffe225167", "tenant_id": "43f2d1cca56a40729dcb17212482f34d", "device_id": "", "device_owner": "", "security_groups": [ "02b4e8ee-74fa-4a31-802e-5490df11245e" ], "extra_dhcp_opts": [], "allowed_address_pairs": [], "binding:vnic_type": "normal", "binding:vif_details": {}, "binding:profile": {}, "port_security_enabled":true }}
  • 路由表 权限 对应API接口 授权项(Action) IAM项目(Project) 企业项目(Enterprise Project) 查询路由表列表 GET /v1/{project_id}/routetables vpc:routeTables:list √ √ 查询路由表 GET /v1/{project_id}/routetables/{routetable_id} vpc:routeTables:get √ √ 创建路由表 POST /v1/{project_id}/routetables vpc:routeTables:create √ √ 更新路由表 PUT /v1/{project_id}/routetables/{routetable_id} vpc:routeTables:update √ √ 关联路由表与子网 POST /v1/{project_id}/routetables/{routetable_id}/action vpc:routeTables:associate √ √ 解关联路由表与子网 POST /v1/{project_id}/routetables/{routetable_id}/action vpc:routeTables:associate √ √ 删除路由表 DELETE /v1/{project_id}/routetables/{routetable_id} vpc:routeTables:delete √ √ 父主题: 权限和授权项
  • 网络ACL(Openstack Neutron API) 权限 对应API接口 授权项(Action) IAM项目(Project) 企业项目(Enterprise Project) 查询所有网络ACL规则 GET /v2.0/fwaas/firewall_rules vpc:firewallRules:get √ × 查询特定网络ACL规则 GET /v2.0/fwaas/firewall_rules/{firewall_rule_id} vpc:firewallRules:get √ × 创建网络ACL规则 POST /v2.0/fwaas/firewall_rules vpc:firewallRules:create √ × 更新网络ACL规则 PUT /v2.0/fwaas/firewall_rules/{firewall_rule_id} vpc:firewallRules:update √ × 删除网络ACL规则 DELETE /v2.0/fwaas/firewall_rules/{firewall_rule_id} vpc:firewallRules:delete √ × 查询所有网络ACL策略 GET /v2.0/fwaas/firewall_policies vpc:firewallPolicies:get √ × 查询特定网络ACL策略 GET /v2.0/fwaas/firewall_policies/{firewall_policy_id} vpc:firewallPolicies:get √ × 创建网络ACL策略 POST /v2.0/fwaas/firewall_policies vpc:firewallPolicies:create √ × 更新网络ACL策略 PUT /v2.0/fwaas/firewall_policies/{firewall_policy_id} vpc:firewallPolicies:update √ × 删除网络ACL策略 DELETE /v2.0/fwaas/firewall_policies/{firewall_policy_id} vpc:firewallPolicies:delete √ × 插入网络ACL规则 PUT /v2.0/fwaas/firewall_policies/{firewall_policy_id}/insert_rule vpc:firewallPolicies:addRule vpc:firewallPolicies:get √ × 移除网络ACL规则 PUT /v2.0/fwaas/firewall_policies/{firewall_policy_id}/remove_rule vpc:firewallPolicies:removeRule vpc:firewallPolicies:get √ × 查询所有网络ACL组 GET /v2.0/fwaas/firewall_groups vpc:firewallGroups:get √ × 查询特定网络ACL组 GET /v2.0/fwaas/firewall_groups/{firewall_group_id} vpc:firewallGroups:get √ × 创建网络ACL组 POST /v2.0/fwaas/firewall_groups vpc:firewallGroups:create √ × 更新网络ACL组 PUT /v2.0/fwaas/firewall_groups/{firewall_group_id} vpc:firewallGroups:update √ × 删除网络ACL组 DELETE /v2.0/fwaas/firewall_groups/{firewall_group_id} vpc:firewallGroups:delete √ × 父主题: 权限和授权项
  • VPC流日志 权限 对应API接口 授权项(Action) IAM项目(Project) 企业项目(Enterprise Project) 创建流日志 POST /v1/{project_id}/fl/flow_logs vpc:flowLogs:create √ × 查询流日志列表 GET /v1/{project_id}/fl/flow_logs vpc:flowLogs:get √ × 查询流日志 GET /v1/{project_id}/fl/flow_logs/{flowlog_id} vpc:flowLogs:get √ × 更新流日志 PUT /v1/{project_id}/fl/flow_logs/{flowlog_id} vpc:flowLogs:update √ × 删除流日志 DELETE /v1/{project_id}/fl/flow_logs/{flowlog_id} vpc:flowLogs:delete √ × 父主题: 权限和授权项
  • VPC 权限 对应API接口 授权项(Action) IAM项目(Project) 企业项目(Enterprise Project) 创建VPC POST /v1/{project_id}/vpcs vpc:vpcs:create √ √ 查询VPC GET /v1/{project_id}/vpcs/{vpc_id} vpc:vpcs:get √ √ 查询VPC详情(v3) GET /v3/{project_id}/vpc/vpcs/{vpc_id} vpc:vpcs:get √ √ 查询VPC列表 GET /v1/{project_id}/vpcs vpc:vpcs:list √ √ 查询VPC列表(v3) GET /v3/{project_id}/vpc/vpcs vpc:vpcs:list √ √ 更新VPC PUT /v1/{project_id}/vpcs/{vpc_id} vpc:vpcs:update √ √ 添加VPC扩展网段(v3) PUT /v3/{project_id}/vpc/vpcs/{vpc_id}/add-extend-cidr vpc:vpcs:update √ √ 移除VPC扩展网段(v3) PUT /v3/{project_id}/vpc/vpcs/{vpc_id}/remove-extend-cidr vpc:vpcs:update √ √ 删除VPC DELETE /v1/{project_id}/vpcs/{vpc_id} vpc:vpcs:delete √ √ 父主题: 权限和授权项
  • VPC路由 权限 对应API接口 授权项(Action) IAM项目(Project) 企业项目(Enterprise Project) 查询VPC路由列表 GET /v2.0/vpc/routes vpc:routes:list √ × 查询VPC路由 GET /v2.0/vpc/routes/{route_id} vpc:routes:get √ × 创建VPC路由 POST /v2.0/vpc/routes vpc:routes:create √ × 删除VPC路由 DELETE /v2.0/vpc/routes/{route_id} vpc:routes:delete √ × 父主题: 权限和授权项
  • VPC标签 权限 对应API接口 授权项(Action) IAM项目(Project) 企业项目(Enterprise Project) 创建VPC资源标签 POST /v2.0/{project_id}/vpcs/{vpc_id}/tags vpc:vpcTags:create √ × 查询VPC资源标签 GET /v2.0/{project_id}/vpcs/{vpc_id}/tags vpc:vpcTags:get √ × 删除VPC资源标签 DELETE /v2.0/{project_id}/vpcs/{vpc_id}/tags/{key} vpc:vpcTags:delete √ × 批量创建和删除VPC资源标签 POST /v2.0/{project_id}/vpcs/{vpc_id}/tags/action vpc:vpcTags:create vpc:vpcTags:delete √ × 查询VPC资源实例 POST /v2.0/{project_id}/vpcs/resource_instances/action vpc:vpcTags:get √ × 查询VPC项目标签 GET /v2.0/{project_id}/vpcs/tags vpc:vpcTags:get √ × 父主题: 权限和授权项
  • 路由器(Openstack Neutron API) 权限 对应API接口 授权项(Action) IAM项目(Project) 企业项目(Enterprise Project) 查询路由器列表 GET /v2.0/routers vpc:routers:get √ × 查询路由器 GET /v2.0/routers/{router_id} vpc:routers:get √ × 创建路由器 POST /v2.0/routers vpc:routers:create √ × 更新路由器 PUT /v2.0/routers/{router_id} vpc:routers:update √ × 删除路由器 DELETE /v2.0/routers/{router_id} vpc:routers:delete √ × 添加路由器接口 PUT /v2.0/routers/{router_id}/add_router_interface vpc:routers:addInterface vpc:routers:get √ × 删除路由器接口 PUT /v2.0/routers/{router_id}/remove_router_interface vpc:routers:removeInterface vpc:routers:get √ × 父主题: 权限和授权项
  • 安全组规则icmp协议名称对应关系表 icmp type port_range_min port_range_max Any NULL NULL Echo 8 0 Echo reply 0 0 Fragment need DF set 3 4 Host redirect 5 1 Host TOS redirect 5 3 Host unreachable 3 1 Information reply 16 0 Information request 15 0 Net redirect 5 0 Net TOS redirect 5 2 Net unreachable 3 0 Parameter problem 12 0 Port unreachable 3 3 Protocol unreachable 3 2 Reassembly timeout 11 1 Source quench 4 0 Source route failed 3 5 Timestamp reply 14 0 Timestamp request 13 0 TTL exceeded 11 0 父主题: 附录
  • 响应示例 状态码为 200 时: OK { "sub_network_interfaces" : 2, "request_id" : "4a79f1f7-67eb-43be-a8be-eb57ba894f90"} 状态码为 400 时: { "request_id" : "string", "error_msg" : "string", "error_code" : "string"} 状态码为 401 时: { "request_id" : "string", "error_msg" : "string", "error_code" : "string"} 状态码为 403 时: { "request_id" : "string", "error_msg" : "string", "error_code" : "string"} 状态码为 500 时: { "request_id" : "string", "error_msg" : "string", "error_code" : "string"}
  • 响应参数 状态码为 200 时: 表3 响应Body参数 参数 参数类型 描述 request_id String 请求ID sub_network_interfaces Integer 辅助弹性网卡数目 状态码为 400 时: 表4 响应Body参数 参数 参数类型 描述 request_id String 请求ID error_msg String 错误消息 error_code String 错误码 状态码为 401 时: 表5 响应Body参数 参数 参数类型 描述 request_id String 请求ID error_msg String 错误消息 error_code String 错误码 状态码为 403 时: 表6 响应Body参数 参数 参数类型 描述 request_id String 请求ID error_msg String 错误消息 error_code String 错误码 状态码为 500 时: 表7 响应Body参数 参数 参数类型 描述 request_id String 请求ID error_msg String 错误消息 error_code String 错误码
  • 响应参数 表2 响应参数 参数名称 类型 说明 firewall_rule firewall_rule object firewall rule对象,请参见表3。 表3 Firewall Rule对象 属性 类型 说明 id String 网络ACL规则的uuid标识。 name String 网络ACL规则名称。 description String 网络ACL规则描述。 tenant_id String 项目ID public Boolean 是否支持跨租户共享。 protocol String IP协议。 source_port String 源端口号或者一段端口范围。 destination_port String 目的端口号或者一段端口范围。 ip_version Integer IP协议版本。 source_ip_address String 源地址或者CIDR。 destination_ip_address String 目的地址或者CIDR。 action String 对通过网络ACL的流量执行的操作。 enabled Boolean 是否使能网络ACL规则。 project_id String 项目ID,请参见获取项目ID。
  • 响应示例 { "firewall_rule": { "protocol": "tcp", "description": "update check parameter", "source_ip_address": "116.66.184.0/24", "destination_ip_address": "0.0.0.0/0", "destination_port": null, "source_port": null, "id": "514e6776-162a-4b5d-ab8b-aa36b86655ef", "name": "test", "tenant_id": "a1c6f90c94334bd2953d9a61b8031a68", "project_id": "a1c6f90c94334bd2953d9a61b8031a68", "enabled": true, "action": "allow", "ip_version": 4, "public": false }}
  • 响应参数 状态码为 400 时: 表3 响应Body参数 参数 参数类型 描述 request_id String 请求ID error_msg String 错误消息 error_code String 错误码 状态码为 401 时: 表4 响应Body参数 参数 参数类型 描述 request_id String 请求ID error_msg String 错误消息 error_code String 错误码 状态码为 403 时: 表5 响应Body参数 参数 参数类型 描述 request_id String 请求ID error_msg String 错误消息 error_code String 错误码 状态码为 404 时: 表6 响应Body参数 参数 参数类型 描述 request_id String 请求ID error_msg String 错误消息 error_code String 错误码 状态码为 409 时: 表7 响应Body参数 参数 参数类型 描述 request_id String 请求ID error_msg String 错误消息 error_code String 错误码 状态码为 500 时: 表8 响应Body参数 参数 参数类型 描述 request_id String 请求ID error_msg String 错误消息 error_code String 错误码
  • 响应示例 状态码为 400 时: { "request_id" : "string", "error_msg" : "string", "error_code" : "string"} 状态码为 401 时: { "request_id" : "string", "error_msg" : "string", "error_code" : "string"} 状态码为 403 时: { "request_id" : "string", "error_msg" : "string", "error_code" : "string"} 状态码为 404 时: { "request_id" : "string", "error_msg" : "string", "error_code" : "string"} 状态码为 409 时: { "request_id" : "string", "error_msg" : "string", "error_code" : "string"} 状态码为 500 时: { "request_id" : "string", "error_msg" : "string", "error_code" : "string"}
  • 响应示例 { "firewall_rule": { "protocol": "tcp", "description": "", "source_ip_address": null, "destination_ip_address": null, "source_port": null, "destination_port": "80", "id": "b94acf06-efc2-485d-ba67-a61acf2a7e28", "name": "ALLOW_HTTP", "tenant_id": "23c8a121505047b6869edf39f3062712", "enabled": true, "action": "allow", "ip_version": 4, "public": false, "project_id": "23c8a121505047b6869edf39f3062712" }}
  • 响应参数 表3 响应参数 参数名称 类型 说明 firewall_rule firewall_rule object firewall rule对象。请参见表4。 表4 Firewall Rule对象 属性 类型 说明 id String 网络ACL规则的uuid标识。 name String 网络ACL规则名称。 description String 网络ACL规则描述。 tenant_id String 项目ID public Boolean 是否支持跨租户共享。 protocol String IP协议。 source_port String 源端口号或者一段端口范围。 destination_port String 目的端口号或者一段端口范围。 ip_version Integer IP协议版本。 source_ip_address String 源地址或者CIDR。 destination_ip_address String 目的地址或者CIDR。 action String 对通过网络ACL的流量执行的操作。 enabled Boolean 是否使能网络ACL规则。 project_id String 项目ID,请参见获取项目ID。
  • 请求参数 表1 请求参数 参数名称 是否必选 类型 说明 firewall_rule 是 firewall_rule object firewall rule对象。请参见表2。 表2 Firewall Rule对象 属性 是否必选 类型 约束 说明 name 否 String 最长255个字符 网络ACL规则名称。 使用说明:最长255个字符 description 否 String 最长255个字符 网络ACL规则描述。 使用说明:最长255个字符 protocol 否 String 支持TCP,UDP,ICMP, ICMPV6 IP协议。 取值范围:支持TCP,UDP,ICMP, ICMPV6 source_port 否 String 位于[1,65535]中一个整数或者一段端口范围a:b 源端口号或者一段端口范围。 取值范围:位于[1,65535]中一个整数或者一段端口范围a:b destination_port 否 String 位于[1,65535]中一个整数或者一段端口范围a:b 目的端口号或者一段端口范围。 取值范围:位于[1,65535]中一个整数或者一段端口范围a:b ip_version 否 Integer 4/6 IP协议版本。 取值范围:4、6,分别表示创建ipv4和ipv6。 source_ip_address 否 String N/A 源地址或者CIDR。 destination_ip_address 否 String N/A 目的地址或者CIDR。 action 否 String deny/allow 对通过网络ACL的流量执行的操作。 取值范围:deny(拒绝)/allow(允许) enabled 否 Boolean true/false 是否使能网络ACL规则。 取值范围:true/false
  • 请求示例 创建ACL规则,action为allow,IP协议为tcp,目的端口为80。 POST https://{Endpoint}/v2.0/fwaas/firewall_rules{ "firewall_rule": { "action": "allow", "enabled": true, "destination_port": "80", "protocol": "tcp", "name": "ALLOW_HTTP" }}
  • 响应参数 表2 响应参数 参数名称 类型 说明 firewall_policy firewall_policy object firewall policy对象。请参见表3。 表3 Firewall Policy对象 属性 类型 说明 id String 网络ACL策略uuid标识。 name String 网络ACL策略名称。 description String 网络ACL策略描述。 tenant_id String 项目ID firewall_rules Array of strings 策略引用的网络ACL规则链。 audited Boolean 审计标记。 public Boolean 是否支持跨租户共享。 project_id String 项目ID,请参见获取项目ID。
  • 响应示例 { "firewall_policy": { "description": "", "firewall_rules": [ "3c0e6267-73df-4d9a-87a6-e226f2db2036" ], "tenant_id": "23c8a121505047b6869edf39f3062712", "public": false, "id": "fed2d88f-d0e7-4cc5-bd7e-c495f67037b6", "audited": false, "name": "bobby_fwp1", "project_id": "23c8a121505047b6869edf39f3062712" }}
  • 响应参数 表2 响应参数 参数名称 类型 说明 firewall_rules Array of Firewall Rule objects firewall rule对象列表,参见表4。单次查询最多返回2000条数据,超过2000后会返回分页标记,分页查询请参见分页查询。 firewall_rules_links Array of firewall_rules_link Object 分页信息,参见表3 。 只有在使用limit过滤,并且资源个数超过limit或者资源个数超过2000时(limit默认值),该参数的rel和href取值才会显示为next和其对应的link。 表3 firewall_rules_link对象 参数名称 类型 说明 href String API链接 rel String API链接与该API版本的关系 表4 Firewall Rule对象 属性 类型 说明 id String 网络ACL规则的uuid标识。 name String 网络ACL规则名称。 description String 网络ACL规则描述。 tenant_id String 项目ID public Boolean 是否支持跨租户共享。 protocol String IP协议。 source_port String 源端口号或者一段端口范围。 destination_port String 目的端口号或者一段端口范围。 ip_version Integer IP协议版本。 source_ip_address String 源地址或者CIDR。 destination_ip_address String 目的地址或者CIDR。 action String 对通过网络ACL的流量执行的操作。 enabled Boolean 是否使能网络ACL规则。 project_id String 项目ID,请参见获取项目ID。
  • 响应示例 { "firewall_rules": [ { "protocol": "tcp", "description": "update check parameter", "source_ip_address": "116.66.184.0/24", "destination_ip_address": "0.0.0.0/0", "destination_port": null, "source_port": null, "id": "2a193015-4a88-4aa1-84ad-d4955adae707", "name": "crhfwruleupdate", "tenant_id": "a1c6f90c94334bd2953d9a61b8031a68", "project_id": "a1c6f90c94334bd2953d9a61b8031a68", "enabled": true, "action": "allow", "ip_version": 4, "public": false }, { "protocol": "tcp", "description": "update check parameter", "source_ip_address": null, "destination_ip_address": null, "destination_port": "40:60", "source_port": "20:50", "id": "db7a204c-9eb1-40a2-9bd6-ed5cfd3cff32", "name": "update_firewall-role-tommy", "tenant_id": "a1c6f90c94334bd2953d9a61b8031a68", "project_id": "a1c6f90c94334bd2953d9a61b8031a68", "enabled": false, "action": "deny", "ip_version": 4, "public": false } ], "firewall_rules_links": [ { "rel": "previous", "href": "https://{Endpoint}/v2.0/fwaas/firewall_rules?marker=2a193015-4a88-4aa1-84ad-d4955adae707&page_reverse=True" } ]}
  • URI GET /v2.0/fwaas/firewall_rules 样例: GET https://{Endpoint}/v2.0/fwaas/firewall_rules?name={firewall_rule_name}&tenant_id={tenant_id}&public={is_public}&protocol={protocol}&ip_version={ip_version}&action={action}&enabled={is_enabled} 分页查询样例: GET https://{Endpoint}/v2.0/fwaas/firewall_rules?limit=2&marker=2a193015-4a88-4aa1-84ad-d4955adae707&page_reverse=False 参数说明请参见表1。 表1 参数说明 名称 是否必选 参数类型 说明 id 否 String 按照网络ACL规则对应的ID过滤查询 name 否 String 按照网络ACL规则的名称过滤查询 description 否 String 按照网络ACL规则的描述过滤查询 ip_version 否 Integer 按照网络ACL规则的IP协议版本过滤查询 取值范围:4,6 action 否 String 按照网络ACL规则的行为过滤查询 取值范围:allow or deny enabled 否 Boolean 按照网络ACL规则是否使能过滤查询 取值范围:true or false tenant_id 否 String 按照网络ACL规则所属的项目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的参数说明。
  • 操作步骤 创建VPC。 发送“POST https://VPC的Endpoint/v1/{project_id}/vpcs”,project_id为项目ID。 在Request Header中增加“X-Auth-Token”。 在Request Body中传入参数如下,其中cidr字段需要提前进行网络规划。 { "vpc": { "name": "vpc", //虚拟私有云名称 "cidr": "192.168.0.0/16" //虚拟私有云下可用子网的范围 }} 查看请求响应结果。 请求成功时,响应参数如下,id就是vpc_id。 { "vpc": { "id": "b6684a27-b049-407d-90b4-c9551f2390e1", "name": "vpc", "cidr": "192.168.0.0/16", "status": "CREATING", "routes": [] }} 请求异常时,错误码请参见错误码。 查询VPC详情。 发送“GET https://VPC的Endpoint/v1/{project_id}/vpcs/{vpc_id}”,project_id为项目ID。 在Request Header中增加“X-Auth-Token”。 查看请求响应结果。 请求成功时,响应参数如下,id就是vpc_id。 { "vpc": { "id": "b6684a27-b049-407d-90b4-c9551f2390e1", "name": "vpc", "description": "", "cidr": "192.168.0.0/16", "status": "OK", "enterprise_project_id": "0" , "routes": [] }} 请求异常时,错误码请参见错误码。 指定VPC创建子网。 发送“POST https://VPC的Endpoint/v1/{project_id}/subnets”,project_id为项目ID。 在Request Header中增加“X-Auth-Token”。 在Request Body中传入参数如下,其中dnsList参数参见华为云提供的内网DNS地址是多少?,availability_zone参数可通过地区和终端节点获取。 {"subnet": {"name": "subnet","description": "","cidr": "192.168.0.0/24","gateway_ip": "192.168.0.1","dhcp_enable": true,"dnsList": ["114.xx.xx.114", "114.xx.xx.115"],"availability_zone": "aa-bb-cc","vpc_id": "b6684a27-b049-407d-90b4-c9551f2390e1"}} 查看请求响应结果。 请求成功时,响应参数如下: {"subnet": {"id": "4779ab1c-7c1a-44b1-a02e-93dfc361b32d","name": "subnet","description": "","cidr": "192.168.0.0/24","dnsList": ["114.xx.xx.114", "1114.xx.xx.115"],"status": "UNKNOWN","vpc_id": "b6684a27-b049-407d-90b4-c9551f2390e1","gateway_ip": "192.168.0.1","dhcp_enable": true,"primary_dns": "114.xx.xx.114","secondary_dns": "114.xx.xx.115","availability_zone": "aa-bb-cc","neutron_network_id": "4779ab1c-7c1a-44b1-a02e-93dfc361b32d","neutron_subnet_id": "213cb9d-3122-2ac1-1a29-91ffc1231a12","extra_dhcp_opts": []}} 请求异常时,错误码请参见错误码。 查询子网详情。 发送“GET https://VPC的Endpoint/v1/{project_id}/subnets/{subnet_id}”,project_id为项目ID。 在Request Header中增加“X-Auth-Token”。 查看请求响应结果。 {"subnet": {"id": "4779ab1c-7c1a-44b1-a02e-93dfc361b32d","name": "subnet","description": "","cidr": "192.168.20.0/24","dnsList": ["114.xx.xx.114", "114.xx.xx.115"],"status": "ACTIVE","vpc_id": "b6684a27-b049-407d-90b4-c9551f2390e1","gateway_ip": "192.168.20.1","ipv6_enable": false,"dhcp_enable": true,"primary_dns": "114.xx.xx.114","secondary_dns": "114.xx.xx.115","availability_zone": "aa-bb-cc","neutron_network_id": "4779ab1c-7c1a-44b1-a02e-93dfc361b32d","neutron_subnet_id": "213cb9d-3122-2ac1-1a29-91ffc1231a12","extra_dhcp_opts": []}}
  • 操作步骤 通过云服务器的ID查询网卡信息。 发送“GET https://VPC的Endpoint/v1/{project_id}/ports?device_id={ecs_id}”,project_id为项目ID。 在Request Header中增加“X-Auth-Token”。 查看请求响应结果。 请求成功时,响应参数如下: {"ports": [{"id": "02c72193-efec-42fb-853b-c33f2b802467","name": "","status": "ACTIVE","admin_state_up": true,"fixed_ips": [{"subnet_id": "213cb9d-3122-2ac1-1a29-91ffc1231a12","ip_address": "192.168.0.75"}],"mac_address": "fa:16:3e:47:5f:c1","network_id": "4779ab1c-7c1a-44b1-a02e-93dfc361b32d","tenant_id": "db82c9e1415a464ea68048baa8acc6b8","project_id": "db82c9e1415a464ea68048baa8acc6b8","device_id": "ea61f836-b52f-41bf-9d06-685644001d6f","device_owner": "compute:br-iaas-odin1a","security_groups": ["e0598d96-9451-4f8a-8de0-b8b4d451d9e7"],"extra_dhcp_opts": [],"allowed_address_pairs": [],"binding:vnic_type": "normal","binding:vif_details": {"primary_interface": true},"binding:profile": {},"port_security_enabled": true,"created_at": "2020-06-20T08:07:29","updated_at": "2020-06-20T08:07:29"}]} 请求异常时,错误码请参见错误码。 查询当前已有的安全组信息。 发送“GET https://VPC的Endpoint/v1/{project_id}/security-groups”,project_id为项目ID。 在Request Header中增加“X-Auth-Token”。 查看请求响应结果。 请求成功时,响应参数如下,id就是security_group_id。 {"security_groups": [{"id": "16b6e77a-08fa-42c7-aa8b-106c048884e6","name": "qq","description": "qq","vpc_id": "3ec3b33f-ac1c-4630-ad1c-7dba1ed79d85","enterprise_project_id ": "0aad99bc-f5f6-4f78-8404-c598d76b0ed2","security_group_rules": [{"direction": "egress","ethertype": "IPv4","id": "369e6499-b2cb-4126-972a-97e589692c62","description": "","security_group_id": "16b6e77a-08fa-42c7-aa8b-106c048884e6"}, {"direction": "ingress","ethertype": "IPv4","id": "0222556c-6556-40ad-8aac-9fd5d3c06171","description": "","remote_group_id": "16b6e77a-08fa-42c7-aa8b-106c048884e6","security_group_id": "16b6e77a-08fa-42c7-aa8b-106c048884e6"}]}, {"id": "9c0f56be-a9ac-438c-8c57-fce62de19419","name": "default","description": "qq","vpc_id": "13551d6b-755d-4757-b956-536f674975c0","enterprise_project_id ": "0","security_group_rules": [{"direction": "egress","ethertype": "IPv4","id": "95479e0a-e312-4844-b53d-a5e4541b783f","description": "","security_group_id": "9c0f56be-a9ac-438c-8c57-fce62de19419"}, {"direction": "ingress","ethertype": "IPv4","id": "0c4a2336-b036-4fa2-bc3c-1a291ed4c431","description": "","remote_group_id": "9c0f56be-a9ac-438c-8c57-fce62de19419","security_group_id": "9c0f56be-a9ac-438c-8c57-fce62de19419"}]}]} 请求异常时,错误码请参见错误码。 为弹性云服务器添加安全组。 发送“PUT https://VPC的Endpoint/v1/{project_id}/ports/{port_id}”,project_id为项目ID。 在Request Header中增加“X-Auth-Token”。 在Request Body中传入参数如下: { "port": { "security_groups": ["9c0f56be-a9ac-438c-8c57-fce62de19419","16b6e77a-08fa-42c7-aa8b-106c048884e6"] }} 查看请求响应结果。 请求成功时,响应参数如下,id就是port_id。 {"port": {"id": "02c72193-efec-42fb-853b-c33f2b802467","name": "","status": "ACTIVE","admin_state_up": true,"fixed_ips": [{"subnet_id": "213cb9d-3122-2ac1-1a29-91ffc1231a12","ip_address": "192.168.0.75"}],"mac_address": "fa:16:3e:47:5f:c1","network_id": "4779ab1c-7c1a-44b1-a02e-93dfc361b32d","tenant_id": "db82c9e1415a464ea68048baa8acc6b8","project_id": "db82c9e1415a464ea68048baa8acc6b8","device_id": "ea61f836-b52f-41bf-9d06-685644001d6f","device_owner": "compute:br-iaas-odin1a","security_groups": ["9c0f56be-a9ac-438c-8c57-fce62de19419", "16b6e77a-08fa-42c7-aa8b-106c048884e6"],"extra_dhcp_opts": [],"allowed_address_pairs": [{"ip_address": "1.1.1.1/0"}],"binding:vnic_type": "normal","binding:vif_details": {"primary_interface": true},"binding:profile": {},"port_security_enabled": true,"created_at": "2020-06-20T08:07:29","updated_at": "2020-06-20T08:07:29"}} 请求异常时,错误码请参见错误码。
共100000条