Create role
POST/v1/roles
Create a new role.
Token scope required: roles:create
Request
- application/json
Body
required
Array [
]
Possible values: non-empty
and <= 50 characters
Name of the new role
Possible values: <= 255 characters
Optional description
firewallRules
object[]
Incoming firewall rules
Possible values: [ANY
, TCP
, UDP
, ICMP
]
Possible values: <= 255 characters
Role ID to allow with this firewall rule. If not specified, all roles are included.
Tags to allow with this firewall rule. An empty list allows all tags. key is max 20 characters, value is max 50 characters, no whitespace around either allowed
portRange
object
nullable
Range of ports for this firewall rule. If not provided or set to null, all ports are allowed.
Possible values: >= 1
and <= 65535
First port number included in range.
Possible values: >= 1
and <= 65535
Last port number included in range. Must be greater than from
port.
Responses
- 200
- 400
Successful operation
- application/json
- Schema
- Example (from schema)
Schema
Array [
]
data
object
firewallRules
object[]
Possible values: [ANY
, TCP
, UDP
, ICMP
]
Possible values: <= 255 characters
Role ID to allow with this firewall rule. If not specified, all roles are included.
Tags to allow with this firewall rule. An empty list allows all tags. key is max 20 characters, value is max 50 characters, no whitespace around either allowed
portRange
object
nullable
Range of ports for this firewall rule. If not provided or set to null, all ports are allowed.
Possible values: >= 1
and <= 65535
First port number included in range.
Possible values: >= 1
and <= 65535
Last port number included in range. Must be greater than from
port.
{
"data": {
"id": "role-LO4SPDSWTZNJC676WFCZKUB3ZQ",
"name": "My new role",
"description": "",
"createdAt": "2023-02-15T13:59:09Z",
"modifiedAt": "2023-02-15T13:59:09Z",
"firewallRules": [
{
"protocol": "TCP",
"description": "allow SSH access",
"allowedRoleID": "role-G3TWUQ4FASQEF44MGMTSRBTYKM",
"portRange": {
"from": 22,
"to": 22
}
}
]
},
"metadata": {}
}
Validation error
- application/json
- Schema
- Example (from schema)
- missingName
- duplicateName
- protocol
- portRangeMissing
- portRangeOrder
Schema
Array [
]
errors
object[]
required
A static name for the error type
A short human readable description of the error
Describes the variable missing or malformed
{
"errors": [
{
"code": "string",
"message": "string",
"path": "string"
}
]
}
{
"errors": [
{
"code": "ERR_INVALID_VALUE_LENGTH",
"message": "must have a length between 1 and 50",
"path": "name"
}
]
}
{
"errors": [
{
"code": "ERR_DUPLICATE_VALUE",
"message": "value already exists",
"path": "name"
}
]
}
{
"errors": [
{
"code": "ERR_INVALID_VALUE",
"message": "must be a valid protocol: ANY, TCP, UDP, ICMP",
"path": "firewallRules[0].protocol"
}
]
}
{
"errors": [
{
"code": "ERR_INVALID_VALUE",
"message": "must be between 1 and 65535",
"path": "firewallRules[0].portRange.from"
},
{
"code": "ERR_INVALID_VALUE",
"message": "must be between 1 and 65535",
"path": "firewallRules[0].portRange.to"
}
]
}
{
"errors": [
{
"code": "ERR_INVALID_VALUE",
"message": "from must be less than or equal to to",
"path": "firewallRules[0].portRange"
}
]
}