From dfee19e63c7697876819a9bf516ec4466a3179ee Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Mon, 15 Dec 2025 13:54:37 +0000
Subject: [PATCH 1/2] feat(api): RBAC APIs
---
.stats.yml | 8 +-
README.md | 2 +-
SECURITY.md | 2 +-
account.go | 146 +-
account_test.go | 41 +-
agent.go | 1815 +++++++++++++++++
agent_test.go | 386 ++++
aliases.go | 198 +-
api.md | 206 +-
client.go | 6 +
editor.go | 45 +-
editor_test.go | 3 +-
environment.go | 213 +-
environment_test.go | 36 +-
environmentautomation.go | 21 +-
environmentautomation_test.go | 3 +
environmentautomationservice.go | 32 +
environmentautomationservice_test.go | 29 +-
environmentautomationtask.go | 5 +-
environmentautomationtask_test.go | 26 +-
error.go | 234 +++
error_test.go | 114 ++
event.go | 50 +-
event_test.go | 2 +-
group.go | 247 ++-
group_test.go | 104 +
groupmembership.go | 273 +++
groupmembership_test.go | 100 +
grouproleassignment.go | 399 ++++
grouproleassignment_test.go | 104 +
organization.go | 24 +-
organization_test.go | 3 +
organizationcustomdomain.go | 315 +++
organizationcustomdomain_test.go | 122 ++
organizationpolicy.go | 231 ++-
organizationpolicy_test.go | 34 +-
organizationssoconfiguration.go | 22 +-
organizationssoconfiguration_test.go | 8 +-
packages/pagination/pagination.go | 1359 ++++++++++--
prebuild.go | 611 ++++++
prebuild_test.go | 179 ++
project.go | 280 ++-
project_test.go | 43 +-
projectenvironmentclase.go | 167 ++
projectenvironmentclase_test.go | 80 +
runner.go | 470 ++++-
runner_test.go | 59 +
runnerconfiguration.go | 5 +
runnerconfiguration_test.go | 1 +
runnerconfigurationhostauthenticationtoken.go | 72 +-
...nfigurationhostauthenticationtoken_test.go | 27 +-
runnerconfigurationscmintegration.go | 36 +-
runnerconfigurationscmintegration_test.go | 2 +
secret.go | 20 +-
secret_test.go | 11 +-
shared/shared.go | 265 ++-
user.go | 75 +
user_test.go | 50 +
58 files changed, 8907 insertions(+), 514 deletions(-)
create mode 100644 agent.go
create mode 100644 agent_test.go
create mode 100644 error.go
create mode 100644 error_test.go
create mode 100644 groupmembership.go
create mode 100644 groupmembership_test.go
create mode 100644 grouproleassignment.go
create mode 100644 grouproleassignment_test.go
create mode 100644 organizationcustomdomain.go
create mode 100644 organizationcustomdomain_test.go
create mode 100644 prebuild.go
create mode 100644 prebuild_test.go
create mode 100644 projectenvironmentclase.go
create mode 100644 projectenvironmentclase_test.go
diff --git a/.stats.yml b/.stats.yml
index 9333247..0fdb5b6 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 119
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-ca9a49ac7fbb63f55611fd7cd48a22a3ff8b38a797125c8513e891d9b7345550.yml
-openapi_spec_hash: fd6ffbdfaefcc555e61ca1c565e05214
-config_hash: 7fb76543ceafd4a116473f647f8d63b1
+configured_endpoints: 159
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-d62ef4b9187c1f3d36f428abc4b31d8a09ffd36e93d39b8136c60c8f463c838e.yml
+openapi_spec_hash: d7f01b6f24e88eb46d744ecd28061f26
+config_hash: 26e4a10dfc6ec809322e60d889d15414
diff --git a/README.md b/README.md
index 14447de..b91a3f2 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
-The Gitpod Go library provides convenient access to the [Gitpod REST API](https://docs.ona.com)
+The Gitpod Go library provides convenient access to the [Gitpod REST API](https://docs.gitpod.io)
from applications written in Go.
It is generated with [Stainless](https://www.stainless.com/).
diff --git a/SECURITY.md b/SECURITY.md
index 8975e82..efd9088 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -20,7 +20,7 @@ or products provided by Gitpod, please follow the respective company's security
### Gitpod Terms and Policies
-Please contact dev-feedback@ona.com for any questions or concerns regarding the security of our services.
+Please contact dev-feedback@gitpod.com for any questions or concerns regarding the security of our services.
---
diff --git a/account.go b/account.go
index 916ab6c..25a9d25 100644
--- a/account.go
+++ b/account.go
@@ -138,11 +138,42 @@ func (r *AccountService) GetSSOLoginURL(ctx context.Context, body AccountGetSSOL
// ```yaml
// {}
// ```
-func (r *AccountService) ListJoinableOrganizations(ctx context.Context, params AccountListJoinableOrganizationsParams, opts ...option.RequestOption) (res *AccountListJoinableOrganizationsResponse, err error) {
+func (r *AccountService) ListJoinableOrganizations(ctx context.Context, params AccountListJoinableOrganizationsParams, opts ...option.RequestOption) (res *pagination.JoinableOrganizationsPage[JoinableOrganization], err error) {
+ var raw *http.Response
opts = slices.Concat(r.Options, opts)
+ opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "gitpod.v1.AccountService/ListJoinableOrganizations"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
- return
+ cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...)
+ if err != nil {
+ return nil, err
+ }
+ err = cfg.Execute()
+ if err != nil {
+ return nil, err
+ }
+ res.SetPageConfig(cfg, raw)
+ return res, nil
+}
+
+// Lists organizations that the currently authenticated account can join.
+//
+// Use this method to:
+//
+// - Discover organizations associated with the account's email domain.
+// - Allow users to join existing organizations.
+// - Display potential organizations during onboarding.
+//
+// ### Examples
+//
+// - List joinable organizations:
+//
+// Retrieves a list of organizations the account can join.
+//
+// ```yaml
+// {}
+// ```
+func (r *AccountService) ListJoinableOrganizationsAutoPaging(ctx context.Context, params AccountListJoinableOrganizationsParams, opts ...option.RequestOption) *pagination.JoinableOrganizationsPageAutoPager[JoinableOrganization] {
+ return pagination.NewJoinableOrganizationsPageAutoPager(r.ListJoinableOrganizations(ctx, params, opts...))
}
// Lists available login providers with optional filtering.
@@ -224,6 +255,29 @@ func (r *AccountService) ListLoginProvidersAutoPaging(ctx context.Context, param
return pagination.NewLoginProvidersPageAutoPager(r.ListLoginProviders(ctx, params, opts...))
}
+// ListSSOLogins
+func (r *AccountService) ListSSOLogins(ctx context.Context, params AccountListSSOLoginsParams, opts ...option.RequestOption) (res *pagination.LoginsPage[AccountListSSOLoginsResponse], err error) {
+ var raw *http.Response
+ opts = slices.Concat(r.Options, opts)
+ opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
+ path := "gitpod.v1.AccountService/ListSSOLogins"
+ cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...)
+ if err != nil {
+ return nil, err
+ }
+ err = cfg.Execute()
+ if err != nil {
+ return nil, err
+ }
+ res.SetPageConfig(cfg, raw)
+ return res, nil
+}
+
+// ListSSOLogins
+func (r *AccountService) ListSSOLoginsAutoPaging(ctx context.Context, params AccountListSSOLoginsParams, opts ...option.RequestOption) *pagination.LoginsPageAutoPager[AccountListSSOLoginsResponse] {
+ return pagination.NewLoginsPageAutoPager(r.ListSSOLogins(ctx, params, opts...))
+}
+
type Account struct {
ID string `json:"id,required" format:"uuid"`
// A Timestamp represents a point in time independent of any time zone or local
@@ -580,24 +634,29 @@ func (r accountGetSSOLoginURLResponseJSON) RawJSON() string {
return r.raw
}
-type AccountListJoinableOrganizationsResponse struct {
- JoinableOrganizations []JoinableOrganization `json:"joinableOrganizations"`
- JSON accountListJoinableOrganizationsResponseJSON `json:"-"`
+type AccountListSSOLoginsResponse struct {
+ // provider is the provider used by this login method, e.g. "github", "google",
+ // "custom"
+ DisplayName string `json:"displayName,required"`
+ // login_url is the URL to redirect the user to for SSO login
+ LoginURL string `json:"loginUrl,required"`
+ JSON accountListSSOLoginsResponseJSON `json:"-"`
}
-// accountListJoinableOrganizationsResponseJSON contains the JSON metadata for the
-// struct [AccountListJoinableOrganizationsResponse]
-type accountListJoinableOrganizationsResponseJSON struct {
- JoinableOrganizations apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
+// accountListSSOLoginsResponseJSON contains the JSON metadata for the struct
+// [AccountListSSOLoginsResponse]
+type accountListSSOLoginsResponseJSON struct {
+ DisplayName apijson.Field
+ LoginURL apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
}
-func (r *AccountListJoinableOrganizationsResponse) UnmarshalJSON(data []byte) (err error) {
+func (r *AccountListSSOLoginsResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r accountListJoinableOrganizationsResponseJSON) RawJSON() string {
+func (r accountListSSOLoginsResponseJSON) RawJSON() string {
return r.raw
}
@@ -611,6 +670,8 @@ func (r AccountGetParams) MarshalJSON() (data []byte, err error) {
type AccountDeleteParams struct {
AccountID param.Field[string] `json:"accountId,required" format:"uuid"`
+ // reason is an optional field for the reason for account deletion
+ Reason param.Field[string] `json:"reason"`
}
func (r AccountDeleteParams) MarshalJSON() (data []byte, err error) {
@@ -631,7 +692,8 @@ func (r AccountGetSSOLoginURLParams) MarshalJSON() (data []byte, err error) {
type AccountListJoinableOrganizationsParams struct {
Token param.Field[string] `query:"token"`
PageSize param.Field[int64] `query:"pageSize"`
- Empty param.Field[bool] `json:"empty"`
+ // pagination contains the pagination options for listing joinable organizations
+ Pagination param.Field[AccountListJoinableOrganizationsParamsPagination] `json:"pagination"`
}
func (r AccountListJoinableOrganizationsParams) MarshalJSON() (data []byte, err error) {
@@ -647,6 +709,20 @@ func (r AccountListJoinableOrganizationsParams) URLQuery() (v url.Values) {
})
}
+// pagination contains the pagination options for listing joinable organizations
+type AccountListJoinableOrganizationsParamsPagination struct {
+ // Token for the next set of results that was returned as next_token of a
+ // PaginationResponse
+ Token param.Field[string] `json:"token"`
+ // Page size is the maximum number of results to retrieve per page. Defaults to 25.
+ // Maximum 100.
+ PageSize param.Field[int64] `json:"pageSize"`
+}
+
+func (r AccountListJoinableOrganizationsParamsPagination) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
type AccountListLoginProvidersParams struct {
Token param.Field[string] `query:"token"`
PageSize param.Field[int64] `query:"pageSize"`
@@ -671,6 +747,8 @@ func (r AccountListLoginProvidersParams) URLQuery() (v url.Values) {
// filter contains the filter options for listing login methods
type AccountListLoginProvidersParamsFilter struct {
+ // email is the email address to filter SSO providers by
+ Email param.Field[string] `json:"email"`
// invite_id is the ID of the invite URL the user wants to login with
InviteID param.Field[string] `json:"inviteId" format:"uuid"`
}
@@ -692,3 +770,41 @@ type AccountListLoginProvidersParamsPagination struct {
func (r AccountListLoginProvidersParamsPagination) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
+
+type AccountListSSOLoginsParams struct {
+ // email is the email the user wants to login with
+ Email param.Field[string] `json:"email,required" format:"email"`
+ Token param.Field[string] `query:"token"`
+ PageSize param.Field[int64] `query:"pageSize"`
+ // pagination contains the pagination options for listing SSO logins
+ Pagination param.Field[AccountListSSOLoginsParamsPagination] `json:"pagination"`
+ // return_to is the URL the user will be redirected to after login
+ ReturnTo param.Field[string] `json:"returnTo" format:"uri"`
+}
+
+func (r AccountListSSOLoginsParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// URLQuery serializes [AccountListSSOLoginsParams]'s query parameters as
+// `url.Values`.
+func (r AccountListSSOLoginsParams) URLQuery() (v url.Values) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatComma,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
+
+// pagination contains the pagination options for listing SSO logins
+type AccountListSSOLoginsParamsPagination struct {
+ // Token for the next set of results that was returned as next_token of a
+ // PaginationResponse
+ Token param.Field[string] `json:"token"`
+ // Page size is the maximum number of results to retrieve per page. Defaults to 25.
+ // Maximum 100.
+ PageSize param.Field[int64] `json:"pageSize"`
+}
+
+func (r AccountListSSOLoginsParamsPagination) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
diff --git a/account_test.go b/account_test.go
index 32a3af8..30ef632 100644
--- a/account_test.go
+++ b/account_test.go
@@ -38,7 +38,7 @@ func TestAccountGetWithOptionalParams(t *testing.T) {
}
}
-func TestAccountDelete(t *testing.T) {
+func TestAccountDeleteWithOptionalParams(t *testing.T) {
t.Skip("Prism tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -53,6 +53,7 @@ func TestAccountDelete(t *testing.T) {
)
_, err := client.Accounts.Delete(context.TODO(), gitpod.AccountDeleteParams{
AccountID: gitpod.F("f53d2330-3795-4c5d-a1f3-453121af9c60"),
+ Reason: gitpod.F("reason"),
})
if err != nil {
var apierr *gitpod.Error
@@ -105,7 +106,10 @@ func TestAccountListJoinableOrganizationsWithOptionalParams(t *testing.T) {
_, err := client.Accounts.ListJoinableOrganizations(context.TODO(), gitpod.AccountListJoinableOrganizationsParams{
Token: gitpod.F("token"),
PageSize: gitpod.F(int64(0)),
- Empty: gitpod.F(true),
+ Pagination: gitpod.F(gitpod.AccountListJoinableOrganizationsParamsPagination{
+ Token: gitpod.F("token"),
+ PageSize: gitpod.F(int64(100)),
+ }),
})
if err != nil {
var apierr *gitpod.Error
@@ -133,6 +137,7 @@ func TestAccountListLoginProvidersWithOptionalParams(t *testing.T) {
Token: gitpod.F("token"),
PageSize: gitpod.F(int64(0)),
Filter: gitpod.F(gitpod.AccountListLoginProvidersParamsFilter{
+ Email: gitpod.F("email"),
InviteID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
}),
Pagination: gitpod.F(gitpod.AccountListLoginProvidersParamsPagination{
@@ -148,3 +153,35 @@ func TestAccountListLoginProvidersWithOptionalParams(t *testing.T) {
t.Fatalf("err should be nil: %s", err.Error())
}
}
+
+func TestAccountListSSOLoginsWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Accounts.ListSSOLogins(context.TODO(), gitpod.AccountListSSOLoginsParams{
+ Email: gitpod.F("dev@stainless.com"),
+ Token: gitpod.F("token"),
+ PageSize: gitpod.F(int64(0)),
+ Pagination: gitpod.F(gitpod.AccountListSSOLoginsParamsPagination{
+ Token: gitpod.F("token"),
+ PageSize: gitpod.F(int64(100)),
+ }),
+ ReturnTo: gitpod.F("https://example.com"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/agent.go b/agent.go
new file mode 100644
index 0000000..b9b3080
--- /dev/null
+++ b/agent.go
@@ -0,0 +1,1815 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package gitpod
+
+import (
+ "context"
+ "net/http"
+ "net/url"
+ "slices"
+ "time"
+
+ "github.com/gitpod-io/gitpod-sdk-go/internal/apijson"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/apiquery"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/param"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/requestconfig"
+ "github.com/gitpod-io/gitpod-sdk-go/option"
+ "github.com/gitpod-io/gitpod-sdk-go/packages/pagination"
+ "github.com/gitpod-io/gitpod-sdk-go/shared"
+)
+
+// AgentService contains methods and other services that help with interacting with
+// the gitpod API.
+//
+// Note, unlike clients, this service does not read variables from the environment
+// automatically. You should not instantiate this service directly, and instead use
+// the [NewAgentService] method instead.
+type AgentService struct {
+ Options []option.RequestOption
+}
+
+// NewAgentService generates a new service that applies the given options to each
+// request. These options are applied after the parent client's options (if there
+// is one), and before any request-specific options.
+func NewAgentService(opts ...option.RequestOption) (r *AgentService) {
+ r = &AgentService{}
+ r.Options = opts
+ return
+}
+
+// Creates a token for conversation access with a specific agent run.
+//
+// This method generates a temporary token that can be used to securely connect to
+// an ongoing agent conversation, for example in a web UI.
+//
+// ### Examples
+//
+// - Create a token to join an agent run conversation in a front-end application:
+//
+// ```yaml
+// agentExecutionId: "6fa1a3c7-fbb7-49d1-ba56-1890dc7c4c35"
+// ```
+func (r *AgentService) NewExecutionConversationToken(ctx context.Context, body AgentNewExecutionConversationTokenParams, opts ...option.RequestOption) (res *AgentNewExecutionConversationTokenResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.AgentService/CreateAgentExecutionConversationToken"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Creates a new prompt.
+//
+// Use this method to:
+//
+// - Define new prompts for templates or commands
+// - Set up organization-wide prompt libraries
+func (r *AgentService) NewPrompt(ctx context.Context, body AgentNewPromptParams, opts ...option.RequestOption) (res *AgentNewPromptResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.AgentService/CreatePrompt"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Deletes an agent run.
+//
+// Use this method to:
+//
+// - Clean up agent runs that are no longer needed
+//
+// ### Examples
+//
+// - Delete an agent run by ID:
+//
+// ```yaml
+// agentExecutionId: "6fa1a3c7-fbb7-49d1-ba56-1890dc7c4c35"
+// ```
+func (r *AgentService) DeleteExecution(ctx context.Context, body AgentDeleteExecutionParams, opts ...option.RequestOption) (res *AgentDeleteExecutionResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.AgentService/DeleteAgentExecution"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Deletes a prompt.
+//
+// Use this method to:
+//
+// - Remove unused prompts
+func (r *AgentService) DeletePrompt(ctx context.Context, body AgentDeletePromptParams, opts ...option.RequestOption) (res *AgentDeletePromptResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.AgentService/DeletePrompt"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Lists all agent runs matching the specified filter.
+//
+// Use this method to track multiple agent runs and their associated resources.
+// Results are ordered by their creation time with the newest first.
+//
+// ### Examples
+//
+// - List agent runs by agent ID:
+//
+// ```yaml
+// filter:
+// agentIds: ["b8a64cfa-43e2-4b9d-9fb3-07edc63f5971"]
+// pagination:
+// pageSize: 10
+// ```
+func (r *AgentService) ListExecutions(ctx context.Context, params AgentListExecutionsParams, opts ...option.RequestOption) (res *pagination.AgentExecutionsPage[AgentExecution], err error) {
+ var raw *http.Response
+ opts = slices.Concat(r.Options, opts)
+ opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
+ path := "gitpod.v1.AgentService/ListAgentExecutions"
+ cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...)
+ if err != nil {
+ return nil, err
+ }
+ err = cfg.Execute()
+ if err != nil {
+ return nil, err
+ }
+ res.SetPageConfig(cfg, raw)
+ return res, nil
+}
+
+// Lists all agent runs matching the specified filter.
+//
+// Use this method to track multiple agent runs and their associated resources.
+// Results are ordered by their creation time with the newest first.
+//
+// ### Examples
+//
+// - List agent runs by agent ID:
+//
+// ```yaml
+// filter:
+// agentIds: ["b8a64cfa-43e2-4b9d-9fb3-07edc63f5971"]
+// pagination:
+// pageSize: 10
+// ```
+func (r *AgentService) ListExecutionsAutoPaging(ctx context.Context, params AgentListExecutionsParams, opts ...option.RequestOption) *pagination.AgentExecutionsPageAutoPager[AgentExecution] {
+ return pagination.NewAgentExecutionsPageAutoPager(r.ListExecutions(ctx, params, opts...))
+}
+
+// Lists all prompts matching the specified criteria.
+//
+// Use this method to find and browse prompts across your organization. Results are
+// ordered by their creation time with the newest first.
+//
+// ### Examples
+//
+// - List all prompts:
+//
+// Retrieves all prompts with pagination.
+//
+// ```yaml
+// pagination:
+// pageSize: 10
+// ```
+func (r *AgentService) ListPrompts(ctx context.Context, params AgentListPromptsParams, opts ...option.RequestOption) (res *pagination.PromptsPage[Prompt], err error) {
+ var raw *http.Response
+ opts = slices.Concat(r.Options, opts)
+ opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
+ path := "gitpod.v1.AgentService/ListPrompts"
+ cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...)
+ if err != nil {
+ return nil, err
+ }
+ err = cfg.Execute()
+ if err != nil {
+ return nil, err
+ }
+ res.SetPageConfig(cfg, raw)
+ return res, nil
+}
+
+// Lists all prompts matching the specified criteria.
+//
+// Use this method to find and browse prompts across your organization. Results are
+// ordered by their creation time with the newest first.
+//
+// ### Examples
+//
+// - List all prompts:
+//
+// Retrieves all prompts with pagination.
+//
+// ```yaml
+// pagination:
+// pageSize: 10
+// ```
+func (r *AgentService) ListPromptsAutoPaging(ctx context.Context, params AgentListPromptsParams, opts ...option.RequestOption) *pagination.PromptsPageAutoPager[Prompt] {
+ return pagination.NewPromptsPageAutoPager(r.ListPrompts(ctx, params, opts...))
+}
+
+// Gets details about a specific agent run, including its metadata, specification,
+// and status (phase, error messages, and usage statistics).
+//
+// Use this method to:
+//
+// - Monitor the run's progress
+// - Retrieve the agent's conversation URL
+// - Check if an agent run is actively producing output
+//
+// ### Examples
+//
+// - Get agent run details by ID:
+//
+// ```yaml
+// agentExecutionId: "6fa1a3c7-fbb7-49d1-ba56-1890dc7c4c35"
+// ```
+func (r *AgentService) GetExecution(ctx context.Context, body AgentGetExecutionParams, opts ...option.RequestOption) (res *AgentGetExecutionResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.AgentService/GetAgentExecution"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Gets details about a specific prompt including name, description, and prompt
+// content.
+//
+// Use this method to:
+//
+// - Retrieve prompt details for editing
+// - Get prompt content for execution
+//
+// ### Examples
+//
+// - Get prompt details:
+//
+// ```yaml
+// promptId: "07e03a28-65a5-4d98-b532-8ea67b188048"
+// ```
+func (r *AgentService) GetPrompt(ctx context.Context, body AgentGetPromptParams, opts ...option.RequestOption) (res *AgentGetPromptResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.AgentService/GetPrompt"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Sends user input to an active agent run.
+//
+// This method is used to provide interactive or conversation-based input to an
+// agent. The agent can respond with output blocks containing text, file changes,
+// or tool usage requests.
+//
+// ### Examples
+//
+// - Send a text message to an agent:
+//
+// ```yaml
+// agentExecutionId: "6fa1a3c7-fbb7-49d1-ba56-1890dc7c4c35"
+// userInput:
+// text:
+// content: "Generate a report based on the latest logs."
+// ```
+func (r *AgentService) SendToExecution(ctx context.Context, body AgentSendToExecutionParams, opts ...option.RequestOption) (res *AgentSendToExecutionResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.AgentService/SendToAgentExecution"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Starts (or triggers) an agent run using a provided agent.
+//
+// Use this method to:
+//
+// - Launch an agent based on a known agent
+//
+// ### Examples
+//
+// - Start an agent with a project ID:
+//
+// ```yaml
+// agentId: "b8a64cfa-43e2-4b9d-9fb3-07edc63f5971"
+// codeContext:
+// projectId: "2d22e4eb-31da-467f-882c-27e21550992f"
+// ```
+func (r *AgentService) StartExecution(ctx context.Context, body AgentStartExecutionParams, opts ...option.RequestOption) (res *AgentStartExecutionResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.AgentService/StartAgent"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Stops an active agent execution.
+//
+// Use this method to:
+//
+// - Stop an agent that is currently running
+// - Prevent further processing or resource usage
+//
+// ### Examples
+//
+// - Stop an agent execution by ID:
+//
+// ```yaml
+// agentExecutionId: "6fa1a3c7-fbb7-49d1-ba56-1890dc7c4c35"
+// ```
+func (r *AgentService) StopExecution(ctx context.Context, body AgentStopExecutionParams, opts ...option.RequestOption) (res *AgentStopExecutionResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.AgentService/StopAgentExecution"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Updates an existing prompt.
+//
+// Use this method to:
+//
+// - Modify prompt content or metadata
+// - Change prompt type (template/command)
+func (r *AgentService) UpdatePrompt(ctx context.Context, body AgentUpdatePromptParams, opts ...option.RequestOption) (res *AgentUpdatePromptResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.AgentService/UpdatePrompt"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+type AgentCodeContext struct {
+ ContextURL AgentCodeContextContextURL `json:"contextUrl"`
+ EnvironmentID string `json:"environmentId" format:"uuid"`
+ ProjectID string `json:"projectId" format:"uuid"`
+ // Pull request context - optional metadata about the PR being worked on This is
+ // populated when the agent execution is triggered by a PR workflow or when
+ // explicitly provided through the browser extension
+ PullRequest AgentCodeContextPullRequest `json:"pullRequest,nullable"`
+ JSON agentCodeContextJSON `json:"-"`
+}
+
+// agentCodeContextJSON contains the JSON metadata for the struct
+// [AgentCodeContext]
+type agentCodeContextJSON struct {
+ ContextURL apijson.Field
+ EnvironmentID apijson.Field
+ ProjectID apijson.Field
+ PullRequest apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AgentCodeContext) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r agentCodeContextJSON) RawJSON() string {
+ return r.raw
+}
+
+type AgentCodeContextContextURL struct {
+ EnvironmentClassID string `json:"environmentClassId" format:"uuid"`
+ URL string `json:"url" format:"uri"`
+ JSON agentCodeContextContextURLJSON `json:"-"`
+}
+
+// agentCodeContextContextURLJSON contains the JSON metadata for the struct
+// [AgentCodeContextContextURL]
+type agentCodeContextContextURLJSON struct {
+ EnvironmentClassID apijson.Field
+ URL apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AgentCodeContextContextURL) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r agentCodeContextContextURLJSON) RawJSON() string {
+ return r.raw
+}
+
+// Pull request context - optional metadata about the PR being worked on This is
+// populated when the agent execution is triggered by a PR workflow or when
+// explicitly provided through the browser extension
+type AgentCodeContextPullRequest struct {
+ // Unique identifier from the source system (e.g., "123" for GitHub PR #123)
+ ID string `json:"id"`
+ // Author name as provided by the SCM system
+ Author string `json:"author"`
+ // Source branch name (the branch being merged from)
+ FromBranch string `json:"fromBranch"`
+ // Repository information
+ Repository AgentCodeContextPullRequestRepository `json:"repository"`
+ // Pull request title
+ Title string `json:"title"`
+ // Target branch name (the branch being merged into)
+ ToBranch string `json:"toBranch"`
+ // Pull request URL (e.g., "https://github.com/owner/repo/pull/123")
+ URL string `json:"url"`
+ JSON agentCodeContextPullRequestJSON `json:"-"`
+}
+
+// agentCodeContextPullRequestJSON contains the JSON metadata for the struct
+// [AgentCodeContextPullRequest]
+type agentCodeContextPullRequestJSON struct {
+ ID apijson.Field
+ Author apijson.Field
+ FromBranch apijson.Field
+ Repository apijson.Field
+ Title apijson.Field
+ ToBranch apijson.Field
+ URL apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AgentCodeContextPullRequest) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r agentCodeContextPullRequestJSON) RawJSON() string {
+ return r.raw
+}
+
+// Repository information
+type AgentCodeContextPullRequestRepository struct {
+ CloneURL string `json:"cloneUrl"`
+ Host string `json:"host"`
+ Name string `json:"name"`
+ Owner string `json:"owner"`
+ JSON agentCodeContextPullRequestRepositoryJSON `json:"-"`
+}
+
+// agentCodeContextPullRequestRepositoryJSON contains the JSON metadata for the
+// struct [AgentCodeContextPullRequestRepository]
+type agentCodeContextPullRequestRepositoryJSON struct {
+ CloneURL apijson.Field
+ Host apijson.Field
+ Name apijson.Field
+ Owner apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AgentCodeContextPullRequestRepository) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r agentCodeContextPullRequestRepositoryJSON) RawJSON() string {
+ return r.raw
+}
+
+type AgentCodeContextParam struct {
+ ContextURL param.Field[AgentCodeContextContextURLParam] `json:"contextUrl"`
+ EnvironmentID param.Field[string] `json:"environmentId" format:"uuid"`
+ ProjectID param.Field[string] `json:"projectId" format:"uuid"`
+ // Pull request context - optional metadata about the PR being worked on This is
+ // populated when the agent execution is triggered by a PR workflow or when
+ // explicitly provided through the browser extension
+ PullRequest param.Field[AgentCodeContextPullRequestParam] `json:"pullRequest"`
+}
+
+func (r AgentCodeContextParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type AgentCodeContextContextURLParam struct {
+ EnvironmentClassID param.Field[string] `json:"environmentClassId" format:"uuid"`
+ URL param.Field[string] `json:"url" format:"uri"`
+}
+
+func (r AgentCodeContextContextURLParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// Pull request context - optional metadata about the PR being worked on This is
+// populated when the agent execution is triggered by a PR workflow or when
+// explicitly provided through the browser extension
+type AgentCodeContextPullRequestParam struct {
+ // Unique identifier from the source system (e.g., "123" for GitHub PR #123)
+ ID param.Field[string] `json:"id"`
+ // Author name as provided by the SCM system
+ Author param.Field[string] `json:"author"`
+ // Source branch name (the branch being merged from)
+ FromBranch param.Field[string] `json:"fromBranch"`
+ // Repository information
+ Repository param.Field[AgentCodeContextPullRequestRepositoryParam] `json:"repository"`
+ // Pull request title
+ Title param.Field[string] `json:"title"`
+ // Target branch name (the branch being merged into)
+ ToBranch param.Field[string] `json:"toBranch"`
+ // Pull request URL (e.g., "https://github.com/owner/repo/pull/123")
+ URL param.Field[string] `json:"url"`
+}
+
+func (r AgentCodeContextPullRequestParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// Repository information
+type AgentCodeContextPullRequestRepositoryParam struct {
+ CloneURL param.Field[string] `json:"cloneUrl"`
+ Host param.Field[string] `json:"host"`
+ Name param.Field[string] `json:"name"`
+ Owner param.Field[string] `json:"owner"`
+}
+
+func (r AgentCodeContextPullRequestRepositoryParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type AgentExecution struct {
+ // ID is a unique identifier of this agent run. No other agent run with the same
+ // name must be managed by this agent manager
+ ID string `json:"id"`
+ // Metadata is data associated with this agent that's required for other parts of
+ // Gitpod to function
+ Metadata AgentExecutionMetadata `json:"metadata"`
+ // Spec is the configuration of the agent that's required for the runner to start
+ // the agent
+ Spec AgentExecutionSpec `json:"spec"`
+ // Status is the current status of the agent
+ Status AgentExecutionStatus `json:"status"`
+ JSON agentExecutionJSON `json:"-"`
+}
+
+// agentExecutionJSON contains the JSON metadata for the struct [AgentExecution]
+type agentExecutionJSON struct {
+ ID apijson.Field
+ Metadata apijson.Field
+ Spec apijson.Field
+ Status apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AgentExecution) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r agentExecutionJSON) RawJSON() string {
+ return r.raw
+}
+
+// Metadata is data associated with this agent that's required for other parts of
+// Gitpod to function
+type AgentExecutionMetadata struct {
+ // A Timestamp represents a point in time independent of any time zone or local
+ // calendar, encoded as a count of seconds and fractions of seconds at nanosecond
+ // resolution. The count is relative to an epoch at UTC midnight on January 1,
+ // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar
+ // backwards to year one.
+ //
+ // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
+ // second table is needed for interpretation, using a
+ // [24-hour linear smear](https://developers.google.com/time/smear).
+ //
+ // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
+ // restricting to that range, we ensure that we can convert to and from
+ // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
+ //
+ // # Examples
+ //
+ // Example 1: Compute Timestamp from POSIX `time()`.
+ //
+ // Timestamp timestamp;
+ // timestamp.set_seconds(time(NULL));
+ // timestamp.set_nanos(0);
+ //
+ // Example 2: Compute Timestamp from POSIX `gettimeofday()`.
+ //
+ // struct timeval tv;
+ // gettimeofday(&tv, NULL);
+ //
+ // Timestamp timestamp;
+ // timestamp.set_seconds(tv.tv_sec);
+ // timestamp.set_nanos(tv.tv_usec * 1000);
+ //
+ // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
+ //
+ // FILETIME ft;
+ // GetSystemTimeAsFileTime(&ft);
+ // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
+ //
+ // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
+ // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
+ // Timestamp timestamp;
+ // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
+ // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
+ //
+ // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
+ //
+ // long millis = System.currentTimeMillis();
+ //
+ // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
+ // .setNanos((int) ((millis % 1000) * 1000000)).build();
+ //
+ // Example 5: Compute Timestamp from Java `Instant.now()`.
+ //
+ // Instant now = Instant.now();
+ //
+ // Timestamp timestamp =
+ // Timestamp.newBuilder().setSeconds(now.getEpochSecond())
+ // .setNanos(now.getNano()).build();
+ //
+ // Example 6: Compute Timestamp from current time in Python.
+ //
+ // timestamp = Timestamp()
+ // timestamp.GetCurrentTime()
+ //
+ // # JSON Mapping
+ //
+ // In JSON format, the Timestamp type is encoded as a string in the
+ // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is
+ // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always
+ // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are
+ // zero-padded to two digits each. The fractional seconds, which can go up to 9
+ // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix
+ // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON
+ // serializer should always use UTC (as indicated by "Z") when printing the
+ // Timestamp type and a proto3 JSON parser should be able to accept both UTC and
+ // other timezones (as indicated by an offset).
+ //
+ // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on
+ // January 15, 2017.
+ //
+ // In JavaScript, one can convert a Date object to this format using the standard
+ // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
+ // method. In Python, a standard `datetime.datetime` object can be converted to
+ // this format using
+ // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the
+ // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the
+ // Joda Time's
+ // [`ISODateTimeFormat.dateTime()`]()
+ // to obtain a formatter capable of generating timestamps in this format.
+ CreatedAt time.Time `json:"createdAt" format:"date-time"`
+ Creator shared.Subject `json:"creator"`
+ Description string `json:"description"`
+ Name string `json:"name"`
+ // role is the role of the agent execution
+ Role AgentExecutionMetadataRole `json:"role"`
+ // A Timestamp represents a point in time independent of any time zone or local
+ // calendar, encoded as a count of seconds and fractions of seconds at nanosecond
+ // resolution. The count is relative to an epoch at UTC midnight on January 1,
+ // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar
+ // backwards to year one.
+ //
+ // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
+ // second table is needed for interpretation, using a
+ // [24-hour linear smear](https://developers.google.com/time/smear).
+ //
+ // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
+ // restricting to that range, we ensure that we can convert to and from
+ // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
+ //
+ // # Examples
+ //
+ // Example 1: Compute Timestamp from POSIX `time()`.
+ //
+ // Timestamp timestamp;
+ // timestamp.set_seconds(time(NULL));
+ // timestamp.set_nanos(0);
+ //
+ // Example 2: Compute Timestamp from POSIX `gettimeofday()`.
+ //
+ // struct timeval tv;
+ // gettimeofday(&tv, NULL);
+ //
+ // Timestamp timestamp;
+ // timestamp.set_seconds(tv.tv_sec);
+ // timestamp.set_nanos(tv.tv_usec * 1000);
+ //
+ // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
+ //
+ // FILETIME ft;
+ // GetSystemTimeAsFileTime(&ft);
+ // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
+ //
+ // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
+ // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
+ // Timestamp timestamp;
+ // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
+ // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
+ //
+ // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
+ //
+ // long millis = System.currentTimeMillis();
+ //
+ // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
+ // .setNanos((int) ((millis % 1000) * 1000000)).build();
+ //
+ // Example 5: Compute Timestamp from Java `Instant.now()`.
+ //
+ // Instant now = Instant.now();
+ //
+ // Timestamp timestamp =
+ // Timestamp.newBuilder().setSeconds(now.getEpochSecond())
+ // .setNanos(now.getNano()).build();
+ //
+ // Example 6: Compute Timestamp from current time in Python.
+ //
+ // timestamp = Timestamp()
+ // timestamp.GetCurrentTime()
+ //
+ // # JSON Mapping
+ //
+ // In JSON format, the Timestamp type is encoded as a string in the
+ // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is
+ // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always
+ // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are
+ // zero-padded to two digits each. The fractional seconds, which can go up to 9
+ // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix
+ // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON
+ // serializer should always use UTC (as indicated by "Z") when printing the
+ // Timestamp type and a proto3 JSON parser should be able to accept both UTC and
+ // other timezones (as indicated by an offset).
+ //
+ // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on
+ // January 15, 2017.
+ //
+ // In JavaScript, one can convert a Date object to this format using the standard
+ // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
+ // method. In Python, a standard `datetime.datetime` object can be converted to
+ // this format using
+ // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the
+ // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the
+ // Joda Time's
+ // [`ISODateTimeFormat.dateTime()`]()
+ // to obtain a formatter capable of generating timestamps in this format.
+ UpdatedAt time.Time `json:"updatedAt" format:"date-time"`
+ // workflow_action_id is set when this agent execution was created as part of a
+ // workflow. Used to correlate agent executions with their parent workflow
+ // execution action.
+ WorkflowActionID string `json:"workflowActionId,nullable" format:"uuid"`
+ JSON agentExecutionMetadataJSON `json:"-"`
+}
+
+// agentExecutionMetadataJSON contains the JSON metadata for the struct
+// [AgentExecutionMetadata]
+type agentExecutionMetadataJSON struct {
+ CreatedAt apijson.Field
+ Creator apijson.Field
+ Description apijson.Field
+ Name apijson.Field
+ Role apijson.Field
+ UpdatedAt apijson.Field
+ WorkflowActionID apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AgentExecutionMetadata) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r agentExecutionMetadataJSON) RawJSON() string {
+ return r.raw
+}
+
+// role is the role of the agent execution
+type AgentExecutionMetadataRole string
+
+const (
+ AgentExecutionMetadataRoleAgentExecutionRoleUnspecified AgentExecutionMetadataRole = "AGENT_EXECUTION_ROLE_UNSPECIFIED"
+ AgentExecutionMetadataRoleAgentExecutionRoleDefault AgentExecutionMetadataRole = "AGENT_EXECUTION_ROLE_DEFAULT"
+ AgentExecutionMetadataRoleAgentExecutionRoleWorkflow AgentExecutionMetadataRole = "AGENT_EXECUTION_ROLE_WORKFLOW"
+)
+
+func (r AgentExecutionMetadataRole) IsKnown() bool {
+ switch r {
+ case AgentExecutionMetadataRoleAgentExecutionRoleUnspecified, AgentExecutionMetadataRoleAgentExecutionRoleDefault, AgentExecutionMetadataRoleAgentExecutionRoleWorkflow:
+ return true
+ }
+ return false
+}
+
+// Spec is the configuration of the agent that's required for the runner to start
+// the agent
+type AgentExecutionSpec struct {
+ AgentID string `json:"agentId" format:"uuid"`
+ CodeContext AgentCodeContext `json:"codeContext"`
+ // desired_phase is the desired phase of the agent run
+ DesiredPhase AgentExecutionSpecDesiredPhase `json:"desiredPhase"`
+ Limits AgentExecutionSpecLimits `json:"limits"`
+ // mode is the operational mode for this agent execution
+ Mode AgentMode `json:"mode"`
+ Session string `json:"session"`
+ // version of the spec. The value of this field has no semantic meaning (e.g. don't
+ // interpret it as as a timestamp), but it can be used to impose a partial order.
+ // If a.spec_version < b.spec_version then a was the spec before b.
+ SpecVersion string `json:"specVersion"`
+ JSON agentExecutionSpecJSON `json:"-"`
+}
+
+// agentExecutionSpecJSON contains the JSON metadata for the struct
+// [AgentExecutionSpec]
+type agentExecutionSpecJSON struct {
+ AgentID apijson.Field
+ CodeContext apijson.Field
+ DesiredPhase apijson.Field
+ Limits apijson.Field
+ Mode apijson.Field
+ Session apijson.Field
+ SpecVersion apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AgentExecutionSpec) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r agentExecutionSpecJSON) RawJSON() string {
+ return r.raw
+}
+
+// desired_phase is the desired phase of the agent run
+type AgentExecutionSpecDesiredPhase string
+
+const (
+ AgentExecutionSpecDesiredPhasePhaseUnspecified AgentExecutionSpecDesiredPhase = "PHASE_UNSPECIFIED"
+ AgentExecutionSpecDesiredPhasePhasePending AgentExecutionSpecDesiredPhase = "PHASE_PENDING"
+ AgentExecutionSpecDesiredPhasePhaseRunning AgentExecutionSpecDesiredPhase = "PHASE_RUNNING"
+ AgentExecutionSpecDesiredPhasePhaseWaitingForInput AgentExecutionSpecDesiredPhase = "PHASE_WAITING_FOR_INPUT"
+ AgentExecutionSpecDesiredPhasePhaseStopped AgentExecutionSpecDesiredPhase = "PHASE_STOPPED"
+)
+
+func (r AgentExecutionSpecDesiredPhase) IsKnown() bool {
+ switch r {
+ case AgentExecutionSpecDesiredPhasePhaseUnspecified, AgentExecutionSpecDesiredPhasePhasePending, AgentExecutionSpecDesiredPhasePhaseRunning, AgentExecutionSpecDesiredPhasePhaseWaitingForInput, AgentExecutionSpecDesiredPhasePhaseStopped:
+ return true
+ }
+ return false
+}
+
+type AgentExecutionSpecLimits struct {
+ MaxInputTokens string `json:"maxInputTokens"`
+ MaxIterations string `json:"maxIterations"`
+ MaxOutputTokens string `json:"maxOutputTokens"`
+ JSON agentExecutionSpecLimitsJSON `json:"-"`
+}
+
+// agentExecutionSpecLimitsJSON contains the JSON metadata for the struct
+// [AgentExecutionSpecLimits]
+type agentExecutionSpecLimitsJSON struct {
+ MaxInputTokens apijson.Field
+ MaxIterations apijson.Field
+ MaxOutputTokens apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AgentExecutionSpecLimits) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r agentExecutionSpecLimitsJSON) RawJSON() string {
+ return r.raw
+}
+
+// Status is the current status of the agent
+type AgentExecutionStatus struct {
+ CachedCreationTokensUsed string `json:"cachedCreationTokensUsed"`
+ CachedInputTokensUsed string `json:"cachedInputTokensUsed"`
+ ContextWindowLength string `json:"contextWindowLength"`
+ // conversation_url is the URL to the conversation (all messages exchanged between
+ // the agent and the user) of the agent run.
+ ConversationURL string `json:"conversationUrl"`
+ // current_activity is the current activity description of the agent execution.
+ CurrentActivity string `json:"currentActivity"`
+ // current_operation is the current operation of the agent execution.
+ CurrentOperation AgentExecutionStatusCurrentOperation `json:"currentOperation"`
+ // failure_message contains the reason the agent run failed to operate.
+ FailureMessage string `json:"failureMessage"`
+ // failure_reason contains a structured reason code for the failure.
+ FailureReason AgentExecutionStatusFailureReason `json:"failureReason"`
+ InputTokensUsed string `json:"inputTokensUsed"`
+ Iterations string `json:"iterations"`
+ // judgement is the judgement of the agent run produced by the judgement prompt.
+ Judgement string `json:"judgement"`
+ // outputs is a map of key-value pairs that can be set by the agent during
+ // execution. Similar to task execution outputs, but with typed values for
+ // structured data.
+ Outputs map[string]AgentExecutionStatusOutput `json:"outputs"`
+ OutputTokensUsed string `json:"outputTokensUsed"`
+ Phase AgentExecutionStatusPhase `json:"phase"`
+ Session string `json:"session"`
+ // version of the status. The value of this field has no semantic meaning (e.g.
+ // don't interpret it as as a timestamp), but it can be used to impose a partial
+ // order. If a.status_version < b.status_version then a was the status before b.
+ StatusVersion string `json:"statusVersion"`
+ // supported_model is the LLM model being used by the agent execution.
+ SupportedModel AgentExecutionStatusSupportedModel `json:"supportedModel"`
+ // transcript_url is the URL to the LLM transcript (all messages exchanged between
+ // the agent and the LLM) of the agent run.
+ TranscriptURL string `json:"transcriptUrl"`
+ // used_environments is the list of environments that were used by the agent
+ // execution.
+ UsedEnvironments []AgentExecutionStatusUsedEnvironment `json:"usedEnvironments"`
+ // warning_message contains warnings, e.g. when the LLM is overloaded.
+ WarningMessage string `json:"warningMessage"`
+ JSON agentExecutionStatusJSON `json:"-"`
+}
+
+// agentExecutionStatusJSON contains the JSON metadata for the struct
+// [AgentExecutionStatus]
+type agentExecutionStatusJSON struct {
+ CachedCreationTokensUsed apijson.Field
+ CachedInputTokensUsed apijson.Field
+ ContextWindowLength apijson.Field
+ ConversationURL apijson.Field
+ CurrentActivity apijson.Field
+ CurrentOperation apijson.Field
+ FailureMessage apijson.Field
+ FailureReason apijson.Field
+ InputTokensUsed apijson.Field
+ Iterations apijson.Field
+ Judgement apijson.Field
+ Outputs apijson.Field
+ OutputTokensUsed apijson.Field
+ Phase apijson.Field
+ Session apijson.Field
+ StatusVersion apijson.Field
+ SupportedModel apijson.Field
+ TranscriptURL apijson.Field
+ UsedEnvironments apijson.Field
+ WarningMessage apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AgentExecutionStatus) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r agentExecutionStatusJSON) RawJSON() string {
+ return r.raw
+}
+
+// current_operation is the current operation of the agent execution.
+type AgentExecutionStatusCurrentOperation struct {
+ Llm AgentExecutionStatusCurrentOperationLlm `json:"llm"`
+ // retries is the number of times the agent run has retried one or more steps
+ Retries string `json:"retries"`
+ Session string `json:"session"`
+ ToolUse AgentExecutionStatusCurrentOperationToolUse `json:"toolUse"`
+ JSON agentExecutionStatusCurrentOperationJSON `json:"-"`
+}
+
+// agentExecutionStatusCurrentOperationJSON contains the JSON metadata for the
+// struct [AgentExecutionStatusCurrentOperation]
+type agentExecutionStatusCurrentOperationJSON struct {
+ Llm apijson.Field
+ Retries apijson.Field
+ Session apijson.Field
+ ToolUse apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AgentExecutionStatusCurrentOperation) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r agentExecutionStatusCurrentOperationJSON) RawJSON() string {
+ return r.raw
+}
+
+type AgentExecutionStatusCurrentOperationLlm struct {
+ Complete bool `json:"complete"`
+ JSON agentExecutionStatusCurrentOperationLlmJSON `json:"-"`
+}
+
+// agentExecutionStatusCurrentOperationLlmJSON contains the JSON metadata for the
+// struct [AgentExecutionStatusCurrentOperationLlm]
+type agentExecutionStatusCurrentOperationLlmJSON struct {
+ Complete apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AgentExecutionStatusCurrentOperationLlm) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r agentExecutionStatusCurrentOperationLlmJSON) RawJSON() string {
+ return r.raw
+}
+
+type AgentExecutionStatusCurrentOperationToolUse struct {
+ Complete bool `json:"complete"`
+ ToolName string `json:"toolName"`
+ JSON agentExecutionStatusCurrentOperationToolUseJSON `json:"-"`
+}
+
+// agentExecutionStatusCurrentOperationToolUseJSON contains the JSON metadata for
+// the struct [AgentExecutionStatusCurrentOperationToolUse]
+type agentExecutionStatusCurrentOperationToolUseJSON struct {
+ Complete apijson.Field
+ ToolName apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AgentExecutionStatusCurrentOperationToolUse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r agentExecutionStatusCurrentOperationToolUseJSON) RawJSON() string {
+ return r.raw
+}
+
+// failure_reason contains a structured reason code for the failure.
+type AgentExecutionStatusFailureReason string
+
+const (
+ AgentExecutionStatusFailureReasonAgentExecutionFailureReasonUnspecified AgentExecutionStatusFailureReason = "AGENT_EXECUTION_FAILURE_REASON_UNSPECIFIED"
+ AgentExecutionStatusFailureReasonAgentExecutionFailureReasonEnvironment AgentExecutionStatusFailureReason = "AGENT_EXECUTION_FAILURE_REASON_ENVIRONMENT"
+ AgentExecutionStatusFailureReasonAgentExecutionFailureReasonService AgentExecutionStatusFailureReason = "AGENT_EXECUTION_FAILURE_REASON_SERVICE"
+ AgentExecutionStatusFailureReasonAgentExecutionFailureReasonLlmIntegration AgentExecutionStatusFailureReason = "AGENT_EXECUTION_FAILURE_REASON_LLM_INTEGRATION"
+ AgentExecutionStatusFailureReasonAgentExecutionFailureReasonInternal AgentExecutionStatusFailureReason = "AGENT_EXECUTION_FAILURE_REASON_INTERNAL"
+ AgentExecutionStatusFailureReasonAgentExecutionFailureReasonAgentExecution AgentExecutionStatusFailureReason = "AGENT_EXECUTION_FAILURE_REASON_AGENT_EXECUTION"
+)
+
+func (r AgentExecutionStatusFailureReason) IsKnown() bool {
+ switch r {
+ case AgentExecutionStatusFailureReasonAgentExecutionFailureReasonUnspecified, AgentExecutionStatusFailureReasonAgentExecutionFailureReasonEnvironment, AgentExecutionStatusFailureReasonAgentExecutionFailureReasonService, AgentExecutionStatusFailureReasonAgentExecutionFailureReasonLlmIntegration, AgentExecutionStatusFailureReasonAgentExecutionFailureReasonInternal, AgentExecutionStatusFailureReasonAgentExecutionFailureReasonAgentExecution:
+ return true
+ }
+ return false
+}
+
+type AgentExecutionStatusOutput struct {
+ BoolValue bool `json:"boolValue"`
+ FloatValue float64 `json:"floatValue"`
+ IntValue string `json:"intValue"`
+ StringValue string `json:"stringValue"`
+ JSON agentExecutionStatusOutputJSON `json:"-"`
+}
+
+// agentExecutionStatusOutputJSON contains the JSON metadata for the struct
+// [AgentExecutionStatusOutput]
+type agentExecutionStatusOutputJSON struct {
+ BoolValue apijson.Field
+ FloatValue apijson.Field
+ IntValue apijson.Field
+ StringValue apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AgentExecutionStatusOutput) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r agentExecutionStatusOutputJSON) RawJSON() string {
+ return r.raw
+}
+
+type AgentExecutionStatusPhase string
+
+const (
+ AgentExecutionStatusPhasePhaseUnspecified AgentExecutionStatusPhase = "PHASE_UNSPECIFIED"
+ AgentExecutionStatusPhasePhasePending AgentExecutionStatusPhase = "PHASE_PENDING"
+ AgentExecutionStatusPhasePhaseRunning AgentExecutionStatusPhase = "PHASE_RUNNING"
+ AgentExecutionStatusPhasePhaseWaitingForInput AgentExecutionStatusPhase = "PHASE_WAITING_FOR_INPUT"
+ AgentExecutionStatusPhasePhaseStopped AgentExecutionStatusPhase = "PHASE_STOPPED"
+)
+
+func (r AgentExecutionStatusPhase) IsKnown() bool {
+ switch r {
+ case AgentExecutionStatusPhasePhaseUnspecified, AgentExecutionStatusPhasePhasePending, AgentExecutionStatusPhasePhaseRunning, AgentExecutionStatusPhasePhaseWaitingForInput, AgentExecutionStatusPhasePhaseStopped:
+ return true
+ }
+ return false
+}
+
+// supported_model is the LLM model being used by the agent execution.
+type AgentExecutionStatusSupportedModel string
+
+const (
+ AgentExecutionStatusSupportedModelSupportedModelUnspecified AgentExecutionStatusSupportedModel = "SUPPORTED_MODEL_UNSPECIFIED"
+ AgentExecutionStatusSupportedModelSupportedModelSonnet3_5 AgentExecutionStatusSupportedModel = "SUPPORTED_MODEL_SONNET_3_5"
+ AgentExecutionStatusSupportedModelSupportedModelSonnet3_7 AgentExecutionStatusSupportedModel = "SUPPORTED_MODEL_SONNET_3_7"
+ AgentExecutionStatusSupportedModelSupportedModelSonnet3_7Extended AgentExecutionStatusSupportedModel = "SUPPORTED_MODEL_SONNET_3_7_EXTENDED"
+ AgentExecutionStatusSupportedModelSupportedModelSonnet4 AgentExecutionStatusSupportedModel = "SUPPORTED_MODEL_SONNET_4"
+ AgentExecutionStatusSupportedModelSupportedModelSonnet4Extended AgentExecutionStatusSupportedModel = "SUPPORTED_MODEL_SONNET_4_EXTENDED"
+ AgentExecutionStatusSupportedModelSupportedModelSonnet4_5 AgentExecutionStatusSupportedModel = "SUPPORTED_MODEL_SONNET_4_5"
+ AgentExecutionStatusSupportedModelSupportedModelSonnet4_5Extended AgentExecutionStatusSupportedModel = "SUPPORTED_MODEL_SONNET_4_5_EXTENDED"
+ AgentExecutionStatusSupportedModelSupportedModelOpus4 AgentExecutionStatusSupportedModel = "SUPPORTED_MODEL_OPUS_4"
+ AgentExecutionStatusSupportedModelSupportedModelOpus4Extended AgentExecutionStatusSupportedModel = "SUPPORTED_MODEL_OPUS_4_EXTENDED"
+ AgentExecutionStatusSupportedModelSupportedModelOpus4_5 AgentExecutionStatusSupportedModel = "SUPPORTED_MODEL_OPUS_4_5"
+ AgentExecutionStatusSupportedModelSupportedModelOpus4_5Extended AgentExecutionStatusSupportedModel = "SUPPORTED_MODEL_OPUS_4_5_EXTENDED"
+ AgentExecutionStatusSupportedModelSupportedModelOpenAI4O AgentExecutionStatusSupportedModel = "SUPPORTED_MODEL_OPENAI_4O"
+ AgentExecutionStatusSupportedModelSupportedModelOpenAI4OMini AgentExecutionStatusSupportedModel = "SUPPORTED_MODEL_OPENAI_4O_MINI"
+ AgentExecutionStatusSupportedModelSupportedModelOpenAIO1 AgentExecutionStatusSupportedModel = "SUPPORTED_MODEL_OPENAI_O1"
+ AgentExecutionStatusSupportedModelSupportedModelOpenAIO1Mini AgentExecutionStatusSupportedModel = "SUPPORTED_MODEL_OPENAI_O1_MINI"
+)
+
+func (r AgentExecutionStatusSupportedModel) IsKnown() bool {
+ switch r {
+ case AgentExecutionStatusSupportedModelSupportedModelUnspecified, AgentExecutionStatusSupportedModelSupportedModelSonnet3_5, AgentExecutionStatusSupportedModelSupportedModelSonnet3_7, AgentExecutionStatusSupportedModelSupportedModelSonnet3_7Extended, AgentExecutionStatusSupportedModelSupportedModelSonnet4, AgentExecutionStatusSupportedModelSupportedModelSonnet4Extended, AgentExecutionStatusSupportedModelSupportedModelSonnet4_5, AgentExecutionStatusSupportedModelSupportedModelSonnet4_5Extended, AgentExecutionStatusSupportedModelSupportedModelOpus4, AgentExecutionStatusSupportedModelSupportedModelOpus4Extended, AgentExecutionStatusSupportedModelSupportedModelOpus4_5, AgentExecutionStatusSupportedModelSupportedModelOpus4_5Extended, AgentExecutionStatusSupportedModelSupportedModelOpenAI4O, AgentExecutionStatusSupportedModelSupportedModelOpenAI4OMini, AgentExecutionStatusSupportedModelSupportedModelOpenAIO1, AgentExecutionStatusSupportedModelSupportedModelOpenAIO1Mini:
+ return true
+ }
+ return false
+}
+
+type AgentExecutionStatusUsedEnvironment struct {
+ CreatedByAgent bool `json:"createdByAgent"`
+ EnvironmentID string `json:"environmentId" format:"uuid"`
+ JSON agentExecutionStatusUsedEnvironmentJSON `json:"-"`
+}
+
+// agentExecutionStatusUsedEnvironmentJSON contains the JSON metadata for the
+// struct [AgentExecutionStatusUsedEnvironment]
+type agentExecutionStatusUsedEnvironmentJSON struct {
+ CreatedByAgent apijson.Field
+ EnvironmentID apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AgentExecutionStatusUsedEnvironment) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r agentExecutionStatusUsedEnvironmentJSON) RawJSON() string {
+ return r.raw
+}
+
+// AgentMode defines the operational mode of an agent
+type AgentMode string
+
+const (
+ AgentModeUnspecified AgentMode = "AGENT_MODE_UNSPECIFIED"
+ AgentModeExecution AgentMode = "AGENT_MODE_EXECUTION"
+ AgentModePlanning AgentMode = "AGENT_MODE_PLANNING"
+)
+
+func (r AgentMode) IsKnown() bool {
+ switch r {
+ case AgentModeUnspecified, AgentModeExecution, AgentModePlanning:
+ return true
+ }
+ return false
+}
+
+type Prompt struct {
+ ID string `json:"id"`
+ Metadata PromptMetadata `json:"metadata"`
+ Spec PromptSpec `json:"spec"`
+ JSON promptJSON `json:"-"`
+}
+
+// promptJSON contains the JSON metadata for the struct [Prompt]
+type promptJSON struct {
+ ID apijson.Field
+ Metadata apijson.Field
+ Spec apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *Prompt) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r promptJSON) RawJSON() string {
+ return r.raw
+}
+
+type PromptMetadata struct {
+ // A Timestamp represents a point in time independent of any time zone or local
+ // calendar, encoded as a count of seconds and fractions of seconds at nanosecond
+ // resolution. The count is relative to an epoch at UTC midnight on January 1,
+ // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar
+ // backwards to year one.
+ //
+ // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
+ // second table is needed for interpretation, using a
+ // [24-hour linear smear](https://developers.google.com/time/smear).
+ //
+ // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
+ // restricting to that range, we ensure that we can convert to and from
+ // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
+ //
+ // # Examples
+ //
+ // Example 1: Compute Timestamp from POSIX `time()`.
+ //
+ // Timestamp timestamp;
+ // timestamp.set_seconds(time(NULL));
+ // timestamp.set_nanos(0);
+ //
+ // Example 2: Compute Timestamp from POSIX `gettimeofday()`.
+ //
+ // struct timeval tv;
+ // gettimeofday(&tv, NULL);
+ //
+ // Timestamp timestamp;
+ // timestamp.set_seconds(tv.tv_sec);
+ // timestamp.set_nanos(tv.tv_usec * 1000);
+ //
+ // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
+ //
+ // FILETIME ft;
+ // GetSystemTimeAsFileTime(&ft);
+ // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
+ //
+ // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
+ // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
+ // Timestamp timestamp;
+ // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
+ // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
+ //
+ // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
+ //
+ // long millis = System.currentTimeMillis();
+ //
+ // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
+ // .setNanos((int) ((millis % 1000) * 1000000)).build();
+ //
+ // Example 5: Compute Timestamp from Java `Instant.now()`.
+ //
+ // Instant now = Instant.now();
+ //
+ // Timestamp timestamp =
+ // Timestamp.newBuilder().setSeconds(now.getEpochSecond())
+ // .setNanos(now.getNano()).build();
+ //
+ // Example 6: Compute Timestamp from current time in Python.
+ //
+ // timestamp = Timestamp()
+ // timestamp.GetCurrentTime()
+ //
+ // # JSON Mapping
+ //
+ // In JSON format, the Timestamp type is encoded as a string in the
+ // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is
+ // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always
+ // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are
+ // zero-padded to two digits each. The fractional seconds, which can go up to 9
+ // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix
+ // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON
+ // serializer should always use UTC (as indicated by "Z") when printing the
+ // Timestamp type and a proto3 JSON parser should be able to accept both UTC and
+ // other timezones (as indicated by an offset).
+ //
+ // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on
+ // January 15, 2017.
+ //
+ // In JavaScript, one can convert a Date object to this format using the standard
+ // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
+ // method. In Python, a standard `datetime.datetime` object can be converted to
+ // this format using
+ // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the
+ // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the
+ // Joda Time's
+ // [`ISODateTimeFormat.dateTime()`]()
+ // to obtain a formatter capable of generating timestamps in this format.
+ CreatedAt time.Time `json:"createdAt" format:"date-time"`
+ // creator is the identity of the prompt creator
+ Creator shared.Subject `json:"creator"`
+ // description is a description of what the prompt does
+ Description string `json:"description"`
+ // name is the human readable name of the prompt
+ Name string `json:"name"`
+ // organization_id is the ID of the organization that contains the prompt
+ OrganizationID string `json:"organizationId" format:"uuid"`
+ // A Timestamp represents a point in time independent of any time zone or local
+ // calendar, encoded as a count of seconds and fractions of seconds at nanosecond
+ // resolution. The count is relative to an epoch at UTC midnight on January 1,
+ // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar
+ // backwards to year one.
+ //
+ // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
+ // second table is needed for interpretation, using a
+ // [24-hour linear smear](https://developers.google.com/time/smear).
+ //
+ // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
+ // restricting to that range, we ensure that we can convert to and from
+ // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
+ //
+ // # Examples
+ //
+ // Example 1: Compute Timestamp from POSIX `time()`.
+ //
+ // Timestamp timestamp;
+ // timestamp.set_seconds(time(NULL));
+ // timestamp.set_nanos(0);
+ //
+ // Example 2: Compute Timestamp from POSIX `gettimeofday()`.
+ //
+ // struct timeval tv;
+ // gettimeofday(&tv, NULL);
+ //
+ // Timestamp timestamp;
+ // timestamp.set_seconds(tv.tv_sec);
+ // timestamp.set_nanos(tv.tv_usec * 1000);
+ //
+ // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
+ //
+ // FILETIME ft;
+ // GetSystemTimeAsFileTime(&ft);
+ // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
+ //
+ // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
+ // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
+ // Timestamp timestamp;
+ // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
+ // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
+ //
+ // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
+ //
+ // long millis = System.currentTimeMillis();
+ //
+ // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
+ // .setNanos((int) ((millis % 1000) * 1000000)).build();
+ //
+ // Example 5: Compute Timestamp from Java `Instant.now()`.
+ //
+ // Instant now = Instant.now();
+ //
+ // Timestamp timestamp =
+ // Timestamp.newBuilder().setSeconds(now.getEpochSecond())
+ // .setNanos(now.getNano()).build();
+ //
+ // Example 6: Compute Timestamp from current time in Python.
+ //
+ // timestamp = Timestamp()
+ // timestamp.GetCurrentTime()
+ //
+ // # JSON Mapping
+ //
+ // In JSON format, the Timestamp type is encoded as a string in the
+ // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is
+ // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always
+ // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are
+ // zero-padded to two digits each. The fractional seconds, which can go up to 9
+ // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix
+ // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON
+ // serializer should always use UTC (as indicated by "Z") when printing the
+ // Timestamp type and a proto3 JSON parser should be able to accept both UTC and
+ // other timezones (as indicated by an offset).
+ //
+ // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on
+ // January 15, 2017.
+ //
+ // In JavaScript, one can convert a Date object to this format using the standard
+ // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
+ // method. In Python, a standard `datetime.datetime` object can be converted to
+ // this format using
+ // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the
+ // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the
+ // Joda Time's
+ // [`ISODateTimeFormat.dateTime()`]()
+ // to obtain a formatter capable of generating timestamps in this format.
+ UpdatedAt time.Time `json:"updatedAt" format:"date-time"`
+ JSON promptMetadataJSON `json:"-"`
+}
+
+// promptMetadataJSON contains the JSON metadata for the struct [PromptMetadata]
+type promptMetadataJSON struct {
+ CreatedAt apijson.Field
+ Creator apijson.Field
+ Description apijson.Field
+ Name apijson.Field
+ OrganizationID apijson.Field
+ UpdatedAt apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *PromptMetadata) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r promptMetadataJSON) RawJSON() string {
+ return r.raw
+}
+
+type PromptSpec struct {
+ // command is the unique command string within the organization
+ Command string `json:"command"`
+ // is_command indicates if this prompt is a command
+ IsCommand bool `json:"isCommand"`
+ // is_template indicates if this prompt is a template
+ IsTemplate bool `json:"isTemplate"`
+ // prompt is the content of the prompt
+ Prompt string `json:"prompt"`
+ JSON promptSpecJSON `json:"-"`
+}
+
+// promptSpecJSON contains the JSON metadata for the struct [PromptSpec]
+type promptSpecJSON struct {
+ Command apijson.Field
+ IsCommand apijson.Field
+ IsTemplate apijson.Field
+ Prompt apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *PromptSpec) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r promptSpecJSON) RawJSON() string {
+ return r.raw
+}
+
+type UserInputBlockParam struct {
+ Text param.Field[UserInputBlockTextParam] `json:"text,required"`
+ ID param.Field[string] `json:"id"`
+ // Timestamp when this block was created. Used for debugging and support bundles.
+ CreatedAt param.Field[time.Time] `json:"createdAt" format:"date-time"`
+}
+
+func (r UserInputBlockParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type UserInputBlockTextParam struct {
+ Content param.Field[string] `json:"content"`
+}
+
+func (r UserInputBlockTextParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type AgentNewExecutionConversationTokenResponse struct {
+ Token string `json:"token"`
+ JSON agentNewExecutionConversationTokenResponseJSON `json:"-"`
+}
+
+// agentNewExecutionConversationTokenResponseJSON contains the JSON metadata for
+// the struct [AgentNewExecutionConversationTokenResponse]
+type agentNewExecutionConversationTokenResponseJSON struct {
+ Token apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AgentNewExecutionConversationTokenResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r agentNewExecutionConversationTokenResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+type AgentNewPromptResponse struct {
+ Prompt Prompt `json:"prompt"`
+ JSON agentNewPromptResponseJSON `json:"-"`
+}
+
+// agentNewPromptResponseJSON contains the JSON metadata for the struct
+// [AgentNewPromptResponse]
+type agentNewPromptResponseJSON struct {
+ Prompt apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AgentNewPromptResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r agentNewPromptResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+type AgentDeleteExecutionResponse = interface{}
+
+type AgentDeletePromptResponse = interface{}
+
+type AgentGetExecutionResponse struct {
+ AgentExecution AgentExecution `json:"agentExecution"`
+ JSON agentGetExecutionResponseJSON `json:"-"`
+}
+
+// agentGetExecutionResponseJSON contains the JSON metadata for the struct
+// [AgentGetExecutionResponse]
+type agentGetExecutionResponseJSON struct {
+ AgentExecution apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AgentGetExecutionResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r agentGetExecutionResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+type AgentGetPromptResponse struct {
+ Prompt Prompt `json:"prompt"`
+ JSON agentGetPromptResponseJSON `json:"-"`
+}
+
+// agentGetPromptResponseJSON contains the JSON metadata for the struct
+// [AgentGetPromptResponse]
+type agentGetPromptResponseJSON struct {
+ Prompt apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AgentGetPromptResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r agentGetPromptResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+type AgentSendToExecutionResponse = interface{}
+
+type AgentStartExecutionResponse struct {
+ AgentExecutionID string `json:"agentExecutionId" format:"uuid"`
+ JSON agentStartExecutionResponseJSON `json:"-"`
+}
+
+// agentStartExecutionResponseJSON contains the JSON metadata for the struct
+// [AgentStartExecutionResponse]
+type agentStartExecutionResponseJSON struct {
+ AgentExecutionID apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AgentStartExecutionResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r agentStartExecutionResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+type AgentStopExecutionResponse = interface{}
+
+type AgentUpdatePromptResponse struct {
+ Prompt Prompt `json:"prompt"`
+ JSON agentUpdatePromptResponseJSON `json:"-"`
+}
+
+// agentUpdatePromptResponseJSON contains the JSON metadata for the struct
+// [AgentUpdatePromptResponse]
+type agentUpdatePromptResponseJSON struct {
+ Prompt apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AgentUpdatePromptResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r agentUpdatePromptResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+type AgentNewExecutionConversationTokenParams struct {
+ AgentExecutionID param.Field[string] `json:"agentExecutionId" format:"uuid"`
+}
+
+func (r AgentNewExecutionConversationTokenParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type AgentNewPromptParams struct {
+ Command param.Field[string] `json:"command"`
+ Description param.Field[string] `json:"description"`
+ IsCommand param.Field[bool] `json:"isCommand"`
+ IsTemplate param.Field[bool] `json:"isTemplate"`
+ Name param.Field[string] `json:"name"`
+ Prompt param.Field[string] `json:"prompt"`
+}
+
+func (r AgentNewPromptParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type AgentDeleteExecutionParams struct {
+ AgentExecutionID param.Field[string] `json:"agentExecutionId" format:"uuid"`
+}
+
+func (r AgentDeleteExecutionParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type AgentDeletePromptParams struct {
+ PromptID param.Field[string] `json:"promptId" format:"uuid"`
+}
+
+func (r AgentDeletePromptParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type AgentListExecutionsParams struct {
+ Token param.Field[string] `query:"token"`
+ PageSize param.Field[int64] `query:"pageSize"`
+ Filter param.Field[AgentListExecutionsParamsFilter] `json:"filter"`
+ Pagination param.Field[AgentListExecutionsParamsPagination] `json:"pagination"`
+}
+
+func (r AgentListExecutionsParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// URLQuery serializes [AgentListExecutionsParams]'s query parameters as
+// `url.Values`.
+func (r AgentListExecutionsParams) URLQuery() (v url.Values) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatComma,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
+
+type AgentListExecutionsParamsFilter struct {
+ AgentIDs param.Field[[]string] `json:"agentIds"`
+ CreatorIDs param.Field[[]string] `json:"creatorIds"`
+ EnvironmentIDs param.Field[[]string] `json:"environmentIds"`
+ ProjectIDs param.Field[[]string] `json:"projectIds" format:"uuid"`
+ Roles param.Field[[]AgentListExecutionsParamsFilterRole] `json:"roles"`
+ StatusPhases param.Field[[]AgentListExecutionsParamsFilterStatusPhase] `json:"statusPhases"`
+}
+
+func (r AgentListExecutionsParamsFilter) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// AgentExecutionRole represents the role of an agent execution
+type AgentListExecutionsParamsFilterRole string
+
+const (
+ AgentListExecutionsParamsFilterRoleAgentExecutionRoleUnspecified AgentListExecutionsParamsFilterRole = "AGENT_EXECUTION_ROLE_UNSPECIFIED"
+ AgentListExecutionsParamsFilterRoleAgentExecutionRoleDefault AgentListExecutionsParamsFilterRole = "AGENT_EXECUTION_ROLE_DEFAULT"
+ AgentListExecutionsParamsFilterRoleAgentExecutionRoleWorkflow AgentListExecutionsParamsFilterRole = "AGENT_EXECUTION_ROLE_WORKFLOW"
+)
+
+func (r AgentListExecutionsParamsFilterRole) IsKnown() bool {
+ switch r {
+ case AgentListExecutionsParamsFilterRoleAgentExecutionRoleUnspecified, AgentListExecutionsParamsFilterRoleAgentExecutionRoleDefault, AgentListExecutionsParamsFilterRoleAgentExecutionRoleWorkflow:
+ return true
+ }
+ return false
+}
+
+type AgentListExecutionsParamsFilterStatusPhase string
+
+const (
+ AgentListExecutionsParamsFilterStatusPhasePhaseUnspecified AgentListExecutionsParamsFilterStatusPhase = "PHASE_UNSPECIFIED"
+ AgentListExecutionsParamsFilterStatusPhasePhasePending AgentListExecutionsParamsFilterStatusPhase = "PHASE_PENDING"
+ AgentListExecutionsParamsFilterStatusPhasePhaseRunning AgentListExecutionsParamsFilterStatusPhase = "PHASE_RUNNING"
+ AgentListExecutionsParamsFilterStatusPhasePhaseWaitingForInput AgentListExecutionsParamsFilterStatusPhase = "PHASE_WAITING_FOR_INPUT"
+ AgentListExecutionsParamsFilterStatusPhasePhaseStopped AgentListExecutionsParamsFilterStatusPhase = "PHASE_STOPPED"
+)
+
+func (r AgentListExecutionsParamsFilterStatusPhase) IsKnown() bool {
+ switch r {
+ case AgentListExecutionsParamsFilterStatusPhasePhaseUnspecified, AgentListExecutionsParamsFilterStatusPhasePhasePending, AgentListExecutionsParamsFilterStatusPhasePhaseRunning, AgentListExecutionsParamsFilterStatusPhasePhaseWaitingForInput, AgentListExecutionsParamsFilterStatusPhasePhaseStopped:
+ return true
+ }
+ return false
+}
+
+type AgentListExecutionsParamsPagination struct {
+ // Token for the next set of results that was returned as next_token of a
+ // PaginationResponse
+ Token param.Field[string] `json:"token"`
+ // Page size is the maximum number of results to retrieve per page. Defaults to 25.
+ // Maximum 100.
+ PageSize param.Field[int64] `json:"pageSize"`
+}
+
+func (r AgentListExecutionsParamsPagination) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type AgentListPromptsParams struct {
+ Token param.Field[string] `query:"token"`
+ PageSize param.Field[int64] `query:"pageSize"`
+ Filter param.Field[AgentListPromptsParamsFilter] `json:"filter"`
+ Pagination param.Field[AgentListPromptsParamsPagination] `json:"pagination"`
+}
+
+func (r AgentListPromptsParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// URLQuery serializes [AgentListPromptsParams]'s query parameters as `url.Values`.
+func (r AgentListPromptsParams) URLQuery() (v url.Values) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatComma,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
+
+type AgentListPromptsParamsFilter struct {
+ Command param.Field[string] `json:"command"`
+ CommandPrefix param.Field[string] `json:"commandPrefix"`
+ IsCommand param.Field[bool] `json:"isCommand"`
+ IsTemplate param.Field[bool] `json:"isTemplate"`
+}
+
+func (r AgentListPromptsParamsFilter) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type AgentListPromptsParamsPagination struct {
+ // Token for the next set of results that was returned as next_token of a
+ // PaginationResponse
+ Token param.Field[string] `json:"token"`
+ // Page size is the maximum number of results to retrieve per page. Defaults to 25.
+ // Maximum 100.
+ PageSize param.Field[int64] `json:"pageSize"`
+}
+
+func (r AgentListPromptsParamsPagination) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type AgentGetExecutionParams struct {
+ AgentExecutionID param.Field[string] `json:"agentExecutionId" format:"uuid"`
+}
+
+func (r AgentGetExecutionParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type AgentGetPromptParams struct {
+ PromptID param.Field[string] `json:"promptId" format:"uuid"`
+}
+
+func (r AgentGetPromptParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type AgentSendToExecutionParams struct {
+ AgentExecutionID param.Field[string] `json:"agentExecutionId" format:"uuid"`
+ UserInput param.Field[UserInputBlockParam] `json:"userInput"`
+}
+
+func (r AgentSendToExecutionParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type AgentStartExecutionParams struct {
+ AgentID param.Field[string] `json:"agentId" format:"uuid"`
+ CodeContext param.Field[AgentCodeContextParam] `json:"codeContext"`
+ // mode specifies the operational mode for this agent execution If not specified,
+ // defaults to AGENT_MODE_EXECUTION
+ Mode param.Field[AgentMode] `json:"mode"`
+ Name param.Field[string] `json:"name"`
+ // workflow_action_id is an optional reference to the workflow execution action
+ // that created this agent execution. Used for tracking and event correlation.
+ WorkflowActionID param.Field[string] `json:"workflowActionId" format:"uuid"`
+}
+
+func (r AgentStartExecutionParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type AgentStopExecutionParams struct {
+ AgentExecutionID param.Field[string] `json:"agentExecutionId" format:"uuid"`
+}
+
+func (r AgentStopExecutionParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type AgentUpdatePromptParams struct {
+ // Metadata updates
+ Metadata param.Field[AgentUpdatePromptParamsMetadata] `json:"metadata"`
+ // The ID of the prompt to update
+ PromptID param.Field[string] `json:"promptId" format:"uuid"`
+ // Spec updates
+ Spec param.Field[AgentUpdatePromptParamsSpec] `json:"spec"`
+}
+
+func (r AgentUpdatePromptParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// Metadata updates
+type AgentUpdatePromptParamsMetadata struct {
+ // A description of what the prompt does
+ Description param.Field[string] `json:"description"`
+ // The name of the prompt
+ Name param.Field[string] `json:"name"`
+}
+
+func (r AgentUpdatePromptParamsMetadata) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// Spec updates
+type AgentUpdatePromptParamsSpec struct {
+ // The command string (unique within organization)
+ Command param.Field[string] `json:"command"`
+ // Whether this prompt is a command
+ IsCommand param.Field[bool] `json:"isCommand"`
+ // Whether this prompt is a template
+ IsTemplate param.Field[bool] `json:"isTemplate"`
+ // The prompt content
+ Prompt param.Field[string] `json:"prompt"`
+}
+
+func (r AgentUpdatePromptParamsSpec) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
diff --git a/agent_test.go b/agent_test.go
new file mode 100644
index 0000000..9b42b35
--- /dev/null
+++ b/agent_test.go
@@ -0,0 +1,386 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package gitpod_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+ "time"
+
+ "github.com/gitpod-io/gitpod-sdk-go"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/testutil"
+ "github.com/gitpod-io/gitpod-sdk-go/option"
+)
+
+func TestAgentNewExecutionConversationTokenWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Agents.NewExecutionConversationToken(context.TODO(), gitpod.AgentNewExecutionConversationTokenParams{
+ AgentExecutionID: gitpod.F("6fa1a3c7-fbb7-49d1-ba56-1890dc7c4c35"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestAgentNewPromptWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Agents.NewPrompt(context.TODO(), gitpod.AgentNewPromptParams{
+ Command: gitpod.F("command"),
+ Description: gitpod.F("x"),
+ IsCommand: gitpod.F(true),
+ IsTemplate: gitpod.F(true),
+ Name: gitpod.F("x"),
+ Prompt: gitpod.F("x"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestAgentDeleteExecutionWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Agents.DeleteExecution(context.TODO(), gitpod.AgentDeleteExecutionParams{
+ AgentExecutionID: gitpod.F("6fa1a3c7-fbb7-49d1-ba56-1890dc7c4c35"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestAgentDeletePromptWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Agents.DeletePrompt(context.TODO(), gitpod.AgentDeletePromptParams{
+ PromptID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestAgentListExecutionsWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Agents.ListExecutions(context.TODO(), gitpod.AgentListExecutionsParams{
+ Token: gitpod.F("token"),
+ PageSize: gitpod.F(int64(0)),
+ Filter: gitpod.F(gitpod.AgentListExecutionsParamsFilter{
+ AgentIDs: gitpod.F([]string{"b8a64cfa-43e2-4b9d-9fb3-07edc63f5971"}),
+ CreatorIDs: gitpod.F([]string{"string"}),
+ EnvironmentIDs: gitpod.F([]string{"string"}),
+ ProjectIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
+ Roles: gitpod.F([]gitpod.AgentListExecutionsParamsFilterRole{gitpod.AgentListExecutionsParamsFilterRoleAgentExecutionRoleUnspecified}),
+ StatusPhases: gitpod.F([]gitpod.AgentListExecutionsParamsFilterStatusPhase{gitpod.AgentListExecutionsParamsFilterStatusPhasePhaseUnspecified}),
+ }),
+ Pagination: gitpod.F(gitpod.AgentListExecutionsParamsPagination{
+ Token: gitpod.F("token"),
+ PageSize: gitpod.F(int64(10)),
+ }),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestAgentListPromptsWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Agents.ListPrompts(context.TODO(), gitpod.AgentListPromptsParams{
+ Token: gitpod.F("token"),
+ PageSize: gitpod.F(int64(0)),
+ Filter: gitpod.F(gitpod.AgentListPromptsParamsFilter{
+ Command: gitpod.F("command"),
+ CommandPrefix: gitpod.F("commandPrefix"),
+ IsCommand: gitpod.F(true),
+ IsTemplate: gitpod.F(true),
+ }),
+ Pagination: gitpod.F(gitpod.AgentListPromptsParamsPagination{
+ Token: gitpod.F("token"),
+ PageSize: gitpod.F(int64(10)),
+ }),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestAgentGetExecutionWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Agents.GetExecution(context.TODO(), gitpod.AgentGetExecutionParams{
+ AgentExecutionID: gitpod.F("6fa1a3c7-fbb7-49d1-ba56-1890dc7c4c35"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestAgentGetPromptWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Agents.GetPrompt(context.TODO(), gitpod.AgentGetPromptParams{
+ PromptID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestAgentSendToExecutionWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Agents.SendToExecution(context.TODO(), gitpod.AgentSendToExecutionParams{
+ AgentExecutionID: gitpod.F("6fa1a3c7-fbb7-49d1-ba56-1890dc7c4c35"),
+ UserInput: gitpod.F(gitpod.UserInputBlockParam{
+ Text: gitpod.F(gitpod.UserInputBlockTextParam{
+ Content: gitpod.F("Generate a report based on the latest logs."),
+ }),
+ ID: gitpod.F("id"),
+ CreatedAt: gitpod.F(time.Now()),
+ }),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestAgentStartExecutionWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Agents.StartExecution(context.TODO(), gitpod.AgentStartExecutionParams{
+ AgentID: gitpod.F("b8a64cfa-43e2-4b9d-9fb3-07edc63f5971"),
+ CodeContext: gitpod.F(gitpod.AgentCodeContextParam{
+ ContextURL: gitpod.F(gitpod.AgentCodeContextContextURLParam{
+ EnvironmentClassID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ URL: gitpod.F("https://example.com"),
+ }),
+ EnvironmentID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ ProjectID: gitpod.F("2d22e4eb-31da-467f-882c-27e21550992f"),
+ PullRequest: gitpod.F(gitpod.AgentCodeContextPullRequestParam{
+ ID: gitpod.F("id"),
+ Author: gitpod.F("author"),
+ FromBranch: gitpod.F("fromBranch"),
+ Repository: gitpod.F(gitpod.AgentCodeContextPullRequestRepositoryParam{
+ CloneURL: gitpod.F("cloneUrl"),
+ Host: gitpod.F("host"),
+ Name: gitpod.F("name"),
+ Owner: gitpod.F("owner"),
+ }),
+ Title: gitpod.F("title"),
+ ToBranch: gitpod.F("toBranch"),
+ URL: gitpod.F("url"),
+ }),
+ }),
+ Mode: gitpod.F(gitpod.AgentModeUnspecified),
+ Name: gitpod.F("name"),
+ WorkflowActionID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestAgentStopExecutionWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Agents.StopExecution(context.TODO(), gitpod.AgentStopExecutionParams{
+ AgentExecutionID: gitpod.F("6fa1a3c7-fbb7-49d1-ba56-1890dc7c4c35"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestAgentUpdatePromptWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Agents.UpdatePrompt(context.TODO(), gitpod.AgentUpdatePromptParams{
+ Metadata: gitpod.F(gitpod.AgentUpdatePromptParamsMetadata{
+ Description: gitpod.F("x"),
+ Name: gitpod.F("name"),
+ }),
+ PromptID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ Spec: gitpod.F(gitpod.AgentUpdatePromptParamsSpec{
+ Command: gitpod.F("command"),
+ IsCommand: gitpod.F(true),
+ IsTemplate: gitpod.F(true),
+ Prompt: gitpod.F("prompt"),
+ }),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/aliases.go b/aliases.go
index 8e7c024..eaf556d 100644
--- a/aliases.go
+++ b/aliases.go
@@ -27,18 +27,34 @@ const ErrorCodeUnavailable = apierror.ErrorCodeUnavailable
const ErrorCodeDataLoss = apierror.ErrorCodeDataLoss
const ErrorCodeUnauthenticated = apierror.ErrorCodeUnauthenticated
-// An AutomationTrigger represents a trigger for an automation action. The
+// An AutomationTrigger represents a trigger for an automation action. The `manual`
+// field shows a start button in the UI for manually triggering the automation. The
+// `post_machine_start` field indicates that the automation should be triggered
+// after the machine has started, before the devcontainer is ready. This is used
+// for machine-level services like security agents that need to start early. The
// `post_environment_start` field indicates that the automation should be triggered
-// after the environment has started. The `post_devcontainer_start` field indicates
-// that the automation should be triggered after the dev container has started.
+// after the environment has started (devcontainer ready). The
+// `post_devcontainer_start` field indicates that the automation should be
+// triggered after the dev container has started. The `prebuild` field starts the
+// automation during a prebuild of an environment. This phase does not have user
+// secrets available. Note: The prebuild trigger can only be used with tasks, not
+// services.
//
// This is an alias to an internal type.
type AutomationTrigger = shared.AutomationTrigger
-// An AutomationTrigger represents a trigger for an automation action. The
+// An AutomationTrigger represents a trigger for an automation action. The `manual`
+// field shows a start button in the UI for manually triggering the automation. The
+// `post_machine_start` field indicates that the automation should be triggered
+// after the machine has started, before the devcontainer is ready. This is used
+// for machine-level services like security agents that need to start early. The
// `post_environment_start` field indicates that the automation should be triggered
-// after the environment has started. The `post_devcontainer_start` field indicates
-// that the automation should be triggered after the dev container has started.
+// after the environment has started (devcontainer ready). The
+// `post_devcontainer_start` field indicates that the automation should be
+// triggered after the dev container has started. The `prebuild` field starts the
+// automation during a prebuild of an environment. This phase does not have user
+// secrets available. Note: The prebuild trigger can only be used with tasks, not
+// services.
//
// This is an alias to an internal type.
type AutomationTriggerParam = shared.AutomationTriggerParam
@@ -49,6 +65,28 @@ type EnvironmentClass = shared.EnvironmentClass
// This is an alias to an internal type.
type EnvironmentClassParam = shared.EnvironmentClassParam
+// EnvironmentVariableItem represents an environment variable that can be set
+// either from a literal value or from a secret reference.
+//
+// This is an alias to an internal type.
+type EnvironmentVariableItem = shared.EnvironmentVariableItem
+
+// EnvironmentVariableItem represents an environment variable that can be set
+// either from a literal value or from a secret reference.
+//
+// This is an alias to an internal type.
+type EnvironmentVariableItemParam = shared.EnvironmentVariableItemParam
+
+// EnvironmentVariableSource specifies a source for an environment variable value.
+//
+// This is an alias to an internal type.
+type EnvironmentVariableSource = shared.EnvironmentVariableSource
+
+// EnvironmentVariableSource specifies a source for an environment variable value.
+//
+// This is an alias to an internal type.
+type EnvironmentVariableSourceParam = shared.EnvironmentVariableSourceParam
+
// This is an alias to an internal type.
type FieldValue = shared.FieldValue
@@ -96,6 +134,144 @@ const PrincipalServiceAccount = shared.PrincipalServiceAccount
// This is an alias to an internal value.
const PrincipalRunnerManager = shared.PrincipalRunnerManager
+// This is an alias to an internal value.
+const PrincipalAgentExecution = shared.PrincipalAgentExecution
+
+// This is an alias to an internal type.
+type ProjectEnvironmentClass = shared.ProjectEnvironmentClass
+
+// This is an alias to an internal type.
+type ProjectEnvironmentClassParam = shared.ProjectEnvironmentClassParam
+
+// This is an alias to an internal type.
+type ResourceType = shared.ResourceType
+
+// This is an alias to an internal value.
+const ResourceTypeUnspecified = shared.ResourceTypeUnspecified
+
+// This is an alias to an internal value.
+const ResourceTypeEnvironment = shared.ResourceTypeEnvironment
+
+// This is an alias to an internal value.
+const ResourceTypeRunner = shared.ResourceTypeRunner
+
+// This is an alias to an internal value.
+const ResourceTypeProject = shared.ResourceTypeProject
+
+// This is an alias to an internal value.
+const ResourceTypeTask = shared.ResourceTypeTask
+
+// This is an alias to an internal value.
+const ResourceTypeTaskExecution = shared.ResourceTypeTaskExecution
+
+// This is an alias to an internal value.
+const ResourceTypeService = shared.ResourceTypeService
+
+// This is an alias to an internal value.
+const ResourceTypeOrganization = shared.ResourceTypeOrganization
+
+// This is an alias to an internal value.
+const ResourceTypeUser = shared.ResourceTypeUser
+
+// This is an alias to an internal value.
+const ResourceTypeEnvironmentClass = shared.ResourceTypeEnvironmentClass
+
+// This is an alias to an internal value.
+const ResourceTypeRunnerScmIntegration = shared.ResourceTypeRunnerScmIntegration
+
+// This is an alias to an internal value.
+const ResourceTypeHostAuthenticationToken = shared.ResourceTypeHostAuthenticationToken
+
+// This is an alias to an internal value.
+const ResourceTypeGroup = shared.ResourceTypeGroup
+
+// This is an alias to an internal value.
+const ResourceTypePersonalAccessToken = shared.ResourceTypePersonalAccessToken
+
+// This is an alias to an internal value.
+const ResourceTypeUserPreference = shared.ResourceTypeUserPreference
+
+// This is an alias to an internal value.
+const ResourceTypeServiceAccount = shared.ResourceTypeServiceAccount
+
+// This is an alias to an internal value.
+const ResourceTypeSecret = shared.ResourceTypeSecret
+
+// This is an alias to an internal value.
+const ResourceTypeSSOConfig = shared.ResourceTypeSSOConfig
+
+// This is an alias to an internal value.
+const ResourceTypeDomainVerification = shared.ResourceTypeDomainVerification
+
+// This is an alias to an internal value.
+const ResourceTypeAgentExecution = shared.ResourceTypeAgentExecution
+
+// This is an alias to an internal value.
+const ResourceTypeRunnerLlmIntegration = shared.ResourceTypeRunnerLlmIntegration
+
+// This is an alias to an internal value.
+const ResourceTypeAgent = shared.ResourceTypeAgent
+
+// This is an alias to an internal value.
+const ResourceTypeEnvironmentSession = shared.ResourceTypeEnvironmentSession
+
+// This is an alias to an internal value.
+const ResourceTypeUserSecret = shared.ResourceTypeUserSecret
+
+// This is an alias to an internal value.
+const ResourceTypeOrganizationPolicy = shared.ResourceTypeOrganizationPolicy
+
+// This is an alias to an internal value.
+const ResourceTypeOrganizationSecret = shared.ResourceTypeOrganizationSecret
+
+// This is an alias to an internal value.
+const ResourceTypeProjectEnvironmentClass = shared.ResourceTypeProjectEnvironmentClass
+
+// This is an alias to an internal value.
+const ResourceTypeBilling = shared.ResourceTypeBilling
+
+// This is an alias to an internal value.
+const ResourceTypePrompt = shared.ResourceTypePrompt
+
+// This is an alias to an internal value.
+const ResourceTypeCoupon = shared.ResourceTypeCoupon
+
+// This is an alias to an internal value.
+const ResourceTypeCouponRedemption = shared.ResourceTypeCouponRedemption
+
+// This is an alias to an internal value.
+const ResourceTypeAccount = shared.ResourceTypeAccount
+
+// This is an alias to an internal value.
+const ResourceTypeIntegration = shared.ResourceTypeIntegration
+
+// This is an alias to an internal value.
+const ResourceTypeWorkflow = shared.ResourceTypeWorkflow
+
+// This is an alias to an internal value.
+const ResourceTypeWorkflowExecution = shared.ResourceTypeWorkflowExecution
+
+// This is an alias to an internal value.
+const ResourceTypeWorkflowExecutionAction = shared.ResourceTypeWorkflowExecutionAction
+
+// This is an alias to an internal value.
+const ResourceTypeSnapshot = shared.ResourceTypeSnapshot
+
+// This is an alias to an internal value.
+const ResourceTypePrebuild = shared.ResourceTypePrebuild
+
+// This is an alias to an internal value.
+const ResourceTypeOrganizationLlmIntegration = shared.ResourceTypeOrganizationLlmIntegration
+
+// This is an alias to an internal value.
+const ResourceTypeCustomDomain = shared.ResourceTypeCustomDomain
+
+// This is an alias to an internal value.
+const ResourceTypeRoleAssignmentChanged = shared.ResourceTypeRoleAssignmentChanged
+
+// This is an alias to an internal value.
+const ResourceTypeGroupMembershipChanged = shared.ResourceTypeGroupMembershipChanged
+
// This is an alias to an internal type.
type RunsOn = shared.RunsOn
@@ -108,6 +284,16 @@ type RunsOnParam = shared.RunsOnParam
// This is an alias to an internal type.
type RunsOnDockerParam = shared.RunsOnDockerParam
+// SecretRef references a secret by its ID.
+//
+// This is an alias to an internal type.
+type SecretRef = shared.SecretRef
+
+// SecretRef references a secret by its ID.
+//
+// This is an alias to an internal type.
+type SecretRefParam = shared.SecretRefParam
+
// This is an alias to an internal type.
type Subject = shared.Subject
diff --git a/api.md b/api.md
index b5ca854..958a997 100644
--- a/api.md
+++ b/api.md
@@ -2,10 +2,15 @@
- shared.AutomationTriggerParam
- shared.EnvironmentClassParam
+- shared.EnvironmentVariableItemParam
+- shared.EnvironmentVariableSourceParam
- shared.FieldValueParam
- shared.OrganizationRole
- shared.Principal
+- shared.ProjectEnvironmentClassParam
+- shared.ResourceType
- shared.RunsOnParam
+- shared.SecretRefParam
- shared.SubjectParam
- shared.TaskExecutionPhase
- shared.TaskMetadataParam
@@ -15,11 +20,16 @@
- shared.AutomationTrigger
- shared.EnvironmentClass
+- shared.EnvironmentVariableItem
+- shared.EnvironmentVariableSource
- shared.FieldValue
- shared.Gateway
- shared.OrganizationRole
- shared.Principal
+- shared.ProjectEnvironmentClass
+- shared.ResourceType
- shared.RunsOn
+- shared.SecretRef
- shared.Subject
- shared.Task
- shared.TaskExecution
@@ -42,21 +52,65 @@ Response Types:
- gitpod.AccountGetResponse
- gitpod.AccountDeleteResponse
- gitpod.AccountGetSSOLoginURLResponse
-- gitpod.AccountListJoinableOrganizationsResponse
+- gitpod.AccountListSSOLoginsResponse
Methods:
- client.Accounts.Get(ctx context.Context, body gitpod.AccountGetParams) (gitpod.AccountGetResponse, error)
- client.Accounts.Delete(ctx context.Context, body gitpod.AccountDeleteParams) (gitpod.AccountDeleteResponse, error)
- client.Accounts.GetSSOLoginURL(ctx context.Context, body gitpod.AccountGetSSOLoginURLParams) (gitpod.AccountGetSSOLoginURLResponse, error)
-- client.Accounts.ListJoinableOrganizations(ctx context.Context, params gitpod.AccountListJoinableOrganizationsParams) (gitpod.AccountListJoinableOrganizationsResponse, error)
+- client.Accounts.ListJoinableOrganizations(ctx context.Context, params gitpod.AccountListJoinableOrganizationsParams) (pagination.JoinableOrganizationsPage[gitpod.JoinableOrganization], error)
- client.Accounts.ListLoginProviders(ctx context.Context, params gitpod.AccountListLoginProvidersParams) (pagination.LoginProvidersPage[gitpod.LoginProvider], error)
+- client.Accounts.ListSSOLogins(ctx context.Context, params gitpod.AccountListSSOLoginsParams) (pagination.LoginsPage[gitpod.AccountListSSOLoginsResponse], error)
+
+# Agents
+
+Params Types:
+
+- gitpod.AgentCodeContextParam
+- gitpod.AgentMode
+- gitpod.UserInputBlockParam
+
+Response Types:
+
+- gitpod.AgentCodeContext
+- gitpod.AgentExecution
+- gitpod.AgentMode
+- gitpod.Prompt
+- gitpod.PromptMetadata
+- gitpod.PromptSpec
+- gitpod.AgentNewExecutionConversationTokenResponse
+- gitpod.AgentNewPromptResponse
+- gitpod.AgentDeleteExecutionResponse
+- gitpod.AgentDeletePromptResponse
+- gitpod.AgentGetExecutionResponse
+- gitpod.AgentGetPromptResponse
+- gitpod.AgentSendToExecutionResponse
+- gitpod.AgentStartExecutionResponse
+- gitpod.AgentStopExecutionResponse
+- gitpod.AgentUpdatePromptResponse
+
+Methods:
+
+- client.Agents.NewExecutionConversationToken(ctx context.Context, body gitpod.AgentNewExecutionConversationTokenParams) (gitpod.AgentNewExecutionConversationTokenResponse, error)
+- client.Agents.NewPrompt(ctx context.Context, body gitpod.AgentNewPromptParams) (gitpod.AgentNewPromptResponse, error)
+- client.Agents.DeleteExecution(ctx context.Context, body gitpod.AgentDeleteExecutionParams) (gitpod.AgentDeleteExecutionResponse, error)
+- client.Agents.DeletePrompt(ctx context.Context, body gitpod.AgentDeletePromptParams) (gitpod.AgentDeletePromptResponse, error)
+- client.Agents.ListExecutions(ctx context.Context, params gitpod.AgentListExecutionsParams) (pagination.AgentExecutionsPage[gitpod.AgentExecution], error)
+- client.Agents.ListPrompts(ctx context.Context, params gitpod.AgentListPromptsParams) (pagination.PromptsPage[gitpod.Prompt], error)
+- client.Agents.GetExecution(ctx context.Context, body gitpod.AgentGetExecutionParams) (gitpod.AgentGetExecutionResponse, error)
+- client.Agents.GetPrompt(ctx context.Context, body gitpod.AgentGetPromptParams) (gitpod.AgentGetPromptResponse, error)
+- client.Agents.SendToExecution(ctx context.Context, body gitpod.AgentSendToExecutionParams) (gitpod.AgentSendToExecutionResponse, error)
+- client.Agents.StartExecution(ctx context.Context, body gitpod.AgentStartExecutionParams) (gitpod.AgentStartExecutionResponse, error)
+- client.Agents.StopExecution(ctx context.Context, body gitpod.AgentStopExecutionParams) (gitpod.AgentStopExecutionResponse, error)
+- client.Agents.UpdatePrompt(ctx context.Context, body gitpod.AgentUpdatePromptParams) (gitpod.AgentUpdatePromptResponse, error)
# Editors
Response Types:
- gitpod.Editor
+- gitpod.EditorVersion
- gitpod.EditorGetResponse
- gitpod.EditorResolveURLResponse
@@ -73,6 +127,7 @@ Params Types:
- gitpod.AdmissionLevel
- gitpod.EnvironmentActivitySignalParam
- gitpod.EnvironmentPhase
+- gitpod.EnvironmentRole
- gitpod.EnvironmentSpecParam
Response Types:
@@ -82,6 +137,7 @@ Response Types:
- gitpod.EnvironmentActivitySignal
- gitpod.EnvironmentMetadata
- gitpod.EnvironmentPhase
+- gitpod.EnvironmentRole
- gitpod.EnvironmentSpec
- gitpod.EnvironmentStatus
- gitpod.EnvironmentNewResponse
@@ -131,6 +187,7 @@ Params Types:
- gitpod.ServiceMetadataParam
- gitpod.ServicePhase
+- gitpod.ServiceRole
- gitpod.ServiceSpecParam
Response Types:
@@ -138,6 +195,7 @@ Response Types:
- gitpod.Service
- gitpod.ServiceMetadata
- gitpod.ServicePhase
+- gitpod.ServiceRole
- gitpod.ServiceSpec
- gitpod.ServiceStatus
- gitpod.EnvironmentAutomationServiceNewResponse
@@ -195,16 +253,31 @@ Methods:
- client.Environments.Classes.List(ctx context.Context, params gitpod.EnvironmentClassListParams) (pagination.EnvironmentClassesPage[shared.EnvironmentClass], error)
-# Events
+# Errors
Params Types:
-- gitpod.ResourceType
+- gitpod.BreadcrumbParam
+- gitpod.ErrorEventParam
+- gitpod.ErrorLevel
+- gitpod.ExceptionInfoParam
+- gitpod.ExceptionMechanismParam
+- gitpod.RequestInfoParam
+- gitpod.StackFrameParam
+
+Response Types:
+
+- gitpod.ErrorReportErrorsResponse
+
+Methods:
+
+- client.Errors.ReportErrors(ctx context.Context, body gitpod.ErrorReportErrorsParams) (gitpod.ErrorReportErrorsResponse, error)
+
+# Events
Response Types:
- gitpod.ResourceOperation
-- gitpod.ResourceType
- gitpod.EventListResponse
- gitpod.EventWatchResponse
@@ -224,10 +297,51 @@ Methods:
Response Types:
- gitpod.Group
+- gitpod.GroupNewResponse
+- gitpod.GroupGetResponse
+- gitpod.GroupUpdateResponse
+- gitpod.GroupDeleteResponse
Methods:
+- client.Groups.New(ctx context.Context, body gitpod.GroupNewParams) (gitpod.GroupNewResponse, error)
+- client.Groups.Get(ctx context.Context, body gitpod.GroupGetParams) (gitpod.GroupGetResponse, error)
+- client.Groups.Update(ctx context.Context, body gitpod.GroupUpdateParams) (gitpod.GroupUpdateResponse, error)
- client.Groups.List(ctx context.Context, params gitpod.GroupListParams) (pagination.GroupsPage[gitpod.Group], error)
+- client.Groups.Delete(ctx context.Context, body gitpod.GroupDeleteParams) (gitpod.GroupDeleteResponse, error)
+
+## Memberships
+
+Response Types:
+
+- gitpod.GroupMembership
+- gitpod.GroupMembershipNewResponse
+- gitpod.GroupMembershipDeleteResponse
+
+Methods:
+
+- client.Groups.Memberships.New(ctx context.Context, body gitpod.GroupMembershipNewParams) (gitpod.GroupMembershipNewResponse, error)
+- client.Groups.Memberships.List(ctx context.Context, params gitpod.GroupMembershipListParams) (pagination.MembersPage[gitpod.GroupMembership], error)
+- client.Groups.Memberships.Delete(ctx context.Context, body gitpod.GroupMembershipDeleteParams) (gitpod.GroupMembershipDeleteResponse, error)
+
+## RoleAssignments
+
+Params Types:
+
+- gitpod.ResourceRole
+
+Response Types:
+
+- gitpod.ResourceRole
+- gitpod.RoleAssignment
+- gitpod.GroupRoleAssignmentNewResponse
+- gitpod.GroupRoleAssignmentDeleteResponse
+
+Methods:
+
+- client.Groups.RoleAssignments.New(ctx context.Context, body gitpod.GroupRoleAssignmentNewParams) (gitpod.GroupRoleAssignmentNewResponse, error)
+- client.Groups.RoleAssignments.List(ctx context.Context, params gitpod.GroupRoleAssignmentListParams) (pagination.AssignmentsPage[gitpod.RoleAssignment], error)
+- client.Groups.RoleAssignments.Delete(ctx context.Context, body gitpod.GroupRoleAssignmentDeleteParams) (gitpod.GroupRoleAssignmentDeleteResponse, error)
# Identity
@@ -278,6 +392,28 @@ Methods:
- client.Organizations.ListMembers(ctx context.Context, params gitpod.OrganizationListMembersParams) (pagination.MembersPage[gitpod.OrganizationMember], error)
- client.Organizations.SetRole(ctx context.Context, body gitpod.OrganizationSetRoleParams) (gitpod.OrganizationSetRoleResponse, error)
+## CustomDomains
+
+Params Types:
+
+- gitpod.CustomDomainProvider
+
+Response Types:
+
+- gitpod.CustomDomain
+- gitpod.CustomDomainProvider
+- gitpod.OrganizationCustomDomainNewResponse
+- gitpod.OrganizationCustomDomainGetResponse
+- gitpod.OrganizationCustomDomainUpdateResponse
+- gitpod.OrganizationCustomDomainDeleteResponse
+
+Methods:
+
+- client.Organizations.CustomDomains.New(ctx context.Context, body gitpod.OrganizationCustomDomainNewParams) (gitpod.OrganizationCustomDomainNewResponse, error)
+- client.Organizations.CustomDomains.Get(ctx context.Context, body gitpod.OrganizationCustomDomainGetParams) (gitpod.OrganizationCustomDomainGetResponse, error)
+- client.Organizations.CustomDomains.Update(ctx context.Context, body gitpod.OrganizationCustomDomainUpdateParams) (gitpod.OrganizationCustomDomainUpdateResponse, error)
+- client.Organizations.CustomDomains.Delete(ctx context.Context, body gitpod.OrganizationCustomDomainDeleteParams) (gitpod.OrganizationCustomDomainDeleteResponse, error)
+
## DomainVerifications
Response Types:
@@ -316,7 +452,10 @@ Methods:
Response Types:
+- gitpod.AgentPolicy
+- gitpod.CrowdStrikeConfig
- gitpod.OrganizationPolicies
+- gitpod.SecurityAgentPolicy
- gitpod.OrganizationPolicyGetResponse
- gitpod.OrganizationPolicyUpdateResponse
@@ -349,19 +488,50 @@ Methods:
- client.Organizations.SSOConfigurations.List(ctx context.Context, params gitpod.OrganizationSSOConfigurationListParams) (pagination.SSOConfigurationsPage[gitpod.SSOConfiguration], error)
- client.Organizations.SSOConfigurations.Delete(ctx context.Context, body gitpod.OrganizationSSOConfigurationDeleteParams) (gitpod.OrganizationSSOConfigurationDeleteResponse, error)
+# Prebuilds
+
+Params Types:
+
+- gitpod.PrebuildPhase
+- gitpod.PrebuildSpecParam
+
+Response Types:
+
+- gitpod.Prebuild
+- gitpod.PrebuildMetadata
+- gitpod.PrebuildPhase
+- gitpod.PrebuildSpec
+- gitpod.PrebuildStatus
+- gitpod.PrebuildTrigger
+- gitpod.PrebuildNewResponse
+- gitpod.PrebuildGetResponse
+- gitpod.PrebuildDeleteResponse
+- gitpod.PrebuildCancelResponse
+- gitpod.PrebuildNewLogsTokenResponse
+
+Methods:
+
+- client.Prebuilds.New(ctx context.Context, body gitpod.PrebuildNewParams) (gitpod.PrebuildNewResponse, error)
+- client.Prebuilds.Get(ctx context.Context, body gitpod.PrebuildGetParams) (gitpod.PrebuildGetResponse, error)
+- client.Prebuilds.List(ctx context.Context, params gitpod.PrebuildListParams) (pagination.PrebuildsPage[gitpod.Prebuild], error)
+- client.Prebuilds.Delete(ctx context.Context, body gitpod.PrebuildDeleteParams) (gitpod.PrebuildDeleteResponse, error)
+- client.Prebuilds.Cancel(ctx context.Context, body gitpod.PrebuildCancelParams) (gitpod.PrebuildCancelResponse, error)
+- client.Prebuilds.NewLogsToken(ctx context.Context, body gitpod.PrebuildNewLogsTokenParams) (gitpod.PrebuildNewLogsTokenResponse, error)
+
# Projects
Params Types:
- gitpod.EnvironmentInitializerParam
-- gitpod.ProjectEnvironmentClassParam
+- gitpod.ProjectPrebuildConfigurationParam
Response Types:
- gitpod.EnvironmentInitializer
- gitpod.Project
-- gitpod.ProjectEnvironmentClass
- gitpod.ProjectMetadata
+- gitpod.ProjectPhase
+- gitpod.ProjectPrebuildConfiguration
- gitpod.ProjectNewResponse
- gitpod.ProjectGetResponse
- gitpod.ProjectUpdateResponse
@@ -377,6 +547,17 @@ Methods:
- client.Projects.Delete(ctx context.Context, body gitpod.ProjectDeleteParams) (gitpod.ProjectDeleteResponse, error)
- client.Projects.NewFromEnvironment(ctx context.Context, body gitpod.ProjectNewFromEnvironmentParams) (gitpod.ProjectNewFromEnvironmentResponse, error)
+## EnvironmentClases
+
+Response Types:
+
+- gitpod.ProjectEnvironmentClaseUpdateResponse
+
+Methods:
+
+- client.Projects.EnvironmentClases.Update(ctx context.Context, body gitpod.ProjectEnvironmentClaseUpdateParams) (gitpod.ProjectEnvironmentClaseUpdateResponse, error)
+- client.Projects.EnvironmentClases.List(ctx context.Context, params gitpod.ProjectEnvironmentClaseListParams) (pagination.ProjectEnvironmentClassesPage[shared.ProjectEnvironmentClass], error)
+
## Policies
Params Types:
@@ -410,6 +591,8 @@ Params Types:
- gitpod.RunnerProvider
- gitpod.RunnerReleaseChannel
- gitpod.RunnerSpecParam
+- gitpod.RunnerVariant
+- gitpod.SearchMode
Response Types:
@@ -425,13 +608,16 @@ Response Types:
- gitpod.RunnerReleaseChannel
- gitpod.RunnerSpec
- gitpod.RunnerStatus
+- gitpod.RunnerVariant
- gitpod.RunnerNewResponse
- gitpod.RunnerGetResponse
- gitpod.RunnerUpdateResponse
- gitpod.RunnerDeleteResponse
- gitpod.RunnerCheckAuthenticationForHostResponse
+- gitpod.RunnerNewLogsTokenResponse
- gitpod.RunnerNewRunnerTokenResponse
- gitpod.RunnerParseContextURLResponse
+- gitpod.RunnerSearchRepositoriesResponse
Methods:
@@ -441,8 +627,10 @@ Methods:
- client.Runners.List(ctx context.Context, params gitpod.RunnerListParams) (pagination.RunnersPage[gitpod.Runner], error)
- client.Runners.Delete(ctx context.Context, body gitpod.RunnerDeleteParams) (gitpod.RunnerDeleteResponse, error)
- client.Runners.CheckAuthenticationForHost(ctx context.Context, body gitpod.RunnerCheckAuthenticationForHostParams) (gitpod.RunnerCheckAuthenticationForHostResponse, error)
+- client.Runners.NewLogsToken(ctx context.Context, body gitpod.RunnerNewLogsTokenParams) (gitpod.RunnerNewLogsTokenResponse, error)
- client.Runners.NewRunnerToken(ctx context.Context, body gitpod.RunnerNewRunnerTokenParams) (gitpod.RunnerNewRunnerTokenResponse, error)
- client.Runners.ParseContextURL(ctx context.Context, body gitpod.RunnerParseContextURLParams) (gitpod.RunnerParseContextURLResponse, error)
+- client.Runners.SearchRepositories(ctx context.Context, body gitpod.RunnerSearchRepositoriesParams) (gitpod.RunnerSearchRepositoriesResponse, error)
## Configurations
@@ -584,12 +772,16 @@ Methods:
Response Types:
- gitpod.User
+- gitpod.UserDeleteUserResponse
- gitpod.UserGetAuthenticatedUserResponse
+- gitpod.UserGetUserResponse
- gitpod.UserSetSuspendedResponse
Methods:
+- client.Users.DeleteUser(ctx context.Context, body gitpod.UserDeleteUserParams) (gitpod.UserDeleteUserResponse, error)
- client.Users.GetAuthenticatedUser(ctx context.Context, body gitpod.UserGetAuthenticatedUserParams) (gitpod.UserGetAuthenticatedUserResponse, error)
+- client.Users.GetUser(ctx context.Context, body gitpod.UserGetUserParams) (gitpod.UserGetUserResponse, error)
- client.Users.SetSuspended(ctx context.Context, body gitpod.UserSetSuspendedParams) (gitpod.UserSetSuspendedResponse, error)
## Dotfiles
diff --git a/client.go b/client.go
index 8ce13cd..89f0c1e 100644
--- a/client.go
+++ b/client.go
@@ -18,13 +18,16 @@ import (
type Client struct {
Options []option.RequestOption
Accounts *AccountService
+ Agents *AgentService
Editors *EditorService
Environments *EnvironmentService
+ Errors *ErrorService
Events *EventService
Gateways *GatewayService
Groups *GroupService
Identity *IdentityService
Organizations *OrganizationService
+ Prebuilds *PrebuildService
Projects *ProjectService
Runners *RunnerService
Secrets *SecretService
@@ -55,13 +58,16 @@ func NewClient(opts ...option.RequestOption) (r *Client) {
r = &Client{Options: opts}
r.Accounts = NewAccountService(opts...)
+ r.Agents = NewAgentService(opts...)
r.Editors = NewEditorService(opts...)
r.Environments = NewEnvironmentService(opts...)
+ r.Errors = NewErrorService(opts...)
r.Events = NewEventService(opts...)
r.Gateways = NewGatewayService(opts...)
r.Groups = NewGroupService(opts...)
r.Identity = NewIdentityService(opts...)
r.Organizations = NewOrganizationService(opts...)
+ r.Prebuilds = NewPrebuildService(opts...)
r.Projects = NewProjectService(opts...)
r.Runners = NewRunnerService(opts...)
r.Secrets = NewSecretService(opts...)
diff --git a/editor.go b/editor.go
index 6c9598a..1511277 100644
--- a/editor.go
+++ b/editor.go
@@ -171,14 +171,16 @@ func (r *EditorService) ResolveURL(ctx context.Context, body EditorResolveURLPar
}
type Editor struct {
- ID string `json:"id,required" format:"uuid"`
- InstallationInstructions string `json:"installationInstructions,required"`
- Name string `json:"name,required"`
- URLTemplate string `json:"urlTemplate,required"`
- Alias string `json:"alias"`
- IconURL string `json:"iconUrl"`
- ShortDescription string `json:"shortDescription"`
- JSON editorJSON `json:"-"`
+ ID string `json:"id,required" format:"uuid"`
+ InstallationInstructions string `json:"installationInstructions,required"`
+ Name string `json:"name,required"`
+ URLTemplate string `json:"urlTemplate,required"`
+ Alias string `json:"alias"`
+ IconURL string `json:"iconUrl"`
+ ShortDescription string `json:"shortDescription"`
+ // versions contains the list of available versions for this editor
+ Versions []EditorVersion `json:"versions"`
+ JSON editorJSON `json:"-"`
}
// editorJSON contains the JSON metadata for the struct [Editor]
@@ -190,6 +192,7 @@ type editorJSON struct {
Alias apijson.Field
IconURL apijson.Field
ShortDescription apijson.Field
+ Versions apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
@@ -202,6 +205,27 @@ func (r editorJSON) RawJSON() string {
return r.raw
}
+type EditorVersion struct {
+ // version is the version string of the editor Examples for JetBrains: 2025.2
+ Version string `json:"version,required"`
+ JSON editorVersionJSON `json:"-"`
+}
+
+// editorVersionJSON contains the JSON metadata for the struct [EditorVersion]
+type editorVersionJSON struct {
+ Version apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *EditorVersion) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r editorVersionJSON) RawJSON() string {
+ return r.raw
+}
+
type EditorGetResponse struct {
// editor contains the editor
Editor Editor `json:"editor,required"`
@@ -308,6 +332,11 @@ type EditorResolveURLParams struct {
EnvironmentID param.Field[string] `json:"environmentId,required" format:"uuid"`
// organizationId is the ID of the organization to resolve the URL for
OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"`
+ // version is the editor version to use If not provided, the latest version will be
+ // installed
+ //
+ // Examples for JetBrains: 2025.2
+ Version param.Field[string] `json:"version"`
}
func (r EditorResolveURLParams) MarshalJSON() (data []byte, err error) {
diff --git a/editor_test.go b/editor_test.go
index a09978c..056b89f 100644
--- a/editor_test.go
+++ b/editor_test.go
@@ -71,7 +71,7 @@ func TestEditorListWithOptionalParams(t *testing.T) {
}
}
-func TestEditorResolveURL(t *testing.T) {
+func TestEditorResolveURLWithOptionalParams(t *testing.T) {
t.Skip("Prism tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -88,6 +88,7 @@ func TestEditorResolveURL(t *testing.T) {
EditorID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
EnvironmentID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"),
OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
+ Version: gitpod.F("version"),
})
if err != nil {
var apierr *gitpod.Error
diff --git a/environment.go b/environment.go
index 9512e1a..b8af486 100644
--- a/environment.go
+++ b/environment.go
@@ -599,9 +599,14 @@ type EnvironmentMetadata struct {
// original_context_url is the normalized URL from which the environment was
// created
OriginalContextURL string `json:"originalContextUrl"`
+ // prebuild_id is the ID of the prebuild this environment was created from. Only
+ // set if the environment was created from a prebuild.
+ PrebuildID string `json:"prebuildId,nullable" format:"uuid"`
// If the Environment was started from a project, the project_id will reference the
// project.
ProjectID string `json:"projectId"`
+ // role is the role of the environment
+ Role EnvironmentRole `json:"role"`
// Runner is the ID of the runner that runs this environment.
RunnerID string `json:"runnerId"`
JSON environmentMetadataJSON `json:"-"`
@@ -618,7 +623,9 @@ type environmentMetadataJSON struct {
Name apijson.Field
OrganizationID apijson.Field
OriginalContextURL apijson.Field
+ PrebuildID apijson.Field
ProjectID apijson.Field
+ Role apijson.Field
RunnerID apijson.Field
raw string
ExtraFields map[string]apijson.Field
@@ -654,6 +661,24 @@ func (r EnvironmentPhase) IsKnown() bool {
return false
}
+// EnvironmentRole represents the role of an environment
+type EnvironmentRole string
+
+const (
+ EnvironmentRoleUnspecified EnvironmentRole = "ENVIRONMENT_ROLE_UNSPECIFIED"
+ EnvironmentRoleDefault EnvironmentRole = "ENVIRONMENT_ROLE_DEFAULT"
+ EnvironmentRolePrebuild EnvironmentRole = "ENVIRONMENT_ROLE_PREBUILD"
+ EnvironmentRoleWorkflow EnvironmentRole = "ENVIRONMENT_ROLE_WORKFLOW"
+)
+
+func (r EnvironmentRole) IsKnown() bool {
+ switch r {
+ case EnvironmentRoleUnspecified, EnvironmentRoleDefault, EnvironmentRolePrebuild, EnvironmentRoleWorkflow:
+ return true
+ }
+ return false
+}
+
// EnvironmentSpec specifies the configuration of an environment for an environment
// start
type EnvironmentSpec struct {
@@ -669,7 +694,7 @@ type EnvironmentSpec struct {
Devcontainer EnvironmentSpecDevcontainer `json:"devcontainer"`
// machine is the machine spec of the environment
Machine EnvironmentSpecMachine `json:"machine"`
- // ports is the set of ports which ought to be exposed to the internet
+ // ports is the set of ports which ought to be exposed to your network
Ports []EnvironmentSpecPort `json:"ports"`
// secrets are confidential data that is mounted into the environment
Secrets []EnvironmentSpecSecret `json:"secrets"`
@@ -681,24 +706,28 @@ type EnvironmentSpec struct {
SSHPublicKeys []EnvironmentSpecSSHPublicKey `json:"sshPublicKeys"`
// Timeout configures the environment timeout
Timeout EnvironmentSpecTimeout `json:"timeout"`
- JSON environmentSpecJSON `json:"-"`
+ // workflow_action_id is an optional reference to the workflow execution action
+ // that created this environment. Used for tracking and event correlation.
+ WorkflowActionID string `json:"workflowActionId,nullable" format:"uuid"`
+ JSON environmentSpecJSON `json:"-"`
}
// environmentSpecJSON contains the JSON metadata for the struct [EnvironmentSpec]
type environmentSpecJSON struct {
- Admission apijson.Field
- AutomationsFile apijson.Field
- Content apijson.Field
- DesiredPhase apijson.Field
- Devcontainer apijson.Field
- Machine apijson.Field
- Ports apijson.Field
- Secrets apijson.Field
- SpecVersion apijson.Field
- SSHPublicKeys apijson.Field
- Timeout apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
+ Admission apijson.Field
+ AutomationsFile apijson.Field
+ Content apijson.Field
+ DesiredPhase apijson.Field
+ Devcontainer apijson.Field
+ Machine apijson.Field
+ Ports apijson.Field
+ Secrets apijson.Field
+ SpecVersion apijson.Field
+ SSHPublicKeys apijson.Field
+ Timeout apijson.Field
+ WorkflowActionID apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
}
func (r *EnvironmentSpec) UnmarshalJSON(data []byte) (err error) {
@@ -718,9 +747,13 @@ type EnvironmentSpecAutomationsFile struct {
// ```
// this.matches('^$|^[^/].*')
// ```
- AutomationsFilePath string `json:"automationsFilePath"`
- Session string `json:"session"`
- JSON environmentSpecAutomationsFileJSON `json:"-"`
+ AutomationsFilePath string `json:"automationsFilePath"`
+ Session string `json:"session"`
+ // trigger_filter specifies which automation triggers should execute. When set,
+ // only automations matching these triggers will run. If empty/unset, all triggers
+ // are evaluated normally.
+ TriggerFilter []shared.AutomationTrigger `json:"triggerFilter"`
+ JSON environmentSpecAutomationsFileJSON `json:"-"`
}
// environmentSpecAutomationsFileJSON contains the JSON metadata for the struct
@@ -728,6 +761,7 @@ type EnvironmentSpecAutomationsFile struct {
type environmentSpecAutomationsFileJSON struct {
AutomationsFilePath apijson.Field
Session apijson.Field
+ TriggerFilter apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
@@ -785,8 +819,11 @@ type EnvironmentSpecDevcontainer struct {
DevcontainerFilePath string `json:"devcontainerFilePath"`
// Experimental: dotfiles is the dotfiles configuration of the devcontainer
Dotfiles EnvironmentSpecDevcontainerDotfiles `json:"dotfiles"`
- Session string `json:"session"`
- JSON environmentSpecDevcontainerJSON `json:"-"`
+ // lifecycle_stage controls which devcontainer lifecycle commands are executed.
+ // Defaults to FULL if not specified.
+ LifecycleStage EnvironmentSpecDevcontainerLifecycleStage `json:"lifecycleStage"`
+ Session string `json:"session"`
+ JSON environmentSpecDevcontainerJSON `json:"-"`
}
// environmentSpecDevcontainerJSON contains the JSON metadata for the struct
@@ -795,6 +832,7 @@ type environmentSpecDevcontainerJSON struct {
DefaultDevcontainerImage apijson.Field
DevcontainerFilePath apijson.Field
Dotfiles apijson.Field
+ LifecycleStage apijson.Field
Session apijson.Field
raw string
ExtraFields map[string]apijson.Field
@@ -831,6 +869,24 @@ func (r environmentSpecDevcontainerDotfilesJSON) RawJSON() string {
return r.raw
}
+// lifecycle_stage controls which devcontainer lifecycle commands are executed.
+// Defaults to FULL if not specified.
+type EnvironmentSpecDevcontainerLifecycleStage string
+
+const (
+ EnvironmentSpecDevcontainerLifecycleStageLifecycleStageUnspecified EnvironmentSpecDevcontainerLifecycleStage = "LIFECYCLE_STAGE_UNSPECIFIED"
+ EnvironmentSpecDevcontainerLifecycleStageLifecycleStageFull EnvironmentSpecDevcontainerLifecycleStage = "LIFECYCLE_STAGE_FULL"
+ EnvironmentSpecDevcontainerLifecycleStageLifecycleStagePrebuild EnvironmentSpecDevcontainerLifecycleStage = "LIFECYCLE_STAGE_PREBUILD"
+)
+
+func (r EnvironmentSpecDevcontainerLifecycleStage) IsKnown() bool {
+ switch r {
+ case EnvironmentSpecDevcontainerLifecycleStageLifecycleStageUnspecified, EnvironmentSpecDevcontainerLifecycleStageLifecycleStageFull, EnvironmentSpecDevcontainerLifecycleStageLifecycleStagePrebuild:
+ return true
+ }
+ return false
+}
+
// machine is the machine spec of the environment
type EnvironmentSpecMachine struct {
// Class denotes the class of the environment we ought to start
@@ -862,8 +918,12 @@ type EnvironmentSpecPort struct {
// name of this port
Name string `json:"name"`
// port number
- Port int64 `json:"port"`
- JSON environmentSpecPortJSON `json:"-"`
+ Port int64 `json:"port"`
+ // protocol for communication (Gateway proxy → user environment service). this
+ // setting only affects the protocol used between Gateway and user environment
+ // services.
+ Protocol EnvironmentSpecPortsProtocol `json:"protocol"`
+ JSON environmentSpecPortJSON `json:"-"`
}
// environmentSpecPortJSON contains the JSON metadata for the struct
@@ -872,6 +932,7 @@ type environmentSpecPortJSON struct {
Admission apijson.Field
Name apijson.Field
Port apijson.Field
+ Protocol apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
@@ -884,9 +945,31 @@ func (r environmentSpecPortJSON) RawJSON() string {
return r.raw
}
+// protocol for communication (Gateway proxy → user environment service). this
+// setting only affects the protocol used between Gateway and user environment
+// services.
+type EnvironmentSpecPortsProtocol string
+
+const (
+ EnvironmentSpecPortsProtocolProtocolUnspecified EnvironmentSpecPortsProtocol = "PROTOCOL_UNSPECIFIED"
+ EnvironmentSpecPortsProtocolProtocolHTTP EnvironmentSpecPortsProtocol = "PROTOCOL_HTTP"
+ EnvironmentSpecPortsProtocolProtocolHTTPS EnvironmentSpecPortsProtocol = "PROTOCOL_HTTPS"
+)
+
+func (r EnvironmentSpecPortsProtocol) IsKnown() bool {
+ switch r {
+ case EnvironmentSpecPortsProtocolProtocolUnspecified, EnvironmentSpecPortsProtocolProtocolHTTP, EnvironmentSpecPortsProtocolProtocolHTTPS:
+ return true
+ }
+ return false
+}
+
type EnvironmentSpecSecret struct {
// id is the unique identifier of the secret.
ID string `json:"id"`
+ // api_only indicates the secret is only available via API/CLI. These secrets are
+ // resolved but NOT automatically injected into services or devcontainers.
+ APIOnly bool `json:"apiOnly"`
// container_registry_basic_auth_host is the hostname of the container registry
// that supports basic auth
ContainerRegistryBasicAuthHost string `json:"containerRegistryBasicAuthHost"`
@@ -910,6 +993,7 @@ type EnvironmentSpecSecret struct {
// [EnvironmentSpecSecret]
type environmentSpecSecretJSON struct {
ID apijson.Field
+ APIOnly apijson.Field
ContainerRegistryBasicAuthHost apijson.Field
EnvironmentVariable apijson.Field
FilePath apijson.Field
@@ -994,7 +1078,7 @@ type EnvironmentSpecParam struct {
Devcontainer param.Field[EnvironmentSpecDevcontainerParam] `json:"devcontainer"`
// machine is the machine spec of the environment
Machine param.Field[EnvironmentSpecMachineParam] `json:"machine"`
- // ports is the set of ports which ought to be exposed to the internet
+ // ports is the set of ports which ought to be exposed to your network
Ports param.Field[[]EnvironmentSpecPortParam] `json:"ports"`
// secrets are confidential data that is mounted into the environment
Secrets param.Field[[]EnvironmentSpecSecretParam] `json:"secrets"`
@@ -1006,6 +1090,9 @@ type EnvironmentSpecParam struct {
SSHPublicKeys param.Field[[]EnvironmentSpecSSHPublicKeyParam] `json:"sshPublicKeys"`
// Timeout configures the environment timeout
Timeout param.Field[EnvironmentSpecTimeoutParam] `json:"timeout"`
+ // workflow_action_id is an optional reference to the workflow execution action
+ // that created this environment. Used for tracking and event correlation.
+ WorkflowActionID param.Field[string] `json:"workflowActionId" format:"uuid"`
}
func (r EnvironmentSpecParam) MarshalJSON() (data []byte, err error) {
@@ -1023,6 +1110,10 @@ type EnvironmentSpecAutomationsFileParam struct {
// ```
AutomationsFilePath param.Field[string] `json:"automationsFilePath"`
Session param.Field[string] `json:"session"`
+ // trigger_filter specifies which automation triggers should execute. When set,
+ // only automations matching these triggers will run. If empty/unset, all triggers
+ // are evaluated normally.
+ TriggerFilter param.Field[[]shared.AutomationTriggerParam] `json:"triggerFilter"`
}
func (r EnvironmentSpecAutomationsFileParam) MarshalJSON() (data []byte, err error) {
@@ -1058,7 +1149,10 @@ type EnvironmentSpecDevcontainerParam struct {
DevcontainerFilePath param.Field[string] `json:"devcontainerFilePath"`
// Experimental: dotfiles is the dotfiles configuration of the devcontainer
Dotfiles param.Field[EnvironmentSpecDevcontainerDotfilesParam] `json:"dotfiles"`
- Session param.Field[string] `json:"session"`
+ // lifecycle_stage controls which devcontainer lifecycle commands are executed.
+ // Defaults to FULL if not specified.
+ LifecycleStage param.Field[EnvironmentSpecDevcontainerLifecycleStage] `json:"lifecycleStage"`
+ Session param.Field[string] `json:"session"`
}
func (r EnvironmentSpecDevcontainerParam) MarshalJSON() (data []byte, err error) {
@@ -1093,6 +1187,10 @@ type EnvironmentSpecPortParam struct {
Name param.Field[string] `json:"name"`
// port number
Port param.Field[int64] `json:"port"`
+ // protocol for communication (Gateway proxy → user environment service). this
+ // setting only affects the protocol used between Gateway and user environment
+ // services.
+ Protocol param.Field[EnvironmentSpecPortsProtocol] `json:"protocol"`
}
func (r EnvironmentSpecPortParam) MarshalJSON() (data []byte, err error) {
@@ -1102,6 +1200,9 @@ func (r EnvironmentSpecPortParam) MarshalJSON() (data []byte, err error) {
type EnvironmentSpecSecretParam struct {
// id is the unique identifier of the secret.
ID param.Field[string] `json:"id"`
+ // api_only indicates the secret is only available via API/CLI. These secrets are
+ // resolved but NOT automatically injected into services or devcontainers.
+ APIOnly param.Field[bool] `json:"apiOnly"`
// container_registry_basic_auth_host is the hostname of the container registry
// that supports basic auth
ContainerRegistryBasicAuthHost param.Field[string] `json:"containerRegistryBasicAuthHost"`
@@ -1287,11 +1388,12 @@ const (
EnvironmentStatusAutomationsFilePhaseContentPhaseReady EnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_READY"
EnvironmentStatusAutomationsFilePhaseContentPhaseUpdating EnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_UPDATING"
EnvironmentStatusAutomationsFilePhaseContentPhaseFailed EnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_FAILED"
+ EnvironmentStatusAutomationsFilePhaseContentPhaseUnavailable EnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_UNAVAILABLE"
)
func (r EnvironmentStatusAutomationsFilePhase) IsKnown() bool {
switch r {
- case EnvironmentStatusAutomationsFilePhaseContentPhaseUnspecified, EnvironmentStatusAutomationsFilePhaseContentPhaseCreating, EnvironmentStatusAutomationsFilePhaseContentPhaseInitializing, EnvironmentStatusAutomationsFilePhaseContentPhaseReady, EnvironmentStatusAutomationsFilePhaseContentPhaseUpdating, EnvironmentStatusAutomationsFilePhaseContentPhaseFailed:
+ case EnvironmentStatusAutomationsFilePhaseContentPhaseUnspecified, EnvironmentStatusAutomationsFilePhaseContentPhaseCreating, EnvironmentStatusAutomationsFilePhaseContentPhaseInitializing, EnvironmentStatusAutomationsFilePhaseContentPhaseReady, EnvironmentStatusAutomationsFilePhaseContentPhaseUpdating, EnvironmentStatusAutomationsFilePhaseContentPhaseFailed, EnvironmentStatusAutomationsFilePhaseContentPhaseUnavailable:
return true
}
return false
@@ -1440,11 +1542,12 @@ const (
EnvironmentStatusContentPhaseContentPhaseReady EnvironmentStatusContentPhase = "CONTENT_PHASE_READY"
EnvironmentStatusContentPhaseContentPhaseUpdating EnvironmentStatusContentPhase = "CONTENT_PHASE_UPDATING"
EnvironmentStatusContentPhaseContentPhaseFailed EnvironmentStatusContentPhase = "CONTENT_PHASE_FAILED"
+ EnvironmentStatusContentPhaseContentPhaseUnavailable EnvironmentStatusContentPhase = "CONTENT_PHASE_UNAVAILABLE"
)
func (r EnvironmentStatusContentPhase) IsKnown() bool {
switch r {
- case EnvironmentStatusContentPhaseContentPhaseUnspecified, EnvironmentStatusContentPhaseContentPhaseCreating, EnvironmentStatusContentPhaseContentPhaseInitializing, EnvironmentStatusContentPhaseContentPhaseReady, EnvironmentStatusContentPhaseContentPhaseUpdating, EnvironmentStatusContentPhaseContentPhaseFailed:
+ case EnvironmentStatusContentPhaseContentPhaseUnspecified, EnvironmentStatusContentPhaseContentPhaseCreating, EnvironmentStatusContentPhaseContentPhaseInitializing, EnvironmentStatusContentPhaseContentPhaseReady, EnvironmentStatusContentPhaseContentPhaseUpdating, EnvironmentStatusContentPhaseContentPhaseFailed, EnvironmentStatusContentPhaseContentPhaseUnavailable:
return true
}
return false
@@ -1555,21 +1658,28 @@ func (r EnvironmentStatusDevcontainerPhase) IsKnown() bool {
// field is only set if the environment is running.
type EnvironmentStatusEnvironmentURLs struct {
// logs is the URL at which the environment logs can be accessed.
- Logs string `json:"logs"`
+ Logs string `json:"logs"`
+ // ops is the URL at which the environment ops service can be accessed.
+ Ops string `json:"ops"`
Ports []EnvironmentStatusEnvironmentURLsPort `json:"ports"`
// SSH is the URL at which the environment can be accessed via SSH.
- SSH EnvironmentStatusEnvironmentURLsSSH `json:"ssh"`
- JSON environmentStatusEnvironmentURLsJSON `json:"-"`
+ SSH EnvironmentStatusEnvironmentURLsSSH `json:"ssh"`
+ // support_bundle is the URL at which the environment support bundle can be
+ // accessed.
+ SupportBundle string `json:"supportBundle"`
+ JSON environmentStatusEnvironmentURLsJSON `json:"-"`
}
// environmentStatusEnvironmentURLsJSON contains the JSON metadata for the struct
// [EnvironmentStatusEnvironmentURLs]
type environmentStatusEnvironmentURLsJSON struct {
- Logs apijson.Field
- Ports apijson.Field
- SSH apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
+ Logs apijson.Field
+ Ops apijson.Field
+ Ports apijson.Field
+ SSH apijson.Field
+ SupportBundle apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
}
func (r *EnvironmentStatusEnvironmentURLs) UnmarshalJSON(data []byte) (err error) {
@@ -1691,6 +1801,7 @@ func (r EnvironmentStatusMachinePhase) IsKnown() bool {
// versions contains the versions of components in the machine.
type EnvironmentStatusMachineVersions struct {
+ AmiID string `json:"amiId"`
SupervisorCommit string `json:"supervisorCommit"`
SupervisorVersion string `json:"supervisorVersion"`
JSON environmentStatusMachineVersionsJSON `json:"-"`
@@ -1699,6 +1810,7 @@ type EnvironmentStatusMachineVersions struct {
// environmentStatusMachineVersionsJSON contains the JSON metadata for the struct
// [EnvironmentStatusMachineVersions]
type environmentStatusMachineVersionsJSON struct {
+ AmiID apijson.Field
SupervisorCommit apijson.Field
SupervisorVersion apijson.Field
raw string
@@ -1802,11 +1914,12 @@ const (
EnvironmentStatusSecretsPhaseContentPhaseReady EnvironmentStatusSecretsPhase = "CONTENT_PHASE_READY"
EnvironmentStatusSecretsPhaseContentPhaseUpdating EnvironmentStatusSecretsPhase = "CONTENT_PHASE_UPDATING"
EnvironmentStatusSecretsPhaseContentPhaseFailed EnvironmentStatusSecretsPhase = "CONTENT_PHASE_FAILED"
+ EnvironmentStatusSecretsPhaseContentPhaseUnavailable EnvironmentStatusSecretsPhase = "CONTENT_PHASE_UNAVAILABLE"
)
func (r EnvironmentStatusSecretsPhase) IsKnown() bool {
switch r {
- case EnvironmentStatusSecretsPhaseContentPhaseUnspecified, EnvironmentStatusSecretsPhaseContentPhaseCreating, EnvironmentStatusSecretsPhaseContentPhaseInitializing, EnvironmentStatusSecretsPhaseContentPhaseReady, EnvironmentStatusSecretsPhaseContentPhaseUpdating, EnvironmentStatusSecretsPhaseContentPhaseFailed:
+ case EnvironmentStatusSecretsPhaseContentPhaseUnspecified, EnvironmentStatusSecretsPhaseContentPhaseCreating, EnvironmentStatusSecretsPhaseContentPhaseInitializing, EnvironmentStatusSecretsPhaseContentPhaseReady, EnvironmentStatusSecretsPhaseContentPhaseUpdating, EnvironmentStatusSecretsPhaseContentPhaseFailed, EnvironmentStatusSecretsPhaseContentPhaseUnavailable:
return true
}
return false
@@ -1847,11 +1960,12 @@ const (
EnvironmentStatusSSHPublicKeysPhaseContentPhaseReady EnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_READY"
EnvironmentStatusSSHPublicKeysPhaseContentPhaseUpdating EnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_UPDATING"
EnvironmentStatusSSHPublicKeysPhaseContentPhaseFailed EnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_FAILED"
+ EnvironmentStatusSSHPublicKeysPhaseContentPhaseUnavailable EnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_UNAVAILABLE"
)
func (r EnvironmentStatusSSHPublicKeysPhase) IsKnown() bool {
switch r {
- case EnvironmentStatusSSHPublicKeysPhaseContentPhaseUnspecified, EnvironmentStatusSSHPublicKeysPhaseContentPhaseCreating, EnvironmentStatusSSHPublicKeysPhaseContentPhaseInitializing, EnvironmentStatusSSHPublicKeysPhaseContentPhaseReady, EnvironmentStatusSSHPublicKeysPhaseContentPhaseUpdating, EnvironmentStatusSSHPublicKeysPhaseContentPhaseFailed:
+ case EnvironmentStatusSSHPublicKeysPhaseContentPhaseUnspecified, EnvironmentStatusSSHPublicKeysPhaseContentPhaseCreating, EnvironmentStatusSSHPublicKeysPhaseContentPhaseInitializing, EnvironmentStatusSSHPublicKeysPhaseContentPhaseReady, EnvironmentStatusSSHPublicKeysPhaseContentPhaseUpdating, EnvironmentStatusSSHPublicKeysPhaseContentPhaseFailed, EnvironmentStatusSSHPublicKeysPhaseContentPhaseUnavailable:
return true
}
return false
@@ -2093,12 +2207,35 @@ type EnvironmentUpdateParamsSpecPort struct {
Name param.Field[string] `json:"name"`
// port number
Port param.Field[int64] `json:"port"`
+ // protocol for communication (Gateway proxy → user environment service). this
+ // setting only affects the protocol used between Gateway and user environment
+ // services.
+ Protocol param.Field[EnvironmentUpdateParamsSpecPortsProtocol] `json:"protocol"`
}
func (r EnvironmentUpdateParamsSpecPort) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
+// protocol for communication (Gateway proxy → user environment service). this
+// setting only affects the protocol used between Gateway and user environment
+// services.
+type EnvironmentUpdateParamsSpecPortsProtocol string
+
+const (
+ EnvironmentUpdateParamsSpecPortsProtocolProtocolUnspecified EnvironmentUpdateParamsSpecPortsProtocol = "PROTOCOL_UNSPECIFIED"
+ EnvironmentUpdateParamsSpecPortsProtocolProtocolHTTP EnvironmentUpdateParamsSpecPortsProtocol = "PROTOCOL_HTTP"
+ EnvironmentUpdateParamsSpecPortsProtocolProtocolHTTPS EnvironmentUpdateParamsSpecPortsProtocol = "PROTOCOL_HTTPS"
+)
+
+func (r EnvironmentUpdateParamsSpecPortsProtocol) IsKnown() bool {
+ switch r {
+ case EnvironmentUpdateParamsSpecPortsProtocolProtocolUnspecified, EnvironmentUpdateParamsSpecPortsProtocolProtocolHTTP, EnvironmentUpdateParamsSpecPortsProtocolProtocolHTTPS:
+ return true
+ }
+ return false
+}
+
type EnvironmentUpdateParamsSpecSSHPublicKey struct {
// id is the unique identifier of the public key
ID param.Field[string] `json:"id"`
@@ -2145,12 +2282,16 @@ func (r EnvironmentListParams) URLQuery() (v url.Values) {
type EnvironmentListParamsFilter struct {
// archival_status filters the response based on environment archive status
ArchivalStatus param.Field[EnvironmentListParamsFilterArchivalStatus] `json:"archivalStatus"`
+ // created_before filters environments created before this timestamp
+ CreatedBefore param.Field[time.Time] `json:"createdBefore" format:"date-time"`
// creator_ids filters the response to only Environments created by specified
// members
CreatorIDs param.Field[[]string] `json:"creatorIds" format:"uuid"`
// project_ids filters the response to only Environments associated with the
// specified projects
ProjectIDs param.Field[[]string] `json:"projectIds" format:"uuid"`
+ // roles filters the response to only Environments with the specified roles
+ Roles param.Field[[]EnvironmentRole] `json:"roles"`
// runner_ids filters the response to only Environments running on these Runner IDs
RunnerIDs param.Field[[]string] `json:"runnerIds" format:"uuid"`
// runner_kinds filters the response to only Environments running on these Runner
diff --git a/environment_test.go b/environment_test.go
index 4d5ccff..93c8e94 100644
--- a/environment_test.go
+++ b/environment_test.go
@@ -12,6 +12,7 @@ import (
"github.com/gitpod-io/gitpod-sdk-go"
"github.com/gitpod-io/gitpod-sdk-go/internal/testutil"
"github.com/gitpod-io/gitpod-sdk-go/option"
+ "github.com/gitpod-io/gitpod-sdk-go/shared"
)
func TestEnvironmentNewWithOptionalParams(t *testing.T) {
@@ -33,6 +34,13 @@ func TestEnvironmentNewWithOptionalParams(t *testing.T) {
AutomationsFile: gitpod.F(gitpod.EnvironmentSpecAutomationsFileParam{
AutomationsFilePath: gitpod.F("automationsFilePath"),
Session: gitpod.F("session"),
+ TriggerFilter: gitpod.F([]shared.AutomationTriggerParam{{
+ Manual: gitpod.F(true),
+ PostDevcontainerStart: gitpod.F(true),
+ PostEnvironmentStart: gitpod.F(true),
+ PostMachineStart: gitpod.F(true),
+ Prebuild: gitpod.F(true),
+ }}),
}),
Content: gitpod.F(gitpod.EnvironmentSpecContentParam{
GitEmail: gitpod.F("gitEmail"),
@@ -60,7 +68,8 @@ func TestEnvironmentNewWithOptionalParams(t *testing.T) {
Dotfiles: gitpod.F(gitpod.EnvironmentSpecDevcontainerDotfilesParam{
Repository: gitpod.F("https://example.com"),
}),
- Session: gitpod.F("session"),
+ LifecycleStage: gitpod.F(gitpod.EnvironmentSpecDevcontainerLifecycleStageLifecycleStageUnspecified),
+ Session: gitpod.F("session"),
}),
Machine: gitpod.F(gitpod.EnvironmentSpecMachineParam{
Class: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
@@ -69,10 +78,12 @@ func TestEnvironmentNewWithOptionalParams(t *testing.T) {
Ports: gitpod.F([]gitpod.EnvironmentSpecPortParam{{
Admission: gitpod.F(gitpod.AdmissionLevelUnspecified),
Name: gitpod.F("x"),
- Port: gitpod.F(int64(1)),
+ Port: gitpod.F(int64(1024)),
+ Protocol: gitpod.F(gitpod.EnvironmentSpecPortsProtocolProtocolUnspecified),
}}),
Secrets: gitpod.F([]gitpod.EnvironmentSpecSecretParam{{
ID: gitpod.F("id"),
+ APIOnly: gitpod.F(true),
ContainerRegistryBasicAuthHost: gitpod.F("containerRegistryBasicAuthHost"),
EnvironmentVariable: gitpod.F("environmentVariable"),
FilePath: gitpod.F("filePath"),
@@ -90,6 +101,7 @@ func TestEnvironmentNewWithOptionalParams(t *testing.T) {
Timeout: gitpod.F(gitpod.EnvironmentSpecTimeoutParam{
Disconnected: gitpod.F("+9125115.360s"),
}),
+ WorkflowActionID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
}),
})
if err != nil {
@@ -175,7 +187,8 @@ func TestEnvironmentUpdateWithOptionalParams(t *testing.T) {
Ports: gitpod.F([]gitpod.EnvironmentUpdateParamsSpecPort{{
Admission: gitpod.F(gitpod.AdmissionLevelUnspecified),
Name: gitpod.F("x"),
- Port: gitpod.F(int64(1)),
+ Port: gitpod.F(int64(1024)),
+ Protocol: gitpod.F(gitpod.EnvironmentUpdateParamsSpecPortsProtocolProtocolUnspecified),
}}),
SSHPublicKeys: gitpod.F([]gitpod.EnvironmentUpdateParamsSpecSSHPublicKey{{
ID: gitpod.F("0194b7c1-c954-718d-91a4-9a742aa5fc11"),
@@ -213,8 +226,10 @@ func TestEnvironmentListWithOptionalParams(t *testing.T) {
PageSize: gitpod.F(int64(0)),
Filter: gitpod.F(gitpod.EnvironmentListParamsFilter{
ArchivalStatus: gitpod.F(gitpod.EnvironmentListParamsFilterArchivalStatusArchivalStatusUnspecified),
+ CreatedBefore: gitpod.F(time.Now()),
CreatorIDs: gitpod.F([]string{"f53d2330-3795-4c5d-a1f3-453121af9c60"}),
ProjectIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
+ Roles: gitpod.F([]gitpod.EnvironmentRole{gitpod.EnvironmentRoleUnspecified}),
RunnerIDs: gitpod.F([]string{"e6aa9c54-89d3-42c1-ac31-bd8d8f1concentrate"}),
RunnerKinds: gitpod.F([]gitpod.RunnerKind{gitpod.RunnerKindUnspecified}),
StatusPhases: gitpod.F([]gitpod.EnvironmentPhase{gitpod.EnvironmentPhaseUnspecified}),
@@ -304,6 +319,13 @@ func TestEnvironmentNewFromProjectWithOptionalParams(t *testing.T) {
AutomationsFile: gitpod.F(gitpod.EnvironmentSpecAutomationsFileParam{
AutomationsFilePath: gitpod.F("automationsFilePath"),
Session: gitpod.F("session"),
+ TriggerFilter: gitpod.F([]shared.AutomationTriggerParam{{
+ Manual: gitpod.F(true),
+ PostDevcontainerStart: gitpod.F(true),
+ PostEnvironmentStart: gitpod.F(true),
+ PostMachineStart: gitpod.F(true),
+ Prebuild: gitpod.F(true),
+ }}),
}),
Content: gitpod.F(gitpod.EnvironmentSpecContentParam{
GitEmail: gitpod.F("gitEmail"),
@@ -331,7 +353,8 @@ func TestEnvironmentNewFromProjectWithOptionalParams(t *testing.T) {
Dotfiles: gitpod.F(gitpod.EnvironmentSpecDevcontainerDotfilesParam{
Repository: gitpod.F("https://example.com"),
}),
- Session: gitpod.F("session"),
+ LifecycleStage: gitpod.F(gitpod.EnvironmentSpecDevcontainerLifecycleStageLifecycleStageUnspecified),
+ Session: gitpod.F("session"),
}),
Machine: gitpod.F(gitpod.EnvironmentSpecMachineParam{
Class: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
@@ -340,10 +363,12 @@ func TestEnvironmentNewFromProjectWithOptionalParams(t *testing.T) {
Ports: gitpod.F([]gitpod.EnvironmentSpecPortParam{{
Admission: gitpod.F(gitpod.AdmissionLevelUnspecified),
Name: gitpod.F("x"),
- Port: gitpod.F(int64(1)),
+ Port: gitpod.F(int64(1024)),
+ Protocol: gitpod.F(gitpod.EnvironmentSpecPortsProtocolProtocolUnspecified),
}}),
Secrets: gitpod.F([]gitpod.EnvironmentSpecSecretParam{{
ID: gitpod.F("id"),
+ APIOnly: gitpod.F(true),
ContainerRegistryBasicAuthHost: gitpod.F("containerRegistryBasicAuthHost"),
EnvironmentVariable: gitpod.F("environmentVariable"),
FilePath: gitpod.F("filePath"),
@@ -361,6 +386,7 @@ func TestEnvironmentNewFromProjectWithOptionalParams(t *testing.T) {
Timeout: gitpod.F(gitpod.EnvironmentSpecTimeoutParam{
Disconnected: gitpod.F("14400s"),
}),
+ WorkflowActionID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
}),
})
if err != nil {
diff --git a/environmentautomation.go b/environmentautomation.go
index acde3b1..d7168e5 100644
--- a/environmentautomation.go
+++ b/environmentautomation.go
@@ -95,6 +95,7 @@ type AutomationsFileServiceParam struct {
Commands param.Field[AutomationsFileServicesCommandsParam] `json:"commands"`
Description param.Field[string] `json:"description"`
Name param.Field[string] `json:"name"`
+ Role param.Field[AutomationsFileServicesRole] `json:"role"`
RunsOn param.Field[shared.RunsOnParam] `json:"runsOn"`
TriggeredBy param.Field[[]AutomationsFileServicesTriggeredBy] `json:"triggeredBy"`
}
@@ -129,6 +130,23 @@ func (r AutomationsFileServicesCommandsParam) MarshalJSON() (data []byte, err er
return apijson.MarshalRoot(r)
}
+type AutomationsFileServicesRole string
+
+const (
+ AutomationsFileServicesRoleEmpty AutomationsFileServicesRole = ""
+ AutomationsFileServicesRoleDefault AutomationsFileServicesRole = "default"
+ AutomationsFileServicesRoleEditor AutomationsFileServicesRole = "editor"
+ AutomationsFileServicesRoleAIAgent AutomationsFileServicesRole = "ai-agent"
+)
+
+func (r AutomationsFileServicesRole) IsKnown() bool {
+ switch r {
+ case AutomationsFileServicesRoleEmpty, AutomationsFileServicesRoleDefault, AutomationsFileServicesRoleEditor, AutomationsFileServicesRoleAIAgent:
+ return true
+ }
+ return false
+}
+
type AutomationsFileServicesTriggeredBy string
const (
@@ -164,11 +182,12 @@ const (
AutomationsFileTasksTriggeredByManual AutomationsFileTasksTriggeredBy = "manual"
AutomationsFileTasksTriggeredByPostEnvironmentStart AutomationsFileTasksTriggeredBy = "postEnvironmentStart"
AutomationsFileTasksTriggeredByPostDevcontainerStart AutomationsFileTasksTriggeredBy = "postDevcontainerStart"
+ AutomationsFileTasksTriggeredByPrebuild AutomationsFileTasksTriggeredBy = "prebuild"
)
func (r AutomationsFileTasksTriggeredBy) IsKnown() bool {
switch r {
- case AutomationsFileTasksTriggeredByManual, AutomationsFileTasksTriggeredByPostEnvironmentStart, AutomationsFileTasksTriggeredByPostDevcontainerStart:
+ case AutomationsFileTasksTriggeredByManual, AutomationsFileTasksTriggeredByPostEnvironmentStart, AutomationsFileTasksTriggeredByPostDevcontainerStart, AutomationsFileTasksTriggeredByPrebuild:
return true
}
return false
diff --git a/environmentautomation_test.go b/environmentautomation_test.go
index ac2463e..7d46e71 100644
--- a/environmentautomation_test.go
+++ b/environmentautomation_test.go
@@ -38,11 +38,13 @@ func TestEnvironmentAutomationUpsertWithOptionalParams(t *testing.T) {
}),
Description: gitpod.F("Development web server"),
Name: gitpod.F("Web Server"),
+ Role: gitpod.F(gitpod.AutomationsFileServicesRoleEmpty),
RunsOn: gitpod.F(shared.RunsOnParam{
Docker: gitpod.F(shared.RunsOnDockerParam{
Environment: gitpod.F([]string{"string"}),
Image: gitpod.F("x"),
}),
+ Machine: gitpod.F[any](map[string]interface{}{}),
}),
TriggeredBy: gitpod.F([]gitpod.AutomationsFileServicesTriggeredBy{gitpod.AutomationsFileServicesTriggeredByPostDevcontainerStart}),
},
@@ -58,6 +60,7 @@ func TestEnvironmentAutomationUpsertWithOptionalParams(t *testing.T) {
Environment: gitpod.F([]string{"string"}),
Image: gitpod.F("x"),
}),
+ Machine: gitpod.F[any](map[string]interface{}{}),
}),
TriggeredBy: gitpod.F([]gitpod.AutomationsFileTasksTriggeredBy{gitpod.AutomationsFileTasksTriggeredByPostEnvironmentStart}),
},
diff --git a/environmentautomationservice.go b/environmentautomationservice.go
index 01ffa4c..98c7ac9 100644
--- a/environmentautomationservice.go
+++ b/environmentautomationservice.go
@@ -371,6 +371,8 @@ type ServiceMetadata struct {
// the environment. It is used to express dependencies between services, and to
// identify the service in user interactions (e.g. the CLI).
Reference string `json:"reference"`
+ // role specifies the intended role or purpose of the service.
+ Role ServiceRole `json:"role"`
// triggered_by is a list of trigger that start the service.
TriggeredBy []shared.AutomationTrigger `json:"triggeredBy"`
JSON serviceMetadataJSON `json:"-"`
@@ -383,6 +385,7 @@ type serviceMetadataJSON struct {
Description apijson.Field
Name apijson.Field
Reference apijson.Field
+ Role apijson.Field
TriggeredBy apijson.Field
raw string
ExtraFields map[string]apijson.Field
@@ -412,6 +415,8 @@ type ServiceMetadataParam struct {
// the environment. It is used to express dependencies between services, and to
// identify the service in user interactions (e.g. the CLI).
Reference param.Field[string] `json:"reference"`
+ // role specifies the intended role or purpose of the service.
+ Role param.Field[ServiceRole] `json:"role"`
// triggered_by is a list of trigger that start the service.
TriggeredBy param.Field[[]shared.AutomationTriggerParam] `json:"triggeredBy"`
}
@@ -440,6 +445,24 @@ func (r ServicePhase) IsKnown() bool {
return false
}
+type ServiceRole string
+
+const (
+ ServiceRoleUnspecified ServiceRole = "SERVICE_ROLE_UNSPECIFIED"
+ ServiceRoleDefault ServiceRole = "SERVICE_ROLE_DEFAULT"
+ ServiceRoleEditor ServiceRole = "SERVICE_ROLE_EDITOR"
+ ServiceRoleAIAgent ServiceRole = "SERVICE_ROLE_AI_AGENT"
+ ServiceRoleSecurityAgent ServiceRole = "SERVICE_ROLE_SECURITY_AGENT"
+)
+
+func (r ServiceRole) IsKnown() bool {
+ switch r {
+ case ServiceRoleUnspecified, ServiceRoleDefault, ServiceRoleEditor, ServiceRoleAIAgent, ServiceRoleSecurityAgent:
+ return true
+ }
+ return false
+}
+
type ServiceSpec struct {
// commands contains the commands to start, stop and check the readiness of the
// service
@@ -447,6 +470,8 @@ type ServiceSpec struct {
// desired_phase is the phase the service should be in. Used to start or stop the
// service.
DesiredPhase ServicePhase `json:"desiredPhase"`
+ // env specifies environment variables for the service.
+ Env []shared.EnvironmentVariableItem `json:"env"`
// runs_on specifies the environment the service should run on.
RunsOn shared.RunsOn `json:"runsOn"`
// session should be changed to trigger a restart of the service. If a service
@@ -463,6 +488,7 @@ type ServiceSpec struct {
type serviceSpecJSON struct {
Commands apijson.Field
DesiredPhase apijson.Field
+ Env apijson.Field
RunsOn apijson.Field
Session apijson.Field
SpecVersion apijson.Field
@@ -528,6 +554,8 @@ type ServiceSpecParam struct {
// desired_phase is the phase the service should be in. Used to start or stop the
// service.
DesiredPhase param.Field[ServicePhase] `json:"desiredPhase"`
+ // env specifies environment variables for the service.
+ Env param.Field[[]shared.EnvironmentVariableItemParam] `json:"env"`
// runs_on specifies the environment the service should run on.
RunsOn param.Field[shared.RunsOnParam] `json:"runsOn"`
// session should be changed to trigger a restart of the service. If a service
@@ -702,6 +730,7 @@ func (r EnvironmentAutomationServiceUpdateParams) MarshalJSON() (data []byte, er
type EnvironmentAutomationServiceUpdateParamsMetadata struct {
Description param.Field[string] `json:"description"`
Name param.Field[string] `json:"name"`
+ Role param.Field[ServiceRole] `json:"role"`
TriggeredBy param.Field[EnvironmentAutomationServiceUpdateParamsMetadataTriggeredBy] `json:"triggeredBy"`
}
@@ -722,6 +751,7 @@ func (r EnvironmentAutomationServiceUpdateParamsMetadataTriggeredBy) MarshalJSON
// it must be stopped first.
type EnvironmentAutomationServiceUpdateParamsSpec struct {
Commands param.Field[EnvironmentAutomationServiceUpdateParamsSpecCommands] `json:"commands"`
+ Env param.Field[[]shared.EnvironmentVariableItemParam] `json:"env"`
RunsOn param.Field[shared.RunsOnParam] `json:"runsOn"`
}
@@ -783,6 +813,8 @@ type EnvironmentAutomationServiceListParamsFilter struct {
EnvironmentIDs param.Field[[]string] `json:"environmentIds" format:"uuid"`
// references filters the response to only services with these references
References param.Field[[]string] `json:"references"`
+ // roles filters the response to only services with these roles
+ Roles param.Field[[]ServiceRole] `json:"roles"`
// service_ids filters the response to only services with these IDs
ServiceIDs param.Field[[]string] `json:"serviceIds" format:"uuid"`
}
diff --git a/environmentautomationservice_test.go b/environmentautomationservice_test.go
index 2d2b739..f1747b5 100644
--- a/environmentautomationservice_test.go
+++ b/environmentautomationservice_test.go
@@ -33,16 +33,19 @@ func TestEnvironmentAutomationServiceNewWithOptionalParams(t *testing.T) {
Metadata: gitpod.F(gitpod.ServiceMetadataParam{
CreatedAt: gitpod.F(time.Now()),
Creator: gitpod.F(shared.SubjectParam{
- ID: gitpod.F("id"),
+ ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
Principal: gitpod.F(shared.PrincipalUnspecified),
}),
Description: gitpod.F("Runs the development web server"),
Name: gitpod.F("Web Server"),
Reference: gitpod.F("web-server"),
+ Role: gitpod.F(gitpod.ServiceRoleUnspecified),
TriggeredBy: gitpod.F([]shared.AutomationTriggerParam{{
Manual: gitpod.F(true),
PostDevcontainerStart: gitpod.F(true),
PostEnvironmentStart: gitpod.F(true),
+ PostMachineStart: gitpod.F(true),
+ Prebuild: gitpod.F(true),
}}),
}),
Spec: gitpod.F(gitpod.ServiceSpecParam{
@@ -52,11 +55,21 @@ func TestEnvironmentAutomationServiceNewWithOptionalParams(t *testing.T) {
Stop: gitpod.F("stop"),
}),
DesiredPhase: gitpod.F(gitpod.ServicePhaseUnspecified),
+ Env: gitpod.F([]shared.EnvironmentVariableItemParam{{
+ Name: gitpod.F("x"),
+ Value: gitpod.F("value"),
+ ValueFrom: gitpod.F(shared.EnvironmentVariableSourceParam{
+ SecretRef: gitpod.F(shared.SecretRefParam{
+ ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ }),
+ }),
+ }}),
RunsOn: gitpod.F(shared.RunsOnParam{
Docker: gitpod.F(shared.RunsOnDockerParam{
Environment: gitpod.F([]string{"string"}),
Image: gitpod.F("x"),
}),
+ Machine: gitpod.F[any](map[string]interface{}{}),
}),
Session: gitpod.F("session"),
SpecVersion: gitpod.F("specVersion"),
@@ -114,11 +127,14 @@ func TestEnvironmentAutomationServiceUpdateWithOptionalParams(t *testing.T) {
Metadata: gitpod.F(gitpod.EnvironmentAutomationServiceUpdateParamsMetadata{
Description: gitpod.F("description"),
Name: gitpod.F("x"),
+ Role: gitpod.F(gitpod.ServiceRoleUnspecified),
TriggeredBy: gitpod.F(gitpod.EnvironmentAutomationServiceUpdateParamsMetadataTriggeredBy{
Trigger: gitpod.F([]shared.AutomationTriggerParam{{
Manual: gitpod.F(true),
PostDevcontainerStart: gitpod.F(true),
PostEnvironmentStart: gitpod.F(true),
+ PostMachineStart: gitpod.F(true),
+ Prebuild: gitpod.F(true),
}}),
}),
}),
@@ -128,11 +144,21 @@ func TestEnvironmentAutomationServiceUpdateWithOptionalParams(t *testing.T) {
Start: gitpod.F("npm run start:dev"),
Stop: gitpod.F("stop"),
}),
+ Env: gitpod.F([]shared.EnvironmentVariableItemParam{{
+ Name: gitpod.F("x"),
+ Value: gitpod.F("value"),
+ ValueFrom: gitpod.F(shared.EnvironmentVariableSourceParam{
+ SecretRef: gitpod.F(shared.SecretRefParam{
+ ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ }),
+ }),
+ }}),
RunsOn: gitpod.F(shared.RunsOnParam{
Docker: gitpod.F(shared.RunsOnDockerParam{
Environment: gitpod.F([]string{"string"}),
Image: gitpod.F("x"),
}),
+ Machine: gitpod.F[any](map[string]interface{}{}),
}),
}),
Status: gitpod.F(gitpod.EnvironmentAutomationServiceUpdateParamsStatus{
@@ -173,6 +199,7 @@ func TestEnvironmentAutomationServiceListWithOptionalParams(t *testing.T) {
Filter: gitpod.F(gitpod.EnvironmentAutomationServiceListParamsFilter{
EnvironmentIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
References: gitpod.F([]string{"web-server", "database"}),
+ Roles: gitpod.F([]gitpod.ServiceRole{gitpod.ServiceRoleUnspecified}),
ServiceIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
}),
Pagination: gitpod.F(gitpod.EnvironmentAutomationServiceListParamsPagination{
diff --git a/environmentautomationtask.go b/environmentautomationtask.go
index fdd4f28..239d16a 100644
--- a/environmentautomationtask.go
+++ b/environmentautomationtask.go
@@ -398,8 +398,9 @@ func (r EnvironmentAutomationTaskUpdateParamsMetadataTriggeredBy) MarshalJSON()
}
type EnvironmentAutomationTaskUpdateParamsSpec struct {
- Command param.Field[string] `json:"command"`
- RunsOn param.Field[shared.RunsOnParam] `json:"runsOn"`
+ Command param.Field[string] `json:"command"`
+ Env param.Field[[]shared.EnvironmentVariableItemParam] `json:"env"`
+ RunsOn param.Field[shared.RunsOnParam] `json:"runsOn"`
}
func (r EnvironmentAutomationTaskUpdateParamsSpec) MarshalJSON() (data []byte, err error) {
diff --git a/environmentautomationtask_test.go b/environmentautomationtask_test.go
index 3db720b..4cad2fd 100644
--- a/environmentautomationtask_test.go
+++ b/environmentautomationtask_test.go
@@ -34,7 +34,7 @@ func TestEnvironmentAutomationTaskNewWithOptionalParams(t *testing.T) {
Metadata: gitpod.F(shared.TaskMetadataParam{
CreatedAt: gitpod.F(time.Now()),
Creator: gitpod.F(shared.SubjectParam{
- ID: gitpod.F("id"),
+ ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
Principal: gitpod.F(shared.PrincipalUnspecified),
}),
Description: gitpod.F("Builds the project artifacts"),
@@ -44,15 +44,27 @@ func TestEnvironmentAutomationTaskNewWithOptionalParams(t *testing.T) {
Manual: gitpod.F(true),
PostDevcontainerStart: gitpod.F(true),
PostEnvironmentStart: gitpod.F(true),
+ PostMachineStart: gitpod.F(true),
+ Prebuild: gitpod.F(true),
}}),
}),
Spec: gitpod.F(shared.TaskSpecParam{
Command: gitpod.F("npm run build"),
+ Env: gitpod.F([]shared.EnvironmentVariableItemParam{{
+ Name: gitpod.F("x"),
+ Value: gitpod.F("value"),
+ ValueFrom: gitpod.F(shared.EnvironmentVariableSourceParam{
+ SecretRef: gitpod.F(shared.SecretRefParam{
+ ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ }),
+ }),
+ }}),
RunsOn: gitpod.F(shared.RunsOnParam{
Docker: gitpod.F(shared.RunsOnDockerParam{
Environment: gitpod.F([]string{"string"}),
Image: gitpod.F("x"),
}),
+ Machine: gitpod.F[any](map[string]interface{}{}),
}),
}),
})
@@ -114,16 +126,28 @@ func TestEnvironmentAutomationTaskUpdateWithOptionalParams(t *testing.T) {
Manual: gitpod.F(true),
PostDevcontainerStart: gitpod.F(true),
PostEnvironmentStart: gitpod.F(true),
+ PostMachineStart: gitpod.F(true),
+ Prebuild: gitpod.F(true),
}}),
}),
}),
Spec: gitpod.F(gitpod.EnvironmentAutomationTaskUpdateParamsSpec{
Command: gitpod.F("npm run test:coverage"),
+ Env: gitpod.F([]shared.EnvironmentVariableItemParam{{
+ Name: gitpod.F("x"),
+ Value: gitpod.F("value"),
+ ValueFrom: gitpod.F(shared.EnvironmentVariableSourceParam{
+ SecretRef: gitpod.F(shared.SecretRefParam{
+ ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ }),
+ }),
+ }}),
RunsOn: gitpod.F(shared.RunsOnParam{
Docker: gitpod.F(shared.RunsOnDockerParam{
Environment: gitpod.F([]string{"string"}),
Image: gitpod.F("x"),
}),
+ Machine: gitpod.F[any](map[string]interface{}{}),
}),
}),
})
diff --git a/error.go b/error.go
new file mode 100644
index 0000000..f40e067
--- /dev/null
+++ b/error.go
@@ -0,0 +1,234 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package gitpod
+
+import (
+ "context"
+ "net/http"
+ "slices"
+ "time"
+
+ "github.com/gitpod-io/gitpod-sdk-go/internal/apijson"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/param"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/requestconfig"
+ "github.com/gitpod-io/gitpod-sdk-go/option"
+)
+
+// ErrorService contains methods and other services that help with interacting with
+// the gitpod API.
+//
+// Note, unlike clients, this service does not read variables from the environment
+// automatically. You should not instantiate this service directly, and instead use
+// the [NewErrorService] method instead.
+type ErrorService struct {
+ Options []option.RequestOption
+}
+
+// NewErrorService generates a new service that applies the given options to each
+// request. These options are applied after the parent client's options (if there
+// is one), and before any request-specific options.
+func NewErrorService(opts ...option.RequestOption) (r *ErrorService) {
+ r = &ErrorService{}
+ r.Options = opts
+ return
+}
+
+// ReportErrors allows clients to report batches of errors that will be sent to
+// error reporting systems. The structure is fully compatible with Sentry's event
+// payload format.
+//
+// Use this method to:
+//
+// - Report client-side errors and exceptions
+// - Track application crashes and panics
+// - Send error context and metadata for debugging
+//
+// ### Examples
+//
+// - Report a JavaScript error with Sentry-compatible structure: The service
+// accepts events with comprehensive error information including stack traces,
+// identity context, breadcrumbs, and metadata that align with Sentry's event
+// payload format.
+func (r *ErrorService) ReportErrors(ctx context.Context, body ErrorReportErrorsParams, opts ...option.RequestOption) (res *ErrorReportErrorsResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.ErrorsService/ReportErrors"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Breadcrumb information (Sentry-compatible)
+type BreadcrumbParam struct {
+ // Breadcrumb category
+ Category param.Field[string] `json:"category"`
+ // Additional breadcrumb data
+ Data param.Field[map[string]string] `json:"data"`
+ // Breadcrumb level
+ Level param.Field[ErrorLevel] `json:"level"`
+ // Breadcrumb message
+ Message param.Field[string] `json:"message"`
+ // When the breadcrumb occurred
+ Timestamp param.Field[time.Time] `json:"timestamp" format:"date-time"`
+ // Breadcrumb type (e.g., "navigation", "http", "user", "error")
+ Type param.Field[string] `json:"type"`
+}
+
+func (r BreadcrumbParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// ErrorEvent contains comprehensive error information (Sentry-compatible)
+type ErrorEventParam struct {
+ // Breadcrumbs leading up to the error
+ Breadcrumbs param.Field[[]BreadcrumbParam] `json:"breadcrumbs"`
+ // Environment (e.g., "production", "staging", "development")
+ Environment param.Field[string] `json:"environment"`
+ // Unique event identifier (required by Sentry)
+ EventID param.Field[string] `json:"eventId"`
+ // Exception information (primary error data)
+ Exceptions param.Field[[]ExceptionInfoParam] `json:"exceptions"`
+ // Additional arbitrary metadata
+ Extra param.Field[map[string]string] `json:"extra"`
+ // Custom fingerprint for grouping
+ Fingerprint param.Field[[]string] `json:"fingerprint"`
+ // Identity ID of the user (UUID)
+ IdentityID param.Field[string] `json:"identityId"`
+ // Error severity level
+ Level param.Field[ErrorLevel] `json:"level"`
+ // Logger name
+ Logger param.Field[string] `json:"logger"`
+ // Modules/dependencies information
+ Modules param.Field[map[string]string] `json:"modules"`
+ // Platform identifier (required by Sentry)
+ Platform param.Field[string] `json:"platform"`
+ // Release version
+ Release param.Field[string] `json:"release"`
+ // Request information
+ Request param.Field[RequestInfoParam] `json:"request"`
+ // SDK information
+ SDK param.Field[map[string]string] `json:"sdk"`
+ // Server/host name
+ ServerName param.Field[string] `json:"serverName"`
+ // Tags for filtering and grouping
+ Tags param.Field[map[string]string] `json:"tags"`
+ // When the event occurred (required by Sentry)
+ Timestamp param.Field[time.Time] `json:"timestamp" format:"date-time"`
+ // Transaction name (e.g., route name, function name)
+ Transaction param.Field[string] `json:"transaction"`
+}
+
+func (r ErrorEventParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// Error severity levels (aligned with Sentry levels)
+type ErrorLevel string
+
+const (
+ ErrorLevelUnspecified ErrorLevel = "ERROR_LEVEL_UNSPECIFIED"
+ ErrorLevelDebug ErrorLevel = "ERROR_LEVEL_DEBUG"
+ ErrorLevelInfo ErrorLevel = "ERROR_LEVEL_INFO"
+ ErrorLevelWarning ErrorLevel = "ERROR_LEVEL_WARNING"
+ ErrorLevelError ErrorLevel = "ERROR_LEVEL_ERROR"
+ ErrorLevelFatal ErrorLevel = "ERROR_LEVEL_FATAL"
+)
+
+func (r ErrorLevel) IsKnown() bool {
+ switch r {
+ case ErrorLevelUnspecified, ErrorLevelDebug, ErrorLevelInfo, ErrorLevelWarning, ErrorLevelError, ErrorLevelFatal:
+ return true
+ }
+ return false
+}
+
+// Exception information (Sentry-compatible)
+type ExceptionInfoParam struct {
+ // Exception mechanism
+ Mechanism param.Field[ExceptionMechanismParam] `json:"mechanism"`
+ // Module or package where the exception type is defined
+ Module param.Field[string] `json:"module"`
+ // Stack trace frames
+ Stacktrace param.Field[[]StackFrameParam] `json:"stacktrace"`
+ // Thread ID if applicable
+ ThreadID param.Field[string] `json:"threadId"`
+ // Exception type/class name
+ Type param.Field[string] `json:"type"`
+ // Exception message/value
+ Value param.Field[string] `json:"value"`
+}
+
+func (r ExceptionInfoParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// Exception mechanism information (Sentry-compatible)
+type ExceptionMechanismParam struct {
+ // Additional mechanism-specific data
+ Data param.Field[map[string]string] `json:"data"`
+ // Human-readable description of the mechanism
+ Description param.Field[string] `json:"description"`
+ // Whether the exception was handled by user code
+ Handled param.Field[bool] `json:"handled"`
+ // Whether this is a synthetic exception (created by SDK)
+ Synthetic param.Field[bool] `json:"synthetic"`
+ // Type of mechanism (e.g., "generic", "promise", "onerror")
+ Type param.Field[string] `json:"type"`
+}
+
+func (r ExceptionMechanismParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// Request information (Sentry-compatible)
+type RequestInfoParam struct {
+ // Request body (truncated if large)
+ Data param.Field[string] `json:"data"`
+ // Request headers
+ Headers param.Field[map[string]string] `json:"headers"`
+ // HTTP method
+ Method param.Field[string] `json:"method"`
+ // Query parameters
+ QueryString param.Field[map[string]string] `json:"queryString"`
+ // Request URL
+ URL param.Field[string] `json:"url"`
+}
+
+func (r RequestInfoParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// Stack trace frame information (Sentry-compatible)
+type StackFrameParam struct {
+ // Column number in the line
+ Colno param.Field[int64] `json:"colno"`
+ ContextLine param.Field[string] `json:"contextLine"`
+ // File name or path
+ Filename param.Field[string] `json:"filename"`
+ // Function name
+ Function param.Field[string] `json:"function"`
+ // Whether this frame is in application code (vs library/framework code)
+ InApp param.Field[bool] `json:"inApp"`
+ // Line number in the file
+ Lineno param.Field[int64] `json:"lineno"`
+ // Module or package name
+ Module param.Field[string] `json:"module"`
+ PostContext param.Field[[]string] `json:"postContext"`
+ // Source code context around the error line
+ PreContext param.Field[[]string] `json:"preContext"`
+ // Additional frame-specific variables/locals
+ Vars param.Field[map[string]string] `json:"vars"`
+}
+
+func (r StackFrameParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type ErrorReportErrorsResponse = interface{}
+
+type ErrorReportErrorsParams struct {
+ // Error events to be reported (batch) - now using Sentry-compatible structure
+ Events param.Field[[]ErrorEventParam] `json:"events"`
+}
+
+func (r ErrorReportErrorsParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
diff --git a/error_test.go b/error_test.go
new file mode 100644
index 0000000..4e30258
--- /dev/null
+++ b/error_test.go
@@ -0,0 +1,114 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package gitpod_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+ "time"
+
+ "github.com/gitpod-io/gitpod-sdk-go"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/testutil"
+ "github.com/gitpod-io/gitpod-sdk-go/option"
+)
+
+func TestErrorReportErrorsWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Errors.ReportErrors(context.TODO(), gitpod.ErrorReportErrorsParams{
+ Events: gitpod.F([]gitpod.ErrorEventParam{{
+ Breadcrumbs: gitpod.F([]gitpod.BreadcrumbParam{{
+ Category: gitpod.F("category"),
+ Data: gitpod.F(map[string]string{
+ "foo": "string",
+ }),
+ Level: gitpod.F(gitpod.ErrorLevelUnspecified),
+ Message: gitpod.F("message"),
+ Timestamp: gitpod.F(time.Now()),
+ Type: gitpod.F("type"),
+ }}),
+ Environment: gitpod.F("environment"),
+ EventID: gitpod.F("210b9798eb53baa4e69d31c1071cf03d"),
+ Exceptions: gitpod.F([]gitpod.ExceptionInfoParam{{
+ Mechanism: gitpod.F(gitpod.ExceptionMechanismParam{
+ Data: gitpod.F(map[string]string{
+ "foo": "string",
+ }),
+ Description: gitpod.F("description"),
+ Handled: gitpod.F(true),
+ Synthetic: gitpod.F(true),
+ Type: gitpod.F("x"),
+ }),
+ Module: gitpod.F("module"),
+ Stacktrace: gitpod.F([]gitpod.StackFrameParam{{
+ Colno: gitpod.F(int64(0)),
+ ContextLine: gitpod.F("contextLine"),
+ Filename: gitpod.F("filename"),
+ Function: gitpod.F("function"),
+ InApp: gitpod.F(true),
+ Lineno: gitpod.F(int64(0)),
+ Module: gitpod.F("module"),
+ PostContext: gitpod.F([]string{"string"}),
+ PreContext: gitpod.F([]string{"string"}),
+ Vars: gitpod.F(map[string]string{
+ "foo": "string",
+ }),
+ }}),
+ ThreadID: gitpod.F("threadId"),
+ Type: gitpod.F("x"),
+ Value: gitpod.F("value"),
+ }}),
+ Extra: gitpod.F(map[string]string{
+ "foo": "string",
+ }),
+ Fingerprint: gitpod.F([]string{"x"}),
+ IdentityID: gitpod.F("ecc2efdd-ddfa-31a9-c6f1-b833d337aa7c"),
+ Level: gitpod.F(gitpod.ErrorLevelUnspecified),
+ Logger: gitpod.F("logger"),
+ Modules: gitpod.F(map[string]string{
+ "foo": "string",
+ }),
+ Platform: gitpod.F("x"),
+ Release: gitpod.F("release"),
+ Request: gitpod.F(gitpod.RequestInfoParam{
+ Data: gitpod.F("data"),
+ Headers: gitpod.F(map[string]string{
+ "foo": "string",
+ }),
+ Method: gitpod.F("method"),
+ QueryString: gitpod.F(map[string]string{
+ "foo": "string",
+ }),
+ URL: gitpod.F("url"),
+ }),
+ SDK: gitpod.F(map[string]string{
+ "foo": "string",
+ }),
+ ServerName: gitpod.F("serverName"),
+ Tags: gitpod.F(map[string]string{
+ "foo": "string",
+ }),
+ Timestamp: gitpod.F(time.Now()),
+ Transaction: gitpod.F("transaction"),
+ }}),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/event.go b/event.go
index 95b2464..b97d9b4 100644
--- a/event.go
+++ b/event.go
@@ -158,44 +158,6 @@ func (r ResourceOperation) IsKnown() bool {
return false
}
-type ResourceType string
-
-const (
- ResourceTypeUnspecified ResourceType = "RESOURCE_TYPE_UNSPECIFIED"
- ResourceTypeEnvironment ResourceType = "RESOURCE_TYPE_ENVIRONMENT"
- ResourceTypeRunner ResourceType = "RESOURCE_TYPE_RUNNER"
- ResourceTypeProject ResourceType = "RESOURCE_TYPE_PROJECT"
- ResourceTypeTask ResourceType = "RESOURCE_TYPE_TASK"
- ResourceTypeTaskExecution ResourceType = "RESOURCE_TYPE_TASK_EXECUTION"
- ResourceTypeService ResourceType = "RESOURCE_TYPE_SERVICE"
- ResourceTypeOrganization ResourceType = "RESOURCE_TYPE_ORGANIZATION"
- ResourceTypeUser ResourceType = "RESOURCE_TYPE_USER"
- ResourceTypeEnvironmentClass ResourceType = "RESOURCE_TYPE_ENVIRONMENT_CLASS"
- ResourceTypeRunnerScmIntegration ResourceType = "RESOURCE_TYPE_RUNNER_SCM_INTEGRATION"
- ResourceTypeHostAuthenticationToken ResourceType = "RESOURCE_TYPE_HOST_AUTHENTICATION_TOKEN"
- ResourceTypeGroup ResourceType = "RESOURCE_TYPE_GROUP"
- ResourceTypePersonalAccessToken ResourceType = "RESOURCE_TYPE_PERSONAL_ACCESS_TOKEN"
- ResourceTypeUserPreference ResourceType = "RESOURCE_TYPE_USER_PREFERENCE"
- ResourceTypeServiceAccount ResourceType = "RESOURCE_TYPE_SERVICE_ACCOUNT"
- ResourceTypeSecret ResourceType = "RESOURCE_TYPE_SECRET"
- ResourceTypeSSOConfig ResourceType = "RESOURCE_TYPE_SSO_CONFIG"
- ResourceTypeDomainVerification ResourceType = "RESOURCE_TYPE_DOMAIN_VERIFICATION"
- ResourceTypeAgentExecution ResourceType = "RESOURCE_TYPE_AGENT_EXECUTION"
- ResourceTypeRunnerLlmIntegration ResourceType = "RESOURCE_TYPE_RUNNER_LLM_INTEGRATION"
- ResourceTypeAgent ResourceType = "RESOURCE_TYPE_AGENT"
- ResourceTypeEnvironmentSession ResourceType = "RESOURCE_TYPE_ENVIRONMENT_SESSION"
- ResourceTypeUserSecret ResourceType = "RESOURCE_TYPE_USER_SECRET"
- ResourceTypeOrganizationPolicy ResourceType = "RESOURCE_TYPE_ORGANIZATION_POLICY"
-)
-
-func (r ResourceType) IsKnown() bool {
- switch r {
- case ResourceTypeUnspecified, ResourceTypeEnvironment, ResourceTypeRunner, ResourceTypeProject, ResourceTypeTask, ResourceTypeTaskExecution, ResourceTypeService, ResourceTypeOrganization, ResourceTypeUser, ResourceTypeEnvironmentClass, ResourceTypeRunnerScmIntegration, ResourceTypeHostAuthenticationToken, ResourceTypeGroup, ResourceTypePersonalAccessToken, ResourceTypeUserPreference, ResourceTypeServiceAccount, ResourceTypeSecret, ResourceTypeSSOConfig, ResourceTypeDomainVerification, ResourceTypeAgentExecution, ResourceTypeRunnerLlmIntegration, ResourceTypeAgent, ResourceTypeEnvironmentSession, ResourceTypeUserSecret, ResourceTypeOrganizationPolicy:
- return true
- }
- return false
-}
-
type EventListResponse struct {
ID string `json:"id"`
Action string `json:"action"`
@@ -291,7 +253,7 @@ type EventListResponse struct {
// to obtain a formatter capable of generating timestamps in this format.
CreatedAt time.Time `json:"createdAt" format:"date-time"`
SubjectID string `json:"subjectId"`
- SubjectType ResourceType `json:"subjectType"`
+ SubjectType shared.ResourceType `json:"subjectType"`
JSON eventListResponseJSON `json:"-"`
}
@@ -320,7 +282,7 @@ func (r eventListResponseJSON) RawJSON() string {
type EventWatchResponse struct {
Operation ResourceOperation `json:"operation"`
ResourceID string `json:"resourceId" format:"uuid"`
- ResourceType ResourceType `json:"resourceType"`
+ ResourceType shared.ResourceType `json:"resourceType"`
JSON eventWatchResponseJSON `json:"-"`
}
@@ -363,10 +325,10 @@ func (r EventListParams) URLQuery() (v url.Values) {
}
type EventListParamsFilter struct {
- ActorIDs param.Field[[]string] `json:"actorIds" format:"uuid"`
- ActorPrincipals param.Field[[]shared.Principal] `json:"actorPrincipals"`
- SubjectIDs param.Field[[]string] `json:"subjectIds" format:"uuid"`
- SubjectTypes param.Field[[]ResourceType] `json:"subjectTypes"`
+ ActorIDs param.Field[[]string] `json:"actorIds" format:"uuid"`
+ ActorPrincipals param.Field[[]shared.Principal] `json:"actorPrincipals"`
+ SubjectIDs param.Field[[]string] `json:"subjectIds" format:"uuid"`
+ SubjectTypes param.Field[[]shared.ResourceType] `json:"subjectTypes"`
}
func (r EventListParamsFilter) MarshalJSON() (data []byte, err error) {
diff --git a/event_test.go b/event_test.go
index 697fee5..06506fa 100644
--- a/event_test.go
+++ b/event_test.go
@@ -34,7 +34,7 @@ func TestEventListWithOptionalParams(t *testing.T) {
ActorIDs: gitpod.F([]string{"d2c94c27-3b76-4a42-b88c-95a85e392c68"}),
ActorPrincipals: gitpod.F([]shared.Principal{shared.PrincipalUser}),
SubjectIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
- SubjectTypes: gitpod.F([]gitpod.ResourceType{gitpod.ResourceTypeUnspecified}),
+ SubjectTypes: gitpod.F([]shared.ResourceType{shared.ResourceTypeUnspecified}),
}),
Pagination: gitpod.F(gitpod.EventListParamsPagination{
Token: gitpod.F("token"),
diff --git a/group.go b/group.go
index c328dc5..7887f61 100644
--- a/group.go
+++ b/group.go
@@ -24,7 +24,9 @@ import (
// automatically. You should not instantiate this service directly, and instead use
// the [NewGroupService] method instead.
type GroupService struct {
- Options []option.RequestOption
+ Options []option.RequestOption
+ Memberships *GroupMembershipService
+ RoleAssignments *GroupRoleAssignmentService
}
// NewGroupService generates a new service that applies the given options to each
@@ -33,6 +35,96 @@ type GroupService struct {
func NewGroupService(opts ...option.RequestOption) (r *GroupService) {
r = &GroupService{}
r.Options = opts
+ r.Memberships = NewGroupMembershipService(opts...)
+ r.RoleAssignments = NewGroupRoleAssignmentService(opts...)
+ return
+}
+
+// Creates a new group within an organization.
+//
+// Use this method to:
+//
+// - Create teams for access control
+// - Organize users by department or function
+// - Set up role-based access groups
+//
+// ### Examples
+//
+// - Create a basic group:
+//
+// Creates a group with name and description.
+//
+// ```yaml
+// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
+// name: "Backend Team"
+// description: "Backend engineering team"
+// ```
+//
+// ### Authorization
+//
+// Requires `org:admin` role on the organization.
+func (r *GroupService) New(ctx context.Context, body GroupNewParams, opts ...option.RequestOption) (res *GroupNewResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.GroupService/CreateGroup"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Gets information about a specific group.
+//
+// Use this method to:
+//
+// - Retrieve group details and metadata
+// - Check group configuration
+// - View member count
+//
+// ### Examples
+//
+// - Get group details:
+//
+// Retrieves information about a specific group.
+//
+// ```yaml
+// groupId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
+// ```
+//
+// ### Authorization
+//
+// All organization members can view group information (transparency model).
+func (r *GroupService) Get(ctx context.Context, body GroupGetParams, opts ...option.RequestOption) (res *GroupGetResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.GroupService/GetGroup"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Updates group information.
+//
+// Use this method to:
+//
+// - Rename a group
+// - Update group description
+//
+// ### Examples
+//
+// - Update group name:
+//
+// Changes the name of an existing group.
+//
+// ```yaml
+// groupId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
+// name: "Platform Team"
+// description: "Platform engineering team"
+// ```
+//
+// ### Authorization
+//
+// Requires `org:admin` permission on the organization or `group:admin` permission
+// on the specific group.
+func (r *GroupService) Update(ctx context.Context, body GroupUpdateParams, opts ...option.RequestOption) (res *GroupUpdateResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.GroupService/UpdateGroup"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
@@ -40,7 +132,7 @@ func NewGroupService(opts ...option.RequestOption) (r *GroupService) {
//
// Use this method to:
//
-// - View all groups
+// - View all groups in an organization
// - Check group memberships
// - Monitor group configurations
// - Audit group access
@@ -65,6 +157,10 @@ func NewGroupService(opts ...option.RequestOption) (r *GroupService) {
// pageSize: 50
// token: "next-page-token-from-previous-response"
// ```
+//
+// ### Authorization
+//
+// All organization members can list groups (transparency model).
func (r *GroupService) List(ctx context.Context, params GroupListParams, opts ...option.RequestOption) (res *pagination.GroupsPage[Group], err error) {
var raw *http.Response
opts = slices.Concat(r.Options, opts)
@@ -86,7 +182,7 @@ func (r *GroupService) List(ctx context.Context, params GroupListParams, opts ..
//
// Use this method to:
//
-// - View all groups
+// - View all groups in an organization
// - Check group memberships
// - Monitor group configurations
// - Audit group access
@@ -111,10 +207,43 @@ func (r *GroupService) List(ctx context.Context, params GroupListParams, opts ..
// pageSize: 50
// token: "next-page-token-from-previous-response"
// ```
+//
+// ### Authorization
+//
+// All organization members can list groups (transparency model).
func (r *GroupService) ListAutoPaging(ctx context.Context, params GroupListParams, opts ...option.RequestOption) *pagination.GroupsPageAutoPager[Group] {
return pagination.NewGroupsPageAutoPager(r.List(ctx, params, opts...))
}
+// Deletes a group and removes all its resource assignments.
+//
+// When a group is deleted, all resource assignments revert to org-level scope.
+//
+// Use this method to:
+//
+// - Remove unused groups
+// - Clean up after team reorganization
+//
+// ### Examples
+//
+// - Delete a group:
+//
+// Permanently removes a group.
+//
+// ```yaml
+// groupId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
+// ```
+//
+// ### Authorization
+//
+// Requires `org:admin` role on the organization.
+func (r *GroupService) Delete(ctx context.Context, body GroupDeleteParams, opts ...option.RequestOption) (res *GroupDeleteResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.GroupService/DeleteGroup"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
type Group struct {
ID string `json:"id" format:"uuid"`
// A Timestamp represents a point in time independent of any time zone or local
@@ -205,9 +334,12 @@ type Group struct {
// Joda Time's
// [`ISODateTimeFormat.dateTime()`]()
// to obtain a formatter capable of generating timestamps in this format.
- CreatedAt time.Time `json:"createdAt" format:"date-time"`
- Name string `json:"name"`
- OrganizationID string `json:"organizationId" format:"uuid"`
+ CreatedAt time.Time `json:"createdAt" format:"date-time"`
+ Description string `json:"description"`
+ // member_count is the total number of members in this group
+ MemberCount int64 `json:"memberCount"`
+ Name string `json:"name"`
+ OrganizationID string `json:"organizationId" format:"uuid"`
// system_managed indicates that this group is created by the system automatically
SystemManaged bool `json:"systemManaged"`
// A Timestamp represents a point in time independent of any time zone or local
@@ -306,6 +438,8 @@ type Group struct {
type groupJSON struct {
ID apijson.Field
CreatedAt apijson.Field
+ Description apijson.Field
+ MemberCount apijson.Field
Name apijson.Field
OrganizationID apijson.Field
SystemManaged apijson.Field
@@ -322,6 +456,99 @@ func (r groupJSON) RawJSON() string {
return r.raw
}
+type GroupNewResponse struct {
+ Group Group `json:"group"`
+ JSON groupNewResponseJSON `json:"-"`
+}
+
+// groupNewResponseJSON contains the JSON metadata for the struct
+// [GroupNewResponse]
+type groupNewResponseJSON struct {
+ Group apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *GroupNewResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r groupNewResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+type GroupGetResponse struct {
+ Group Group `json:"group"`
+ JSON groupGetResponseJSON `json:"-"`
+}
+
+// groupGetResponseJSON contains the JSON metadata for the struct
+// [GroupGetResponse]
+type groupGetResponseJSON struct {
+ Group apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *GroupGetResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r groupGetResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+type GroupUpdateResponse struct {
+ Group Group `json:"group"`
+ JSON groupUpdateResponseJSON `json:"-"`
+}
+
+// groupUpdateResponseJSON contains the JSON metadata for the struct
+// [GroupUpdateResponse]
+type groupUpdateResponseJSON struct {
+ Group apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *GroupUpdateResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r groupUpdateResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+type GroupDeleteResponse = interface{}
+
+type GroupNewParams struct {
+ Description param.Field[string] `json:"description"`
+ Name param.Field[string] `json:"name"`
+ OrganizationID param.Field[string] `json:"organizationId" format:"uuid"`
+}
+
+func (r GroupNewParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type GroupGetParams struct {
+ GroupID param.Field[string] `json:"groupId" format:"uuid"`
+}
+
+func (r GroupGetParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type GroupUpdateParams struct {
+ Description param.Field[string] `json:"description"`
+ GroupID param.Field[string] `json:"groupId" format:"uuid"`
+ Name param.Field[string] `json:"name"`
+}
+
+func (r GroupUpdateParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
type GroupListParams struct {
Token param.Field[string] `query:"token"`
PageSize param.Field[int64] `query:"pageSize"`
@@ -354,3 +581,11 @@ type GroupListParamsPagination struct {
func (r GroupListParamsPagination) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
+
+type GroupDeleteParams struct {
+ GroupID param.Field[string] `json:"groupId" format:"uuid"`
+}
+
+func (r GroupDeleteParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
diff --git a/group_test.go b/group_test.go
index fcc578f..1cff051 100644
--- a/group_test.go
+++ b/group_test.go
@@ -13,6 +13,85 @@ import (
"github.com/gitpod-io/gitpod-sdk-go/option"
)
+func TestGroupNewWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Groups.New(context.TODO(), gitpod.GroupNewParams{
+ Description: gitpod.F("Backend engineering team"),
+ Name: gitpod.F("Backend Team"),
+ OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestGroupGetWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Groups.Get(context.TODO(), gitpod.GroupGetParams{
+ GroupID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestGroupUpdateWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Groups.Update(context.TODO(), gitpod.GroupUpdateParams{
+ Description: gitpod.F("Platform engineering team"),
+ GroupID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
+ Name: gitpod.F("Platform Team"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
func TestGroupListWithOptionalParams(t *testing.T) {
t.Skip("Prism tests are disabled")
baseURL := "http://localhost:4010"
@@ -42,3 +121,28 @@ func TestGroupListWithOptionalParams(t *testing.T) {
t.Fatalf("err should be nil: %s", err.Error())
}
}
+
+func TestGroupDeleteWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Groups.Delete(context.TODO(), gitpod.GroupDeleteParams{
+ GroupID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/groupmembership.go b/groupmembership.go
new file mode 100644
index 0000000..fc9d2c6
--- /dev/null
+++ b/groupmembership.go
@@ -0,0 +1,273 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package gitpod
+
+import (
+ "context"
+ "net/http"
+ "net/url"
+ "slices"
+
+ "github.com/gitpod-io/gitpod-sdk-go/internal/apijson"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/apiquery"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/param"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/requestconfig"
+ "github.com/gitpod-io/gitpod-sdk-go/option"
+ "github.com/gitpod-io/gitpod-sdk-go/packages/pagination"
+ "github.com/gitpod-io/gitpod-sdk-go/shared"
+)
+
+// GroupMembershipService contains methods and other services that help with
+// interacting with the gitpod API.
+//
+// Note, unlike clients, this service does not read variables from the environment
+// automatically. You should not instantiate this service directly, and instead use
+// the [NewGroupMembershipService] method instead.
+type GroupMembershipService struct {
+ Options []option.RequestOption
+}
+
+// NewGroupMembershipService generates a new service that applies the given options
+// to each request. These options are applied after the parent client's options (if
+// there is one), and before any request-specific options.
+func NewGroupMembershipService(opts ...option.RequestOption) (r *GroupMembershipService) {
+ r = &GroupMembershipService{}
+ r.Options = opts
+ return
+}
+
+// Creates a membership for a user in a group.
+//
+// Use this method to:
+//
+// - Add users to groups
+// - Grant group-based permissions to users
+//
+// ### Examples
+//
+// - Add a user to a group:
+//
+// Creates a membership for a user in a group.
+//
+// ```yaml
+// groupId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
+// subject:
+// id: "f53d2330-3795-4c5d-a1f3-453121af9c60"
+// principal: PRINCIPAL_USER
+// ```
+//
+// ### Authorization
+//
+// Requires `org:admin` permission on the organization or `group:admin` permission
+// on the specific group.
+func (r *GroupMembershipService) New(ctx context.Context, body GroupMembershipNewParams, opts ...option.RequestOption) (res *GroupMembershipNewResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.GroupService/CreateMembership"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Lists all memberships of a group.
+//
+// Use this method to:
+//
+// - View all members of a group
+// - Audit group membership
+//
+// ### Examples
+//
+// - List group members:
+//
+// Shows all members of a specific group.
+//
+// ```yaml
+// groupId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
+// pagination:
+// pageSize: 20
+// ```
+//
+// ### Authorization
+//
+// All organization members can view group membership (transparency model).
+func (r *GroupMembershipService) List(ctx context.Context, params GroupMembershipListParams, opts ...option.RequestOption) (res *pagination.MembersPage[GroupMembership], err error) {
+ var raw *http.Response
+ opts = slices.Concat(r.Options, opts)
+ opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
+ path := "gitpod.v1.GroupService/ListMemberships"
+ cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...)
+ if err != nil {
+ return nil, err
+ }
+ err = cfg.Execute()
+ if err != nil {
+ return nil, err
+ }
+ res.SetPageConfig(cfg, raw)
+ return res, nil
+}
+
+// Lists all memberships of a group.
+//
+// Use this method to:
+//
+// - View all members of a group
+// - Audit group membership
+//
+// ### Examples
+//
+// - List group members:
+//
+// Shows all members of a specific group.
+//
+// ```yaml
+// groupId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
+// pagination:
+// pageSize: 20
+// ```
+//
+// ### Authorization
+//
+// All organization members can view group membership (transparency model).
+func (r *GroupMembershipService) ListAutoPaging(ctx context.Context, params GroupMembershipListParams, opts ...option.RequestOption) *pagination.MembersPageAutoPager[GroupMembership] {
+ return pagination.NewMembersPageAutoPager(r.List(ctx, params, opts...))
+}
+
+// Deletes a membership for a user in a group.
+//
+// Use this method to:
+//
+// - Remove users from groups
+// - Revoke group-based permissions
+//
+// ### Examples
+//
+// - Remove a user from a group:
+//
+// Deletes a membership by its ID.
+//
+// ```yaml
+// membershipId: "a1b2c3d4-5678-90ab-cdef-1234567890ab"
+// ```
+//
+// ### Authorization
+//
+// Requires `org:admin` permission on the organization or `group:admin` permission
+// on the specific group.
+func (r *GroupMembershipService) Delete(ctx context.Context, body GroupMembershipDeleteParams, opts ...option.RequestOption) (res *GroupMembershipDeleteResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.GroupService/DeleteMembership"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// GroupMembership represents a subject's membership in a group
+type GroupMembership struct {
+ // Unique identifier for the group membership
+ ID string `json:"id" format:"uuid"`
+ // Subject's avatar URL
+ AvatarURL string `json:"avatarUrl"`
+ // Group identifier
+ GroupID string `json:"groupId" format:"uuid"`
+ // Subject's display name
+ Name string `json:"name"`
+ // Subject (user, runner, environment, service account, etc.)
+ Subject shared.Subject `json:"subject"`
+ JSON groupMembershipJSON `json:"-"`
+}
+
+// groupMembershipJSON contains the JSON metadata for the struct [GroupMembership]
+type groupMembershipJSON struct {
+ ID apijson.Field
+ AvatarURL apijson.Field
+ GroupID apijson.Field
+ Name apijson.Field
+ Subject apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *GroupMembership) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r groupMembershipJSON) RawJSON() string {
+ return r.raw
+}
+
+type GroupMembershipNewResponse struct {
+ // GroupMembership represents a subject's membership in a group
+ Member GroupMembership `json:"member"`
+ JSON groupMembershipNewResponseJSON `json:"-"`
+}
+
+// groupMembershipNewResponseJSON contains the JSON metadata for the struct
+// [GroupMembershipNewResponse]
+type groupMembershipNewResponseJSON struct {
+ Member apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *GroupMembershipNewResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r groupMembershipNewResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+type GroupMembershipDeleteResponse = interface{}
+
+type GroupMembershipNewParams struct {
+ GroupID param.Field[string] `json:"groupId" format:"uuid"`
+ // Subject to add to the group
+ Subject param.Field[shared.SubjectParam] `json:"subject"`
+}
+
+func (r GroupMembershipNewParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type GroupMembershipListParams struct {
+ Token param.Field[string] `query:"token"`
+ PageSize param.Field[int64] `query:"pageSize"`
+ GroupID param.Field[string] `json:"groupId" format:"uuid"`
+ // pagination contains the pagination options for listing memberships
+ Pagination param.Field[GroupMembershipListParamsPagination] `json:"pagination"`
+}
+
+func (r GroupMembershipListParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// URLQuery serializes [GroupMembershipListParams]'s query parameters as
+// `url.Values`.
+func (r GroupMembershipListParams) URLQuery() (v url.Values) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatComma,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
+
+// pagination contains the pagination options for listing memberships
+type GroupMembershipListParamsPagination struct {
+ // Token for the next set of results that was returned as next_token of a
+ // PaginationResponse
+ Token param.Field[string] `json:"token"`
+ // Page size is the maximum number of results to retrieve per page. Defaults to 25.
+ // Maximum 100.
+ PageSize param.Field[int64] `json:"pageSize"`
+}
+
+func (r GroupMembershipListParamsPagination) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type GroupMembershipDeleteParams struct {
+ // The membership to delete
+ MembershipID param.Field[string] `json:"membershipId" format:"uuid"`
+}
+
+func (r GroupMembershipDeleteParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
diff --git a/groupmembership_test.go b/groupmembership_test.go
new file mode 100644
index 0000000..6206821
--- /dev/null
+++ b/groupmembership_test.go
@@ -0,0 +1,100 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package gitpod_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+
+ "github.com/gitpod-io/gitpod-sdk-go"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/testutil"
+ "github.com/gitpod-io/gitpod-sdk-go/option"
+ "github.com/gitpod-io/gitpod-sdk-go/shared"
+)
+
+func TestGroupMembershipNewWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Groups.Memberships.New(context.TODO(), gitpod.GroupMembershipNewParams{
+ GroupID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
+ Subject: gitpod.F(shared.SubjectParam{
+ ID: gitpod.F("f53d2330-3795-4c5d-a1f3-453121af9c60"),
+ Principal: gitpod.F(shared.PrincipalUser),
+ }),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestGroupMembershipListWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Groups.Memberships.List(context.TODO(), gitpod.GroupMembershipListParams{
+ Token: gitpod.F("token"),
+ PageSize: gitpod.F(int64(0)),
+ GroupID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
+ Pagination: gitpod.F(gitpod.GroupMembershipListParamsPagination{
+ Token: gitpod.F("token"),
+ PageSize: gitpod.F(int64(20)),
+ }),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestGroupMembershipDeleteWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Groups.Memberships.Delete(context.TODO(), gitpod.GroupMembershipDeleteParams{
+ MembershipID: gitpod.F("a1b2c3d4-5678-90ab-cdef-1234567890ab"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/grouproleassignment.go b/grouproleassignment.go
new file mode 100644
index 0000000..8e0ed14
--- /dev/null
+++ b/grouproleassignment.go
@@ -0,0 +1,399 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package gitpod
+
+import (
+ "context"
+ "net/http"
+ "net/url"
+ "slices"
+
+ "github.com/gitpod-io/gitpod-sdk-go/internal/apijson"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/apiquery"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/param"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/requestconfig"
+ "github.com/gitpod-io/gitpod-sdk-go/option"
+ "github.com/gitpod-io/gitpod-sdk-go/packages/pagination"
+ "github.com/gitpod-io/gitpod-sdk-go/shared"
+)
+
+// GroupRoleAssignmentService contains methods and other services that help with
+// interacting with the gitpod API.
+//
+// Note, unlike clients, this service does not read variables from the environment
+// automatically. You should not instantiate this service directly, and instead use
+// the [NewGroupRoleAssignmentService] method instead.
+type GroupRoleAssignmentService struct {
+ Options []option.RequestOption
+}
+
+// NewGroupRoleAssignmentService generates a new service that applies the given
+// options to each request. These options are applied after the parent client's
+// options (if there is one), and before any request-specific options.
+func NewGroupRoleAssignmentService(opts ...option.RequestOption) (r *GroupRoleAssignmentService) {
+ r = &GroupRoleAssignmentService{}
+ r.Options = opts
+ return
+}
+
+// Creates a role assignment for a group on a resource.
+//
+// Use this method to:
+//
+// - Assign specific roles to groups on runners, projects, or environments
+// - Grant group-based access to resources
+//
+// ### Examples
+//
+// - Assign admin role on a runner:
+//
+// Grants the group admin access to a runner.
+//
+// ```yaml
+// groupId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
+// resourceType: RESOURCE_TYPE_RUNNER
+// resourceId: "f53d2330-3795-4c5d-a1f3-453121af9c60"
+// resourceRole: RESOURCE_ROLE_RUNNER_ADMIN
+// ```
+//
+// - Assign user role on a project:
+//
+// Grants the group user access to a project.
+//
+// ```yaml
+// groupId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
+// resourceType: RESOURCE_TYPE_PROJECT
+// resourceId: "a1b2c3d4-5678-90ab-cdef-1234567890ab"
+// resourceRole: RESOURCE_ROLE_PROJECT_USER
+// ```
+//
+// ### Authorization
+//
+// Requires admin role on the specific resource.
+func (r *GroupRoleAssignmentService) New(ctx context.Context, body GroupRoleAssignmentNewParams, opts ...option.RequestOption) (res *GroupRoleAssignmentNewResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.GroupService/CreateRoleAssignment"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Lists role assignments for a group or resource.
+//
+// Use this method to:
+//
+// - View all role assignments for a group
+// - Audit resource access
+// - Check which groups have access to resources
+//
+// ### Examples
+//
+// - List role assignments for a group:
+//
+// Shows all role assignments for a specific group.
+//
+// ```yaml
+// filter:
+// groupId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
+// pagination:
+// pageSize: 20
+// ```
+//
+// - List role assignments by resource type:
+//
+// Shows all role assignments for runners.
+//
+// ```yaml
+// filter:
+// resourceTypes:
+// - RESOURCE_TYPE_RUNNER
+// pagination:
+// pageSize: 20
+// ```
+//
+// ### Authorization
+//
+// All organization members can view role assignments (transparency model).
+func (r *GroupRoleAssignmentService) List(ctx context.Context, params GroupRoleAssignmentListParams, opts ...option.RequestOption) (res *pagination.AssignmentsPage[RoleAssignment], err error) {
+ var raw *http.Response
+ opts = slices.Concat(r.Options, opts)
+ opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
+ path := "gitpod.v1.GroupService/ListRoleAssignments"
+ cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...)
+ if err != nil {
+ return nil, err
+ }
+ err = cfg.Execute()
+ if err != nil {
+ return nil, err
+ }
+ res.SetPageConfig(cfg, raw)
+ return res, nil
+}
+
+// Lists role assignments for a group or resource.
+//
+// Use this method to:
+//
+// - View all role assignments for a group
+// - Audit resource access
+// - Check which groups have access to resources
+//
+// ### Examples
+//
+// - List role assignments for a group:
+//
+// Shows all role assignments for a specific group.
+//
+// ```yaml
+// filter:
+// groupId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
+// pagination:
+// pageSize: 20
+// ```
+//
+// - List role assignments by resource type:
+//
+// Shows all role assignments for runners.
+//
+// ```yaml
+// filter:
+// resourceTypes:
+// - RESOURCE_TYPE_RUNNER
+// pagination:
+// pageSize: 20
+// ```
+//
+// ### Authorization
+//
+// All organization members can view role assignments (transparency model).
+func (r *GroupRoleAssignmentService) ListAutoPaging(ctx context.Context, params GroupRoleAssignmentListParams, opts ...option.RequestOption) *pagination.AssignmentsPageAutoPager[RoleAssignment] {
+ return pagination.NewAssignmentsPageAutoPager(r.List(ctx, params, opts...))
+}
+
+// Deletes a role assignment.
+//
+// Use this method to:
+//
+// - Remove group access to resources
+// - Revoke role-based permissions
+//
+// ### Examples
+//
+// - Delete a role assignment:
+//
+// Removes a role assignment by its ID.
+//
+// ```yaml
+// assignmentId: "a1b2c3d4-5678-90ab-cdef-1234567890ab"
+// ```
+//
+// ### Authorization
+//
+// Requires admin role on the specific resource.
+func (r *GroupRoleAssignmentService) Delete(ctx context.Context, body GroupRoleAssignmentDeleteParams, opts ...option.RequestOption) (res *GroupRoleAssignmentDeleteResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.GroupService/DeleteRoleAssignment"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// ResourceRole represents roles that can be assigned to groups on resources These
+// map directly to the roles defined in backend/db/rule/rbac/role/role.go
+type ResourceRole string
+
+const (
+ ResourceRoleUnspecified ResourceRole = "RESOURCE_ROLE_UNSPECIFIED"
+ ResourceRoleOrgAdmin ResourceRole = "RESOURCE_ROLE_ORG_ADMIN"
+ ResourceRoleOrgMember ResourceRole = "RESOURCE_ROLE_ORG_MEMBER"
+ ResourceRoleGroupAdmin ResourceRole = "RESOURCE_ROLE_GROUP_ADMIN"
+ ResourceRoleGroupViewer ResourceRole = "RESOURCE_ROLE_GROUP_VIEWER"
+ ResourceRoleUserIdentity ResourceRole = "RESOURCE_ROLE_USER_IDENTITY"
+ ResourceRoleUserViewer ResourceRole = "RESOURCE_ROLE_USER_VIEWER"
+ ResourceRoleUserAdmin ResourceRole = "RESOURCE_ROLE_USER_ADMIN"
+ ResourceRoleEnvironmentIdentity ResourceRole = "RESOURCE_ROLE_ENVIRONMENT_IDENTITY"
+ ResourceRoleEnvironmentAdmin ResourceRole = "RESOURCE_ROLE_ENVIRONMENT_ADMIN"
+ ResourceRoleEnvironmentUser ResourceRole = "RESOURCE_ROLE_ENVIRONMENT_USER"
+ ResourceRoleEnvironmentViewer ResourceRole = "RESOURCE_ROLE_ENVIRONMENT_VIEWER"
+ ResourceRoleEnvironmentRunner ResourceRole = "RESOURCE_ROLE_ENVIRONMENT_RUNNER"
+ ResourceRoleRunnerIdentity ResourceRole = "RESOURCE_ROLE_RUNNER_IDENTITY"
+ ResourceRoleRunnerAdmin ResourceRole = "RESOURCE_ROLE_RUNNER_ADMIN"
+ ResourceRoleRunnerLocalAdmin ResourceRole = "RESOURCE_ROLE_RUNNER_LOCAL_ADMIN"
+ ResourceRoleRunnerManagedAdmin ResourceRole = "RESOURCE_ROLE_RUNNER_MANAGED_ADMIN"
+ ResourceRoleRunnerUser ResourceRole = "RESOURCE_ROLE_RUNNER_USER"
+ ResourceRoleRunnerConfigurationReader ResourceRole = "RESOURCE_ROLE_RUNNER_CONFIGURATION_READER"
+ ResourceRoleHostAuthenticationTokenAdmin ResourceRole = "RESOURCE_ROLE_HOST_AUTHENTICATION_TOKEN_ADMIN"
+ ResourceRoleHostAuthenticationTokenUpdater ResourceRole = "RESOURCE_ROLE_HOST_AUTHENTICATION_TOKEN_UPDATER"
+ ResourceRoleProjectAdmin ResourceRole = "RESOURCE_ROLE_PROJECT_ADMIN"
+ ResourceRoleProjectUser ResourceRole = "RESOURCE_ROLE_PROJECT_USER"
+ ResourceRoleProjectEditor ResourceRole = "RESOURCE_ROLE_PROJECT_EDITOR"
+ ResourceRoleEnvironmentServiceAdmin ResourceRole = "RESOURCE_ROLE_ENVIRONMENT_SERVICE_ADMIN"
+ ResourceRoleEnvironmentServiceViewer ResourceRole = "RESOURCE_ROLE_ENVIRONMENT_SERVICE_VIEWER"
+ ResourceRoleEnvironmentServiceUser ResourceRole = "RESOURCE_ROLE_ENVIRONMENT_SERVICE_USER"
+ ResourceRoleEnvironmentServiceEnv ResourceRole = "RESOURCE_ROLE_ENVIRONMENT_SERVICE_ENV"
+ ResourceRoleEnvironmentTaskAdmin ResourceRole = "RESOURCE_ROLE_ENVIRONMENT_TASK_ADMIN"
+ ResourceRoleEnvironmentTaskViewer ResourceRole = "RESOURCE_ROLE_ENVIRONMENT_TASK_VIEWER"
+ ResourceRoleEnvironmentTaskUser ResourceRole = "RESOURCE_ROLE_ENVIRONMENT_TASK_USER"
+ ResourceRoleEnvironmentTaskEnv ResourceRole = "RESOURCE_ROLE_ENVIRONMENT_TASK_ENV"
+ ResourceRoleServiceAccountIdentity ResourceRole = "RESOURCE_ROLE_SERVICE_ACCOUNT_IDENTITY"
+ ResourceRoleServiceAccountAdmin ResourceRole = "RESOURCE_ROLE_SERVICE_ACCOUNT_ADMIN"
+ ResourceRoleAgentExecutionIdentity ResourceRole = "RESOURCE_ROLE_AGENT_EXECUTION_IDENTITY"
+ ResourceRoleAgentExecutionUser ResourceRole = "RESOURCE_ROLE_AGENT_EXECUTION_USER"
+ ResourceRoleAgentExecutionAdmin ResourceRole = "RESOURCE_ROLE_AGENT_EXECUTION_ADMIN"
+ ResourceRoleAgentExecutionRunner ResourceRole = "RESOURCE_ROLE_AGENT_EXECUTION_RUNNER"
+ ResourceRoleAgentExecutionOutputsReporter ResourceRole = "RESOURCE_ROLE_AGENT_EXECUTION_OUTPUTS_REPORTER"
+ ResourceRoleAgentAdmin ResourceRole = "RESOURCE_ROLE_AGENT_ADMIN"
+ ResourceRoleAgentViewer ResourceRole = "RESOURCE_ROLE_AGENT_VIEWER"
+ ResourceRoleAgentExecutor ResourceRole = "RESOURCE_ROLE_AGENT_EXECUTOR"
+ ResourceRoleWorkflowAdmin ResourceRole = "RESOURCE_ROLE_WORKFLOW_ADMIN"
+ ResourceRoleWorkflowUser ResourceRole = "RESOURCE_ROLE_WORKFLOW_USER"
+ ResourceRoleWorkflowViewer ResourceRole = "RESOURCE_ROLE_WORKFLOW_VIEWER"
+ ResourceRoleWorkflowExecutor ResourceRole = "RESOURCE_ROLE_WORKFLOW_EXECUTOR"
+ ResourceRoleSnapshotAdmin ResourceRole = "RESOURCE_ROLE_SNAPSHOT_ADMIN"
+ ResourceRoleSnapshotRunner ResourceRole = "RESOURCE_ROLE_SNAPSHOT_RUNNER"
+)
+
+func (r ResourceRole) IsKnown() bool {
+ switch r {
+ case ResourceRoleUnspecified, ResourceRoleOrgAdmin, ResourceRoleOrgMember, ResourceRoleGroupAdmin, ResourceRoleGroupViewer, ResourceRoleUserIdentity, ResourceRoleUserViewer, ResourceRoleUserAdmin, ResourceRoleEnvironmentIdentity, ResourceRoleEnvironmentAdmin, ResourceRoleEnvironmentUser, ResourceRoleEnvironmentViewer, ResourceRoleEnvironmentRunner, ResourceRoleRunnerIdentity, ResourceRoleRunnerAdmin, ResourceRoleRunnerLocalAdmin, ResourceRoleRunnerManagedAdmin, ResourceRoleRunnerUser, ResourceRoleRunnerConfigurationReader, ResourceRoleHostAuthenticationTokenAdmin, ResourceRoleHostAuthenticationTokenUpdater, ResourceRoleProjectAdmin, ResourceRoleProjectUser, ResourceRoleProjectEditor, ResourceRoleEnvironmentServiceAdmin, ResourceRoleEnvironmentServiceViewer, ResourceRoleEnvironmentServiceUser, ResourceRoleEnvironmentServiceEnv, ResourceRoleEnvironmentTaskAdmin, ResourceRoleEnvironmentTaskViewer, ResourceRoleEnvironmentTaskUser, ResourceRoleEnvironmentTaskEnv, ResourceRoleServiceAccountIdentity, ResourceRoleServiceAccountAdmin, ResourceRoleAgentExecutionIdentity, ResourceRoleAgentExecutionUser, ResourceRoleAgentExecutionAdmin, ResourceRoleAgentExecutionRunner, ResourceRoleAgentExecutionOutputsReporter, ResourceRoleAgentAdmin, ResourceRoleAgentViewer, ResourceRoleAgentExecutor, ResourceRoleWorkflowAdmin, ResourceRoleWorkflowUser, ResourceRoleWorkflowViewer, ResourceRoleWorkflowExecutor, ResourceRoleSnapshotAdmin, ResourceRoleSnapshotRunner:
+ return true
+ }
+ return false
+}
+
+// RoleAssignment represents a role assigned to a group on a specific resource
+type RoleAssignment struct {
+ // Unique identifier for the role assignment
+ ID string `json:"id" format:"uuid"`
+ // Group identifier
+ GroupID string `json:"groupId" format:"uuid"`
+ // Organization identifier
+ OrganizationID string `json:"organizationId" format:"uuid"`
+ // Resource identifier
+ ResourceID string `json:"resourceId" format:"uuid"`
+ // Role assigned to the group on this resource
+ ResourceRole ResourceRole `json:"resourceRole"`
+ // Type of resource (runner, project, environment, etc.)
+ ResourceType shared.ResourceType `json:"resourceType"`
+ JSON roleAssignmentJSON `json:"-"`
+}
+
+// roleAssignmentJSON contains the JSON metadata for the struct [RoleAssignment]
+type roleAssignmentJSON struct {
+ ID apijson.Field
+ GroupID apijson.Field
+ OrganizationID apijson.Field
+ ResourceID apijson.Field
+ ResourceRole apijson.Field
+ ResourceType apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *RoleAssignment) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r roleAssignmentJSON) RawJSON() string {
+ return r.raw
+}
+
+type GroupRoleAssignmentNewResponse struct {
+ // RoleAssignment represents a role assigned to a group on a specific resource
+ Assignment RoleAssignment `json:"assignment"`
+ JSON groupRoleAssignmentNewResponseJSON `json:"-"`
+}
+
+// groupRoleAssignmentNewResponseJSON contains the JSON metadata for the struct
+// [GroupRoleAssignmentNewResponse]
+type groupRoleAssignmentNewResponseJSON struct {
+ Assignment apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *GroupRoleAssignmentNewResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r groupRoleAssignmentNewResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+type GroupRoleAssignmentDeleteResponse = interface{}
+
+type GroupRoleAssignmentNewParams struct {
+ GroupID param.Field[string] `json:"groupId" format:"uuid"`
+ ResourceID param.Field[string] `json:"resourceId" format:"uuid"`
+ // ResourceRole represents roles that can be assigned to groups on resources These
+ // map directly to the roles defined in backend/db/rule/rbac/role/role.go
+ ResourceRole param.Field[ResourceRole] `json:"resourceRole"`
+ ResourceType param.Field[shared.ResourceType] `json:"resourceType"`
+}
+
+func (r GroupRoleAssignmentNewParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type GroupRoleAssignmentListParams struct {
+ Token param.Field[string] `query:"token"`
+ PageSize param.Field[int64] `query:"pageSize"`
+ // Filter parameters
+ Filter param.Field[GroupRoleAssignmentListParamsFilter] `json:"filter"`
+ // Pagination parameters
+ Pagination param.Field[GroupRoleAssignmentListParamsPagination] `json:"pagination"`
+}
+
+func (r GroupRoleAssignmentListParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// URLQuery serializes [GroupRoleAssignmentListParams]'s query parameters as
+// `url.Values`.
+func (r GroupRoleAssignmentListParams) URLQuery() (v url.Values) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatComma,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
+
+// Filter parameters
+type GroupRoleAssignmentListParamsFilter struct {
+ // group_id filters the response to only role assignments for this specific group
+ // Empty string is allowed and means no filtering by group
+ GroupID param.Field[string] `json:"groupId"`
+ // resource_roles filters the response to only role assignments with these specific
+ // roles
+ ResourceRoles param.Field[[]ResourceRole] `json:"resourceRoles"`
+ // resource_types filters the response to only role assignments for these resource
+ // types
+ ResourceTypes param.Field[[]shared.ResourceType] `json:"resourceTypes"`
+ // user_id filters the response to only role assignments for groups that this user
+ // is a member of Empty string is allowed and means no filtering by user
+ UserID param.Field[string] `json:"userId"`
+}
+
+func (r GroupRoleAssignmentListParamsFilter) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// Pagination parameters
+type GroupRoleAssignmentListParamsPagination struct {
+ // Token for the next set of results that was returned as next_token of a
+ // PaginationResponse
+ Token param.Field[string] `json:"token"`
+ // Page size is the maximum number of results to retrieve per page. Defaults to 25.
+ // Maximum 100.
+ PageSize param.Field[int64] `json:"pageSize"`
+}
+
+func (r GroupRoleAssignmentListParamsPagination) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type GroupRoleAssignmentDeleteParams struct {
+ AssignmentID param.Field[string] `json:"assignmentId" format:"uuid"`
+}
+
+func (r GroupRoleAssignmentDeleteParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
diff --git a/grouproleassignment_test.go b/grouproleassignment_test.go
new file mode 100644
index 0000000..2678290
--- /dev/null
+++ b/grouproleassignment_test.go
@@ -0,0 +1,104 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package gitpod_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+
+ "github.com/gitpod-io/gitpod-sdk-go"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/testutil"
+ "github.com/gitpod-io/gitpod-sdk-go/option"
+ "github.com/gitpod-io/gitpod-sdk-go/shared"
+)
+
+func TestGroupRoleAssignmentNewWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Groups.RoleAssignments.New(context.TODO(), gitpod.GroupRoleAssignmentNewParams{
+ GroupID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
+ ResourceID: gitpod.F("f53d2330-3795-4c5d-a1f3-453121af9c60"),
+ ResourceRole: gitpod.F(gitpod.ResourceRoleRunnerAdmin),
+ ResourceType: gitpod.F(shared.ResourceTypeRunner),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestGroupRoleAssignmentListWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Groups.RoleAssignments.List(context.TODO(), gitpod.GroupRoleAssignmentListParams{
+ Token: gitpod.F("token"),
+ PageSize: gitpod.F(int64(0)),
+ Filter: gitpod.F(gitpod.GroupRoleAssignmentListParamsFilter{
+ GroupID: gitpod.F("groupId"),
+ ResourceRoles: gitpod.F([]gitpod.ResourceRole{gitpod.ResourceRoleUnspecified}),
+ ResourceTypes: gitpod.F([]shared.ResourceType{shared.ResourceTypeRunner}),
+ UserID: gitpod.F("userId"),
+ }),
+ Pagination: gitpod.F(gitpod.GroupRoleAssignmentListParamsPagination{
+ Token: gitpod.F("token"),
+ PageSize: gitpod.F(int64(20)),
+ }),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestGroupRoleAssignmentDeleteWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Groups.RoleAssignments.Delete(context.TODO(), gitpod.GroupRoleAssignmentDeleteParams{
+ AssignmentID: gitpod.F("a1b2c3d4-5678-90ab-cdef-1234567890ab"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/organization.go b/organization.go
index b6309c0..8839dda 100644
--- a/organization.go
+++ b/organization.go
@@ -26,6 +26,7 @@ import (
// the [NewOrganizationService] method instead.
type OrganizationService struct {
Options []option.RequestOption
+ CustomDomains *OrganizationCustomDomainService
DomainVerifications *OrganizationDomainVerificationService
Invites *OrganizationInviteService
Policies *OrganizationPolicyService
@@ -38,6 +39,7 @@ type OrganizationService struct {
func NewOrganizationService(opts ...option.RequestOption) (r *OrganizationService) {
r = &OrganizationService{}
r.Options = opts
+ r.CustomDomains = NewOrganizationCustomDomainService(opts...)
r.DomainVerifications = NewOrganizationDomainVerificationService(opts...)
r.Invites = NewOrganizationInviteService(opts...)
r.Policies = NewOrganizationPolicyService(opts...)
@@ -470,7 +472,7 @@ type Organization struct {
// to obtain a formatter capable of generating timestamps in this format.
CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
Name string `json:"name,required"`
- // The tier of the organization - free or enterprise
+ // The tier of the organization - free, enterprise or core
Tier OrganizationTier `json:"tier,required"`
// A Timestamp represents a point in time independent of any time zone or local
// calendar, encoded as a count of seconds and fractions of seconds at nanosecond
@@ -715,11 +717,13 @@ const (
OrganizationTierUnspecified OrganizationTier = "ORGANIZATION_TIER_UNSPECIFIED"
OrganizationTierFree OrganizationTier = "ORGANIZATION_TIER_FREE"
OrganizationTierEnterprise OrganizationTier = "ORGANIZATION_TIER_ENTERPRISE"
+ OrganizationTierCore OrganizationTier = "ORGANIZATION_TIER_CORE"
+ OrganizationTierFreeOna OrganizationTier = "ORGANIZATION_TIER_FREE_ONA"
)
func (r OrganizationTier) IsKnown() bool {
switch r {
- case OrganizationTierUnspecified, OrganizationTierFree, OrganizationTierEnterprise:
+ case OrganizationTierUnspecified, OrganizationTierFree, OrganizationTierEnterprise, OrganizationTierCore, OrganizationTierFreeOna:
return true
}
return false
@@ -890,9 +894,10 @@ func (r OrganizationLeaveParams) MarshalJSON() (data []byte, err error) {
type OrganizationListMembersParams struct {
// organization_id is the ID of the organization to list members for
- OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"`
- Token param.Field[string] `query:"token"`
- PageSize param.Field[int64] `query:"pageSize"`
+ OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"`
+ Token param.Field[string] `query:"token"`
+ PageSize param.Field[int64] `query:"pageSize"`
+ Filter param.Field[OrganizationListMembersParamsFilter] `json:"filter"`
// pagination contains the pagination options for listing members
Pagination param.Field[OrganizationListMembersParamsPagination] `json:"pagination"`
}
@@ -910,6 +915,15 @@ func (r OrganizationListMembersParams) URLQuery() (v url.Values) {
})
}
+type OrganizationListMembersParamsFilter struct {
+ // search performs case-insensitive search across member name and email
+ Search param.Field[string] `json:"search"`
+}
+
+func (r OrganizationListMembersParamsFilter) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
// pagination contains the pagination options for listing members
type OrganizationListMembersParamsPagination struct {
// Token for the next set of results that was returned as next_token of a
diff --git a/organization_test.go b/organization_test.go
index 04d9ba8..bbeee22 100644
--- a/organization_test.go
+++ b/organization_test.go
@@ -188,6 +188,9 @@ func TestOrganizationListMembersWithOptionalParams(t *testing.T) {
OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
Token: gitpod.F("token"),
PageSize: gitpod.F(int64(0)),
+ Filter: gitpod.F(gitpod.OrganizationListMembersParamsFilter{
+ Search: gitpod.F("search"),
+ }),
Pagination: gitpod.F(gitpod.OrganizationListMembersParamsPagination{
Token: gitpod.F("token"),
PageSize: gitpod.F(int64(20)),
diff --git a/organizationcustomdomain.go b/organizationcustomdomain.go
new file mode 100644
index 0000000..e35cead
--- /dev/null
+++ b/organizationcustomdomain.go
@@ -0,0 +1,315 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package gitpod
+
+import (
+ "context"
+ "net/http"
+ "slices"
+ "time"
+
+ "github.com/gitpod-io/gitpod-sdk-go/internal/apijson"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/param"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/requestconfig"
+ "github.com/gitpod-io/gitpod-sdk-go/option"
+)
+
+// OrganizationCustomDomainService contains methods and other services that help
+// with interacting with the gitpod API.
+//
+// Note, unlike clients, this service does not read variables from the environment
+// automatically. You should not instantiate this service directly, and instead use
+// the [NewOrganizationCustomDomainService] method instead.
+type OrganizationCustomDomainService struct {
+ Options []option.RequestOption
+}
+
+// NewOrganizationCustomDomainService generates a new service that applies the
+// given options to each request. These options are applied after the parent
+// client's options (if there is one), and before any request-specific options.
+func NewOrganizationCustomDomainService(opts ...option.RequestOption) (r *OrganizationCustomDomainService) {
+ r = &OrganizationCustomDomainService{}
+ r.Options = opts
+ return
+}
+
+// Creates a custom domain configuration for an organization.
+//
+// # Use this method to configure custom domains for organization workspaces
+//
+// ### Examples
+//
+// - Configure AWS custom domain:
+//
+// Sets up a custom domain with AWS provider.
+//
+// ```yaml
+// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
+// domainName: "workspaces.acme-corp.com"
+// provider: CUSTOM_DOMAIN_PROVIDER_AWS
+// awsAccountId: "123456789012"
+// ```
+func (r *OrganizationCustomDomainService) New(ctx context.Context, body OrganizationCustomDomainNewParams, opts ...option.RequestOption) (res *OrganizationCustomDomainNewResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.OrganizationService/CreateCustomDomain"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Retrieves a specific custom domain configuration.
+//
+// # Use this method to view custom domain details
+//
+// ### Examples
+//
+// - Get custom domain configuration:
+//
+// Retrieves details of a specific custom domain.
+//
+// ```yaml
+// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
+// ```
+func (r *OrganizationCustomDomainService) Get(ctx context.Context, body OrganizationCustomDomainGetParams, opts ...option.RequestOption) (res *OrganizationCustomDomainGetResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.OrganizationService/GetCustomDomain"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Updates custom domain configuration settings.
+//
+// Use this method to:
+//
+// - Update cloud provider settings
+// - Change AWS account ID
+// - Modify domain configuration
+//
+// ### Examples
+//
+// - Update AWS account ID:
+//
+// Changes the AWS account ID for the custom domain.
+//
+// ```yaml
+// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
+// domainName: "workspaces.acme-corp.com"
+// awsAccountId: "987654321098"
+// ```
+func (r *OrganizationCustomDomainService) Update(ctx context.Context, body OrganizationCustomDomainUpdateParams, opts ...option.RequestOption) (res *OrganizationCustomDomainUpdateResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.OrganizationService/UpdateCustomDomain"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Removes a custom domain configuration from an organization.
+//
+// Use this method to:
+//
+// - Disable custom domain functionality
+// - Remove outdated configurations
+// - Clean up unused domains
+//
+// ### Examples
+//
+// - Delete custom domain configuration:
+//
+// Removes a specific custom domain configuration.
+//
+// ```yaml
+// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
+// ```
+func (r *OrganizationCustomDomainService) Delete(ctx context.Context, body OrganizationCustomDomainDeleteParams, opts ...option.RequestOption) (res *OrganizationCustomDomainDeleteResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.OrganizationService/DeleteCustomDomain"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// CustomDomain represents a custom domain configuration for an organization
+type CustomDomain struct {
+ // id is the unique identifier of the custom domain
+ ID string `json:"id,required" format:"uuid"`
+ // created_at is when the custom domain was created
+ CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
+ // domain_name is the custom domain name
+ DomainName string `json:"domainName,required"`
+ // organization_id is the ID of the organization this custom domain belongs to
+ OrganizationID string `json:"organizationId,required" format:"uuid"`
+ // updated_at is when the custom domain was last updated
+ UpdatedAt time.Time `json:"updatedAt,required" format:"date-time"`
+ // aws_account_id is the AWS account ID (deprecated: use cloud_account_id)
+ //
+ // Deprecated: deprecated
+ AwsAccountID string `json:"awsAccountId"`
+ // cloud_account_id is the unified cloud account identifier (AWS Account ID or GCP
+ // Project ID)
+ CloudAccountID string `json:"cloudAccountId"`
+ // provider is the cloud provider for this custom domain
+ Provider CustomDomainProvider `json:"provider"`
+ JSON customDomainJSON `json:"-"`
+}
+
+// customDomainJSON contains the JSON metadata for the struct [CustomDomain]
+type customDomainJSON struct {
+ ID apijson.Field
+ CreatedAt apijson.Field
+ DomainName apijson.Field
+ OrganizationID apijson.Field
+ UpdatedAt apijson.Field
+ AwsAccountID apijson.Field
+ CloudAccountID apijson.Field
+ Provider apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *CustomDomain) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r customDomainJSON) RawJSON() string {
+ return r.raw
+}
+
+// CustomDomainProvider represents the cloud provider for custom domain
+// configuration
+type CustomDomainProvider string
+
+const (
+ CustomDomainProviderUnspecified CustomDomainProvider = "CUSTOM_DOMAIN_PROVIDER_UNSPECIFIED"
+ CustomDomainProviderAws CustomDomainProvider = "CUSTOM_DOMAIN_PROVIDER_AWS"
+ CustomDomainProviderGcp CustomDomainProvider = "CUSTOM_DOMAIN_PROVIDER_GCP"
+)
+
+func (r CustomDomainProvider) IsKnown() bool {
+ switch r {
+ case CustomDomainProviderUnspecified, CustomDomainProviderAws, CustomDomainProviderGcp:
+ return true
+ }
+ return false
+}
+
+// CreateCustomDomainResponse is the response message for creating a custom domain
+type OrganizationCustomDomainNewResponse struct {
+ // custom_domain is the created custom domain
+ CustomDomain CustomDomain `json:"customDomain,required"`
+ JSON organizationCustomDomainNewResponseJSON `json:"-"`
+}
+
+// organizationCustomDomainNewResponseJSON contains the JSON metadata for the
+// struct [OrganizationCustomDomainNewResponse]
+type organizationCustomDomainNewResponseJSON struct {
+ CustomDomain apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *OrganizationCustomDomainNewResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r organizationCustomDomainNewResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+type OrganizationCustomDomainGetResponse struct {
+ // CustomDomain represents a custom domain configuration for an organization
+ CustomDomain CustomDomain `json:"customDomain,required"`
+ JSON organizationCustomDomainGetResponseJSON `json:"-"`
+}
+
+// organizationCustomDomainGetResponseJSON contains the JSON metadata for the
+// struct [OrganizationCustomDomainGetResponse]
+type organizationCustomDomainGetResponseJSON struct {
+ CustomDomain apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *OrganizationCustomDomainGetResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r organizationCustomDomainGetResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+// UpdateCustomDomainResponse is the response message for updating a custom domain
+type OrganizationCustomDomainUpdateResponse struct {
+ // custom_domain is the updated custom domain
+ CustomDomain CustomDomain `json:"customDomain,required"`
+ JSON organizationCustomDomainUpdateResponseJSON `json:"-"`
+}
+
+// organizationCustomDomainUpdateResponseJSON contains the JSON metadata for the
+// struct [OrganizationCustomDomainUpdateResponse]
+type organizationCustomDomainUpdateResponseJSON struct {
+ CustomDomain apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *OrganizationCustomDomainUpdateResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r organizationCustomDomainUpdateResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+type OrganizationCustomDomainDeleteResponse = interface{}
+
+type OrganizationCustomDomainNewParams struct {
+ // domain_name is the custom domain name
+ DomainName param.Field[string] `json:"domainName,required"`
+ // organization_id is the ID of the organization to create the custom domain for
+ OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"`
+ // aws_account_id is the AWS account ID (deprecated: use cloud_account_id)
+ AwsAccountID param.Field[string] `json:"awsAccountId"`
+ // cloud_account_id is the unified cloud account identifier (AWS Account ID or GCP
+ // Project ID)
+ CloudAccountID param.Field[string] `json:"cloudAccountId"`
+ // provider is the cloud provider for this custom domain
+ Provider param.Field[CustomDomainProvider] `json:"provider"`
+}
+
+func (r OrganizationCustomDomainNewParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type OrganizationCustomDomainGetParams struct {
+ // organization_id is the ID of the organization to retrieve custom domain for
+ OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"`
+}
+
+func (r OrganizationCustomDomainGetParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type OrganizationCustomDomainUpdateParams struct {
+ // domain_name is the custom domain name
+ DomainName param.Field[string] `json:"domainName,required"`
+ // organization_id is the ID of the organization to update custom domain for
+ OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"`
+ // aws_account_id is the AWS account ID (deprecated: use cloud_account_id)
+ AwsAccountID param.Field[string] `json:"awsAccountId"`
+ // cloud_account_id is the unified cloud account identifier (AWS Account ID or GCP
+ // Project ID)
+ CloudAccountID param.Field[string] `json:"cloudAccountId"`
+ // provider is the cloud provider for this custom domain
+ Provider param.Field[CustomDomainProvider] `json:"provider"`
+}
+
+func (r OrganizationCustomDomainUpdateParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type OrganizationCustomDomainDeleteParams struct {
+ // organization_id is the ID of the organization to delete custom domain for
+ OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"`
+}
+
+func (r OrganizationCustomDomainDeleteParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
diff --git a/organizationcustomdomain_test.go b/organizationcustomdomain_test.go
new file mode 100644
index 0000000..886abe9
--- /dev/null
+++ b/organizationcustomdomain_test.go
@@ -0,0 +1,122 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package gitpod_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+
+ "github.com/gitpod-io/gitpod-sdk-go"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/testutil"
+ "github.com/gitpod-io/gitpod-sdk-go/option"
+)
+
+func TestOrganizationCustomDomainNewWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Organizations.CustomDomains.New(context.TODO(), gitpod.OrganizationCustomDomainNewParams{
+ DomainName: gitpod.F("workspaces.acme-corp.com"),
+ OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
+ AwsAccountID: gitpod.F("123456789012"),
+ CloudAccountID: gitpod.F("cloudAccountId"),
+ Provider: gitpod.F(gitpod.CustomDomainProviderAws),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestOrganizationCustomDomainGet(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Organizations.CustomDomains.Get(context.TODO(), gitpod.OrganizationCustomDomainGetParams{
+ OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestOrganizationCustomDomainUpdateWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Organizations.CustomDomains.Update(context.TODO(), gitpod.OrganizationCustomDomainUpdateParams{
+ DomainName: gitpod.F("workspaces.acme-corp.com"),
+ OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
+ AwsAccountID: gitpod.F("987654321098"),
+ CloudAccountID: gitpod.F("cloudAccountId"),
+ Provider: gitpod.F(gitpod.CustomDomainProviderUnspecified),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestOrganizationCustomDomainDelete(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Organizations.CustomDomains.Delete(context.TODO(), gitpod.OrganizationCustomDomainDeleteParams{
+ OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/organizationpolicy.go b/organizationpolicy.go
index 48edca5..99f95cb 100644
--- a/organizationpolicy.go
+++ b/organizationpolicy.go
@@ -96,7 +96,77 @@ func (r *OrganizationPolicyService) Update(ctx context.Context, body Organizatio
return
}
+// AgentPolicy contains agent-specific policy settings for an organization
+type AgentPolicy struct {
+ // command_deny_list contains a list of commands that agents are not allowed to
+ // execute
+ CommandDenyList []string `json:"commandDenyList,required"`
+ // mcp_disabled controls whether MCP (Model Context Protocol) is disabled for
+ // agents
+ McpDisabled bool `json:"mcpDisabled,required"`
+ // scm_tools_disabled controls whether SCM (Source Control Management) tools are
+ // disabled for agents
+ ScmToolsDisabled bool `json:"scmToolsDisabled,required"`
+ JSON agentPolicyJSON `json:"-"`
+}
+
+// agentPolicyJSON contains the JSON metadata for the struct [AgentPolicy]
+type agentPolicyJSON struct {
+ CommandDenyList apijson.Field
+ McpDisabled apijson.Field
+ ScmToolsDisabled apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AgentPolicy) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r agentPolicyJSON) RawJSON() string {
+ return r.raw
+}
+
+// CrowdStrikeConfig configures CrowdStrike Falcon sensor deployment
+type CrowdStrikeConfig struct {
+ // additional*options contains additional FALCONCTL_OPT*\* options as key-value
+ // pairs. Keys should NOT include the FALCONCTL*OPT* prefix.
+ AdditionalOptions map[string]string `json:"additionalOptions"`
+ // cid_secret_id references an organization secret containing the Customer ID
+ // (CID).
+ CidSecretID string `json:"cidSecretId" format:"uuid"`
+ // enabled controls whether CrowdStrike Falcon is deployed to environments
+ Enabled bool `json:"enabled"`
+ // image is the CrowdStrike Falcon sensor container image reference
+ Image string `json:"image"`
+ // tags are optional tags to apply to the Falcon sensor (comma-separated)
+ Tags string `json:"tags"`
+ JSON crowdStrikeConfigJSON `json:"-"`
+}
+
+// crowdStrikeConfigJSON contains the JSON metadata for the struct
+// [CrowdStrikeConfig]
+type crowdStrikeConfigJSON struct {
+ AdditionalOptions apijson.Field
+ CidSecretID apijson.Field
+ Enabled apijson.Field
+ Image apijson.Field
+ Tags apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *CrowdStrikeConfig) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r crowdStrikeConfigJSON) RawJSON() string {
+ return r.raw
+}
+
type OrganizationPolicies struct {
+ // agent_policy contains agent-specific policy settings
+ AgentPolicy AgentPolicy `json:"agentPolicy,required"`
// allowed_editor_ids is the list of editor IDs that are allowed to be used in the
// organization
AllowedEditorIDs []string `json:"allowedEditorIds,required"`
@@ -125,16 +195,37 @@ type OrganizationPolicies struct {
// port_sharing_disabled controls whether port sharing is disabled in the
// organization
PortSharingDisabled bool `json:"portSharingDisabled,required"`
+ // 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.
+ RequireCustomDomainAccess bool `json:"requireCustomDomainAccess,required"`
+ // 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).
+ DeleteArchivedEnvironmentsAfter string `json:"deleteArchivedEnvironmentsAfter" format:"regex"`
+ // editor_version_restrictions restricts which editor versions can be used. Maps
+ // editor ID to version policy, editor_version_restrictions not set means no
+ // restrictions. If empty or not set for an editor, we will use the latest version
+ // of the editor
+ EditorVersionRestrictions map[string]OrganizationPoliciesEditorVersionRestriction `json:"editorVersionRestrictions"`
+ // 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).
+ MaximumEnvironmentLifetime string `json:"maximumEnvironmentLifetime" format:"regex"`
// maximum_environment_timeout controls the maximum timeout allowed for
// environments in seconds. 0 means no limit (never). Minimum duration is 30
- // minutes.
- MaximumEnvironmentTimeout string `json:"maximumEnvironmentTimeout" format:"regex"`
- JSON organizationPoliciesJSON `json:"-"`
+ // minutes (1800 seconds).
+ MaximumEnvironmentTimeout string `json:"maximumEnvironmentTimeout" format:"regex"`
+ // security_agent_policy contains security agent configuration for the
+ // organization. When configured, security agents are automatically deployed to all
+ // environments.
+ SecurityAgentPolicy SecurityAgentPolicy `json:"securityAgentPolicy"`
+ JSON organizationPoliciesJSON `json:"-"`
}
// organizationPoliciesJSON contains the JSON metadata for the struct
// [OrganizationPolicies]
type organizationPoliciesJSON struct {
+ AgentPolicy apijson.Field
AllowedEditorIDs apijson.Field
AllowLocalRunners apijson.Field
DefaultEditorID apijson.Field
@@ -145,7 +236,12 @@ type organizationPoliciesJSON struct {
MembersRequireProjects apijson.Field
OrganizationID apijson.Field
PortSharingDisabled apijson.Field
+ RequireCustomDomainAccess apijson.Field
+ DeleteArchivedEnvironmentsAfter apijson.Field
+ EditorVersionRestrictions apijson.Field
+ MaximumEnvironmentLifetime apijson.Field
MaximumEnvironmentTimeout apijson.Field
+ SecurityAgentPolicy apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
@@ -158,6 +254,56 @@ func (r organizationPoliciesJSON) RawJSON() string {
return r.raw
}
+// EditorVersionPolicy defines the version policy for a specific editor
+type OrganizationPoliciesEditorVersionRestriction struct {
+ // allowed_versions lists the versions that are allowed If empty, we will use the
+ // latest version of the editor
+ //
+ // Examples for JetBrains: `["2025.2", "2025.1", "2024.3"]`
+ AllowedVersions []string `json:"allowedVersions"`
+ JSON organizationPoliciesEditorVersionRestrictionJSON `json:"-"`
+}
+
+// organizationPoliciesEditorVersionRestrictionJSON contains the JSON metadata for
+// the struct [OrganizationPoliciesEditorVersionRestriction]
+type organizationPoliciesEditorVersionRestrictionJSON struct {
+ AllowedVersions apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *OrganizationPoliciesEditorVersionRestriction) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r organizationPoliciesEditorVersionRestrictionJSON) RawJSON() string {
+ return r.raw
+}
+
+// SecurityAgentPolicy contains security agent configuration for an organization.
+// When enabled, security agents are automatically deployed to all environments.
+type SecurityAgentPolicy struct {
+ // crowdstrike contains CrowdStrike Falcon configuration
+ Crowdstrike CrowdStrikeConfig `json:"crowdstrike"`
+ JSON securityAgentPolicyJSON `json:"-"`
+}
+
+// securityAgentPolicyJSON contains the JSON metadata for the struct
+// [SecurityAgentPolicy]
+type securityAgentPolicyJSON struct {
+ Crowdstrike apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *SecurityAgentPolicy) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r securityAgentPolicyJSON) RawJSON() string {
+ return r.raw
+}
+
type OrganizationPolicyGetResponse struct {
Policies OrganizationPolicies `json:"policies,required"`
JSON organizationPolicyGetResponseJSON `json:"-"`
@@ -193,6 +339,8 @@ func (r OrganizationPolicyGetParams) MarshalJSON() (data []byte, err error) {
type OrganizationPolicyUpdateParams struct {
// organization_id is the ID of the organization to update policies for
OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"`
+ // agent_policy contains agent-specific policy settings
+ AgentPolicy param.Field[OrganizationPolicyUpdateParamsAgentPolicy] `json:"agentPolicy"`
// allowed_editor_ids is the list of editor IDs that are allowed to be used in the
// organization
AllowedEditorIDs param.Field[[]string] `json:"allowedEditorIds"`
@@ -205,12 +353,23 @@ type OrganizationPolicyUpdateParams struct {
// default_environment_image is the default container image when none is defined in
// repo
DefaultEnvironmentImage param.Field[string] `json:"defaultEnvironmentImage"`
+ // 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).
+ DeleteArchivedEnvironmentsAfter param.Field[string] `json:"deleteArchivedEnvironmentsAfter" format:"regex"`
+ // editor_version_restrictions restricts which editor versions can be used. Maps
+ // editor ID to version policy with allowed major versions.
+ EditorVersionRestrictions param.Field[map[string]OrganizationPolicyUpdateParamsEditorVersionRestrictions] `json:"editorVersionRestrictions"`
+ // 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).
+ MaximumEnvironmentLifetime param.Field[string] `json:"maximumEnvironmentLifetime" format:"regex"`
// maximum_environments_per_user limits total environments (running or stopped) per
// user
MaximumEnvironmentsPerUser param.Field[string] `json:"maximumEnvironmentsPerUser"`
// maximum_environment_timeout controls the maximum timeout allowed for
// environments in seconds. 0 means no limit (never). Minimum duration is 30
- // minutes.
+ // minutes (1800 seconds).
MaximumEnvironmentTimeout param.Field[string] `json:"maximumEnvironmentTimeout" format:"regex"`
// maximum_running_environments_per_user limits simultaneously running environments
// per user
@@ -223,8 +382,72 @@ type OrganizationPolicyUpdateParams struct {
// port_sharing_disabled controls whether port sharing is disabled in the
// organization
PortSharingDisabled param.Field[bool] `json:"portSharingDisabled"`
+ // 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.
+ RequireCustomDomainAccess param.Field[bool] `json:"requireCustomDomainAccess"`
+ // security_agent_policy contains security agent configuration updates
+ SecurityAgentPolicy param.Field[OrganizationPolicyUpdateParamsSecurityAgentPolicy] `json:"securityAgentPolicy"`
}
func (r OrganizationPolicyUpdateParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
+
+// agent_policy contains agent-specific policy settings
+type OrganizationPolicyUpdateParamsAgentPolicy struct {
+ // command_deny_list contains a list of commands that agents are not allowed to
+ // execute
+ CommandDenyList param.Field[[]string] `json:"commandDenyList"`
+ // mcp_disabled controls whether MCP (Model Context Protocol) is disabled for
+ // agents
+ McpDisabled param.Field[bool] `json:"mcpDisabled"`
+ // scm_tools_disabled controls whether SCM (Source Control Management) tools are
+ // disabled for agents
+ ScmToolsDisabled param.Field[bool] `json:"scmToolsDisabled"`
+}
+
+func (r OrganizationPolicyUpdateParamsAgentPolicy) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// EditorVersionPolicy defines the version policy for a specific editor
+type OrganizationPolicyUpdateParamsEditorVersionRestrictions struct {
+ // allowed_versions lists the versions that are allowed If empty, we will use the
+ // latest version of the editor
+ //
+ // Examples for JetBrains: `["2025.2", "2025.1", "2024.3"]`
+ AllowedVersions param.Field[[]string] `json:"allowedVersions"`
+}
+
+func (r OrganizationPolicyUpdateParamsEditorVersionRestrictions) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// security_agent_policy contains security agent configuration updates
+type OrganizationPolicyUpdateParamsSecurityAgentPolicy struct {
+ // crowdstrike contains CrowdStrike Falcon configuration updates
+ Crowdstrike param.Field[OrganizationPolicyUpdateParamsSecurityAgentPolicyCrowdstrike] `json:"crowdstrike"`
+}
+
+func (r OrganizationPolicyUpdateParamsSecurityAgentPolicy) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// crowdstrike contains CrowdStrike Falcon configuration updates
+type OrganizationPolicyUpdateParamsSecurityAgentPolicyCrowdstrike struct {
+ // additional*options contains additional FALCONCTL_OPT*\* options as key-value
+ // pairs
+ AdditionalOptions param.Field[map[string]string] `json:"additionalOptions"`
+ // cid_secret_id references an organization secret containing the Customer ID (CID)
+ CidSecretID param.Field[string] `json:"cidSecretId" format:"uuid"`
+ // enabled controls whether CrowdStrike Falcon is deployed to environments
+ Enabled param.Field[bool] `json:"enabled"`
+ // image is the CrowdStrike Falcon sensor container image reference
+ Image param.Field[string] `json:"image"`
+ // tags are optional tags to apply to the Falcon sensor
+ Tags param.Field[string] `json:"tags"`
+}
+
+func (r OrganizationPolicyUpdateParamsSecurityAgentPolicyCrowdstrike) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
diff --git a/organizationpolicy_test.go b/organizationpolicy_test.go
index 94fda35..cea9261 100644
--- a/organizationpolicy_test.go
+++ b/organizationpolicy_test.go
@@ -52,17 +52,41 @@ func TestOrganizationPolicyUpdateWithOptionalParams(t *testing.T) {
option.WithBearerToken("My Bearer Token"),
)
_, err := client.Organizations.Policies.Update(context.TODO(), gitpod.OrganizationPolicyUpdateParams{
- OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
- AllowedEditorIDs: gitpod.F([]string{"string"}),
- AllowLocalRunners: gitpod.F(true),
- DefaultEditorID: gitpod.F("defaultEditorId"),
- DefaultEnvironmentImage: gitpod.F("defaultEnvironmentImage"),
+ OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
+ AgentPolicy: gitpod.F(gitpod.OrganizationPolicyUpdateParamsAgentPolicy{
+ CommandDenyList: gitpod.F([]string{"string"}),
+ McpDisabled: gitpod.F(true),
+ ScmToolsDisabled: gitpod.F(true),
+ }),
+ AllowedEditorIDs: gitpod.F([]string{"string"}),
+ AllowLocalRunners: gitpod.F(true),
+ DefaultEditorID: gitpod.F("defaultEditorId"),
+ DefaultEnvironmentImage: gitpod.F("defaultEnvironmentImage"),
+ DeleteArchivedEnvironmentsAfter: gitpod.F("+9125115.360s"),
+ EditorVersionRestrictions: gitpod.F(map[string]gitpod.OrganizationPolicyUpdateParamsEditorVersionRestrictions{
+ "foo": {
+ AllowedVersions: gitpod.F([]string{"string"}),
+ },
+ }),
+ MaximumEnvironmentLifetime: gitpod.F("+9125115.360s"),
MaximumEnvironmentsPerUser: gitpod.F("20"),
MaximumEnvironmentTimeout: gitpod.F("3600s"),
MaximumRunningEnvironmentsPerUser: gitpod.F("5"),
MembersCreateProjects: gitpod.F(true),
MembersRequireProjects: gitpod.F(true),
PortSharingDisabled: gitpod.F(true),
+ RequireCustomDomainAccess: gitpod.F(true),
+ SecurityAgentPolicy: gitpod.F(gitpod.OrganizationPolicyUpdateParamsSecurityAgentPolicy{
+ Crowdstrike: gitpod.F(gitpod.OrganizationPolicyUpdateParamsSecurityAgentPolicyCrowdstrike{
+ AdditionalOptions: gitpod.F(map[string]string{
+ "foo": "string",
+ }),
+ CidSecretID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ Enabled: gitpod.F(true),
+ Image: gitpod.F("image"),
+ Tags: gitpod.F("tags"),
+ }),
+ }),
})
if err != nil {
var apierr *gitpod.Error
diff --git a/organizationssoconfiguration.go b/organizationssoconfiguration.go
index 3aefb95..e879b0b 100644
--- a/organizationssoconfiguration.go
+++ b/organizationssoconfiguration.go
@@ -273,9 +273,11 @@ type SSOConfiguration struct {
// claims are key/value pairs that defines a mapping of claims issued by the IdP.
Claims map[string]string `json:"claims"`
// client_id is the client ID of the OIDC application set on the IdP
- ClientID string `json:"clientId"`
- EmailDomain string `json:"emailDomain"`
- JSON ssoConfigurationJSON `json:"-"`
+ ClientID string `json:"clientId"`
+ DisplayName string `json:"displayName"`
+ EmailDomain string `json:"emailDomain"`
+ EmailDomains []string `json:"emailDomains"`
+ JSON ssoConfigurationJSON `json:"-"`
}
// ssoConfigurationJSON contains the JSON metadata for the struct
@@ -288,7 +290,9 @@ type ssoConfigurationJSON struct {
State apijson.Field
Claims apijson.Field
ClientID apijson.Field
+ DisplayName apijson.Field
EmailDomain apijson.Field
+ EmailDomains apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
@@ -370,11 +374,13 @@ type OrganizationSSOConfigurationNewParams struct {
ClientID param.Field[string] `json:"clientId,required"`
// client_secret is the client secret of the OIDC application set on the IdP
ClientSecret param.Field[string] `json:"clientSecret,required"`
- // email_domain is the domain that is allowed to sign in to the organization
- EmailDomain param.Field[string] `json:"emailDomain,required"`
// issuer_url is the URL of the IdP issuer
IssuerURL param.Field[string] `json:"issuerUrl,required" format:"uri"`
OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"`
+ DisplayName param.Field[string] `json:"displayName"`
+ // email_domain is the domain that is allowed to sign in to the organization
+ EmailDomain param.Field[string] `json:"emailDomain"`
+ EmailDomains param.Field[[]string] `json:"emailDomains"`
}
func (r OrganizationSSOConfigurationNewParams) MarshalJSON() (data []byte, err error) {
@@ -398,8 +404,10 @@ type OrganizationSSOConfigurationUpdateParams struct {
// client_id is the client ID of the SSO provider
ClientID param.Field[string] `json:"clientId"`
// client_secret is the client secret of the SSO provider
- ClientSecret param.Field[string] `json:"clientSecret"`
- EmailDomain param.Field[string] `json:"emailDomain"`
+ ClientSecret param.Field[string] `json:"clientSecret"`
+ DisplayName param.Field[string] `json:"displayName"`
+ EmailDomain param.Field[string] `json:"emailDomain"`
+ EmailDomains param.Field[[]string] `json:"emailDomains"`
// issuer_url is the URL of the IdP issuer
IssuerURL param.Field[string] `json:"issuerUrl" format:"uri"`
// state is the state of the SSO configuration
diff --git a/organizationssoconfiguration_test.go b/organizationssoconfiguration_test.go
index 192f9e2..e5e0162 100644
--- a/organizationssoconfiguration_test.go
+++ b/organizationssoconfiguration_test.go
@@ -13,7 +13,7 @@ import (
"github.com/gitpod-io/gitpod-sdk-go/option"
)
-func TestOrganizationSSOConfigurationNew(t *testing.T) {
+func TestOrganizationSSOConfigurationNewWithOptionalParams(t *testing.T) {
t.Skip("Prism tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -29,9 +29,11 @@ func TestOrganizationSSOConfigurationNew(t *testing.T) {
_, err := client.Organizations.SSOConfigurations.New(context.TODO(), gitpod.OrganizationSSOConfigurationNewParams{
ClientID: gitpod.F("012345678-abcdefghijklmnopqrstuvwxyz.apps.googleusercontent.com"),
ClientSecret: gitpod.F("GOCSPX-abcdefghijklmnopqrstuvwxyz123456"),
- EmailDomain: gitpod.F("acme-corp.com"),
IssuerURL: gitpod.F("https://accounts.google.com"),
OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
+ DisplayName: gitpod.F("displayName"),
+ EmailDomain: gitpod.F("acme-corp.com"),
+ EmailDomains: gitpod.F([]string{"sfN2.l.iJR-BU.u9JV9.a.m.o2D-4b-Jd.0Z-kX.L.n.S.f.UKbxB"}),
})
if err != nil {
var apierr *gitpod.Error
@@ -87,7 +89,9 @@ func TestOrganizationSSOConfigurationUpdateWithOptionalParams(t *testing.T) {
}),
ClientID: gitpod.F("new-client-id"),
ClientSecret: gitpod.F("new-client-secret"),
+ DisplayName: gitpod.F("displayName"),
EmailDomain: gitpod.F("xxxx"),
+ EmailDomains: gitpod.F([]string{"sfN2.l.iJR-BU.u9JV9.a.m.o2D-4b-Jd.0Z-kX.L.n.S.f.UKbxB"}),
IssuerURL: gitpod.F("https://example.com"),
State: gitpod.F(gitpod.SSOConfigurationStateUnspecified),
})
diff --git a/packages/pagination/pagination.go b/packages/pagination/pagination.go
index 88ab34c..abd1f10 100644
--- a/packages/pagination/pagination.go
+++ b/packages/pagination/pagination.go
@@ -10,6 +10,256 @@ import (
"github.com/gitpod-io/gitpod-sdk-go/option"
)
+type AgentExecutionsPagePagination struct {
+ NextToken string `json:"nextToken"`
+ JSON agentExecutionsPagePaginationJSON `json:"-"`
+}
+
+// agentExecutionsPagePaginationJSON contains the JSON metadata for the struct
+// [AgentExecutionsPagePagination]
+type agentExecutionsPagePaginationJSON struct {
+ NextToken apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AgentExecutionsPagePagination) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r agentExecutionsPagePaginationJSON) RawJSON() string {
+ return r.raw
+}
+
+type AgentExecutionsPage[T any] struct {
+ AgentExecutions []T `json:"agentExecutions"`
+ Pagination AgentExecutionsPagePagination `json:"pagination"`
+ JSON agentExecutionsPageJSON `json:"-"`
+ cfg *requestconfig.RequestConfig
+ res *http.Response
+}
+
+// agentExecutionsPageJSON contains the JSON metadata for the struct
+// [AgentExecutionsPage[T]]
+type agentExecutionsPageJSON struct {
+ AgentExecutions apijson.Field
+ Pagination apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AgentExecutionsPage[T]) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r agentExecutionsPageJSON) RawJSON() string {
+ return r.raw
+}
+
+// GetNextPage returns the next page as defined by this pagination style. When
+// there is no next page, this function will return a 'nil' for the page value, but
+// will not return an error
+func (r *AgentExecutionsPage[T]) GetNextPage() (res *AgentExecutionsPage[T], err error) {
+ if len(r.AgentExecutions) == 0 {
+ return nil, nil
+ }
+ next := r.Pagination.NextToken
+ if len(next) == 0 {
+ return nil, nil
+ }
+ cfg := r.cfg.Clone(r.cfg.Context)
+ err = cfg.Apply(option.WithQuery("token", next))
+ if err != nil {
+ return nil, err
+ }
+ var raw *http.Response
+ cfg.ResponseInto = &raw
+ cfg.ResponseBodyInto = &res
+ err = cfg.Execute()
+ if err != nil {
+ return nil, err
+ }
+ res.SetPageConfig(cfg, raw)
+ return res, nil
+}
+
+func (r *AgentExecutionsPage[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) {
+ if r == nil {
+ r = &AgentExecutionsPage[T]{}
+ }
+ r.cfg = cfg
+ r.res = res
+}
+
+type AgentExecutionsPageAutoPager[T any] struct {
+ page *AgentExecutionsPage[T]
+ cur T
+ idx int
+ run int
+ err error
+}
+
+func NewAgentExecutionsPageAutoPager[T any](page *AgentExecutionsPage[T], err error) *AgentExecutionsPageAutoPager[T] {
+ return &AgentExecutionsPageAutoPager[T]{
+ page: page,
+ err: err,
+ }
+}
+
+func (r *AgentExecutionsPageAutoPager[T]) Next() bool {
+ if r.page == nil || len(r.page.AgentExecutions) == 0 {
+ return false
+ }
+ if r.idx >= len(r.page.AgentExecutions) {
+ r.idx = 0
+ r.page, r.err = r.page.GetNextPage()
+ if r.err != nil || r.page == nil || len(r.page.AgentExecutions) == 0 {
+ return false
+ }
+ }
+ r.cur = r.page.AgentExecutions[r.idx]
+ r.run += 1
+ r.idx += 1
+ return true
+}
+
+func (r *AgentExecutionsPageAutoPager[T]) Current() T {
+ return r.cur
+}
+
+func (r *AgentExecutionsPageAutoPager[T]) Err() error {
+ return r.err
+}
+
+func (r *AgentExecutionsPageAutoPager[T]) Index() int {
+ return r.run
+}
+
+type AssignmentsPagePagination struct {
+ NextToken string `json:"nextToken"`
+ JSON assignmentsPagePaginationJSON `json:"-"`
+}
+
+// assignmentsPagePaginationJSON contains the JSON metadata for the struct
+// [AssignmentsPagePagination]
+type assignmentsPagePaginationJSON struct {
+ NextToken apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AssignmentsPagePagination) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r assignmentsPagePaginationJSON) RawJSON() string {
+ return r.raw
+}
+
+type AssignmentsPage[T any] struct {
+ Assignments []T `json:"assignments"`
+ Pagination AssignmentsPagePagination `json:"pagination"`
+ JSON assignmentsPageJSON `json:"-"`
+ cfg *requestconfig.RequestConfig
+ res *http.Response
+}
+
+// assignmentsPageJSON contains the JSON metadata for the struct
+// [AssignmentsPage[T]]
+type assignmentsPageJSON struct {
+ Assignments apijson.Field
+ Pagination apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AssignmentsPage[T]) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r assignmentsPageJSON) RawJSON() string {
+ return r.raw
+}
+
+// GetNextPage returns the next page as defined by this pagination style. When
+// there is no next page, this function will return a 'nil' for the page value, but
+// will not return an error
+func (r *AssignmentsPage[T]) GetNextPage() (res *AssignmentsPage[T], err error) {
+ if len(r.Assignments) == 0 {
+ return nil, nil
+ }
+ next := r.Pagination.NextToken
+ if len(next) == 0 {
+ return nil, nil
+ }
+ cfg := r.cfg.Clone(r.cfg.Context)
+ err = cfg.Apply(option.WithQuery("token", next))
+ if err != nil {
+ return nil, err
+ }
+ var raw *http.Response
+ cfg.ResponseInto = &raw
+ cfg.ResponseBodyInto = &res
+ err = cfg.Execute()
+ if err != nil {
+ return nil, err
+ }
+ res.SetPageConfig(cfg, raw)
+ return res, nil
+}
+
+func (r *AssignmentsPage[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) {
+ if r == nil {
+ r = &AssignmentsPage[T]{}
+ }
+ r.cfg = cfg
+ r.res = res
+}
+
+type AssignmentsPageAutoPager[T any] struct {
+ page *AssignmentsPage[T]
+ cur T
+ idx int
+ run int
+ err error
+}
+
+func NewAssignmentsPageAutoPager[T any](page *AssignmentsPage[T], err error) *AssignmentsPageAutoPager[T] {
+ return &AssignmentsPageAutoPager[T]{
+ page: page,
+ err: err,
+ }
+}
+
+func (r *AssignmentsPageAutoPager[T]) Next() bool {
+ if r.page == nil || len(r.page.Assignments) == 0 {
+ return false
+ }
+ if r.idx >= len(r.page.Assignments) {
+ r.idx = 0
+ r.page, r.err = r.page.GetNextPage()
+ if r.err != nil || r.page == nil || len(r.page.Assignments) == 0 {
+ return false
+ }
+ }
+ r.cur = r.page.Assignments[r.idx]
+ r.run += 1
+ r.idx += 1
+ return true
+}
+
+func (r *AssignmentsPageAutoPager[T]) Current() T {
+ return r.cur
+}
+
+func (r *AssignmentsPageAutoPager[T]) Err() error {
+ return r.err
+}
+
+func (r *AssignmentsPageAutoPager[T]) Index() int {
+ return r.run
+}
+
type DomainVerificationsPagePagination struct {
NextToken string `json:"nextToken"`
JSON domainVerificationsPagePaginationJSON `json:"-"`
@@ -1006,57 +1256,57 @@ func (r *IntegrationsPageAutoPager[T]) Index() int {
return r.run
}
-type LoginProvidersPagePagination struct {
- NextToken string `json:"nextToken"`
- JSON loginProvidersPagePaginationJSON `json:"-"`
+type JoinableOrganizationsPagePagination struct {
+ NextToken string `json:"nextToken"`
+ JSON joinableOrganizationsPagePaginationJSON `json:"-"`
}
-// loginProvidersPagePaginationJSON contains the JSON metadata for the struct
-// [LoginProvidersPagePagination]
-type loginProvidersPagePaginationJSON struct {
+// joinableOrganizationsPagePaginationJSON contains the JSON metadata for the
+// struct [JoinableOrganizationsPagePagination]
+type joinableOrganizationsPagePaginationJSON struct {
NextToken apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
-func (r *LoginProvidersPagePagination) UnmarshalJSON(data []byte) (err error) {
+func (r *JoinableOrganizationsPagePagination) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r loginProvidersPagePaginationJSON) RawJSON() string {
+func (r joinableOrganizationsPagePaginationJSON) RawJSON() string {
return r.raw
}
-type LoginProvidersPage[T any] struct {
- LoginProviders []T `json:"loginProviders"`
- Pagination LoginProvidersPagePagination `json:"pagination"`
- JSON loginProvidersPageJSON `json:"-"`
- cfg *requestconfig.RequestConfig
- res *http.Response
+type JoinableOrganizationsPage[T any] struct {
+ JoinableOrganizations []T `json:"joinableOrganizations"`
+ Pagination JoinableOrganizationsPagePagination `json:"pagination"`
+ JSON joinableOrganizationsPageJSON `json:"-"`
+ cfg *requestconfig.RequestConfig
+ res *http.Response
}
-// loginProvidersPageJSON contains the JSON metadata for the struct
-// [LoginProvidersPage[T]]
-type loginProvidersPageJSON struct {
- LoginProviders apijson.Field
- Pagination apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
+// joinableOrganizationsPageJSON contains the JSON metadata for the struct
+// [JoinableOrganizationsPage[T]]
+type joinableOrganizationsPageJSON struct {
+ JoinableOrganizations apijson.Field
+ Pagination apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
}
-func (r *LoginProvidersPage[T]) UnmarshalJSON(data []byte) (err error) {
+func (r *JoinableOrganizationsPage[T]) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r loginProvidersPageJSON) RawJSON() string {
+func (r joinableOrganizationsPageJSON) RawJSON() string {
return r.raw
}
// GetNextPage returns the next page as defined by this pagination style. When
// there is no next page, this function will return a 'nil' for the page value, but
// will not return an error
-func (r *LoginProvidersPage[T]) GetNextPage() (res *LoginProvidersPage[T], err error) {
- if len(r.LoginProviders) == 0 {
+func (r *JoinableOrganizationsPage[T]) GetNextPage() (res *JoinableOrganizationsPage[T], err error) {
+ if len(r.JoinableOrganizations) == 0 {
return nil, nil
}
next := r.Pagination.NextToken
@@ -1079,108 +1329,730 @@ func (r *LoginProvidersPage[T]) GetNextPage() (res *LoginProvidersPage[T], err e
return res, nil
}
-func (r *LoginProvidersPage[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) {
+func (r *JoinableOrganizationsPage[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) {
if r == nil {
- r = &LoginProvidersPage[T]{}
+ r = &JoinableOrganizationsPage[T]{}
}
r.cfg = cfg
r.res = res
}
-type LoginProvidersPageAutoPager[T any] struct {
- page *LoginProvidersPage[T]
+type JoinableOrganizationsPageAutoPager[T any] struct {
+ page *JoinableOrganizationsPage[T]
cur T
idx int
run int
err error
}
-func NewLoginProvidersPageAutoPager[T any](page *LoginProvidersPage[T], err error) *LoginProvidersPageAutoPager[T] {
- return &LoginProvidersPageAutoPager[T]{
+func NewJoinableOrganizationsPageAutoPager[T any](page *JoinableOrganizationsPage[T], err error) *JoinableOrganizationsPageAutoPager[T] {
+ return &JoinableOrganizationsPageAutoPager[T]{
page: page,
err: err,
}
}
-func (r *LoginProvidersPageAutoPager[T]) Next() bool {
- if r.page == nil || len(r.page.LoginProviders) == 0 {
+func (r *JoinableOrganizationsPageAutoPager[T]) Next() bool {
+ if r.page == nil || len(r.page.JoinableOrganizations) == 0 {
return false
}
- if r.idx >= len(r.page.LoginProviders) {
+ if r.idx >= len(r.page.JoinableOrganizations) {
r.idx = 0
r.page, r.err = r.page.GetNextPage()
- if r.err != nil || r.page == nil || len(r.page.LoginProviders) == 0 {
+ if r.err != nil || r.page == nil || len(r.page.JoinableOrganizations) == 0 {
return false
}
}
- r.cur = r.page.LoginProviders[r.idx]
+ r.cur = r.page.JoinableOrganizations[r.idx]
r.run += 1
r.idx += 1
return true
}
-func (r *LoginProvidersPageAutoPager[T]) Current() T {
+func (r *JoinableOrganizationsPageAutoPager[T]) Current() T {
return r.cur
}
-func (r *LoginProvidersPageAutoPager[T]) Err() error {
+func (r *JoinableOrganizationsPageAutoPager[T]) Err() error {
return r.err
}
-func (r *LoginProvidersPageAutoPager[T]) Index() int {
+func (r *JoinableOrganizationsPageAutoPager[T]) Index() int {
return r.run
}
-type MembersPagePagination struct {
- NextToken string `json:"nextToken"`
- JSON membersPagePaginationJSON `json:"-"`
+type LoginProvidersPagePagination struct {
+ NextToken string `json:"nextToken"`
+ JSON loginProvidersPagePaginationJSON `json:"-"`
}
-// membersPagePaginationJSON contains the JSON metadata for the struct
-// [MembersPagePagination]
-type membersPagePaginationJSON struct {
+// loginProvidersPagePaginationJSON contains the JSON metadata for the struct
+// [LoginProvidersPagePagination]
+type loginProvidersPagePaginationJSON struct {
NextToken apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
-func (r *MembersPagePagination) UnmarshalJSON(data []byte) (err error) {
+func (r *LoginProvidersPagePagination) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r membersPagePaginationJSON) RawJSON() string {
+func (r loginProvidersPagePaginationJSON) RawJSON() string {
return r.raw
}
-type MembersPage[T any] struct {
- Members []T `json:"members"`
- Pagination MembersPagePagination `json:"pagination"`
- JSON membersPageJSON `json:"-"`
- cfg *requestconfig.RequestConfig
- res *http.Response
+type LoginProvidersPage[T any] struct {
+ LoginProviders []T `json:"loginProviders"`
+ Pagination LoginProvidersPagePagination `json:"pagination"`
+ JSON loginProvidersPageJSON `json:"-"`
+ cfg *requestconfig.RequestConfig
+ res *http.Response
}
-// membersPageJSON contains the JSON metadata for the struct [MembersPage[T]]
-type membersPageJSON struct {
- Members apijson.Field
- Pagination apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
+// loginProvidersPageJSON contains the JSON metadata for the struct
+// [LoginProvidersPage[T]]
+type loginProvidersPageJSON struct {
+ LoginProviders apijson.Field
+ Pagination apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
}
-func (r *MembersPage[T]) UnmarshalJSON(data []byte) (err error) {
+func (r *LoginProvidersPage[T]) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r loginProvidersPageJSON) RawJSON() string {
+ return r.raw
+}
+
+// GetNextPage returns the next page as defined by this pagination style. When
+// there is no next page, this function will return a 'nil' for the page value, but
+// will not return an error
+func (r *LoginProvidersPage[T]) GetNextPage() (res *LoginProvidersPage[T], err error) {
+ if len(r.LoginProviders) == 0 {
+ return nil, nil
+ }
+ next := r.Pagination.NextToken
+ if len(next) == 0 {
+ return nil, nil
+ }
+ cfg := r.cfg.Clone(r.cfg.Context)
+ err = cfg.Apply(option.WithQuery("token", next))
+ if err != nil {
+ return nil, err
+ }
+ var raw *http.Response
+ cfg.ResponseInto = &raw
+ cfg.ResponseBodyInto = &res
+ err = cfg.Execute()
+ if err != nil {
+ return nil, err
+ }
+ res.SetPageConfig(cfg, raw)
+ return res, nil
+}
+
+func (r *LoginProvidersPage[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) {
+ if r == nil {
+ r = &LoginProvidersPage[T]{}
+ }
+ r.cfg = cfg
+ r.res = res
+}
+
+type LoginProvidersPageAutoPager[T any] struct {
+ page *LoginProvidersPage[T]
+ cur T
+ idx int
+ run int
+ err error
+}
+
+func NewLoginProvidersPageAutoPager[T any](page *LoginProvidersPage[T], err error) *LoginProvidersPageAutoPager[T] {
+ return &LoginProvidersPageAutoPager[T]{
+ page: page,
+ err: err,
+ }
+}
+
+func (r *LoginProvidersPageAutoPager[T]) Next() bool {
+ if r.page == nil || len(r.page.LoginProviders) == 0 {
+ return false
+ }
+ if r.idx >= len(r.page.LoginProviders) {
+ r.idx = 0
+ r.page, r.err = r.page.GetNextPage()
+ if r.err != nil || r.page == nil || len(r.page.LoginProviders) == 0 {
+ return false
+ }
+ }
+ r.cur = r.page.LoginProviders[r.idx]
+ r.run += 1
+ r.idx += 1
+ return true
+}
+
+func (r *LoginProvidersPageAutoPager[T]) Current() T {
+ return r.cur
+}
+
+func (r *LoginProvidersPageAutoPager[T]) Err() error {
+ return r.err
+}
+
+func (r *LoginProvidersPageAutoPager[T]) Index() int {
+ return r.run
+}
+
+type LoginsPagePagination struct {
+ NextToken string `json:"nextToken"`
+ JSON loginsPagePaginationJSON `json:"-"`
+}
+
+// loginsPagePaginationJSON contains the JSON metadata for the struct
+// [LoginsPagePagination]
+type loginsPagePaginationJSON struct {
+ NextToken apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *LoginsPagePagination) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r loginsPagePaginationJSON) RawJSON() string {
+ return r.raw
+}
+
+type LoginsPage[T any] struct {
+ Logins []T `json:"logins"`
+ Pagination LoginsPagePagination `json:"pagination"`
+ JSON loginsPageJSON `json:"-"`
+ cfg *requestconfig.RequestConfig
+ res *http.Response
+}
+
+// loginsPageJSON contains the JSON metadata for the struct [LoginsPage[T]]
+type loginsPageJSON struct {
+ Logins apijson.Field
+ Pagination apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *LoginsPage[T]) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r loginsPageJSON) RawJSON() string {
+ return r.raw
+}
+
+// GetNextPage returns the next page as defined by this pagination style. When
+// there is no next page, this function will return a 'nil' for the page value, but
+// will not return an error
+func (r *LoginsPage[T]) GetNextPage() (res *LoginsPage[T], err error) {
+ if len(r.Logins) == 0 {
+ return nil, nil
+ }
+ next := r.Pagination.NextToken
+ if len(next) == 0 {
+ return nil, nil
+ }
+ cfg := r.cfg.Clone(r.cfg.Context)
+ err = cfg.Apply(option.WithQuery("token", next))
+ if err != nil {
+ return nil, err
+ }
+ var raw *http.Response
+ cfg.ResponseInto = &raw
+ cfg.ResponseBodyInto = &res
+ err = cfg.Execute()
+ if err != nil {
+ return nil, err
+ }
+ res.SetPageConfig(cfg, raw)
+ return res, nil
+}
+
+func (r *LoginsPage[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) {
+ if r == nil {
+ r = &LoginsPage[T]{}
+ }
+ r.cfg = cfg
+ r.res = res
+}
+
+type LoginsPageAutoPager[T any] struct {
+ page *LoginsPage[T]
+ cur T
+ idx int
+ run int
+ err error
+}
+
+func NewLoginsPageAutoPager[T any](page *LoginsPage[T], err error) *LoginsPageAutoPager[T] {
+ return &LoginsPageAutoPager[T]{
+ page: page,
+ err: err,
+ }
+}
+
+func (r *LoginsPageAutoPager[T]) Next() bool {
+ if r.page == nil || len(r.page.Logins) == 0 {
+ return false
+ }
+ if r.idx >= len(r.page.Logins) {
+ r.idx = 0
+ r.page, r.err = r.page.GetNextPage()
+ if r.err != nil || r.page == nil || len(r.page.Logins) == 0 {
+ return false
+ }
+ }
+ r.cur = r.page.Logins[r.idx]
+ r.run += 1
+ r.idx += 1
+ return true
+}
+
+func (r *LoginsPageAutoPager[T]) Current() T {
+ return r.cur
+}
+
+func (r *LoginsPageAutoPager[T]) Err() error {
+ return r.err
+}
+
+func (r *LoginsPageAutoPager[T]) Index() int {
+ return r.run
+}
+
+type MembersPagePagination struct {
+ NextToken string `json:"nextToken"`
+ JSON membersPagePaginationJSON `json:"-"`
+}
+
+// membersPagePaginationJSON contains the JSON metadata for the struct
+// [MembersPagePagination]
+type membersPagePaginationJSON struct {
+ NextToken apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *MembersPagePagination) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r membersPagePaginationJSON) RawJSON() string {
+ return r.raw
+}
+
+type MembersPage[T any] struct {
+ Members []T `json:"members"`
+ Pagination MembersPagePagination `json:"pagination"`
+ JSON membersPageJSON `json:"-"`
+ cfg *requestconfig.RequestConfig
+ res *http.Response
+}
+
+// membersPageJSON contains the JSON metadata for the struct [MembersPage[T]]
+type membersPageJSON struct {
+ Members apijson.Field
+ Pagination apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *MembersPage[T]) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r membersPageJSON) RawJSON() string {
+ return r.raw
+}
+
+// GetNextPage returns the next page as defined by this pagination style. When
+// there is no next page, this function will return a 'nil' for the page value, but
+// will not return an error
+func (r *MembersPage[T]) GetNextPage() (res *MembersPage[T], err error) {
+ if len(r.Members) == 0 {
+ return nil, nil
+ }
+ next := r.Pagination.NextToken
+ if len(next) == 0 {
+ return nil, nil
+ }
+ cfg := r.cfg.Clone(r.cfg.Context)
+ err = cfg.Apply(option.WithQuery("token", next))
+ if err != nil {
+ return nil, err
+ }
+ var raw *http.Response
+ cfg.ResponseInto = &raw
+ cfg.ResponseBodyInto = &res
+ err = cfg.Execute()
+ if err != nil {
+ return nil, err
+ }
+ res.SetPageConfig(cfg, raw)
+ return res, nil
+}
+
+func (r *MembersPage[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) {
+ if r == nil {
+ r = &MembersPage[T]{}
+ }
+ r.cfg = cfg
+ r.res = res
+}
+
+type MembersPageAutoPager[T any] struct {
+ page *MembersPage[T]
+ cur T
+ idx int
+ run int
+ err error
+}
+
+func NewMembersPageAutoPager[T any](page *MembersPage[T], err error) *MembersPageAutoPager[T] {
+ return &MembersPageAutoPager[T]{
+ page: page,
+ err: err,
+ }
+}
+
+func (r *MembersPageAutoPager[T]) Next() bool {
+ if r.page == nil || len(r.page.Members) == 0 {
+ return false
+ }
+ if r.idx >= len(r.page.Members) {
+ r.idx = 0
+ r.page, r.err = r.page.GetNextPage()
+ if r.err != nil || r.page == nil || len(r.page.Members) == 0 {
+ return false
+ }
+ }
+ r.cur = r.page.Members[r.idx]
+ r.run += 1
+ r.idx += 1
+ return true
+}
+
+func (r *MembersPageAutoPager[T]) Current() T {
+ return r.cur
+}
+
+func (r *MembersPageAutoPager[T]) Err() error {
+ return r.err
+}
+
+func (r *MembersPageAutoPager[T]) Index() int {
+ return r.run
+}
+
+type PersonalAccessTokensPagePagination struct {
+ NextToken string `json:"nextToken"`
+ JSON personalAccessTokensPagePaginationJSON `json:"-"`
+}
+
+// personalAccessTokensPagePaginationJSON contains the JSON metadata for the struct
+// [PersonalAccessTokensPagePagination]
+type personalAccessTokensPagePaginationJSON struct {
+ NextToken apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *PersonalAccessTokensPagePagination) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r personalAccessTokensPagePaginationJSON) RawJSON() string {
+ return r.raw
+}
+
+type PersonalAccessTokensPage[T any] struct {
+ Pagination PersonalAccessTokensPagePagination `json:"pagination"`
+ PersonalAccessTokens []T `json:"personalAccessTokens"`
+ JSON personalAccessTokensPageJSON `json:"-"`
+ cfg *requestconfig.RequestConfig
+ res *http.Response
+}
+
+// personalAccessTokensPageJSON contains the JSON metadata for the struct
+// [PersonalAccessTokensPage[T]]
+type personalAccessTokensPageJSON struct {
+ Pagination apijson.Field
+ PersonalAccessTokens apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *PersonalAccessTokensPage[T]) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r personalAccessTokensPageJSON) RawJSON() string {
+ return r.raw
+}
+
+// GetNextPage returns the next page as defined by this pagination style. When
+// there is no next page, this function will return a 'nil' for the page value, but
+// will not return an error
+func (r *PersonalAccessTokensPage[T]) GetNextPage() (res *PersonalAccessTokensPage[T], err error) {
+ if len(r.PersonalAccessTokens) == 0 {
+ return nil, nil
+ }
+ next := r.Pagination.NextToken
+ if len(next) == 0 {
+ return nil, nil
+ }
+ cfg := r.cfg.Clone(r.cfg.Context)
+ err = cfg.Apply(option.WithQuery("token", next))
+ if err != nil {
+ return nil, err
+ }
+ var raw *http.Response
+ cfg.ResponseInto = &raw
+ cfg.ResponseBodyInto = &res
+ err = cfg.Execute()
+ if err != nil {
+ return nil, err
+ }
+ res.SetPageConfig(cfg, raw)
+ return res, nil
+}
+
+func (r *PersonalAccessTokensPage[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) {
+ if r == nil {
+ r = &PersonalAccessTokensPage[T]{}
+ }
+ r.cfg = cfg
+ r.res = res
+}
+
+type PersonalAccessTokensPageAutoPager[T any] struct {
+ page *PersonalAccessTokensPage[T]
+ cur T
+ idx int
+ run int
+ err error
+}
+
+func NewPersonalAccessTokensPageAutoPager[T any](page *PersonalAccessTokensPage[T], err error) *PersonalAccessTokensPageAutoPager[T] {
+ return &PersonalAccessTokensPageAutoPager[T]{
+ page: page,
+ err: err,
+ }
+}
+
+func (r *PersonalAccessTokensPageAutoPager[T]) Next() bool {
+ if r.page == nil || len(r.page.PersonalAccessTokens) == 0 {
+ return false
+ }
+ if r.idx >= len(r.page.PersonalAccessTokens) {
+ r.idx = 0
+ r.page, r.err = r.page.GetNextPage()
+ if r.err != nil || r.page == nil || len(r.page.PersonalAccessTokens) == 0 {
+ return false
+ }
+ }
+ r.cur = r.page.PersonalAccessTokens[r.idx]
+ r.run += 1
+ r.idx += 1
+ return true
+}
+
+func (r *PersonalAccessTokensPageAutoPager[T]) Current() T {
+ return r.cur
+}
+
+func (r *PersonalAccessTokensPageAutoPager[T]) Err() error {
+ return r.err
+}
+
+func (r *PersonalAccessTokensPageAutoPager[T]) Index() int {
+ return r.run
+}
+
+type PoliciesPagePagination struct {
+ NextToken string `json:"nextToken"`
+ JSON policiesPagePaginationJSON `json:"-"`
+}
+
+// policiesPagePaginationJSON contains the JSON metadata for the struct
+// [PoliciesPagePagination]
+type policiesPagePaginationJSON struct {
+ NextToken apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *PoliciesPagePagination) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r policiesPagePaginationJSON) RawJSON() string {
+ return r.raw
+}
+
+type PoliciesPage[T any] struct {
+ Pagination PoliciesPagePagination `json:"pagination"`
+ Policies []T `json:"policies"`
+ JSON policiesPageJSON `json:"-"`
+ cfg *requestconfig.RequestConfig
+ res *http.Response
+}
+
+// policiesPageJSON contains the JSON metadata for the struct [PoliciesPage[T]]
+type policiesPageJSON struct {
+ Pagination apijson.Field
+ Policies apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *PoliciesPage[T]) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r policiesPageJSON) RawJSON() string {
+ return r.raw
+}
+
+// GetNextPage returns the next page as defined by this pagination style. When
+// there is no next page, this function will return a 'nil' for the page value, but
+// will not return an error
+func (r *PoliciesPage[T]) GetNextPage() (res *PoliciesPage[T], err error) {
+ if len(r.Policies) == 0 {
+ return nil, nil
+ }
+ next := r.Pagination.NextToken
+ if len(next) == 0 {
+ return nil, nil
+ }
+ cfg := r.cfg.Clone(r.cfg.Context)
+ err = cfg.Apply(option.WithQuery("token", next))
+ if err != nil {
+ return nil, err
+ }
+ var raw *http.Response
+ cfg.ResponseInto = &raw
+ cfg.ResponseBodyInto = &res
+ err = cfg.Execute()
+ if err != nil {
+ return nil, err
+ }
+ res.SetPageConfig(cfg, raw)
+ return res, nil
+}
+
+func (r *PoliciesPage[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) {
+ if r == nil {
+ r = &PoliciesPage[T]{}
+ }
+ r.cfg = cfg
+ r.res = res
+}
+
+type PoliciesPageAutoPager[T any] struct {
+ page *PoliciesPage[T]
+ cur T
+ idx int
+ run int
+ err error
+}
+
+func NewPoliciesPageAutoPager[T any](page *PoliciesPage[T], err error) *PoliciesPageAutoPager[T] {
+ return &PoliciesPageAutoPager[T]{
+ page: page,
+ err: err,
+ }
+}
+
+func (r *PoliciesPageAutoPager[T]) Next() bool {
+ if r.page == nil || len(r.page.Policies) == 0 {
+ return false
+ }
+ if r.idx >= len(r.page.Policies) {
+ r.idx = 0
+ r.page, r.err = r.page.GetNextPage()
+ if r.err != nil || r.page == nil || len(r.page.Policies) == 0 {
+ return false
+ }
+ }
+ r.cur = r.page.Policies[r.idx]
+ r.run += 1
+ r.idx += 1
+ return true
+}
+
+func (r *PoliciesPageAutoPager[T]) Current() T {
+ return r.cur
+}
+
+func (r *PoliciesPageAutoPager[T]) Err() error {
+ return r.err
+}
+
+func (r *PoliciesPageAutoPager[T]) Index() int {
+ return r.run
+}
+
+type PrebuildsPagePagination struct {
+ NextToken string `json:"nextToken"`
+ JSON prebuildsPagePaginationJSON `json:"-"`
+}
+
+// prebuildsPagePaginationJSON contains the JSON metadata for the struct
+// [PrebuildsPagePagination]
+type prebuildsPagePaginationJSON struct {
+ NextToken apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *PrebuildsPagePagination) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r prebuildsPagePaginationJSON) RawJSON() string {
+ return r.raw
+}
+
+type PrebuildsPage[T any] struct {
+ Pagination PrebuildsPagePagination `json:"pagination"`
+ Prebuilds []T `json:"prebuilds"`
+ JSON prebuildsPageJSON `json:"-"`
+ cfg *requestconfig.RequestConfig
+ res *http.Response
+}
+
+// prebuildsPageJSON contains the JSON metadata for the struct [PrebuildsPage[T]]
+type prebuildsPageJSON struct {
+ Pagination apijson.Field
+ Prebuilds apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *PrebuildsPage[T]) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r membersPageJSON) RawJSON() string {
+func (r prebuildsPageJSON) RawJSON() string {
return r.raw
}
// GetNextPage returns the next page as defined by this pagination style. When
// there is no next page, this function will return a 'nil' for the page value, but
// will not return an error
-func (r *MembersPage[T]) GetNextPage() (res *MembersPage[T], err error) {
- if len(r.Members) == 0 {
+func (r *PrebuildsPage[T]) GetNextPage() (res *PrebuildsPage[T], err error) {
+ if len(r.Prebuilds) == 0 {
return nil, nil
}
next := r.Pagination.NextToken
@@ -1203,109 +2075,109 @@ func (r *MembersPage[T]) GetNextPage() (res *MembersPage[T], err error) {
return res, nil
}
-func (r *MembersPage[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) {
+func (r *PrebuildsPage[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) {
if r == nil {
- r = &MembersPage[T]{}
+ r = &PrebuildsPage[T]{}
}
r.cfg = cfg
r.res = res
}
-type MembersPageAutoPager[T any] struct {
- page *MembersPage[T]
+type PrebuildsPageAutoPager[T any] struct {
+ page *PrebuildsPage[T]
cur T
idx int
run int
err error
}
-func NewMembersPageAutoPager[T any](page *MembersPage[T], err error) *MembersPageAutoPager[T] {
- return &MembersPageAutoPager[T]{
+func NewPrebuildsPageAutoPager[T any](page *PrebuildsPage[T], err error) *PrebuildsPageAutoPager[T] {
+ return &PrebuildsPageAutoPager[T]{
page: page,
err: err,
}
}
-func (r *MembersPageAutoPager[T]) Next() bool {
- if r.page == nil || len(r.page.Members) == 0 {
+func (r *PrebuildsPageAutoPager[T]) Next() bool {
+ if r.page == nil || len(r.page.Prebuilds) == 0 {
return false
}
- if r.idx >= len(r.page.Members) {
+ if r.idx >= len(r.page.Prebuilds) {
r.idx = 0
r.page, r.err = r.page.GetNextPage()
- if r.err != nil || r.page == nil || len(r.page.Members) == 0 {
+ if r.err != nil || r.page == nil || len(r.page.Prebuilds) == 0 {
return false
}
}
- r.cur = r.page.Members[r.idx]
+ r.cur = r.page.Prebuilds[r.idx]
r.run += 1
r.idx += 1
return true
}
-func (r *MembersPageAutoPager[T]) Current() T {
+func (r *PrebuildsPageAutoPager[T]) Current() T {
return r.cur
}
-func (r *MembersPageAutoPager[T]) Err() error {
+func (r *PrebuildsPageAutoPager[T]) Err() error {
return r.err
}
-func (r *MembersPageAutoPager[T]) Index() int {
+func (r *PrebuildsPageAutoPager[T]) Index() int {
return r.run
}
-type PersonalAccessTokensPagePagination struct {
- NextToken string `json:"nextToken"`
- JSON personalAccessTokensPagePaginationJSON `json:"-"`
+type ProjectEnvironmentClassesPagePagination struct {
+ NextToken string `json:"nextToken"`
+ JSON projectEnvironmentClassesPagePaginationJSON `json:"-"`
}
-// personalAccessTokensPagePaginationJSON contains the JSON metadata for the struct
-// [PersonalAccessTokensPagePagination]
-type personalAccessTokensPagePaginationJSON struct {
+// projectEnvironmentClassesPagePaginationJSON contains the JSON metadata for the
+// struct [ProjectEnvironmentClassesPagePagination]
+type projectEnvironmentClassesPagePaginationJSON struct {
NextToken apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
-func (r *PersonalAccessTokensPagePagination) UnmarshalJSON(data []byte) (err error) {
+func (r *ProjectEnvironmentClassesPagePagination) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r personalAccessTokensPagePaginationJSON) RawJSON() string {
+func (r projectEnvironmentClassesPagePaginationJSON) RawJSON() string {
return r.raw
}
-type PersonalAccessTokensPage[T any] struct {
- Pagination PersonalAccessTokensPagePagination `json:"pagination"`
- PersonalAccessTokens []T `json:"personalAccessTokens"`
- JSON personalAccessTokensPageJSON `json:"-"`
- cfg *requestconfig.RequestConfig
- res *http.Response
+type ProjectEnvironmentClassesPage[T any] struct {
+ Pagination ProjectEnvironmentClassesPagePagination `json:"pagination"`
+ ProjectEnvironmentClasses []T `json:"projectEnvironmentClasses"`
+ JSON projectEnvironmentClassesPageJSON `json:"-"`
+ cfg *requestconfig.RequestConfig
+ res *http.Response
}
-// personalAccessTokensPageJSON contains the JSON metadata for the struct
-// [PersonalAccessTokensPage[T]]
-type personalAccessTokensPageJSON struct {
- Pagination apijson.Field
- PersonalAccessTokens apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
+// projectEnvironmentClassesPageJSON contains the JSON metadata for the struct
+// [ProjectEnvironmentClassesPage[T]]
+type projectEnvironmentClassesPageJSON struct {
+ Pagination apijson.Field
+ ProjectEnvironmentClasses apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
}
-func (r *PersonalAccessTokensPage[T]) UnmarshalJSON(data []byte) (err error) {
+func (r *ProjectEnvironmentClassesPage[T]) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r personalAccessTokensPageJSON) RawJSON() string {
+func (r projectEnvironmentClassesPageJSON) RawJSON() string {
return r.raw
}
// GetNextPage returns the next page as defined by this pagination style. When
// there is no next page, this function will return a 'nil' for the page value, but
// will not return an error
-func (r *PersonalAccessTokensPage[T]) GetNextPage() (res *PersonalAccessTokensPage[T], err error) {
- if len(r.PersonalAccessTokens) == 0 {
+func (r *ProjectEnvironmentClassesPage[T]) GetNextPage() (res *ProjectEnvironmentClassesPage[T], err error) {
+ if len(r.ProjectEnvironmentClasses) == 0 {
return nil, nil
}
next := r.Pagination.NextToken
@@ -1328,108 +2200,108 @@ func (r *PersonalAccessTokensPage[T]) GetNextPage() (res *PersonalAccessTokensPa
return res, nil
}
-func (r *PersonalAccessTokensPage[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) {
+func (r *ProjectEnvironmentClassesPage[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) {
if r == nil {
- r = &PersonalAccessTokensPage[T]{}
+ r = &ProjectEnvironmentClassesPage[T]{}
}
r.cfg = cfg
r.res = res
}
-type PersonalAccessTokensPageAutoPager[T any] struct {
- page *PersonalAccessTokensPage[T]
+type ProjectEnvironmentClassesPageAutoPager[T any] struct {
+ page *ProjectEnvironmentClassesPage[T]
cur T
idx int
run int
err error
}
-func NewPersonalAccessTokensPageAutoPager[T any](page *PersonalAccessTokensPage[T], err error) *PersonalAccessTokensPageAutoPager[T] {
- return &PersonalAccessTokensPageAutoPager[T]{
+func NewProjectEnvironmentClassesPageAutoPager[T any](page *ProjectEnvironmentClassesPage[T], err error) *ProjectEnvironmentClassesPageAutoPager[T] {
+ return &ProjectEnvironmentClassesPageAutoPager[T]{
page: page,
err: err,
}
}
-func (r *PersonalAccessTokensPageAutoPager[T]) Next() bool {
- if r.page == nil || len(r.page.PersonalAccessTokens) == 0 {
+func (r *ProjectEnvironmentClassesPageAutoPager[T]) Next() bool {
+ if r.page == nil || len(r.page.ProjectEnvironmentClasses) == 0 {
return false
}
- if r.idx >= len(r.page.PersonalAccessTokens) {
+ if r.idx >= len(r.page.ProjectEnvironmentClasses) {
r.idx = 0
r.page, r.err = r.page.GetNextPage()
- if r.err != nil || r.page == nil || len(r.page.PersonalAccessTokens) == 0 {
+ if r.err != nil || r.page == nil || len(r.page.ProjectEnvironmentClasses) == 0 {
return false
}
}
- r.cur = r.page.PersonalAccessTokens[r.idx]
+ r.cur = r.page.ProjectEnvironmentClasses[r.idx]
r.run += 1
r.idx += 1
return true
}
-func (r *PersonalAccessTokensPageAutoPager[T]) Current() T {
+func (r *ProjectEnvironmentClassesPageAutoPager[T]) Current() T {
return r.cur
}
-func (r *PersonalAccessTokensPageAutoPager[T]) Err() error {
+func (r *ProjectEnvironmentClassesPageAutoPager[T]) Err() error {
return r.err
}
-func (r *PersonalAccessTokensPageAutoPager[T]) Index() int {
+func (r *ProjectEnvironmentClassesPageAutoPager[T]) Index() int {
return r.run
}
-type PoliciesPagePagination struct {
+type ProjectsPagePagination struct {
NextToken string `json:"nextToken"`
- JSON policiesPagePaginationJSON `json:"-"`
+ JSON projectsPagePaginationJSON `json:"-"`
}
-// policiesPagePaginationJSON contains the JSON metadata for the struct
-// [PoliciesPagePagination]
-type policiesPagePaginationJSON struct {
+// projectsPagePaginationJSON contains the JSON metadata for the struct
+// [ProjectsPagePagination]
+type projectsPagePaginationJSON struct {
NextToken apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
-func (r *PoliciesPagePagination) UnmarshalJSON(data []byte) (err error) {
+func (r *ProjectsPagePagination) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r policiesPagePaginationJSON) RawJSON() string {
+func (r projectsPagePaginationJSON) RawJSON() string {
return r.raw
}
-type PoliciesPage[T any] struct {
- Pagination PoliciesPagePagination `json:"pagination"`
- Policies []T `json:"policies"`
- JSON policiesPageJSON `json:"-"`
+type ProjectsPage[T any] struct {
+ Pagination ProjectsPagePagination `json:"pagination"`
+ Projects []T `json:"projects"`
+ JSON projectsPageJSON `json:"-"`
cfg *requestconfig.RequestConfig
res *http.Response
}
-// policiesPageJSON contains the JSON metadata for the struct [PoliciesPage[T]]
-type policiesPageJSON struct {
+// projectsPageJSON contains the JSON metadata for the struct [ProjectsPage[T]]
+type projectsPageJSON struct {
Pagination apijson.Field
- Policies apijson.Field
+ Projects apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
-func (r *PoliciesPage[T]) UnmarshalJSON(data []byte) (err error) {
+func (r *ProjectsPage[T]) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r policiesPageJSON) RawJSON() string {
+func (r projectsPageJSON) RawJSON() string {
return r.raw
}
// GetNextPage returns the next page as defined by this pagination style. When
// there is no next page, this function will return a 'nil' for the page value, but
// will not return an error
-func (r *PoliciesPage[T]) GetNextPage() (res *PoliciesPage[T], err error) {
- if len(r.Policies) == 0 {
+func (r *ProjectsPage[T]) GetNextPage() (res *ProjectsPage[T], err error) {
+ if len(r.Projects) == 0 {
return nil, nil
}
next := r.Pagination.NextToken
@@ -1452,108 +2324,108 @@ func (r *PoliciesPage[T]) GetNextPage() (res *PoliciesPage[T], err error) {
return res, nil
}
-func (r *PoliciesPage[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) {
+func (r *ProjectsPage[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) {
if r == nil {
- r = &PoliciesPage[T]{}
+ r = &ProjectsPage[T]{}
}
r.cfg = cfg
r.res = res
}
-type PoliciesPageAutoPager[T any] struct {
- page *PoliciesPage[T]
+type ProjectsPageAutoPager[T any] struct {
+ page *ProjectsPage[T]
cur T
idx int
run int
err error
}
-func NewPoliciesPageAutoPager[T any](page *PoliciesPage[T], err error) *PoliciesPageAutoPager[T] {
- return &PoliciesPageAutoPager[T]{
+func NewProjectsPageAutoPager[T any](page *ProjectsPage[T], err error) *ProjectsPageAutoPager[T] {
+ return &ProjectsPageAutoPager[T]{
page: page,
err: err,
}
}
-func (r *PoliciesPageAutoPager[T]) Next() bool {
- if r.page == nil || len(r.page.Policies) == 0 {
+func (r *ProjectsPageAutoPager[T]) Next() bool {
+ if r.page == nil || len(r.page.Projects) == 0 {
return false
}
- if r.idx >= len(r.page.Policies) {
+ if r.idx >= len(r.page.Projects) {
r.idx = 0
r.page, r.err = r.page.GetNextPage()
- if r.err != nil || r.page == nil || len(r.page.Policies) == 0 {
+ if r.err != nil || r.page == nil || len(r.page.Projects) == 0 {
return false
}
}
- r.cur = r.page.Policies[r.idx]
+ r.cur = r.page.Projects[r.idx]
r.run += 1
r.idx += 1
return true
}
-func (r *PoliciesPageAutoPager[T]) Current() T {
+func (r *ProjectsPageAutoPager[T]) Current() T {
return r.cur
}
-func (r *PoliciesPageAutoPager[T]) Err() error {
+func (r *ProjectsPageAutoPager[T]) Err() error {
return r.err
}
-func (r *PoliciesPageAutoPager[T]) Index() int {
+func (r *ProjectsPageAutoPager[T]) Index() int {
return r.run
}
-type ProjectsPagePagination struct {
- NextToken string `json:"nextToken"`
- JSON projectsPagePaginationJSON `json:"-"`
+type PromptsPagePagination struct {
+ NextToken string `json:"nextToken"`
+ JSON promptsPagePaginationJSON `json:"-"`
}
-// projectsPagePaginationJSON contains the JSON metadata for the struct
-// [ProjectsPagePagination]
-type projectsPagePaginationJSON struct {
+// promptsPagePaginationJSON contains the JSON metadata for the struct
+// [PromptsPagePagination]
+type promptsPagePaginationJSON struct {
NextToken apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
-func (r *ProjectsPagePagination) UnmarshalJSON(data []byte) (err error) {
+func (r *PromptsPagePagination) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r projectsPagePaginationJSON) RawJSON() string {
+func (r promptsPagePaginationJSON) RawJSON() string {
return r.raw
}
-type ProjectsPage[T any] struct {
- Pagination ProjectsPagePagination `json:"pagination"`
- Projects []T `json:"projects"`
- JSON projectsPageJSON `json:"-"`
+type PromptsPage[T any] struct {
+ Pagination PromptsPagePagination `json:"pagination"`
+ Prompts []T `json:"prompts"`
+ JSON promptsPageJSON `json:"-"`
cfg *requestconfig.RequestConfig
res *http.Response
}
-// projectsPageJSON contains the JSON metadata for the struct [ProjectsPage[T]]
-type projectsPageJSON struct {
+// promptsPageJSON contains the JSON metadata for the struct [PromptsPage[T]]
+type promptsPageJSON struct {
Pagination apijson.Field
- Projects apijson.Field
+ Prompts apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
-func (r *ProjectsPage[T]) UnmarshalJSON(data []byte) (err error) {
+func (r *PromptsPage[T]) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r projectsPageJSON) RawJSON() string {
+func (r promptsPageJSON) RawJSON() string {
return r.raw
}
// GetNextPage returns the next page as defined by this pagination style. When
// there is no next page, this function will return a 'nil' for the page value, but
// will not return an error
-func (r *ProjectsPage[T]) GetNextPage() (res *ProjectsPage[T], err error) {
- if len(r.Projects) == 0 {
+func (r *PromptsPage[T]) GetNextPage() (res *PromptsPage[T], err error) {
+ if len(r.Prompts) == 0 {
return nil, nil
}
next := r.Pagination.NextToken
@@ -1576,55 +2448,55 @@ func (r *ProjectsPage[T]) GetNextPage() (res *ProjectsPage[T], err error) {
return res, nil
}
-func (r *ProjectsPage[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) {
+func (r *PromptsPage[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) {
if r == nil {
- r = &ProjectsPage[T]{}
+ r = &PromptsPage[T]{}
}
r.cfg = cfg
r.res = res
}
-type ProjectsPageAutoPager[T any] struct {
- page *ProjectsPage[T]
+type PromptsPageAutoPager[T any] struct {
+ page *PromptsPage[T]
cur T
idx int
run int
err error
}
-func NewProjectsPageAutoPager[T any](page *ProjectsPage[T], err error) *ProjectsPageAutoPager[T] {
- return &ProjectsPageAutoPager[T]{
+func NewPromptsPageAutoPager[T any](page *PromptsPage[T], err error) *PromptsPageAutoPager[T] {
+ return &PromptsPageAutoPager[T]{
page: page,
err: err,
}
}
-func (r *ProjectsPageAutoPager[T]) Next() bool {
- if r.page == nil || len(r.page.Projects) == 0 {
+func (r *PromptsPageAutoPager[T]) Next() bool {
+ if r.page == nil || len(r.page.Prompts) == 0 {
return false
}
- if r.idx >= len(r.page.Projects) {
+ if r.idx >= len(r.page.Prompts) {
r.idx = 0
r.page, r.err = r.page.GetNextPage()
- if r.err != nil || r.page == nil || len(r.page.Projects) == 0 {
+ if r.err != nil || r.page == nil || len(r.page.Prompts) == 0 {
return false
}
}
- r.cur = r.page.Projects[r.idx]
+ r.cur = r.page.Prompts[r.idx]
r.run += 1
r.idx += 1
return true
}
-func (r *ProjectsPageAutoPager[T]) Current() T {
+func (r *PromptsPageAutoPager[T]) Current() T {
return r.cur
}
-func (r *ProjectsPageAutoPager[T]) Err() error {
+func (r *PromptsPageAutoPager[T]) Err() error {
return r.err
}
-func (r *ProjectsPageAutoPager[T]) Index() int {
+func (r *PromptsPageAutoPager[T]) Index() int {
return r.run
}
@@ -1752,6 +2624,131 @@ func (r *RecordsPageAutoPager[T]) Index() int {
return r.run
}
+type RepositoriesPagePagination struct {
+ NextToken string `json:"nextToken"`
+ JSON repositoriesPagePaginationJSON `json:"-"`
+}
+
+// repositoriesPagePaginationJSON contains the JSON metadata for the struct
+// [RepositoriesPagePagination]
+type repositoriesPagePaginationJSON struct {
+ NextToken apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *RepositoriesPagePagination) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r repositoriesPagePaginationJSON) RawJSON() string {
+ return r.raw
+}
+
+type RepositoriesPage[T any] struct {
+ Pagination RepositoriesPagePagination `json:"pagination"`
+ Repositories []T `json:"repositories"`
+ JSON repositoriesPageJSON `json:"-"`
+ cfg *requestconfig.RequestConfig
+ res *http.Response
+}
+
+// repositoriesPageJSON contains the JSON metadata for the struct
+// [RepositoriesPage[T]]
+type repositoriesPageJSON struct {
+ Pagination apijson.Field
+ Repositories apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *RepositoriesPage[T]) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r repositoriesPageJSON) RawJSON() string {
+ return r.raw
+}
+
+// GetNextPage returns the next page as defined by this pagination style. When
+// there is no next page, this function will return a 'nil' for the page value, but
+// will not return an error
+func (r *RepositoriesPage[T]) GetNextPage() (res *RepositoriesPage[T], err error) {
+ if len(r.Repositories) == 0 {
+ return nil, nil
+ }
+ next := r.Pagination.NextToken
+ if len(next) == 0 {
+ return nil, nil
+ }
+ cfg := r.cfg.Clone(r.cfg.Context)
+ err = cfg.Apply(option.WithQuery("token", next))
+ if err != nil {
+ return nil, err
+ }
+ var raw *http.Response
+ cfg.ResponseInto = &raw
+ cfg.ResponseBodyInto = &res
+ err = cfg.Execute()
+ if err != nil {
+ return nil, err
+ }
+ res.SetPageConfig(cfg, raw)
+ return res, nil
+}
+
+func (r *RepositoriesPage[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) {
+ if r == nil {
+ r = &RepositoriesPage[T]{}
+ }
+ r.cfg = cfg
+ r.res = res
+}
+
+type RepositoriesPageAutoPager[T any] struct {
+ page *RepositoriesPage[T]
+ cur T
+ idx int
+ run int
+ err error
+}
+
+func NewRepositoriesPageAutoPager[T any](page *RepositoriesPage[T], err error) *RepositoriesPageAutoPager[T] {
+ return &RepositoriesPageAutoPager[T]{
+ page: page,
+ err: err,
+ }
+}
+
+func (r *RepositoriesPageAutoPager[T]) Next() bool {
+ if r.page == nil || len(r.page.Repositories) == 0 {
+ return false
+ }
+ if r.idx >= len(r.page.Repositories) {
+ r.idx = 0
+ r.page, r.err = r.page.GetNextPage()
+ if r.err != nil || r.page == nil || len(r.page.Repositories) == 0 {
+ return false
+ }
+ }
+ r.cur = r.page.Repositories[r.idx]
+ r.run += 1
+ r.idx += 1
+ return true
+}
+
+func (r *RepositoriesPageAutoPager[T]) Current() T {
+ return r.cur
+}
+
+func (r *RepositoriesPageAutoPager[T]) Err() error {
+ return r.err
+}
+
+func (r *RepositoriesPageAutoPager[T]) Index() int {
+ return r.run
+}
+
type RunnersPagePagination struct {
NextToken string `json:"nextToken"`
JSON runnersPagePaginationJSON `json:"-"`
diff --git a/prebuild.go b/prebuild.go
new file mode 100644
index 0000000..5095304
--- /dev/null
+++ b/prebuild.go
@@ -0,0 +1,611 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package gitpod
+
+import (
+ "context"
+ "net/http"
+ "net/url"
+ "slices"
+ "time"
+
+ "github.com/gitpod-io/gitpod-sdk-go/internal/apijson"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/apiquery"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/param"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/requestconfig"
+ "github.com/gitpod-io/gitpod-sdk-go/option"
+ "github.com/gitpod-io/gitpod-sdk-go/packages/pagination"
+ "github.com/gitpod-io/gitpod-sdk-go/shared"
+)
+
+// PrebuildService contains methods and other services that help with interacting
+// with the gitpod API.
+//
+// Note, unlike clients, this service does not read variables from the environment
+// automatically. You should not instantiate this service directly, and instead use
+// the [NewPrebuildService] method instead.
+type PrebuildService struct {
+ Options []option.RequestOption
+}
+
+// NewPrebuildService generates a new service that applies the given options to
+// each request. These options are applied after the parent client's options (if
+// there is one), and before any request-specific options.
+func NewPrebuildService(opts ...option.RequestOption) (r *PrebuildService) {
+ r = &PrebuildService{}
+ r.Options = opts
+ return
+}
+
+// Creates a prebuild for a project.
+//
+// Use this method to:
+//
+// - Create on-demand prebuilds for faster environment startup
+// - Trigger prebuilds after repository changes
+// - Generate prebuilds for specific environment classes
+//
+// The prebuild process creates an environment, runs the devcontainer prebuild
+// lifecycle, and creates a snapshot for future environment provisioning.
+//
+// ### Examples
+//
+// - Create basic prebuild:
+//
+// Creates a prebuild for a project using default settings.
+//
+// ```yaml
+// projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
+// spec:
+// timeout: "3600s" # 60 minutes default
+// ```
+//
+// - Create prebuild with custom environment class:
+//
+// Creates a prebuild with a specific environment class and timeout.
+//
+// ```yaml
+// projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
+// environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
+// spec:
+// timeout: "3600s" # 1 hour
+// ```
+func (r *PrebuildService) New(ctx context.Context, body PrebuildNewParams, opts ...option.RequestOption) (res *PrebuildNewResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.PrebuildService/CreatePrebuild"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Gets details about a specific prebuild.
+//
+// Use this method to:
+//
+// - Check prebuild status and progress
+// - Access prebuild logs for debugging
+//
+// ### Examples
+//
+// - Get prebuild details:
+//
+// Retrieves comprehensive information about a prebuild.
+//
+// ```yaml
+// prebuildId: "07e03a28-65a5-4d98-b532-8ea67b188048"
+// ```
+func (r *PrebuildService) Get(ctx context.Context, body PrebuildGetParams, opts ...option.RequestOption) (res *PrebuildGetResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.PrebuildService/GetPrebuild"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// ListPrebuilds
+func (r *PrebuildService) List(ctx context.Context, params PrebuildListParams, opts ...option.RequestOption) (res *pagination.PrebuildsPage[Prebuild], err error) {
+ var raw *http.Response
+ opts = slices.Concat(r.Options, opts)
+ opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
+ path := "gitpod.v1.PrebuildService/ListPrebuilds"
+ cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...)
+ if err != nil {
+ return nil, err
+ }
+ err = cfg.Execute()
+ if err != nil {
+ return nil, err
+ }
+ res.SetPageConfig(cfg, raw)
+ return res, nil
+}
+
+// ListPrebuilds
+func (r *PrebuildService) ListAutoPaging(ctx context.Context, params PrebuildListParams, opts ...option.RequestOption) *pagination.PrebuildsPageAutoPager[Prebuild] {
+ return pagination.NewPrebuildsPageAutoPager(r.List(ctx, params, opts...))
+}
+
+// Deletes a prebuild.
+//
+// Prebuilds are automatically deleted after some time. Use this method to manually
+// delete a prebuild before automatic cleanup, for example to remove a prebuild
+// that should no longer be used.
+//
+// Deletion is processed asynchronously. The prebuild will be marked for deletion
+// and removed from the system in the background.
+//
+// ### Examples
+//
+// - Delete prebuild:
+//
+// Marks a prebuild for deletion and removes it from the system.
+//
+// ```yaml
+// prebuildId: "07e03a28-65a5-4d98-b532-8ea67b188048"
+// ```
+func (r *PrebuildService) Delete(ctx context.Context, body PrebuildDeleteParams, opts ...option.RequestOption) (res *PrebuildDeleteResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.PrebuildService/DeletePrebuild"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Cancels a running prebuild.
+//
+// Use this method to:
+//
+// - Stop prebuilds that are no longer needed
+// - Free up resources for other operations
+//
+// ### Examples
+//
+// - Cancel prebuild:
+//
+// Stops a running prebuild and cleans up resources.
+//
+// ```yaml
+// prebuildId: "07e03a28-65a5-4d98-b532-8ea67b188048"
+// ```
+func (r *PrebuildService) Cancel(ctx context.Context, body PrebuildCancelParams, opts ...option.RequestOption) (res *PrebuildCancelResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.PrebuildService/CancelPrebuild"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Creates a logs access token for a prebuild.
+//
+// Use this method to:
+//
+// - Stream logs from a running prebuild
+// - Access archived logs from completed prebuilds
+//
+// Generated tokens are valid for one hour.
+//
+// ### Examples
+//
+// - Create prebuild logs token:
+//
+// Generates a token for accessing prebuild logs.
+//
+// ```yaml
+// prebuildId: "07e03a28-65a5-4d98-b532-8ea67b188048"
+// ```
+func (r *PrebuildService) NewLogsToken(ctx context.Context, body PrebuildNewLogsTokenParams, opts ...option.RequestOption) (res *PrebuildNewLogsTokenResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.PrebuildService/CreatePrebuildLogsToken"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Prebuild represents a prebuild for a project that creates a snapshot for faster
+// environment startup times.
+type Prebuild struct {
+ // metadata contains organizational and ownership information
+ Metadata PrebuildMetadata `json:"metadata,required"`
+ // spec contains the configuration used to create this prebuild
+ Spec PrebuildSpec `json:"spec,required"`
+ // status contains the current status and progress of the prebuild
+ Status PrebuildStatus `json:"status,required"`
+ // id is the unique identifier for the prebuild
+ ID string `json:"id" format:"uuid"`
+ JSON prebuildJSON `json:"-"`
+}
+
+// prebuildJSON contains the JSON metadata for the struct [Prebuild]
+type prebuildJSON struct {
+ Metadata apijson.Field
+ Spec apijson.Field
+ Status apijson.Field
+ ID apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *Prebuild) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r prebuildJSON) RawJSON() string {
+ return r.raw
+}
+
+// PrebuildMetadata contains metadata about the prebuild
+type PrebuildMetadata struct {
+ // created_at is when the prebuild was created
+ CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
+ // creator is the identity of who created the prebuild. For manual prebuilds, this
+ // is the user who triggered it. For scheduled prebuilds, this is the configured
+ // executor.
+ Creator shared.Subject `json:"creator,required"`
+ // updated_at is when the prebuild was last updated
+ UpdatedAt time.Time `json:"updatedAt,required" format:"date-time"`
+ // environment_class_id is the environment class used to create this prebuild.
+ // While the prebuild is created with a specific environment class, environments
+ // with different classes (e.g., smaller or larger instance sizes) can be created
+ // from the same prebuild, as long as they run on the same runner. If not specified
+ // in create requests, uses the project's default environment class.
+ EnvironmentClassID string `json:"environmentClassId" format:"uuid"`
+ // executor is the identity used to run the prebuild. The executor's SCM
+ // credentials are used to clone the repository. If not set, the creator's identity
+ // is used.
+ Executor shared.Subject `json:"executor"`
+ // organization_id is the ID of the organization that owns the prebuild
+ OrganizationID string `json:"organizationId" format:"uuid"`
+ // project_id is the ID of the project this prebuild was created for
+ ProjectID string `json:"projectId" format:"uuid"`
+ // trigger describes the trigger that created this prebuild.
+ TriggeredBy PrebuildTrigger `json:"triggeredBy"`
+ JSON prebuildMetadataJSON `json:"-"`
+}
+
+// prebuildMetadataJSON contains the JSON metadata for the struct
+// [PrebuildMetadata]
+type prebuildMetadataJSON struct {
+ CreatedAt apijson.Field
+ Creator apijson.Field
+ UpdatedAt apijson.Field
+ EnvironmentClassID apijson.Field
+ Executor apijson.Field
+ OrganizationID apijson.Field
+ ProjectID apijson.Field
+ TriggeredBy apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *PrebuildMetadata) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r prebuildMetadataJSON) RawJSON() string {
+ return r.raw
+}
+
+// PrebuildPhase represents the lifecycle phase of a prebuild
+type PrebuildPhase string
+
+const (
+ PrebuildPhaseUnspecified PrebuildPhase = "PREBUILD_PHASE_UNSPECIFIED"
+ PrebuildPhasePending PrebuildPhase = "PREBUILD_PHASE_PENDING"
+ PrebuildPhaseStarting PrebuildPhase = "PREBUILD_PHASE_STARTING"
+ PrebuildPhaseRunning PrebuildPhase = "PREBUILD_PHASE_RUNNING"
+ PrebuildPhaseStopping PrebuildPhase = "PREBUILD_PHASE_STOPPING"
+ PrebuildPhaseSnapshotting PrebuildPhase = "PREBUILD_PHASE_SNAPSHOTTING"
+ PrebuildPhaseCompleted PrebuildPhase = "PREBUILD_PHASE_COMPLETED"
+ PrebuildPhaseFailed PrebuildPhase = "PREBUILD_PHASE_FAILED"
+ PrebuildPhaseCancelling PrebuildPhase = "PREBUILD_PHASE_CANCELLING"
+ PrebuildPhaseCancelled PrebuildPhase = "PREBUILD_PHASE_CANCELLED"
+ PrebuildPhaseDeleting PrebuildPhase = "PREBUILD_PHASE_DELETING"
+ PrebuildPhaseDeleted PrebuildPhase = "PREBUILD_PHASE_DELETED"
+)
+
+func (r PrebuildPhase) IsKnown() bool {
+ switch r {
+ case PrebuildPhaseUnspecified, PrebuildPhasePending, PrebuildPhaseStarting, PrebuildPhaseRunning, PrebuildPhaseStopping, PrebuildPhaseSnapshotting, PrebuildPhaseCompleted, PrebuildPhaseFailed, PrebuildPhaseCancelling, PrebuildPhaseCancelled, PrebuildPhaseDeleting, PrebuildPhaseDeleted:
+ return true
+ }
+ return false
+}
+
+// PrebuildSpec contains the configuration used to create a prebuild
+type PrebuildSpec struct {
+ // desired_phase is the desired phase of the prebuild. Used to signal cancellation
+ // or other state changes. This field is managed by the API and reconciler.
+ DesiredPhase PrebuildPhase `json:"desiredPhase"`
+ // spec_version is incremented each time the spec is updated. Used for optimistic
+ // concurrency control.
+ SpecVersion string `json:"specVersion"`
+ // timeout is the maximum time allowed for the prebuild to complete. Defaults to 60
+ // minutes if not specified. Maximum allowed timeout is 2 hours.
+ Timeout string `json:"timeout" format:"regex"`
+ JSON prebuildSpecJSON `json:"-"`
+}
+
+// prebuildSpecJSON contains the JSON metadata for the struct [PrebuildSpec]
+type prebuildSpecJSON struct {
+ DesiredPhase apijson.Field
+ SpecVersion apijson.Field
+ Timeout apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *PrebuildSpec) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r prebuildSpecJSON) RawJSON() string {
+ return r.raw
+}
+
+// PrebuildSpec contains the configuration used to create a prebuild
+type PrebuildSpecParam struct {
+ // desired_phase is the desired phase of the prebuild. Used to signal cancellation
+ // or other state changes. This field is managed by the API and reconciler.
+ DesiredPhase param.Field[PrebuildPhase] `json:"desiredPhase"`
+ // spec_version is incremented each time the spec is updated. Used for optimistic
+ // concurrency control.
+ SpecVersion param.Field[string] `json:"specVersion"`
+ // timeout is the maximum time allowed for the prebuild to complete. Defaults to 60
+ // minutes if not specified. Maximum allowed timeout is 2 hours.
+ Timeout param.Field[string] `json:"timeout" format:"regex"`
+}
+
+func (r PrebuildSpecParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// PrebuildStatus contains the current status and progress of a prebuild
+type PrebuildStatus struct {
+ // phase is the current phase of the prebuild lifecycle
+ Phase PrebuildPhase `json:"phase,required"`
+ // completion_time is when the prebuild completed (successfully or with failure)
+ CompletionTime time.Time `json:"completionTime" format:"date-time"`
+ // environment_id is the ID of the environment used to create this prebuild. This
+ // field is set when the prebuild environment is created.
+ EnvironmentID string `json:"environmentId" format:"uuid"`
+ // failure_message contains details about why the prebuild failed
+ FailureMessage string `json:"failureMessage"`
+ // log_url provides access to prebuild logs. During prebuild execution, this
+ // references the environment logs. After completion, this may reference archived
+ // logs.
+ LogURL string `json:"logUrl" format:"uri"`
+ // status_version is incremented each time the status is updated. Used for
+ // optimistic concurrency control.
+ StatusVersion string `json:"statusVersion"`
+ // warning_message contains warnings from the prebuild environment that indicate
+ // something went wrong but the prebuild could still complete. For example, the
+ // devcontainer failed to build but the environment is still usable. These warnings
+ // will likely affect any environment started from this prebuild.
+ WarningMessage string `json:"warningMessage"`
+ JSON prebuildStatusJSON `json:"-"`
+}
+
+// prebuildStatusJSON contains the JSON metadata for the struct [PrebuildStatus]
+type prebuildStatusJSON struct {
+ Phase apijson.Field
+ CompletionTime apijson.Field
+ EnvironmentID apijson.Field
+ FailureMessage apijson.Field
+ LogURL apijson.Field
+ StatusVersion apijson.Field
+ WarningMessage apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *PrebuildStatus) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r prebuildStatusJSON) RawJSON() string {
+ return r.raw
+}
+
+// PrebuildTrigger indicates how the prebuild was triggered
+type PrebuildTrigger string
+
+const (
+ PrebuildTriggerUnspecified PrebuildTrigger = "PREBUILD_TRIGGER_UNSPECIFIED"
+ PrebuildTriggerManual PrebuildTrigger = "PREBUILD_TRIGGER_MANUAL"
+ PrebuildTriggerScheduled PrebuildTrigger = "PREBUILD_TRIGGER_SCHEDULED"
+)
+
+func (r PrebuildTrigger) IsKnown() bool {
+ switch r {
+ case PrebuildTriggerUnspecified, PrebuildTriggerManual, PrebuildTriggerScheduled:
+ return true
+ }
+ return false
+}
+
+type PrebuildNewResponse struct {
+ // Prebuild represents a prebuild for a project that creates a snapshot for faster
+ // environment startup times.
+ Prebuild Prebuild `json:"prebuild,required"`
+ JSON prebuildNewResponseJSON `json:"-"`
+}
+
+// prebuildNewResponseJSON contains the JSON metadata for the struct
+// [PrebuildNewResponse]
+type prebuildNewResponseJSON struct {
+ Prebuild apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *PrebuildNewResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r prebuildNewResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+type PrebuildGetResponse struct {
+ // Prebuild represents a prebuild for a project that creates a snapshot for faster
+ // environment startup times.
+ Prebuild Prebuild `json:"prebuild,required"`
+ JSON prebuildGetResponseJSON `json:"-"`
+}
+
+// prebuildGetResponseJSON contains the JSON metadata for the struct
+// [PrebuildGetResponse]
+type prebuildGetResponseJSON struct {
+ Prebuild apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *PrebuildGetResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r prebuildGetResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+type PrebuildDeleteResponse = interface{}
+
+type PrebuildCancelResponse struct {
+ // Prebuild represents a prebuild for a project that creates a snapshot for faster
+ // environment startup times.
+ Prebuild Prebuild `json:"prebuild,required"`
+ JSON prebuildCancelResponseJSON `json:"-"`
+}
+
+// prebuildCancelResponseJSON contains the JSON metadata for the struct
+// [PrebuildCancelResponse]
+type prebuildCancelResponseJSON struct {
+ Prebuild apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *PrebuildCancelResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r prebuildCancelResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+type PrebuildNewLogsTokenResponse struct {
+ // access_token is the token that can be used to access the logs of the prebuild
+ AccessToken string `json:"accessToken,required"`
+ JSON prebuildNewLogsTokenResponseJSON `json:"-"`
+}
+
+// prebuildNewLogsTokenResponseJSON contains the JSON metadata for the struct
+// [PrebuildNewLogsTokenResponse]
+type prebuildNewLogsTokenResponseJSON struct {
+ AccessToken apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *PrebuildNewLogsTokenResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r prebuildNewLogsTokenResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+type PrebuildNewParams struct {
+ // project_id specifies the project to create a prebuild for
+ ProjectID param.Field[string] `json:"projectId,required" format:"uuid"`
+ // spec contains the configuration for creating the prebuild
+ Spec param.Field[PrebuildSpecParam] `json:"spec,required"`
+ // environment_class_id specifies which environment class to use for the prebuild.
+ // If not specified, uses the project's default environment class.
+ EnvironmentClassID param.Field[string] `json:"environmentClassId" format:"uuid"`
+}
+
+func (r PrebuildNewParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type PrebuildGetParams struct {
+ // prebuild_id specifies the prebuild to retrieve
+ PrebuildID param.Field[string] `json:"prebuildId,required" format:"uuid"`
+}
+
+func (r PrebuildGetParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type PrebuildListParams struct {
+ Token param.Field[string] `query:"token"`
+ PageSize param.Field[int64] `query:"pageSize"`
+ // filter contains the filter options for listing prebuilds
+ Filter param.Field[PrebuildListParamsFilter] `json:"filter"`
+ // pagination contains the pagination options for listing prebuilds
+ Pagination param.Field[PrebuildListParamsPagination] `json:"pagination"`
+}
+
+func (r PrebuildListParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// URLQuery serializes [PrebuildListParams]'s query parameters as `url.Values`.
+func (r PrebuildListParams) URLQuery() (v url.Values) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatComma,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
+
+// filter contains the filter options for listing prebuilds
+type PrebuildListParamsFilter struct {
+ // phases filters prebuilds by their current phase
+ Phases param.Field[[]PrebuildPhase] `json:"phases"`
+ // project_ids filters prebuilds to specific projects
+ ProjectIDs param.Field[[]string] `json:"projectIds" format:"uuid"`
+}
+
+func (r PrebuildListParamsFilter) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// pagination contains the pagination options for listing prebuilds
+type PrebuildListParamsPagination struct {
+ // Token for the next set of results that was returned as next_token of a
+ // PaginationResponse
+ Token param.Field[string] `json:"token"`
+ // Page size is the maximum number of results to retrieve per page. Defaults to 25.
+ // Maximum 100.
+ PageSize param.Field[int64] `json:"pageSize"`
+}
+
+func (r PrebuildListParamsPagination) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type PrebuildDeleteParams struct {
+ // prebuild_id specifies the prebuild to delete
+ PrebuildID param.Field[string] `json:"prebuildId,required" format:"uuid"`
+}
+
+func (r PrebuildDeleteParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type PrebuildCancelParams struct {
+ // prebuild_id specifies the prebuild to cancel
+ PrebuildID param.Field[string] `json:"prebuildId,required" format:"uuid"`
+}
+
+func (r PrebuildCancelParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type PrebuildNewLogsTokenParams struct {
+ // prebuild_id specifies the prebuild for which the logs token should be created.
+ //
+ // +required
+ PrebuildID param.Field[string] `json:"prebuildId,required" format:"uuid"`
+}
+
+func (r PrebuildNewLogsTokenParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
diff --git a/prebuild_test.go b/prebuild_test.go
new file mode 100644
index 0000000..4fcdd11
--- /dev/null
+++ b/prebuild_test.go
@@ -0,0 +1,179 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package gitpod_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+
+ "github.com/gitpod-io/gitpod-sdk-go"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/testutil"
+ "github.com/gitpod-io/gitpod-sdk-go/option"
+)
+
+func TestPrebuildNewWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Prebuilds.New(context.TODO(), gitpod.PrebuildNewParams{
+ ProjectID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
+ Spec: gitpod.F(gitpod.PrebuildSpecParam{
+ DesiredPhase: gitpod.F(gitpod.PrebuildPhaseUnspecified),
+ SpecVersion: gitpod.F("specVersion"),
+ Timeout: gitpod.F("3600s"),
+ }),
+ EnvironmentClassID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestPrebuildGet(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Prebuilds.Get(context.TODO(), gitpod.PrebuildGetParams{
+ PrebuildID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestPrebuildListWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Prebuilds.List(context.TODO(), gitpod.PrebuildListParams{
+ Token: gitpod.F("token"),
+ PageSize: gitpod.F(int64(0)),
+ Filter: gitpod.F(gitpod.PrebuildListParamsFilter{
+ Phases: gitpod.F([]gitpod.PrebuildPhase{gitpod.PrebuildPhaseUnspecified}),
+ ProjectIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
+ }),
+ Pagination: gitpod.F(gitpod.PrebuildListParamsPagination{
+ Token: gitpod.F("token"),
+ PageSize: gitpod.F(int64(100)),
+ }),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestPrebuildDelete(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Prebuilds.Delete(context.TODO(), gitpod.PrebuildDeleteParams{
+ PrebuildID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestPrebuildCancel(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Prebuilds.Cancel(context.TODO(), gitpod.PrebuildCancelParams{
+ PrebuildID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestPrebuildNewLogsToken(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Prebuilds.NewLogsToken(context.TODO(), gitpod.PrebuildNewLogsTokenParams{
+ PrebuildID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/project.go b/project.go
index ccc8de5..d152d8a 100644
--- a/project.go
+++ b/project.go
@@ -25,8 +25,9 @@ import (
// automatically. You should not instantiate this service directly, and instead use
// the [NewProjectService] method instead.
type ProjectService struct {
- Options []option.RequestOption
- Policies *ProjectPolicyService
+ Options []option.RequestOption
+ EnvironmentClases *ProjectEnvironmentClaseService
+ Policies *ProjectPolicyService
}
// NewProjectService generates a new service that applies the given options to each
@@ -35,6 +36,7 @@ type ProjectService struct {
func NewProjectService(opts ...option.RequestOption) (r *ProjectService) {
r = &ProjectService{}
r.Options = opts
+ r.EnvironmentClases = NewProjectEnvironmentClaseService(opts...)
r.Policies = NewProjectPolicyService(opts...)
return
}
@@ -56,8 +58,6 @@ func NewProjectService(opts ...option.RequestOption) (r *ProjectService) {
//
// ```yaml
// name: "Web Application"
-// environmentClass:
-// environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
// initializer:
// specs:
// - git:
@@ -70,8 +70,6 @@ func NewProjectService(opts ...option.RequestOption) (r *ProjectService) {
//
// ```yaml
// name: "Backend Service"
-// environmentClass:
-// environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
// initializer:
// specs:
// - git:
@@ -118,6 +116,7 @@ func (r *ProjectService) Get(ctx context.Context, body ProjectGetParams, opts ..
// - Update environment class
// - Change project name
// - Configure initializers
+// - Configure prebuild settings
//
// ### Examples
//
@@ -130,14 +129,20 @@ func (r *ProjectService) Get(ctx context.Context, body ProjectGetParams, opts ..
// name: "New Project Name"
// ```
//
-// - Update environment class:
+// - Enable prebuilds with daily schedule:
//
-// Changes the project's environment class.
+// Configures prebuilds to run daily at 2 AM UTC.
//
// ```yaml
// projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
-// environmentClass:
-// environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
+// prebuildConfiguration:
+// enabled: true
+// environmentClassIds:
+// - "b0e12f6c-4c67-429d-a4a6-d9838b5da041"
+// timeout: "3600s"
+// trigger:
+// dailySchedule:
+// hourUtc: 2
// ```
func (r *ProjectService) Update(ctx context.Context, body ProjectUpdateParams, opts ...option.RequestOption) (res *ProjectUpdateResponse, err error) {
opts = slices.Concat(r.Options, opts)
@@ -362,11 +367,12 @@ const (
EnvironmentInitializerSpecsGitTargetModeCloneTargetModeRemoteCommit EnvironmentInitializerSpecsGitTargetMode = "CLONE_TARGET_MODE_REMOTE_COMMIT"
EnvironmentInitializerSpecsGitTargetModeCloneTargetModeRemoteBranch EnvironmentInitializerSpecsGitTargetMode = "CLONE_TARGET_MODE_REMOTE_BRANCH"
EnvironmentInitializerSpecsGitTargetModeCloneTargetModeLocalBranch EnvironmentInitializerSpecsGitTargetMode = "CLONE_TARGET_MODE_LOCAL_BRANCH"
+ EnvironmentInitializerSpecsGitTargetModeCloneTargetModeRemoteTag EnvironmentInitializerSpecsGitTargetMode = "CLONE_TARGET_MODE_REMOTE_TAG"
)
func (r EnvironmentInitializerSpecsGitTargetMode) IsKnown() bool {
switch r {
- case EnvironmentInitializerSpecsGitTargetModeCloneTargetModeUnspecified, EnvironmentInitializerSpecsGitTargetModeCloneTargetModeRemoteHead, EnvironmentInitializerSpecsGitTargetModeCloneTargetModeRemoteCommit, EnvironmentInitializerSpecsGitTargetModeCloneTargetModeRemoteBranch, EnvironmentInitializerSpecsGitTargetModeCloneTargetModeLocalBranch:
+ case EnvironmentInitializerSpecsGitTargetModeCloneTargetModeUnspecified, EnvironmentInitializerSpecsGitTargetModeCloneTargetModeRemoteHead, EnvironmentInitializerSpecsGitTargetModeCloneTargetModeRemoteCommit, EnvironmentInitializerSpecsGitTargetModeCloneTargetModeRemoteBranch, EnvironmentInitializerSpecsGitTargetModeCloneTargetModeLocalBranch, EnvironmentInitializerSpecsGitTargetModeCloneTargetModeRemoteTag:
return true
}
return false
@@ -417,18 +423,28 @@ func (r EnvironmentInitializerSpecsGitParam) MarshalJSON() (data []byte, err err
}
type Project struct {
- EnvironmentClass ProjectEnvironmentClass `json:"environmentClass,required"`
+ // Use `environment_classes` instead.
+ //
+ // Deprecated: deprecated
+ EnvironmentClass shared.ProjectEnvironmentClass `json:"environmentClass,required"`
// id is the unique identifier for the project
ID string `json:"id" format:"uuid"`
// automations_file_path is the path to the automations file relative to the repo
// root
AutomationsFilePath string `json:"automationsFilePath"`
+ // desired_phase is the desired phase of the project When set to DELETED, the
+ // project is pending deletion
+ DesiredPhase ProjectPhase `json:"desiredPhase"`
// devcontainer_file_path is the path to the devcontainer file relative to the repo
// root
DevcontainerFilePath string `json:"devcontainerFilePath"`
+ // environment_classes is the list of environment classes for the project
+ EnvironmentClasses []shared.ProjectEnvironmentClass `json:"environmentClasses"`
// initializer is the content initializer
Initializer EnvironmentInitializer `json:"initializer"`
Metadata ProjectMetadata `json:"metadata"`
+ // prebuild_configuration defines how prebuilds are created for this project.
+ PrebuildConfiguration ProjectPrebuildConfiguration `json:"prebuildConfiguration"`
// technical_description is a detailed technical description of the project This
// field is not returned by default in GetProject or ListProjects responses
TechnicalDescription string `json:"technicalDescription"`
@@ -438,16 +454,19 @@ type Project struct {
// projectJSON contains the JSON metadata for the struct [Project]
type projectJSON struct {
- EnvironmentClass apijson.Field
- ID apijson.Field
- AutomationsFilePath apijson.Field
- DevcontainerFilePath apijson.Field
- Initializer apijson.Field
- Metadata apijson.Field
- TechnicalDescription apijson.Field
- UsedBy apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
+ EnvironmentClass apijson.Field
+ ID apijson.Field
+ AutomationsFilePath apijson.Field
+ DesiredPhase apijson.Field
+ DevcontainerFilePath apijson.Field
+ EnvironmentClasses apijson.Field
+ Initializer apijson.Field
+ Metadata apijson.Field
+ PrebuildConfiguration apijson.Field
+ TechnicalDescription apijson.Field
+ UsedBy apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
}
func (r *Project) UnmarshalJSON(data []byte) (err error) {
@@ -483,44 +502,6 @@ func (r projectUsedByJSON) RawJSON() string {
return r.raw
}
-type ProjectEnvironmentClass struct {
- // Use a fixed environment class on a given Runner. This cannot be a local runner's
- // environment class.
- EnvironmentClassID string `json:"environmentClassId" format:"uuid"`
- // Use a local runner for the user
- LocalRunner bool `json:"localRunner"`
- JSON projectEnvironmentClassJSON `json:"-"`
-}
-
-// projectEnvironmentClassJSON contains the JSON metadata for the struct
-// [ProjectEnvironmentClass]
-type projectEnvironmentClassJSON struct {
- EnvironmentClassID apijson.Field
- LocalRunner apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
-}
-
-func (r *ProjectEnvironmentClass) UnmarshalJSON(data []byte) (err error) {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func (r projectEnvironmentClassJSON) RawJSON() string {
- return r.raw
-}
-
-type ProjectEnvironmentClassParam struct {
- // Use a fixed environment class on a given Runner. This cannot be a local runner's
- // environment class.
- EnvironmentClassID param.Field[string] `json:"environmentClassId" format:"uuid"`
- // Use a local runner for the user
- LocalRunner param.Field[bool] `json:"localRunner"`
-}
-
-func (r ProjectEnvironmentClassParam) MarshalJSON() (data []byte, err error) {
- return apijson.MarshalRoot(r)
-}
-
type ProjectMetadata struct {
// A Timestamp represents a point in time independent of any time zone or local
// calendar, encoded as a count of seconds and fractions of seconds at nanosecond
@@ -728,6 +709,168 @@ func (r projectMetadataJSON) RawJSON() string {
return r.raw
}
+type ProjectPhase string
+
+const (
+ ProjectPhaseUnspecified ProjectPhase = "PROJECT_PHASE_UNSPECIFIED"
+ ProjectPhaseActive ProjectPhase = "PROJECT_PHASE_ACTIVE"
+ ProjectPhaseDeleted ProjectPhase = "PROJECT_PHASE_DELETED"
+)
+
+func (r ProjectPhase) IsKnown() bool {
+ switch r {
+ case ProjectPhaseUnspecified, ProjectPhaseActive, ProjectPhaseDeleted:
+ return true
+ }
+ return false
+}
+
+// ProjectPrebuildConfiguration defines how prebuilds are created for a project.
+// Prebuilds create environment snapshots that enable faster environment startup
+// times.
+type ProjectPrebuildConfiguration struct {
+ // enabled controls whether prebuilds are created for this project. When disabled,
+ // no automatic prebuilds will be triggered.
+ Enabled bool `json:"enabled"`
+ // enable_jetbrains_warmup controls whether JetBrains IDE warmup runs during
+ // prebuilds.
+ EnableJetbrainsWarmup bool `json:"enableJetbrainsWarmup"`
+ // environment_class_ids specifies which environment classes should have prebuilds
+ // created. If empty, no prebuilds are created.
+ EnvironmentClassIDs []string `json:"environmentClassIds" format:"uuid"`
+ // executor specifies who runs prebuilds for this project. The executor's SCM
+ // credentials are used to clone the repository. If not set, defaults to the
+ // project creator.
+ Executor shared.Subject `json:"executor"`
+ // 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.
+ Timeout string `json:"timeout" format:"regex"`
+ // trigger defines when prebuilds should be created.
+ Trigger ProjectPrebuildConfigurationTrigger `json:"trigger"`
+ JSON projectPrebuildConfigurationJSON `json:"-"`
+}
+
+// projectPrebuildConfigurationJSON contains the JSON metadata for the struct
+// [ProjectPrebuildConfiguration]
+type projectPrebuildConfigurationJSON struct {
+ Enabled apijson.Field
+ EnableJetbrainsWarmup apijson.Field
+ EnvironmentClassIDs apijson.Field
+ Executor apijson.Field
+ Timeout apijson.Field
+ Trigger apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *ProjectPrebuildConfiguration) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r projectPrebuildConfigurationJSON) RawJSON() string {
+ return r.raw
+}
+
+// trigger defines when prebuilds should be created.
+type ProjectPrebuildConfigurationTrigger struct {
+ // daily_schedule triggers a prebuild once per day at the specified hour (UTC). The
+ // actual start time may vary slightly to distribute system load.
+ DailySchedule ProjectPrebuildConfigurationTriggerDailySchedule `json:"dailySchedule,required"`
+ JSON projectPrebuildConfigurationTriggerJSON `json:"-"`
+}
+
+// projectPrebuildConfigurationTriggerJSON contains the JSON metadata for the
+// struct [ProjectPrebuildConfigurationTrigger]
+type projectPrebuildConfigurationTriggerJSON struct {
+ DailySchedule apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *ProjectPrebuildConfigurationTrigger) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r projectPrebuildConfigurationTriggerJSON) RawJSON() string {
+ return r.raw
+}
+
+// daily_schedule triggers a prebuild once per day at the specified hour (UTC). The
+// actual start time may vary slightly to distribute system load.
+type ProjectPrebuildConfigurationTriggerDailySchedule struct {
+ // hour_utc is the hour of day (0-23) in UTC when the prebuild should start. The
+ // actual start time may be adjusted by a few minutes to balance system load.
+ HourUtc int64 `json:"hourUtc"`
+ JSON projectPrebuildConfigurationTriggerDailyScheduleJSON `json:"-"`
+}
+
+// projectPrebuildConfigurationTriggerDailyScheduleJSON contains the JSON metadata
+// for the struct [ProjectPrebuildConfigurationTriggerDailySchedule]
+type projectPrebuildConfigurationTriggerDailyScheduleJSON struct {
+ HourUtc apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *ProjectPrebuildConfigurationTriggerDailySchedule) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r projectPrebuildConfigurationTriggerDailyScheduleJSON) RawJSON() string {
+ return r.raw
+}
+
+// ProjectPrebuildConfiguration defines how prebuilds are created for a project.
+// Prebuilds create environment snapshots that enable faster environment startup
+// times.
+type ProjectPrebuildConfigurationParam struct {
+ // enabled controls whether prebuilds are created for this project. When disabled,
+ // no automatic prebuilds will be triggered.
+ Enabled param.Field[bool] `json:"enabled"`
+ // enable_jetbrains_warmup controls whether JetBrains IDE warmup runs during
+ // prebuilds.
+ EnableJetbrainsWarmup param.Field[bool] `json:"enableJetbrainsWarmup"`
+ // environment_class_ids specifies which environment classes should have prebuilds
+ // created. If empty, no prebuilds are created.
+ EnvironmentClassIDs param.Field[[]string] `json:"environmentClassIds" format:"uuid"`
+ // executor specifies who runs prebuilds for this project. The executor's SCM
+ // credentials are used to clone the repository. If not set, defaults to the
+ // project creator.
+ Executor param.Field[shared.SubjectParam] `json:"executor"`
+ // 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.
+ Timeout param.Field[string] `json:"timeout" format:"regex"`
+ // trigger defines when prebuilds should be created.
+ Trigger param.Field[ProjectPrebuildConfigurationTriggerParam] `json:"trigger"`
+}
+
+func (r ProjectPrebuildConfigurationParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// trigger defines when prebuilds should be created.
+type ProjectPrebuildConfigurationTriggerParam struct {
+ // daily_schedule triggers a prebuild once per day at the specified hour (UTC). The
+ // actual start time may vary slightly to distribute system load.
+ DailySchedule param.Field[ProjectPrebuildConfigurationTriggerDailyScheduleParam] `json:"dailySchedule,required"`
+}
+
+func (r ProjectPrebuildConfigurationTriggerParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// daily_schedule triggers a prebuild once per day at the specified hour (UTC). The
+// actual start time may vary slightly to distribute system load.
+type ProjectPrebuildConfigurationTriggerDailyScheduleParam struct {
+ // hour_utc is the hour of day (0-23) in UTC when the prebuild should start. The
+ // actual start time may be adjusted by a few minutes to balance system load.
+ HourUtc param.Field[int64] `json:"hourUtc"`
+}
+
+func (r ProjectPrebuildConfigurationTriggerDailyScheduleParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
type ProjectNewResponse struct {
Project Project `json:"project"`
JSON projectNewResponseJSON `json:"-"`
@@ -815,7 +958,6 @@ func (r projectNewFromEnvironmentResponseJSON) RawJSON() string {
}
type ProjectNewParams struct {
- EnvironmentClass param.Field[ProjectEnvironmentClassParam] `json:"environmentClass,required"`
// initializer is the content initializer
Initializer param.Field[EnvironmentInitializerParam] `json:"initializer,required"`
// automations_file_path is the path to the automations file relative to the repo
@@ -833,6 +975,9 @@ type ProjectNewParams struct {
// ```
DevcontainerFilePath param.Field[string] `json:"devcontainerFilePath"`
Name param.Field[string] `json:"name"`
+ // prebuild_configuration defines how prebuilds are created for this project. If
+ // not set, prebuilds are disabled for the project.
+ PrebuildConfiguration param.Field[ProjectPrebuildConfigurationParam] `json:"prebuildConfiguration"`
// technical_description is a detailed technical description of the project This
// field is not returned by default in GetProject or ListProjects responses 8KB max
TechnicalDescription param.Field[string] `json:"technicalDescription"`
@@ -865,11 +1010,14 @@ type ProjectUpdateParams struct {
// ```
// this.matches('^$|^[^/].*')
// ```
- DevcontainerFilePath param.Field[string] `json:"devcontainerFilePath"`
- EnvironmentClass param.Field[ProjectEnvironmentClassParam] `json:"environmentClass"`
+ DevcontainerFilePath param.Field[string] `json:"devcontainerFilePath"`
// initializer is the content initializer
Initializer param.Field[EnvironmentInitializerParam] `json:"initializer"`
Name param.Field[string] `json:"name"`
+ // prebuild_configuration defines how prebuilds are created for this project. If
+ // not provided, the existing prebuild configuration is not modified. To disable
+ // prebuilds, set enabled to false.
+ PrebuildConfiguration param.Field[ProjectPrebuildConfigurationParam] `json:"prebuildConfiguration"`
// project_id specifies the project identifier
ProjectID param.Field[string] `json:"projectId" format:"uuid"`
// technical_description is a detailed technical description of the project This
@@ -904,6 +1052,12 @@ func (r ProjectListParams) URLQuery() (v url.Values) {
type ProjectListParamsFilter struct {
// project_ids filters the response to only projects with these IDs
ProjectIDs param.Field[[]string] `json:"projectIds" format:"uuid"`
+ // runner_ids filters the response to only projects that use environment classes
+ // from these runners
+ RunnerIDs param.Field[[]string] `json:"runnerIds" format:"uuid"`
+ // search performs case-insensitive search across project name, project ID, and
+ // repository name
+ Search param.Field[string] `json:"search"`
}
func (r ProjectListParamsFilter) MarshalJSON() (data []byte, err error) {
diff --git a/project_test.go b/project_test.go
index 608869e..c86a0d3 100644
--- a/project_test.go
+++ b/project_test.go
@@ -11,6 +11,7 @@ import (
"github.com/gitpod-io/gitpod-sdk-go"
"github.com/gitpod-io/gitpod-sdk-go/internal/testutil"
"github.com/gitpod-io/gitpod-sdk-go/option"
+ "github.com/gitpod-io/gitpod-sdk-go/shared"
)
func TestProjectNewWithOptionalParams(t *testing.T) {
@@ -27,10 +28,6 @@ func TestProjectNewWithOptionalParams(t *testing.T) {
option.WithBearerToken("My Bearer Token"),
)
_, err := client.Projects.New(context.TODO(), gitpod.ProjectNewParams{
- EnvironmentClass: gitpod.F(gitpod.ProjectEnvironmentClassParam{
- EnvironmentClassID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
- LocalRunner: gitpod.F(true),
- }),
Initializer: gitpod.F(gitpod.EnvironmentInitializerParam{
Specs: gitpod.F([]gitpod.EnvironmentInitializerSpecParam{{
ContextURL: gitpod.F(gitpod.EnvironmentInitializerSpecsContextURLParam{
@@ -48,6 +45,21 @@ func TestProjectNewWithOptionalParams(t *testing.T) {
AutomationsFilePath: gitpod.F("automationsFilePath"),
DevcontainerFilePath: gitpod.F("devcontainerFilePath"),
Name: gitpod.F("Web Application"),
+ PrebuildConfiguration: gitpod.F(gitpod.ProjectPrebuildConfigurationParam{
+ Enabled: gitpod.F(true),
+ EnableJetbrainsWarmup: gitpod.F(true),
+ EnvironmentClassIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
+ Executor: gitpod.F(shared.SubjectParam{
+ ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ Principal: gitpod.F(shared.PrincipalUnspecified),
+ }),
+ Timeout: gitpod.F("+9125115.360s"),
+ Trigger: gitpod.F(gitpod.ProjectPrebuildConfigurationTriggerParam{
+ DailySchedule: gitpod.F(gitpod.ProjectPrebuildConfigurationTriggerDailyScheduleParam{
+ HourUtc: gitpod.F(int64(23)),
+ }),
+ }),
+ }),
TechnicalDescription: gitpod.F("technicalDescription"),
})
if err != nil {
@@ -100,10 +112,6 @@ func TestProjectUpdateWithOptionalParams(t *testing.T) {
_, err := client.Projects.Update(context.TODO(), gitpod.ProjectUpdateParams{
AutomationsFilePath: gitpod.F("automationsFilePath"),
DevcontainerFilePath: gitpod.F("devcontainerFilePath"),
- EnvironmentClass: gitpod.F(gitpod.ProjectEnvironmentClassParam{
- EnvironmentClassID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
- LocalRunner: gitpod.F(true),
- }),
Initializer: gitpod.F(gitpod.EnvironmentInitializerParam{
Specs: gitpod.F([]gitpod.EnvironmentInitializerSpecParam{{
ContextURL: gitpod.F(gitpod.EnvironmentInitializerSpecsContextURLParam{
@@ -118,7 +126,22 @@ func TestProjectUpdateWithOptionalParams(t *testing.T) {
}),
}}),
}),
- Name: gitpod.F("x"),
+ Name: gitpod.F("x"),
+ PrebuildConfiguration: gitpod.F(gitpod.ProjectPrebuildConfigurationParam{
+ Enabled: gitpod.F(true),
+ EnableJetbrainsWarmup: gitpod.F(true),
+ EnvironmentClassIDs: gitpod.F([]string{"b0e12f6c-4c67-429d-a4a6-d9838b5da041"}),
+ Executor: gitpod.F(shared.SubjectParam{
+ ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ Principal: gitpod.F(shared.PrincipalUnspecified),
+ }),
+ Timeout: gitpod.F("3600s"),
+ Trigger: gitpod.F(gitpod.ProjectPrebuildConfigurationTriggerParam{
+ DailySchedule: gitpod.F(gitpod.ProjectPrebuildConfigurationTriggerDailyScheduleParam{
+ HourUtc: gitpod.F(int64(2)),
+ }),
+ }),
+ }),
ProjectID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
TechnicalDescription: gitpod.F("technicalDescription"),
})
@@ -149,6 +172,8 @@ func TestProjectListWithOptionalParams(t *testing.T) {
PageSize: gitpod.F(int64(0)),
Filter: gitpod.F(gitpod.ProjectListParamsFilter{
ProjectIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
+ RunnerIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
+ Search: gitpod.F("search"),
}),
Pagination: gitpod.F(gitpod.ProjectListParamsPagination{
Token: gitpod.F("token"),
diff --git a/projectenvironmentclase.go b/projectenvironmentclase.go
new file mode 100644
index 0000000..b6d10bf
--- /dev/null
+++ b/projectenvironmentclase.go
@@ -0,0 +1,167 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package gitpod
+
+import (
+ "context"
+ "net/http"
+ "net/url"
+ "slices"
+
+ "github.com/gitpod-io/gitpod-sdk-go/internal/apijson"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/apiquery"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/param"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/requestconfig"
+ "github.com/gitpod-io/gitpod-sdk-go/option"
+ "github.com/gitpod-io/gitpod-sdk-go/packages/pagination"
+ "github.com/gitpod-io/gitpod-sdk-go/shared"
+)
+
+// ProjectEnvironmentClaseService contains methods and other services that help
+// with interacting with the gitpod API.
+//
+// Note, unlike clients, this service does not read variables from the environment
+// automatically. You should not instantiate this service directly, and instead use
+// the [NewProjectEnvironmentClaseService] method instead.
+type ProjectEnvironmentClaseService struct {
+ Options []option.RequestOption
+}
+
+// NewProjectEnvironmentClaseService generates a new service that applies the given
+// options to each request. These options are applied after the parent client's
+// options (if there is one), and before any request-specific options.
+func NewProjectEnvironmentClaseService(opts ...option.RequestOption) (r *ProjectEnvironmentClaseService) {
+ r = &ProjectEnvironmentClaseService{}
+ r.Options = opts
+ return
+}
+
+// Updates all environment classes of a project.
+//
+// Use this method to:
+//
+// - Modify all environment classea of a project
+//
+// ### Examples
+//
+// - Update project environment classes:
+//
+// Updates all environment classes for a project.
+//
+// ```yaml
+// projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
+// projectEnvironmentClasses:
+// - environmentClassId: "b0e12f6c-4c67-429d-a4a6-d9838b5da041"
+// order: 0
+// - localRunner: true
+// order: 1
+// ```
+func (r *ProjectEnvironmentClaseService) Update(ctx context.Context, body ProjectEnvironmentClaseUpdateParams, opts ...option.RequestOption) (res *ProjectEnvironmentClaseUpdateResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.ProjectService/UpdateProjectEnvironmentClasses"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Lists environment classes of a project.
+//
+// Use this method to:
+//
+// - View all environment classes of a project
+//
+// ### Examples
+//
+// - List project environment classes:
+//
+// Shows all environment classes of a project.
+//
+// ```yaml
+// projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
+// pagination:
+// pageSize: 20
+// ```
+func (r *ProjectEnvironmentClaseService) List(ctx context.Context, params ProjectEnvironmentClaseListParams, opts ...option.RequestOption) (res *pagination.ProjectEnvironmentClassesPage[shared.ProjectEnvironmentClass], err error) {
+ var raw *http.Response
+ opts = slices.Concat(r.Options, opts)
+ opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
+ path := "gitpod.v1.ProjectService/ListProjectEnvironmentClasses"
+ cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...)
+ if err != nil {
+ return nil, err
+ }
+ err = cfg.Execute()
+ if err != nil {
+ return nil, err
+ }
+ res.SetPageConfig(cfg, raw)
+ return res, nil
+}
+
+// Lists environment classes of a project.
+//
+// Use this method to:
+//
+// - View all environment classes of a project
+//
+// ### Examples
+//
+// - List project environment classes:
+//
+// Shows all environment classes of a project.
+//
+// ```yaml
+// projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
+// pagination:
+// pageSize: 20
+// ```
+func (r *ProjectEnvironmentClaseService) ListAutoPaging(ctx context.Context, params ProjectEnvironmentClaseListParams, opts ...option.RequestOption) *pagination.ProjectEnvironmentClassesPageAutoPager[shared.ProjectEnvironmentClass] {
+ return pagination.NewProjectEnvironmentClassesPageAutoPager(r.List(ctx, params, opts...))
+}
+
+type ProjectEnvironmentClaseUpdateResponse = interface{}
+
+type ProjectEnvironmentClaseUpdateParams struct {
+ ProjectEnvironmentClasses param.Field[[]shared.ProjectEnvironmentClassParam] `json:"projectEnvironmentClasses"`
+ // project_id specifies the project identifier
+ ProjectID param.Field[string] `json:"projectId" format:"uuid"`
+}
+
+func (r ProjectEnvironmentClaseUpdateParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type ProjectEnvironmentClaseListParams struct {
+ Token param.Field[string] `query:"token"`
+ PageSize param.Field[int64] `query:"pageSize"`
+ // pagination contains the pagination options for listing project policies
+ Pagination param.Field[ProjectEnvironmentClaseListParamsPagination] `json:"pagination"`
+ // project_id specifies the project identifier
+ ProjectID param.Field[string] `json:"projectId" format:"uuid"`
+}
+
+func (r ProjectEnvironmentClaseListParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// URLQuery serializes [ProjectEnvironmentClaseListParams]'s query parameters as
+// `url.Values`.
+func (r ProjectEnvironmentClaseListParams) URLQuery() (v url.Values) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatComma,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
+
+// pagination contains the pagination options for listing project policies
+type ProjectEnvironmentClaseListParamsPagination struct {
+ // Token for the next set of results that was returned as next_token of a
+ // PaginationResponse
+ Token param.Field[string] `json:"token"`
+ // Page size is the maximum number of results to retrieve per page. Defaults to 25.
+ // Maximum 100.
+ PageSize param.Field[int64] `json:"pageSize"`
+}
+
+func (r ProjectEnvironmentClaseListParamsPagination) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
diff --git a/projectenvironmentclase_test.go b/projectenvironmentclase_test.go
new file mode 100644
index 0000000..3ee105a
--- /dev/null
+++ b/projectenvironmentclase_test.go
@@ -0,0 +1,80 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package gitpod_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+
+ "github.com/gitpod-io/gitpod-sdk-go"
+ "github.com/gitpod-io/gitpod-sdk-go/internal/testutil"
+ "github.com/gitpod-io/gitpod-sdk-go/option"
+ "github.com/gitpod-io/gitpod-sdk-go/shared"
+)
+
+func TestProjectEnvironmentClaseUpdateWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Projects.EnvironmentClases.Update(context.TODO(), gitpod.ProjectEnvironmentClaseUpdateParams{
+ ProjectEnvironmentClasses: gitpod.F([]shared.ProjectEnvironmentClassParam{{
+ EnvironmentClassID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da041"),
+ LocalRunner: gitpod.F(true),
+ Order: gitpod.F(int64(0)),
+ }, {
+ EnvironmentClassID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ LocalRunner: gitpod.F(true),
+ Order: gitpod.F(int64(1)),
+ }}),
+ ProjectID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestProjectEnvironmentClaseListWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Projects.EnvironmentClases.List(context.TODO(), gitpod.ProjectEnvironmentClaseListParams{
+ Token: gitpod.F("token"),
+ PageSize: gitpod.F(int64(0)),
+ Pagination: gitpod.F(gitpod.ProjectEnvironmentClaseListParamsPagination{
+ Token: gitpod.F("token"),
+ PageSize: gitpod.F(int64(20)),
+ }),
+ ProjectID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/runner.go b/runner.go
index ca04ae0..22708fb 100644
--- a/runner.go
+++ b/runner.go
@@ -272,6 +272,26 @@ func (r *RunnerService) CheckAuthenticationForHost(ctx context.Context, body Run
return
}
+// Creates an access token for runner logs and debug information.
+//
+// Generated tokens are valid for one hour and provide runner-specific access
+// permissions. The token is scoped to a specific runner and can be used to access
+// support bundles.
+//
+// ### Examples
+//
+// - Generate runner logs token:
+//
+// ```yaml
+// runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
+// ```
+func (r *RunnerService) NewLogsToken(ctx context.Context, body RunnerNewLogsTokenParams, opts ...option.RequestOption) (res *RunnerNewLogsTokenResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.RunnerService/CreateRunnerLogsToken"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
// Creates a new authentication token for a runner.
//
// Use this method to:
@@ -329,6 +349,43 @@ func (r *RunnerService) ParseContextURL(ctx context.Context, body RunnerParseCon
return
}
+// Searches for repositories across all authenticated SCM hosts.
+//
+// Use this method to:
+//
+// - List available repositories
+// - Search repositories by name or content
+// - Discover repositories for environment creation
+//
+// Returns repositories from all authenticated SCM hosts in natural sort order. If
+// no repositories are found, returns an empty list.
+//
+// ### Examples
+//
+// - List all repositories:
+//
+// Returns up to 25 repositories from all authenticated hosts.
+//
+// ```yaml
+// runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
+// ```
+//
+// - Search repositories:
+//
+// Searches for repositories matching the query across all hosts.
+//
+// ```yaml
+// runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
+// searchString: "my-project"
+// limit: 10
+// ```
+func (r *RunnerService) SearchRepositories(ctx context.Context, body RunnerSearchRepositoriesParams, opts ...option.RequestOption) (res *RunnerSearchRepositoriesResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.RunnerService/SearchRepositories"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
type GatewayInfo struct {
// Gateway represents a system gateway that provides access to services
Gateway shared.Gateway `json:"gateway"`
@@ -429,6 +486,9 @@ type Runner struct {
// The runner's provider
Provider RunnerProvider `json:"provider"`
RunnerID string `json:"runnerId"`
+ // The runner manager id specifies the runner manager for the managed runner. This
+ // field is only set for managed runners.
+ RunnerManagerID string `json:"runnerManagerId" format:"uuid"`
// The runner's specification
Spec RunnerSpec `json:"spec"`
// The runner's status
@@ -440,17 +500,18 @@ type Runner struct {
// runnerJSON contains the JSON metadata for the struct [Runner]
type runnerJSON struct {
- CreatedAt apijson.Field
- Creator apijson.Field
- Kind apijson.Field
- Name apijson.Field
- Provider apijson.Field
- RunnerID apijson.Field
- Spec apijson.Field
- Status apijson.Field
- UpdatedAt apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
+ CreatedAt apijson.Field
+ Creator apijson.Field
+ Kind apijson.Field
+ Name apijson.Field
+ Provider apijson.Field
+ RunnerID apijson.Field
+ RunnerManagerID apijson.Field
+ Spec apijson.Field
+ Status apijson.Field
+ UpdatedAt apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
}
func (r *Runner) UnmarshalJSON(data []byte) (err error) {
@@ -470,11 +531,12 @@ const (
RunnerCapabilityAgentExecution RunnerCapability = "RUNNER_CAPABILITY_AGENT_EXECUTION"
RunnerCapabilityAllowEnvTokenPopulation RunnerCapability = "RUNNER_CAPABILITY_ALLOW_ENV_TOKEN_POPULATION"
RunnerCapabilityDefaultDevContainerImage RunnerCapability = "RUNNER_CAPABILITY_DEFAULT_DEV_CONTAINER_IMAGE"
+ RunnerCapabilityEnvironmentSnapshot RunnerCapability = "RUNNER_CAPABILITY_ENVIRONMENT_SNAPSHOT"
)
func (r RunnerCapability) IsKnown() bool {
switch r {
- case RunnerCapabilityUnspecified, RunnerCapabilityFetchLocalScmIntegrations, RunnerCapabilitySecretContainerRegistry, RunnerCapabilityAgentExecution, RunnerCapabilityAllowEnvTokenPopulation, RunnerCapabilityDefaultDevContainerImage:
+ case RunnerCapabilityUnspecified, RunnerCapabilityFetchLocalScmIntegrations, RunnerCapabilitySecretContainerRegistry, RunnerCapabilityAgentExecution, RunnerCapabilityAllowEnvTokenPopulation, RunnerCapabilityDefaultDevContainerImage, RunnerCapabilityEnvironmentSnapshot:
return true
}
return false
@@ -485,7 +547,7 @@ type RunnerConfiguration struct {
AutoUpdate bool `json:"autoUpdate"`
// devcontainer_image_cache_enabled controls whether the devcontainer build cache
// is enabled for this runner. Only takes effect on supported runners, currently
- // only AWS EC2 runners.
+ // only AWS EC2 and Gitpod-managed runners.
DevcontainerImageCacheEnabled bool `json:"devcontainerImageCacheEnabled"`
// log_level is the log level for the runner
LogLevel LogLevel `json:"logLevel"`
@@ -526,7 +588,7 @@ type RunnerConfigurationParam struct {
AutoUpdate param.Field[bool] `json:"autoUpdate"`
// devcontainer_image_cache_enabled controls whether the devcontainer build cache
// is enabled for this runner. Only takes effect on supported runners, currently
- // only AWS EC2 runners.
+ // only AWS EC2 and Gitpod-managed runners.
DevcontainerImageCacheEnabled param.Field[bool] `json:"devcontainerImageCacheEnabled"`
// log_level is the log level for the runner
LogLevel param.Field[LogLevel] `json:"logLevel"`
@@ -594,11 +656,12 @@ const (
RunnerProviderLinuxHost RunnerProvider = "RUNNER_PROVIDER_LINUX_HOST"
RunnerProviderDesktopMac RunnerProvider = "RUNNER_PROVIDER_DESKTOP_MAC"
RunnerProviderManaged RunnerProvider = "RUNNER_PROVIDER_MANAGED"
+ RunnerProviderGcp RunnerProvider = "RUNNER_PROVIDER_GCP"
)
func (r RunnerProvider) IsKnown() bool {
switch r {
- case RunnerProviderUnspecified, RunnerProviderAwsEc2, RunnerProviderLinuxHost, RunnerProviderDesktopMac, RunnerProviderManaged:
+ case RunnerProviderUnspecified, RunnerProviderAwsEc2, RunnerProviderLinuxHost, RunnerProviderDesktopMac, RunnerProviderManaged, RunnerProviderGcp:
return true
}
return false
@@ -624,14 +687,17 @@ type RunnerSpec struct {
// The runner's configuration
Configuration RunnerConfiguration `json:"configuration"`
// RunnerPhase represents the phase a runner is in
- DesiredPhase RunnerPhase `json:"desiredPhase"`
- JSON runnerSpecJSON `json:"-"`
+ DesiredPhase RunnerPhase `json:"desiredPhase"`
+ // The runner's variant
+ Variant RunnerVariant `json:"variant"`
+ JSON runnerSpecJSON `json:"-"`
}
// runnerSpecJSON contains the JSON metadata for the struct [RunnerSpec]
type runnerSpecJSON struct {
Configuration apijson.Field
DesiredPhase apijson.Field
+ Variant apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
@@ -649,6 +715,8 @@ type RunnerSpecParam struct {
Configuration param.Field[RunnerConfigurationParam] `json:"configuration"`
// RunnerPhase represents the phase a runner is in
DesiredPhase param.Field[RunnerPhase] `json:"desiredPhase"`
+ // The runner's variant
+ Variant param.Field[RunnerVariant] `json:"variant"`
}
func (r RunnerSpecParam) MarshalJSON() (data []byte, err error) {
@@ -664,15 +732,23 @@ type RunnerStatus struct {
Capabilities []RunnerCapability `json:"capabilities"`
// gateway_info is information about the gateway to which the runner is connected.
GatewayInfo GatewayInfo `json:"gatewayInfo"`
- LogURL string `json:"logUrl"`
+ // llm_url is the URL of the LLM service to which the runner is connected.
+ LlmURL string `json:"llmUrl"`
+ LogURL string `json:"logUrl"`
// The runner's reported message which is shown to users. This message adds more
// context to the runner's phase.
Message string `json:"message"`
// The runner's reported phase
Phase RunnerPhase `json:"phase"`
+ // public_key is the runner's public key used for encryption (32 bytes)
+ PublicKey string `json:"publicKey" format:"byte"`
// region is the region the runner is running in, if applicable.
- Region string `json:"region"`
- SystemDetails string `json:"systemDetails"`
+ Region string `json:"region"`
+ // support_bundle_url is the URL at which the runner support bundle can be
+ // accessed. This URL provides access to pprof profiles and other debug
+ // information. Only available for standalone runners.
+ SupportBundleURL string `json:"supportBundleUrl"`
+ SystemDetails string `json:"systemDetails"`
// Time when the status was last updated.
UpdatedAt time.Time `json:"updatedAt" format:"date-time"`
Version string `json:"version"`
@@ -681,18 +757,21 @@ type RunnerStatus struct {
// runnerStatusJSON contains the JSON metadata for the struct [RunnerStatus]
type runnerStatusJSON struct {
- AdditionalInfo apijson.Field
- Capabilities apijson.Field
- GatewayInfo apijson.Field
- LogURL apijson.Field
- Message apijson.Field
- Phase apijson.Field
- Region apijson.Field
- SystemDetails apijson.Field
- UpdatedAt apijson.Field
- Version apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
+ AdditionalInfo apijson.Field
+ Capabilities apijson.Field
+ GatewayInfo apijson.Field
+ LlmURL apijson.Field
+ LogURL apijson.Field
+ Message apijson.Field
+ Phase apijson.Field
+ PublicKey apijson.Field
+ Region apijson.Field
+ SupportBundleURL apijson.Field
+ SystemDetails apijson.Field
+ UpdatedAt apijson.Field
+ Version apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
}
func (r *RunnerStatus) UnmarshalJSON(data []byte) (err error) {
@@ -703,6 +782,38 @@ func (r runnerStatusJSON) RawJSON() string {
return r.raw
}
+type RunnerVariant string
+
+const (
+ RunnerVariantUnspecified RunnerVariant = "RUNNER_VARIANT_UNSPECIFIED"
+ RunnerVariantStandard RunnerVariant = "RUNNER_VARIANT_STANDARD"
+ RunnerVariantEnterprise RunnerVariant = "RUNNER_VARIANT_ENTERPRISE"
+)
+
+func (r RunnerVariant) IsKnown() bool {
+ switch r {
+ case RunnerVariantUnspecified, RunnerVariantStandard, RunnerVariantEnterprise:
+ return true
+ }
+ return false
+}
+
+type SearchMode string
+
+const (
+ SearchModeUnspecified SearchMode = "SEARCH_MODE_UNSPECIFIED"
+ SearchModeKeyword SearchMode = "SEARCH_MODE_KEYWORD"
+ SearchModeNative SearchMode = "SEARCH_MODE_NATIVE"
+)
+
+func (r SearchMode) IsKnown() bool {
+ switch r {
+ case SearchModeUnspecified, SearchModeKeyword, SearchModeNative:
+ return true
+ }
+ return false
+}
+
type RunnerNewResponse struct {
Runner Runner `json:"runner,required"`
// deprecated, will be removed. Use exchange_token instead.
@@ -860,6 +971,29 @@ func (r runnerCheckAuthenticationForHostResponseSupportsPatJSON) RawJSON() strin
return r.raw
}
+type RunnerNewLogsTokenResponse struct {
+ // access_token is the token that can be used to access the logs and support bundle
+ // of the runner
+ AccessToken string `json:"accessToken,required"`
+ JSON runnerNewLogsTokenResponseJSON `json:"-"`
+}
+
+// runnerNewLogsTokenResponseJSON contains the JSON metadata for the struct
+// [RunnerNewLogsTokenResponse]
+type runnerNewLogsTokenResponseJSON struct {
+ AccessToken apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *RunnerNewLogsTokenResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r runnerNewLogsTokenResponseJSON) RawJSON() string {
+ return r.raw
+}
+
type RunnerNewRunnerTokenResponse struct {
// deprecated, will be removed. Use exchange_token instead.
//
@@ -890,19 +1024,35 @@ func (r runnerNewRunnerTokenResponseJSON) RawJSON() string {
}
type RunnerParseContextURLResponse struct {
- Git RunnerParseContextURLResponseGit `json:"git"`
- OriginalContextURL string `json:"originalContextUrl"`
+ Git RunnerParseContextURLResponseGit `json:"git"`
+ Issue RunnerParseContextURLResponseIssue `json:"issue"`
+ OriginalContextURL string `json:"originalContextUrl"`
+ // Deprecated: Use top-level PullRequest message instead
+ //
+ // Deprecated: deprecated
+ Pr RunnerParseContextURLResponsePr `json:"pr"`
// project_ids is a list of projects to which the context URL belongs to.
- ProjectIDs []string `json:"projectIds"`
- JSON runnerParseContextURLResponseJSON `json:"-"`
+ ProjectIDs []string `json:"projectIds"`
+ // PullRequest represents pull request metadata from source control systems. This
+ // message is used across workflow triggers, executions, and agent contexts to
+ // maintain consistent PR information throughout the system.
+ PullRequest RunnerParseContextURLResponsePullRequest `json:"pullRequest"`
+ // scm_id is the unique identifier of the SCM provider (e.g., "github", "gitlab",
+ // "bitbucket")
+ ScmID string `json:"scmId"`
+ JSON runnerParseContextURLResponseJSON `json:"-"`
}
// runnerParseContextURLResponseJSON contains the JSON metadata for the struct
// [RunnerParseContextURLResponse]
type runnerParseContextURLResponseJSON struct {
Git apijson.Field
+ Issue apijson.Field
OriginalContextURL apijson.Field
+ Pr apijson.Field
ProjectIDs apijson.Field
+ PullRequest apijson.Field
+ ScmID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
@@ -922,6 +1072,7 @@ type RunnerParseContextURLResponseGit struct {
Host string `json:"host"`
Owner string `json:"owner"`
Repo string `json:"repo"`
+ Tag string `json:"tag"`
UpstreamRemoteURL string `json:"upstreamRemoteUrl"`
JSON runnerParseContextURLResponseGitJSON `json:"-"`
}
@@ -935,6 +1086,7 @@ type runnerParseContextURLResponseGitJSON struct {
Host apijson.Field
Owner apijson.Field
Repo apijson.Field
+ Tag apijson.Field
UpstreamRemoteURL apijson.Field
raw string
ExtraFields map[string]apijson.Field
@@ -948,6 +1100,208 @@ func (r runnerParseContextURLResponseGitJSON) RawJSON() string {
return r.raw
}
+type RunnerParseContextURLResponseIssue struct {
+ // id is the source system's ID of this issue, e.g. BNFRD-6100
+ ID string `json:"id"`
+ Title string `json:"title"`
+ JSON runnerParseContextURLResponseIssueJSON `json:"-"`
+}
+
+// runnerParseContextURLResponseIssueJSON contains the JSON metadata for the struct
+// [RunnerParseContextURLResponseIssue]
+type runnerParseContextURLResponseIssueJSON struct {
+ ID apijson.Field
+ Title apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *RunnerParseContextURLResponseIssue) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r runnerParseContextURLResponseIssueJSON) RawJSON() string {
+ return r.raw
+}
+
+// Deprecated: Use top-level PullRequest message instead
+//
+// Deprecated: deprecated
+type RunnerParseContextURLResponsePr struct {
+ ID string `json:"id"`
+ FromBranch string `json:"fromBranch"`
+ Title string `json:"title"`
+ ToBranch string `json:"toBranch"`
+ JSON runnerParseContextURLResponsePrJSON `json:"-"`
+}
+
+// runnerParseContextURLResponsePrJSON contains the JSON metadata for the struct
+// [RunnerParseContextURLResponsePr]
+type runnerParseContextURLResponsePrJSON struct {
+ ID apijson.Field
+ FromBranch apijson.Field
+ Title apijson.Field
+ ToBranch apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *RunnerParseContextURLResponsePr) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r runnerParseContextURLResponsePrJSON) RawJSON() string {
+ return r.raw
+}
+
+// PullRequest represents pull request metadata from source control systems. This
+// message is used across workflow triggers, executions, and agent contexts to
+// maintain consistent PR information throughout the system.
+type RunnerParseContextURLResponsePullRequest struct {
+ // Unique identifier from the source system (e.g., "123" for GitHub PR #123)
+ ID string `json:"id"`
+ // Author name as provided by the SCM system
+ Author string `json:"author"`
+ // Source branch name (the branch being merged from)
+ FromBranch string `json:"fromBranch"`
+ // Repository information
+ Repository RunnerParseContextURLResponsePullRequestRepository `json:"repository"`
+ // Pull request title
+ Title string `json:"title"`
+ // Target branch name (the branch being merged into)
+ ToBranch string `json:"toBranch"`
+ // Pull request URL (e.g., "https://github.com/owner/repo/pull/123")
+ URL string `json:"url"`
+ JSON runnerParseContextURLResponsePullRequestJSON `json:"-"`
+}
+
+// runnerParseContextURLResponsePullRequestJSON contains the JSON metadata for the
+// struct [RunnerParseContextURLResponsePullRequest]
+type runnerParseContextURLResponsePullRequestJSON struct {
+ ID apijson.Field
+ Author apijson.Field
+ FromBranch apijson.Field
+ Repository apijson.Field
+ Title apijson.Field
+ ToBranch apijson.Field
+ URL apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *RunnerParseContextURLResponsePullRequest) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r runnerParseContextURLResponsePullRequestJSON) RawJSON() string {
+ return r.raw
+}
+
+// Repository information
+type RunnerParseContextURLResponsePullRequestRepository struct {
+ CloneURL string `json:"cloneUrl"`
+ Host string `json:"host"`
+ Name string `json:"name"`
+ Owner string `json:"owner"`
+ JSON runnerParseContextURLResponsePullRequestRepositoryJSON `json:"-"`
+}
+
+// runnerParseContextURLResponsePullRequestRepositoryJSON contains the JSON
+// metadata for the struct [RunnerParseContextURLResponsePullRequestRepository]
+type runnerParseContextURLResponsePullRequestRepositoryJSON struct {
+ CloneURL apijson.Field
+ Host apijson.Field
+ Name apijson.Field
+ Owner apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *RunnerParseContextURLResponsePullRequestRepository) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r runnerParseContextURLResponsePullRequestRepositoryJSON) RawJSON() string {
+ return r.raw
+}
+
+type RunnerSearchRepositoriesResponse struct {
+ // Last page in the responses
+ LastPage int64 `json:"lastPage"`
+ // Pagination information for the response
+ Pagination RunnerSearchRepositoriesResponsePagination `json:"pagination"`
+ // List of repositories matching the search criteria
+ Repositories []RunnerSearchRepositoriesResponseRepository `json:"repositories"`
+ JSON runnerSearchRepositoriesResponseJSON `json:"-"`
+}
+
+// runnerSearchRepositoriesResponseJSON contains the JSON metadata for the struct
+// [RunnerSearchRepositoriesResponse]
+type runnerSearchRepositoriesResponseJSON struct {
+ LastPage apijson.Field
+ Pagination apijson.Field
+ Repositories apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *RunnerSearchRepositoriesResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r runnerSearchRepositoriesResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+// Pagination information for the response
+type RunnerSearchRepositoriesResponsePagination struct {
+ // Token passed for retrieving the next set of results. Empty if there are no more
+ // results
+ NextToken string `json:"nextToken"`
+ JSON runnerSearchRepositoriesResponsePaginationJSON `json:"-"`
+}
+
+// runnerSearchRepositoriesResponsePaginationJSON contains the JSON metadata for
+// the struct [RunnerSearchRepositoriesResponsePagination]
+type runnerSearchRepositoriesResponsePaginationJSON struct {
+ NextToken apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *RunnerSearchRepositoriesResponsePagination) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r runnerSearchRepositoriesResponsePaginationJSON) RawJSON() string {
+ return r.raw
+}
+
+type RunnerSearchRepositoriesResponseRepository struct {
+ // Repository name (e.g., "my-project")
+ Name string `json:"name"`
+ // Repository URL (e.g., "https://github.com/owner/my-project")
+ URL string `json:"url"`
+ JSON runnerSearchRepositoriesResponseRepositoryJSON `json:"-"`
+}
+
+// runnerSearchRepositoriesResponseRepositoryJSON contains the JSON metadata for
+// the struct [RunnerSearchRepositoriesResponseRepository]
+type runnerSearchRepositoriesResponseRepositoryJSON struct {
+ Name apijson.Field
+ URL apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *RunnerSearchRepositoriesResponseRepository) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r runnerSearchRepositoriesResponseRepositoryJSON) RawJSON() string {
+ return r.raw
+}
+
type RunnerNewParams struct {
// The runner's kind This field is optional and here for backwards-compatibility.
// Use the provider field instead. If provider is set, the runner's kind will be
@@ -1112,6 +1466,17 @@ func (r RunnerCheckAuthenticationForHostParams) MarshalJSON() (data []byte, err
return apijson.MarshalRoot(r)
}
+type RunnerNewLogsTokenParams struct {
+ // runner_id specifies the runner for which the logs token should be created.
+ //
+ // +required
+ RunnerID param.Field[string] `json:"runnerId" format:"uuid"`
+}
+
+func (r RunnerNewLogsTokenParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
type RunnerNewRunnerTokenParams struct {
RunnerID param.Field[string] `json:"runnerId" format:"uuid"`
}
@@ -1128,3 +1493,36 @@ type RunnerParseContextURLParams struct {
func (r RunnerParseContextURLParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
+
+type RunnerSearchRepositoriesParams struct {
+ // Maximum number of repositories to return. Default: 25, Maximum: 100 Deprecated:
+ // Use pagination.page_size instead
+ Limit param.Field[int64] `json:"limit"`
+ // Pagination parameters for repository search
+ Pagination param.Field[RunnerSearchRepositoriesParamsPagination] `json:"pagination"`
+ RunnerID param.Field[string] `json:"runnerId" format:"uuid"`
+ // The SCM's host to retrieve repositories from
+ ScmHost param.Field[string] `json:"scmHost"`
+ // Search mode determines how search_string is interpreted
+ SearchMode param.Field[SearchMode] `json:"searchMode"`
+ // Search query - interpretation depends on search_mode
+ SearchString param.Field[string] `json:"searchString"`
+}
+
+func (r RunnerSearchRepositoriesParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// Pagination parameters for repository search
+type RunnerSearchRepositoriesParamsPagination struct {
+ // Token for the next set of results that was returned as next_token of a
+ // PaginationResponse
+ Token param.Field[string] `json:"token"`
+ // Page size is the maximum number of results to retrieve per page. Defaults to 25.
+ // Maximum 100.
+ PageSize param.Field[int64] `json:"pageSize"`
+}
+
+func (r RunnerSearchRepositoriesParamsPagination) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
diff --git a/runner_test.go b/runner_test.go
index 1eb07f8..e27f1ff 100644
--- a/runner_test.go
+++ b/runner_test.go
@@ -46,6 +46,7 @@ func TestRunnerNewWithOptionalParams(t *testing.T) {
ReleaseChannel: gitpod.F(gitpod.RunnerReleaseChannelStable),
}),
DesiredPhase: gitpod.F(gitpod.RunnerPhaseActive),
+ Variant: gitpod.F(gitpod.RunnerVariantUnspecified),
}),
})
if err != nil {
@@ -210,6 +211,31 @@ func TestRunnerCheckAuthenticationForHostWithOptionalParams(t *testing.T) {
}
}
+func TestRunnerNewLogsTokenWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Runners.NewLogsToken(context.TODO(), gitpod.RunnerNewLogsTokenParams{
+ RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
func TestRunnerNewRunnerTokenWithOptionalParams(t *testing.T) {
t.Skip("Prism tests are disabled")
baseURL := "http://localhost:4010"
@@ -260,3 +286,36 @@ func TestRunnerParseContextURLWithOptionalParams(t *testing.T) {
t.Fatalf("err should be nil: %s", err.Error())
}
}
+
+func TestRunnerSearchRepositoriesWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Runners.SearchRepositories(context.TODO(), gitpod.RunnerSearchRepositoriesParams{
+ Limit: gitpod.F(int64(1)),
+ Pagination: gitpod.F(gitpod.RunnerSearchRepositoriesParamsPagination{
+ Token: gitpod.F("token"),
+ PageSize: gitpod.F(int64(100)),
+ }),
+ RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
+ ScmHost: gitpod.F("scmHost"),
+ SearchMode: gitpod.F(gitpod.SearchModeUnspecified),
+ SearchString: gitpod.F("searchString"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/runnerconfiguration.go b/runnerconfiguration.go
index 3ca8fd0..4e30e70 100644
--- a/runnerconfiguration.go
+++ b/runnerconfiguration.go
@@ -206,6 +206,11 @@ type RunnerConfigurationValidateParamsScmIntegration struct {
// scm_id references the scm_id in the runner's configuration schema that this
// integration is for
ScmID param.Field[string] `json:"scmId"`
+ // virtual_directory is the virtual directory path for Azure DevOps Server (e.g.,
+ // "/tfs"). This field is only used for Azure DevOps Server SCM integrations and
+ // should be empty for other SCM types. Azure DevOps Server APIs work without
+ // collection when PAT scope is 'All accessible organizations'.
+ VirtualDirectory param.Field[string] `json:"virtualDirectory"`
}
func (r RunnerConfigurationValidateParamsScmIntegration) MarshalJSON() (data []byte, err error) {
diff --git a/runnerconfiguration_test.go b/runnerconfiguration_test.go
index 2a7a7a9..fa0b7e3 100644
--- a/runnerconfiguration_test.go
+++ b/runnerconfiguration_test.go
@@ -49,6 +49,7 @@ func TestRunnerConfigurationValidateWithOptionalParams(t *testing.T) {
OAuthPlaintextClientSecret: gitpod.F("client_secret"),
Pat: gitpod.F(true),
ScmID: gitpod.F("github"),
+ VirtualDirectory: gitpod.F("virtualDirectory"),
}),
})
if err != nil {
diff --git a/runnerconfigurationhostauthenticationtoken.go b/runnerconfigurationhostauthenticationtoken.go
index 257d4a6..e4fa548 100644
--- a/runnerconfigurationhostauthenticationtoken.go
+++ b/runnerconfigurationhostauthenticationtoken.go
@@ -15,6 +15,7 @@ import (
"github.com/gitpod-io/gitpod-sdk-go/internal/requestconfig"
"github.com/gitpod-io/gitpod-sdk-go/option"
"github.com/gitpod-io/gitpod-sdk-go/packages/pagination"
+ "github.com/gitpod-io/gitpod-sdk-go/shared"
)
// RunnerConfigurationHostAuthenticationTokenService contains methods and other
@@ -311,25 +312,40 @@ type HostAuthenticationToken struct {
// Joda Time's
// [`ISODateTimeFormat.dateTime()`]()
// to obtain a formatter capable of generating timestamps in this format.
- ExpiresAt time.Time `json:"expiresAt" format:"date-time"`
- Host string `json:"host"`
- RunnerID string `json:"runnerId"`
- Source HostAuthenticationTokenSource `json:"source"`
- UserID string `json:"userId"`
- JSON hostAuthenticationTokenJSON `json:"-"`
+ ExpiresAt time.Time `json:"expiresAt" format:"date-time"`
+ Host string `json:"host"`
+ // links to integration instance
+ IntegrationID string `json:"integrationId"`
+ RunnerID string `json:"runnerId"`
+ // token permissions
+ Scopes []string `json:"scopes"`
+ // auth_type
+ Source HostAuthenticationTokenSource `json:"source"`
+ // Subject identifies the principal (user or service account) for the token Note:
+ // actual token and refresh_token values are retrieved via
+ // GetHostAuthenticationTokenValue API
+ Subject shared.Subject `json:"subject"`
+ // Deprecated: Use principal_id and principal_type instead principal (user)
+ //
+ // Deprecated: deprecated
+ UserID string `json:"userId"`
+ JSON hostAuthenticationTokenJSON `json:"-"`
}
// hostAuthenticationTokenJSON contains the JSON metadata for the struct
// [HostAuthenticationToken]
type hostAuthenticationTokenJSON struct {
- ID apijson.Field
- ExpiresAt apijson.Field
- Host apijson.Field
- RunnerID apijson.Field
- Source apijson.Field
- UserID apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
+ ID apijson.Field
+ ExpiresAt apijson.Field
+ Host apijson.Field
+ IntegrationID apijson.Field
+ RunnerID apijson.Field
+ Scopes apijson.Field
+ Source apijson.Field
+ Subject apijson.Field
+ UserID apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
}
func (r *HostAuthenticationToken) UnmarshalJSON(data []byte) (err error) {
@@ -403,6 +419,7 @@ type RunnerConfigurationHostAuthenticationTokenUpdateResponse = interface{}
type RunnerConfigurationHostAuthenticationTokenDeleteResponse = interface{}
type RunnerConfigurationHostAuthenticationTokenNewParams struct {
+ // stored encrypted, retrieved via GetHostAuthenticationTokenValue
Token param.Field[string] `json:"token"`
// A Timestamp represents a point in time independent of any time zone or local
// calendar, encoded as a count of seconds and fractions of seconds at nanosecond
@@ -492,12 +509,19 @@ type RunnerConfigurationHostAuthenticationTokenNewParams struct {
// Joda Time's
// [`ISODateTimeFormat.dateTime()`]()
// to obtain a formatter capable of generating timestamps in this format.
- ExpiresAt param.Field[time.Time] `json:"expiresAt" format:"date-time"`
- Host param.Field[string] `json:"host"`
- RefreshToken param.Field[string] `json:"refreshToken"`
- RunnerID param.Field[string] `json:"runnerId" format:"uuid"`
- Source param.Field[HostAuthenticationTokenSource] `json:"source"`
- UserID param.Field[string] `json:"userId" format:"uuid"`
+ ExpiresAt param.Field[time.Time] `json:"expiresAt" format:"date-time"`
+ Host param.Field[string] `json:"host"`
+ IntegrationID param.Field[string] `json:"integrationId" format:"uuid"`
+ // stored encrypted, retrieved via GetHostAuthenticationTokenValue
+ RefreshToken param.Field[string] `json:"refreshToken"`
+ RunnerID param.Field[string] `json:"runnerId" format:"uuid"`
+ // Maximum 100 scopes allowed (101 for validation purposes)
+ Scopes param.Field[[]string] `json:"scopes"`
+ Source param.Field[HostAuthenticationTokenSource] `json:"source"`
+ // Subject identifies the principal (user or service account) for the token
+ Subject param.Field[shared.SubjectParam] `json:"subject"`
+ // Deprecated: Use principal_id and principal_type instead
+ UserID param.Field[string] `json:"userId" format:"uuid"`
}
func (r RunnerConfigurationHostAuthenticationTokenNewParams) MarshalJSON() (data []byte, err error) {
@@ -605,6 +629,7 @@ type RunnerConfigurationHostAuthenticationTokenUpdateParams struct {
// to obtain a formatter capable of generating timestamps in this format.
ExpiresAt param.Field[time.Time] `json:"expiresAt" format:"date-time"`
RefreshToken param.Field[string] `json:"refreshToken"`
+ Scopes param.Field[[]string] `json:"scopes"`
}
func (r RunnerConfigurationHostAuthenticationTokenUpdateParams) MarshalJSON() (data []byte, err error) {
@@ -633,7 +658,12 @@ func (r RunnerConfigurationHostAuthenticationTokenListParams) URLQuery() (v url.
type RunnerConfigurationHostAuthenticationTokenListParamsFilter struct {
RunnerID param.Field[string] `json:"runnerId" format:"uuid"`
- UserID param.Field[string] `json:"userId" format:"uuid"`
+ // Filter by subject (user or service account)
+ SubjectID param.Field[string] `json:"subjectId" format:"uuid"`
+ // Deprecated: Use principal_id instead
+ //
+ // Deprecated: deprecated
+ UserID param.Field[string] `json:"userId" format:"uuid"`
}
func (r RunnerConfigurationHostAuthenticationTokenListParamsFilter) MarshalJSON() (data []byte, err error) {
diff --git a/runnerconfigurationhostauthenticationtoken_test.go b/runnerconfigurationhostauthenticationtoken_test.go
index 06879bb..bb02b12 100644
--- a/runnerconfigurationhostauthenticationtoken_test.go
+++ b/runnerconfigurationhostauthenticationtoken_test.go
@@ -12,6 +12,7 @@ import (
"github.com/gitpod-io/gitpod-sdk-go"
"github.com/gitpod-io/gitpod-sdk-go/internal/testutil"
"github.com/gitpod-io/gitpod-sdk-go/option"
+ "github.com/gitpod-io/gitpod-sdk-go/shared"
)
func TestRunnerConfigurationHostAuthenticationTokenNewWithOptionalParams(t *testing.T) {
@@ -28,13 +29,19 @@ func TestRunnerConfigurationHostAuthenticationTokenNewWithOptionalParams(t *test
option.WithBearerToken("My Bearer Token"),
)
_, err := client.Runners.Configurations.HostAuthenticationTokens.New(context.TODO(), gitpod.RunnerConfigurationHostAuthenticationTokenNewParams{
- Token: gitpod.F("gho_xxxxxxxxxxxx"),
- ExpiresAt: gitpod.F(time.Now()),
- Host: gitpod.F("github.com"),
- RefreshToken: gitpod.F("ghr_xxxxxxxxxxxx"),
- RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
- Source: gitpod.F(gitpod.HostAuthenticationTokenSourceOAuth),
- UserID: gitpod.F("f53d2330-3795-4c5d-a1f3-453121af9c60"),
+ Token: gitpod.F("gho_xxxxxxxxxxxx"),
+ ExpiresAt: gitpod.F(time.Now()),
+ Host: gitpod.F("github.com"),
+ IntegrationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ RefreshToken: gitpod.F("ghr_xxxxxxxxxxxx"),
+ RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
+ Scopes: gitpod.F([]string{"string"}),
+ Source: gitpod.F(gitpod.HostAuthenticationTokenSourceOAuth),
+ Subject: gitpod.F(shared.SubjectParam{
+ ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ Principal: gitpod.F(shared.PrincipalUnspecified),
+ }),
+ UserID: gitpod.F("f53d2330-3795-4c5d-a1f3-453121af9c60"),
})
if err != nil {
var apierr *gitpod.Error
@@ -88,6 +95,7 @@ func TestRunnerConfigurationHostAuthenticationTokenUpdateWithOptionalParams(t *t
Token: gitpod.F("gho_xxxxxxxxxxxx"),
ExpiresAt: gitpod.F(time.Now()),
RefreshToken: gitpod.F("ghr_xxxxxxxxxxxx"),
+ Scopes: gitpod.F([]string{"string"}),
})
if err != nil {
var apierr *gitpod.Error
@@ -115,8 +123,9 @@ func TestRunnerConfigurationHostAuthenticationTokenListWithOptionalParams(t *tes
Token: gitpod.F("token"),
PageSize: gitpod.F(int64(0)),
Filter: gitpod.F(gitpod.RunnerConfigurationHostAuthenticationTokenListParamsFilter{
- RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
- UserID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
+ SubjectID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ UserID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
}),
Pagination: gitpod.F(gitpod.RunnerConfigurationHostAuthenticationTokenListParamsPagination{
Token: gitpod.F("token"),
diff --git a/runnerconfigurationscmintegration.go b/runnerconfigurationscmintegration.go
index 03fad41..e6e8f6a 100644
--- a/runnerconfigurationscmintegration.go
+++ b/runnerconfigurationscmintegration.go
@@ -207,20 +207,26 @@ type ScmIntegration struct {
RunnerID string `json:"runnerId"`
// scm_id references the scm_id in the runner's configuration schema that this
// integration is for
- ScmID string `json:"scmId"`
- JSON scmIntegrationJSON `json:"-"`
+ ScmID string `json:"scmId"`
+ // virtual_directory is the virtual directory path for Azure DevOps Server (e.g.,
+ // "/tfs"). This field is only used for Azure DevOps Server SCM integrations and
+ // should be empty for other SCM types. Azure DevOps Server APIs work without
+ // collection when PAT scope is 'All accessible organizations'.
+ VirtualDirectory string `json:"virtualDirectory,nullable"`
+ JSON scmIntegrationJSON `json:"-"`
}
// scmIntegrationJSON contains the JSON metadata for the struct [ScmIntegration]
type scmIntegrationJSON struct {
- ID apijson.Field
- Host apijson.Field
- OAuth apijson.Field
- Pat apijson.Field
- RunnerID apijson.Field
- ScmID apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
+ ID apijson.Field
+ Host apijson.Field
+ OAuth apijson.Field
+ Pat apijson.Field
+ RunnerID apijson.Field
+ ScmID apijson.Field
+ VirtualDirectory apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
}
func (r *ScmIntegration) UnmarshalJSON(data []byte) (err error) {
@@ -326,6 +332,11 @@ type RunnerConfigurationScmIntegrationNewParams struct {
// scm_id references the scm_id in the runner's configuration schema that this
// integration is for
ScmID param.Field[string] `json:"scmId"`
+ // virtual_directory is the virtual directory path for Azure DevOps Server (e.g.,
+ // "/tfs"). This field is only used for Azure DevOps Server SCM integrations and
+ // should be empty for other SCM types. Azure DevOps Server APIs work without
+ // collection when PAT scope is 'All accessible organizations'.
+ VirtualDirectory param.Field[string] `json:"virtualDirectory"`
}
func (r RunnerConfigurationScmIntegrationNewParams) MarshalJSON() (data []byte, err error) {
@@ -362,6 +373,11 @@ type RunnerConfigurationScmIntegrationUpdateParams struct {
// This might lead to users being unable to access their repositories until they
// re-authenticate.
Pat param.Field[bool] `json:"pat"`
+ // virtual_directory is the virtual directory path for Azure DevOps Server (e.g.,
+ // "/tfs"). This field is only used for Azure DevOps Server SCM integrations and
+ // should be empty for other SCM types. Azure DevOps Server APIs work without
+ // collection when PAT scope is 'All accessible organizations'.
+ VirtualDirectory param.Field[string] `json:"virtualDirectory"`
}
func (r RunnerConfigurationScmIntegrationUpdateParams) MarshalJSON() (data []byte, err error) {
diff --git a/runnerconfigurationscmintegration_test.go b/runnerconfigurationscmintegration_test.go
index beb6112..5305d77 100644
--- a/runnerconfigurationscmintegration_test.go
+++ b/runnerconfigurationscmintegration_test.go
@@ -34,6 +34,7 @@ func TestRunnerConfigurationScmIntegrationNewWithOptionalParams(t *testing.T) {
Pat: gitpod.F(true),
RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
ScmID: gitpod.F("github"),
+ VirtualDirectory: gitpod.F("virtualDirectory"),
})
if err != nil {
var apierr *gitpod.Error
@@ -88,6 +89,7 @@ func TestRunnerConfigurationScmIntegrationUpdateWithOptionalParams(t *testing.T)
OAuthClientID: gitpod.F("new_client_id"),
OAuthPlaintextClientSecret: gitpod.F("new_client_secret"),
Pat: gitpod.F(true),
+ VirtualDirectory: gitpod.F("virtualDirectory"),
})
if err != nil {
var apierr *gitpod.Error
diff --git a/secret.go b/secret.go
index 990ce81..9139d2d 100644
--- a/secret.go
+++ b/secret.go
@@ -245,6 +245,8 @@ func (r *SecretService) UpdateValue(ctx context.Context, body SecretUpdateValueP
type Secret struct {
ID string `json:"id" format:"uuid"`
+ // api_only indicates the secret is only available via API/CLI
+ APIOnly bool `json:"apiOnly"`
// secret will be mounted as a registry secret
ContainerRegistryBasicAuthHost string `json:"containerRegistryBasicAuthHost" format:"uri"`
// A Timestamp represents a point in time independent of any time zone or local
@@ -445,6 +447,7 @@ type Secret struct {
// secretJSON contains the JSON metadata for the struct [Secret]
type secretJSON struct {
ID apijson.Field
+ APIOnly apijson.Field
ContainerRegistryBasicAuthHost apijson.Field
CreatedAt apijson.Field
Creator apijson.Field
@@ -467,6 +470,8 @@ func (r secretJSON) RawJSON() string {
}
type SecretScope struct {
+ // organization_id is the Organization ID this Secret belongs to
+ OrganizationID string `json:"organizationId" format:"uuid"`
// project_id is the Project ID this Secret belongs to
ProjectID string `json:"projectId" format:"uuid"`
// user_id is the User ID this Secret belongs to
@@ -476,10 +481,11 @@ type SecretScope struct {
// secretScopeJSON contains the JSON metadata for the struct [SecretScope]
type secretScopeJSON struct {
- ProjectID apijson.Field
- UserID apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
+ OrganizationID apijson.Field
+ ProjectID apijson.Field
+ UserID apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
}
func (r *SecretScope) UnmarshalJSON(data []byte) (err error) {
@@ -491,6 +497,8 @@ func (r secretScopeJSON) RawJSON() string {
}
type SecretScopeParam struct {
+ // organization_id is the Organization ID this Secret belongs to
+ OrganizationID param.Field[string] `json:"organizationId" format:"uuid"`
// project_id is the Project ID this Secret belongs to
ProjectID param.Field[string] `json:"projectId" format:"uuid"`
// user_id is the User ID this Secret belongs to
@@ -548,6 +556,10 @@ func (r secretGetValueResponseJSON) RawJSON() string {
type SecretUpdateValueResponse = interface{}
type SecretNewParams struct {
+ // api_only indicates the secret is only available via API/CLI. These secrets are
+ // NOT automatically injected into services or devcontainers. Useful for secrets
+ // that should only be consumed programmatically (e.g., by security agents).
+ APIOnly param.Field[bool] `json:"apiOnly"`
// secret will be mounted as a docker config in the environment VM, mount will have
// the docker registry host
ContainerRegistryBasicAuthHost param.Field[string] `json:"containerRegistryBasicAuthHost"`
diff --git a/secret_test.go b/secret_test.go
index 92f5a18..067688b 100644
--- a/secret_test.go
+++ b/secret_test.go
@@ -27,14 +27,16 @@ func TestSecretNewWithOptionalParams(t *testing.T) {
option.WithBearerToken("My Bearer Token"),
)
_, err := client.Secrets.New(context.TODO(), gitpod.SecretNewParams{
+ APIOnly: gitpod.F(true),
ContainerRegistryBasicAuthHost: gitpod.F("containerRegistryBasicAuthHost"),
EnvironmentVariable: gitpod.F(true),
FilePath: gitpod.F("filePath"),
Name: gitpod.F("DATABASE_URL"),
ProjectID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
Scope: gitpod.F(gitpod.SecretScopeParam{
- ProjectID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
- UserID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ ProjectID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ UserID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
}),
Value: gitpod.F("postgresql://user:pass@localhost:5432/db"),
})
@@ -66,8 +68,9 @@ func TestSecretListWithOptionalParams(t *testing.T) {
Filter: gitpod.F(gitpod.SecretListParamsFilter{
ProjectIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
Scope: gitpod.F(gitpod.SecretScopeParam{
- ProjectID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
- UserID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ ProjectID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
+ UserID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
}),
}),
Pagination: gitpod.F(gitpod.SecretListParamsPagination{
diff --git a/shared/shared.go b/shared/shared.go
index bec0078..a233b22 100644
--- a/shared/shared.go
+++ b/shared/shared.go
@@ -9,14 +9,24 @@ import (
"github.com/gitpod-io/gitpod-sdk-go/internal/param"
)
-// An AutomationTrigger represents a trigger for an automation action. The
+// An AutomationTrigger represents a trigger for an automation action. The `manual`
+// field shows a start button in the UI for manually triggering the automation. The
+// `post_machine_start` field indicates that the automation should be triggered
+// after the machine has started, before the devcontainer is ready. This is used
+// for machine-level services like security agents that need to start early. The
// `post_environment_start` field indicates that the automation should be triggered
-// after the environment has started. The `post_devcontainer_start` field indicates
-// that the automation should be triggered after the dev container has started.
+// after the environment has started (devcontainer ready). The
+// `post_devcontainer_start` field indicates that the automation should be
+// triggered after the dev container has started. The `prebuild` field starts the
+// automation during a prebuild of an environment. This phase does not have user
+// secrets available. Note: The prebuild trigger can only be used with tasks, not
+// services.
type AutomationTrigger struct {
Manual bool `json:"manual"`
PostDevcontainerStart bool `json:"postDevcontainerStart"`
PostEnvironmentStart bool `json:"postEnvironmentStart"`
+ PostMachineStart bool `json:"postMachineStart"`
+ Prebuild bool `json:"prebuild"`
JSON automationTriggerJSON `json:"-"`
}
@@ -26,6 +36,8 @@ type automationTriggerJSON struct {
Manual apijson.Field
PostDevcontainerStart apijson.Field
PostEnvironmentStart apijson.Field
+ PostMachineStart apijson.Field
+ Prebuild apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
@@ -38,14 +50,24 @@ func (r automationTriggerJSON) RawJSON() string {
return r.raw
}
-// An AutomationTrigger represents a trigger for an automation action. The
+// An AutomationTrigger represents a trigger for an automation action. The `manual`
+// field shows a start button in the UI for manually triggering the automation. The
+// `post_machine_start` field indicates that the automation should be triggered
+// after the machine has started, before the devcontainer is ready. This is used
+// for machine-level services like security agents that need to start early. The
// `post_environment_start` field indicates that the automation should be triggered
-// after the environment has started. The `post_devcontainer_start` field indicates
-// that the automation should be triggered after the dev container has started.
+// after the environment has started (devcontainer ready). The
+// `post_devcontainer_start` field indicates that the automation should be
+// triggered after the dev container has started. The `prebuild` field starts the
+// automation during a prebuild of an environment. This phase does not have user
+// secrets available. Note: The prebuild trigger can only be used with tasks, not
+// services.
type AutomationTriggerParam struct {
Manual param.Field[bool] `json:"manual"`
PostDevcontainerStart param.Field[bool] `json:"postDevcontainerStart"`
PostEnvironmentStart param.Field[bool] `json:"postEnvironmentStart"`
+ PostMachineStart param.Field[bool] `json:"postMachineStart"`
+ Prebuild param.Field[bool] `json:"prebuild"`
}
func (r AutomationTriggerParam) MarshalJSON() (data []byte, err error) {
@@ -112,6 +134,84 @@ func (r EnvironmentClassParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
+// EnvironmentVariableItem represents an environment variable that can be set
+// either from a literal value or from a secret reference.
+type EnvironmentVariableItem struct {
+ // name is the environment variable name.
+ Name string `json:"name"`
+ // value is a literal string value.
+ Value string `json:"value"`
+ // value_from specifies a source for the value.
+ ValueFrom EnvironmentVariableSource `json:"valueFrom"`
+ JSON environmentVariableItemJSON `json:"-"`
+}
+
+// environmentVariableItemJSON contains the JSON metadata for the struct
+// [EnvironmentVariableItem]
+type environmentVariableItemJSON struct {
+ Name apijson.Field
+ Value apijson.Field
+ ValueFrom apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *EnvironmentVariableItem) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r environmentVariableItemJSON) RawJSON() string {
+ return r.raw
+}
+
+// EnvironmentVariableItem represents an environment variable that can be set
+// either from a literal value or from a secret reference.
+type EnvironmentVariableItemParam struct {
+ // name is the environment variable name.
+ Name param.Field[string] `json:"name"`
+ // value is a literal string value.
+ Value param.Field[string] `json:"value"`
+ // value_from specifies a source for the value.
+ ValueFrom param.Field[EnvironmentVariableSourceParam] `json:"valueFrom"`
+}
+
+func (r EnvironmentVariableItemParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// EnvironmentVariableSource specifies a source for an environment variable value.
+type EnvironmentVariableSource struct {
+ // secret_ref references a secret by ID.
+ SecretRef SecretRef `json:"secretRef,required"`
+ JSON environmentVariableSourceJSON `json:"-"`
+}
+
+// environmentVariableSourceJSON contains the JSON metadata for the struct
+// [EnvironmentVariableSource]
+type environmentVariableSourceJSON struct {
+ SecretRef apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *EnvironmentVariableSource) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r environmentVariableSourceJSON) RawJSON() string {
+ return r.raw
+}
+
+// EnvironmentVariableSource specifies a source for an environment variable value.
+type EnvironmentVariableSourceParam struct {
+ // secret_ref references a secret by ID.
+ SecretRef param.Field[SecretRefParam] `json:"secretRef,required"`
+}
+
+func (r EnvironmentVariableSourceParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
type FieldValue struct {
Key string `json:"key"`
Value string `json:"value"`
@@ -198,24 +298,126 @@ const (
PrincipalEnvironment Principal = "PRINCIPAL_ENVIRONMENT"
PrincipalServiceAccount Principal = "PRINCIPAL_SERVICE_ACCOUNT"
PrincipalRunnerManager Principal = "PRINCIPAL_RUNNER_MANAGER"
+ PrincipalAgentExecution Principal = "PRINCIPAL_AGENT_EXECUTION"
)
func (r Principal) IsKnown() bool {
switch r {
- case PrincipalUnspecified, PrincipalAccount, PrincipalUser, PrincipalRunner, PrincipalEnvironment, PrincipalServiceAccount, PrincipalRunnerManager:
+ case PrincipalUnspecified, PrincipalAccount, PrincipalUser, PrincipalRunner, PrincipalEnvironment, PrincipalServiceAccount, PrincipalRunnerManager, PrincipalAgentExecution:
+ return true
+ }
+ return false
+}
+
+type ProjectEnvironmentClass struct {
+ // Use a fixed environment class on a given Runner. This cannot be a local runner's
+ // environment class.
+ EnvironmentClassID string `json:"environmentClassId" format:"uuid"`
+ // Use a local runner for the user
+ LocalRunner bool `json:"localRunner"`
+ // order is the priority of this entry
+ Order int64 `json:"order"`
+ JSON projectEnvironmentClassJSON `json:"-"`
+}
+
+// projectEnvironmentClassJSON contains the JSON metadata for the struct
+// [ProjectEnvironmentClass]
+type projectEnvironmentClassJSON struct {
+ EnvironmentClassID apijson.Field
+ LocalRunner apijson.Field
+ Order apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *ProjectEnvironmentClass) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r projectEnvironmentClassJSON) RawJSON() string {
+ return r.raw
+}
+
+type ProjectEnvironmentClassParam struct {
+ // Use a fixed environment class on a given Runner. This cannot be a local runner's
+ // environment class.
+ EnvironmentClassID param.Field[string] `json:"environmentClassId" format:"uuid"`
+ // Use a local runner for the user
+ LocalRunner param.Field[bool] `json:"localRunner"`
+ // order is the priority of this entry
+ Order param.Field[int64] `json:"order"`
+}
+
+func (r ProjectEnvironmentClassParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type ResourceType string
+
+const (
+ ResourceTypeUnspecified ResourceType = "RESOURCE_TYPE_UNSPECIFIED"
+ ResourceTypeEnvironment ResourceType = "RESOURCE_TYPE_ENVIRONMENT"
+ ResourceTypeRunner ResourceType = "RESOURCE_TYPE_RUNNER"
+ ResourceTypeProject ResourceType = "RESOURCE_TYPE_PROJECT"
+ ResourceTypeTask ResourceType = "RESOURCE_TYPE_TASK"
+ ResourceTypeTaskExecution ResourceType = "RESOURCE_TYPE_TASK_EXECUTION"
+ ResourceTypeService ResourceType = "RESOURCE_TYPE_SERVICE"
+ ResourceTypeOrganization ResourceType = "RESOURCE_TYPE_ORGANIZATION"
+ ResourceTypeUser ResourceType = "RESOURCE_TYPE_USER"
+ ResourceTypeEnvironmentClass ResourceType = "RESOURCE_TYPE_ENVIRONMENT_CLASS"
+ ResourceTypeRunnerScmIntegration ResourceType = "RESOURCE_TYPE_RUNNER_SCM_INTEGRATION"
+ ResourceTypeHostAuthenticationToken ResourceType = "RESOURCE_TYPE_HOST_AUTHENTICATION_TOKEN"
+ ResourceTypeGroup ResourceType = "RESOURCE_TYPE_GROUP"
+ ResourceTypePersonalAccessToken ResourceType = "RESOURCE_TYPE_PERSONAL_ACCESS_TOKEN"
+ ResourceTypeUserPreference ResourceType = "RESOURCE_TYPE_USER_PREFERENCE"
+ ResourceTypeServiceAccount ResourceType = "RESOURCE_TYPE_SERVICE_ACCOUNT"
+ ResourceTypeSecret ResourceType = "RESOURCE_TYPE_SECRET"
+ ResourceTypeSSOConfig ResourceType = "RESOURCE_TYPE_SSO_CONFIG"
+ ResourceTypeDomainVerification ResourceType = "RESOURCE_TYPE_DOMAIN_VERIFICATION"
+ ResourceTypeAgentExecution ResourceType = "RESOURCE_TYPE_AGENT_EXECUTION"
+ ResourceTypeRunnerLlmIntegration ResourceType = "RESOURCE_TYPE_RUNNER_LLM_INTEGRATION"
+ ResourceTypeAgent ResourceType = "RESOURCE_TYPE_AGENT"
+ ResourceTypeEnvironmentSession ResourceType = "RESOURCE_TYPE_ENVIRONMENT_SESSION"
+ ResourceTypeUserSecret ResourceType = "RESOURCE_TYPE_USER_SECRET"
+ ResourceTypeOrganizationPolicy ResourceType = "RESOURCE_TYPE_ORGANIZATION_POLICY"
+ ResourceTypeOrganizationSecret ResourceType = "RESOURCE_TYPE_ORGANIZATION_SECRET"
+ ResourceTypeProjectEnvironmentClass ResourceType = "RESOURCE_TYPE_PROJECT_ENVIRONMENT_CLASS"
+ ResourceTypeBilling ResourceType = "RESOURCE_TYPE_BILLING"
+ ResourceTypePrompt ResourceType = "RESOURCE_TYPE_PROMPT"
+ ResourceTypeCoupon ResourceType = "RESOURCE_TYPE_COUPON"
+ ResourceTypeCouponRedemption ResourceType = "RESOURCE_TYPE_COUPON_REDEMPTION"
+ ResourceTypeAccount ResourceType = "RESOURCE_TYPE_ACCOUNT"
+ ResourceTypeIntegration ResourceType = "RESOURCE_TYPE_INTEGRATION"
+ ResourceTypeWorkflow ResourceType = "RESOURCE_TYPE_WORKFLOW"
+ ResourceTypeWorkflowExecution ResourceType = "RESOURCE_TYPE_WORKFLOW_EXECUTION"
+ ResourceTypeWorkflowExecutionAction ResourceType = "RESOURCE_TYPE_WORKFLOW_EXECUTION_ACTION"
+ ResourceTypeSnapshot ResourceType = "RESOURCE_TYPE_SNAPSHOT"
+ ResourceTypePrebuild ResourceType = "RESOURCE_TYPE_PREBUILD"
+ ResourceTypeOrganizationLlmIntegration ResourceType = "RESOURCE_TYPE_ORGANIZATION_LLM_INTEGRATION"
+ ResourceTypeCustomDomain ResourceType = "RESOURCE_TYPE_CUSTOM_DOMAIN"
+ ResourceTypeRoleAssignmentChanged ResourceType = "RESOURCE_TYPE_ROLE_ASSIGNMENT_CHANGED"
+ ResourceTypeGroupMembershipChanged ResourceType = "RESOURCE_TYPE_GROUP_MEMBERSHIP_CHANGED"
+)
+
+func (r ResourceType) IsKnown() bool {
+ switch r {
+ case ResourceTypeUnspecified, ResourceTypeEnvironment, ResourceTypeRunner, ResourceTypeProject, ResourceTypeTask, ResourceTypeTaskExecution, ResourceTypeService, ResourceTypeOrganization, ResourceTypeUser, ResourceTypeEnvironmentClass, ResourceTypeRunnerScmIntegration, ResourceTypeHostAuthenticationToken, ResourceTypeGroup, ResourceTypePersonalAccessToken, ResourceTypeUserPreference, ResourceTypeServiceAccount, ResourceTypeSecret, ResourceTypeSSOConfig, ResourceTypeDomainVerification, ResourceTypeAgentExecution, ResourceTypeRunnerLlmIntegration, ResourceTypeAgent, ResourceTypeEnvironmentSession, ResourceTypeUserSecret, ResourceTypeOrganizationPolicy, ResourceTypeOrganizationSecret, ResourceTypeProjectEnvironmentClass, ResourceTypeBilling, ResourceTypePrompt, ResourceTypeCoupon, ResourceTypeCouponRedemption, ResourceTypeAccount, ResourceTypeIntegration, ResourceTypeWorkflow, ResourceTypeWorkflowExecution, ResourceTypeWorkflowExecutionAction, ResourceTypeSnapshot, ResourceTypePrebuild, ResourceTypeOrganizationLlmIntegration, ResourceTypeCustomDomain, ResourceTypeRoleAssignmentChanged, ResourceTypeGroupMembershipChanged:
return true
}
return false
}
type RunsOn struct {
- Docker RunsOnDocker `json:"docker,required"`
- JSON runsOnJSON `json:"-"`
+ Docker RunsOnDocker `json:"docker"`
+ // Machine runs the service/task directly on the VM/machine level.
+ Machine interface{} `json:"machine"`
+ JSON runsOnJSON `json:"-"`
}
// runsOnJSON contains the JSON metadata for the struct [RunsOn]
type runsOnJSON struct {
Docker apijson.Field
+ Machine apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
@@ -251,7 +453,9 @@ func (r runsOnDockerJSON) RawJSON() string {
}
type RunsOnParam struct {
- Docker param.Field[RunsOnDockerParam] `json:"docker,required"`
+ Docker param.Field[RunsOnDockerParam] `json:"docker"`
+ // Machine runs the service/task directly on the VM/machine level.
+ Machine param.Field[interface{}] `json:"machine"`
}
func (r RunsOnParam) MarshalJSON() (data []byte, err error) {
@@ -267,9 +471,41 @@ func (r RunsOnDockerParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
+// SecretRef references a secret by its ID.
+type SecretRef struct {
+ // id is the UUID of the secret to reference.
+ ID string `json:"id" format:"uuid"`
+ JSON secretRefJSON `json:"-"`
+}
+
+// secretRefJSON contains the JSON metadata for the struct [SecretRef]
+type secretRefJSON struct {
+ ID apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *SecretRef) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r secretRefJSON) RawJSON() string {
+ return r.raw
+}
+
+// SecretRef references a secret by its ID.
+type SecretRefParam struct {
+ // id is the UUID of the secret to reference.
+ ID param.Field[string] `json:"id" format:"uuid"`
+}
+
+func (r SecretRefParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
type Subject struct {
// id is the UUID of the subject
- ID string `json:"id"`
+ ID string `json:"id" format:"uuid"`
// Principal is the principal of the subject
Principal Principal `json:"principal"`
JSON subjectJSON `json:"-"`
@@ -293,7 +529,7 @@ func (r subjectJSON) RawJSON() string {
type SubjectParam struct {
// id is the UUID of the subject
- ID param.Field[string] `json:"id"`
+ ID param.Field[string] `json:"id" format:"uuid"`
// Principal is the principal of the subject
Principal param.Field[Principal] `json:"principal"`
}
@@ -661,6 +897,8 @@ func (r TaskMetadataParam) MarshalJSON() (data []byte, err error) {
type TaskSpec struct {
// command contains the command the task should execute
Command string `json:"command"`
+ // env specifies environment variables for the task.
+ Env []EnvironmentVariableItem `json:"env"`
// runs_on specifies the environment the task should run on.
RunsOn RunsOn `json:"runsOn"`
JSON taskSpecJSON `json:"-"`
@@ -669,6 +907,7 @@ type TaskSpec struct {
// taskSpecJSON contains the JSON metadata for the struct [TaskSpec]
type taskSpecJSON struct {
Command apijson.Field
+ Env apijson.Field
RunsOn apijson.Field
raw string
ExtraFields map[string]apijson.Field
@@ -685,6 +924,8 @@ func (r taskSpecJSON) RawJSON() string {
type TaskSpecParam struct {
// command contains the command the task should execute
Command param.Field[string] `json:"command"`
+ // env specifies environment variables for the task.
+ Env param.Field[[]EnvironmentVariableItemParam] `json:"env"`
// runs_on specifies the environment the task should run on.
RunsOn param.Field[RunsOnParam] `json:"runsOn"`
}
diff --git a/user.go b/user.go
index 467c393..2c5c737 100644
--- a/user.go
+++ b/user.go
@@ -38,6 +38,15 @@ func NewUserService(opts ...option.RequestOption) (r *UserService) {
return
}
+// Deletes a user. If the User comes from an organization's SSO provider, the
+// Account will also be deleted.
+func (r *UserService) DeleteUser(ctx context.Context, body UserDeleteUserParams, opts ...option.RequestOption) (res *UserDeleteUserResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.UserService/DeleteUser"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
// Gets information about the currently authenticated user.
//
// Use this method to:
@@ -63,6 +72,30 @@ func (r *UserService) GetAuthenticatedUser(ctx context.Context, body UserGetAuth
return
}
+// Gets basic information about a specific user by their ID.
+//
+// Use this method to:
+//
+// - Retrieve user profile information
+// - Get user details for display purposes
+// - Fetch user metadata for administrative tasks
+//
+// ### Examples
+//
+// - Get user by ID:
+//
+// Retrieves basic user information by user ID.
+//
+// ```yaml
+// userId: "f53d2330-3795-4c5d-a1f3-453121af9c60"
+// ```
+func (r *UserService) GetUser(ctx context.Context, body UserGetUserParams, opts ...option.RequestOption) (res *UserGetUserResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "gitpod.v1.UserService/GetUser"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
// Sets whether a user account is suspended.
//
// Use this method to:
@@ -104,6 +137,8 @@ type User struct {
AvatarURL string `json:"avatarUrl"`
// created_at is the creation time
CreatedAt time.Time `json:"createdAt" format:"date-time"`
+ // email is the user's email address
+ Email string `json:"email"`
// name is the full name of the user
Name string `json:"name"`
// organization_id is the id of the organization this account is owned by.
@@ -120,6 +155,7 @@ type userJSON struct {
ID apijson.Field
AvatarURL apijson.Field
CreatedAt apijson.Field
+ Email apijson.Field
Name apijson.Field
OrganizationID apijson.Field
Status apijson.Field
@@ -135,6 +171,8 @@ func (r userJSON) RawJSON() string {
return r.raw
}
+type UserDeleteUserResponse = interface{}
+
type UserGetAuthenticatedUserResponse struct {
User User `json:"user,required"`
JSON userGetAuthenticatedUserResponseJSON `json:"-"`
@@ -156,8 +194,37 @@ func (r userGetAuthenticatedUserResponseJSON) RawJSON() string {
return r.raw
}
+type UserGetUserResponse struct {
+ User User `json:"user,required"`
+ JSON userGetUserResponseJSON `json:"-"`
+}
+
+// userGetUserResponseJSON contains the JSON metadata for the struct
+// [UserGetUserResponse]
+type userGetUserResponseJSON struct {
+ User apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *UserGetUserResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r userGetUserResponseJSON) RawJSON() string {
+ return r.raw
+}
+
type UserSetSuspendedResponse = interface{}
+type UserDeleteUserParams struct {
+ UserID param.Field[string] `json:"userId" format:"uuid"`
+}
+
+func (r UserDeleteUserParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
type UserGetAuthenticatedUserParams struct {
Empty param.Field[bool] `json:"empty"`
}
@@ -166,6 +233,14 @@ func (r UserGetAuthenticatedUserParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
+type UserGetUserParams struct {
+ UserID param.Field[string] `json:"userId" format:"uuid"`
+}
+
+func (r UserGetUserParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
type UserSetSuspendedParams struct {
Suspended param.Field[bool] `json:"suspended"`
UserID param.Field[string] `json:"userId" format:"uuid"`
diff --git a/user_test.go b/user_test.go
index 0a5872b..e7c2636 100644
--- a/user_test.go
+++ b/user_test.go
@@ -13,6 +13,31 @@ import (
"github.com/gitpod-io/gitpod-sdk-go/option"
)
+func TestUserDeleteUserWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Users.DeleteUser(context.TODO(), gitpod.UserDeleteUserParams{
+ UserID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
func TestUserGetAuthenticatedUserWithOptionalParams(t *testing.T) {
t.Skip("Prism tests are disabled")
baseURL := "http://localhost:4010"
@@ -38,6 +63,31 @@ func TestUserGetAuthenticatedUserWithOptionalParams(t *testing.T) {
}
}
+func TestUserGetUserWithOptionalParams(t *testing.T) {
+ t.Skip("Prism tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := gitpod.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithBearerToken("My Bearer Token"),
+ )
+ _, err := client.Users.GetUser(context.TODO(), gitpod.UserGetUserParams{
+ UserID: gitpod.F("f53d2330-3795-4c5d-a1f3-453121af9c60"),
+ })
+ if err != nil {
+ var apierr *gitpod.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
func TestUserSetSuspendedWithOptionalParams(t *testing.T) {
t.Skip("Prism tests are disabled")
baseURL := "http://localhost:4010"
From 159a586717bbee1360439eaef4ab316a046409e8 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Mon, 15 Dec 2025 18:04:42 +0000
Subject: [PATCH 2/2] release: 0.7.0
---
.release-please-manifest.json | 2 +-
CHANGELOG.md | 8 ++++++++
README.md | 2 +-
internal/version.go | 2 +-
4 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index ac03171..1b77f50 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.6.1"
+ ".": "0.7.0"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6e18534..484c1fe 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## 0.7.0 (2025-12-15)
+
+Full Changelog: [v0.6.1...v0.7.0](https://github.com/gitpod-io/gitpod-sdk-go/compare/v0.6.1...v0.7.0)
+
+### Features
+
+* **api:** RBAC APIs ([dfee19e](https://github.com/gitpod-io/gitpod-sdk-go/commit/dfee19e63c7697876819a9bf516ec4466a3179ee))
+
## 0.6.1 (2025-12-06)
Full Changelog: [v0.6.0...v0.6.1](https://github.com/gitpod-io/gitpod-sdk-go/compare/v0.6.0...v0.6.1)
diff --git a/README.md b/README.md
index b91a3f2..b88b96e 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@ Or to pin the version:
```sh
-go get -u 'github.com/gitpod-io/gitpod-sdk-go@v0.6.1'
+go get -u 'github.com/gitpod-io/gitpod-sdk-go@v0.7.0'
```
diff --git a/internal/version.go b/internal/version.go
index 6dfc989..79301ae 100644
--- a/internal/version.go
+++ b/internal/version.go
@@ -2,4 +2,4 @@
package internal
-const PackageVersion = "0.6.1" // x-release-please-version
+const PackageVersion = "0.7.0" // x-release-please-version