セキュリティグループ ルール作成
Description
セキュリティグループ ルールを作成します。
defaultのセキュリティグループにルールを追加することはできません。
セキュリティグループIDを指定する必要があります。
セキュリティグループ ルールは100個まで作成可能です。
プロトコルに「icmp」を指定する場合、最小ポート番号と最大ポート番号にそれぞれICMP Typeを指定する必要があります。
Request URL
Network API v2.0 POST /v2.0/security-group-rules
Request Json
{
"security_group_rule": {
"direction": "適用するトラフィックの向き",
"ethertype": "イーサタイプ",
"security_group_id": "セキュリティグループID",
"port_range_min": "最小ポート番号",
"port_range_max": "最大ポート番号",
"protocol": "プロトコル"
}
}
Request Parameters
| Parameter | Value | Style | Description |
|---|---|---|---|
| X-Auth-Token | Userトークン | header | トークン発行 にて払い出されたID |
| direction | ingressegress | plain | 指定するルールがどのトラフィックの向きに適用するかを指定します。「インバウンド(ingress)」もしくは「アウトバウンド(egress)」の指定が可能です。 |
| ethertype | IPv4IPv6 | plain | イーサタイプを指定します。 |
| port_range_min (Optional) | ポート番号ICMPタイプ | plain | 開放するポート番号 もしくは ICMPタイプを指定します。範囲で設定する場合は最小ポート番号 もしくは ICMPタイプになります。(ポート開放/ICMP許可) |
| port_range_max (Optional) | ポート番号ICMPタイプ | plain | 開放するポート番号 もしくは ICMPタイプを指定します。範囲で設定する場合は最大ポート番号 もしくは ICMPタイプになります。(ポート開放/ICMP許可) |
| protocol (Optional) | tcpudpicmpnull | plain | プロトコルを指定します。 「icmp」を指定する場合、最小ポート番号と最大ポート番号にそれぞれICMP Typeを指定する必要があります。 |
| remote_group_id (Optional) | セキュリティグループID | plain | 指定したセキュリティグループIDに紐付いたポートからのトラフィックのみを許可する際に指定します。 |
| remote_ip_prefix (Optional) | 許可IP | plain | 指定したIPからのトラフィックのみを許可したい場合に指定します。(接続元IP制限) |
Response
-
Normal response codes
201
Example
-
Request
curl -i -X POST \ -H "Content-Type: application/json" \ -H "X-Auth-Token: トークンID" \ -d '{"security_group_rule": {"direction": "ルールを適用するトラフィックの向き", "ethertype": "イーサタイプ", "security_group_id": "セキュリティグループID", "port_range_min": "ポート番号", "port_range_max": "ポート番号", "protocol": "プロトコル"}}' \ https://networking.jpt1.cloud.z.com/v2.0/security-group-rules
-
Response
HTTP/1.1 201 Created
Date: Fri, 08 Jul 2016 06:31:48 GMT
Server: Apache
Content-Length: 340
Content-Type: application/json
{
"security_group_rule": {
"direction": "ルールを適用するトラフィックの向き",
"ethertype": "イーサタイプ",
"id": "セキュリティグループルールID",
"port_range_max": ポート番号,
"port_range_min": ポート番号,
"protocol": "プロトコル",
"remote_group_id": null,
"remote_ip_prefix": null,
"security_group_id": "セキュリティグループID",
"tenant_id": "テナントID"
}
}