api-v2
api-v2 copied to clipboard
Firewall names cannot have spaces or underscores
The DigitoalOcean API Firewall section has:
| Name | Type | Description |
|---|---|---|
| name | string | A human-readable name for a Firewall |
But the API rejects names such as "a_b" and "a b". It accepts "a-b", "a.b", "ab", and "aaaaAAAAaaaaAAAAaaaaAAAAaaaaAAAAaaaaAAAAaaaaAAAAaaaaAAAAaaaaAAAA" (64-char).
I would like to use names like "hello_server-180958124".
2020/02/17 15:27:48 [DEBUG] DigitalOcean API Request Details:
---[ REQUEST ]---------------------------------------
PUT /v2/firewalls/cc622838-87d4-425c-bbbc-137cb1f1a940 HTTP/1.1
Host: api.digitalocean.com
User-Agent: Terraform/0.12.20 godo/1.29.0
Content-Length: 170
Accept: application/json
Content-Type: application/json
Accept-Encoding: gzip
{
"name": "a b",
"inbound_rules": [
{
"protocol": "tcp",
"ports": "5001",
"sources": {
"addresses": [
"0.0.0.0/0",
"::/0"
]
}
}
],
"outbound_rules": null,
"droplet_ids": [
180958124
],
"tags": []
}
-----------------------------------------------------
2020/02/17 15:27:49 [DEBUG] DigitalOcean API Response Details:
---[ RESPONSE ]--------------------------------------
HTTP/2.0 422 Unprocessable Entity
Content-Length: 106
Cache-Control: no-cache
Cf-Cache-Status: DYNAMIC
Cf-Ray: 566b88b90c1fed73-SJC
Content-Type: application/json; charset=utf-8
Date: Mon, 17 Feb 2020 23:27:49 GMT
Expect-Ct: ...
Ratelimit-Limit: 5000
Ratelimit-Remaining: 4880
Ratelimit-Reset: 1581979185
Server: cloudflare
Set-Cookie: ...
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Gateway: Edge-Gateway
X-Request-Id: 71cf20f4-42fa-4271-8e4c-40598ac75d1b
X-Response-From: service
X-Runtime: 0.230148
X-Xss-Protection: 1; mode=block
{
"id": "unprocessable_entity",
"message": "invalid name",
"request_id": "71cf20f4-42fa-4271-8e4c-40598ac75d1b"
}
-----------------------------------------------------
Hi. The API documentation needs to be improved, "A human-readable name for a Firewall" is not ideal. Firewalls follow the same naming conventions as other resources:
- must start with an alphanumeric character
- must consist of further alphanumeric characters or the
.or-characters
I know this won't allow you to use the _ you would like to, but this is the current validation process. I will work with our teams to improve the API documentation. Thanks for bringing this to our attention.