Create a definition
Creates a new security definition for a connection in the project.
Include at least one of clsConfig, slsConfig, or rlsConfig.
A definition without any security configuration is rejected.
Definition names must be unique within a project + connection pair.
Authorization
UnifiedSecurityBearerAuth A project-scoped access token generated for an organization Admin.
Generate one with the Token API using
the Admin's orgUserId. The token project must match the request path,
and the user must currently be active and belong to the project
organization. Dashboard tokens and tenant-user project tokens are not
accepted.
In: header
Path Parameters
Your Semaphor project ID.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X post "https://semaphor.cloud/api/management/v1/projects/string/unified-security/definitions" \ -H "Content-Type: application/json" \ -d '{ "connectionId": "conn_postgres", "name": "PostgreSQL tenant isolation", "rlsConfig": { "parameters": { "tenant_id": { "source": "ASSIGNMENT", "missing": "NO_ROWS" } }, "rules": [ { "name": "Tenant isolation", "matcher": { "type": "SCHEMA", "schema": "public", "column": "tenant_id" }, "expression": "tenant_id = {{ tenant_id }}" } ] } }'{
"ok": true,
"data": {
"definition": {
"clsConfig": {
"connectionTemplate": "string",
"filePathTemplates": {
"property1": "string",
"property2": "string"
},
"params": {
"property1": "string",
"property2": "string"
}
},
"slsConfig": {
"schemaTemplate": "string",
"allowedSchemas": [
"string"
],
"defaultSchema": "string",
"schema": "string"
},
"rlsConfig": {
"parameters": {
"property1": {
"source": "FIXED",
"value": "string"
},
"property2": {
"source": "FIXED",
"value": "string"
}
},
"rules": [
{
"matcher": {
"type": "ALL_TABLES_WITH_COLUMN",
"column": "string"
},
"expression": "string",
"name": "string",
"description": "string",
"enabled": true
}
]
},
"id": "string",
"projectId": "string",
"connectionId": "string",
"name": "string",
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
},
"diagnostics": [
{
"code": "RLS_CONFIG_SHAPE_INVALID",
"severity": "ERROR",
"title": "string",
"message": "string",
"location": {
"resourceType": "DEFINITION",
"resourceId": "string",
"resourceName": "string",
"subjectType": "RULE",
"fieldPath": "string",
"parameterName": "string"
},
"remediations": [
{
"code": "REAUTHOR_LEGACY_RLS",
"label": "string",
"target": {
"resourceType": "DEFINITION",
"resourceId": "string"
}
}
],
"requiresUserDecision": true,
"retryable": true
}
],
"recovery": {
"action": "SAVE_DEFINITION_AND_REVIEW_ASSIGNMENTS",
"assignmentIds": [
"string"
]
}
}
}{
"ok": false,
"error": {
"code": "INVALID_REQUEST",
"message": "string",
"requestId": "string",
"issues": [
{
"code": "INVALID_JSON",
"fieldPath": "string",
"message": "string"
}
],
"retryable": true
}
}{
"ok": false,
"error": {
"code": "INVALID_REQUEST",
"message": "string",
"details": {}
}
}{
"ok": false,
"error": {
"code": "INVALID_REQUEST",
"message": "string",
"details": {}
}
}{
"ok": false,
"error": {
"code": "INVALID_REQUEST",
"message": "string",
"requestId": "string",
"issues": [
{
"code": "INVALID_JSON",
"fieldPath": "string",
"message": "string"
}
],
"retryable": true
}
}{
"ok": false,
"error": {
"code": "INVALID_REQUEST",
"message": "string",
"requestId": "string",
"issues": [
{
"code": "INVALID_JSON",
"fieldPath": "string",
"message": "string"
}
],
"retryable": true
}
}{
"ok": false,
"error": {
"code": "RLS_CONFIGURATION_INVALID",
"message": "string",
"diagnostics": [
{
"code": "RLS_CONFIG_SHAPE_INVALID",
"severity": "ERROR",
"title": "string",
"message": "string",
"location": {
"resourceType": "DEFINITION",
"resourceId": "string",
"resourceName": "string",
"subjectType": "RULE",
"fieldPath": "string",
"parameterName": "string"
},
"remediations": [
{
"code": "REAUTHOR_LEGACY_RLS",
"label": "string",
"target": {
"resourceType": "DEFINITION",
"resourceId": "string"
}
}
],
"requiresUserDecision": true,
"retryable": true
}
],
"requestId": "string"
}
}{
"ok": false,
"error": {
"code": "INVALID_REQUEST",
"message": "string",
"requestId": "string",
"issues": [
{
"code": "INVALID_JSON",
"fieldPath": "string",
"message": "string"
}
],
"retryable": true
}
}