All pages
Powered by GitBook
1 of 1

Loading...

Role Existence

Check whether a role with specific resource permissions already exists.

Early Access: This API is provided in Early Access. Please contact our customer support team for more information and to enable this feature.

Overview

The Role Existence API allows users to check whether a role with specific resource permissions already exists in the system. This API is particularly useful for role management and access governance in Snowflake environments.

Use cases and features

This API enables efficient role management by identifying existing roles that already have the permissions you're looking for. Key use cases include:

  1. Role Discovery: Find existing roles that match specific permission requirements

  2. Prevent Role Proliferation: Avoid creating duplicate roles with the same permissions

  3. Permission Auditing: Verify which roles have specific permissions to resources

  4. Role Standardization: Identify standard roles that can be reused for similar access requirements

  • This feature is currently limited to the .

The API accepts a request object with the following parameters:

Parameter
Type
Required
Description

Each ResourcePermissions object contains:

Field
Type
Required
Description

The API uses the following protocol buffer message definitions:

The API returns a response object with the following field:

Field
Type
Description

This example checks if there's an existing role with USAGE permission on a specific Snowflake database:

The response indicates that a matching role exists:

You can check for roles that have permissions across multiple resources:

In this example, the request is checking for roles with specific permissions, but no matching roles are found:

The response indicates that no matching roles with the specified permission combination exist:

When you receive an empty response like this, it suggests that a new role might need to be created to satisfy these specific permission requirements, as no existing role has the exact permission set requested.

A list of resource permissions to match against existing roles

Veza node ID of the resource (i.e., ID property in graph and query builder)

raw_permissions

string[]

Yes

A list of permissions to check (e.g., USAGE, SELECT, etc.)

grantee_type

string

Yes

The type of grantee for which the role existence is checked (currently supports only SnowflakeRole)

resource_permissions

ResourcePermissions[]

node_type

string

Yes

The type of resource node (supported types are SnowflakeDatabase, SnowflakeTable, SnowflakeView, and SnowflakeSchema)

node_id

string

message RoleExistsRequest {
  string grantee_type = 1;
  repeated GetRoleMatchingRequest.ResourcePermissions resource_permissions = 2;
}

message RoleExistsResponse {
  repeated string grantee_ids = 1;
}

grantee_ids

string[]

A list of existing role IDs that match the given permissions

{
  "grantee_type": "SnowflakeRole",
  "resource_permissions": [
    {
      "node_type": "SnowflakeDatabase",
      "node_id": "example-snowflake.com/database/SECURITY_DB",
      "raw_permissions": ["USAGE"]
    }
  ]
}
{
  "grantee_ids": [
    "example-snowflake.com/role/SECURITY_READER_ROLE"
  ]
}
{
  "grantee_type": "SnowflakeRole",
  "resource_permissions": [
    {
      "node_type": "SnowflakeDatabase",
      "node_id": "example-snowflake.com/database/ANALYTICS",
      "raw_permissions": ["USAGE"]
    },
    {
      "node_type": "SnowflakeSchema",
      "node_id": "example-snowflake.com/database/ANALYTICS/schema/PUBLIC",
      "raw_permissions": ["USAGE", "SELECT"]
    }
  ]
}
{
  "grantee_ids": [
    "example-snowflake.com/role/ANALYTICS_READER_ROLE",
    "example-snowflake.com/role/REPORTING_USER_ROLE"
  ]
}
{
  "grantee_type": "SnowflakeRole",
  "resource_permissions": [
    {
      "node_type": "SnowflakeDatabase",
      "node_id": "snowhouse.snowflakecomputing.com/database/RESEARCH_DATA",
      "raw_permissions": ["OWNERSHIP"]
    },
    {
      "node_type": "SnowflakeSchema",
      "node_id": "snowhouse.snowflakecomputing.com/database/RESEARCH_DATA/schema/EXPERIMENTS",
      "raw_permissions": ["CREATE TABLE", "CREATE VIEW", "MODIFY"]
    }
  ]
}
{
  "grantee_ids": []
}

Limitations

Role Existence API

Request Parameters

ResourcePermissions Structure

Protocol Definition

Proto Message Definitions

Response Structure

Usage Example

Request

Response

Example: Multiple Resource Permissions

Request

Response

Example: No Matching Roles

Request

Response

Related APIs

Snowflake integration
Get Access Relationship API
Role Maintenance API
Cohort Role Analysis API

Yes

Yes

post
Authorizations
AuthorizationstringRequired

Veza API key for authentication. Generate keys in Administration > API Keys.

Body
grantee_typestringOptional
raw_permissionsstring[]Optional
node_typestringOptional
node_idstringOptional
Responses
200

OK

application/json
grantee_idsstring[]Optional
default

Default error response

application/json
post
/api/private/assessments/role_recommendations_role_exists
{
  "grantee_ids": [
    "text"
  ]
}
POST /api/private/assessments/role_recommendations_role_exists HTTP/1.1
Host: your-tenant.vezacloud.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 113

{
  "grantee_type": "text",
  "resource_permissions": [
    {
      "raw_permissions": [
        "text"
      ],
      "node_type": "text",
      "node_id": "text"
    }
  ]
}