Skip to content
Ona Docs

ListProjectPolicies

projects.policies.list(PolicyListParams**kwargs) -> SyncPoliciesPage[ProjectPolicy]
POST/gitpod.v1.ProjectService/ListProjectPolicies

Lists policies for a project.

Use this method to:

  • View access controls
  • Check policy configurations
  • Audit permissions

Examples

  • List policies:

    Shows all policies for a project.

    projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
    pagination:
      pageSize: 20
ParametersExpand Collapse
token: Optional[str]
page_size: Optional[int]
maximum100
minimum0
project_id: Optional[str]

project_id specifies the project identifier

formatuuid
ReturnsExpand Collapse
class ProjectPolicy:
group_id: Optional[str]
formatuuid
role: Optional[ProjectRole]

role is the role assigned to the group

One of the following:
"PROJECT_ROLE_UNSPECIFIED"
"PROJECT_ROLE_ADMIN"
"PROJECT_ROLE_USER"
"PROJECT_ROLE_EDITOR"

ListProjectPolicies

import os
from gitpod import Gitpod

client = Gitpod(
    bearer_token=os.environ.get("GITPOD_API_KEY"),  # This is the default and can be omitted
)
page = client.projects.policies.list(
    pagination={
        "page_size": 20
    },
    project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047",
)
page = page.policies[0]
print(page.group_id)
{
  "pagination": {
    "nextToken": "nextToken"
  },
  "policies": [
    {
      "groupId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "role": "PROJECT_ROLE_UNSPECIFIED"
    }
  ]
}
Returns Examples
{
  "pagination": {
    "nextToken": "nextToken"
  },
  "policies": [
    {
      "groupId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "role": "PROJECT_ROLE_UNSPECIFIED"
    }
  ]
}