• Virtual Private Cloud

vpc
  1. Help Center
  2. Virtual Private Cloud
  3. API Reference
  4. OpenStack Neutron APIs
  5. Firewall
  6. Creating a Firewall Rule

Creating a Firewall Rule

Function

This interface is used to create a firewall rule.

URI

POST /v2.0/fwaas/firewall_rules

Request Message

Table 1 Request parameter

Parameter

Type

Mandatory

Description

firewall_rule

Dict

Yes

Specifies the firewall rule. For details, see Table 1.

This parameter has no mandatory fields.

Response Message

Table 2 Response parameter

Parameter

Type

Description

firewall_rule

Dict

Specifies the firewall rule. For details, see Table 1.

Example:

Example request

POST /v2.0/fwaas/firewall_rules
{
    "firewall_rule": {
        "action": "allow", 
        "enabled": true, 
        "destination_port": "80", 
        "protocol": "tcp", 
        "name": "ALLOW_HTTP"
    }
}

Example response

{
    "firewall_rule": {
        "protocol": "tcp", 
        "description": "", 
        "source_ip_address": null, 
        "destination_ip_address": null, 
        "source_port": null, 
        "destination_port": "80", 
        "id": "b94acf06-efc2-485d-ba67-a61acf2a7e28", 
        "name": "ALLOW_HTTP", 
        "tenant_id": "23c8a121505047b6869edf39f3062712", 
        "enabled": true, 
        "action": "allow", 
        "ip_version": 4, 
        "public": false,
        "project_id": "23c8a121505047b6869edf39f3062712"
    }
}

Status Codes

For details, see section Status Codes.