Create Firewall rule to a Security Group
Create one firewall rule and attach it to the existing security group
post
Authorizations
AuthorizationstringRequired
Please provide header value as 'Bearer ' and don't forget to add 'Bearer' HTTP Authorization Scheme before the token.
Path parameters
datacenterIdstringRequired
The unique ID of the data center
securityGroupIdstringRequired
The unique ID of the security group.
Body
idstringRead-onlyOptionalExample:
The resource's unique identifier.
15f67991-0f51-4efc-a8ad-ef1fb31a480ctypestring · enumOptionalPossible values:
hrefstring · uriRead-onlyOptionalExample:
URL to the object representation (absolute path).
<RESOURCE-URI>Responses
200
Successful operation
application/json
default
Any erroneous status code:
400 (parse error), 401 (auth error), 402 (trial access), 403 (insufficient privileges), 404 (not found), 405 (unsupported HTTP method), 415 (unsupported content type), 422 (validation error), 429 (request rate limit exceeded), 500 (server error), or 503 (maintenance).
application/json
post/datacenters/{datacenterId}/securitygroups/{securityGroupId}/rules
POST /cloudapi/v6/datacenters/{datacenterId}/securitygroups/{securityGroupId}/rules HTTP/1.1
Host: api.ionos.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 275
{
"type": "firewall-rule",
"metadata": {},
"properties": {
"name": "My resource",
"protocol": "TCP",
"sourceMac": "00:0a:95:9d:68:16",
"ipVersion": "IPv4",
"sourceIp": "22.231.113.64",
"targetIp": "22.231.113.64",
"icmpCode": 0,
"icmpType": 8,
"portRangeStart": 8,
"portRangeEnd": 8,
"type": "INGRESS"
}
}{
"id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
"type": "firewall-rule",
"href": "<RESOURCE-URI>",
"metadata": {
"etag": "45480eb3fbfc31f1d916c1eaa4abdcc3",
"createdDate": "2015-12-04T14:34:09.809Z",
"createdBy": "user@example.com",
"createdByUserId": "user@example.com",
"lastModifiedDate": "2015-12-04T14:34:09.809Z",
"lastModifiedBy": "user@example.com",
"lastModifiedByUserId": "63cef532-26fe-4a64-a4e0-de7c8a506c90",
"state": "AVAILABLE"
},
"properties": {
"name": "My resource",
"protocol": "TCP",
"sourceMac": "00:0a:95:9d:68:16",
"ipVersion": "IPv4",
"sourceIp": "22.231.113.64",
"targetIp": "22.231.113.64",
"icmpCode": 0,
"icmpType": 8,
"portRangeStart": 8,
"portRangeEnd": 8,
"type": "INGRESS"
}
}Last updated
Was this helpful?