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"
ParametersExpand Collapse
body OrganizationPolicyUpdateParams
organization_id is the ID of the organization to update policies for
agent_policy contains agent-specific policy settings
agent_policy contains agent-specific policy settings
command_deny_list contains a list of commands that agents are not allowed to execute
conversation_sharing_policy controls whether agent conversations can be shared
conversation_sharing_policy controls whether agent conversations can be shared
max_subagents_per_environment limits the number of non-terminal sub-agents a parent can have running simultaneously in the same environment. Valid range: 0-10. Zero means use the default (5).
mcp_disabled controls whether MCP (Model Context Protocol) is disabled for agents
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.
EditorVersionRestrictions param.Field[map[string, OrganizationPolicyUpdateParamsEditorVersionRestrictions]]Optionaleditor_version_restrictions restricts which editor versions can be used.
Maps editor ID to version policy with allowed major versions.
editor_version_restrictions restricts which editor versions can be used. Maps editor ID to version policy with allowed major versions.
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
max_port_admission_level caps the maximum admission level a user-opened port may use. UNSPECIFIED means no cap (any AdmissionLevel value is allowed). System ports (VS Code Browser, agents) are exempt. The legacy port_sharing_disabled field, when true, takes precedence and blocks all user-initiated port sharing.
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.
project_creation_defaults contains updates to default settings applied to newly created projects.
project_creation_defaults contains updates to default settings applied to newly created projects.
environment_classes replaces the full list of default environment classes
and their per-class settings. Send an empty list to clear defaults.
environment_classes replaces the full list of default environment classes and their per-class settings. Send an empty list to clear defaults.
prebuild controls whether prebuilds are enabled for this environment class on newly created projects.
insights_enabled controls whether Insights (co-author attribution) is automatically enabled on newly created projects.
Prebuilds OrganizationPolicyUpdateParamsProjectCreationDefaultsPrebuildsOptionalprebuilds updates default prebuild settings for newly created projects.
When absent, prebuild defaults are left unchanged.
prebuilds updates default prebuild settings for newly created projects. When absent, prebuild defaults are left unchanged.
enabled sets or updates persisted prebuild defaults.
enabled sets or updates persisted prebuild defaults.
enable_jetbrains_warmup controls whether JetBrains IDE warmup runs during prebuilds on newly created projects.
prebuild_executor is the service account used to run prebuilds on newly
created projects. Must be a service account (not a user).
prebuild_executor is the service account used to run prebuilds on newly created projects. Must be a service account (not a user).
timeout is the maximum duration allowed for a prebuild to complete. If not specified, defaults to 1 hour. Must be between 5 minutes and 2 hours.
Trigger ProjectCreationDefaultsPrebuildsTriggerOptionaltrigger defines when prebuilds should be created on newly created projects.
trigger defines when prebuilds should be created on newly created projects.
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_agent_policy contains security agent configuration updates
security_agent_policy contains security agent configuration updates
Crowdstrike OrganizationPolicyUpdateParamsSecurityAgentPolicyCrowdstrikeOptionalcrowdstrike contains CrowdStrike Falcon configuration updates
crowdstrike contains CrowdStrike Falcon configuration updates
UpdateOrganizationPolicies
package main
import (
"context"
"fmt"
"github.com/gitpod-io/gitpod-sdk-go"
"github.com/gitpod-io/gitpod-sdk-go/option"
)
func main() {
client := gitpod.NewClient(
option.WithBearerToken("My Bearer Token"),
)
policy, err := client.Organizations.Policies.Update(context.TODO(), gitpod.OrganizationPolicyUpdateParams{
OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
MaximumEnvironmentsPerUser: gitpod.F("20"),
MaximumEnvironmentTimeout: gitpod.F("3600s"),
MaximumRunningEnvironmentsPerUser: gitpod.F("5"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", policy)
}
{}Returns Examples
{}