更新时间:2024-01-02 GMT+08:00
分享

创建边缘安全组

功能介绍

根据用户的请求内容,创建对应的安全组。

调试

您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。

URI

POST /v1/security-groups

请求参数

表1 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token。

通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

表2 请求Body参数

参数

是否必选

参数类型

描述

security_group

CreateSecurityGroupOption object

创建安全组参数。

表3 CreateSecurityGroupOption

参数

是否必选

参数类型

描述

name

String

安全组的名称。

最小长度:1

最大长度:64

description

String

安全组的描述。非必填项,默认值为空。

最小长度:0

最大长度:64

响应参数

状态码: 200

表4 响应Body参数

参数

参数类型

描述

security_group

SecurityGroup object

安全组对象。

表5 SecurityGroup

参数

参数类型

描述

id

String

安全组的ID。UUID

name

String

安全组的名称。

最小长度:1

最大长度:64

description

String

安全组的描述。

最小长度:0

最大长度:64

security_group_rules

Array of SecurityGroupRule objects

安全组规则列表。

表6 SecurityGroupRule

参数

参数类型

描述

id

String

安全组规则的ID。

description

String

安全组规则描述信息。

最小长度:0

最大长度:64

security_group_id

String

安全组ID。

direction

String

出入控制方向。

取值范围:

  • egress:出方向

  • ingress:入方向

ethertype

String

IP协议类型。

取值范围:IPv4,IPv6

约束:不填默认值为IPv4

protocol

String

协议类型。

取值范围:icmp、tcp、udp、icmpv6等

约束:为空表示支持所有协议

port_range_min

String

起始端口值。

取值范围:1~65535

约束:取值不能大于port_range_max的值,为空表示所有端口

port_range_max

String

结束端口值。

取值范围:1~65535

约束:取值不能小于port_range_min的值,为空表示所有端口。

remote_group_id

String

对端安全组ID。

约束:和remote_ip_prefix互斥 ,remote_group_id与remote_ip_prefix必须存在一个

remote_ip_prefix

String

远端IP地址,当direction是egress时为虚拟机访问端的地址,当direction是ingress时为访问虚拟机的地址。

取值范围:IP地址,或者cidr格式

约束:和remote_group_id互斥

action

String

安全组规则生效策略 取值范围:allow 允许,deny 拒绝 约束:默认值为allow

缺省值:allow

priority

Integer

规则在安全组中的优先级 取值范围:1~100,1代表最高优先级 约束:默认值为1

请求示例

创建名称为sg002的安全组

https://{endpoint}/v1/security-groups

{
  "security_group" : {
    "name" : "sg002",
    "description" : "用于视频处理组"
  }
}

响应示例

状态码: 200

OK

{
  "security_group" : {
    "id" : "99d9d709-8478-4b46-9f3f-2206b1023fd3",
    "name" : "sg002",
    "description" : "用于test",
    "security_group_rules" : [ {
      "description" : "for test",
      "direction" : "egress",
      "ethertype" : "IPv4",
      "id" : "99d9d709-8478-4b46-9f3f-2206b1023fd3",
      "protocol" : "TCP",
      "port_range_max" : 300,
      "port_range_min" : 30,
      "remote_group_id" : null,
      "remote_ip_prefix" : null,
      "security_group_id" : null
    } ]
  }
}

状态码

状态码

描述

200

OK

错误码

请参见错误码

分享:

    相关文档

    相关产品