Skip to content

Commit 60b3e5e

Browse files
feat(api): manual updates
1 parent 3ecd0c4 commit 60b3e5e

File tree

7 files changed

+148
-26
lines changed

7 files changed

+148
-26
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 116
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-d854bc81e0a99171716893e6790a87ba350bb6fc778f8e3244abdd47d5c252c3.yml
3-
openapi_spec_hash: 5189220e4712a7b0cdd35beba2ebb47d
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-2e6ddfc9da00e33fcf13baf0b67012b97f051fa986658ff114fde989e56caa94.yml
3+
openapi_spec_hash: 5af02ea2008312d609394e548756e761
44
config_hash: 60929489bdc1eaf979e7ef74fdd17b94

runner.go

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,10 @@ func (r RunnerCapability) IsKnown() bool {
458458
type RunnerConfiguration struct {
459459
// auto_update indicates whether the runner should automatically update itself.
460460
AutoUpdate bool `json:"autoUpdate"`
461+
// devcontainer_image_cache_enabled controls whether the devcontainer build cache
462+
// is enabled for this runner. Only takes effect on supported runners, currently
463+
// only AWS EC2 runners.
464+
DevcontainerImageCacheEnabled bool `json:"devcontainerImageCacheEnabled"`
461465
// log_level is the log level for the runner
462466
LogLevel LogLevel `json:"logLevel"`
463467
// metrics contains configuration for the runner's metrics collection
@@ -474,13 +478,14 @@ type RunnerConfiguration struct {
474478
// runnerConfigurationJSON contains the JSON metadata for the struct
475479
// [RunnerConfiguration]
476480
type runnerConfigurationJSON struct {
477-
AutoUpdate apijson.Field
478-
LogLevel apijson.Field
479-
Metrics apijson.Field
480-
Region apijson.Field
481-
ReleaseChannel apijson.Field
482-
raw string
483-
ExtraFields map[string]apijson.Field
481+
AutoUpdate apijson.Field
482+
DevcontainerImageCacheEnabled apijson.Field
483+
LogLevel apijson.Field
484+
Metrics apijson.Field
485+
Region apijson.Field
486+
ReleaseChannel apijson.Field
487+
raw string
488+
ExtraFields map[string]apijson.Field
484489
}
485490

486491
func (r *RunnerConfiguration) UnmarshalJSON(data []byte) (err error) {
@@ -494,6 +499,10 @@ func (r runnerConfigurationJSON) RawJSON() string {
494499
type RunnerConfigurationParam struct {
495500
// auto_update indicates whether the runner should automatically update itself.
496501
AutoUpdate param.Field[bool] `json:"autoUpdate"`
502+
// devcontainer_image_cache_enabled controls whether the devcontainer build cache
503+
// is enabled for this runner. Only takes effect on supported runners, currently
504+
// only AWS EC2 runners.
505+
DevcontainerImageCacheEnabled param.Field[bool] `json:"devcontainerImageCacheEnabled"`
497506
// log_level is the log level for the runner
498507
LogLevel param.Field[LogLevel] `json:"logLevel"`
499508
// metrics contains configuration for the runner's metrics collection
@@ -971,6 +980,9 @@ func (r RunnerUpdateParamsSpec) MarshalJSON() (data []byte, err error) {
971980
type RunnerUpdateParamsSpecConfiguration struct {
972981
// auto_update indicates whether the runner should automatically update itself.
973982
AutoUpdate param.Field[bool] `json:"autoUpdate"`
983+
// devcontainer_image_cache_enabled controls whether the shared devcontainer build
984+
// cache is enabled for this runner.
985+
DevcontainerImageCacheEnabled param.Field[bool] `json:"devcontainerImageCacheEnabled"`
974986
// log_level is the log level for the runner
975987
LogLevel param.Field[LogLevel] `json:"logLevel"`
976988
// metrics contains configuration for the runner's metrics collection

runner_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ func TestRunnerNewWithOptionalParams(t *testing.T) {
3232
Provider: gitpod.F(gitpod.RunnerProviderAwsEc2),
3333
Spec: gitpod.F(gitpod.RunnerSpecParam{
3434
Configuration: gitpod.F(gitpod.RunnerConfigurationParam{
35-
AutoUpdate: gitpod.F(true),
36-
LogLevel: gitpod.F(gitpod.LogLevelUnspecified),
35+
AutoUpdate: gitpod.F(true),
36+
DevcontainerImageCacheEnabled: gitpod.F(true),
37+
LogLevel: gitpod.F(gitpod.LogLevelUnspecified),
3738
Metrics: gitpod.F(gitpod.MetricsConfigurationParam{
3839
Enabled: gitpod.F(true),
3940
Password: gitpod.F("password"),
@@ -98,8 +99,9 @@ func TestRunnerUpdateWithOptionalParams(t *testing.T) {
9899
RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
99100
Spec: gitpod.F(gitpod.RunnerUpdateParamsSpec{
100101
Configuration: gitpod.F(gitpod.RunnerUpdateParamsSpecConfiguration{
101-
AutoUpdate: gitpod.F(true),
102-
LogLevel: gitpod.F(gitpod.LogLevelUnspecified),
102+
AutoUpdate: gitpod.F(true),
103+
DevcontainerImageCacheEnabled: gitpod.F(true),
104+
LogLevel: gitpod.F(gitpod.LogLevelUnspecified),
103105
Metrics: gitpod.F(gitpod.RunnerUpdateParamsSpecConfigurationMetrics{
104106
Enabled: gitpod.F(true),
105107
Password: gitpod.F("password"),

secret.go

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,38 @@ func (r *SecretService) New(ctx context.Context, body SecretNewParams, opts ...o
8686
return
8787
}
8888

89-
// ListSecrets
89+
// Lists secrets
90+
//
91+
// Use this method to:
92+
//
93+
// - View all project secrets
94+
// - View all user secrets
95+
//
96+
// ### Examples
97+
//
98+
// - List project secrets:
99+
//
100+
// Shows all secrets for a project.
101+
//
102+
// ```yaml
103+
// filter:
104+
// scope:
105+
// projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
106+
// pagination:
107+
// pageSize: 20
108+
// ```
109+
//
110+
// - List user secrets:
111+
//
112+
// Shows all secrets for a user.
113+
//
114+
// ```yaml
115+
// filter:
116+
// scope:
117+
// userId: "123e4567-e89b-12d3-a456-426614174000"
118+
// pagination:
119+
// pageSize: 20
120+
// ```
90121
func (r *SecretService) List(ctx context.Context, params SecretListParams, opts ...option.RequestOption) (res *pagination.SecretsPage[Secret], err error) {
91122
var raw *http.Response
92123
opts = append(r.Options[:], opts...)
@@ -104,7 +135,38 @@ func (r *SecretService) List(ctx context.Context, params SecretListParams, opts
104135
return res, nil
105136
}
106137

107-
// ListSecrets
138+
// Lists secrets
139+
//
140+
// Use this method to:
141+
//
142+
// - View all project secrets
143+
// - View all user secrets
144+
//
145+
// ### Examples
146+
//
147+
// - List project secrets:
148+
//
149+
// Shows all secrets for a project.
150+
//
151+
// ```yaml
152+
// filter:
153+
// scope:
154+
// projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
155+
// pagination:
156+
// pageSize: 20
157+
// ```
158+
//
159+
// - List user secrets:
160+
//
161+
// Shows all secrets for a user.
162+
//
163+
// ```yaml
164+
// filter:
165+
// scope:
166+
// userId: "123e4567-e89b-12d3-a456-426614174000"
167+
// pagination:
168+
// pageSize: 20
169+
// ```
108170
func (r *SecretService) ListAutoPaging(ctx context.Context, params SecretListParams, opts ...option.RequestOption) *pagination.SecretsPageAutoPager[Secret] {
109171
return pagination.NewSecretsPageAutoPager(r.List(ctx, params, opts...))
110172
}

secret_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ func TestSecretListWithOptionalParams(t *testing.T) {
6666
Filter: gitpod.F(gitpod.SecretListParamsFilter{
6767
ProjectIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
6868
Scope: gitpod.F(gitpod.SecretScopeParam{
69-
ProjectID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
69+
ProjectID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
7070
UserID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
7171
}),
7272
}),
7373
Pagination: gitpod.F(gitpod.SecretListParamsPagination{
7474
Token: gitpod.F("token"),
75-
PageSize: gitpod.F(int64(100)),
75+
PageSize: gitpod.F(int64(20)),
7676
}),
7777
})
7878
if err != nil {

usage.go

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,33 @@ func NewUsageService(opts ...option.RequestOption) (r *UsageService) {
3535
return
3636
}
3737

38-
// Lists environment sessions within a specified date range.
38+
// Lists completed environment sessions within a specified date range.
3939
//
40-
// Returns a list of environment sessions that were active within the specified
41-
// date range.
40+
// Returns a list of environment sessions that were completed within the specified
41+
// date range. Currently running sessions are not included.
42+
//
43+
// Use this method to:
44+
//
45+
// - View environment sessions
46+
// - Filter by project
47+
// - Monitor session activity
48+
// - Create custom usage reports
49+
//
50+
// ### Example
51+
//
52+
// ```yaml
53+
// filter:
54+
//
55+
// projectId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
56+
// dateRange:
57+
// startTime: "2024-01-01T00:00:00Z"
58+
// endTime: "2024-01-02T00:00:00Z"
59+
//
60+
// pagination:
61+
//
62+
// pageSize: 100
63+
//
64+
// ```
4265
func (r *UsageService) ListEnvironmentSessions(ctx context.Context, params UsageListEnvironmentSessionsParams, opts ...option.RequestOption) (res *pagination.SessionsPage[EnvironmentSession], err error) {
4366
var raw *http.Response
4467
opts = append(r.Options[:], opts...)
@@ -56,10 +79,33 @@ func (r *UsageService) ListEnvironmentSessions(ctx context.Context, params Usage
5679
return res, nil
5780
}
5881

59-
// Lists environment sessions within a specified date range.
82+
// Lists completed environment sessions within a specified date range.
83+
//
84+
// Returns a list of environment sessions that were completed within the specified
85+
// date range. Currently running sessions are not included.
86+
//
87+
// Use this method to:
88+
//
89+
// - View environment sessions
90+
// - Filter by project
91+
// - Monitor session activity
92+
// - Create custom usage reports
93+
//
94+
// ### Example
95+
//
96+
// ```yaml
97+
// filter:
98+
//
99+
// projectId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
100+
// dateRange:
101+
// startTime: "2024-01-01T00:00:00Z"
102+
// endTime: "2024-01-02T00:00:00Z"
103+
//
104+
// pagination:
105+
//
106+
// pageSize: 100
60107
//
61-
// Returns a list of environment sessions that were active within the specified
62-
// date range.
108+
// ```
63109
func (r *UsageService) ListEnvironmentSessionsAutoPaging(ctx context.Context, params UsageListEnvironmentSessionsParams, opts ...option.RequestOption) *pagination.SessionsPageAutoPager[EnvironmentSession] {
64110
return pagination.NewSessionsPageAutoPager(r.ListEnvironmentSessions(ctx, params, opts...))
65111
}
@@ -73,13 +119,13 @@ type EnvironmentSession struct {
73119
EnvironmentClassID string `json:"environmentClassId"`
74120
// Environment ID associated with the session.
75121
EnvironmentID string `json:"environmentId"`
76-
// Project ID associated with the session.
122+
// Project ID associated with the session (if available).
77123
ProjectID string `json:"projectId"`
78124
// Runner ID associated with the session.
79125
RunnerID string `json:"runnerId"`
80126
// Time when the session was stopped.
81127
StoppedAt time.Time `json:"stoppedAt" format:"date-time"`
82-
// User ID who created the session.
128+
// User ID that created the session.
83129
UserID string `json:"userId"`
84130
JSON environmentSessionJSON `json:"-"`
85131
}

usage_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func TestUsageListEnvironmentSessionsWithOptionalParams(t *testing.T) {
3535
EndTime: gitpod.F(time.Now()),
3636
StartTime: gitpod.F(time.Now()),
3737
}),
38-
ProjectID: gitpod.F("projectId"),
38+
ProjectID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
3939
}),
4040
Pagination: gitpod.F(gitpod.UsageListEnvironmentSessionsParamsPagination{
4141
Token: gitpod.F("token"),

0 commit comments

Comments
 (0)