diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index f14b480..aaf968a 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.1.0-alpha.2"
+ ".": "0.1.0-alpha.3"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 1b7c986..c57d3dc 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 106
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-da4c36c6b1d973f481abb8eefdeb085d88eaf37eeaba30d276cb3daa405b6f0c.yml
+configured_endpoints: 111
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-988164042da1361feb3d28364c6f14fee775ceab496b9d79d048141c0fa6da19.yml
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cd525af..844e944 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,21 @@
# Changelog
+## 0.1.0-alpha.3 (2025-02-13)
+
+Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/gitpod-io/gitpod-sdk-go/compare/v0.1.0-alpha.2...v0.1.0-alpha.3)
+
+### Features
+
+* **api:** manual updates ([#17](https://github.com/gitpod-io/gitpod-sdk-go/issues/17)) ([762e8f7](https://github.com/gitpod-io/gitpod-sdk-go/commit/762e8f70ad9507a80a2cddefe31e79d128919c06))
+* **api:** manual updates ([#18](https://github.com/gitpod-io/gitpod-sdk-go/issues/18)) ([3d70885](https://github.com/gitpod-io/gitpod-sdk-go/commit/3d708857be80530a1b8cc5169b5b03dbc38bebd3))
+* **api:** manual updates ([#20](https://github.com/gitpod-io/gitpod-sdk-go/issues/20)) ([47bc0b1](https://github.com/gitpod-io/gitpod-sdk-go/commit/47bc0b103590ceace9c56bec72a8c6da133f5f17))
+* **api:** manual updates ([#22](https://github.com/gitpod-io/gitpod-sdk-go/issues/22)) ([fd57922](https://github.com/gitpod-io/gitpod-sdk-go/commit/fd57922f815b9c876056ea9a878ac5c352af1ca9))
+* **api:** manual updates ([#23](https://github.com/gitpod-io/gitpod-sdk-go/issues/23)) ([33e7aed](https://github.com/gitpod-io/gitpod-sdk-go/commit/33e7aed13c50f6458e8f0c4a7fba7fcb9e775f24))
+* **api:** manual updates ([#25](https://github.com/gitpod-io/gitpod-sdk-go/issues/25)) ([d8140c6](https://github.com/gitpod-io/gitpod-sdk-go/commit/d8140c673b66d53bfe58ff315ad4e9062b7cc5ac))
+* **api:** Overview page updates ([#26](https://github.com/gitpod-io/gitpod-sdk-go/issues/26)) ([a85f0c2](https://github.com/gitpod-io/gitpod-sdk-go/commit/a85f0c2a5d99d9616bb3013fb98b88b23967e1df))
+* **api:** update examples ([#21](https://github.com/gitpod-io/gitpod-sdk-go/issues/21)) ([48bf713](https://github.com/gitpod-io/gitpod-sdk-go/commit/48bf7138ab06ae118aaefc46c9ff2a9809a25d77))
+* **api:** update with latest API spec ([#24](https://github.com/gitpod-io/gitpod-sdk-go/issues/24)) ([7232ba6](https://github.com/gitpod-io/gitpod-sdk-go/commit/7232ba6189894f53d16d94218c7b0e2d361c4ea7))
+
## 0.1.0-alpha.2 (2025-02-11)
Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/gitpod-io/gitpod-sdk-go/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)
diff --git a/README.md b/README.md
index f2557da..4c35e17 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
The Gitpod Go library provides convenient access to [the Gitpod REST
-API](https://docs.gitpod.com) from applications written in Go. The full API of this library can be found in [api.md](api.md).
+API](https://docs.gitpod.io) from applications written in Go. The full API of this library can be found in [api.md](api.md).
It is generated with [Stainless](https://www.stainlessapi.com/).
@@ -24,7 +24,7 @@ Or to pin the version:
```sh
-go get -u 'github.com/gitpod-io/gitpod-sdk-go@v0.1.0-alpha.2'
+go get -u 'github.com/gitpod-io/gitpod-sdk-go@v0.1.0-alpha.3'
```
@@ -52,11 +52,11 @@ func main() {
client := gitpod.NewClient(
option.WithBearerToken("My Bearer Token"), // defaults to os.LookupEnv("GITPOD_API_KEY")
)
- runner, err := client.Runners.New(context.TODO(), gitpod.RunnerNewParams{})
+ response, err := client.Identity.GetAuthenticatedIdentity(context.TODO(), gitpod.IdentityGetAuthenticatedIdentityParams{})
if err != nil {
panic(err.Error())
}
- fmt.Printf("%+v\n", runner.AccessToken)
+ fmt.Printf("%+v\n", response.OrganizationID)
}
```
@@ -145,7 +145,7 @@ client := gitpod.NewClient(
option.WithHeader("X-Some-Header", "custom_header_info"),
)
-client.Runners.New(context.TODO(), ...,
+client.Identity.GetAuthenticatedIdentity(context.TODO(), ...,
// Override the header
option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
// Add an undocumented field to the request body, using sjson syntax
@@ -162,11 +162,11 @@ This library provides some conveniences for working with paginated list endpoint
You can use `.ListAutoPaging()` methods to iterate through items across all pages:
```go
-iter := client.Environments.Automations.Services.ListAutoPaging(context.TODO(), gitpod.EnvironmentAutomationServiceListParams{})
+iter := client.Environments.ListAutoPaging(context.TODO(), gitpod.EnvironmentListParams{})
// Automatically fetches more pages as needed.
for iter.Next() {
- service := iter.Current()
- fmt.Printf("%+v\n", service)
+ environment := iter.Current()
+ fmt.Printf("%+v\n", environment)
}
if err := iter.Err(); err != nil {
panic(err.Error())
@@ -177,10 +177,10 @@ Or you can use simple `.List()` methods to fetch a single page and receive a sta
with additional helper methods like `.GetNextPage()`, e.g.:
```go
-page, err := client.Environments.Automations.Services.List(context.TODO(), gitpod.EnvironmentAutomationServiceListParams{})
+page, err := client.Environments.List(context.TODO(), gitpod.EnvironmentListParams{})
for page != nil {
- for _, service := range page.Services {
- fmt.Printf("%+v\n", service)
+ for _, environment := range page.Environments {
+ fmt.Printf("%+v\n", environment)
}
page, err = page.GetNextPage()
}
@@ -199,14 +199,14 @@ When the API returns a non-success status code, we return an error with type
To handle errors, we recommend that you use the `errors.As` pattern:
```go
-_, err := client.Runners.New(context.TODO(), gitpod.RunnerNewParams{})
+_, err := client.Identity.GetAuthenticatedIdentity(context.TODO(), gitpod.IdentityGetAuthenticatedIdentityParams{})
if err != nil {
var apierr *gitpod.Error
if errors.As(err, &apierr) {
println(string(apierr.DumpRequest(true))) // Prints the serialized HTTP request
println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
}
- panic(err.Error()) // GET "/gitpod.v1.RunnerService/CreateRunner": 400 Bad Request { ... }
+ panic(err.Error()) // GET "/gitpod.v1.IdentityService/GetAuthenticatedIdentity": 400 Bad Request { ... }
}
```
@@ -224,9 +224,9 @@ To set a per-retry timeout, use `option.WithRequestTimeout()`.
// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
-client.Runners.New(
+client.Identity.GetAuthenticatedIdentity(
ctx,
- gitpod.RunnerNewParams{},
+ gitpod.IdentityGetAuthenticatedIdentityParams{},
// This sets the per-retry timeout
option.WithRequestTimeout(20*time.Second),
)
@@ -260,9 +260,9 @@ client := gitpod.NewClient(
)
// Override per-request:
-client.Runners.New(
+client.Identity.GetAuthenticatedIdentity(
context.TODO(),
- gitpod.RunnerNewParams{},
+ gitpod.IdentityGetAuthenticatedIdentityParams{},
option.WithMaxRetries(5),
)
```
@@ -275,15 +275,15 @@ you need to examine response headers, status codes, or other details.
```go
// Create a variable to store the HTTP response
var response *http.Response
-runner, err := client.Runners.New(
+response, err := client.Identity.GetAuthenticatedIdentity(
context.TODO(),
- gitpod.RunnerNewParams{},
+ gitpod.IdentityGetAuthenticatedIdentityParams{},
option.WithResponseInto(&response),
)
if err != nil {
// handle error
}
-fmt.Printf("%+v\n", runner)
+fmt.Printf("%+v\n", response)
fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
diff --git a/account.go b/account.go
index 58194a4..7a5e8a2 100644
--- a/account.go
+++ b/account.go
@@ -87,8 +87,7 @@ func (r *AccountService) ListLoginProvidersAutoPaging(ctx context.Context, param
}
type Account struct {
- ID string `json:"id" format:"uuid"`
- AvatarURL string `json:"avatarUrl"`
+ ID string `json:"id,required" 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,
@@ -177,17 +176,12 @@ type Account 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"`
- Email string `json:"email"`
- Joinables []JoinableOrganization `json:"joinables"`
- Memberships []AccountMembership `json:"memberships"`
- Name string `json:"name"`
- // organization_id is the ID of the organization the account is owned by if it's
- // created through custom SSO
- OrganizationID string `json:"organizationId,nullable"`
+ CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
+ Email string `json:"email,required"`
+ Name string `json:"name,required"`
// public_email_provider is true if the email for the Account matches a known
// public email provider
- PublicEmailProvider bool `json:"publicEmailProvider"`
+ PublicEmailProvider bool `json:"publicEmailProvider,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
// resolution. The count is relative to an epoch at UTC midnight on January 1,
@@ -276,22 +270,28 @@ type Account struct {
// 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 accountJSON `json:"-"`
+ UpdatedAt time.Time `json:"updatedAt,required" format:"date-time"`
+ AvatarURL string `json:"avatarUrl"`
+ Joinables []JoinableOrganization `json:"joinables"`
+ Memberships []AccountMembership `json:"memberships"`
+ // organization_id is the ID of the organization the account is owned by if it's
+ // created through custom SSO
+ OrganizationID string `json:"organizationId,nullable"`
+ JSON accountJSON `json:"-"`
}
// accountJSON contains the JSON metadata for the struct [Account]
type accountJSON struct {
ID apijson.Field
- AvatarURL apijson.Field
CreatedAt apijson.Field
Email apijson.Field
- Joinables apijson.Field
- Memberships apijson.Field
Name apijson.Field
- OrganizationID apijson.Field
PublicEmailProvider apijson.Field
UpdatedAt apijson.Field
+ AvatarURL apijson.Field
+ Joinables apijson.Field
+ Memberships apijson.Field
+ OrganizationID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
@@ -306,16 +306,16 @@ func (r accountJSON) RawJSON() string {
type AccountMembership struct {
// organization_id is the id of the organization the user is a member of
- OrganizationID string `json:"organizationId" format:"uuid"`
+ OrganizationID string `json:"organizationId,required" format:"uuid"`
// organization_name is the member count of the organization the user is a member
// of
- OrganizationMemberCount int64 `json:"organizationMemberCount"`
+ OrganizationMemberCount int64 `json:"organizationMemberCount,required"`
// organization_name is the name of the organization the user is a member of
- OrganizationName string `json:"organizationName"`
+ OrganizationName string `json:"organizationName,required"`
// user_id is the ID the user has in the organization
- UserID string `json:"userId" format:"uuid"`
+ UserID string `json:"userId,required" format:"uuid"`
// user_role is the role the user has in the organization
- UserRole shared.OrganizationRole `json:"userRole"`
+ UserRole shared.OrganizationRole `json:"userRole,required"`
JSON accountMembershipJSON `json:"-"`
}
@@ -341,12 +341,12 @@ func (r accountMembershipJSON) RawJSON() string {
type JoinableOrganization struct {
// organization_id is the id of the organization the user can join
- OrganizationID string `json:"organizationId" format:"uuid"`
+ OrganizationID string `json:"organizationId,required" format:"uuid"`
// organization_member_count is the member count of the organization the user can
// join
- OrganizationMemberCount int64 `json:"organizationMemberCount"`
+ OrganizationMemberCount int64 `json:"organizationMemberCount,required"`
// organization_name is the name of the organization the user can join
- OrganizationName string `json:"organizationName"`
+ OrganizationName string `json:"organizationName,required"`
JSON joinableOrganizationJSON `json:"-"`
}
@@ -370,10 +370,10 @@ func (r joinableOrganizationJSON) RawJSON() string {
type LoginProvider struct {
// login_url is the URL to redirect the browser agent to for login
- LoginURL string `json:"loginUrl"`
+ LoginURL string `json:"loginUrl,required"`
// provider is the provider used by this login method, e.g. "github", "google",
// "custom"
- Provider string `json:"provider"`
+ Provider string `json:"provider,required"`
JSON loginProviderJSON `json:"-"`
}
@@ -394,7 +394,7 @@ func (r loginProviderJSON) RawJSON() string {
}
type AccountGetResponse struct {
- Account Account `json:"account"`
+ Account Account `json:"account,required"`
JSON accountGetResponseJSON `json:"-"`
}
@@ -418,7 +418,7 @@ type AccountDeleteResponse = interface{}
type AccountGetSSOLoginURLResponse struct {
// login_url is the URL to redirect the user to for SSO login
- LoginURL string `json:"loginUrl"`
+ LoginURL string `json:"loginUrl,required"`
JSON accountGetSSOLoginURLResponseJSON `json:"-"`
}
@@ -447,7 +447,7 @@ func (r AccountGetParams) MarshalJSON() (data []byte, err error) {
}
type AccountDeleteParams struct {
- AccountID param.Field[string] `json:"accountId" format:"uuid"`
+ AccountID param.Field[string] `json:"accountId,required" format:"uuid"`
}
func (r AccountDeleteParams) MarshalJSON() (data []byte, err error) {
@@ -456,7 +456,7 @@ func (r AccountDeleteParams) MarshalJSON() (data []byte, err error) {
type AccountGetSSOLoginURLParams struct {
// email is the email the user wants to login with
- Email param.Field[string] `json:"email" format:"email"`
+ Email param.Field[string] `json:"email,required" format:"email"`
// return_to is the URL the user will be redirected to after login
ReturnTo param.Field[string] `json:"returnTo" format:"uri"`
}
diff --git a/account_test.go b/account_test.go
index e8be478..ad0d804 100644
--- a/account_test.go
+++ b/account_test.go
@@ -38,7 +38,7 @@ func TestAccountGetWithOptionalParams(t *testing.T) {
}
}
-func TestAccountDeleteWithOptionalParams(t *testing.T) {
+func TestAccountDelete(t *testing.T) {
t.Skip("skipped: tests are disabled for the time being")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
diff --git a/aliases.go b/aliases.go
index 52464d8..85a555d 100644
--- a/aliases.go
+++ b/aliases.go
@@ -88,6 +88,9 @@ type Subject = shared.Subject
// This is an alias to an internal type.
type SubjectParam = shared.SubjectParam
+// This is an alias to an internal type.
+type Task = shared.Task
+
// This is an alias to an internal type.
type TaskExecution = shared.TaskExecution
@@ -133,6 +136,18 @@ type TaskExecutionStatus = shared.TaskExecutionStatus
// This is an alias to an internal type.
type TaskExecutionStatusStep = shared.TaskExecutionStatusStep
+// This is an alias to an internal type.
+type TaskMetadata = shared.TaskMetadata
+
+// This is an alias to an internal type.
+type TaskMetadataParam = shared.TaskMetadataParam
+
+// This is an alias to an internal type.
+type TaskSpec = shared.TaskSpec
+
+// This is an alias to an internal type.
+type TaskSpecParam = shared.TaskSpecParam
+
// This is an alias to an internal type.
type UserStatus = shared.UserStatus
diff --git a/api.md b/api.md
index ed69f69..5aa7cbb 100644
--- a/api.md
+++ b/api.md
@@ -8,6 +8,8 @@
- shared.RunsOnParam
- shared.SubjectParam
- shared.TaskExecutionPhase
+- shared.TaskMetadataParam
+- shared.TaskSpecParam
# Shared Response Types
@@ -18,11 +20,14 @@
- shared.Principal
- shared.RunsOn
- shared.Subject
+- shared.Task
- shared.TaskExecution
- shared.TaskExecutionMetadata
- shared.TaskExecutionPhase
- shared.TaskExecutionSpec
- shared.TaskExecutionStatus
+- shared.TaskMetadata
+- shared.TaskSpec
- shared.UserStatus
# Accounts
@@ -147,16 +152,8 @@ Methods:
### Tasks
-Params Types:
-
-- gitpod.TaskMetadataParam
-- gitpod.TaskSpecParam
-
Response Types:
-- gitpod.Task
-- gitpod.TaskMetadata
-- gitpod.TaskSpec
- gitpod.EnvironmentAutomationTaskNewResponse
- gitpod.EnvironmentAutomationTaskGetResponse
- gitpod.EnvironmentAutomationTaskUpdateResponse
@@ -168,7 +165,7 @@ Methods:
- client.Environments.Automations.Tasks.New(ctx context.Context, body gitpod.EnvironmentAutomationTaskNewParams) (gitpod.EnvironmentAutomationTaskNewResponse, error)
- client.Environments.Automations.Tasks.Get(ctx context.Context, body gitpod.EnvironmentAutomationTaskGetParams) (gitpod.EnvironmentAutomationTaskGetResponse, error)
- client.Environments.Automations.Tasks.Update(ctx context.Context, body gitpod.EnvironmentAutomationTaskUpdateParams) (gitpod.EnvironmentAutomationTaskUpdateResponse, error)
-- client.Environments.Automations.Tasks.List(ctx context.Context, params gitpod.EnvironmentAutomationTaskListParams) (pagination.TasksPage[gitpod.Task], error)
+- client.Environments.Automations.Tasks.List(ctx context.Context, params gitpod.EnvironmentAutomationTaskListParams) (pagination.TasksPage[shared.Task], error)
- client.Environments.Automations.Tasks.Delete(ctx context.Context, body gitpod.EnvironmentAutomationTaskDeleteParams) (gitpod.EnvironmentAutomationTaskDeleteResponse, error)
- client.Environments.Automations.Tasks.Start(ctx context.Context, body gitpod.EnvironmentAutomationTaskStartParams) (gitpod.EnvironmentAutomationTaskStartResponse, error)
@@ -265,6 +262,25 @@ 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)
+## DomainVerifications
+
+Response Types:
+
+- gitpod.DomainVerification
+- gitpod.DomainVerificationState
+- gitpod.OrganizationDomainVerificationNewResponse
+- gitpod.OrganizationDomainVerificationGetResponse
+- gitpod.OrganizationDomainVerificationDeleteResponse
+- gitpod.OrganizationDomainVerificationVerifyResponse
+
+Methods:
+
+- client.Organizations.DomainVerifications.New(ctx context.Context, body gitpod.OrganizationDomainVerificationNewParams) (gitpod.OrganizationDomainVerificationNewResponse, error)
+- client.Organizations.DomainVerifications.Get(ctx context.Context, body gitpod.OrganizationDomainVerificationGetParams) (gitpod.OrganizationDomainVerificationGetResponse, error)
+- client.Organizations.DomainVerifications.List(ctx context.Context, params gitpod.OrganizationDomainVerificationListParams) (pagination.DomainVerificationsPage[gitpod.DomainVerification], error)
+- client.Organizations.DomainVerifications.Delete(ctx context.Context, body gitpod.OrganizationDomainVerificationDeleteParams) (gitpod.OrganizationDomainVerificationDeleteResponse, error)
+- client.Organizations.DomainVerifications.Verify(ctx context.Context, body gitpod.OrganizationDomainVerificationVerifyParams) (gitpod.OrganizationDomainVerificationVerifyResponse, error)
+
## Invites
Response Types:
diff --git a/client_test.go b/client_test.go
index f5a3f8f..4375020 100644
--- a/client_test.go
+++ b/client_test.go
@@ -37,7 +37,7 @@ func TestUserAgentHeader(t *testing.T) {
},
}),
)
- client.Runners.New(context.Background(), gitpod.RunnerNewParams{})
+ client.Identity.GetAuthenticatedIdentity(context.Background(), gitpod.IdentityGetAuthenticatedIdentityParams{})
if userAgent != fmt.Sprintf("Gitpod/Go %s", internal.PackageVersion) {
t.Errorf("Expected User-Agent to be correct, but got: %#v", userAgent)
}
@@ -60,7 +60,7 @@ func TestRetryAfter(t *testing.T) {
},
}),
)
- _, err := client.Runners.New(context.Background(), gitpod.RunnerNewParams{})
+ _, err := client.Identity.GetAuthenticatedIdentity(context.Background(), gitpod.IdentityGetAuthenticatedIdentityParams{})
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -94,7 +94,7 @@ func TestDeleteRetryCountHeader(t *testing.T) {
}),
option.WithHeaderDel("X-Stainless-Retry-Count"),
)
- _, err := client.Runners.New(context.Background(), gitpod.RunnerNewParams{})
+ _, err := client.Identity.GetAuthenticatedIdentity(context.Background(), gitpod.IdentityGetAuthenticatedIdentityParams{})
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -123,7 +123,7 @@ func TestOverwriteRetryCountHeader(t *testing.T) {
}),
option.WithHeader("X-Stainless-Retry-Count", "42"),
)
- _, err := client.Runners.New(context.Background(), gitpod.RunnerNewParams{})
+ _, err := client.Identity.GetAuthenticatedIdentity(context.Background(), gitpod.IdentityGetAuthenticatedIdentityParams{})
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -151,7 +151,7 @@ func TestRetryAfterMs(t *testing.T) {
},
}),
)
- _, err := client.Runners.New(context.Background(), gitpod.RunnerNewParams{})
+ _, err := client.Identity.GetAuthenticatedIdentity(context.Background(), gitpod.IdentityGetAuthenticatedIdentityParams{})
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -173,7 +173,7 @@ func TestContextCancel(t *testing.T) {
)
cancelCtx, cancel := context.WithCancel(context.Background())
cancel()
- _, err := client.Runners.New(cancelCtx, gitpod.RunnerNewParams{})
+ _, err := client.Identity.GetAuthenticatedIdentity(cancelCtx, gitpod.IdentityGetAuthenticatedIdentityParams{})
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -192,7 +192,7 @@ func TestContextCancelDelay(t *testing.T) {
)
cancelCtx, cancel := context.WithTimeout(context.Background(), 2*time.Millisecond)
defer cancel()
- _, err := client.Runners.New(cancelCtx, gitpod.RunnerNewParams{})
+ _, err := client.Identity.GetAuthenticatedIdentity(cancelCtx, gitpod.IdentityGetAuthenticatedIdentityParams{})
if err == nil {
t.Error("expected there to be a cancel error")
}
@@ -217,7 +217,7 @@ func TestContextDeadline(t *testing.T) {
},
}),
)
- _, err := client.Runners.New(deadlineCtx, gitpod.RunnerNewParams{})
+ _, err := client.Identity.GetAuthenticatedIdentity(deadlineCtx, gitpod.IdentityGetAuthenticatedIdentityParams{})
if err == nil {
t.Error("expected there to be a deadline error")
}
diff --git a/editor.go b/editor.go
index ce8fcf8..0ac0064 100644
--- a/editor.go
+++ b/editor.go
@@ -74,13 +74,13 @@ func (r *EditorService) ResolveURL(ctx context.Context, body EditorResolveURLPar
}
type Editor struct {
- ID string `json:"id"`
- Alias string `json:"alias"`
- IconURL string `json:"iconUrl"`
- InstallationInstructions string `json:"installationInstructions"`
- Name string `json:"name"`
- ShortDescription string `json:"shortDescription"`
- URLTemplate string `json:"urlTemplate"`
+ ID string `json:"id,required"`
+ Alias string `json:"alias,required"`
+ IconURL string `json:"iconUrl,required"`
+ InstallationInstructions string `json:"installationInstructions,required"`
+ Name string `json:"name,required"`
+ ShortDescription string `json:"shortDescription,required"`
+ URLTemplate string `json:"urlTemplate,required"`
JSON editorJSON `json:"-"`
}
@@ -107,7 +107,7 @@ func (r editorJSON) RawJSON() string {
type EditorGetResponse struct {
// editor contains the editor
- Editor Editor `json:"editor"`
+ Editor Editor `json:"editor,required"`
JSON editorGetResponseJSON `json:"-"`
}
@@ -129,7 +129,7 @@ func (r editorGetResponseJSON) RawJSON() string {
type EditorResolveURLResponse struct {
// url is the resolved editor URL
- URL string `json:"url"`
+ URL string `json:"url,required"`
JSON editorResolveURLResponseJSON `json:"-"`
}
@@ -151,7 +151,7 @@ func (r editorResolveURLResponseJSON) RawJSON() string {
type EditorGetParams struct {
// id is the ID of the editor to get
- ID param.Field[string] `json:"id"`
+ ID param.Field[string] `json:"id,required"`
}
func (r EditorGetParams) MarshalJSON() (data []byte, err error) {
@@ -193,11 +193,11 @@ func (r EditorListParamsPagination) MarshalJSON() (data []byte, err error) {
type EditorResolveURLParams struct {
// editorId is the ID of the editor to resolve the URL for
- EditorID param.Field[string] `json:"editorId" format:"uuid"`
+ EditorID param.Field[string] `json:"editorId,required" format:"uuid"`
// environmentId is the ID of the environment to resolve the URL for
- EnvironmentID param.Field[string] `json:"environmentId" format:"uuid"`
+ 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" format:"uuid"`
+ OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"`
}
func (r EditorResolveURLParams) MarshalJSON() (data []byte, err error) {
diff --git a/editor_test.go b/editor_test.go
index a9448c7..eb59d95 100644
--- a/editor_test.go
+++ b/editor_test.go
@@ -13,7 +13,7 @@ import (
"github.com/gitpod-io/gitpod-sdk-go/option"
)
-func TestEditorGetWithOptionalParams(t *testing.T) {
+func TestEditorGet(t *testing.T) {
t.Skip("skipped: tests are disabled for the time being")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -68,7 +68,7 @@ func TestEditorListWithOptionalParams(t *testing.T) {
}
}
-func TestEditorResolveURLWithOptionalParams(t *testing.T) {
+func TestEditorResolveURL(t *testing.T) {
t.Skip("skipped: tests are disabled for the time being")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
diff --git a/environment.go b/environment.go
index 07daff8..b81ea1f 100644
--- a/environment.go
+++ b/environment.go
@@ -40,21 +40,22 @@ func NewEnvironmentService(opts ...option.RequestOption) (r *EnvironmentService)
return
}
-// CreateEnvironment creates a new environment and starts it.
+// Creates a development environment from a context URL (e.g. Git repository) and
+// starts it.
//
// The `class` field must be a valid environment class ID. You can find a list of
// available environment classes with the `ListEnvironmentClasses` method.
//
// ### Examples
//
-// - from context URL:
+// - Create from context URL:
//
-// Creates an environment from a context URL, e.g. a GitHub repository.
+// Creates an environment from a Git repository URL with default settings.
//
// ```yaml
// spec:
// machine:
-// class: "61000000-0000-0000-0000-000000000000"
+// class: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
// content:
// initializer:
// specs:
@@ -62,15 +63,14 @@ func NewEnvironmentService(opts ...option.RequestOption) (r *EnvironmentService)
// url: "https://github.com/gitpod-io/gitpod"
// ```
//
-// - from Git repository:
+// - Create from Git repository:
//
-// Creates an environment from a Git repository directly. While less convenient,
-// this is useful if you want to specify a specific branch, commit, etc.
+// Creates an environment from a Git repository with specific branch targeting.
//
// ```yaml
// spec:
// machine:
-// class: "61000000-0000-0000-0000-000000000000"
+// class: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
// content:
// initializer:
// specs:
@@ -79,6 +79,28 @@ func NewEnvironmentService(opts ...option.RequestOption) (r *EnvironmentService)
// cloneTarget: "main"
// targetMode: "CLONE_TARGET_MODE_REMOTE_BRANCH"
// ```
+//
+// - Create with custom timeout and ports:
+//
+// Creates an environment with custom inactivity timeout and exposed port
+// configuration.
+//
+// ```yaml
+// spec:
+// machine:
+// class: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
+// content:
+// initializer:
+// specs:
+// - contextUrl:
+// url: "https://github.com/gitpod-io/gitpod"
+// timeout:
+// disconnected: "7200s" # 2 hours in seconds
+// ports:
+// - port: 3000
+// admission: "ADMISSION_LEVEL_EVERYONE"
+// name: "Web App"
+// ```
func (r *EnvironmentService) New(ctx context.Context, body EnvironmentNewParams, opts ...option.RequestOption) (res *EnvironmentNewResponse, err error) {
opts = append(r.Options[:], opts...)
path := "gitpod.v1.EnvironmentService/CreateEnvironment"
@@ -86,7 +108,26 @@ func (r *EnvironmentService) New(ctx context.Context, body EnvironmentNewParams,
return
}
-// GetEnvironment returns a single environment.
+// Gets details about a specific environment including its status, configuration,
+// and context URL.
+//
+// Use this method to:
+//
+// - Check if an environment is ready to use
+// - Get connection details for IDE and exposed ports
+// - Monitor environment health and resource usage
+// - Debug environment setup issues
+//
+// ### Examples
+//
+// - Get environment details:
+//
+// Retrieves detailed information about a specific environment using its unique
+// identifier.
+//
+// ```yaml
+// environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048"
+// ```
func (r *EnvironmentService) Get(ctx context.Context, body EnvironmentGetParams, opts ...option.RequestOption) (res *EnvironmentGetResponse, err error) {
opts = append(r.Options[:], opts...)
path := "gitpod.v1.EnvironmentService/GetEnvironment"
@@ -94,7 +135,56 @@ func (r *EnvironmentService) Get(ctx context.Context, body EnvironmentGetParams,
return
}
-// UpdateEnvironment updates the environment partially.
+// Updates an environment's configuration while it is running.
+//
+// Updates are limited to:
+//
+// - Git credentials (username, email)
+// - SSH public keys
+// - Content initialization
+// - Port configurations
+// - Automation files
+// - Environment timeouts
+//
+// ### Examples
+//
+// - Update Git credentials:
+//
+// Updates the Git configuration for the environment.
+//
+// ```yaml
+// environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048"
+// spec:
+// content:
+// gitUsername: "example-user"
+// gitEmail: "user@example.com"
+// ```
+//
+// - Add SSH public key:
+//
+// Adds a new SSH public key for authentication.
+//
+// ```yaml
+// environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048"
+// spec:
+// sshPublicKeys:
+// - id: "0194b7c1-c954-718d-91a4-9a742aa5fc11"
+// value: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI..."
+// ```
+//
+// - Update content session:
+//
+// Updates the content session identifier for the environment.
+//
+// ```yaml
+// environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048"
+// spec:
+// content:
+// session: "0194b7c1-c954-718d-91a4-9a742aa5fc11"
+// ```
+//
+// Note: Machine class changes require stopping the environment and creating a new
+// one.
func (r *EnvironmentService) Update(ctx context.Context, body EnvironmentUpdateParams, opts ...option.RequestOption) (res *EnvironmentUpdateResponse, err error) {
opts = append(r.Options[:], opts...)
path := "gitpod.v1.EnvironmentService/UpdateEnvironment"
@@ -102,7 +192,43 @@ func (r *EnvironmentService) Update(ctx context.Context, body EnvironmentUpdateP
return
}
-// ListEnvironments returns a list of environments that match the query.
+// Lists all environments matching the specified criteria.
+//
+// Use this method to find and monitor environments across your organization.
+// Results are ordered by creation time with newest environments first.
+//
+// ### Examples
+//
+// - List running environments for a project:
+//
+// Retrieves all running environments for a specific project with pagination.
+//
+// ```yaml
+// filter:
+// statusPhases: ["ENVIRONMENT_PHASE_RUNNING"]
+// projectIds: ["b0e12f6c-4c67-429d-a4a6-d9838b5da047"]
+// pagination:
+// pageSize: 10
+// ```
+//
+// - List all environments for a specific runner:
+//
+// Filters environments by runner ID and creator ID.
+//
+// ```yaml
+// filter:
+// runnerIds: ["e6aa9c54-89d3-42c1-ac31-bd8d8f1concentrate"]
+// creatorIds: ["f53d2330-3795-4c5d-a1f3-453121af9c60"]
+// ```
+//
+// - List stopped and deleted environments:
+//
+// Retrieves all environments in stopped or deleted state.
+//
+// ```yaml
+// filter:
+// statusPhases: ["ENVIRONMENT_PHASE_STOPPED", "ENVIRONMENT_PHASE_DELETED"]
+// ```
func (r *EnvironmentService) List(ctx context.Context, params EnvironmentListParams, opts ...option.RequestOption) (res *pagination.EnvironmentsPage[Environment], err error) {
var raw *http.Response
opts = append(r.Options[:], opts...)
@@ -120,13 +246,71 @@ func (r *EnvironmentService) List(ctx context.Context, params EnvironmentListPar
return res, nil
}
-// ListEnvironments returns a list of environments that match the query.
+// Lists all environments matching the specified criteria.
+//
+// Use this method to find and monitor environments across your organization.
+// Results are ordered by creation time with newest environments first.
+//
+// ### Examples
+//
+// - List running environments for a project:
+//
+// Retrieves all running environments for a specific project with pagination.
+//
+// ```yaml
+// filter:
+// statusPhases: ["ENVIRONMENT_PHASE_RUNNING"]
+// projectIds: ["b0e12f6c-4c67-429d-a4a6-d9838b5da047"]
+// pagination:
+// pageSize: 10
+// ```
+//
+// - List all environments for a specific runner:
+//
+// Filters environments by runner ID and creator ID.
+//
+// ```yaml
+// filter:
+// runnerIds: ["e6aa9c54-89d3-42c1-ac31-bd8d8f1concentrate"]
+// creatorIds: ["f53d2330-3795-4c5d-a1f3-453121af9c60"]
+// ```
+//
+// - List stopped and deleted environments:
+//
+// Retrieves all environments in stopped or deleted state.
+//
+// ```yaml
+// filter:
+// statusPhases: ["ENVIRONMENT_PHASE_STOPPED", "ENVIRONMENT_PHASE_DELETED"]
+// ```
func (r *EnvironmentService) ListAutoPaging(ctx context.Context, params EnvironmentListParams, opts ...option.RequestOption) *pagination.EnvironmentsPageAutoPager[Environment] {
return pagination.NewEnvironmentsPageAutoPager(r.List(ctx, params, opts...))
}
-// DeleteEnvironment deletes an environment. When the environment is running, it
-// will be stopped as well. Deleted environments cannot be started again.
+// Permanently deletes an environment.
+//
+// Running environments are automatically stopped before deletion. If force is
+// true, the environment is deleted immediately without graceful shutdown.
+//
+// ### Examples
+//
+// - Delete with graceful shutdown:
+//
+// Deletes an environment after gracefully stopping it.
+//
+// ```yaml
+// environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048"
+// force: false
+// ```
+//
+// - Force delete:
+//
+// Immediately deletes an environment without waiting for graceful shutdown.
+//
+// ```yaml
+// environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048"
+// force: true
+// ```
func (r *EnvironmentService) Delete(ctx context.Context, body EnvironmentDeleteParams, opts ...option.RequestOption) (res *EnvironmentDeleteResponse, err error) {
opts = append(r.Options[:], opts...)
path := "gitpod.v1.EnvironmentService/DeleteEnvironment"
@@ -134,8 +318,36 @@ func (r *EnvironmentService) Delete(ctx context.Context, body EnvironmentDeleteP
return
}
-// CreateAbdStartEnvironmentFromProject creates a new environment from a project
-// and starts it.
+// Creates an environment from an existing project configuration and starts it.
+//
+// This method uses project settings as defaults but allows overriding specific
+// configurations. Project settings take precedence over default configurations,
+// while custom specifications in the request override project settings.
+//
+// ### Examples
+//
+// - Create with project defaults:
+//
+// Creates an environment using all default settings from the project
+// configuration.
+//
+// ```yaml
+// projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
+// ```
+//
+// - Create with custom compute resources:
+//
+// Creates an environment from project with custom machine class and timeout
+// settings.
+//
+// ```yaml
+// projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
+// spec:
+// machine:
+// class: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
+// timeout:
+// disconnected: "14400s" # 4 hours in seconds
+// ```
func (r *EnvironmentService) NewFromProject(ctx context.Context, body EnvironmentNewFromProjectParams, opts ...option.RequestOption) (res *EnvironmentNewFromProjectResponse, err error) {
opts = append(r.Options[:], opts...)
path := "gitpod.v1.EnvironmentService/CreateEnvironmentFromProject"
@@ -143,8 +355,20 @@ func (r *EnvironmentService) NewFromProject(ctx context.Context, body Environmen
return
}
-// CreateEnvironmentLogsToken creates a token that can be used to access the logs
-// of an environment.
+// Creates an access token for retrieving environment logs.
+//
+// Generated tokens are valid for one hour and provide read-only access to the
+// environment's logs.
+//
+// ### Examples
+//
+// - Generate logs token:
+//
+// Creates a temporary access token for retrieving environment logs.
+//
+// ```yaml
+// environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048"
+// ```
func (r *EnvironmentService) NewLogsToken(ctx context.Context, body EnvironmentNewLogsTokenParams, opts ...option.RequestOption) (res *EnvironmentNewLogsTokenResponse, err error) {
opts = append(r.Options[:], opts...)
path := "gitpod.v1.EnvironmentService/CreateEnvironmentLogsToken"
@@ -152,7 +376,23 @@ func (r *EnvironmentService) NewLogsToken(ctx context.Context, body EnvironmentN
return
}
-// MarkEnvironmentActive allows tools to signal activity for an environment.
+// Records environment activity to prevent automatic shutdown.
+//
+// Activity signals should be sent every 5 minutes while the environment is
+// actively being used. The source must be between 3-80 characters.
+//
+// ### Examples
+//
+// - Signal VS Code activity:
+//
+// Records VS Code editor activity to prevent environment shutdown.
+//
+// ```yaml
+// environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048"
+// activitySignal:
+// source: "VS Code"
+// timestamp: "2025-02-12T14:30:00Z"
+// ```
func (r *EnvironmentService) MarkActive(ctx context.Context, body EnvironmentMarkActiveParams, opts ...option.RequestOption) (res *EnvironmentMarkActiveResponse, err error) {
opts = append(r.Options[:], opts...)
path := "gitpod.v1.EnvironmentService/MarkEnvironmentActive"
@@ -160,8 +400,21 @@ func (r *EnvironmentService) MarkActive(ctx context.Context, body EnvironmentMar
return
}
-// StartEnvironment starts an environment. This function is idempotent, i.e. if the
-// environment is already running no error is returned.
+// Starts a stopped environment.
+//
+// Use this method to resume work on a previously stopped environment. The
+// environment retains its configuration and workspace content from when it was
+// stopped.
+//
+// ### Examples
+//
+// - Start an environment:
+//
+// Resumes a previously stopped environment with its existing configuration.
+//
+// ```yaml
+// environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048"
+// ```
func (r *EnvironmentService) Start(ctx context.Context, body EnvironmentStartParams, opts ...option.RequestOption) (res *EnvironmentStartResponse, err error) {
opts = append(r.Options[:], opts...)
path := "gitpod.v1.EnvironmentService/StartEnvironment"
@@ -169,7 +422,20 @@ func (r *EnvironmentService) Start(ctx context.Context, body EnvironmentStartPar
return
}
-// StopEnvironment stops a running environment.
+// Stops a running environment.
+//
+// Use this method to pause work while preserving the environment's state. The
+// environment can be resumed later using StartEnvironment.
+//
+// ### Examples
+//
+// - Stop an environment:
+//
+// Gracefully stops a running environment while preserving its state.
+//
+// ```yaml
+// environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048"
+// ```
func (r *EnvironmentService) Stop(ctx context.Context, body EnvironmentStopParams, opts ...option.RequestOption) (res *EnvironmentStopResponse, err error) {
opts = append(r.Options[:], opts...)
path := "gitpod.v1.EnvironmentService/StopEnvironment"
@@ -892,7 +1158,10 @@ func (r environmentSpecPortJSON) RawJSON() string {
}
type EnvironmentSpecSecret struct {
- EnvironmentVariable string `json:"environmentVariable"`
+ // container_registry_basic_auth_host is the hostname of the container registry
+ // that supports basic auth
+ ContainerRegistryBasicAuthHost string `json:"containerRegistryBasicAuthHost"`
+ EnvironmentVariable string `json:"environmentVariable"`
// file_path is the path inside the devcontainer where the secret is mounted
FilePath string `json:"filePath"`
GitCredentialHost string `json:"gitCredentialHost"`
@@ -911,15 +1180,16 @@ type EnvironmentSpecSecret struct {
// environmentSpecSecretJSON contains the JSON metadata for the struct
// [EnvironmentSpecSecret]
type environmentSpecSecretJSON struct {
- EnvironmentVariable apijson.Field
- FilePath apijson.Field
- GitCredentialHost apijson.Field
- Name apijson.Field
- Session apijson.Field
- Source apijson.Field
- SourceRef apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
+ ContainerRegistryBasicAuthHost apijson.Field
+ EnvironmentVariable apijson.Field
+ FilePath apijson.Field
+ GitCredentialHost apijson.Field
+ Name apijson.Field
+ Session apijson.Field
+ Source apijson.Field
+ SourceRef apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
}
func (r *EnvironmentSpecSecret) UnmarshalJSON(data []byte) (err error) {
@@ -1140,7 +1410,10 @@ func (r EnvironmentSpecPortParam) MarshalJSON() (data []byte, err error) {
}
type EnvironmentSpecSecretParam struct {
- EnvironmentVariable param.Field[string] `json:"environmentVariable"`
+ // container_registry_basic_auth_host is the hostname of the container registry
+ // that supports basic auth
+ ContainerRegistryBasicAuthHost param.Field[string] `json:"containerRegistryBasicAuthHost"`
+ EnvironmentVariable param.Field[string] `json:"environmentVariable"`
// file_path is the path inside the devcontainer where the secret is mounted
FilePath param.Field[string] `json:"filePath"`
GitCredentialHost param.Field[string] `json:"gitCredentialHost"`
@@ -2050,7 +2323,7 @@ func (r EnvironmentNewParams) MarshalJSON() (data []byte, err error) {
type EnvironmentGetParams struct {
// environment_id specifies the environment to get
- EnvironmentID param.Field[string] `json:"environmentId" format:"uuid"`
+ EnvironmentID param.Field[string] `json:"environmentId,required" format:"uuid"`
}
func (r EnvironmentGetParams) MarshalJSON() (data []byte, err error) {
@@ -2231,8 +2504,6 @@ type EnvironmentListParams struct {
Token param.Field[string] `query:"token"`
PageSize param.Field[int64] `query:"pageSize"`
Filter param.Field[EnvironmentListParamsFilter] `json:"filter"`
- // organization_id is the ID of the organization that contains the environments
- OrganizationID param.Field[string] `json:"organizationId" format:"uuid"`
// pagination contains the pagination options for listing environments
Pagination param.Field[EnvironmentListParamsPagination] `json:"pagination"`
}
diff --git a/environment_test.go b/environment_test.go
index 016c4c3..a28c267 100644
--- a/environment_test.go
+++ b/environment_test.go
@@ -59,7 +59,7 @@ func TestEnvironmentNewWithOptionalParams(t *testing.T) {
Session: gitpod.F("session"),
}),
Machine: gitpod.F(gitpod.EnvironmentSpecMachineParam{
- Class: gitpod.F("61000000-0000-0000-0000-000000000000"),
+ Class: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
Session: gitpod.F("session"),
}),
Ports: gitpod.F([]gitpod.EnvironmentSpecPortParam{{
@@ -68,13 +68,14 @@ func TestEnvironmentNewWithOptionalParams(t *testing.T) {
Port: gitpod.F(int64(1)),
}}),
Secrets: gitpod.F([]gitpod.EnvironmentSpecSecretParam{{
- EnvironmentVariable: gitpod.F("environmentVariable"),
- FilePath: gitpod.F("filePath"),
- GitCredentialHost: gitpod.F("gitCredentialHost"),
- Name: gitpod.F("name"),
- Session: gitpod.F("session"),
- Source: gitpod.F("source"),
- SourceRef: gitpod.F("sourceRef"),
+ ContainerRegistryBasicAuthHost: gitpod.F("containerRegistryBasicAuthHost"),
+ EnvironmentVariable: gitpod.F("environmentVariable"),
+ FilePath: gitpod.F("filePath"),
+ GitCredentialHost: gitpod.F("gitCredentialHost"),
+ Name: gitpod.F("name"),
+ Session: gitpod.F("session"),
+ Source: gitpod.F("source"),
+ SourceRef: gitpod.F("sourceRef"),
}}),
SpecVersion: gitpod.F("specVersion"),
SSHPublicKeys: gitpod.F([]gitpod.EnvironmentSpecSSHPublicKeyParam{{
@@ -95,7 +96,7 @@ func TestEnvironmentNewWithOptionalParams(t *testing.T) {
}
}
-func TestEnvironmentGetWithOptionalParams(t *testing.T) {
+func TestEnvironmentGet(t *testing.T) {
t.Skip("skipped: tests are disabled for the time being")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -109,7 +110,7 @@ func TestEnvironmentGetWithOptionalParams(t *testing.T) {
option.WithBearerToken("My Bearer Token"),
)
_, err := client.Environments.Get(context.TODO(), gitpod.EnvironmentGetParams{
- EnvironmentID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ EnvironmentID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"),
})
if err != nil {
var apierr *gitpod.Error
@@ -134,7 +135,7 @@ func TestEnvironmentUpdateWithOptionalParams(t *testing.T) {
option.WithBearerToken("My Bearer Token"),
)
_, err := client.Environments.Update(context.TODO(), gitpod.EnvironmentUpdateParams{
- EnvironmentID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ EnvironmentID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"),
Metadata: gitpod.F[any](map[string]interface{}{}),
Spec: gitpod.F(gitpod.EnvironmentUpdateParamsSpec{
AutomationsFile: gitpod.F(gitpod.EnvironmentUpdateParamsSpecAutomationsFile{
@@ -170,8 +171,8 @@ func TestEnvironmentUpdateWithOptionalParams(t *testing.T) {
Port: gitpod.F(int64(1)),
}}),
SSHPublicKeys: gitpod.F([]gitpod.EnvironmentUpdateParamsSpecSSHPublicKey{{
- ID: gitpod.F("id"),
- Value: gitpod.F("value"),
+ ID: gitpod.F("0194b7c1-c954-718d-91a4-9a742aa5fc11"),
+ Value: gitpod.F("ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI..."),
}}),
Timeout: gitpod.F(gitpod.EnvironmentUpdateParamsSpecTimeout{
Disconnected: gitpod.F("+9125115.360s"),
@@ -204,13 +205,12 @@ func TestEnvironmentListWithOptionalParams(t *testing.T) {
Token: gitpod.F("token"),
PageSize: gitpod.F(int64(0)),
Filter: gitpod.F(gitpod.EnvironmentListParamsFilter{
- CreatorIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
+ CreatorIDs: gitpod.F([]string{"f53d2330-3795-4c5d-a1f3-453121af9c60"}),
ProjectIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
- RunnerIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
+ RunnerIDs: gitpod.F([]string{"e6aa9c54-89d3-42c1-ac31-bd8d8f1concentrate"}),
RunnerKinds: gitpod.F([]gitpod.RunnerKind{gitpod.RunnerKindUnspecified}),
StatusPhases: gitpod.F([]gitpod.EnvironmentPhase{gitpod.EnvironmentPhaseUnspecified}),
}),
- OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
Pagination: gitpod.F(gitpod.EnvironmentListParamsPagination{
Token: gitpod.F("token"),
PageSize: gitpod.F(int64(100)),
@@ -239,8 +239,8 @@ func TestEnvironmentDeleteWithOptionalParams(t *testing.T) {
option.WithBearerToken("My Bearer Token"),
)
_, err := client.Environments.Delete(context.TODO(), gitpod.EnvironmentDeleteParams{
- EnvironmentID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
- Force: gitpod.F(true),
+ EnvironmentID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"),
+ Force: gitpod.F(false),
})
if err != nil {
var apierr *gitpod.Error
@@ -265,7 +265,7 @@ func TestEnvironmentNewFromProjectWithOptionalParams(t *testing.T) {
option.WithBearerToken("My Bearer Token"),
)
_, err := client.Environments.NewFromProject(context.TODO(), gitpod.EnvironmentNewFromProjectParams{
- ProjectID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ ProjectID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
Spec: gitpod.F(gitpod.EnvironmentSpecParam{
Admission: gitpod.F(gitpod.AdmissionLevelUnspecified),
AutomationsFile: gitpod.F(gitpod.EnvironmentSpecAutomationsFileParam{
@@ -297,7 +297,7 @@ func TestEnvironmentNewFromProjectWithOptionalParams(t *testing.T) {
Session: gitpod.F("session"),
}),
Machine: gitpod.F(gitpod.EnvironmentSpecMachineParam{
- Class: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ Class: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
Session: gitpod.F("session"),
}),
Ports: gitpod.F([]gitpod.EnvironmentSpecPortParam{{
@@ -306,13 +306,14 @@ func TestEnvironmentNewFromProjectWithOptionalParams(t *testing.T) {
Port: gitpod.F(int64(1)),
}}),
Secrets: gitpod.F([]gitpod.EnvironmentSpecSecretParam{{
- EnvironmentVariable: gitpod.F("environmentVariable"),
- FilePath: gitpod.F("filePath"),
- GitCredentialHost: gitpod.F("gitCredentialHost"),
- Name: gitpod.F("name"),
- Session: gitpod.F("session"),
- Source: gitpod.F("source"),
- SourceRef: gitpod.F("sourceRef"),
+ ContainerRegistryBasicAuthHost: gitpod.F("containerRegistryBasicAuthHost"),
+ EnvironmentVariable: gitpod.F("environmentVariable"),
+ FilePath: gitpod.F("filePath"),
+ GitCredentialHost: gitpod.F("gitCredentialHost"),
+ Name: gitpod.F("name"),
+ Session: gitpod.F("session"),
+ Source: gitpod.F("source"),
+ SourceRef: gitpod.F("sourceRef"),
}}),
SpecVersion: gitpod.F("specVersion"),
SSHPublicKeys: gitpod.F([]gitpod.EnvironmentSpecSSHPublicKeyParam{{
@@ -320,7 +321,7 @@ func TestEnvironmentNewFromProjectWithOptionalParams(t *testing.T) {
Value: gitpod.F("value"),
}}),
Timeout: gitpod.F(gitpod.EnvironmentSpecTimeoutParam{
- Disconnected: gitpod.F("+9125115.360s"),
+ Disconnected: gitpod.F("14400s"),
}),
}),
})
@@ -347,7 +348,7 @@ func TestEnvironmentNewLogsTokenWithOptionalParams(t *testing.T) {
option.WithBearerToken("My Bearer Token"),
)
_, err := client.Environments.NewLogsToken(context.TODO(), gitpod.EnvironmentNewLogsTokenParams{
- EnvironmentID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ EnvironmentID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"),
})
if err != nil {
var apierr *gitpod.Error
@@ -373,10 +374,10 @@ func TestEnvironmentMarkActiveWithOptionalParams(t *testing.T) {
)
_, err := client.Environments.MarkActive(context.TODO(), gitpod.EnvironmentMarkActiveParams{
ActivitySignal: gitpod.F(gitpod.EnvironmentActivitySignalParam{
- Source: gitpod.F("xxx"),
+ Source: gitpod.F("VS Code"),
Timestamp: gitpod.F(time.Now()),
}),
- EnvironmentID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ EnvironmentID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"),
})
if err != nil {
var apierr *gitpod.Error
@@ -401,7 +402,7 @@ func TestEnvironmentStartWithOptionalParams(t *testing.T) {
option.WithBearerToken("My Bearer Token"),
)
_, err := client.Environments.Start(context.TODO(), gitpod.EnvironmentStartParams{
- EnvironmentID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ EnvironmentID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"),
})
if err != nil {
var apierr *gitpod.Error
@@ -426,7 +427,7 @@ func TestEnvironmentStopWithOptionalParams(t *testing.T) {
option.WithBearerToken("My Bearer Token"),
)
_, err := client.Environments.Stop(context.TODO(), gitpod.EnvironmentStopParams{
- EnvironmentID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ EnvironmentID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"),
})
if err != nil {
var apierr *gitpod.Error
diff --git a/environmentautomationtask.go b/environmentautomationtask.go
index fccea0b..e1292dc 100644
--- a/environmentautomationtask.go
+++ b/environmentautomationtask.go
@@ -6,7 +6,6 @@ import (
"context"
"net/http"
"net/url"
- "time"
"github.com/gitpod-io/gitpod-sdk-go/internal/apijson"
"github.com/gitpod-io/gitpod-sdk-go/internal/apiquery"
@@ -63,7 +62,7 @@ func (r *EnvironmentAutomationTaskService) Update(ctx context.Context, body Envi
}
// ListTasks
-func (r *EnvironmentAutomationTaskService) List(ctx context.Context, params EnvironmentAutomationTaskListParams, opts ...option.RequestOption) (res *pagination.TasksPage[Task], err error) {
+func (r *EnvironmentAutomationTaskService) List(ctx context.Context, params EnvironmentAutomationTaskListParams, opts ...option.RequestOption) (res *pagination.TasksPage[shared.Task], err error) {
var raw *http.Response
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
@@ -81,7 +80,7 @@ func (r *EnvironmentAutomationTaskService) List(ctx context.Context, params Envi
}
// ListTasks
-func (r *EnvironmentAutomationTaskService) ListAutoPaging(ctx context.Context, params EnvironmentAutomationTaskListParams, opts ...option.RequestOption) *pagination.TasksPageAutoPager[Task] {
+func (r *EnvironmentAutomationTaskService) ListAutoPaging(ctx context.Context, params EnvironmentAutomationTaskListParams, opts ...option.RequestOption) *pagination.TasksPageAutoPager[shared.Task] {
return pagination.NewTasksPageAutoPager(r.List(ctx, params, opts...))
}
@@ -102,311 +101,8 @@ func (r *EnvironmentAutomationTaskService) Start(ctx context.Context, body Envir
return
}
-type Task struct {
- ID string `json:"id" format:"uuid"`
- // dependencies specifies the IDs of the automations this task depends on.
- DependsOn []string `json:"dependsOn" format:"uuid"`
- EnvironmentID string `json:"environmentId" format:"uuid"`
- Metadata TaskMetadata `json:"metadata"`
- Spec TaskSpec `json:"spec"`
- JSON taskJSON `json:"-"`
-}
-
-// taskJSON contains the JSON metadata for the struct [Task]
-type taskJSON struct {
- ID apijson.Field
- DependsOn apijson.Field
- EnvironmentID apijson.Field
- Metadata apijson.Field
- Spec apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
-}
-
-func (r *Task) UnmarshalJSON(data []byte) (err error) {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func (r taskJSON) RawJSON() string {
- return r.raw
-}
-
-type TaskMetadata 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 describes the principal who created the task.
- Creator shared.Subject `json:"creator"`
- // description is a user-facing description for the task. It can be used to provide
- // context and documentation for the task.
- Description string `json:"description"`
- // name is a user-facing name for the task. Unlike the reference, this field is not
- // unique, and not referenced by the system. This is a short descriptive name for
- // the task.
- Name string `json:"name"`
- // reference is a user-facing identifier for the task which must be unique on the
- // environment. It is used to express dependencies between tasks, and to identify
- // the task in user interactions (e.g. the CLI).
- Reference string `json:"reference"`
- // triggered_by is a list of trigger that start the task.
- TriggeredBy []shared.AutomationTrigger `json:"triggeredBy"`
- JSON taskMetadataJSON `json:"-"`
-}
-
-// taskMetadataJSON contains the JSON metadata for the struct [TaskMetadata]
-type taskMetadataJSON struct {
- CreatedAt apijson.Field
- Creator apijson.Field
- Description apijson.Field
- Name apijson.Field
- Reference apijson.Field
- TriggeredBy apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
-}
-
-func (r *TaskMetadata) UnmarshalJSON(data []byte) (err error) {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func (r taskMetadataJSON) RawJSON() string {
- return r.raw
-}
-
-type TaskMetadataParam 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 param.Field[time.Time] `json:"createdAt" format:"date-time"`
- // creator describes the principal who created the task.
- Creator param.Field[shared.SubjectParam] `json:"creator"`
- // description is a user-facing description for the task. It can be used to provide
- // context and documentation for the task.
- Description param.Field[string] `json:"description"`
- // name is a user-facing name for the task. Unlike the reference, this field is not
- // unique, and not referenced by the system. This is a short descriptive name for
- // the task.
- Name param.Field[string] `json:"name"`
- // reference is a user-facing identifier for the task which must be unique on the
- // environment. It is used to express dependencies between tasks, and to identify
- // the task in user interactions (e.g. the CLI).
- Reference param.Field[string] `json:"reference"`
- // triggered_by is a list of trigger that start the task.
- TriggeredBy param.Field[[]shared.AutomationTriggerParam] `json:"triggeredBy"`
-}
-
-func (r TaskMetadataParam) MarshalJSON() (data []byte, err error) {
- return apijson.MarshalRoot(r)
-}
-
-type TaskSpec struct {
- // command contains the command the task should execute
- Command string `json:"command"`
- // runs_on specifies the environment the task should run on.
- RunsOn shared.RunsOn `json:"runsOn"`
- JSON taskSpecJSON `json:"-"`
-}
-
-// taskSpecJSON contains the JSON metadata for the struct [TaskSpec]
-type taskSpecJSON struct {
- Command apijson.Field
- RunsOn apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
-}
-
-func (r *TaskSpec) UnmarshalJSON(data []byte) (err error) {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func (r taskSpecJSON) RawJSON() string {
- return r.raw
-}
-
-type TaskSpecParam struct {
- // command contains the command the task should execute
- Command param.Field[string] `json:"command"`
- // runs_on specifies the environment the task should run on.
- RunsOn param.Field[shared.RunsOnParam] `json:"runsOn"`
-}
-
-func (r TaskSpecParam) MarshalJSON() (data []byte, err error) {
- return apijson.MarshalRoot(r)
-}
-
type EnvironmentAutomationTaskNewResponse struct {
- Task Task `json:"task"`
+ Task shared.Task `json:"task"`
JSON environmentAutomationTaskNewResponseJSON `json:"-"`
}
@@ -427,7 +123,7 @@ func (r environmentAutomationTaskNewResponseJSON) RawJSON() string {
}
type EnvironmentAutomationTaskGetResponse struct {
- Task Task `json:"task"`
+ Task shared.Task `json:"task"`
JSON environmentAutomationTaskGetResponseJSON `json:"-"`
}
@@ -473,10 +169,10 @@ func (r environmentAutomationTaskStartResponseJSON) RawJSON() string {
}
type EnvironmentAutomationTaskNewParams struct {
- DependsOn param.Field[[]string] `json:"dependsOn" format:"uuid"`
- EnvironmentID param.Field[string] `json:"environmentId" format:"uuid"`
- Metadata param.Field[TaskMetadataParam] `json:"metadata"`
- Spec param.Field[TaskSpecParam] `json:"spec"`
+ DependsOn param.Field[[]string] `json:"dependsOn" format:"uuid"`
+ EnvironmentID param.Field[string] `json:"environmentId" format:"uuid"`
+ Metadata param.Field[shared.TaskMetadataParam] `json:"metadata"`
+ Spec param.Field[shared.TaskSpecParam] `json:"spec"`
}
func (r EnvironmentAutomationTaskNewParams) MarshalJSON() (data []byte, err error) {
diff --git a/environmentautomationtask_test.go b/environmentautomationtask_test.go
index 5bb5407..901819c 100644
--- a/environmentautomationtask_test.go
+++ b/environmentautomationtask_test.go
@@ -31,7 +31,7 @@ func TestEnvironmentAutomationTaskNewWithOptionalParams(t *testing.T) {
_, err := client.Environments.Automations.Tasks.New(context.TODO(), gitpod.EnvironmentAutomationTaskNewParams{
DependsOn: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
EnvironmentID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
- Metadata: gitpod.F(gitpod.TaskMetadataParam{
+ Metadata: gitpod.F(shared.TaskMetadataParam{
CreatedAt: gitpod.F(time.Now()),
Creator: gitpod.F(shared.SubjectParam{
ID: gitpod.F("id"),
@@ -46,7 +46,7 @@ func TestEnvironmentAutomationTaskNewWithOptionalParams(t *testing.T) {
PostEnvironmentStart: gitpod.F(true),
}}),
}),
- Spec: gitpod.F(gitpod.TaskSpecParam{
+ Spec: gitpod.F(shared.TaskSpecParam{
Command: gitpod.F("command"),
RunsOn: gitpod.F(shared.RunsOnParam{
Docker: gitpod.F(shared.RunsOnDockerParam{
diff --git a/environmentclass.go b/environmentclass.go
index fb87350..930e20c 100644
--- a/environmentclass.go
+++ b/environmentclass.go
@@ -35,9 +35,24 @@ func NewEnvironmentClassService(opts ...option.RequestOption) (r *EnvironmentCla
return
}
-// ListEnvironmentClasses returns the list of environment classes with runner
-// details a user is able to use based on the query buf:lint:ignore
-// RPC_REQUEST_RESPONSE_UNIQUE
+// Lists available environment classes with their specifications and resource
+// limits.
+//
+// Use this method to understand what types of environments you can create and
+// their capabilities. Environment classes define the compute resources and
+// features available to your environments.
+//
+// ### Examples
+//
+// - List all available classes:
+//
+// Retrieves a list of all environment classes with their specifications.
+//
+// ```yaml
+// {}
+// ```
+//
+// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
func (r *EnvironmentClassService) List(ctx context.Context, params EnvironmentClassListParams, opts ...option.RequestOption) (res *pagination.EnvironmentClassesPage[shared.EnvironmentClass], err error) {
var raw *http.Response
opts = append(r.Options[:], opts...)
@@ -55,9 +70,24 @@ func (r *EnvironmentClassService) List(ctx context.Context, params EnvironmentCl
return res, nil
}
-// ListEnvironmentClasses returns the list of environment classes with runner
-// details a user is able to use based on the query buf:lint:ignore
-// RPC_REQUEST_RESPONSE_UNIQUE
+// Lists available environment classes with their specifications and resource
+// limits.
+//
+// Use this method to understand what types of environments you can create and
+// their capabilities. Environment classes define the compute resources and
+// features available to your environments.
+//
+// ### Examples
+//
+// - List all available classes:
+//
+// Retrieves a list of all environment classes with their specifications.
+//
+// ```yaml
+// {}
+// ```
+//
+// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
func (r *EnvironmentClassService) ListAutoPaging(ctx context.Context, params EnvironmentClassListParams, opts ...option.RequestOption) *pagination.EnvironmentClassesPageAutoPager[shared.EnvironmentClass] {
return pagination.NewEnvironmentClassesPageAutoPager(r.List(ctx, params, opts...))
}
@@ -84,11 +114,22 @@ func (r EnvironmentClassListParams) URLQuery() (v url.Values) {
}
type EnvironmentClassListParamsFilter struct {
+ // can_create_environments filters the response to only environment classes that
+ // can be used to create new environments by the caller. Unlike enabled, which
+ // indicates general availability, this ensures the caller only sees environment
+ // classes they are allowed to use.
+ CanCreateEnvironments param.Field[bool] `json:"canCreateEnvironments"`
// enabled filters the response to only enabled or disabled environment classes. If
// not set, all environment classes are returned.
Enabled param.Field[bool] `json:"enabled"`
// runner_ids filters the response to only EnvironmentClasses of these Runner IDs
RunnerIDs param.Field[[]string] `json:"runnerIds" format:"uuid"`
+ // runner_kind filters the response to only environment classes from runners of
+ // these kinds.
+ RunnerKinds param.Field[[]RunnerKind] `json:"runnerKinds"`
+ // runner_providers filters the response to only environment classes from runners
+ // of these providers.
+ RunnerProviders param.Field[[]RunnerProvider] `json:"runnerProviders"`
}
func (r EnvironmentClassListParamsFilter) MarshalJSON() (data []byte, err error) {
diff --git a/environmentclass_test.go b/environmentclass_test.go
index 12aaf53..b4acb10 100644
--- a/environmentclass_test.go
+++ b/environmentclass_test.go
@@ -30,8 +30,11 @@ func TestEnvironmentClassListWithOptionalParams(t *testing.T) {
Token: gitpod.F("token"),
PageSize: gitpod.F(int64(0)),
Filter: gitpod.F(gitpod.EnvironmentClassListParamsFilter{
- Enabled: gitpod.F(true),
- RunnerIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
+ CanCreateEnvironments: gitpod.F(true),
+ Enabled: gitpod.F(true),
+ RunnerIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
+ RunnerKinds: gitpod.F([]gitpod.RunnerKind{gitpod.RunnerKindUnspecified}),
+ RunnerProviders: gitpod.F([]gitpod.RunnerProvider{gitpod.RunnerProviderUnspecified}),
}),
Pagination: gitpod.F(gitpod.EnvironmentClassListParamsPagination{
Token: gitpod.F("token"),
diff --git a/event.go b/event.go
index eec2e74..382100e 100644
--- a/event.go
+++ b/event.go
@@ -114,11 +114,12 @@ const (
ResourceTypeServiceAccount ResourceType = "RESOURCE_TYPE_SERVICE_ACCOUNT"
ResourceTypeSecret ResourceType = "RESOURCE_TYPE_SECRET"
ResourceTypeSSOConfig ResourceType = "RESOURCE_TYPE_SSO_CONFIG"
+ ResourceTypeDomainVerification ResourceType = "RESOURCE_TYPE_DOMAIN_VERIFICATION"
)
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:
+ case ResourceTypeUnspecified, ResourceTypeEnvironment, ResourceTypeRunner, ResourceTypeProject, ResourceTypeTask, ResourceTypeTaskExecution, ResourceTypeService, ResourceTypeOrganization, ResourceTypeUser, ResourceTypeEnvironmentClass, ResourceTypeRunnerScmIntegration, ResourceTypeHostAuthenticationToken, ResourceTypeGroup, ResourceTypePersonalAccessToken, ResourceTypeUserPreference, ResourceTypeServiceAccount, ResourceTypeSecret, ResourceTypeSSOConfig, ResourceTypeDomainVerification:
return true
}
return false
diff --git a/internal/version.go b/internal/version.go
index d6f40b3..2d1d85e 100644
--- a/internal/version.go
+++ b/internal/version.go
@@ -2,4 +2,4 @@
package internal
-const PackageVersion = "0.1.0-alpha.2" // x-release-please-version
+const PackageVersion = "0.1.0-alpha.3" // x-release-please-version
diff --git a/organization.go b/organization.go
index 2bb1413..e9887c2 100644
--- a/organization.go
+++ b/organization.go
@@ -24,9 +24,10 @@ import (
// automatically. You should not instantiate this service directly, and instead use
// the [NewOrganizationService] method instead.
type OrganizationService struct {
- Options []option.RequestOption
- Invites *OrganizationInviteService
- SSOConfigurations *OrganizationSSOConfigurationService
+ Options []option.RequestOption
+ DomainVerifications *OrganizationDomainVerificationService
+ Invites *OrganizationInviteService
+ SSOConfigurations *OrganizationSSOConfigurationService
}
// NewOrganizationService generates a new service that applies the given options to
@@ -35,6 +36,7 @@ type OrganizationService struct {
func NewOrganizationService(opts ...option.RequestOption) (r *OrganizationService) {
r = &OrganizationService{}
r.Options = opts
+ r.DomainVerifications = NewOrganizationDomainVerificationService(opts...)
r.Invites = NewOrganizationInviteService(opts...)
r.SSOConfigurations = NewOrganizationSSOConfigurationService(opts...)
return
@@ -173,7 +175,7 @@ func (r InviteDomainsParam) MarshalJSON() (data []byte, err error) {
}
type Organization struct {
- ID string `json:"id" format:"uuid"`
+ ID string `json:"id,required" 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,
@@ -262,9 +264,8 @@ type Organization 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"`
- InviteDomains InviteDomains `json:"inviteDomains"`
- Name string `json:"name"`
+ CreatedAt time.Time `json:"createdAt,required" format:"date-time"`
+ Name string `json:"name,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
// resolution. The count is relative to an epoch at UTC midnight on January 1,
@@ -353,17 +354,18 @@ type Organization struct {
// 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 organizationJSON `json:"-"`
+ UpdatedAt time.Time `json:"updatedAt,required" format:"date-time"`
+ InviteDomains InviteDomains `json:"inviteDomains"`
+ JSON organizationJSON `json:"-"`
}
// organizationJSON contains the JSON metadata for the struct [Organization]
type organizationJSON struct {
ID apijson.Field
CreatedAt apijson.Field
- InviteDomains apijson.Field
Name apijson.Field
UpdatedAt apijson.Field
+ InviteDomains apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
@@ -377,11 +379,10 @@ func (r organizationJSON) RawJSON() string {
}
type OrganizationMember struct {
- AvatarURL string `json:"avatarUrl"`
- Email string `json:"email"`
- FullName string `json:"fullName"`
+ Email string `json:"email,required"`
+ FullName string `json:"fullName,required"`
// login_provider is the login provider the user uses to sign in
- LoginProvider string `json:"loginProvider"`
+ LoginProvider string `json:"loginProvider,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
// resolution. The count is relative to an epoch at UTC midnight on January 1,
@@ -470,17 +471,17 @@ type OrganizationMember struct {
// Joda Time's
// [`ISODateTimeFormat.dateTime()`]()
// to obtain a formatter capable of generating timestamps in this format.
- MemberSince time.Time `json:"memberSince" format:"date-time"`
- Role shared.OrganizationRole `json:"role"`
- Status shared.UserStatus `json:"status"`
- UserID string `json:"userId" format:"uuid"`
+ MemberSince time.Time `json:"memberSince,required" format:"date-time"`
+ Role shared.OrganizationRole `json:"role,required"`
+ Status shared.UserStatus `json:"status,required"`
+ UserID string `json:"userId,required" format:"uuid"`
+ AvatarURL string `json:"avatarUrl"`
JSON organizationMemberJSON `json:"-"`
}
// organizationMemberJSON contains the JSON metadata for the struct
// [OrganizationMember]
type organizationMemberJSON struct {
- AvatarURL apijson.Field
Email apijson.Field
FullName apijson.Field
LoginProvider apijson.Field
@@ -488,6 +489,7 @@ type organizationMemberJSON struct {
Role apijson.Field
Status apijson.Field
UserID apijson.Field
+ AvatarURL apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
@@ -517,19 +519,19 @@ func (r Scope) IsKnown() bool {
}
type OrganizationNewResponse struct {
+ // organization is the created organization
+ Organization Organization `json:"organization,required"`
// member is the member that joined the org on creation. Only set if specified
// "join_organization" is "true" in the request.
- Member OrganizationMember `json:"member"`
- // organization is the created organization
- Organization Organization `json:"organization"`
- JSON organizationNewResponseJSON `json:"-"`
+ Member OrganizationMember `json:"member"`
+ JSON organizationNewResponseJSON `json:"-"`
}
// organizationNewResponseJSON contains the JSON metadata for the struct
// [OrganizationNewResponse]
type organizationNewResponseJSON struct {
- Member apijson.Field
Organization apijson.Field
+ Member apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
@@ -544,7 +546,7 @@ func (r organizationNewResponseJSON) RawJSON() string {
type OrganizationGetResponse struct {
// organization is the requested organization
- Organization Organization `json:"organization"`
+ Organization Organization `json:"organization,required"`
JSON organizationGetResponseJSON `json:"-"`
}
@@ -566,7 +568,7 @@ func (r organizationGetResponseJSON) RawJSON() string {
type OrganizationUpdateResponse struct {
// organization is the updated organization
- Organization Organization `json:"organization"`
+ Organization Organization `json:"organization,required"`
JSON organizationUpdateResponseJSON `json:"-"`
}
@@ -590,7 +592,7 @@ type OrganizationDeleteResponse = interface{}
type OrganizationJoinResponse struct {
// member is the member that was created by joining the organization.
- Member OrganizationMember `json:"member"`
+ Member OrganizationMember `json:"member,required"`
JSON organizationJoinResponseJSON `json:"-"`
}
@@ -615,14 +617,14 @@ type OrganizationLeaveResponse = interface{}
type OrganizationSetRoleResponse = interface{}
type OrganizationNewParams struct {
+ // name is the organization name
+ Name param.Field[string] `json:"name,required"`
// Should other Accounts with the same domain be automatically invited to the
// organization?
InviteAccountsWithMatchingDomain param.Field[bool] `json:"inviteAccountsWithMatchingDomain"`
// join_organization decides whether the Identity issuing this request joins the
// org on creation
JoinOrganization param.Field[bool] `json:"joinOrganization"`
- // name is the organization name
- Name param.Field[string] `json:"name"`
}
func (r OrganizationNewParams) MarshalJSON() (data []byte, err error) {
@@ -631,7 +633,7 @@ func (r OrganizationNewParams) MarshalJSON() (data []byte, err error) {
type OrganizationGetParams struct {
// organization_id is the unique identifier of the Organization to retreive.
- OrganizationID param.Field[string] `json:"organizationId" format:"uuid"`
+ OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"`
}
func (r OrganizationGetParams) MarshalJSON() (data []byte, err error) {
@@ -639,12 +641,12 @@ func (r OrganizationGetParams) MarshalJSON() (data []byte, err error) {
}
type OrganizationUpdateParams struct {
+ // organization_id is the ID of the organization to update the settings for.
+ OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"`
// invite_domains is the domain allowlist of the organization
InviteDomains param.Field[InviteDomainsParam] `json:"inviteDomains"`
// name is the new name of the organization
Name param.Field[string] `json:"name"`
- // organization_id is the ID of the organization to update the settings for.
- OrganizationID param.Field[string] `json:"organizationId" format:"uuid"`
}
func (r OrganizationUpdateParams) MarshalJSON() (data []byte, err error) {
@@ -688,7 +690,7 @@ func (r OrganizationListParamsPagination) MarshalJSON() (data []byte, err error)
type OrganizationDeleteParams struct {
// organization_id is the ID of the organization to delete
- OrganizationID param.Field[string] `json:"organizationId" format:"uuid"`
+ OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"`
}
func (r OrganizationDeleteParams) MarshalJSON() (data []byte, err error) {
@@ -707,7 +709,7 @@ func (r OrganizationJoinParams) MarshalJSON() (data []byte, err error) {
}
type OrganizationLeaveParams struct {
- UserID param.Field[string] `json:"userId" format:"uuid"`
+ UserID param.Field[string] `json:"userId,required" format:"uuid"`
}
func (r OrganizationLeaveParams) MarshalJSON() (data []byte, err error) {
@@ -715,10 +717,10 @@ func (r OrganizationLeaveParams) MarshalJSON() (data []byte, err error) {
}
type OrganizationListMembersParams struct {
- Token param.Field[string] `query:"token"`
- PageSize param.Field[int64] `query:"pageSize"`
// organization_id is the ID of the organization to list members for
- OrganizationID param.Field[string] `json:"organizationId" format:"uuid"`
+ OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"`
+ Token param.Field[string] `query:"token"`
+ PageSize param.Field[int64] `query:"pageSize"`
// pagination contains the pagination options for listing members
Pagination param.Field[OrganizationListMembersParamsPagination] `json:"pagination"`
}
@@ -751,9 +753,9 @@ func (r OrganizationListMembersParamsPagination) MarshalJSON() (data []byte, err
}
type OrganizationSetRoleParams struct {
- OrganizationID param.Field[string] `json:"organizationId" format:"uuid"`
+ OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"`
+ UserID param.Field[string] `json:"userId,required" format:"uuid"`
Role param.Field[shared.OrganizationRole] `json:"role"`
- UserID param.Field[string] `json:"userId" format:"uuid"`
}
func (r OrganizationSetRoleParams) MarshalJSON() (data []byte, err error) {
diff --git a/organization_test.go b/organization_test.go
index 3d6fe20..7f401ac 100644
--- a/organization_test.go
+++ b/organization_test.go
@@ -28,9 +28,9 @@ func TestOrganizationNewWithOptionalParams(t *testing.T) {
option.WithBearerToken("My Bearer Token"),
)
_, err := client.Organizations.New(context.TODO(), gitpod.OrganizationNewParams{
+ Name: gitpod.F("xxx"),
InviteAccountsWithMatchingDomain: gitpod.F(true),
JoinOrganization: gitpod.F(true),
- Name: gitpod.F("xxx"),
})
if err != nil {
var apierr *gitpod.Error
@@ -41,7 +41,7 @@ func TestOrganizationNewWithOptionalParams(t *testing.T) {
}
}
-func TestOrganizationGetWithOptionalParams(t *testing.T) {
+func TestOrganizationGet(t *testing.T) {
t.Skip("skipped: tests are disabled for the time being")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -80,11 +80,11 @@ func TestOrganizationUpdateWithOptionalParams(t *testing.T) {
option.WithBearerToken("My Bearer Token"),
)
_, err := client.Organizations.Update(context.TODO(), gitpod.OrganizationUpdateParams{
+ OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
InviteDomains: gitpod.F(gitpod.InviteDomainsParam{
Domains: gitpod.F([]string{"sfN2.l.iJR-BU.u9JV9.a.m.o2D-4b-Jd.0Z-kX.L.n.S.f.UKbxB"}),
}),
- Name: gitpod.F("name"),
- OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ Name: gitpod.F("name"),
})
if err != nil {
var apierr *gitpod.Error
@@ -126,7 +126,7 @@ func TestOrganizationListWithOptionalParams(t *testing.T) {
}
}
-func TestOrganizationDeleteWithOptionalParams(t *testing.T) {
+func TestOrganizationDelete(t *testing.T) {
t.Skip("skipped: tests are disabled for the time being")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -177,7 +177,7 @@ func TestOrganizationJoinWithOptionalParams(t *testing.T) {
}
}
-func TestOrganizationLeaveWithOptionalParams(t *testing.T) {
+func TestOrganizationLeave(t *testing.T) {
t.Skip("skipped: tests are disabled for the time being")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -216,9 +216,9 @@ func TestOrganizationListMembersWithOptionalParams(t *testing.T) {
option.WithBearerToken("My Bearer Token"),
)
_, err := client.Organizations.ListMembers(context.TODO(), gitpod.OrganizationListMembersParams{
+ OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
Token: gitpod.F("token"),
PageSize: gitpod.F(int64(0)),
- OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
Pagination: gitpod.F(gitpod.OrganizationListMembersParamsPagination{
Token: gitpod.F("token"),
PageSize: gitpod.F(int64(100)),
@@ -248,8 +248,8 @@ func TestOrganizationSetRoleWithOptionalParams(t *testing.T) {
)
_, err := client.Organizations.SetRole(context.TODO(), gitpod.OrganizationSetRoleParams{
OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
- Role: gitpod.F(shared.OrganizationRoleUnspecified),
UserID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ Role: gitpod.F(shared.OrganizationRoleUnspecified),
})
if err != nil {
var apierr *gitpod.Error
diff --git a/organizationdomainverification.go b/organizationdomainverification.go
new file mode 100644
index 0000000..aec5222
--- /dev/null
+++ b/organizationdomainverification.go
@@ -0,0 +1,355 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package gitpod
+
+import (
+ "context"
+ "net/http"
+ "net/url"
+ "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"
+)
+
+// OrganizationDomainVerificationService 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 [NewOrganizationDomainVerificationService] method instead.
+type OrganizationDomainVerificationService struct {
+ Options []option.RequestOption
+}
+
+// NewOrganizationDomainVerificationService 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 NewOrganizationDomainVerificationService(opts ...option.RequestOption) (r *OrganizationDomainVerificationService) {
+ r = &OrganizationDomainVerificationService{}
+ r.Options = opts
+ return
+}
+
+// CreateDomainVerification creates a new domain verification request
+func (r *OrganizationDomainVerificationService) New(ctx context.Context, body OrganizationDomainVerificationNewParams, opts ...option.RequestOption) (res *OrganizationDomainVerificationNewResponse, err error) {
+ opts = append(r.Options[:], opts...)
+ path := "gitpod.v1.OrganizationService/CreateDomainVerification"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// GetDomainVerification retrieves a domain verification request
+func (r *OrganizationDomainVerificationService) Get(ctx context.Context, body OrganizationDomainVerificationGetParams, opts ...option.RequestOption) (res *OrganizationDomainVerificationGetResponse, err error) {
+ opts = append(r.Options[:], opts...)
+ path := "gitpod.v1.OrganizationService/GetDomainVerification"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// ListDomainVerifications lists all domain verifications for an organization
+func (r *OrganizationDomainVerificationService) List(ctx context.Context, params OrganizationDomainVerificationListParams, opts ...option.RequestOption) (res *pagination.DomainVerificationsPage[DomainVerification], err error) {
+ var raw *http.Response
+ opts = append(r.Options[:], opts...)
+ opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
+ path := "gitpod.v1.OrganizationService/ListDomainVerifications"
+ 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
+}
+
+// ListDomainVerifications lists all domain verifications for an organization
+func (r *OrganizationDomainVerificationService) ListAutoPaging(ctx context.Context, params OrganizationDomainVerificationListParams, opts ...option.RequestOption) *pagination.DomainVerificationsPageAutoPager[DomainVerification] {
+ return pagination.NewDomainVerificationsPageAutoPager(r.List(ctx, params, opts...))
+}
+
+// DeleteDomainVerification deletes a domain verification request
+func (r *OrganizationDomainVerificationService) Delete(ctx context.Context, body OrganizationDomainVerificationDeleteParams, opts ...option.RequestOption) (res *OrganizationDomainVerificationDeleteResponse, err error) {
+ opts = append(r.Options[:], opts...)
+ path := "gitpod.v1.OrganizationService/DeleteDomainVerification"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// VerifyDomain verifies a domain ownership
+func (r *OrganizationDomainVerificationService) Verify(ctx context.Context, body OrganizationDomainVerificationVerifyParams, opts ...option.RequestOption) (res *OrganizationDomainVerificationVerifyResponse, err error) {
+ opts = append(r.Options[:], opts...)
+ path := "gitpod.v1.OrganizationService/VerifyDomain"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+type DomainVerification struct {
+ ID string `json:"id,required" format:"uuid"`
+ Domain string `json:"domain,required"`
+ OrganizationID string `json:"organizationId,required" format:"uuid"`
+ State DomainVerificationState `json:"state,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
+ // 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.
+ VerifiedAt time.Time `json:"verifiedAt,required" format:"date-time"`
+ JSON domainVerificationJSON `json:"-"`
+}
+
+// domainVerificationJSON contains the JSON metadata for the struct
+// [DomainVerification]
+type domainVerificationJSON struct {
+ ID apijson.Field
+ Domain apijson.Field
+ OrganizationID apijson.Field
+ State apijson.Field
+ VerifiedAt apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *DomainVerification) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r domainVerificationJSON) RawJSON() string {
+ return r.raw
+}
+
+type DomainVerificationState string
+
+const (
+ DomainVerificationStateUnspecified DomainVerificationState = "DOMAIN_VERIFICATION_STATE_UNSPECIFIED"
+ DomainVerificationStatePending DomainVerificationState = "DOMAIN_VERIFICATION_STATE_PENDING"
+ DomainVerificationStateVerified DomainVerificationState = "DOMAIN_VERIFICATION_STATE_VERIFIED"
+)
+
+func (r DomainVerificationState) IsKnown() bool {
+ switch r {
+ case DomainVerificationStateUnspecified, DomainVerificationStatePending, DomainVerificationStateVerified:
+ return true
+ }
+ return false
+}
+
+type OrganizationDomainVerificationNewResponse struct {
+ DomainVerification DomainVerification `json:"domainVerification,required"`
+ JSON organizationDomainVerificationNewResponseJSON `json:"-"`
+}
+
+// organizationDomainVerificationNewResponseJSON contains the JSON metadata for the
+// struct [OrganizationDomainVerificationNewResponse]
+type organizationDomainVerificationNewResponseJSON struct {
+ DomainVerification apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *OrganizationDomainVerificationNewResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r organizationDomainVerificationNewResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+type OrganizationDomainVerificationGetResponse struct {
+ DomainVerification DomainVerification `json:"domainVerification,required"`
+ JSON organizationDomainVerificationGetResponseJSON `json:"-"`
+}
+
+// organizationDomainVerificationGetResponseJSON contains the JSON metadata for the
+// struct [OrganizationDomainVerificationGetResponse]
+type organizationDomainVerificationGetResponseJSON struct {
+ DomainVerification apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *OrganizationDomainVerificationGetResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r organizationDomainVerificationGetResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+type OrganizationDomainVerificationDeleteResponse = interface{}
+
+type OrganizationDomainVerificationVerifyResponse struct {
+ DomainVerification DomainVerification `json:"domainVerification,required"`
+ JSON organizationDomainVerificationVerifyResponseJSON `json:"-"`
+}
+
+// organizationDomainVerificationVerifyResponseJSON contains the JSON metadata for
+// the struct [OrganizationDomainVerificationVerifyResponse]
+type organizationDomainVerificationVerifyResponseJSON struct {
+ DomainVerification apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *OrganizationDomainVerificationVerifyResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r organizationDomainVerificationVerifyResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+type OrganizationDomainVerificationNewParams struct {
+ Domain param.Field[string] `json:"domain,required"`
+ OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"`
+}
+
+func (r OrganizationDomainVerificationNewParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type OrganizationDomainVerificationGetParams struct {
+ DomainVerificationID param.Field[string] `json:"domainVerificationId,required" format:"uuid"`
+}
+
+func (r OrganizationDomainVerificationGetParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type OrganizationDomainVerificationListParams struct {
+ OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"`
+ Token param.Field[string] `query:"token"`
+ PageSize param.Field[int64] `query:"pageSize"`
+ Pagination param.Field[OrganizationDomainVerificationListParamsPagination] `json:"pagination"`
+}
+
+func (r OrganizationDomainVerificationListParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// URLQuery serializes [OrganizationDomainVerificationListParams]'s query
+// parameters as `url.Values`.
+func (r OrganizationDomainVerificationListParams) URLQuery() (v url.Values) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatComma,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
+
+type OrganizationDomainVerificationListParamsPagination 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 OrganizationDomainVerificationListParamsPagination) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type OrganizationDomainVerificationDeleteParams struct {
+ DomainVerificationID param.Field[string] `json:"domainVerificationId,required" format:"uuid"`
+}
+
+func (r OrganizationDomainVerificationDeleteParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type OrganizationDomainVerificationVerifyParams struct {
+ DomainVerificationID param.Field[string] `json:"domainVerificationId,required" format:"uuid"`
+}
+
+func (r OrganizationDomainVerificationVerifyParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
diff --git a/organizationdomainverification_test.go b/organizationdomainverification_test.go
new file mode 100644
index 0000000..d90cf92
--- /dev/null
+++ b/organizationdomainverification_test.go
@@ -0,0 +1,146 @@
+// 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 TestOrganizationDomainVerificationNew(t *testing.T) {
+ t.Skip("skipped: tests are disabled for the time being")
+ 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.DomainVerifications.New(context.TODO(), gitpod.OrganizationDomainVerificationNewParams{
+ Domain: gitpod.F("xxxx"),
+ OrganizationID: 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 TestOrganizationDomainVerificationGet(t *testing.T) {
+ t.Skip("skipped: tests are disabled for the time being")
+ 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.DomainVerifications.Get(context.TODO(), gitpod.OrganizationDomainVerificationGetParams{
+ DomainVerificationID: 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 TestOrganizationDomainVerificationListWithOptionalParams(t *testing.T) {
+ t.Skip("skipped: tests are disabled for the time being")
+ 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.DomainVerifications.List(context.TODO(), gitpod.OrganizationDomainVerificationListParams{
+ OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ Token: gitpod.F("token"),
+ PageSize: gitpod.F(int64(0)),
+ Pagination: gitpod.F(gitpod.OrganizationDomainVerificationListParamsPagination{
+ 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 TestOrganizationDomainVerificationDelete(t *testing.T) {
+ t.Skip("skipped: tests are disabled for the time being")
+ 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.DomainVerifications.Delete(context.TODO(), gitpod.OrganizationDomainVerificationDeleteParams{
+ DomainVerificationID: 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 TestOrganizationDomainVerificationVerify(t *testing.T) {
+ t.Skip("skipped: tests are disabled for the time being")
+ 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.DomainVerifications.Verify(context.TODO(), gitpod.OrganizationDomainVerificationVerifyParams{
+ DomainVerificationID: 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())
+ }
+}
diff --git a/organizationinvite.go b/organizationinvite.go
index cd6eed4..2e700c7 100644
--- a/organizationinvite.go
+++ b/organizationinvite.go
@@ -61,7 +61,7 @@ func (r *OrganizationInviteService) GetSummary(ctx context.Context, body Organiz
type OrganizationInvite struct {
// invite_id is the unique identifier of the invite to join the organization. Use
// JoinOrganization with this ID to join the organization.
- InviteID string `json:"inviteId" format:"uuid"`
+ InviteID string `json:"inviteId,required" format:"uuid"`
JSON organizationInviteJSON `json:"-"`
}
@@ -82,7 +82,7 @@ func (r organizationInviteJSON) RawJSON() string {
}
type OrganizationInviteNewResponse struct {
- Invite OrganizationInvite `json:"invite"`
+ Invite OrganizationInvite `json:"invite,required"`
JSON organizationInviteNewResponseJSON `json:"-"`
}
@@ -103,7 +103,7 @@ func (r organizationInviteNewResponseJSON) RawJSON() string {
}
type OrganizationInviteGetResponse struct {
- Invite OrganizationInvite `json:"invite"`
+ Invite OrganizationInvite `json:"invite,required"`
JSON organizationInviteGetResponseJSON `json:"-"`
}
@@ -124,7 +124,7 @@ func (r organizationInviteGetResponseJSON) RawJSON() string {
}
type OrganizationInviteGetSummaryResponse struct {
- OrganizationID string `json:"organizationId" format:"uuid"`
+ OrganizationID string `json:"organizationId,required" format:"uuid"`
OrganizationMemberCount int64 `json:"organizationMemberCount"`
OrganizationName string `json:"organizationName"`
JSON organizationInviteGetSummaryResponseJSON `json:"-"`
@@ -149,7 +149,7 @@ func (r organizationInviteGetSummaryResponseJSON) RawJSON() string {
}
type OrganizationInviteNewParams struct {
- OrganizationID param.Field[string] `json:"organizationId" format:"uuid"`
+ OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"`
}
func (r OrganizationInviteNewParams) MarshalJSON() (data []byte, err error) {
@@ -157,7 +157,7 @@ func (r OrganizationInviteNewParams) MarshalJSON() (data []byte, err error) {
}
type OrganizationInviteGetParams struct {
- OrganizationID param.Field[string] `json:"organizationId" format:"uuid"`
+ OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"`
}
func (r OrganizationInviteGetParams) MarshalJSON() (data []byte, err error) {
@@ -165,7 +165,7 @@ func (r OrganizationInviteGetParams) MarshalJSON() (data []byte, err error) {
}
type OrganizationInviteGetSummaryParams struct {
- InviteID param.Field[string] `json:"inviteId" format:"uuid"`
+ InviteID param.Field[string] `json:"inviteId,required" format:"uuid"`
}
func (r OrganizationInviteGetSummaryParams) MarshalJSON() (data []byte, err error) {
diff --git a/organizationinvite_test.go b/organizationinvite_test.go
index c678cdc..b439088 100644
--- a/organizationinvite_test.go
+++ b/organizationinvite_test.go
@@ -13,7 +13,7 @@ import (
"github.com/gitpod-io/gitpod-sdk-go/option"
)
-func TestOrganizationInviteNewWithOptionalParams(t *testing.T) {
+func TestOrganizationInviteNew(t *testing.T) {
t.Skip("skipped: tests are disabled for the time being")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -38,7 +38,7 @@ func TestOrganizationInviteNewWithOptionalParams(t *testing.T) {
}
}
-func TestOrganizationInviteGetWithOptionalParams(t *testing.T) {
+func TestOrganizationInviteGet(t *testing.T) {
t.Skip("skipped: tests are disabled for the time being")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -63,7 +63,7 @@ func TestOrganizationInviteGetWithOptionalParams(t *testing.T) {
}
}
-func TestOrganizationInviteGetSummaryWithOptionalParams(t *testing.T) {
+func TestOrganizationInviteGetSummary(t *testing.T) {
t.Skip("skipped: tests are disabled for the time being")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
diff --git a/organizationssoconfiguration.go b/organizationssoconfiguration.go
index 14b8fc8..5bf4c79 100644
--- a/organizationssoconfiguration.go
+++ b/organizationssoconfiguration.go
@@ -107,33 +107,33 @@ func (r ProviderType) IsKnown() bool {
type SSOConfiguration struct {
// id is the unique identifier of the SSO configuration
- ID string `json:"id" format:"uuid"`
- // claims are key/value pairs that defines a mapping of claims issued by the IdP.
- Claims map[string]string `json:"claims"`
+ ID string `json:"id,required" format:"uuid"`
// client_id is the client ID of the OIDC application set on the IdP
- ClientID string `json:"clientId"`
- EmailDomain string `json:"emailDomain"`
+ ClientID string `json:"clientId,required"`
+ EmailDomain string `json:"emailDomain,required"`
// issuer_url is the URL of the IdP issuer
- IssuerURL string `json:"issuerUrl"`
- OrganizationID string `json:"organizationId" format:"uuid"`
+ IssuerURL string `json:"issuerUrl,required"`
+ OrganizationID string `json:"organizationId,required" format:"uuid"`
// provider_type defines the type of the SSO configuration
- ProviderType ProviderType `json:"providerType"`
+ ProviderType ProviderType `json:"providerType,required"`
// state is the state of the SSO configuration
- State SSOConfigurationState `json:"state"`
- JSON ssoConfigurationJSON `json:"-"`
+ State SSOConfigurationState `json:"state,required"`
+ // claims are key/value pairs that defines a mapping of claims issued by the IdP.
+ Claims map[string]string `json:"claims"`
+ JSON ssoConfigurationJSON `json:"-"`
}
// ssoConfigurationJSON contains the JSON metadata for the struct
// [SSOConfiguration]
type ssoConfigurationJSON struct {
ID apijson.Field
- Claims apijson.Field
ClientID apijson.Field
EmailDomain apijson.Field
IssuerURL apijson.Field
OrganizationID apijson.Field
ProviderType apijson.Field
State apijson.Field
+ Claims apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
@@ -164,7 +164,7 @@ func (r SSOConfigurationState) IsKnown() bool {
type OrganizationSSOConfigurationNewResponse struct {
// sso_configuration is the created SSO configuration
- SSOConfiguration SSOConfiguration `json:"ssoConfiguration"`
+ SSOConfiguration SSOConfiguration `json:"ssoConfiguration,required"`
JSON organizationSSOConfigurationNewResponseJSON `json:"-"`
}
@@ -186,7 +186,7 @@ func (r organizationSSOConfigurationNewResponseJSON) RawJSON() string {
type OrganizationSSOConfigurationGetResponse struct {
// sso_configuration is the SSO configuration identified by the ID
- SSOConfiguration SSOConfiguration `json:"ssoConfiguration"`
+ SSOConfiguration SSOConfiguration `json:"ssoConfiguration,required"`
JSON organizationSSOConfigurationGetResponseJSON `json:"-"`
}
@@ -212,14 +212,14 @@ type OrganizationSSOConfigurationDeleteResponse = interface{}
type OrganizationSSOConfigurationNewParams struct {
// client_id is the client ID of the OIDC application set on the IdP
- ClientID param.Field[string] `json:"clientId"`
+ 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"`
+ 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"`
+ EmailDomain param.Field[string] `json:"emailDomain,required"`
// issuer_url is the URL of the IdP issuer
- IssuerURL param.Field[string] `json:"issuerUrl" format:"uri"`
- OrganizationID param.Field[string] `json:"organizationId" format:"uuid"`
+ IssuerURL param.Field[string] `json:"issuerUrl,required" format:"uri"`
+ OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"`
}
func (r OrganizationSSOConfigurationNewParams) MarshalJSON() (data []byte, err error) {
@@ -228,7 +228,7 @@ func (r OrganizationSSOConfigurationNewParams) MarshalJSON() (data []byte, err e
type OrganizationSSOConfigurationGetParams struct {
// sso_configuration_id is the ID of the SSO configuration to get
- SSOConfigurationID param.Field[string] `json:"ssoConfigurationId" format:"uuid"`
+ SSOConfigurationID param.Field[string] `json:"ssoConfigurationId,required" format:"uuid"`
}
func (r OrganizationSSOConfigurationGetParams) MarshalJSON() (data []byte, err error) {
@@ -236,6 +236,8 @@ func (r OrganizationSSOConfigurationGetParams) MarshalJSON() (data []byte, err e
}
type OrganizationSSOConfigurationUpdateParams struct {
+ // sso_configuration_id is the ID of the SSO configuration to update
+ SSOConfigurationID param.Field[string] `json:"ssoConfigurationId,required" format:"uuid"`
// claims are key/value pairs that defines a mapping of claims issued by the IdP.
Claims param.Field[map[string]string] `json:"claims"`
// client_id is the client ID of the SSO provider
@@ -245,8 +247,6 @@ type OrganizationSSOConfigurationUpdateParams struct {
EmailDomain param.Field[string] `json:"emailDomain"`
// issuer_url is the URL of the IdP issuer
IssuerURL param.Field[string] `json:"issuerUrl" format:"uri"`
- // sso_configuration_id is the ID of the SSO configuration to update
- SSOConfigurationID param.Field[string] `json:"ssoConfigurationId" format:"uuid"`
// state is the state of the SSO configuration
State param.Field[SSOConfigurationState] `json:"state"`
}
@@ -256,10 +256,10 @@ func (r OrganizationSSOConfigurationUpdateParams) MarshalJSON() (data []byte, er
}
type OrganizationSSOConfigurationListParams struct {
- Token param.Field[string] `query:"token"`
- PageSize param.Field[int64] `query:"pageSize"`
// organization_id is the ID of the organization to list SSO configurations for.
- OrganizationID param.Field[string] `json:"organizationId" format:"uuid"`
+ OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"`
+ Token param.Field[string] `query:"token"`
+ PageSize param.Field[int64] `query:"pageSize"`
Pagination param.Field[OrganizationSSOConfigurationListParamsPagination] `json:"pagination"`
}
@@ -290,7 +290,7 @@ func (r OrganizationSSOConfigurationListParamsPagination) MarshalJSON() (data []
}
type OrganizationSSOConfigurationDeleteParams struct {
- SSOConfigurationID param.Field[string] `json:"ssoConfigurationId" format:"uuid"`
+ SSOConfigurationID param.Field[string] `json:"ssoConfigurationId,required" format:"uuid"`
}
func (r OrganizationSSOConfigurationDeleteParams) MarshalJSON() (data []byte, err error) {
diff --git a/organizationssoconfiguration_test.go b/organizationssoconfiguration_test.go
index 173fb13..c75078b 100644
--- a/organizationssoconfiguration_test.go
+++ b/organizationssoconfiguration_test.go
@@ -13,7 +13,7 @@ import (
"github.com/gitpod-io/gitpod-sdk-go/option"
)
-func TestOrganizationSSOConfigurationNewWithOptionalParams(t *testing.T) {
+func TestOrganizationSSOConfigurationNew(t *testing.T) {
t.Skip("skipped: tests are disabled for the time being")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -42,7 +42,7 @@ func TestOrganizationSSOConfigurationNewWithOptionalParams(t *testing.T) {
}
}
-func TestOrganizationSSOConfigurationGetWithOptionalParams(t *testing.T) {
+func TestOrganizationSSOConfigurationGet(t *testing.T) {
t.Skip("skipped: tests are disabled for the time being")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -81,15 +81,15 @@ func TestOrganizationSSOConfigurationUpdateWithOptionalParams(t *testing.T) {
option.WithBearerToken("My Bearer Token"),
)
_, err := client.Organizations.SSOConfigurations.Update(context.TODO(), gitpod.OrganizationSSOConfigurationUpdateParams{
+ SSOConfigurationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
Claims: gitpod.F(map[string]string{
"foo": "string",
}),
- ClientID: gitpod.F("x"),
- ClientSecret: gitpod.F("x"),
- EmailDomain: gitpod.F("xxxx"),
- IssuerURL: gitpod.F("https://example.com"),
- SSOConfigurationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
- State: gitpod.F(gitpod.SSOConfigurationStateUnspecified),
+ ClientID: gitpod.F("x"),
+ ClientSecret: gitpod.F("x"),
+ EmailDomain: gitpod.F("xxxx"),
+ IssuerURL: gitpod.F("https://example.com"),
+ State: gitpod.F(gitpod.SSOConfigurationStateUnspecified),
})
if err != nil {
var apierr *gitpod.Error
@@ -114,9 +114,9 @@ func TestOrganizationSSOConfigurationListWithOptionalParams(t *testing.T) {
option.WithBearerToken("My Bearer Token"),
)
_, err := client.Organizations.SSOConfigurations.List(context.TODO(), gitpod.OrganizationSSOConfigurationListParams{
+ OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
Token: gitpod.F("token"),
PageSize: gitpod.F(int64(0)),
- OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
Pagination: gitpod.F(gitpod.OrganizationSSOConfigurationListParamsPagination{
Token: gitpod.F("token"),
PageSize: gitpod.F(int64(100)),
@@ -131,7 +131,7 @@ func TestOrganizationSSOConfigurationListWithOptionalParams(t *testing.T) {
}
}
-func TestOrganizationSSOConfigurationDeleteWithOptionalParams(t *testing.T) {
+func TestOrganizationSSOConfigurationDelete(t *testing.T) {
t.Skip("skipped: tests are disabled for the time being")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
diff --git a/packages/pagination/pagination.go b/packages/pagination/pagination.go
index 6622cf5..03d33c5 100644
--- a/packages/pagination/pagination.go
+++ b/packages/pagination/pagination.go
@@ -10,6 +10,125 @@ import (
"github.com/gitpod-io/gitpod-sdk-go/option"
)
+type DomainVerificationsPagePagination struct {
+ NextToken string `json:"nextToken"`
+ JSON domainVerificationsPagePaginationJSON `json:"-"`
+}
+
+// domainVerificationsPagePaginationJSON contains the JSON metadata for the struct
+// [DomainVerificationsPagePagination]
+type domainVerificationsPagePaginationJSON struct {
+ NextToken apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *DomainVerificationsPagePagination) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r domainVerificationsPagePaginationJSON) RawJSON() string {
+ return r.raw
+}
+
+type DomainVerificationsPage[T any] struct {
+ DomainVerifications []T `json:"domainVerifications"`
+ Pagination DomainVerificationsPagePagination `json:"pagination"`
+ JSON domainVerificationsPageJSON `json:"-"`
+ cfg *requestconfig.RequestConfig
+ res *http.Response
+}
+
+// domainVerificationsPageJSON contains the JSON metadata for the struct
+// [DomainVerificationsPage[T]]
+type domainVerificationsPageJSON struct {
+ DomainVerifications apijson.Field
+ Pagination apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *DomainVerificationsPage[T]) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r domainVerificationsPageJSON) 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 *DomainVerificationsPage[T]) GetNextPage() (res *DomainVerificationsPage[T], err error) {
+ next := r.Pagination.NextToken
+ if len(next) == 0 {
+ return nil, nil
+ }
+ cfg := r.cfg.Clone(r.cfg.Context)
+ cfg.Apply(option.WithQuery("token", next))
+ 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 *DomainVerificationsPage[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) {
+ if r == nil {
+ r = &DomainVerificationsPage[T]{}
+ }
+ r.cfg = cfg
+ r.res = res
+}
+
+type DomainVerificationsPageAutoPager[T any] struct {
+ page *DomainVerificationsPage[T]
+ cur T
+ idx int
+ run int
+ err error
+}
+
+func NewDomainVerificationsPageAutoPager[T any](page *DomainVerificationsPage[T], err error) *DomainVerificationsPageAutoPager[T] {
+ return &DomainVerificationsPageAutoPager[T]{
+ page: page,
+ err: err,
+ }
+}
+
+func (r *DomainVerificationsPageAutoPager[T]) Next() bool {
+ if r.page == nil || len(r.page.DomainVerifications) == 0 {
+ return false
+ }
+ if r.idx >= len(r.page.DomainVerifications) {
+ r.idx = 0
+ r.page, r.err = r.page.GetNextPage()
+ if r.err != nil || r.page == nil || len(r.page.DomainVerifications) == 0 {
+ return false
+ }
+ }
+ r.cur = r.page.DomainVerifications[r.idx]
+ r.run += 1
+ r.idx += 1
+ return true
+}
+
+func (r *DomainVerificationsPageAutoPager[T]) Current() T {
+ return r.cur
+}
+
+func (r *DomainVerificationsPageAutoPager[T]) Err() error {
+ return r.err
+}
+
+func (r *DomainVerificationsPageAutoPager[T]) Index() int {
+ return r.run
+}
+
type EditorsPagePagination struct {
NextToken string `json:"nextToken"`
JSON editorsPagePaginationJSON `json:"-"`
diff --git a/paginationauto_test.go b/paginationauto_test.go
index 49809dc..2638e2c 100644
--- a/paginationauto_test.go
+++ b/paginationauto_test.go
@@ -24,11 +24,11 @@ func TestAutoPagination(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
)
- iter := client.Environments.Automations.Services.ListAutoPaging(context.TODO(), gitpod.EnvironmentAutomationServiceListParams{})
+ iter := client.Environments.ListAutoPaging(context.TODO(), gitpod.EnvironmentListParams{})
// Prism mock isn't going to give us real pagination
for i := 0; i < 3 && iter.Next(); i++ {
- service := iter.Current()
- t.Logf("%+v\n", service.ID)
+ environment := iter.Current()
+ t.Logf("%+v\n", environment.ID)
}
if err := iter.Err(); err != nil {
t.Fatalf("err should be nil: %s", err.Error())
diff --git a/paginationmanual_test.go b/paginationmanual_test.go
index 454b2db..ef6e802 100644
--- a/paginationmanual_test.go
+++ b/paginationmanual_test.go
@@ -24,12 +24,12 @@ func TestManualPagination(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
)
- page, err := client.Environments.Automations.Services.List(context.TODO(), gitpod.EnvironmentAutomationServiceListParams{})
+ page, err := client.Environments.List(context.TODO(), gitpod.EnvironmentListParams{})
if err != nil {
t.Fatalf("err should be nil: %s", err.Error())
}
- for _, service := range page.Services {
- t.Logf("%+v\n", service.ID)
+ for _, environment := range page.Environments {
+ t.Logf("%+v\n", environment.ID)
}
// Prism mock isn't going to give us real pagination
page, err = page.GetNextPage()
@@ -37,8 +37,8 @@ func TestManualPagination(t *testing.T) {
t.Fatalf("err should be nil: %s", err.Error())
}
if page != nil {
- for _, service := range page.Services {
- t.Logf("%+v\n", service.ID)
+ for _, environment := range page.Environments {
+ t.Logf("%+v\n", environment.ID)
}
}
}
diff --git a/projectpolicy.go b/projectpolicy.go
index 8c9a655..a9a2861 100644
--- a/projectpolicy.go
+++ b/projectpolicy.go
@@ -110,11 +110,12 @@ const (
ProjectRoleUnspecified ProjectRole = "PROJECT_ROLE_UNSPECIFIED"
ProjectRoleAdmin ProjectRole = "PROJECT_ROLE_ADMIN"
ProjectRoleUser ProjectRole = "PROJECT_ROLE_USER"
+ ProjectRoleEditor ProjectRole = "PROJECT_ROLE_EDITOR"
)
func (r ProjectRole) IsKnown() bool {
switch r {
- case ProjectRoleUnspecified, ProjectRoleAdmin, ProjectRoleUser:
+ case ProjectRoleUnspecified, ProjectRoleAdmin, ProjectRoleUser, ProjectRoleEditor:
return true
}
return false
diff --git a/runnerconfigurationenvironmentclass.go b/runnerconfigurationenvironmentclass.go
index 0ad734d..affc504 100644
--- a/runnerconfigurationenvironmentclass.go
+++ b/runnerconfigurationenvironmentclass.go
@@ -60,8 +60,8 @@ func (r *RunnerConfigurationEnvironmentClassService) Update(ctx context.Context,
return
}
-// ListEnvironmentClasses returns all environment classes configured for a runner.
-// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
+// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE ListEnvironmentClasses returns all
+// environment classes configured for a runner.
func (r *RunnerConfigurationEnvironmentClassService) List(ctx context.Context, params RunnerConfigurationEnvironmentClassListParams, opts ...option.RequestOption) (res *pagination.EnvironmentClassesPage[shared.EnvironmentClass], err error) {
var raw *http.Response
opts = append(r.Options[:], opts...)
@@ -79,8 +79,8 @@ func (r *RunnerConfigurationEnvironmentClassService) List(ctx context.Context, p
return res, nil
}
-// ListEnvironmentClasses returns all environment classes configured for a runner.
-// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
+// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE ListEnvironmentClasses returns all
+// environment classes configured for a runner.
func (r *RunnerConfigurationEnvironmentClassService) ListAutoPaging(ctx context.Context, params RunnerConfigurationEnvironmentClassListParams, opts ...option.RequestOption) *pagination.EnvironmentClassesPageAutoPager[shared.EnvironmentClass] {
return pagination.NewEnvironmentClassesPageAutoPager(r.List(ctx, params, opts...))
}
@@ -181,11 +181,22 @@ func (r RunnerConfigurationEnvironmentClassListParams) URLQuery() (v url.Values)
}
type RunnerConfigurationEnvironmentClassListParamsFilter struct {
+ // can_create_environments filters the response to only environment classes that
+ // can be used to create new environments by the caller. Unlike enabled, which
+ // indicates general availability, this ensures the caller only sees environment
+ // classes they are allowed to use.
+ CanCreateEnvironments param.Field[bool] `json:"canCreateEnvironments"`
// enabled filters the response to only enabled or disabled environment classes. If
// not set, all environment classes are returned.
Enabled param.Field[bool] `json:"enabled"`
// runner_ids filters the response to only EnvironmentClasses of these Runner IDs
RunnerIDs param.Field[[]string] `json:"runnerIds" format:"uuid"`
+ // runner_kind filters the response to only environment classes from runners of
+ // these kinds.
+ RunnerKinds param.Field[[]RunnerKind] `json:"runnerKinds"`
+ // runner_providers filters the response to only environment classes from runners
+ // of these providers.
+ RunnerProviders param.Field[[]RunnerProvider] `json:"runnerProviders"`
}
func (r RunnerConfigurationEnvironmentClassListParamsFilter) MarshalJSON() (data []byte, err error) {
diff --git a/runnerconfigurationenvironmentclass_test.go b/runnerconfigurationenvironmentclass_test.go
index aaaa918..1f89366 100644
--- a/runnerconfigurationenvironmentclass_test.go
+++ b/runnerconfigurationenvironmentclass_test.go
@@ -115,8 +115,11 @@ func TestRunnerConfigurationEnvironmentClassListWithOptionalParams(t *testing.T)
Token: gitpod.F("token"),
PageSize: gitpod.F(int64(0)),
Filter: gitpod.F(gitpod.RunnerConfigurationEnvironmentClassListParamsFilter{
- Enabled: gitpod.F(true),
- RunnerIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
+ CanCreateEnvironments: gitpod.F(true),
+ Enabled: gitpod.F(true),
+ RunnerIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}),
+ RunnerKinds: gitpod.F([]gitpod.RunnerKind{gitpod.RunnerKindUnspecified}),
+ RunnerProviders: gitpod.F([]gitpod.RunnerProvider{gitpod.RunnerProviderUnspecified}),
}),
Pagination: gitpod.F(gitpod.RunnerConfigurationEnvironmentClassListParamsPagination{
Token: gitpod.F("token"),
diff --git a/secret.go b/secret.go
index a01605c..6d64c98 100644
--- a/secret.go
+++ b/secret.go
@@ -94,6 +94,8 @@ func (r *SecretService) UpdateValue(ctx context.Context, body SecretUpdateValueP
type Secret struct {
ID string `json:"id" format:"uuid"`
+ // secret will be mounted as a registry secret
+ ContainerRegistryBasicAuthHost string `json:"containerRegistryBasicAuthHost"`
// 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,
@@ -288,16 +290,17 @@ type Secret struct {
// secretJSON contains the JSON metadata for the struct [Secret]
type secretJSON struct {
- ID apijson.Field
- CreatedAt apijson.Field
- Creator apijson.Field
- EnvironmentVariable apijson.Field
- FilePath apijson.Field
- Name apijson.Field
- ProjectID apijson.Field
- UpdatedAt apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
+ ID apijson.Field
+ ContainerRegistryBasicAuthHost apijson.Field
+ CreatedAt apijson.Field
+ Creator apijson.Field
+ EnvironmentVariable apijson.Field
+ FilePath apijson.Field
+ Name apijson.Field
+ ProjectID apijson.Field
+ UpdatedAt apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
}
func (r *Secret) UnmarshalJSON(data []byte) (err error) {
@@ -355,6 +358,13 @@ func (r secretGetValueResponseJSON) RawJSON() string {
type SecretUpdateValueResponse = interface{}
type SecretNewParams struct {
+ // secret will be mounted as a docker config in the environment VM, mount will have
+ // the docker host value must be a valid registry hostname with optional port:
+ //
+ // ```
+ // this.matches('^[a-zA-Z0-9][a-zA-Z0-9.-]*[a-zA-Z0-9](:[0-9]+)?$')
+ // ```
+ ContainerRegistryBasicAuthHost param.Field[string] `json:"containerRegistryBasicAuthHost"`
// secret will be created as an Environment Variable with the same name as the
// secret
EnvironmentVariable param.Field[bool] `json:"environmentVariable"`
diff --git a/secret_test.go b/secret_test.go
index ef5d669..302e111 100644
--- a/secret_test.go
+++ b/secret_test.go
@@ -27,11 +27,12 @@ func TestSecretNewWithOptionalParams(t *testing.T) {
option.WithBearerToken("My Bearer Token"),
)
_, err := client.Secrets.New(context.TODO(), gitpod.SecretNewParams{
- EnvironmentVariable: gitpod.F(true),
- FilePath: gitpod.F("filePath"),
- Name: gitpod.F("name"),
- ProjectID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
- Value: gitpod.F("x"),
+ ContainerRegistryBasicAuthHost: gitpod.F("containerRegistryBasicAuthHost"),
+ EnvironmentVariable: gitpod.F(true),
+ FilePath: gitpod.F("filePath"),
+ Name: gitpod.F("name"),
+ ProjectID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ Value: gitpod.F("x"),
})
if err != nil {
var apierr *gitpod.Error
diff --git a/shared/shared.go b/shared/shared.go
index a581656..e174c8f 100644
--- a/shared/shared.go
+++ b/shared/shared.go
@@ -5,7 +5,6 @@ package shared
import (
"time"
- "github.com/gitpod-io/gitpod-sdk-go"
"github.com/gitpod-io/gitpod-sdk-go/internal/apijson"
"github.com/gitpod-io/gitpod-sdk-go/internal/param"
)
@@ -273,6 +272,35 @@ func (r SubjectParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
+type Task struct {
+ ID string `json:"id" format:"uuid"`
+ // dependencies specifies the IDs of the automations this task depends on.
+ DependsOn []string `json:"dependsOn" format:"uuid"`
+ EnvironmentID string `json:"environmentId" format:"uuid"`
+ Metadata TaskMetadata `json:"metadata"`
+ Spec TaskSpec `json:"spec"`
+ JSON taskJSON `json:"-"`
+}
+
+// taskJSON contains the JSON metadata for the struct [Task]
+type taskJSON struct {
+ ID apijson.Field
+ DependsOn apijson.Field
+ EnvironmentID apijson.Field
+ Metadata apijson.Field
+ Spec apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *Task) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r taskJSON) RawJSON() string {
+ return r.raw
+}
+
type TaskExecution struct {
ID string `json:"id" format:"uuid"`
Metadata TaskExecutionMetadata `json:"metadata"`
@@ -700,7 +728,7 @@ func (r taskExecutionSpecPlanStepJSON) RawJSON() string {
type TaskExecutionSpecPlanStepsTask struct {
ID string `json:"id" format:"uuid"`
- Spec gitpod.TaskSpec `json:"spec"`
+ Spec TaskSpec `json:"spec"`
JSON taskExecutionSpecPlanStepsTaskJSON `json:"-"`
}
@@ -792,6 +820,280 @@ func (r taskExecutionStatusStepJSON) RawJSON() string {
return r.raw
}
+type TaskMetadata 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 describes the principal who created the task.
+ Creator Subject `json:"creator"`
+ // description is a user-facing description for the task. It can be used to provide
+ // context and documentation for the task.
+ Description string `json:"description"`
+ // name is a user-facing name for the task. Unlike the reference, this field is not
+ // unique, and not referenced by the system. This is a short descriptive name for
+ // the task.
+ Name string `json:"name"`
+ // reference is a user-facing identifier for the task which must be unique on the
+ // environment. It is used to express dependencies between tasks, and to identify
+ // the task in user interactions (e.g. the CLI).
+ Reference string `json:"reference"`
+ // triggered_by is a list of trigger that start the task.
+ TriggeredBy []AutomationTrigger `json:"triggeredBy"`
+ JSON taskMetadataJSON `json:"-"`
+}
+
+// taskMetadataJSON contains the JSON metadata for the struct [TaskMetadata]
+type taskMetadataJSON struct {
+ CreatedAt apijson.Field
+ Creator apijson.Field
+ Description apijson.Field
+ Name apijson.Field
+ Reference apijson.Field
+ TriggeredBy apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *TaskMetadata) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r taskMetadataJSON) RawJSON() string {
+ return r.raw
+}
+
+type TaskMetadataParam 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 param.Field[time.Time] `json:"createdAt" format:"date-time"`
+ // creator describes the principal who created the task.
+ Creator param.Field[SubjectParam] `json:"creator"`
+ // description is a user-facing description for the task. It can be used to provide
+ // context and documentation for the task.
+ Description param.Field[string] `json:"description"`
+ // name is a user-facing name for the task. Unlike the reference, this field is not
+ // unique, and not referenced by the system. This is a short descriptive name for
+ // the task.
+ Name param.Field[string] `json:"name"`
+ // reference is a user-facing identifier for the task which must be unique on the
+ // environment. It is used to express dependencies between tasks, and to identify
+ // the task in user interactions (e.g. the CLI).
+ Reference param.Field[string] `json:"reference"`
+ // triggered_by is a list of trigger that start the task.
+ TriggeredBy param.Field[[]AutomationTriggerParam] `json:"triggeredBy"`
+}
+
+func (r TaskMetadataParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type TaskSpec struct {
+ // command contains the command the task should execute
+ Command string `json:"command"`
+ // runs_on specifies the environment the task should run on.
+ RunsOn RunsOn `json:"runsOn"`
+ JSON taskSpecJSON `json:"-"`
+}
+
+// taskSpecJSON contains the JSON metadata for the struct [TaskSpec]
+type taskSpecJSON struct {
+ Command apijson.Field
+ RunsOn apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *TaskSpec) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r taskSpecJSON) RawJSON() string {
+ return r.raw
+}
+
+type TaskSpecParam struct {
+ // command contains the command the task should execute
+ Command param.Field[string] `json:"command"`
+ // runs_on specifies the environment the task should run on.
+ RunsOn param.Field[RunsOnParam] `json:"runsOn"`
+}
+
+func (r TaskSpecParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
type UserStatus string
const (
diff --git a/usage_test.go b/usage_test.go
index be3f00a..c1454a1 100644
--- a/usage_test.go
+++ b/usage_test.go
@@ -24,9 +24,9 @@ func TestUsage(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
)
- runner, err := client.Runners.New(context.TODO(), gitpod.RunnerNewParams{})
+ response, err := client.Identity.GetAuthenticatedIdentity(context.TODO(), gitpod.IdentityGetAuthenticatedIdentityParams{})
if err != nil {
t.Error(err)
}
- t.Logf("%+v\n", runner.AccessToken)
+ t.Logf("%+v\n", response.OrganizationID)
}