セキュリティグループ ルール作成
Description
セキュリティグループ ルールを作成します。
セキュリティグループ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 | トークンID | header | トークン発行 にて払い出されたID |
| security_group_id | セキュリティグループID | URI | 作成するルールを紐付けるセキュリティグループIDを指定します。セキュリティグループ一覧取得 にて任意のセキュリティグループ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 "Accept: application/json" \ -H "Content-Type: application/json" \ -H "X-Auth-Token: トークンID" \ -d '{"security_group_rule": {"security_group_id": "セキュリティグループID", "direction": "ルールを適用するトラフィックの向き", "ethertype": "イーサタイプ", "port_range_min": "ポート番号", "port_range_max": "ポート番号", "protocol": "プロトコル"}}' \ ネットワークエンドポイント/security-group-rules
-
Response
HTTP/1.1 201 Created
Date: Mon, 26 Mar 2018 09:03:18 GMT
Server: Apache
Content-Length: 340
Content-Type: application/json
{
"security_group_rule": {
"remote_group_id": null,
"direction": "ingress",
"remote_ip_prefix": null,
"protocol": "tcp",
"ethertype": "IPv4",
"tenant_id": "テナントID",
"port_range_max": ポート番号,
"port_range_min": ポート番号,
"id": "セキュリティグループルールID",
"security_group_id": "セキュリティグループID"
}
}