Description
セキュリティグループ ルールを作成します。
Request URL
Network API POST /v2.0/security-group-rules
Request Json
{
"security_group_rule": {
"direction": "通信の向き",
"ethertype": "イーサタイプ",
"security_group_id": "セキュリティグループID",
"port_range_min": "ポート番号またはICMPタイプ",
"port_range_max": "ポート番号またはICMPタイプ",
"protocol": "プロトコル"
}
}
Request Parameters
| Parameter | Value | Style | Description |
|---|---|---|---|
| X-Auth-Token | トークンID | header | トークンIDを指定します。 |
| direction | ingressegress | body | 作成するルールがどのトラフィックの向きに適用するかを指定します。「インバウンド(ingress)」もしくは「アウトバウンド(egress)」の指定が可能です。 |
| ethertype | IPv4IPv6 | body | イーサタイプを指定します。 |
| security_group_id | セキュリティグループID | body | ルールを紐付けるセキュリティグループIDを指定します。 |
| port_range_min(Optional) | ポート番号ICMPタイプ | body | 開放するポート番号 もしくは 許可するICMPタイプを指定します。範囲で設定する場合は最小ポート番号 もしくは ICMPタイプになります。 |
| port_range_max(Optional) | ポート番号ICMPタイプ | body | 開放するポート番号 もしくは 許可するICMPタイプを指定します。範囲で設定する場合は最大ポート番号 もしくは ICMPタイプになります。 |
| protocol(Optional) | tcpudpicmpnull | body | プロトコルを指定します。「icmp」を指定する場合、最小ポート番号と最大ポート番号にそれぞれICMP Typeを指定する必要があります。「null」を指定した場合、全てプロトコルが許可されます。 |
| remote_ip_prefix(Optional) | ネットワークアドレス | body | 許可する接続元IPアドレスを指定します。CIDR形式(XXX.XXX.XXX.X/XX)でネットワークアドレスを指定する必要があります。 |
| remote_group_id(Optional) | セキュリティグループID | body | 許可する接続元のセキュリティグループIDを指定します。 |
Response Code
Success
201
Example
Request
curl -i -X POST -H "Accept: 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.tyo1.conoha.io/v2.0/security-group-rules
Response
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"
}
}
ConoHaにて提供しておりますAPIにつきましては、クラウド基盤として採用しておりますOpenStackの機能にて実装しておりますので、詳細な情報や使い方はOpenStackのドキュメントにてご確認ください。