Skip to content
Ona Docs

CreateRunnerPolicy

client.runners.policies.create(PolicyCreateParams { groupId, role, runnerId } body, RequestOptionsoptions?): PolicyCreateResponse { policy }
POST/gitpod.v1.RunnerService/CreateRunnerPolicy

Creates a new policy for a runner.

Use this method to:

  • Set up access controls
  • Define group permissions
  • Configure role-based access

Examples

  • Create admin policy:

    Grants admin access to a group.

    runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
    groupId: "f53d2330-3795-4c5d-a1f3-453121af9c60"
    role: RUNNER_ROLE_ADMIN
ParametersExpand Collapse
body: PolicyCreateParams { groupId, role, runnerId }
groupId?: string

group_id specifies the group_id identifier

formatuuid
role?: RunnerRole
One of the following:
"RUNNER_ROLE_UNSPECIFIED"
"RUNNER_ROLE_ADMIN"
"RUNNER_ROLE_USER"
runnerId?: string

runner_id specifies the project identifier

formatuuid
ReturnsExpand Collapse
PolicyCreateResponse { policy }
policy: RunnerPolicy { groupId, role }
groupId?: string
formatuuid
role?: RunnerRole

role is the role assigned to the group

One of the following:
"RUNNER_ROLE_UNSPECIFIED"
"RUNNER_ROLE_ADMIN"
"RUNNER_ROLE_USER"

CreateRunnerPolicy

import Gitpod from '@gitpod/sdk';

const client = new Gitpod({
  bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted
});

const policy = await client.runners.policies.create({
  groupId: 'f53d2330-3795-4c5d-a1f3-453121af9c60',
  role: 'RUNNER_ROLE_ADMIN',
  runnerId: 'd2c94c27-3b76-4a42-b88c-95a85e392c68',
});

console.log(policy.policy);
{
  "policy": {
    "groupId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "role": "RUNNER_ROLE_UNSPECIFIED"
  }
}
Returns Examples
{
  "policy": {
    "groupId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "role": "RUNNER_ROLE_UNSPECIFIED"
  }
}