POST
/
waap
/
v1
/
domains
/
{domain_id}
/
firewall-rules
import os
from gcore import Gcore

client = Gcore(
    api_key=os.environ.get("GCORE_API_KEY"),  # This is the default and can be omitted
)
firewall_rule = client.waap.domains.firewall_rules.create(
    domain_id=0,
    action={},
    conditions=[{}],
    enabled=True,
    name="name",
)
print(firewall_rule.id)
{
  "name": "<string>",
  "description": "<string>",
  "enabled": true,
  "action": {
    "allow": {},
    "block": {
      "status_code": 403,
      "action_duration": "12h"
    }
  },
  "conditions": [
    {
      "ip": {
        "negation": false,
        "ip_address": "127.0.0.1"
      },
      "ip_range": {
        "negation": false,
        "lower_bound": "127.0.0.1",
        "upper_bound": "127.0.0.1"
      }
    }
  ],
  "id": 123
}

Authorizations

APIKey
string
header
required

API key for authentication.

Path Parameters

domain_id
integer
required

The domain ID

Body

application/json

Response

201
application/json

Successful Response

The response is of type object.