UpdateOrganizationPolicies
Updates organization policy settings.
Use this method to:
- Configure editor restrictions
- Set environment resource limits
- Define project creation permissions
- Customize default configurations
Examples
-
Update editor policies:
Restricts available editors and sets a default.
organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" allowedEditorIds: - "vscode" - "jetbrains" defaultEditorId: "vscode" -
Set environment limits:
Configures limits for environment usage.
organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" maximumEnvironmentTimeout: "3600s" maximumRunningEnvironmentsPerUser: "5" maximumEnvironmentsPerUser: "20"
Parameters
allowed_editor_ids is the list of editor IDs that are allowed to be used in the organization
allow_local_runners controls whether local runners are allowed to be used in the organization
default_editor_id is the default editor ID to be used when a user doesn’t specify one
default_environment_image is the default container image when none is defined in repo
delete_archived_environments_after controls how long archived environments are kept before automatic deletion. 0 means no automatic deletion. Maximum duration is 4 weeks (2419200 seconds).
disable_from_scratch controls whether non-admin users can create blank environments without a Git or URL initializer.
maximum_environment_lifetime controls for how long environments are allowed to be reused. 0 means no maximum lifetime. Maximum duration is 180 days (15552000 seconds).
maximum_environments_per_user limits total environments (running or stopped) per user
maximum_environment_timeout controls the maximum timeout allowed for environments in seconds. 0 means no limit (never). Minimum duration is 30 minutes (1800 seconds). value must be 0s (no limit) or at least 1800s (30 minutes):
this == duration('0s') || this >= duration('1800s')maximum_running_environments_per_user limits simultaneously running environments per user
members_create_projects controls whether members can create projects
members_require_projects controls whether environments can only be created from projects by non-admin users
port_sharing_disabled controls whether user-initiated port sharing is disabled in the organization. System ports (VS Code Browser, agents) are always exempt from this policy.
require_custom_domain_access controls whether users must access via custom domain when one is configured. When true, access via app.gitpod.io is blocked.
restrict_account_creation_to_scim controls whether account creation is restricted to SCIM-provisioned users only. When true and SCIM is configured for the organization, only users provisioned via SCIM can create accounts.
security_policy_id assigns a Veto Exec SecurityPolicy to newly created environments. The public GA contract accepts policies that use only SecurityPolicy.Spec.executables. Assignment validates materializability and rejects unsupported executable selectors or effects. Set this field to an empty string to clear the default assignment.
UpdateOrganizationPolicies
import os
from gitpod import Gitpod
client = Gitpod(
bearer_token=os.environ.get("GITPOD_API_KEY"), # This is the default and can be omitted
)
policy = client.organizations.policies.update(
organization_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047",
maximum_environments_per_user="20",
maximum_environment_timeout="3600s",
maximum_running_environments_per_user="5",
)
print(policy){}Returns Examples
{}