MENU
セキュリティグループ ルール作成 - Network API v2.0
Description
- security_group_idを指定する必要があります。
- APIからコントロールパネル上のセキュリティグループにルールを追加することはできません。
Request URL
Network API v2.0 POST /v2.0/security-group-rules
Request Paramters
Parameter | Value | Style | Description |
---|---|---|---|
X-Auth-Token | Userトークン | header | トークンID |
direction | Ingress or egress | plain | セキュリティグループルールが反映される方向 |
ethertype | Must be IPv4 or IPv6 | plain | イーサタイプ |
security_group_id | security_group ID | plain | セキュリティグループID |
port_range_min (Optional) | The minimum port number | plain | セキュリティグループルールを範囲で設定する場合の最小ポート番号 |
port_range_max (Optional) | The maximum port number | plain | セキュリティグループルールを範囲で設定する場合の最大ポート番号 |
protocol (Optional) | <tcp|udp|icmp|null> | plain | セキュリティグループルールが設定されるプロトコル。null を指定した場合すべての protocol を許可 |
remote_group_id (Optional) | plain | 指定したセキュリティグループIDに紐付いたポートからのトラフィックのみを許可 | |
remote_ip_prefix (Optional) | plain | 指定した prefix を持つ IP からのトラフィックのみを許可 |
Request Json
{ "security_group_rule": { "direction": "ingress", "ethertype": "IPv4", "security_group_id": "2b799530-dca1-4c59-8543-9e38d607a7f1", "port_range_min": "80", "port_range_max": "80", "protocol": "tcp" } }
Normal response codes
201
Example
※エンドポイントURLにつきましては、お客様環境によって異なりますので、コントロールパネルにてご確認の上ご利用ください。
- REQ
curl -i -X POST \ -H "Accept: application/json" \ -H "X-Auth-Token: 0925897a3d4543218ff0dcd2bb378a8e" \ -d '{"security_group_rule": {"direction": "ingress", "ethertype": "IPv4", "security_group_id": "c8084620-075c-4932-bbc0-508908df56ca", "port_range_min": "80", "port_range_max": "80", "protocol": "tcp"}}' \ https://networking.tyo1.conoha.io/v2.0/security-group-rules
- RES
HTTP/1.1 201 Created Server: openresty/1.7.10.1 Date: Fri, 08 May 2015 12:26:42 GMT Content-Type: application/json Content-Length: 320 Connection: keep-alive { "security_group_rule": { "remote_group_id": null, "direction": "ingress", "remote_ip_prefix": null, "protocol": "tcp", "ethertype": "IPv4", "tenant_id": "22394afc818d471ca2f0308c06ae7460", "port_range_max": 80, "port_range_min": 80, "id": "11a7f5c8-e9d1-4353-923a-bc103a412ba6", "security_group_id": "c8084620-075c-4932-bbc0-508908df56ca" } }