Create security group
const url = 'https://console.cloudlogics.com/api/v1/security-group';const options = { method: 'POST', headers: {Authorization: '<Authorization>', 'Content-Type': 'application/json'}, body: '{"description":"Public web tier","name":"web-servers","rules":[{"description":"HTTPS from anywhere","direction":"ingress","dst_port":"443","ethertype":"IPv4","protocol":"tcp","remote_group":"8f14e45f-ceea-467a-9f2c-1b1d3a5e77c2","remote_ip":"0.0.0.0/0"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://console.cloudlogics.com/api/v1/security-group \ --header 'Authorization: <Authorization>' \ --header 'Content-Type: application/json' \ --data '{ "description": "Public web tier", "name": "web-servers", "rules": [ { "description": "HTTPS from anywhere", "direction": "ingress", "dst_port": "443", "ethertype": "IPv4", "protocol": "tcp", "remote_group": "8f14e45f-ceea-467a-9f2c-1b1d3a5e77c2", "remote_ip": "0.0.0.0/0" } ] }'Create a security group in the authenticated user’s project. Available to any active project member; the group is tagged with the creator’s email so they may later edit or delete it. May optionally include rules to create atomically with the group; if any rule fails, the security group is rolled back.
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”Security group fields
object
Optional free text.
Example
Public web tier3-50 characters, a single word of a-z, 0-9 and hyphens. Uppercase is converted to lowercase. Required: omitting it returns 400 “name cannot be empty”.
Example
web-serversOptional. Rules to create together with the group, using the same shape as POST /security-group/{id}/rule. Omit to create an empty group, which admits no inbound traffic until you add rules.
object
Optional free text, stored with the rule.
Example
HTTPS from anywhereIngress for inbound traffic, egress for outbound.
Example
ingressDestination port, sent as a string rather than a number. Omit for icmp. Comes back as the integers port_range_min and port_range_max.
Example
443Comes back as ether_type, with an underscore.
Example
IPv4Lowercase. Uppercase is not accepted.
Example
tcpThe UUID of another security group, to allow traffic from anything using that group. Use this or remote_ip, not both.
Example
8f14e45f-ceea-467a-9f2c-1b1d3a5e77c2Source or destination CIDR. 0.0.0.0/0 is the whole internet; a /32 is a single address. Use this or remote_group, not both. Comes back as remote_ip_prefix.
Example
0.0.0.0/0Responses
Section titled “Responses”Created security group ID and rules
object
Examplegenerated
{}Invalid request
object
object
object
Example
{ "error": { "code": 400, "message": "name cannot be empty" }}One of the provided rules already exists; SG rolled back
object
object
object
Examplegenerated
{ "data": "example", "error": { "code": 1, "message": "example" }, "page": { "next": "example", "prev": "example", "total_size": 1 }}Internal server error
object
object
object
Examplegenerated
{ "data": "example", "error": { "code": 1, "message": "example" }, "page": { "next": "example", "prev": "example", "total_size": 1 }}