Attribute’s Properties¶
We can distinguish the following features of attributes used in object specification:
Property |
Possible values |
Default value |
Description |
|---|---|---|---|
type |
|
|
Attribute’s type in JSON requests. |
readonly |
|
|
When set to |
immutable |
|
|
When set to |
ignore-case |
|
|
When set to |
allow-empty |
|
|
When set to |
default |
|
No default |
Attribute’s default value. |
protected |
|
|
The attribute’s value is a secret and shouldn’t be returned to the caller. |
grant |
|
No default |
Require grant on |
required |
|
|
When set to |
required-by |
|
No default |
|
requires |
|
No default |
|
values |
or:
|
No default |
Value or an array of possible values for this attribute. |
value-labels |
|
No default |
User-friendly names for all the values, used in graphical user interfaces. |
value-range |
|
No default |
Value range for a numeric attribute. |
value-regexp |
|
No default |
Regular expression that the value has to match. |
unique |
or:
or:
|
|
The given attribute is unique by itself (when |
expensive |
|
|
The given attribute is expensive to retrieve because it requires an additional operations in the database or a subquery. |
description |
|
No default |
Short description of the attribute. |
capability |
|
None |
Defines role-based access requirements (RBAC) for accessing or modifying the object via a specific API method. The object type (objtype) specifies the protected resource (e.g. account), while each HTTP method (e.g. GET, POST, PATCH, DELETE) maps to a required right (e.g. read, write). For example, GET: read on account means that to retrieve object via GET, the user must have the read right on the account object type. |
Selected Use Examples¶
Required-by
Description
In the following example, the attribute is required when protocol is set to either ssh or rdp.
Example
"required-by": { "protocol": [ "ssh", "rdp" ] }
Description
Example below shows that when "external_port" is defined, this attribute is required.
Example
"required-by": { "external_port": { } }
Description
Multiple "required-by" properties can be specified. Two equivalent examples below shows that this attribute is required either:
when
protocolis"ssh"orwhen
protocolishttporrdpandtls_enabledistrue.
Example
"required-by": { "protocol": "ssh" },
"required-by": { "protocol": [ "http", "rdp" ], "tls_enabled": true }
Equivalent example
"required-by": { "protocol": "ssh" },
"required-by": { "protocol": "http", "tls_enabled": true },
"required-by": { "protocol": "rdp", "tls_enabled": true }
Requires
Description
Following example shows that this attribute requires protocol to be set to ssh or rdp.
Example
"requires": { "protocol": [ "ssh", "rdp" ] }
Description
Following example shows that "external_port" is required to exist, but its value is not important.
Example
"requires": { "external_port": { } }
Description
Following example shows that this attribute requires protocol to be set to rdp and "tls_enabled" to be set to true.
Example
"requires": { "protocol": "rdp", "tls_enabled": true }
Unique
Description
Example of unique attribute with no dependencies.
Example
"id": {"unique": true}
Description
Example of unique attribute with single dependency - a pair of those attributes is unique.
Example
"safe_id": {
"unique": "user_id"
},
"user_id": {
"unique": "safe_id"
}
Description
Example of unique attribute with double dependency - three attributes together are unique.
Example
"account_id": {
"unique": [ "listener_id", "safe_id" ]
},
"listener_id": {
"unique": [ "account_id", "safe_id" ]
},
"safe_id": {
"unique": [ "account_id", "listener_id" ]
}