Create role
POST/metalakes/:metalake/roles
Creates a role with the given properties and securable objects, and returns the new role. Every securable object must exist, and each privilege must be one that the object's type supports.
Sign in with a bearer token or a local user's password; see Authentication.
Request
Path Parameters
The name of the metalake
- application/json
Body
Array [
Array [
]
]
The name of the role
properties
object
nullable
A map of properties for the role
securableObjects
object[]
A list of securable objects
The full name of the securable object
Possible values: [metalake, catalog, schema, fileset, table, view, topic, model, tag, policy, job_template, function]
The type of the securable object. Only types that at least one privilege can be bound to are accepted, and each privilege in privileges must support the type. Responses return the value in lowercase; requests accept any case.
privileges
object[]
A list of privileges
Possible values: [create_catalog, use_catalog, create_schema, use_schema, create_table, modify_table, select_table, create_fileset, write_fileset, read_fileset, create_topic, produce_topic, consume_topic, manage_users, manage_groups, create_role, manage_grants, register_model, create_model, link_model_version, create_model_version, use_model, create_tag, apply_tag, create_policy, apply_policy, register_job_template, use_job_template, run_job, create_view, select_view, register_function, execute_function, modify_function, use_secrets, include_credential_secrets]
The name of the privilege, one of the values of Privilege.Name. Responses return the name in lowercase; requests accept any case. create_model and create_model_version are deprecated: the server still accepts them as aliases of register_model and link_model_version, and new requests should use the new names.
Possible values: [allow, deny]
The condition of the privilege, allow or deny. Responses return the value in lowercase; requests accept any case.
Responses
- 200
- 400
- 409
- 5xx
The new role, with its properties, its securable objects with their privileges, and its audit information.
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- RoleResponse
Schema
Array [
Array [
]
]
Possible values: [0]
Status code of the response
role
object
The name of the role
properties
object
nullable
A map of properties for the role
securableObjects
object[]
A list of securable objects
The full name of the securable object
Possible values: [metalake, catalog, schema, fileset, table, view, topic, model, tag, policy, job_template, function]
The type of the securable object. Only types that at least one privilege can be bound to are accepted, and each privilege in privileges must support the type. Responses return the value in lowercase; requests accept any case.
privileges
object[]
A list of privileges
Possible values: [create_catalog, use_catalog, create_schema, use_schema, create_table, modify_table, select_table, create_fileset, write_fileset, read_fileset, create_topic, produce_topic, consume_topic, manage_users, manage_groups, create_role, manage_grants, register_model, create_model, link_model_version, create_model_version, use_model, create_tag, apply_tag, create_policy, apply_policy, register_job_template, use_job_template, run_job, create_view, select_view, register_function, execute_function, modify_function, use_secrets, include_credential_secrets]
The name of the privilege, one of the values of Privilege.Name. Responses return the name in lowercase; requests accept any case. create_model and create_model_version are deprecated: the server still accepts them as aliases of register_model and link_model_version, and new requests should use the new names.
Possible values: [allow, deny]
The condition of the privilege, allow or deny. Responses return the value in lowercase; requests accept any case.
audit
object
Audit information for a Gravitino resource.
The user who created the resource
The time the resource was created
The user who last modified the resource
The time the resource was last modified
{
"code": 0,
"role": {
"name": "string",
"properties": {},
"securableObjects": [
{
"fullName": "string",
"type": "metalake",
"privileges": [
{
"name": "create_catalog",
"condition": "allow"
}
]
}
],
"audit": {
"creator": "string",
"createTime": "2024-07-29T15:51:28.071Z",
"lastModifier": "string",
"lastModifiedTime": "2024-07-29T15:51:28.071Z"
}
}
}
{
"code": 0,
"role": {
"name": "role1",
"properties": {
"k1": "v1"
},
"securableObjects": [
{
"fullName": "catalog1.schema1.table1",
"type": "table",
"privileges": [
{
"name": "select_table",
"condition": "allow"
}
]
}
]
}
}
A securable object does not exist, or one of its privileges is not supported by the object's type or is listed twice with different conditions.
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- NoSuchMetadataObjectException
Schema
Possible values: >= 1000 and <= 1100
HTTP response code
Internal type definition of the error
A human-readable message
Deprecated diagnostic stack trace. Enterprise omits it by default because it can expose internal implementation details. Operators can opt in for controlled diagnostics with gravitino.server.webserver.includeErrorStackTrace=true. See OWASP REST Security: Error handling and CWE-209.
{
"code": 1002,
"type": "string",
"message": "string"
}
{
"code": 1001,
"type": "IllegalMetadataObjectException",
"message": "Metadata object does not exist",
"stack": [
"org.apache.gravitino.exceptions.IllegalMetadataObjectException: Metadata object does not exist",
"..."
]
}
A role with the same name already exists in the metalake.
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- RoleAlreadyExistsException
Schema
Possible values: >= 1000 and <= 1100
HTTP response code
Internal type definition of the error
A human-readable message
Deprecated diagnostic stack trace. Enterprise omits it by default because it can expose internal implementation details. Operators can opt in for controlled diagnostics with gravitino.server.webserver.includeErrorStackTrace=true. See OWASP REST Security: Error handling and CWE-209.
{
"code": 1002,
"type": "string",
"message": "string"
}
{
"code": 1004,
"type": "RoleAlreadyExistsException",
"message": "Role already exists",
"stack": [
"org.apache.gravitino.exceptions.RoleAlreadyExistsException: Role already exists: role1"
]
}
The server hit an internal error that the client usually cannot fix by changing the request.
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- Example
Schema
Possible values: >= 1000 and <= 1100
HTTP response code
Internal type definition of the error
A human-readable message
Deprecated diagnostic stack trace. Enterprise omits it by default because it can expose internal implementation details. Operators can opt in for controlled diagnostics with gravitino.server.webserver.includeErrorStackTrace=true. See OWASP REST Security: Error handling and CWE-209.
{
"code": 1002,
"type": "string",
"message": "string"
}
{
"code": 1002,
"type": "RuntimeException",
"message": "Internal Server Error",
"stack": [
"java.lang.RuntimeException: Internal Server Error"
]
}