华为云用户手册

  • 响应参数 表2 响应参数 参数名称 类型 说明 ports Array of port objects port对象列表,参见表3。 ports_links Array of ports_link objects 分页信息,参见表9。 只有在使用limit过滤,并且资源个数超过limit或者资源个数超过2000时(limit默认值),该参数的rel和href取值才会显示为next和其对应的link。 表3 port对象 属性 类型 说明 id String 功能说明:端口的ID,最大长度不超过255。 使用说明:在查询端口列表时非必选。 name String 端口的名称。 network_id String 所属网络的ID。 admin_state_up Boolean 功能说明:端口的管理状态。 使用说明:默认为true。 mac_address String 功能说明:端口MAC地址,例如:"mac_address": "fa:16:3e:9e:ff:55"。 使用说明:只支持系统动态分配,不支持指定。 fixed_ips Array of fixed_ip objects 功能说明:端口IP,参见表4。 例如,"fixed_ips": [{"subnet_id": "4dc70db6-cb7f-4200-9790-a6a910776bba", "ip_address": "192.169.25.79"}], "fixed_ips": [{"subnet_id": "1fd001aa-6946-4168-86d9-924c7d3ef8fb", "ip_address": "2a07:b980:4030:14::1"}] device_id String 功能说明:设备ID。 使用说明:不支持设置和更新,由系统自动维护,该字段非空的端口不允许删除。 device_owner String 功能说明:设备所属(DHCP/Router/ Nova等)。 取值范围:network:dhcp,network:router_interface_distributed,compute:xxx(xxx对应具体的可用区名称,例如compute:aa-bb-cc表示是被可用区aa-bb-cc上的E CS 使用),neutron:VIP_PORT,neutron:LOADBALANCERV2,neutron:LOADBALANCERV3,network:endpoint_interface,network:nat_gateway,network:ucmp。 使用说明: 不支持更新,只允许用户在创建虚拟IP端口时,为虚拟IP端口设置device_owner为neutron:VIP_PORT,当端口的该字段不为空时,仅支持该字段为neutron:VIP_PORT时的端口删除。 该字段非空的端口不允许删除。 tenant_id String 项目ID。 status String 功能说明:端口状态。 取值范围:ACTIVE,BUILD,DOWN。 使用说明:Hana硬直通虚拟机端口状态总为DOWN。 security_groups Array of strings 功能说明:扩展属性,安全组的UUID,例如:"security_groups": ["a0608cbf-d047-4f54-8b28-cd7b59853fff"]。 使用说明:不支持更新为空。 allowed_address_pairs Array of allowed_address_pairs objects 功能说明:扩展属性,IP/Mac对列表,allow_address_pair参见表5。 使用说明: IP地址不允许为 “0.0.0.0/0” 如果allowed_address_pairs配置地址池较大的CIDR(掩码小于24位),建议为该port配置一个单独的安全组 如果allowed_address_pairs的IP地址为“1.1.1.1/0”,表示关闭源目的地址检查开关。 硬件SDN环境不支持ip_address属性配置为CIDR格式 为虚拟IP配置后端ECS场景,allowed_address_pairs中配置的IP地址,必须为ECS网卡已有的IP地址,否则可能会导致虚拟IP通信异常。 被绑定的云服务器网卡allowed_address_pairs的IP地址填“1.1.1.1/0”。 extra_dhcp_opts Array of extra_dhcp_opt objects 扩展属性,DHCP的扩展Option,参见表6。 binding:vif_details binding:vif_details object vif的详细信息,参见表7 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功能不生效。 仅对于“华北-北京二”:udp_srvports和tcp_srvports,字段,字符串类型,默认不设置udp_srvports和tcp_srvports字段。允许指定udp_srvports和tcp_srvports字段为端口号,表示这些端口的tcp报文和udp报文可支持高并发连接,但是此类报文不受ACL和安全组规则的限制。udp_srvports和tcp_srvports字段同时支持更新操作。 【格式】 {"tcp_srvports": "port1 port2 port3", "udp_srvports": "port1 port2 port3"} 端口号之间以空格间隔,最多允许指定的端口号总共为15个,端口号范围是1到65535。 【示例】 {"tcp_srvports": "80 443", "udp_srvports": "53"} 示例表示入方向目的端口为80或者443的tcp报文可支持高并发连接。入方向目的端口为53的udp报文可支持高并发连接。但是此类报文不受ACL和安全组规则的限制。 binding:vnic_type String 功能说明:绑定的vNIC类型。 取值范围: normal: 软交换。 port_security_enabled Boolean 端口安全使能标记。 取值范围:true,允许加入安全组和开启dhcp防欺骗;false,安全组和dhcp防欺骗不生效。 dns_assignment Array of dns_assignment objects 功能说明:扩展属性,主网卡默认内网 域名 信息。 使用说明:不支持设置和更新,由系统自动维护。 取值范围: hostname:与端口dns_name一致。 ip_address:端口ipv4私有地址。 fqdn:为端口创建默认内网fqdn。 dns_name String 功能说明:扩展属性,主网卡默认内网DNS名称。 使用说明:不支持设置和更新,由系统自动维护,访问该默认内网域名前,请确保子网使用当前系统提供的DNS。 project_id String 项目ID,请参见获取项目ID。 created_at String 功能说明:资源创建时间,UTC时间。 格式:yyyy-MM-ddTHH:mm:ss。 updated_at String 功能说明:资源更新时间,UTC时间。 格式:yyyy-MM-ddTHH:mm:ss。 表4 fixed_ip对象 属性 类型 说明 subnet_id String 功能说明:所属子网ID。 使用说明:不支持更新。 ip_address String 功能说明:端口IP地址。 使用说明:不支持更新。 表5 allowed_address_pairs对象 名称 是否必选 参数类型 说明 ip_address 是 String 功能说明:IP地址。 约束:不支持0.0.0.0/0。 如果allowed_address_pairs配置地址池较大的CIDR(掩码小于24位),建议为该port配置一个单独的安全组。 如果allowed_address_pairs的IP地址为“1.1.1.1/0”,表示关闭源目的地址检查开关。 被绑定的云服务器网卡allowed_address_pairs的IP地址填“1.1.1.1/0”。 如果填写allowed_address_pairs参数,则ip_address是必选参数。 mac_address 否 String MAC地址。默认使用当前端口的MAC地址。 表6 extra_dhcp_opt对象 属性 类型 说明 opt_name String Option名称。 opt_value String Option值。 表7 binding:vif_details对象 名称 参数类型 说明 primary_interface Boolean 取值为true,表示是虚拟机的主网卡。 port_filter Boolean 表示该网络服务提供端口过滤特性,如安全组和反MAC/IP欺骗。 ovs_hybrid_plug Boolean 用于通知像nova这样的API消费者,应该使用OVS的混合插入策略。 表8 dns_assignment对象 名称 参数类型 说明 hostname String 端口hostname。 ip_address String 端口IP地址。 fqdn String 端口内网fqdn。 表9 ports_link对象 名称 参数类型 说明 href String API链接。 rel String API链接与该API版本的关系。
  • URI GET /v2.0/ports 样例: GET https://{Endpoint}/v2.0/ports?id={port_id}&name={port_name}&admin_state_up={is_admin_status_up}&network_id={network_id}&mac_address={port_mac}&device_id={port_device_id}&device_owner={device_owner}&tenant_id={tenant_id}&status={port_status}&fixed_ips=ip_address={ip_address}&fixed_ips=subnet_id={subnet_id}&dns_name={dns_name} 分页查询样例: GET https://{Endpoint}/v2.0/ports?limit=2&marker=791870bd-36a7-4d9b-b015-a78e9b06af08&page_reverse=False
  • 响应示例 状态码:200 GET操作正常返回,更多状态码请参见状态码。 { "firewall" : { "id" : "e9a7731d-5bd9-4250-a524-b9a076fd5629", "name" : "network_acl_test1", "description" : "network_acl_test1", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "created_at" : "2022-04-07T07:30:46.000+00:00", "updated_at" : "2022-04-07T07:30:46.000+00:00", "admin_state_up" : true, "enterprise_project_id" : "158ad39a-dab7-45a3-9b5a-2836b3cf93f9", "status" : "ACTIVE", "tags" : [ ], "ingress_rules" : [ { "id" : "e9a7731d-5bd9-4250-a524-b9a076fd5629", "name" : "network_acl_rule test", "description" : "network_acl_rule test", "action" : "allow", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "protocol" : "tcp", "ip_version" : 4, "source_ip_address" : "192.168.3.0/24", "destination_ip_address" : "192.168.6.0/24", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90" } ], "egress_rules" : [ { "id" : "e9a7731d-5bd9-4250-a524-b9a076fd5629", "name" : "network_acl_rule test", "description" : "network_acl_rule test", "action" : "allow", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "protocol" : "tcp", "ip_version" : 4, "source_ip_address" : "192.168.3.0/24", "destination_ip_address" : "192.168.6.0/24", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90" } ], "associations" : [ { "virsubnet_id" : "8359e5b0-353f-4ef3-a071-98e67a34a143" } ] } }
  • 请求示例 过滤查询ACL资源实例数量,用tags和matches过滤。 POST https://{{Endpoint}}/v3/{project_id}/firewalls/resource-instances/count { "tags" : [ { "key" : "key1", "values" : [ "value1" ] } ], "matches" : [ { "key" : "resource_name", "value" : "network_aclv3_test" } ] }
  • 响应参数 状态码:200 表5 响应Body参数 参数 参数类型 描述 request_id String 请求ID total_count Integer 资源数量 状态码:400 表6 响应Body参数 参数 参数类型 描述 request_id String 请求ID。 error_msg String 错误消息。 error_code String 错误码。 状态码:401 表7 响应Body参数 参数 参数类型 描述 request_id String 请求ID。 error_msg String 错误消息。 error_code String 错误码。 状态码:403 表8 响应Body参数 参数 参数类型 描述 request_id String 请求ID。 error_msg String 错误消息。 error_code String 错误码。 状态码:404 表9 响应Body参数 参数 参数类型 描述 request_id String 请求ID。 error_msg String 错误消息。 error_code String 错误码。 状态码:500 表10 响应Body参数 参数 参数类型 描述 request_id String 请求ID。 error_msg String 错误消息。 error_code String 错误码。
  • 请求参数 表2 请求Body参数 参数 是否必选 参数类型 描述 matches 否 Array of Match objects 功能说明:搜索字段,key为要匹配的字段,value为匹配的值 约束:key为固定字典值,不能包含重复的key或不支持的key,当前key仅支持resource_name tags 否 Array of ListTag objects 包含标签,最多包含50个key,每个key下面的value最多10个,每个key对应的value可以为空数组但结构体不能缺失 。 Key不能重复,同一个key中values不能重复。 结果返回包含所有标签的资源列表,key之间是与的关系,key-value结构中value是或的关系。无tag过滤条件时返回全量数据。 表3 Match 参数 是否必选 参数类型 描述 key 是 String 键。当前仅限定为resource_name 最小长度:1 最大长度:128 value 是 String 值。每个值最大长度255个unicode字符. 最小长度:0 最大长度:255 表4 ListTag 参数 是否必选 参数类型 描述 key 是 String 功能说明:标签键 约束:key不能为空 最小长度:1 最大长度:128 values 是 Array of strings 功能描述:标签值列表。 如果values为空列表,则表示any_value(查询任意value)。value之间为或的关系。 最大长度:255
  • 响应示例 状态码:200 PUT操作正常返回,更多状态码请参见状态码。 { "firewall" : { "id" : "e9a7731d-5bd9-4250-a524-b9a076fd5629", "name" : "network_acl_test1", "description" : "network_acl_test1", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "created_at" : "2022-04-07T07:30:46.000+00:00", "updated_at" : "2022-04-07T07:30:46.000+00:00", "admin_state_up" : true, "enterprise_project_id" : "158ad39a-dab7-45a3-9b5a-2836b3cf93f9", "status" : "ACTIVE", "tags" : [ ], "ingress_rules" : [ { "id" : "e9a7731d-5bd9-4250-a524-b9a076fd5629", "name" : "network_acl_rule test2", "description" : "network_acl_rule test2", "action" : "allow", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "protocol" : "tcp", "ip_version" : 4, "source_ip_address" : "192.168.3.0/24", "destination_ip_address" : "192.168.6.0/24", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90" } ], "egress_rules" : [ { "id" : "f9a7731d-5bd9-4250-a524-b9a076fd5629", "name" : "network_acl_rule test", "description" : "network_acl_rule test", "action" : "allow", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "protocol" : "tcp", "ip_version" : 4, "source_ip_address" : "192.168.3.0/24", "destination_ip_address" : "192.168.6.0/24", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90" } ], "associations" : [ { "virsubnet_id" : "8359e5b0-353f-4ef3-a071-98e67a34a143" } ] } }
  • 请求示例 在id为e9a7731d-5bd9-4250-a524-b9a076fd5629的网络ACL中更新入方向规则e9a7731d-5bd9-4250-a524-b9a076fd5629。 PUT https://{Endpoint}/v3/{project_id}/vpc/firewalls/e9a7731d-5bd9-4250-a524-b9a076fd5629/update-rules { "firewall" : { "ingress_rules" : [ { "id" : "e9a7731d-5bd9-4250-a524-b9a076fd5629", "name" : "network_acl_rule test2", "description" : "network_acl_rule test2", "action" : "allow", "protocol" : "tcp", "ip_version" : "4", "source_ip_address" : "192.168.3.0/24", "destination_ip_address" : "192.168.6.0/24", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90", "source_address_group_id" : null, "destination_address_group_id" : null } ] } }
  • 响应示例 状态码:200 操作正常返回 { "request_id" : "65ae533b-f32c-49df-9b5d-e55eda8f2c25", "tags" : [ { "key" : "key1", "values" : [ "value1", "value2" ] }, { "key" : "key2", "values" : [ "value2" ] }, { "key" : "key3", "values" : [ "value3" ] }, { "key" : "key4", "values" : [ "value4" ] }, { "key" : "key5", "values" : [ "value5" ] }, { "key" : "keyyyy", "values" : [ "value2" ] } ] }
  • URI GET /v3/{project_id}/firewalls/tags 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目ID 表2 Query参数 参数 是否必选 参数类型 描述 limit 否 Integer 功能说明:查询记录数 最小值:1 最大值:1000 缺省值:1000 offset 否 Integer 功能说明:索引位置, 从第一条数据偏移offset条数据后开始查询 约束:默认为0(偏移0条数据,表示从第一条数据开始查询),必须为数字,不能为负数 缺省值:0
  • 响应参数 状态码:200 表3 响应Body参数 参数 参数类型 描述 tags Array of ListTag objects tag对象列表 request_id String 请求ID total_count Integer 资源数量 表4 ListTag 参数 参数类型 描述 key String 功能说明:标签键 约束:key不能为空 最小长度:1 最大长度:128 values Array of strings 功能描述:标签值列表。 如果values为空列表,则表示any_value(查询任意value)。value之间为或的关系。 最大长度:255 状态码:400 表5 响应Body参数 参数 参数类型 描述 request_id String 请求ID。 error_msg String 错误消息。 error_code String 错误码。 状态码:401 表6 响应Body参数 参数 参数类型 描述 request_id String 请求ID。 error_msg String 错误消息。 error_code String 错误码。 状态码:403 表7 响应Body参数 参数 参数类型 描述 request_id String 请求ID。 error_msg String 错误消息。 error_code String 错误码。 状态码:404 表8 响应Body参数 参数 参数类型 描述 request_id String 请求ID。 error_msg String 错误消息。 error_code String 错误码。 状态码:500 表9 响应Body参数 参数 参数类型 描述 request_id String 请求ID。 error_msg String 错误消息。 error_code String 错误码。
  • 请求参数 表2 请求Body参数 参数 是否必选 参数类型 描述 firewall 是 FirewallRemoveRuleOption object ACL要删除的入方向或出方向规则列表。 表3 FirewallRemoveRuleOption 参数 是否必选 参数类型 描述 ingress_rules 否 Array of FirewallRemoveRuleItemOption objects 功能说明:ACL删除入方向规则列表。 约束:ingress_rules和egress_rules仅能同时设置一个。 egress_rules 否 Array of FirewallRemoveRuleItemOption objects 功能说明:ACL删除出方向规则列表。 约束:ingress_rules和egress_rules仅能同时设置一个。 表4 FirewallRemoveRuleItemOption 参数 是否必选 参数类型 描述 id 是 String 功能说明:要删除的ACL规则id。
  • 请求示例 移除id为e9a7731d-5bd9-4250-a524-b9a076fd5629的网络ACL中的一条入方向规则,移除的规则id为e9a7731d-5bd9-4250-a524-b9a076fd5629。 PUT /v3/{project_id}/vpc/firewalls/e9a7731d-5bd9-4250-a524-b9a076fd5629/remove-rules { "firewall" : { "ingress_rules" : [ { "id" : "e9a7731d-5bd9-4250-a524-b9a076fd5629" } ] } }
  • 响应示例 状态码:200 PUT操作正常返回,更多状态码请参见状态码。 { "firewall" : { "id" : "e9a7731d-5bd9-4250-a524-b9a076fd5629", "name" : "network_acl_test1", "description" : "network_acl_test1", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "created_at" : "2022-04-07T07:30:46.000+00:00", "updated_at" : "2022-04-07T07:30:46.000+00:00", "admin_state_up" : true, "enterprise_project_id" : "158ad39a-dab7-45a3-9b5a-2836b3cf93f9", "status" : "ACTIVE", "tags" : [ ], "ingress_rules" : [ ], "egress_rules" : [ { "id" : "f9a7731d-5bd9-4250-a524-b9a076fd5629", "name" : "network_acl_rule test", "description" : "network_acl_rule test", "action" : "allow", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "protocol" : "tcp", "ip_version" : 4, "source_ip_address" : "192.168.3.0/24", "destination_ip_address" : "192.168.6.0/24", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90" } ], "associations" : [ { "virsubnet_id" : "8359e5b0-353f-4ef3-a071-98e67a34a143" } ] } }
  • 响应示例 状态码:200 PUT操作正常返回,更多状态码请参见状态码。 { "firewall" : { "id" : "e9a7731d-5bd9-4250-a524-b9a076fd5629", "name" : "network_acl_test1", "description" : "network_acl_test1", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "created_at" : "2022-04-07T07:30:46.000+00:00", "updated_at" : "2022-04-07T07:30:46.000+00:00", "admin_state_up" : true, "enterprise_project_id" : "158ad39a-dab7-45a3-9b5a-2836b3cf93f9", "status" : "ACTIVE", "tags" : [ ], "ingress_rules" : [ { "id" : "e9a7731d-5bd9-4250-a524-b9a076fd5629", "name" : "network_acl_rule test", "description" : "network_acl_rule test", "action" : "allow", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "protocol" : "tcp", "ip_version" : 4, "source_ip_address" : "192.168.3.0/24", "destination_ip_address" : "192.168.6.0/24", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90" } ], "egress_rules" : [ { "id" : "e9a7731d-5bd9-4250-a524-b9a076fd5629", "name" : "network_acl_rule test", "description" : "network_acl_rule test", "action" : "allow", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "protocol" : "tcp", "ip_version" : 4, "source_ip_address" : "192.168.3.0/24", "destination_ip_address" : "192.168.6.0/24", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90" } ], "associations" : [ { "virsubnet_id" : "8359e5b0-353f-4ef3-a071-98e67a34a143" } ] } }
  • 请求参数 表2 请求Body参数 参数 是否必选 参数类型 描述 subnets 是 Array of FirewallAssociation objects 绑定ACL的子网列表。 表3 FirewallAssociation 参数 是否必选 参数类型 描述 virsubnet_id 是 String 功能说明:ACL绑定的子网ID。 约束:ACL的type为normal,只支持绑定普通子网;ACL的type为clouddcn,只支持绑定clouddcn子网。
  • 请求示例 绑定网络ACL e9a7731d-5bd9-4250-a524-b9a076fd5629和子网 8359e5b0-353f-4ef3-a071-98e67a34a143。 PUT https://{Endpoint}/v3/{project_id}/vpc/firewalls/e9a7731d-5bd9-4250-a524-b9a076fd5629/associate-subnets { "subnets" : [ { "virsubnet_id" : "8359e5b0-353f-4ef3-a071-98e67a34a143" } ] }
  • 请求示例 更新id为e9a7731d-5bd9-4250-a524-b9a076fd5629的网络ACL,名称更新为network_acl_test1,描述更新为network_acl_test1,开启网络ACL。 PUT https://{Endpoint}/v3/9476ea5a8a9849c38358e43c0c3a9e12/vpc/firewalls/e9a7731d-5bd9-4250-a524-b9a076fd5629 { "firewall" : { "name" : "network_acl_test1", "description" : "network_acl_test1", "admin_state_up" : true } }
  • 响应示例 状态码:200 PUT操作正常返回,更多状态码请参见状态码。 { "firewall" : { "id" : "e9a7731d-5bd9-4250-a524-b9a076fd5629", "name" : "network_acl_test1", "description" : "network_acl_test1", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "created_at" : "2022-04-07T07:30:46.000+00:00", "updated_at" : "2022-04-07T07:30:46.000+00:00", "admin_state_up" : true, "enterprise_project_id" : "158ad39a-dab7-45a3-9b5a-2836b3cf93f9", "status" : "ACTIVE", "tags" : [ ], "ingress_rules" : [ { "id" : "e9a7731d-5bd9-4250-a524-b9a076fd5629", "name" : "network_acl_rule test", "description" : "network_acl_rule test", "action" : "allow", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "protocol" : "tcp", "ip_version" : 4, "source_ip_address" : "192.168.3.0/24", "destination_ip_address" : "192.168.6.0/24", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90" } ], "egress_rules" : [ { "id" : "f9a7731d-5bd9-4250-a524-b9a076fd5629", "name" : "network_acl_rule test", "description" : "network_acl_rule test", "action" : "allow", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "protocol" : "tcp", "ip_version" : 4, "source_ip_address" : "192.168.3.0/24", "destination_ip_address" : "192.168.6.0/24", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90" } ], "associations" : [ { "virsubnet_id" : "8359e5b0-353f-4ef3-a071-98e67a34a143" } ] } }
  • 响应参数 表3 响应参数 参数名称 类型 说明 security_group_rule security_group_rule object security group rule对象。请参见表4。 表4 Security Group Rule对象 属性 类型 说明 id String 安全组规则id。 使用说明:查询安全组规则非必选。 description String 安全组规则描述。 security_group_id String 所属安全组id。 remote_group_id String 所属安全组的对端id。 direction String 安全组规则方向。 remote_ip_prefix String 对端ip网段。 protocol String 协议类型或直接指定IP协议号。 port_range_max Integer 功能说明:最大端口,当协议类型为ICMP时,该值表示ICMP的code。 取值范围:1-65535(当表示code时为0-255)。 port_range_min Integer 功能说明:最小端口,当协议类型为ICMP时,该值表示ICMP的type。 约束: protocol为tcp和udp时,port_range_max和port_range_min必须同时输入,且port_range_max应大于等于port_range_min。 protocol为icmp时,指定ICMP code(port_range_max)时,必须同时指定ICMP type(port_range_min)。 ethertype String 功能说明:IP地址协议类型。 取值范围:支持IPv4,IPv6 tenant_id String 项目ID remote_address_group_id String 功能说明:远端IP地址组ID。 约束:和remote_ip_prefix,remote_group_id功能互斥。 project_id String 项目ID,请参见获取项目ID。 created_at String 功能说明:安全组规则创建时间 取值范围:UTC时间格式,yyyy-MM-ddTHH:mm:ssZ updated_at String 功能说明:安全组规则更新时间 取值范围:UTC时间格式,yyyy-MM-ddTHH:mm:ssZ
  • 响应示例 { "security_group_rule": { "remote_group_id": null, "direction": "egress", "remote_ip_prefix": "10.10.0.0/24", "protocol": "tcp", "tenant_id": "6fbe9263116a4b68818cf1edce16bc4f", "port_range_max": null, "security_group_id": "5cb9c1ee-00e0-4d0f-9623-55463cd26ff8", "port_range_min": null, "ethertype": "IPv4", "description": null, "id": "7c336b04-1603-4911-a6f4-f2af1d9a0488", "project_id": "6fbe9263116a4b68818cf1edce16bc4f", "created_at": "2018-09-20T02:15:34", "updated_at": "2018-09-20T02:15:34", "remote_address_group_id": null } }
  • 请求参数 表1 请求参数 参数名称 类型 必选 说明 security_group_rule security_group_rule object 是 security group rule对象。请参见表2。 表2 Security Group Rule对象 属性 是否必选 类型 说明 description 否 String 安全组规则描述。 security_group_id 是 String 所属安全组id。 remote_group_id 否 String 功能说明:所属安全组的对端id。 使用说明:和remote_ip_prefix,remote_address_group_id参数互斥。 direction 是 String 安全组规则方向。 取值范围:ingress表示入方向,egress表示出方向。 remote_ip_prefix 否 String 功能说明:对端ip网段。 使用说明:和remote_group_id,remote_address_group_id参数互斥。 protocol 否 String 功能说明:协议类型或直接指定IP协议号。 取值范围:tcp/udp/icmp或IP协议号。 port_range_max 否 Integer 功能说明:最大端口,当协议类型为ICMP时,该值表示ICMP的code。 取值范围:1-65535(当表示code时为0-255)。 port_range_min 否 Integer 功能说明:最小端口,当协议类型为ICMP时,该值表示ICMP的type。 约束: protocol为tcp和udp时,port_range_max和port_range_min必须同时输入,且port_range_max应大于等于port_range_min。 protocol为icmp时,指定ICMP code(port_range_max)时,必须同时指定ICMP type(port_range_min) 取值范围:1-65535(当表示code时为0-255) ethertype 否 String 功能说明:网络类型。 取值范围:IPv4/IPv6 remote_address_group_id 否 String 功能说明:远端IP地址组ID。您可以登录管理控制台,在IP地址组页面查看该ID。 约束:和remote_ip_prefix,remote_group_id功能互斥。
  • 请求示例 创建出方向安全组规则,所在安全组id为5cb9c1ee-00e0-4d0f-9623-55463cd26ff8,协议为tcp,对端ip为10.10.0.0/24。 POST https://{Endpoint}/v2.0/security-group-rules { "security_group_rule": { "security_group_id": "5cb9c1ee-00e0-4d0f-9623-55463cd26ff8", "direction": "egress", "protocol": "tcp", "remote_ip_prefix": "10.10.0.0/24" } }
  • 响应参数 状态码:200 表6 响应Body参数 参数 参数类型 描述 resources Array of ListResourceResp objects 资源列表 total_count Integer 资源数量 request_id String 请求ID 表7 ListResourceResp 参数 参数类型 描述 resource_id String 资源ID resource_detail Object 资源详情。 资源对象,用于扩展。默认为空 resource_name String 资源名称,资源没有名称时默认为空字符串. tags Array of ResourceTag objects 标签列表,没有标签默认为空数组 表8 ResourceTag 参数 参数类型 描述 key String 功能说明:标签键。 约束:同一资源的key值不能重复。 取值范围:1-128个字符。 最小长度:1 最大长度:128 value String 功能说明:标签值。 取值范围:0-255个字符。 最大长度:255 状态码:400 表9 响应Body参数 参数 参数类型 描述 request_id String 请求ID。 error_msg String 错误消息。 error_code String 错误码。 状态码:401 表10 响应Body参数 参数 参数类型 描述 request_id String 请求ID。 error_msg String 错误消息。 error_code String 错误码。 状态码:403 表11 响应Body参数 参数 参数类型 描述 request_id String 请求ID。 error_msg String 错误消息。 error_code String 错误码。 状态码:404 表12 响应Body参数 参数 参数类型 描述 request_id String 请求ID。 error_msg String 错误消息。 error_code String 错误码。 状态码:500 表13 响应Body参数 参数 参数类型 描述 request_id String 请求ID。 error_msg String 错误消息。 error_code String 错误码。
  • 响应示例 状态码:200 请求正常返回 { "resources" : [ { "resource_id" : "55046c0b-f38e-4bc4-988a-06529b34a7db", "resource_detail" : "", "resource_name" : "network_aclv3_test", "tags" : [ { "key" : "key1", "value" : "value1" }, { "key" : "key2", "value" : "value2" } ] }, { "resource_id" : "1828c600-793d-4570-987b-ac59f3ef0734", "resource_detail" : "", "resource_name" : "network_aclv3_test", "tags" : [ { "key" : "key1", "value" : "value1" }, { "key" : "key5", "value" : "value5" } ] } ], "request_id" : "2d9cef8c-4e17-40bc-9111-f3fc97b97294", "total_count" : 2 }
  • 请求示例 过滤查询ACL资源实例列表,用tags和matches过滤,限制返回100条数据,从第1条数据开始查询。 https://{{Endpoint}}/v3/{project_id}/firewalls/resource-instances/filter?limit=100&offset=0 { "tags" : [ { "key" : "key1", "values" : [ "value1" ] } ], "matches" : [ { "key" : "resource_name", "value" : "network_aclv3_test" } ] }
  • URI POST /v3/{project_id}/firewalls/resource-instances/filter 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目ID 表2 Query参数 参数 是否必选 参数类型 描述 limit 否 Integer 功能说明:查询记录数 取值范围:1-1000 约束:默认为1000 缺省值:1000 offset 否 Integer 功能说明:索引位置, 从第一条数据偏移offset条数据后开始查询 约束:默认为0(偏移0条数据,表示从第一条数据开始查询),必须为数字,不能为负数 缺省值:0
  • 请求参数 表3 请求Body参数 参数 是否必选 参数类型 描述 matches 否 Array of Match objects 功能说明:搜索字段,key为要匹配的字段,value为匹配的值 约束:key为固定字典值,不能包含重复的key或不支持的key,当前key仅支持resource_name tags 否 Array of ListTag objects 包含标签,最多包含50个key,每个key下面的value最多10个,每个key对应的value可以为空数组但结构体不能缺失 。 Key不能重复,同一个key中values不能重复。 结果返回包含所有标签的资源列表,key之间是与的关系,key-value结构中value是或的关系。无tag过滤条件时返回全量数据。 表4 Match 参数 是否必选 参数类型 描述 key 是 String 键。当前仅限定为resource_name 最小长度:1 最大长度:128 value 是 String 值。每个值最大长度255个unicode字符. 最小长度:0 最大长度:255 表5 ListTag 参数 是否必选 参数类型 描述 key 是 String 功能说明:标签键 约束:key不能为空 最小长度:1 最大长度:128 values 是 Array of strings 功能描述:标签值列表。 如果values为空列表,则表示any_value(查询任意value)。value之间为或的关系。 最大长度:255
  • 响应示例 状态码:200 PUT操作正常返回,更多状态码请参见状态码。 { "firewall" : { "id" : "e9a7731d-5bd9-4250-a524-b9a076fd5629", "name" : "network_acl_test1", "description" : "network_acl_test1", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "created_at" : "2022-04-07T07:30:46.000+00:00", "updated_at" : "2022-04-07T07:30:46.000+00:00", "admin_state_up" : true, "enterprise_project_id" : "158ad39a-dab7-45a3-9b5a-2836b3cf93f9", "status" : "ACTIVE", "tags" : [ ], "ingress_rules" : [ { "id" : "e9a7731d-5bd9-4250-a524-b9a076fd5629", "name" : "network_acl_rule test", "description" : "network_acl_rule test", "action" : "allow", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "protocol" : "tcp", "ip_version" : 4, "source_ip_address" : "192.168.3.0/24", "destination_ip_address" : "192.168.6.0/24", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90" } ], "egress_rules" : [ { "id" : "f9a7731d-5bd9-4250-a524-b9a076fd5629", "name" : "network_acl_rule test", "description" : "network_acl_rule test", "action" : "allow", "project_id" : "9476ea5a8a9849c38358e43c0c3a9e12", "protocol" : "tcp", "ip_version" : 4, "source_ip_address" : "192.168.3.0/24", "destination_ip_address" : "192.168.6.0/24", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90" } ], "associations" : [ { "virsubnet_id" : "8359e5b0-353f-4ef3-a071-98e67a34a143" } ] } }
  • 请求示例 插入一条入方向规则到id为e9a7731d-5bd9-4250-a524-b9a076fd5629的网络ACL中,插入到规则e9a7731d-5bd9-4250-a524-b9a076fd5630后面。 PUT https://{Endpoint}/v3/{project_id}/vpc/firewalls/e9a7731d-5bd9-4250-a524-b9a076fd5629/insert-rules { "firewall" : { "ingress_rules" : [ { "name" : "network_acl_rule test", "description" : "network_acl_rule test", "action" : "allow", "protocol" : "tcp", "ip_version" : "4", "source_ip_address" : "192.168.3.0/24", "destination_ip_address" : "192.168.6.0/24", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90", "source_address_group_id" : null, "destination_address_group_id" : null } ], "insert_after_rule" : "e9a7731d-5bd9-4250-a524-b9a076fd5630" } } 插入一条出方向规则到id为e9a7731d-5bd9-4250-a524-b9a076fd5629的网络ACL中,插入到规则e9a7731d-5bd9-4250-a524-b9a076fd5630之后。 PUT https://{Endpoint}/v3/{project_id}/vpc/firewalls/e9a7731d-5bd9-4250-a524-b9a076fd5629/insert-rules { "firewall" : { "egress_rules" : [ { "name" : "network_acl_rule test", "description" : "network_acl_rule test", "action" : "allow", "protocol" : "tcp", "ip_version" : "4", "source_ip_address" : "192.168.3.0/24", "destination_ip_address" : "192.168.6.0/24", "source_port" : "30-40,60-90", "destination_port" : "40-60,70-90", "source_address_group_id" : null, "destination_address_group_id" : null } ], "insert_after_rule" : "e9a7731d-5bd9-4250-a524-b9a076fd5630" } }
共100000条
提示

您即将访问非华为云网站,请注意账号财产安全