Skip to content

Commit 8c14eb0

Browse files
feat(api): add project_creation_defaults field to organization policy
1 parent a2b9e42 commit 8c14eb0

4 files changed

Lines changed: 53 additions & 5 deletions

File tree

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 193
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod/gitpod-163329b61609d5c35f782faa460b99ad014584f1f0746d863c5612d6ee6e2c4b.yml
3-
openapi_spec_hash: 97bfee064dda4a0e940140c91fec5206
4-
config_hash: e7d6e90c037f5d495ae913f3806471fd
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod/gitpod-b9c1a7558d4dda4b0e58729d1c14b130d19262615d63ce6c78340daeca76188e.yml
3+
openapi_spec_hash: a91da1453dbfb8aceccb085665b3b21d
4+
config_hash: 9052d3b03d620cf6871184b15487e020

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,7 @@ Response Types:
550550
- <a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#CrowdStrikeConfig">CrowdStrikeConfig</a>
551551
- <a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#KernelControlsAction">KernelControlsAction</a>
552552
- <a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#OrganizationPolicies">OrganizationPolicies</a>
553+
- <a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#ProjectCreationDefaults">ProjectCreationDefaults</a>
553554
- <a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#SecurityAgentPolicy">SecurityAgentPolicy</a>
554555
- <a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#VetoExecPolicy">VetoExecPolicy</a>
555556
- <a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go#OrganizationPolicyGetResponse">OrganizationPolicyGetResponse</a>

organizationpolicy.go

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,9 @@ type OrganizationPolicies struct {
271271
// this == duration('0s') || this >= duration('1800s')
272272
// ```
273273
MaximumEnvironmentTimeout string `json:"maximumEnvironmentTimeout" format:"regex"`
274+
// project_creation_defaults contains default settings applied to newly created
275+
// projects.
276+
ProjectCreationDefaults ProjectCreationDefaults `json:"projectCreationDefaults"`
274277
// security_agent_policy contains security agent configuration for the
275278
// organization. When configured, security agents are automatically deployed to all
276279
// environments.
@@ -300,6 +303,7 @@ type organizationPoliciesJSON struct {
300303
EditorVersionRestrictions apijson.Field
301304
MaximumEnvironmentLifetime apijson.Field
302305
MaximumEnvironmentTimeout apijson.Field
306+
ProjectCreationDefaults apijson.Field
303307
SecurityAgentPolicy apijson.Field
304308
VetoExecPolicy apijson.Field
305309
raw string
@@ -340,6 +344,31 @@ func (r organizationPoliciesEditorVersionRestrictionJSON) RawJSON() string {
340344
return r.raw
341345
}
342346

347+
// ProjectCreationDefaults contains default settings applied to newly created
348+
// projects.
349+
type ProjectCreationDefaults struct {
350+
// insights_enabled controls whether Insights (co-author attribution) is
351+
// automatically enabled on newly created projects.
352+
InsightsEnabled bool `json:"insightsEnabled"`
353+
JSON projectCreationDefaultsJSON `json:"-"`
354+
}
355+
356+
// projectCreationDefaultsJSON contains the JSON metadata for the struct
357+
// [ProjectCreationDefaults]
358+
type projectCreationDefaultsJSON struct {
359+
InsightsEnabled apijson.Field
360+
raw string
361+
ExtraFields map[string]apijson.Field
362+
}
363+
364+
func (r *ProjectCreationDefaults) UnmarshalJSON(data []byte) (err error) {
365+
return apijson.UnmarshalRoot(data, r)
366+
}
367+
368+
func (r projectCreationDefaultsJSON) RawJSON() string {
369+
return r.raw
370+
}
371+
343372
// SecurityAgentPolicy contains security agent configuration for an organization.
344373
// When enabled, security agents are automatically deployed to all environments.
345374
type SecurityAgentPolicy struct {
@@ -497,6 +526,9 @@ type OrganizationPolicyUpdateParams struct {
497526
// in the organization. System ports (VS Code Browser, agents) are always exempt
498527
// from this policy.
499528
PortSharingDisabled param.Field[bool] `json:"portSharingDisabled"`
529+
// project_creation_defaults contains updates to default settings applied to newly
530+
// created projects.
531+
ProjectCreationDefaults param.Field[OrganizationPolicyUpdateParamsProjectCreationDefaults] `json:"projectCreationDefaults"`
500532
// require_custom_domain_access controls whether users must access via custom
501533
// domain when one is configured. When true, access via app.gitpod.io is blocked.
502534
RequireCustomDomainAccess param.Field[bool] `json:"requireCustomDomainAccess"`
@@ -553,6 +585,18 @@ func (r OrganizationPolicyUpdateParamsEditorVersionRestrictions) MarshalJSON() (
553585
return apijson.MarshalRoot(r)
554586
}
555587

588+
// project_creation_defaults contains updates to default settings applied to newly
589+
// created projects.
590+
type OrganizationPolicyUpdateParamsProjectCreationDefaults struct {
591+
// insights_enabled controls whether Insights (co-author attribution) is
592+
// automatically enabled on newly created projects.
593+
InsightsEnabled param.Field[bool] `json:"insightsEnabled"`
594+
}
595+
596+
func (r OrganizationPolicyUpdateParamsProjectCreationDefaults) MarshalJSON() (data []byte, err error) {
597+
return apijson.MarshalRoot(r)
598+
}
599+
556600
// security_agent_policy contains security agent configuration updates
557601
type OrganizationPolicyUpdateParamsSecurityAgentPolicy struct {
558602
// crowdstrike contains CrowdStrike Falcon configuration updates

organizationpolicy_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,11 @@ func TestOrganizationPolicyUpdateWithOptionalParams(t *testing.T) {
7979
MembersCreateProjects: gitpod.F(true),
8080
MembersRequireProjects: gitpod.F(true),
8181
PortSharingDisabled: gitpod.F(true),
82-
RequireCustomDomainAccess: gitpod.F(true),
83-
RestrictAccountCreationToScim: gitpod.F(true),
82+
ProjectCreationDefaults: gitpod.F(gitpod.OrganizationPolicyUpdateParamsProjectCreationDefaults{
83+
InsightsEnabled: gitpod.F(true),
84+
}),
85+
RequireCustomDomainAccess: gitpod.F(true),
86+
RestrictAccountCreationToScim: gitpod.F(true),
8487
SecurityAgentPolicy: gitpod.F(gitpod.OrganizationPolicyUpdateParamsSecurityAgentPolicy{
8588
Crowdstrike: gitpod.F(gitpod.OrganizationPolicyUpdateParamsSecurityAgentPolicyCrowdstrike{
8689
AdditionalOptions: gitpod.F(map[string]string{

0 commit comments

Comments
 (0)