From 70235d839c7192057a11fd43e60a0e0484e75f68 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 7 Feb 2025 15:11:11 +0000 Subject: [PATCH] feat(api): update to latest changes --- .stats.yml | 2 +- README.md | 4 +- account.go | 364 +- account_test.go | 2 +- aliases.go | 140 + api.md | 209 +- editor.go | 89 +- environment.go | 9088 ++--------------- environment_test.go | 128 +- environmentautomation.go | 161 +- environmentautomation_test.go | 21 +- environmentautomationservice.go | 2360 +---- environmentautomationservice_test.go | 50 +- environmentautomationtask.go | 2255 +--- environmentautomationtask_test.go | 37 +- environmentautomationtaskexecution.go | 1363 +-- environmentautomationtaskexecution_test.go | 3 +- environmentclass.go | 71 +- environmentclass_test.go | 3 +- event.go | 278 +- event_test.go | 5 +- group.go | 19 +- identity.go | 51 +- organization.go | 1438 +-- organization_test.go | 22 +- organizationinvite.go | 67 +- organizationssoconfiguration.go | 377 +- organizationssoconfiguration_test.go | 14 +- project.go | 3813 +------ project_test.go | 41 +- projectpolicy.go | 188 +- projectpolicy_test.go | 4 +- runner.go | 2025 +--- runner_test.go | 30 +- runnerconfiguration.go | 504 +- runnerconfiguration_test.go | 36 +- runnerconfigurationenvironmentclass.go | 216 +- runnerconfigurationenvironmentclass_test.go | 15 +- runnerconfigurationhostauthenticationtoken.go | 565 +- ...nfigurationhostauthenticationtoken_test.go | 14 +- runnerconfigurationschema.go | 576 +- runnerconfigurationscmintegration.go | 275 +- runnerconfigurationscmintegration_test.go | 20 +- runnerpolicy.go | 188 +- runnerpolicy_test.go | 4 +- secret.go | 820 +- secret_test.go | 11 +- shared/shared.go | 810 ++ user.go | 68 +- userpat.go | 414 +- 50 files changed, 4654 insertions(+), 24604 deletions(-) create mode 100644 shared/shared.go diff --git a/.stats.yml b/.stats.yml index d135c04..1b7c986 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-2410f189970eeb715e79976f13eeca7259b602809e27a84820da8c794dcf00cb.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-da4c36c6b1d973f481abb8eefdeb085d88eaf37eeaba30d276cb3daa405b6f0c.yml diff --git a/README.md b/README.md index 1c9e355..17bf8e3 100644 --- a/README.md +++ b/README.md @@ -165,8 +165,8 @@ You can use `.ListAutoPaging()` methods to iterate through items across all page iter := client.Environments.Automations.Services.ListAutoPaging(context.TODO(), gitpod.EnvironmentAutomationServiceListParams{}) // Automatically fetches more pages as needed. for iter.Next() { - environmentAutomationServiceListResponse := iter.Current() - fmt.Printf("%+v\n", environmentAutomationServiceListResponse) + service := iter.Current() + fmt.Printf("%+v\n", service) } if err := iter.Err(); err != nil { panic(err.Error()) diff --git a/account.go b/account.go index dab71f3..cbb7d6c 100644 --- a/account.go +++ b/account.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "time" "github.com/gitpod-io/flex-sdk-go/internal/apijson" "github.com/gitpod-io/flex-sdk-go/internal/apiquery" @@ -13,6 +14,7 @@ import ( "github.com/gitpod-io/flex-sdk-go/internal/requestconfig" "github.com/gitpod-io/flex-sdk-go/option" "github.com/gitpod-io/flex-sdk-go/packages/pagination" + "github.com/gitpod-io/flex-sdk-go/shared" ) // AccountService contains methods and other services that help with interacting @@ -61,7 +63,7 @@ func (r *AccountService) GetSSOLoginURL(ctx context.Context, body AccountGetSSOL // ListLoginProviders returns the list of login providers matching the provided // filters. -func (r *AccountService) ListLoginProviders(ctx context.Context, params AccountListLoginProvidersParams, opts ...option.RequestOption) (res *pagination.LoginProvidersPage[AccountListLoginProvidersResponse], err error) { +func (r *AccountService) ListLoginProviders(ctx context.Context, params AccountListLoginProvidersParams, opts ...option.RequestOption) (res *pagination.LoginProvidersPage[LoginProvider], err error) { var raw *http.Response opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -80,101 +82,359 @@ func (r *AccountService) ListLoginProviders(ctx context.Context, params AccountL // ListLoginProviders returns the list of login providers matching the provided // filters. -func (r *AccountService) ListLoginProvidersAutoPaging(ctx context.Context, params AccountListLoginProvidersParams, opts ...option.RequestOption) *pagination.LoginProvidersPageAutoPager[AccountListLoginProvidersResponse] { +func (r *AccountService) ListLoginProvidersAutoPaging(ctx context.Context, params AccountListLoginProvidersParams, opts ...option.RequestOption) *pagination.LoginProvidersPageAutoPager[LoginProvider] { return pagination.NewLoginProvidersPageAutoPager(r.ListLoginProviders(ctx, params, opts...)) } -type AccountGetResponse struct { - Account AccountGetResponseAccount `json:"account"` - JSON accountGetResponseJSON `json:"-"` +type Account struct { + ID string `json:"id" format:"uuid"` + AvatarURL string `json:"avatarUrl"` + // 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"` + 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"` + // public_email_provider is true if the email for the Account matches a known + // public email provider + PublicEmailProvider bool `json:"publicEmailProvider"` + // A Timestamp represents a point in time independent of any time zone or local + // calendar, encoded as a count of seconds and fractions of seconds at nanosecond + // resolution. The count is relative to an epoch at UTC midnight on January 1, + // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar + // backwards to year one. + // + // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + // second table is needed for interpretation, using a + // [24-hour linear smear](https://developers.google.com/time/smear). + // + // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + // restricting to that range, we ensure that we can convert to and from + // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + // + // # Examples + // + // Example 1: Compute Timestamp from POSIX `time()`. + // + // Timestamp timestamp; + // timestamp.set_seconds(time(NULL)); + // timestamp.set_nanos(0); + // + // Example 2: Compute Timestamp from POSIX `gettimeofday()`. + // + // struct timeval tv; + // gettimeofday(&tv, NULL); + // + // Timestamp timestamp; + // timestamp.set_seconds(tv.tv_sec); + // timestamp.set_nanos(tv.tv_usec * 1000); + // + // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + // + // FILETIME ft; + // GetSystemTimeAsFileTime(&ft); + // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + // + // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + // Timestamp timestamp; + // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + // + // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + // + // long millis = System.currentTimeMillis(); + // + // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + // .setNanos((int) ((millis % 1000) * 1000000)).build(); + // + // Example 5: Compute Timestamp from Java `Instant.now()`. + // + // Instant now = Instant.now(); + // + // Timestamp timestamp = + // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + // .setNanos(now.getNano()).build(); + // + // Example 6: Compute Timestamp from current time in Python. + // + // timestamp = Timestamp() + // timestamp.GetCurrentTime() + // + // # JSON Mapping + // + // In JSON format, the Timestamp type is encoded as a string in the + // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is + // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always + // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are + // zero-padded to two digits each. The fractional seconds, which can go up to 9 + // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix + // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON + // serializer should always use UTC (as indicated by "Z") when printing the + // Timestamp type and a proto3 JSON parser should be able to accept both UTC and + // other timezones (as indicated by an offset). + // + // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on + // January 15, 2017. + // + // In JavaScript, one can convert a Date object to this format using the standard + // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + // method. In Python, a standard `datetime.datetime` object can be converted to + // this format using + // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the + // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the + // Joda Time's + // [`ISODateTimeFormat.dateTime()`]() + // to obtain a formatter capable of generating timestamps in this format. + UpdatedAt time.Time `json:"updatedAt" format:"date-time"` + JSON 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 + raw string + ExtraFields map[string]apijson.Field +} + +func (r *Account) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -// accountGetResponseJSON contains the JSON metadata for the struct -// [AccountGetResponse] -type accountGetResponseJSON struct { - Account apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r accountJSON) RawJSON() string { + return r.raw } -func (r *AccountGetResponse) UnmarshalJSON(data []byte) (err error) { +type AccountMembership struct { + // organization_id is the id of the organization the user is a member of + OrganizationID string `json:"organizationId" format:"uuid"` + // organization_name is the member count of the organization the user is a member + // of + OrganizationMemberCount int64 `json:"organizationMemberCount"` + // organization_name is the name of the organization the user is a member of + OrganizationName string `json:"organizationName"` + // user_id is the ID the user has in the organization + UserID string `json:"userId" format:"uuid"` + // user_role is the role the user has in the organization + UserRole shared.OrganizationRole `json:"userRole"` + JSON accountMembershipJSON `json:"-"` +} + +// accountMembershipJSON contains the JSON metadata for the struct +// [AccountMembership] +type accountMembershipJSON struct { + OrganizationID apijson.Field + OrganizationMemberCount apijson.Field + OrganizationName apijson.Field + UserID apijson.Field + UserRole apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountMembership) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r accountGetResponseJSON) RawJSON() string { +func (r accountMembershipJSON) RawJSON() string { return r.raw } -type AccountGetResponseAccount struct { - // organization_id is the ID of the organization the account is owned by if it's - // created through custom SSO - OrganizationID string `json:"organizationId,required"` - JSON accountGetResponseAccountJSON `json:"-"` +type JoinableOrganization struct { + // organization_id is the id of the organization the user can join + OrganizationID string `json:"organizationId" format:"uuid"` + // organization_member_count is the member count of the organization the user can + // join + OrganizationMemberCount int64 `json:"organizationMemberCount"` + // organization_name is the name of the organization the user can join + OrganizationName string `json:"organizationName"` + JSON joinableOrganizationJSON `json:"-"` } -// accountGetResponseAccountJSON contains the JSON metadata for the struct -// [AccountGetResponseAccount] -type accountGetResponseAccountJSON struct { - OrganizationID apijson.Field - raw string - ExtraFields map[string]apijson.Field +// joinableOrganizationJSON contains the JSON metadata for the struct +// [JoinableOrganization] +type joinableOrganizationJSON struct { + OrganizationID apijson.Field + OrganizationMemberCount apijson.Field + OrganizationName apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *AccountGetResponseAccount) UnmarshalJSON(data []byte) (err error) { +func (r *JoinableOrganization) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r accountGetResponseAccountJSON) RawJSON() string { +func (r joinableOrganizationJSON) RawJSON() string { return r.raw } -type AccountDeleteResponse = interface{} - -type AccountGetSSOLoginURLResponse struct { - // login_url is the URL to redirect the user to for SSO login - LoginURL string `json:"loginUrl"` - JSON accountGetSSOLoginURLResponseJSON `json:"-"` +type LoginProvider struct { + // login_url is the URL to redirect the browser agent to for login + LoginURL string `json:"loginUrl"` + // provider is the provider used by this login method, e.g. "github", "google", + // "custom" + Provider string `json:"provider"` + JSON loginProviderJSON `json:"-"` } -// accountGetSSOLoginURLResponseJSON contains the JSON metadata for the struct -// [AccountGetSSOLoginURLResponse] -type accountGetSSOLoginURLResponseJSON struct { +// loginProviderJSON contains the JSON metadata for the struct [LoginProvider] +type loginProviderJSON struct { LoginURL apijson.Field + Provider apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *AccountGetSSOLoginURLResponse) UnmarshalJSON(data []byte) (err error) { +func (r *LoginProvider) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r accountGetSSOLoginURLResponseJSON) RawJSON() string { +func (r loginProviderJSON) RawJSON() string { return r.raw } -type AccountListLoginProvidersResponse struct { - // login_url is the URL to redirect the browser agent to for login - LoginURL string `json:"loginUrl"` - // provider is the provider used by this login method, e.g. "github", "google", - // "custom" - Provider string `json:"provider"` - JSON accountListLoginProvidersResponseJSON `json:"-"` +type AccountGetResponse struct { + Account Account `json:"account"` + JSON accountGetResponseJSON `json:"-"` +} + +// accountGetResponseJSON contains the JSON metadata for the struct +// [AccountGetResponse] +type accountGetResponseJSON struct { + Account apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AccountGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r accountGetResponseJSON) RawJSON() string { + return r.raw +} + +type AccountDeleteResponse = interface{} + +type AccountGetSSOLoginURLResponse struct { + // login_url is the URL to redirect the user to for SSO login + LoginURL string `json:"loginUrl"` + JSON accountGetSSOLoginURLResponseJSON `json:"-"` } -// accountListLoginProvidersResponseJSON contains the JSON metadata for the struct -// [AccountListLoginProvidersResponse] -type accountListLoginProvidersResponseJSON struct { +// accountGetSSOLoginURLResponseJSON contains the JSON metadata for the struct +// [AccountGetSSOLoginURLResponse] +type accountGetSSOLoginURLResponseJSON struct { LoginURL apijson.Field - Provider apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *AccountListLoginProvidersResponse) UnmarshalJSON(data []byte) (err error) { +func (r *AccountGetSSOLoginURLResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r accountListLoginProvidersResponseJSON) RawJSON() string { +func (r accountGetSSOLoginURLResponseJSON) RawJSON() string { return r.raw } @@ -195,10 +455,10 @@ func (r AccountDeleteParams) MarshalJSON() (data []byte, err error) { } type AccountGetSSOLoginURLParams struct { - // return_to is the URL the user will be redirected to after login - ReturnTo param.Field[string] `json:"returnTo,required" format:"uri"` // email is the email the user wants to login with Email param.Field[string] `json:"email" format:"email"` + // return_to is the URL the user will be redirected to after login + ReturnTo param.Field[string] `json:"returnTo" format:"uri"` } func (r AccountGetSSOLoginURLParams) MarshalJSON() (data []byte, err error) { diff --git a/account_test.go b/account_test.go index 118bef7..0fe9ef4 100644 --- a/account_test.go +++ b/account_test.go @@ -77,8 +77,8 @@ func TestAccountGetSSOLoginURLWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Accounts.GetSSOLoginURL(context.TODO(), gitpod.AccountGetSSOLoginURLParams{ - ReturnTo: gitpod.F("https://example.com"), Email: gitpod.F("dev@stainlessapi.com"), + ReturnTo: gitpod.F("https://example.com"), }) if err != nil { var apierr *gitpod.Error diff --git a/aliases.go b/aliases.go index 8e662f5..3724f20 100644 --- a/aliases.go +++ b/aliases.go @@ -4,6 +4,146 @@ package gitpod import ( "github.com/gitpod-io/flex-sdk-go/internal/apierror" + "github.com/gitpod-io/flex-sdk-go/shared" ) type Error = apierror.Error + +// An AutomationTrigger represents a trigger for an automation action. The +// `post_environment_start` field indicates that the automation should be triggered +// after the environment has started. The `post_devcontainer_start` field indicates +// that the automation should be triggered after the dev container has started. +// +// This is an alias to an internal type. +type AutomationTrigger = shared.AutomationTrigger + +// An AutomationTrigger represents a trigger for an automation action. The +// `post_environment_start` field indicates that the automation should be triggered +// after the environment has started. The `post_devcontainer_start` field indicates +// that the automation should be triggered after the dev container has started. +// +// This is an alias to an internal type. +type AutomationTriggerParam = shared.AutomationTriggerParam + +// This is an alias to an internal type. +type EnvironmentClass = shared.EnvironmentClass + +// This is an alias to an internal type. +type EnvironmentClassParam = shared.EnvironmentClassParam + +// This is an alias to an internal type. +type FieldValue = shared.FieldValue + +// This is an alias to an internal type. +type FieldValueParam = shared.FieldValueParam + +// This is an alias to an internal type. +type OrganizationRole = shared.OrganizationRole + +// This is an alias to an internal value. +const OrganizationRoleOrganizationRoleUnspecified = shared.OrganizationRoleOrganizationRoleUnspecified + +// This is an alias to an internal value. +const OrganizationRoleOrganizationRoleAdmin = shared.OrganizationRoleOrganizationRoleAdmin + +// This is an alias to an internal value. +const OrganizationRoleOrganizationRoleMember = shared.OrganizationRoleOrganizationRoleMember + +// This is an alias to an internal type. +type Principal = shared.Principal + +// This is an alias to an internal value. +const PrincipalPrincipalUnspecified = shared.PrincipalPrincipalUnspecified + +// This is an alias to an internal value. +const PrincipalPrincipalAccount = shared.PrincipalPrincipalAccount + +// This is an alias to an internal value. +const PrincipalPrincipalUser = shared.PrincipalPrincipalUser + +// This is an alias to an internal value. +const PrincipalPrincipalRunner = shared.PrincipalPrincipalRunner + +// This is an alias to an internal value. +const PrincipalPrincipalEnvironment = shared.PrincipalPrincipalEnvironment + +// This is an alias to an internal value. +const PrincipalPrincipalServiceAccount = shared.PrincipalPrincipalServiceAccount + +// This is an alias to an internal type. +type RunsOn = shared.RunsOn + +// This is an alias to an internal type. +type RunsOnDocker = shared.RunsOnDocker + +// This is an alias to an internal type. +type RunsOnParam = shared.RunsOnParam + +// This is an alias to an internal type. +type RunsOnDockerParam = shared.RunsOnDockerParam + +// This is an alias to an internal type. +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 TaskExecution = shared.TaskExecution + +// This is an alias to an internal type. +type TaskExecutionMetadata = shared.TaskExecutionMetadata + +// This is an alias to an internal type. +type TaskExecutionPhase = shared.TaskExecutionPhase + +// This is an alias to an internal value. +const TaskExecutionPhaseTaskExecutionPhaseUnspecified = shared.TaskExecutionPhaseTaskExecutionPhaseUnspecified + +// This is an alias to an internal value. +const TaskExecutionPhaseTaskExecutionPhasePending = shared.TaskExecutionPhaseTaskExecutionPhasePending + +// This is an alias to an internal value. +const TaskExecutionPhaseTaskExecutionPhaseRunning = shared.TaskExecutionPhaseTaskExecutionPhaseRunning + +// This is an alias to an internal value. +const TaskExecutionPhaseTaskExecutionPhaseSucceeded = shared.TaskExecutionPhaseTaskExecutionPhaseSucceeded + +// This is an alias to an internal value. +const TaskExecutionPhaseTaskExecutionPhaseFailed = shared.TaskExecutionPhaseTaskExecutionPhaseFailed + +// This is an alias to an internal value. +const TaskExecutionPhaseTaskExecutionPhaseStopped = shared.TaskExecutionPhaseTaskExecutionPhaseStopped + +// This is an alias to an internal type. +type TaskExecutionSpec = shared.TaskExecutionSpec + +// This is an alias to an internal type. +type TaskExecutionSpecPlan = shared.TaskExecutionSpecPlan + +// This is an alias to an internal type. +type TaskExecutionSpecPlanStep = shared.TaskExecutionSpecPlanStep + +// This is an alias to an internal type. +type TaskExecutionSpecPlanStepsTask = shared.TaskExecutionSpecPlanStepsTask + +// This is an alias to an internal type. +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 UserStatus = shared.UserStatus + +// This is an alias to an internal value. +const UserStatusUserStatusUnspecified = shared.UserStatusUserStatusUnspecified + +// This is an alias to an internal value. +const UserStatusUserStatusActive = shared.UserStatusUserStatusActive + +// This is an alias to an internal value. +const UserStatusUserStatusSuspended = shared.UserStatusUserStatusSuspended + +// This is an alias to an internal value. +const UserStatusUserStatusLeft = shared.UserStatusUserStatusLeft diff --git a/api.md b/api.md index 8dc77ae..2df1faf 100644 --- a/api.md +++ b/api.md @@ -1,41 +1,84 @@ +# Shared Params Types + +- shared.AutomationTriggerParam +- shared.EnvironmentClassParam +- shared.FieldValueParam +- shared.OrganizationRole +- shared.Principal +- shared.RunsOnParam +- shared.SubjectParam +- shared.TaskExecutionPhase + +# Shared Response Types + +- shared.AutomationTrigger +- shared.EnvironmentClass +- shared.FieldValue +- shared.OrganizationRole +- shared.Principal +- shared.RunsOn +- shared.Subject +- shared.TaskExecution +- shared.TaskExecutionMetadata +- shared.TaskExecutionPhase +- shared.TaskExecutionSpec +- shared.TaskExecutionStatus +- shared.UserStatus + # Accounts Response Types: +- gitpod.Account +- gitpod.AccountMembership +- gitpod.JoinableOrganization +- gitpod.LoginProvider - gitpod.AccountGetResponse - gitpod.AccountDeleteResponse - gitpod.AccountGetSSOLoginURLResponse -- gitpod.AccountListLoginProvidersResponse Methods: - client.Accounts.Get(ctx context.Context, body gitpod.AccountGetParams) (gitpod.AccountGetResponse, error) - client.Accounts.Delete(ctx context.Context, body gitpod.AccountDeleteParams) (gitpod.AccountDeleteResponse, error) - client.Accounts.GetSSOLoginURL(ctx context.Context, body gitpod.AccountGetSSOLoginURLParams) (gitpod.AccountGetSSOLoginURLResponse, error) -- client.Accounts.ListLoginProviders(ctx context.Context, params gitpod.AccountListLoginProvidersParams) (pagination.LoginProvidersPage[gitpod.AccountListLoginProvidersResponse], error) +- client.Accounts.ListLoginProviders(ctx context.Context, params gitpod.AccountListLoginProvidersParams) (pagination.LoginProvidersPage[gitpod.LoginProvider], error) # Editors Response Types: +- gitpod.Editor - gitpod.EditorGetResponse -- gitpod.EditorListResponse - gitpod.EditorResolveURLResponse Methods: - client.Editors.Get(ctx context.Context, body gitpod.EditorGetParams) (gitpod.EditorGetResponse, error) -- client.Editors.List(ctx context.Context, params gitpod.EditorListParams) (pagination.EditorsPage[gitpod.EditorListResponse], error) +- client.Editors.List(ctx context.Context, params gitpod.EditorListParams) (pagination.EditorsPage[gitpod.Editor], error) - client.Editors.ResolveURL(ctx context.Context, body gitpod.EditorResolveURLParams) (gitpod.EditorResolveURLResponse, error) # Environments +Params Types: + +- gitpod.AdmissionLevel +- gitpod.EnvironmentActivitySignalParam +- gitpod.EnvironmentPhase +- gitpod.EnvironmentSpecParam + Response Types: +- gitpod.AdmissionLevel +- gitpod.Environment +- gitpod.EnvironmentActivitySignal +- gitpod.EnvironmentMetadata +- gitpod.EnvironmentPhase +- gitpod.EnvironmentSpec +- gitpod.EnvironmentStatus - gitpod.EnvironmentNewResponse - gitpod.EnvironmentGetResponse - gitpod.EnvironmentUpdateResponse -- gitpod.EnvironmentListResponse - gitpod.EnvironmentDeleteResponse - gitpod.EnvironmentNewFromProjectResponse - gitpod.EnvironmentNewLogsTokenResponse @@ -48,7 +91,7 @@ Methods: - client.Environments.New(ctx context.Context, body gitpod.EnvironmentNewParams) (gitpod.EnvironmentNewResponse, error) - client.Environments.Get(ctx context.Context, body gitpod.EnvironmentGetParams) (gitpod.EnvironmentGetResponse, error) - client.Environments.Update(ctx context.Context, body gitpod.EnvironmentUpdateParams) (gitpod.EnvironmentUpdateResponse, error) -- client.Environments.List(ctx context.Context, params gitpod.EnvironmentListParams) (pagination.EnvironmentsPage[gitpod.EnvironmentListResponse], error) +- client.Environments.List(ctx context.Context, params gitpod.EnvironmentListParams) (pagination.EnvironmentsPage[gitpod.Environment], error) - client.Environments.Delete(ctx context.Context, body gitpod.EnvironmentDeleteParams) (gitpod.EnvironmentDeleteResponse, error) - client.Environments.NewFromProject(ctx context.Context, body gitpod.EnvironmentNewFromProjectParams) (gitpod.EnvironmentNewFromProjectResponse, error) - client.Environments.NewLogsToken(ctx context.Context, body gitpod.EnvironmentNewLogsTokenParams) (gitpod.EnvironmentNewLogsTokenResponse, error) @@ -58,6 +101,10 @@ Methods: ## Automations +Params Types: + +- gitpod.AutomationsFileParam + Response Types: - gitpod.EnvironmentAutomationUpsertResponse @@ -68,12 +115,22 @@ Methods: ### Services +Params Types: + +- gitpod.ServiceMetadataParam +- gitpod.ServicePhase +- gitpod.ServiceSpecParam + Response Types: +- gitpod.Service +- gitpod.ServiceMetadata +- gitpod.ServicePhase +- gitpod.ServiceSpec +- gitpod.ServiceStatus - gitpod.EnvironmentAutomationServiceNewResponse - gitpod.EnvironmentAutomationServiceGetResponse - gitpod.EnvironmentAutomationServiceUpdateResponse -- gitpod.EnvironmentAutomationServiceListResponse - gitpod.EnvironmentAutomationServiceDeleteResponse - gitpod.EnvironmentAutomationServiceStartResponse - gitpod.EnvironmentAutomationServiceStopResponse @@ -83,19 +140,26 @@ Methods: - client.Environments.Automations.Services.New(ctx context.Context, body gitpod.EnvironmentAutomationServiceNewParams) (gitpod.EnvironmentAutomationServiceNewResponse, error) - client.Environments.Automations.Services.Get(ctx context.Context, body gitpod.EnvironmentAutomationServiceGetParams) (gitpod.EnvironmentAutomationServiceGetResponse, error) - client.Environments.Automations.Services.Update(ctx context.Context, body gitpod.EnvironmentAutomationServiceUpdateParams) (gitpod.EnvironmentAutomationServiceUpdateResponse, error) -- client.Environments.Automations.Services.List(ctx context.Context, params gitpod.EnvironmentAutomationServiceListParams) (pagination.ServicesPage[gitpod.EnvironmentAutomationServiceListResponse], error) +- client.Environments.Automations.Services.List(ctx context.Context, params gitpod.EnvironmentAutomationServiceListParams) (pagination.ServicesPage[gitpod.Service], error) - client.Environments.Automations.Services.Delete(ctx context.Context, body gitpod.EnvironmentAutomationServiceDeleteParams) (gitpod.EnvironmentAutomationServiceDeleteResponse, error) - client.Environments.Automations.Services.Start(ctx context.Context, body gitpod.EnvironmentAutomationServiceStartParams) (gitpod.EnvironmentAutomationServiceStartResponse, error) - client.Environments.Automations.Services.Stop(ctx context.Context, body gitpod.EnvironmentAutomationServiceStopParams) (gitpod.EnvironmentAutomationServiceStopResponse, error) ### Tasks +Params Types: + +- gitpod.TaskMetadataParam +- gitpod.TaskSpecParam + Response Types: +- gitpod.Task +- gitpod.TaskMetadata +- gitpod.TaskSpec - gitpod.EnvironmentAutomationTaskNewResponse - gitpod.EnvironmentAutomationTaskGetResponse - gitpod.EnvironmentAutomationTaskUpdateResponse -- gitpod.EnvironmentAutomationTaskListResponse - gitpod.EnvironmentAutomationTaskDeleteResponse - gitpod.EnvironmentAutomationTaskStartResponse @@ -104,7 +168,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.EnvironmentAutomationTaskListResponse], error) +- client.Environments.Automations.Tasks.List(ctx context.Context, params gitpod.EnvironmentAutomationTaskListParams) (pagination.TasksPage[gitpod.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) @@ -113,29 +177,30 @@ Methods: Response Types: - gitpod.EnvironmentAutomationTaskExecutionGetResponse -- gitpod.EnvironmentAutomationTaskExecutionListResponse - gitpod.EnvironmentAutomationTaskExecutionStopResponse Methods: - client.Environments.Automations.Tasks.Executions.Get(ctx context.Context, body gitpod.EnvironmentAutomationTaskExecutionGetParams) (gitpod.EnvironmentAutomationTaskExecutionGetResponse, error) -- client.Environments.Automations.Tasks.Executions.List(ctx context.Context, params gitpod.EnvironmentAutomationTaskExecutionListParams) (pagination.TaskExecutionsPage[gitpod.EnvironmentAutomationTaskExecutionListResponse], error) +- client.Environments.Automations.Tasks.Executions.List(ctx context.Context, params gitpod.EnvironmentAutomationTaskExecutionListParams) (pagination.TaskExecutionsPage[shared.TaskExecution], error) - client.Environments.Automations.Tasks.Executions.Stop(ctx context.Context, body gitpod.EnvironmentAutomationTaskExecutionStopParams) (gitpod.EnvironmentAutomationTaskExecutionStopResponse, error) ## Classes -Response Types: - -- gitpod.EnvironmentClassListResponse - Methods: -- client.Environments.Classes.List(ctx context.Context, params gitpod.EnvironmentClassListParams) (pagination.EnvironmentClassesPage[gitpod.EnvironmentClassListResponse], error) +- client.Environments.Classes.List(ctx context.Context, params gitpod.EnvironmentClassListParams) (pagination.EnvironmentClassesPage[shared.EnvironmentClass], error) # Events +Params Types: + +- gitpod.ResourceType + Response Types: +- gitpod.ResourceOperation +- gitpod.ResourceType - gitpod.EventListResponse - gitpod.EventWatchResponse @@ -148,11 +213,11 @@ Methods: Response Types: -- gitpod.GroupListResponse +- gitpod.Group Methods: -- client.Groups.List(ctx context.Context, params gitpod.GroupListParams) (pagination.GroupsPage[gitpod.GroupListResponse], error) +- client.Groups.List(ctx context.Context, params gitpod.GroupListParams) (pagination.GroupsPage[gitpod.Group], error) # Identity @@ -170,16 +235,22 @@ Methods: # Organizations +Params Types: + +- gitpod.InviteDomainsParam +- gitpod.Scope + Response Types: +- gitpod.InviteDomains +- gitpod.Organization +- gitpod.OrganizationMember - gitpod.OrganizationNewResponse - gitpod.OrganizationGetResponse - gitpod.OrganizationUpdateResponse -- gitpod.OrganizationListResponse - gitpod.OrganizationDeleteResponse - gitpod.OrganizationJoinResponse - gitpod.OrganizationLeaveResponse -- gitpod.OrganizationListMembersResponse - gitpod.OrganizationSetRoleResponse Methods: @@ -187,17 +258,18 @@ Methods: - client.Organizations.New(ctx context.Context, body gitpod.OrganizationNewParams) (gitpod.OrganizationNewResponse, error) - client.Organizations.Get(ctx context.Context, body gitpod.OrganizationGetParams) (gitpod.OrganizationGetResponse, error) - client.Organizations.Update(ctx context.Context, body gitpod.OrganizationUpdateParams) (gitpod.OrganizationUpdateResponse, error) -- client.Organizations.List(ctx context.Context, params gitpod.OrganizationListParams) (pagination.OrganizationsPage[gitpod.OrganizationListResponse], error) +- client.Organizations.List(ctx context.Context, params gitpod.OrganizationListParams) (pagination.OrganizationsPage[gitpod.Organization], error) - client.Organizations.Delete(ctx context.Context, body gitpod.OrganizationDeleteParams) (gitpod.OrganizationDeleteResponse, error) - client.Organizations.Join(ctx context.Context, body gitpod.OrganizationJoinParams) (gitpod.OrganizationJoinResponse, error) - client.Organizations.Leave(ctx context.Context, body gitpod.OrganizationLeaveParams) (gitpod.OrganizationLeaveResponse, error) -- client.Organizations.ListMembers(ctx context.Context, params gitpod.OrganizationListMembersParams) (pagination.MembersPage[gitpod.OrganizationListMembersResponse], error) +- 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) ## Invites Response Types: +- gitpod.OrganizationInvite - gitpod.OrganizationInviteNewResponse - gitpod.OrganizationInviteGetResponse - gitpod.OrganizationInviteGetSummaryResponse @@ -210,12 +282,18 @@ Methods: ## SSOConfigurations +Params Types: + +- gitpod.SSOConfigurationState + Response Types: +- gitpod.ProviderType +- gitpod.SSOConfiguration +- gitpod.SSOConfigurationState - gitpod.OrganizationSSOConfigurationNewResponse - gitpod.OrganizationSSOConfigurationGetResponse - gitpod.OrganizationSSOConfigurationUpdateResponse -- gitpod.OrganizationSSOConfigurationListResponse - gitpod.OrganizationSSOConfigurationDeleteResponse Methods: @@ -223,17 +301,25 @@ Methods: - client.Organizations.SSOConfigurations.New(ctx context.Context, body gitpod.OrganizationSSOConfigurationNewParams) (gitpod.OrganizationSSOConfigurationNewResponse, error) - client.Organizations.SSOConfigurations.Get(ctx context.Context, body gitpod.OrganizationSSOConfigurationGetParams) (gitpod.OrganizationSSOConfigurationGetResponse, error) - client.Organizations.SSOConfigurations.Update(ctx context.Context, body gitpod.OrganizationSSOConfigurationUpdateParams) (gitpod.OrganizationSSOConfigurationUpdateResponse, error) -- client.Organizations.SSOConfigurations.List(ctx context.Context, params gitpod.OrganizationSSOConfigurationListParams) (pagination.SSOConfigurationsPage[gitpod.OrganizationSSOConfigurationListResponse], error) +- client.Organizations.SSOConfigurations.List(ctx context.Context, params gitpod.OrganizationSSOConfigurationListParams) (pagination.SSOConfigurationsPage[gitpod.SSOConfiguration], error) - client.Organizations.SSOConfigurations.Delete(ctx context.Context, body gitpod.OrganizationSSOConfigurationDeleteParams) (gitpod.OrganizationSSOConfigurationDeleteResponse, error) # Projects +Params Types: + +- gitpod.EnvironmentInitializerParam +- gitpod.ProjectEnvironmentClassParam + Response Types: +- gitpod.EnvironmentInitializer +- gitpod.Project +- gitpod.ProjectEnvironmentClass +- gitpod.ProjectMetadata - gitpod.ProjectNewResponse - gitpod.ProjectGetResponse - gitpod.ProjectUpdateResponse -- gitpod.ProjectListResponse - gitpod.ProjectDeleteResponse - gitpod.ProjectNewFromEnvironmentResponse @@ -242,34 +328,56 @@ Methods: - client.Projects.New(ctx context.Context, body gitpod.ProjectNewParams) (gitpod.ProjectNewResponse, error) - client.Projects.Get(ctx context.Context, body gitpod.ProjectGetParams) (gitpod.ProjectGetResponse, error) - client.Projects.Update(ctx context.Context, body gitpod.ProjectUpdateParams) (gitpod.ProjectUpdateResponse, error) -- client.Projects.List(ctx context.Context, params gitpod.ProjectListParams) (pagination.ProjectsPage[gitpod.ProjectListResponse], error) +- client.Projects.List(ctx context.Context, params gitpod.ProjectListParams) (pagination.ProjectsPage[gitpod.Project], error) - client.Projects.Delete(ctx context.Context, body gitpod.ProjectDeleteParams) (gitpod.ProjectDeleteResponse, error) - client.Projects.NewFromEnvironment(ctx context.Context, body gitpod.ProjectNewFromEnvironmentParams) (gitpod.ProjectNewFromEnvironmentResponse, error) ## Policies +Params Types: + +- gitpod.ProjectRole + Response Types: +- gitpod.ProjectPolicy +- gitpod.ProjectRole - gitpod.ProjectPolicyNewResponse - gitpod.ProjectPolicyUpdateResponse -- gitpod.ProjectPolicyListResponse - gitpod.ProjectPolicyDeleteResponse Methods: - client.Projects.Policies.New(ctx context.Context, body gitpod.ProjectPolicyNewParams) (gitpod.ProjectPolicyNewResponse, error) - client.Projects.Policies.Update(ctx context.Context, body gitpod.ProjectPolicyUpdateParams) (gitpod.ProjectPolicyUpdateResponse, error) -- client.Projects.Policies.List(ctx context.Context, params gitpod.ProjectPolicyListParams) (pagination.PoliciesPage[gitpod.ProjectPolicyListResponse], error) +- client.Projects.Policies.List(ctx context.Context, params gitpod.ProjectPolicyListParams) (pagination.PoliciesPage[gitpod.ProjectPolicy], error) - client.Projects.Policies.Delete(ctx context.Context, body gitpod.ProjectPolicyDeleteParams) (gitpod.ProjectPolicyDeleteResponse, error) # Runners +Params Types: + +- gitpod.RunnerConfigurationParam +- gitpod.RunnerKind +- gitpod.RunnerPhase +- gitpod.RunnerProvider +- gitpod.RunnerReleaseChannel +- gitpod.RunnerSpecParam + Response Types: +- gitpod.Runner +- gitpod.RunnerCapability +- gitpod.RunnerConfiguration +- gitpod.RunnerKind +- gitpod.RunnerPhase +- gitpod.RunnerProvider +- gitpod.RunnerReleaseChannel +- gitpod.RunnerSpec +- gitpod.RunnerStatus - gitpod.RunnerNewResponse - gitpod.RunnerGetResponse - gitpod.RunnerUpdateResponse -- gitpod.RunnerListResponse - gitpod.RunnerDeleteResponse - gitpod.RunnerCheckAuthenticationForHostResponse - gitpod.RunnerNewRunnerTokenResponse @@ -280,7 +388,7 @@ Methods: - client.Runners.New(ctx context.Context, body gitpod.RunnerNewParams) (gitpod.RunnerNewResponse, error) - client.Runners.Get(ctx context.Context, body gitpod.RunnerGetParams) (gitpod.RunnerGetResponse, error) - client.Runners.Update(ctx context.Context, body gitpod.RunnerUpdateParams) (gitpod.RunnerUpdateResponse, error) -- client.Runners.List(ctx context.Context, params gitpod.RunnerListParams) (pagination.RunnersPage[gitpod.RunnerListResponse], error) +- client.Runners.List(ctx context.Context, params gitpod.RunnerListParams) (pagination.RunnersPage[gitpod.Runner], error) - client.Runners.Delete(ctx context.Context, body gitpod.RunnerDeleteParams) (gitpod.RunnerDeleteResponse, error) - client.Runners.CheckAuthenticationForHost(ctx context.Context, body gitpod.RunnerCheckAuthenticationForHostParams) (gitpod.RunnerCheckAuthenticationForHostResponse, error) - client.Runners.NewRunnerToken(ctx context.Context, body gitpod.RunnerNewRunnerTokenParams) (gitpod.RunnerNewRunnerTokenResponse, error) @@ -290,6 +398,9 @@ Methods: Response Types: +- gitpod.EnvironmentClassValidationResult +- gitpod.FieldValidationError +- gitpod.ScmIntegrationValidationResult - gitpod.RunnerConfigurationValidateResponse Methods: @@ -303,23 +414,27 @@ Response Types: - gitpod.RunnerConfigurationEnvironmentClassNewResponse - gitpod.RunnerConfigurationEnvironmentClassGetResponse - gitpod.RunnerConfigurationEnvironmentClassUpdateResponse -- gitpod.RunnerConfigurationEnvironmentClassListResponse Methods: - client.Runners.Configurations.EnvironmentClasses.New(ctx context.Context, body gitpod.RunnerConfigurationEnvironmentClassNewParams) (gitpod.RunnerConfigurationEnvironmentClassNewResponse, error) - client.Runners.Configurations.EnvironmentClasses.Get(ctx context.Context, body gitpod.RunnerConfigurationEnvironmentClassGetParams) (gitpod.RunnerConfigurationEnvironmentClassGetResponse, error) - client.Runners.Configurations.EnvironmentClasses.Update(ctx context.Context, body gitpod.RunnerConfigurationEnvironmentClassUpdateParams) (gitpod.RunnerConfigurationEnvironmentClassUpdateResponse, error) -- client.Runners.Configurations.EnvironmentClasses.List(ctx context.Context, params gitpod.RunnerConfigurationEnvironmentClassListParams) (pagination.EnvironmentClassesPage[gitpod.RunnerConfigurationEnvironmentClassListResponse], error) +- client.Runners.Configurations.EnvironmentClasses.List(ctx context.Context, params gitpod.RunnerConfigurationEnvironmentClassListParams) (pagination.EnvironmentClassesPage[shared.EnvironmentClass], error) ### HostAuthenticationTokens +Params Types: + +- gitpod.HostAuthenticationTokenSource + Response Types: +- gitpod.HostAuthenticationToken +- gitpod.HostAuthenticationTokenSource - gitpod.RunnerConfigurationHostAuthenticationTokenNewResponse - gitpod.RunnerConfigurationHostAuthenticationTokenGetResponse - gitpod.RunnerConfigurationHostAuthenticationTokenUpdateResponse -- gitpod.RunnerConfigurationHostAuthenticationTokenListResponse - gitpod.RunnerConfigurationHostAuthenticationTokenDeleteResponse Methods: @@ -327,13 +442,14 @@ Methods: - client.Runners.Configurations.HostAuthenticationTokens.New(ctx context.Context, body gitpod.RunnerConfigurationHostAuthenticationTokenNewParams) (gitpod.RunnerConfigurationHostAuthenticationTokenNewResponse, error) - client.Runners.Configurations.HostAuthenticationTokens.Get(ctx context.Context, body gitpod.RunnerConfigurationHostAuthenticationTokenGetParams) (gitpod.RunnerConfigurationHostAuthenticationTokenGetResponse, error) - client.Runners.Configurations.HostAuthenticationTokens.Update(ctx context.Context, body gitpod.RunnerConfigurationHostAuthenticationTokenUpdateParams) (gitpod.RunnerConfigurationHostAuthenticationTokenUpdateResponse, error) -- client.Runners.Configurations.HostAuthenticationTokens.List(ctx context.Context, params gitpod.RunnerConfigurationHostAuthenticationTokenListParams) (pagination.TokensPage[gitpod.RunnerConfigurationHostAuthenticationTokenListResponse], error) +- client.Runners.Configurations.HostAuthenticationTokens.List(ctx context.Context, params gitpod.RunnerConfigurationHostAuthenticationTokenListParams) (pagination.TokensPage[gitpod.HostAuthenticationToken], error) - client.Runners.Configurations.HostAuthenticationTokens.Delete(ctx context.Context, body gitpod.RunnerConfigurationHostAuthenticationTokenDeleteParams) (gitpod.RunnerConfigurationHostAuthenticationTokenDeleteResponse, error) ### Schema Response Types: +- gitpod.RunnerConfigurationSchema - gitpod.RunnerConfigurationSchemaGetResponse Methods: @@ -344,10 +460,11 @@ Methods: Response Types: +- gitpod.ScmIntegration +- gitpod.ScmIntegrationOAuthConfig - gitpod.RunnerConfigurationScmIntegrationNewResponse - gitpod.RunnerConfigurationScmIntegrationGetResponse - gitpod.RunnerConfigurationScmIntegrationUpdateResponse -- gitpod.RunnerConfigurationScmIntegrationListResponse - gitpod.RunnerConfigurationScmIntegrationDeleteResponse Methods: @@ -355,31 +472,36 @@ Methods: - client.Runners.Configurations.ScmIntegrations.New(ctx context.Context, body gitpod.RunnerConfigurationScmIntegrationNewParams) (gitpod.RunnerConfigurationScmIntegrationNewResponse, error) - client.Runners.Configurations.ScmIntegrations.Get(ctx context.Context, body gitpod.RunnerConfigurationScmIntegrationGetParams) (gitpod.RunnerConfigurationScmIntegrationGetResponse, error) - client.Runners.Configurations.ScmIntegrations.Update(ctx context.Context, body gitpod.RunnerConfigurationScmIntegrationUpdateParams) (gitpod.RunnerConfigurationScmIntegrationUpdateResponse, error) -- client.Runners.Configurations.ScmIntegrations.List(ctx context.Context, params gitpod.RunnerConfigurationScmIntegrationListParams) (pagination.IntegrationsPage[gitpod.RunnerConfigurationScmIntegrationListResponse], error) +- client.Runners.Configurations.ScmIntegrations.List(ctx context.Context, params gitpod.RunnerConfigurationScmIntegrationListParams) (pagination.IntegrationsPage[gitpod.ScmIntegration], error) - client.Runners.Configurations.ScmIntegrations.Delete(ctx context.Context, body gitpod.RunnerConfigurationScmIntegrationDeleteParams) (gitpod.RunnerConfigurationScmIntegrationDeleteResponse, error) ## Policies +Params Types: + +- gitpod.RunnerRole + Response Types: +- gitpod.RunnerPolicy +- gitpod.RunnerRole - gitpod.RunnerPolicyNewResponse - gitpod.RunnerPolicyUpdateResponse -- gitpod.RunnerPolicyListResponse - gitpod.RunnerPolicyDeleteResponse Methods: - client.Runners.Policies.New(ctx context.Context, body gitpod.RunnerPolicyNewParams) (gitpod.RunnerPolicyNewResponse, error) - client.Runners.Policies.Update(ctx context.Context, body gitpod.RunnerPolicyUpdateParams) (gitpod.RunnerPolicyUpdateResponse, error) -- client.Runners.Policies.List(ctx context.Context, params gitpod.RunnerPolicyListParams) (pagination.PoliciesPage[gitpod.RunnerPolicyListResponse], error) +- client.Runners.Policies.List(ctx context.Context, params gitpod.RunnerPolicyListParams) (pagination.PoliciesPage[gitpod.RunnerPolicy], error) - client.Runners.Policies.Delete(ctx context.Context, body gitpod.RunnerPolicyDeleteParams) (gitpod.RunnerPolicyDeleteResponse, error) # Secrets Response Types: +- gitpod.Secret - gitpod.SecretNewResponse -- gitpod.SecretListResponse - gitpod.SecretDeleteResponse - gitpod.SecretGetValueResponse - gitpod.SecretUpdateValueResponse @@ -387,7 +509,7 @@ Response Types: Methods: - client.Secrets.New(ctx context.Context, body gitpod.SecretNewParams) (gitpod.SecretNewResponse, error) -- client.Secrets.List(ctx context.Context, params gitpod.SecretListParams) (pagination.SecretsPage[gitpod.SecretListResponse], error) +- client.Secrets.List(ctx context.Context, params gitpod.SecretListParams) (pagination.SecretsPage[gitpod.Secret], error) - client.Secrets.Delete(ctx context.Context, body gitpod.SecretDeleteParams) (gitpod.SecretDeleteResponse, error) - client.Secrets.GetValue(ctx context.Context, body gitpod.SecretGetValueParams) (gitpod.SecretGetValueResponse, error) - client.Secrets.UpdateValue(ctx context.Context, body gitpod.SecretUpdateValueParams) (gitpod.SecretUpdateValueResponse, error) @@ -396,6 +518,7 @@ Methods: Response Types: +- gitpod.User - gitpod.UserGetAuthenticatedUserResponse - gitpod.UserSetSuspendedResponse @@ -408,12 +531,12 @@ Methods: Response Types: -- gitpod.UserPatListResponse +- gitpod.PersonalAccessToken - gitpod.UserPatDeleteResponse - gitpod.UserPatGetResponse Methods: -- client.Users.Pats.List(ctx context.Context, params gitpod.UserPatListParams) (pagination.PersonalAccessTokensPage[gitpod.UserPatListResponse], error) +- client.Users.Pats.List(ctx context.Context, params gitpod.UserPatListParams) (pagination.PersonalAccessTokensPage[gitpod.PersonalAccessToken], error) - client.Users.Pats.Delete(ctx context.Context, body gitpod.UserPatDeleteParams) (gitpod.UserPatDeleteResponse, error) - client.Users.Pats.Get(ctx context.Context, body gitpod.UserPatGetParams) (gitpod.UserPatGetResponse, error) diff --git a/editor.go b/editor.go index d80fc67..7f64916 100644 --- a/editor.go +++ b/editor.go @@ -43,7 +43,7 @@ func (r *EditorService) Get(ctx context.Context, body EditorGetParams, opts ...o } // ListEditors lists all editors available to the caller -func (r *EditorService) List(ctx context.Context, params EditorListParams, opts ...option.RequestOption) (res *pagination.EditorsPage[EditorListResponse], err error) { +func (r *EditorService) List(ctx context.Context, params EditorListParams, opts ...option.RequestOption) (res *pagination.EditorsPage[Editor], err error) { var raw *http.Response opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -61,7 +61,7 @@ func (r *EditorService) List(ctx context.Context, params EditorListParams, opts } // ListEditors lists all editors available to the caller -func (r *EditorService) ListAutoPaging(ctx context.Context, params EditorListParams, opts ...option.RequestOption) *pagination.EditorsPageAutoPager[EditorListResponse] { +func (r *EditorService) ListAutoPaging(ctx context.Context, params EditorListParams, opts ...option.RequestOption) *pagination.EditorsPageAutoPager[Editor] { return pagination.NewEditorsPageAutoPager(r.List(ctx, params, opts...)) } @@ -73,43 +73,19 @@ func (r *EditorService) ResolveURL(ctx context.Context, body EditorResolveURLPar return } -type EditorGetResponse struct { - // editor contains the editor - Editor EditorGetResponseEditor `json:"editor"` - JSON editorGetResponseJSON `json:"-"` -} - -// editorGetResponseJSON contains the JSON metadata for the struct -// [EditorGetResponse] -type editorGetResponseJSON struct { - Editor apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EditorGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r editorGetResponseJSON) RawJSON() string { - return r.raw -} - -// editor contains the editor -type EditorGetResponseEditor 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"` - JSON editorGetResponseEditorJSON `json:"-"` +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"` + JSON editorJSON `json:"-"` } -// editorGetResponseEditorJSON contains the JSON metadata for the struct -// [EditorGetResponseEditor] -type editorGetResponseEditorJSON struct { +// editorJSON contains the JSON metadata for the struct [Editor] +type editorJSON struct { ID apijson.Field Alias apijson.Field IconURL apijson.Field @@ -121,44 +97,33 @@ type editorGetResponseEditorJSON struct { ExtraFields map[string]apijson.Field } -func (r *EditorGetResponseEditor) UnmarshalJSON(data []byte) (err error) { +func (r *Editor) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r editorGetResponseEditorJSON) RawJSON() string { +func (r editorJSON) RawJSON() string { return r.raw } -type EditorListResponse 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"` - JSON editorListResponseJSON `json:"-"` +type EditorGetResponse struct { + // editor contains the editor + Editor Editor `json:"editor"` + JSON editorGetResponseJSON `json:"-"` } -// editorListResponseJSON contains the JSON metadata for the struct -// [EditorListResponse] -type editorListResponseJSON struct { - ID apijson.Field - Alias apijson.Field - IconURL apijson.Field - InstallationInstructions apijson.Field - Name apijson.Field - ShortDescription apijson.Field - URLTemplate apijson.Field - raw string - ExtraFields map[string]apijson.Field +// editorGetResponseJSON contains the JSON metadata for the struct +// [EditorGetResponse] +type editorGetResponseJSON struct { + Editor apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *EditorListResponse) UnmarshalJSON(data []byte) (err error) { +func (r *EditorGetResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r editorListResponseJSON) RawJSON() string { +func (r editorGetResponseJSON) RawJSON() string { return r.raw } diff --git a/environment.go b/environment.go index 9ba3152..9a8fbe1 100644 --- a/environment.go +++ b/environment.go @@ -6,7 +6,6 @@ import ( "context" "net/http" "net/url" - "reflect" "time" "github.com/gitpod-io/flex-sdk-go/internal/apijson" @@ -15,7 +14,7 @@ import ( "github.com/gitpod-io/flex-sdk-go/internal/requestconfig" "github.com/gitpod-io/flex-sdk-go/option" "github.com/gitpod-io/flex-sdk-go/packages/pagination" - "github.com/tidwall/gjson" + "github.com/gitpod-io/flex-sdk-go/shared" ) // EnvironmentService contains methods and other services that help with @@ -42,6 +41,44 @@ func NewEnvironmentService(opts ...option.RequestOption) (r *EnvironmentService) } // CreateEnvironment creates a new environment 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: +// +// Creates an environment from a context URL, e.g. a GitHub repository. +// +// ```yaml +// spec: +// machine: +// class: "61000000-0000-0000-0000-000000000000" +// content: +// initializer: +// specs: +// - contextUrl: +// url: "https://github.com/gitpod-io/gitpod" +// ``` +// +// - 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. +// +// ```yaml +// spec: +// machine: +// class: "61000000-0000-0000-0000-000000000000" +// content: +// initializer: +// specs: +// - git: +// remoteUri: "https://github.com/gitpod-io/gitpod" +// cloneTarget: "main" +// targetMode: "CLONE_TARGET_MODE_REMOTE_BRANCH" +// ``` 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" @@ -50,9 +87,6 @@ func (r *EnvironmentService) New(ctx context.Context, body EnvironmentNewParams, } // GetEnvironment returns a single environment. -// -// +return NOT_FOUND User does not have access to an environment with the given ID -// +return NOT_FOUND Environment does not exist 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" @@ -69,7 +103,7 @@ func (r *EnvironmentService) Update(ctx context.Context, body EnvironmentUpdateP } // ListEnvironments returns a list of environments that match the query. -func (r *EnvironmentService) List(ctx context.Context, params EnvironmentListParams, opts ...option.RequestOption) (res *pagination.EnvironmentsPage[EnvironmentListResponse], err error) { +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...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -87,7 +121,7 @@ func (r *EnvironmentService) List(ctx context.Context, params EnvironmentListPar } // ListEnvironments returns a list of environments that match the query. -func (r *EnvironmentService) ListAutoPaging(ctx context.Context, params EnvironmentListParams, opts ...option.RequestOption) *pagination.EnvironmentsPageAutoPager[EnvironmentListResponse] { +func (r *EnvironmentService) ListAutoPaging(ctx context.Context, params EnvironmentListParams, opts ...option.RequestOption) *pagination.EnvironmentsPageAutoPager[Environment] { return pagination.NewEnvironmentsPageAutoPager(r.List(ctx, params, opts...)) } @@ -143,47 +177,41 @@ func (r *EnvironmentService) Stop(ctx context.Context, body EnvironmentStopParam return } -type EnvironmentNewResponse struct { - // +resource get environment - Environment EnvironmentNewResponseEnvironment `json:"environment"` - JSON environmentNewResponseJSON `json:"-"` -} - -// environmentNewResponseJSON contains the JSON metadata for the struct -// [EnvironmentNewResponse] -type environmentNewResponseJSON struct { - Environment apijson.Field - raw string - ExtraFields map[string]apijson.Field -} +// Admission level describes who can access an environment instance and its ports. +type AdmissionLevel string -func (r *EnvironmentNewResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} +const ( + AdmissionLevelAdmissionLevelUnspecified AdmissionLevel = "ADMISSION_LEVEL_UNSPECIFIED" + AdmissionLevelAdmissionLevelOwnerOnly AdmissionLevel = "ADMISSION_LEVEL_OWNER_ONLY" + AdmissionLevelAdmissionLevelEveryone AdmissionLevel = "ADMISSION_LEVEL_EVERYONE" +) -func (r environmentNewResponseJSON) RawJSON() string { - return r.raw +func (r AdmissionLevel) IsKnown() bool { + switch r { + case AdmissionLevelAdmissionLevelUnspecified, AdmissionLevelAdmissionLevelOwnerOnly, AdmissionLevelAdmissionLevelEveryone: + return true + } + return false } // +resource get environment -type EnvironmentNewResponseEnvironment struct { +type Environment struct { // ID is a unique identifier of this environment. No other environment with the // same name must be managed by this environment manager ID string `json:"id"` // EnvironmentMetadata is data associated with an environment that's required for // other parts of the system to function - Metadata EnvironmentNewResponseEnvironmentMetadata `json:"metadata"` + Metadata EnvironmentMetadata `json:"metadata"` // EnvironmentSpec specifies the configuration of an environment for an environment // start - Spec EnvironmentNewResponseEnvironmentSpec `json:"spec"` + Spec EnvironmentSpec `json:"spec"` // EnvironmentStatus describes an environment status - Status EnvironmentNewResponseEnvironmentStatus `json:"status"` - JSON environmentNewResponseEnvironmentJSON `json:"-"` + Status EnvironmentStatus `json:"status"` + JSON environmentJSON `json:"-"` } -// environmentNewResponseEnvironmentJSON contains the JSON metadata for the struct -// [EnvironmentNewResponseEnvironment] -type environmentNewResponseEnvironmentJSON struct { +// environmentJSON contains the JSON metadata for the struct [Environment] +type environmentJSON struct { ID apijson.Field Metadata apijson.Field Spec apijson.Field @@ -192,17 +220,233 @@ type environmentNewResponseEnvironmentJSON struct { ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironment) UnmarshalJSON(data []byte) (err error) { +func (r *Environment) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r environmentJSON) RawJSON() string { + return r.raw +} + +// EnvironmentActivitySignal used to signal activity for an environment. +type EnvironmentActivitySignal struct { + // source of the activity signal, such as "VS Code", "SSH", or "Automations". It + // should be a human-readable string that describes the source of the activity + // signal. + Source string `json:"source"` + // 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. + Timestamp time.Time `json:"timestamp" format:"date-time"` + JSON environmentActivitySignalJSON `json:"-"` +} + +// environmentActivitySignalJSON contains the JSON metadata for the struct +// [EnvironmentActivitySignal] +type environmentActivitySignalJSON struct { + Source apijson.Field + Timestamp apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *EnvironmentActivitySignal) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentJSON) RawJSON() string { +func (r environmentActivitySignalJSON) RawJSON() string { return r.raw } +// EnvironmentActivitySignal used to signal activity for an environment. +type EnvironmentActivitySignalParam struct { + // source of the activity signal, such as "VS Code", "SSH", or "Automations". It + // should be a human-readable string that describes the source of the activity + // signal. + Source param.Field[string] `json:"source"` + // 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. + Timestamp param.Field[time.Time] `json:"timestamp" format:"date-time"` +} + +func (r EnvironmentActivitySignalParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + // EnvironmentMetadata is data associated with an environment that's required for // other parts of the system to function -type EnvironmentNewResponseEnvironmentMetadata struct { +type EnvironmentMetadata struct { // annotations are key/value pairs that gets attached to the environment. // +internal - not yet implemented Annotations map[string]string `json:"annotations"` @@ -296,7 +540,7 @@ type EnvironmentNewResponseEnvironmentMetadata struct { // to obtain a formatter capable of generating timestamps in this format. CreatedAt time.Time `json:"createdAt" format:"date-time"` // creator is the identity of the creator of the environment - Creator EnvironmentNewResponseEnvironmentMetadataCreator `json:"creator"` + Creator shared.Subject `json:"creator"` // 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, @@ -397,13 +641,13 @@ type EnvironmentNewResponseEnvironmentMetadata struct { // project. ProjectID string `json:"projectId"` // Runner is the ID of the runner that runs this environment. - RunnerID string `json:"runnerId"` - JSON environmentNewResponseEnvironmentMetadataJSON `json:"-"` + RunnerID string `json:"runnerId"` + JSON environmentMetadataJSON `json:"-"` } -// environmentNewResponseEnvironmentMetadataJSON contains the JSON metadata for the -// struct [EnvironmentNewResponseEnvironmentMetadata] -type environmentNewResponseEnvironmentMetadataJSON struct { +// environmentMetadataJSON contains the JSON metadata for the struct +// [EnvironmentMetadata] +type environmentMetadataJSON struct { Annotations apijson.Field CreatedAt apijson.Field Creator apijson.Field @@ -417,55 +661,31 @@ type environmentNewResponseEnvironmentMetadataJSON struct { ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironmentMetadata) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewResponseEnvironmentMetadataJSON) RawJSON() string { - return r.raw -} - -// creator is the identity of the creator of the environment -type EnvironmentNewResponseEnvironmentMetadataCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal EnvironmentNewResponseEnvironmentMetadataCreatorPrincipal `json:"principal"` - JSON environmentNewResponseEnvironmentMetadataCreatorJSON `json:"-"` -} - -// environmentNewResponseEnvironmentMetadataCreatorJSON contains the JSON metadata -// for the struct [EnvironmentNewResponseEnvironmentMetadataCreator] -type environmentNewResponseEnvironmentMetadataCreatorJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewResponseEnvironmentMetadataCreator) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentMetadata) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentMetadataCreatorJSON) RawJSON() string { +func (r environmentMetadataJSON) RawJSON() string { return r.raw } -// Principal is the principal of the subject -type EnvironmentNewResponseEnvironmentMetadataCreatorPrincipal string +type EnvironmentPhase string const ( - EnvironmentNewResponseEnvironmentMetadataCreatorPrincipalPrincipalUnspecified EnvironmentNewResponseEnvironmentMetadataCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - EnvironmentNewResponseEnvironmentMetadataCreatorPrincipalPrincipalAccount EnvironmentNewResponseEnvironmentMetadataCreatorPrincipal = "PRINCIPAL_ACCOUNT" - EnvironmentNewResponseEnvironmentMetadataCreatorPrincipalPrincipalUser EnvironmentNewResponseEnvironmentMetadataCreatorPrincipal = "PRINCIPAL_USER" - EnvironmentNewResponseEnvironmentMetadataCreatorPrincipalPrincipalRunner EnvironmentNewResponseEnvironmentMetadataCreatorPrincipal = "PRINCIPAL_RUNNER" - EnvironmentNewResponseEnvironmentMetadataCreatorPrincipalPrincipalEnvironment EnvironmentNewResponseEnvironmentMetadataCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - EnvironmentNewResponseEnvironmentMetadataCreatorPrincipalPrincipalServiceAccount EnvironmentNewResponseEnvironmentMetadataCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" + EnvironmentPhaseEnvironmentPhaseUnspecified EnvironmentPhase = "ENVIRONMENT_PHASE_UNSPECIFIED" + EnvironmentPhaseEnvironmentPhaseCreating EnvironmentPhase = "ENVIRONMENT_PHASE_CREATING" + EnvironmentPhaseEnvironmentPhaseStarting EnvironmentPhase = "ENVIRONMENT_PHASE_STARTING" + EnvironmentPhaseEnvironmentPhaseRunning EnvironmentPhase = "ENVIRONMENT_PHASE_RUNNING" + EnvironmentPhaseEnvironmentPhaseUpdating EnvironmentPhase = "ENVIRONMENT_PHASE_UPDATING" + EnvironmentPhaseEnvironmentPhaseStopping EnvironmentPhase = "ENVIRONMENT_PHASE_STOPPING" + EnvironmentPhaseEnvironmentPhaseStopped EnvironmentPhase = "ENVIRONMENT_PHASE_STOPPED" + EnvironmentPhaseEnvironmentPhaseDeleting EnvironmentPhase = "ENVIRONMENT_PHASE_DELETING" + EnvironmentPhaseEnvironmentPhaseDeleted EnvironmentPhase = "ENVIRONMENT_PHASE_DELETED" ) -func (r EnvironmentNewResponseEnvironmentMetadataCreatorPrincipal) IsKnown() bool { +func (r EnvironmentPhase) IsKnown() bool { switch r { - case EnvironmentNewResponseEnvironmentMetadataCreatorPrincipalPrincipalUnspecified, EnvironmentNewResponseEnvironmentMetadataCreatorPrincipalPrincipalAccount, EnvironmentNewResponseEnvironmentMetadataCreatorPrincipalPrincipalUser, EnvironmentNewResponseEnvironmentMetadataCreatorPrincipalPrincipalRunner, EnvironmentNewResponseEnvironmentMetadataCreatorPrincipalPrincipalEnvironment, EnvironmentNewResponseEnvironmentMetadataCreatorPrincipalPrincipalServiceAccount: + case EnvironmentPhaseEnvironmentPhaseUnspecified, EnvironmentPhaseEnvironmentPhaseCreating, EnvironmentPhaseEnvironmentPhaseStarting, EnvironmentPhaseEnvironmentPhaseRunning, EnvironmentPhaseEnvironmentPhaseUpdating, EnvironmentPhaseEnvironmentPhaseStopping, EnvironmentPhaseEnvironmentPhaseStopped, EnvironmentPhaseEnvironmentPhaseDeleting, EnvironmentPhaseEnvironmentPhaseDeleted: return true } return false @@ -473,37 +693,36 @@ func (r EnvironmentNewResponseEnvironmentMetadataCreatorPrincipal) IsKnown() boo // EnvironmentSpec specifies the configuration of an environment for an environment // start -type EnvironmentNewResponseEnvironmentSpec struct { +type EnvironmentSpec struct { // Admission level describes who can access an environment instance and its ports. - Admission EnvironmentNewResponseEnvironmentSpecAdmission `json:"admission"` + Admission AdmissionLevel `json:"admission"` // automations_file is the automations file spec of the environment - AutomationsFile EnvironmentNewResponseEnvironmentSpecAutomationsFile `json:"automationsFile"` + AutomationsFile EnvironmentSpecAutomationsFile `json:"automationsFile"` // content is the content spec of the environment - Content EnvironmentNewResponseEnvironmentSpecContent `json:"content"` + Content EnvironmentSpecContent `json:"content"` // Phase is the desired phase of the environment - DesiredPhase EnvironmentNewResponseEnvironmentSpecDesiredPhase `json:"desiredPhase"` + DesiredPhase EnvironmentPhase `json:"desiredPhase"` // devcontainer is the devcontainer spec of the environment - Devcontainer EnvironmentNewResponseEnvironmentSpecDevcontainer `json:"devcontainer"` + Devcontainer EnvironmentSpecDevcontainer `json:"devcontainer"` // machine is the machine spec of the environment - Machine EnvironmentNewResponseEnvironmentSpecMachine `json:"machine"` + Machine EnvironmentSpecMachine `json:"machine"` // ports is the set of ports which ought to be exposed to the internet - Ports []EnvironmentNewResponseEnvironmentSpecPort `json:"ports"` + Ports []EnvironmentSpecPort `json:"ports"` // secrets are confidential data that is mounted into the environment - Secrets []EnvironmentNewResponseEnvironmentSpecSecret `json:"secrets"` + Secrets []EnvironmentSpecSecret `json:"secrets"` // version of the spec. The value of this field has no semantic meaning (e.g. don't // interpret it as as a timestamp), but it can be used to impose a partial order. // If a.spec_version < b.spec_version then a was the spec before b. SpecVersion string `json:"specVersion"` // ssh_public_keys are the public keys used to ssh into the environment - SSHPublicKeys []EnvironmentNewResponseEnvironmentSpecSSHPublicKey `json:"sshPublicKeys"` + SSHPublicKeys []EnvironmentSpecSSHPublicKey `json:"sshPublicKeys"` // Timeout configures the environment timeout - Timeout EnvironmentNewResponseEnvironmentSpecTimeout `json:"timeout"` - JSON environmentNewResponseEnvironmentSpecJSON `json:"-"` + Timeout EnvironmentSpecTimeout `json:"timeout"` + JSON environmentSpecJSON `json:"-"` } -// environmentNewResponseEnvironmentSpecJSON contains the JSON metadata for the -// struct [EnvironmentNewResponseEnvironmentSpec] -type environmentNewResponseEnvironmentSpecJSON struct { +// environmentSpecJSON contains the JSON metadata for the struct [EnvironmentSpec] +type environmentSpecJSON struct { Admission apijson.Field AutomationsFile apijson.Field Content apijson.Field @@ -519,33 +738,16 @@ type environmentNewResponseEnvironmentSpecJSON struct { ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironmentSpec) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentSpec) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentSpecJSON) RawJSON() string { +func (r environmentSpecJSON) RawJSON() string { return r.raw } -// Admission level describes who can access an environment instance and its ports. -type EnvironmentNewResponseEnvironmentSpecAdmission string - -const ( - EnvironmentNewResponseEnvironmentSpecAdmissionAdmissionLevelUnspecified EnvironmentNewResponseEnvironmentSpecAdmission = "ADMISSION_LEVEL_UNSPECIFIED" - EnvironmentNewResponseEnvironmentSpecAdmissionAdmissionLevelOwnerOnly EnvironmentNewResponseEnvironmentSpecAdmission = "ADMISSION_LEVEL_OWNER_ONLY" - EnvironmentNewResponseEnvironmentSpecAdmissionAdmissionLevelEveryone EnvironmentNewResponseEnvironmentSpecAdmission = "ADMISSION_LEVEL_EVERYONE" -) - -func (r EnvironmentNewResponseEnvironmentSpecAdmission) IsKnown() bool { - switch r { - case EnvironmentNewResponseEnvironmentSpecAdmissionAdmissionLevelUnspecified, EnvironmentNewResponseEnvironmentSpecAdmissionAdmissionLevelOwnerOnly, EnvironmentNewResponseEnvironmentSpecAdmissionAdmissionLevelEveryone: - return true - } - return false -} - // automations_file is the automations file spec of the environment -type EnvironmentNewResponseEnvironmentSpecAutomationsFile struct { +type EnvironmentSpecAutomationsFile struct { // automations_file_path is the path to the automations file that is applied in the // environment, relative to the repo root. path must not be absolute (start with a // /): @@ -553,43 +755,43 @@ type EnvironmentNewResponseEnvironmentSpecAutomationsFile struct { // ``` // this.matches('^$|^[^/].*') // ``` - AutomationsFilePath string `json:"automationsFilePath"` - Session string `json:"session"` - JSON environmentNewResponseEnvironmentSpecAutomationsFileJSON `json:"-"` + AutomationsFilePath string `json:"automationsFilePath"` + Session string `json:"session"` + JSON environmentSpecAutomationsFileJSON `json:"-"` } -// environmentNewResponseEnvironmentSpecAutomationsFileJSON contains the JSON -// metadata for the struct [EnvironmentNewResponseEnvironmentSpecAutomationsFile] -type environmentNewResponseEnvironmentSpecAutomationsFileJSON struct { +// environmentSpecAutomationsFileJSON contains the JSON metadata for the struct +// [EnvironmentSpecAutomationsFile] +type environmentSpecAutomationsFileJSON struct { AutomationsFilePath apijson.Field Session apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironmentSpecAutomationsFile) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentSpecAutomationsFile) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentSpecAutomationsFileJSON) RawJSON() string { +func (r environmentSpecAutomationsFileJSON) RawJSON() string { return r.raw } // content is the content spec of the environment -type EnvironmentNewResponseEnvironmentSpecContent struct { +type EnvironmentSpecContent struct { // The Git email address GitEmail string `json:"gitEmail"` // The Git username GitUsername string `json:"gitUsername"` // EnvironmentInitializer specifies how an environment is to be initialized - Initializer EnvironmentNewResponseEnvironmentSpecContentInitializer `json:"initializer"` - Session string `json:"session"` - JSON environmentNewResponseEnvironmentSpecContentJSON `json:"-"` + Initializer EnvironmentInitializer `json:"initializer"` + Session string `json:"session"` + JSON environmentSpecContentJSON `json:"-"` } -// environmentNewResponseEnvironmentSpecContentJSON contains the JSON metadata for -// the struct [EnvironmentNewResponseEnvironmentSpecContent] -type environmentNewResponseEnvironmentSpecContentJSON struct { +// environmentSpecContentJSON contains the JSON metadata for the struct +// [EnvironmentSpecContent] +type environmentSpecContentJSON struct { GitEmail apijson.Field GitUsername apijson.Field Initializer apijson.Field @@ -598,322 +800,82 @@ type environmentNewResponseEnvironmentSpecContentJSON struct { ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironmentSpecContent) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewResponseEnvironmentSpecContentJSON) RawJSON() string { - return r.raw -} - -// EnvironmentInitializer specifies how an environment is to be initialized -type EnvironmentNewResponseEnvironmentSpecContentInitializer struct { - Specs []EnvironmentNewResponseEnvironmentSpecContentInitializerSpec `json:"specs"` - JSON environmentNewResponseEnvironmentSpecContentInitializerJSON `json:"-"` -} - -// environmentNewResponseEnvironmentSpecContentInitializerJSON contains the JSON -// metadata for the struct -// [EnvironmentNewResponseEnvironmentSpecContentInitializer] -type environmentNewResponseEnvironmentSpecContentInitializerJSON struct { - Specs apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewResponseEnvironmentSpecContentInitializer) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewResponseEnvironmentSpecContentInitializerJSON) RawJSON() string { - return r.raw -} - -type EnvironmentNewResponseEnvironmentSpecContentInitializerSpec struct { - // This field can have the runtime type of - // [EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsContextURLContextURL]. - ContextURL interface{} `json:"contextUrl"` - // This field can have the runtime type of - // [EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGitGit]. - Git interface{} `json:"git"` - JSON environmentNewResponseEnvironmentSpecContentInitializerSpecJSON `json:"-"` - union EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsUnion -} - -// environmentNewResponseEnvironmentSpecContentInitializerSpecJSON contains the -// JSON metadata for the struct -// [EnvironmentNewResponseEnvironmentSpecContentInitializerSpec] -type environmentNewResponseEnvironmentSpecContentInitializerSpecJSON struct { - ContextURL apijson.Field - Git apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r environmentNewResponseEnvironmentSpecContentInitializerSpecJSON) RawJSON() string { - return r.raw -} - -func (r *EnvironmentNewResponseEnvironmentSpecContentInitializerSpec) UnmarshalJSON(data []byte) (err error) { - *r = EnvironmentNewResponseEnvironmentSpecContentInitializerSpec{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a -// [EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsUnion] interface -// which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsContextURL], -// [EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGit]. -func (r EnvironmentNewResponseEnvironmentSpecContentInitializerSpec) AsUnion() EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsUnion { - return r.union -} - -// Union satisfied by -// [EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsContextURL] or -// [EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGit]. -type EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsUnion interface { - implementsEnvironmentNewResponseEnvironmentSpecContentInitializerSpec() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsContextURL{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGit{}), - }, - ) -} - -type EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsContextURL struct { - ContextURL EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsContextURLContextURL `json:"contextUrl,required"` - JSON environmentNewResponseEnvironmentSpecContentInitializerSpecsContextURLJSON `json:"-"` -} - -// environmentNewResponseEnvironmentSpecContentInitializerSpecsContextURLJSON -// contains the JSON metadata for the struct -// [EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsContextURL] -type environmentNewResponseEnvironmentSpecContentInitializerSpecsContextURLJSON struct { - ContextURL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsContextURL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewResponseEnvironmentSpecContentInitializerSpecsContextURLJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsContextURL) implementsEnvironmentNewResponseEnvironmentSpecContentInitializerSpec() { -} - -type EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsContextURLContextURL struct { - // url is the URL from which the environment is created - URL string `json:"url" format:"uri"` - JSON environmentNewResponseEnvironmentSpecContentInitializerSpecsContextURLContextURLJSON `json:"-"` -} - -// environmentNewResponseEnvironmentSpecContentInitializerSpecsContextURLContextURLJSON -// contains the JSON metadata for the struct -// [EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsContextURLContextURL] -type environmentNewResponseEnvironmentSpecContentInitializerSpecsContextURLContextURLJSON struct { - URL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsContextURLContextURL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewResponseEnvironmentSpecContentInitializerSpecsContextURLContextURLJSON) RawJSON() string { - return r.raw -} - -type EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGit struct { - Git EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGitGit `json:"git,required"` - JSON environmentNewResponseEnvironmentSpecContentInitializerSpecsGitJSON `json:"-"` -} - -// environmentNewResponseEnvironmentSpecContentInitializerSpecsGitJSON contains the -// JSON metadata for the struct -// [EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGit] -type environmentNewResponseEnvironmentSpecContentInitializerSpecsGitJSON struct { - Git apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGit) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewResponseEnvironmentSpecContentInitializerSpecsGitJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGit) implementsEnvironmentNewResponseEnvironmentSpecContentInitializerSpec() { -} - -type EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGitGit struct { - // a path relative to the environment root in which the code will be checked out to - CheckoutLocation string `json:"checkoutLocation"` - // the value for the clone target mode - use depends on the target mode - CloneTarget string `json:"cloneTarget"` - // remote_uri is the Git remote origin - RemoteUri string `json:"remoteUri"` - // CloneTargetMode is the target state in which we want to leave a GitEnvironment - TargetMode EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode `json:"targetMode"` - // upstream_Remote_uri is the fork upstream of a repository - UpstreamRemoteUri string `json:"upstreamRemoteUri"` - JSON environmentNewResponseEnvironmentSpecContentInitializerSpecsGitGitJSON `json:"-"` -} - -// environmentNewResponseEnvironmentSpecContentInitializerSpecsGitGitJSON contains -// the JSON metadata for the struct -// [EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGitGit] -type environmentNewResponseEnvironmentSpecContentInitializerSpecsGitGitJSON struct { - CheckoutLocation apijson.Field - CloneTarget apijson.Field - RemoteUri apijson.Field - TargetMode apijson.Field - UpstreamRemoteUri apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGitGit) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentSpecContent) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentSpecContentInitializerSpecsGitGitJSON) RawJSON() string { +func (r environmentSpecContentJSON) RawJSON() string { return r.raw } -// CloneTargetMode is the target state in which we want to leave a GitEnvironment -type EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode string - -const ( - EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_UNSPECIFIED" - EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_HEAD" - EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_COMMIT" - EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_BRANCH" - EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_LOCAL_BRANCH" -) - -func (r EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode) IsKnown() bool { - switch r { - case EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified, EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead, EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit, EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch, EnvironmentNewResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch: - return true - } - return false -} - -// Phase is the desired phase of the environment -type EnvironmentNewResponseEnvironmentSpecDesiredPhase string - -const ( - EnvironmentNewResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseUnspecified EnvironmentNewResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_UNSPECIFIED" - EnvironmentNewResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseCreating EnvironmentNewResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_CREATING" - EnvironmentNewResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseStarting EnvironmentNewResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_STARTING" - EnvironmentNewResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseRunning EnvironmentNewResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_RUNNING" - EnvironmentNewResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseUpdating EnvironmentNewResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_UPDATING" - EnvironmentNewResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseStopping EnvironmentNewResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_STOPPING" - EnvironmentNewResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseStopped EnvironmentNewResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_STOPPED" - EnvironmentNewResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseDeleting EnvironmentNewResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_DELETING" - EnvironmentNewResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseDeleted EnvironmentNewResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_DELETED" -) - -func (r EnvironmentNewResponseEnvironmentSpecDesiredPhase) IsKnown() bool { - switch r { - case EnvironmentNewResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseUnspecified, EnvironmentNewResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseCreating, EnvironmentNewResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseStarting, EnvironmentNewResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseRunning, EnvironmentNewResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseUpdating, EnvironmentNewResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseStopping, EnvironmentNewResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseStopped, EnvironmentNewResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseDeleting, EnvironmentNewResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseDeleted: - return true - } - return false -} - // devcontainer is the devcontainer spec of the environment -type EnvironmentNewResponseEnvironmentSpecDevcontainer struct { +type EnvironmentSpecDevcontainer struct { // devcontainer_file_path is the path to the devcontainer file relative to the repo // root path must not be absolute (start with a /): // // ``` // this.matches('^$|^[^/].*') // ``` - DevcontainerFilePath string `json:"devcontainerFilePath"` - Session string `json:"session"` - JSON environmentNewResponseEnvironmentSpecDevcontainerJSON `json:"-"` + DevcontainerFilePath string `json:"devcontainerFilePath"` + Session string `json:"session"` + JSON environmentSpecDevcontainerJSON `json:"-"` } -// environmentNewResponseEnvironmentSpecDevcontainerJSON contains the JSON metadata -// for the struct [EnvironmentNewResponseEnvironmentSpecDevcontainer] -type environmentNewResponseEnvironmentSpecDevcontainerJSON struct { +// environmentSpecDevcontainerJSON contains the JSON metadata for the struct +// [EnvironmentSpecDevcontainer] +type environmentSpecDevcontainerJSON struct { DevcontainerFilePath apijson.Field Session apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironmentSpecDevcontainer) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentSpecDevcontainer) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentSpecDevcontainerJSON) RawJSON() string { +func (r environmentSpecDevcontainerJSON) RawJSON() string { return r.raw } // machine is the machine spec of the environment -type EnvironmentNewResponseEnvironmentSpecMachine struct { +type EnvironmentSpecMachine struct { // Class denotes the class of the environment we ought to start - Class string `json:"class" format:"uuid"` - Session string `json:"session"` - JSON environmentNewResponseEnvironmentSpecMachineJSON `json:"-"` + Class string `json:"class" format:"uuid"` + Session string `json:"session"` + JSON environmentSpecMachineJSON `json:"-"` } -// environmentNewResponseEnvironmentSpecMachineJSON contains the JSON metadata for -// the struct [EnvironmentNewResponseEnvironmentSpecMachine] -type environmentNewResponseEnvironmentSpecMachineJSON struct { +// environmentSpecMachineJSON contains the JSON metadata for the struct +// [EnvironmentSpecMachine] +type environmentSpecMachineJSON struct { Class apijson.Field Session apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironmentSpecMachine) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentSpecMachine) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentSpecMachineJSON) RawJSON() string { +func (r environmentSpecMachineJSON) RawJSON() string { return r.raw } -type EnvironmentNewResponseEnvironmentSpecPort struct { +type EnvironmentSpecPort struct { // Admission level describes who can access an environment instance and its ports. - Admission EnvironmentNewResponseEnvironmentSpecPortsAdmission `json:"admission"` + Admission AdmissionLevel `json:"admission"` // name of this port Name string `json:"name"` // port number - Port int64 `json:"port"` - JSON environmentNewResponseEnvironmentSpecPortJSON `json:"-"` + Port int64 `json:"port"` + JSON environmentSpecPortJSON `json:"-"` } -// environmentNewResponseEnvironmentSpecPortJSON contains the JSON metadata for the -// struct [EnvironmentNewResponseEnvironmentSpecPort] -type environmentNewResponseEnvironmentSpecPortJSON struct { +// environmentSpecPortJSON contains the JSON metadata for the struct +// [EnvironmentSpecPort] +type environmentSpecPortJSON struct { Admission apijson.Field Name apijson.Field Port apijson.Field @@ -921,32 +883,15 @@ type environmentNewResponseEnvironmentSpecPortJSON struct { ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironmentSpecPort) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentSpecPort) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentSpecPortJSON) RawJSON() string { +func (r environmentSpecPortJSON) RawJSON() string { return r.raw } -// Admission level describes who can access an environment instance and its ports. -type EnvironmentNewResponseEnvironmentSpecPortsAdmission string - -const ( - EnvironmentNewResponseEnvironmentSpecPortsAdmissionAdmissionLevelUnspecified EnvironmentNewResponseEnvironmentSpecPortsAdmission = "ADMISSION_LEVEL_UNSPECIFIED" - EnvironmentNewResponseEnvironmentSpecPortsAdmissionAdmissionLevelOwnerOnly EnvironmentNewResponseEnvironmentSpecPortsAdmission = "ADMISSION_LEVEL_OWNER_ONLY" - EnvironmentNewResponseEnvironmentSpecPortsAdmissionAdmissionLevelEveryone EnvironmentNewResponseEnvironmentSpecPortsAdmission = "ADMISSION_LEVEL_EVERYONE" -) - -func (r EnvironmentNewResponseEnvironmentSpecPortsAdmission) IsKnown() bool { - switch r { - case EnvironmentNewResponseEnvironmentSpecPortsAdmissionAdmissionLevelUnspecified, EnvironmentNewResponseEnvironmentSpecPortsAdmissionAdmissionLevelOwnerOnly, EnvironmentNewResponseEnvironmentSpecPortsAdmissionAdmissionLevelEveryone: - return true - } - return false -} - -type EnvironmentNewResponseEnvironmentSpecSecret struct { +type EnvironmentSpecSecret struct { EnvironmentVariable string `json:"environmentVariable"` // file_path is the path inside the devcontainer where the secret is mounted FilePath string `json:"filePath"` @@ -959,14 +904,13 @@ type EnvironmentNewResponseEnvironmentSpecSecret struct { // source is the source of the secret, for now control-plane or runner Source string `json:"source"` // source_ref into the source, in case of control-plane this is uuid of the secret - SourceRef string `json:"sourceRef"` - JSON environmentNewResponseEnvironmentSpecSecretJSON `json:"-"` - union EnvironmentNewResponseEnvironmentSpecSecretsUnion + SourceRef string `json:"sourceRef"` + JSON environmentSpecSecretJSON `json:"-"` } -// environmentNewResponseEnvironmentSpecSecretJSON contains the JSON metadata for -// the struct [EnvironmentNewResponseEnvironmentSpecSecret] -type environmentNewResponseEnvironmentSpecSecretJSON struct { +// environmentSpecSecretJSON contains the JSON metadata for the struct +// [EnvironmentSpecSecret] +type environmentSpecSecretJSON struct { EnvironmentVariable apijson.Field FilePath apijson.Field GitCredentialHost apijson.Field @@ -978,159 +922,41 @@ type environmentNewResponseEnvironmentSpecSecretJSON struct { ExtraFields map[string]apijson.Field } -func (r environmentNewResponseEnvironmentSpecSecretJSON) RawJSON() string { - return r.raw -} - -func (r *EnvironmentNewResponseEnvironmentSpecSecret) UnmarshalJSON(data []byte) (err error) { - *r = EnvironmentNewResponseEnvironmentSpecSecret{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a [EnvironmentNewResponseEnvironmentSpecSecretsUnion] interface -// which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [EnvironmentNewResponseEnvironmentSpecSecretsObject], -// [EnvironmentNewResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted], -// [EnvironmentNewResponseEnvironmentSpecSecretsObject]. -func (r EnvironmentNewResponseEnvironmentSpecSecret) AsUnion() EnvironmentNewResponseEnvironmentSpecSecretsUnion { - return r.union -} - -// Union satisfied by [EnvironmentNewResponseEnvironmentSpecSecretsObject], -// [EnvironmentNewResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted] -// or [EnvironmentNewResponseEnvironmentSpecSecretsObject]. -type EnvironmentNewResponseEnvironmentSpecSecretsUnion interface { - implementsEnvironmentNewResponseEnvironmentSpecSecret() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*EnvironmentNewResponseEnvironmentSpecSecretsUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentNewResponseEnvironmentSpecSecretsObject{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentNewResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentNewResponseEnvironmentSpecSecretsObject{}), - }, - ) -} - -type EnvironmentNewResponseEnvironmentSpecSecretsObject struct { - EnvironmentVariable string `json:"environmentVariable,required"` - // name is the human readable description of the secret - Name string `json:"name"` - // session indicated the current session of the secret. When the session does not - // change, secrets are not reloaded in the environment. - Session string `json:"session"` - // source is the source of the secret, for now control-plane or runner - Source string `json:"source"` - // source_ref into the source, in case of control-plane this is uuid of the secret - SourceRef string `json:"sourceRef"` - JSON environmentNewResponseEnvironmentSpecSecretsObjectJSON `json:"-"` -} - -// environmentNewResponseEnvironmentSpecSecretsObjectJSON contains the JSON -// metadata for the struct [EnvironmentNewResponseEnvironmentSpecSecretsObject] -type environmentNewResponseEnvironmentSpecSecretsObjectJSON struct { - EnvironmentVariable apijson.Field - Name apijson.Field - Session apijson.Field - Source apijson.Field - SourceRef apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewResponseEnvironmentSpecSecretsObject) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewResponseEnvironmentSpecSecretsObjectJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentNewResponseEnvironmentSpecSecretsObject) implementsEnvironmentNewResponseEnvironmentSpecSecret() { -} - -type EnvironmentNewResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted struct { - // file_path is the path inside the devcontainer where the secret is mounted - FilePath string `json:"filePath,required"` - // name is the human readable description of the secret - Name string `json:"name"` - // session indicated the current session of the secret. When the session does not - // change, secrets are not reloaded in the environment. - Session string `json:"session"` - // source is the source of the secret, for now control-plane or runner - Source string `json:"source"` - // source_ref into the source, in case of control-plane this is uuid of the secret - SourceRef string `json:"sourceRef"` - JSON environmentNewResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMountedJSON `json:"-"` -} - -// environmentNewResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMountedJSON -// contains the JSON metadata for the struct -// [EnvironmentNewResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted] -type environmentNewResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMountedJSON struct { - FilePath apijson.Field - Name apijson.Field - Session apijson.Field - Source apijson.Field - SourceRef apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentSpecSecret) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMountedJSON) RawJSON() string { +func (r environmentSpecSecretJSON) RawJSON() string { return r.raw } -func (r EnvironmentNewResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted) implementsEnvironmentNewResponseEnvironmentSpecSecret() { -} - -type EnvironmentNewResponseEnvironmentSpecSSHPublicKey struct { +type EnvironmentSpecSSHPublicKey struct { // id is the unique identifier of the public key ID string `json:"id"` // value is the actual public key in the public key file format - Value string `json:"value"` - JSON environmentNewResponseEnvironmentSpecSSHPublicKeyJSON `json:"-"` + Value string `json:"value"` + JSON environmentSpecSSHPublicKeyJSON `json:"-"` } -// environmentNewResponseEnvironmentSpecSSHPublicKeyJSON contains the JSON metadata -// for the struct [EnvironmentNewResponseEnvironmentSpecSSHPublicKey] -type environmentNewResponseEnvironmentSpecSSHPublicKeyJSON struct { +// environmentSpecSSHPublicKeyJSON contains the JSON metadata for the struct +// [EnvironmentSpecSSHPublicKey] +type environmentSpecSSHPublicKeyJSON struct { ID apijson.Field Value apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironmentSpecSSHPublicKey) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentSpecSSHPublicKey) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentSpecSSHPublicKeyJSON) RawJSON() string { +func (r environmentSpecSSHPublicKeyJSON) RawJSON() string { return r.raw } // Timeout configures the environment timeout -type EnvironmentNewResponseEnvironmentSpecTimeout struct { +type EnvironmentSpecTimeout struct { // A Duration represents a signed, fixed-length span of time represented as a count // of seconds and fractions of seconds at nanosecond resolution. It is independent // of any calendar and concepts like "day" or "month". It is related to Timestamp @@ -1188,232 +1014,319 @@ type EnvironmentNewResponseEnvironmentSpecTimeout struct { // while 3 seconds and 1 nanosecond should be expressed in JSON format as // "3.000000001s", and 3 seconds and 1 microsecond should be expressed in JSON // format as "3.000001s". - Disconnected string `json:"disconnected" format:"regex"` - JSON environmentNewResponseEnvironmentSpecTimeoutJSON `json:"-"` + Disconnected string `json:"disconnected" format:"regex"` + JSON environmentSpecTimeoutJSON `json:"-"` } -// environmentNewResponseEnvironmentSpecTimeoutJSON contains the JSON metadata for -// the struct [EnvironmentNewResponseEnvironmentSpecTimeout] -type environmentNewResponseEnvironmentSpecTimeoutJSON struct { +// environmentSpecTimeoutJSON contains the JSON metadata for the struct +// [EnvironmentSpecTimeout] +type environmentSpecTimeoutJSON struct { Disconnected apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironmentSpecTimeout) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentSpecTimeout) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentSpecTimeoutJSON) RawJSON() string { +func (r environmentSpecTimeoutJSON) RawJSON() string { return r.raw } -// EnvironmentStatus describes an environment status -type EnvironmentNewResponseEnvironmentStatus struct { - // EnvironmentActivitySignal used to signal activity for an environment. - ActivitySignal EnvironmentNewResponseEnvironmentStatusActivitySignal `json:"activitySignal"` - // automations_file contains the status of the automations file. - AutomationsFile EnvironmentNewResponseEnvironmentStatusAutomationsFile `json:"automationsFile"` - // content contains the status of the environment content. - Content EnvironmentNewResponseEnvironmentStatusContent `json:"content"` - // devcontainer contains the status of the devcontainer. - Devcontainer EnvironmentNewResponseEnvironmentStatusDevcontainer `json:"devcontainer"` - // environment_url contains the URL at which the environment can be accessed. This - // field is only set if the environment is running. - EnvironmentURLs EnvironmentNewResponseEnvironmentStatusEnvironmentURLs `json:"environmentUrls"` - // failure_message summarises why the environment failed to operate. If this is - // non-empty the environment has failed to operate and will likely transition to a - // stopped state. - FailureMessage []string `json:"failureMessage"` - // machine contains the status of the environment machine - Machine EnvironmentNewResponseEnvironmentStatusMachine `json:"machine"` - // the phase of an environment is a simple, high-level summary of where the - // environment is in its lifecycle - Phase EnvironmentNewResponseEnvironmentStatusPhase `json:"phase"` - // RunnerACK is the acknowledgement from the runner that is has received the - // environment spec. - RunnerAck EnvironmentNewResponseEnvironmentStatusRunnerAck `json:"runnerAck"` - // secrets contains the status of the environment secrets - Secrets []EnvironmentNewResponseEnvironmentStatusSecret `json:"secrets"` - // ssh_public_keys contains the status of the environment ssh public keys - SSHPublicKeys []EnvironmentNewResponseEnvironmentStatusSSHPublicKey `json:"sshPublicKeys"` - // version of the status update. Environment instances themselves are unversioned, - // but their status has different versions. The value of this field has no semantic - // meaning (e.g. don't interpret it as as a timestamp), but it can be used to - // impose a partial order. If a.status_version < b.status_version then a was the - // status before b. - StatusVersion string `json:"statusVersion"` - // warning_message contains warnings, e.g. when the environment is present but not - // in the expected state. - WarningMessage []string `json:"warningMessage"` - JSON environmentNewResponseEnvironmentStatusJSON `json:"-"` +// EnvironmentSpec specifies the configuration of an environment for an environment +// start +type EnvironmentSpecParam struct { + // Admission level describes who can access an environment instance and its ports. + Admission param.Field[AdmissionLevel] `json:"admission"` + // automations_file is the automations file spec of the environment + AutomationsFile param.Field[EnvironmentSpecAutomationsFileParam] `json:"automationsFile"` + // content is the content spec of the environment + Content param.Field[EnvironmentSpecContentParam] `json:"content"` + // Phase is the desired phase of the environment + DesiredPhase param.Field[EnvironmentPhase] `json:"desiredPhase"` + // devcontainer is the devcontainer spec of the environment + Devcontainer param.Field[EnvironmentSpecDevcontainerParam] `json:"devcontainer"` + // machine is the machine spec of the environment + Machine param.Field[EnvironmentSpecMachineParam] `json:"machine"` + // ports is the set of ports which ought to be exposed to the internet + Ports param.Field[[]EnvironmentSpecPortParam] `json:"ports"` + // secrets are confidential data that is mounted into the environment + Secrets param.Field[[]EnvironmentSpecSecretParam] `json:"secrets"` + // version of the spec. The value of this field has no semantic meaning (e.g. don't + // interpret it as as a timestamp), but it can be used to impose a partial order. + // If a.spec_version < b.spec_version then a was the spec before b. + SpecVersion param.Field[string] `json:"specVersion"` + // ssh_public_keys are the public keys used to ssh into the environment + SSHPublicKeys param.Field[[]EnvironmentSpecSSHPublicKeyParam] `json:"sshPublicKeys"` + // Timeout configures the environment timeout + Timeout param.Field[EnvironmentSpecTimeoutParam] `json:"timeout"` } -// environmentNewResponseEnvironmentStatusJSON contains the JSON metadata for the -// struct [EnvironmentNewResponseEnvironmentStatus] -type environmentNewResponseEnvironmentStatusJSON struct { - ActivitySignal apijson.Field - AutomationsFile apijson.Field - Content apijson.Field - Devcontainer apijson.Field - EnvironmentURLs apijson.Field - FailureMessage apijson.Field - Machine apijson.Field - Phase apijson.Field - RunnerAck apijson.Field - Secrets apijson.Field - SSHPublicKeys apijson.Field - StatusVersion apijson.Field - WarningMessage apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r EnvironmentSpecParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r *EnvironmentNewResponseEnvironmentStatus) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +// automations_file is the automations file spec of the environment +type EnvironmentSpecAutomationsFileParam struct { + // automations_file_path is the path to the automations file that is applied in the + // environment, relative to the repo root. path must not be absolute (start with a + // /): + // + // ``` + // this.matches('^$|^[^/].*') + // ``` + AutomationsFilePath param.Field[string] `json:"automationsFilePath"` + Session param.Field[string] `json:"session"` } -func (r environmentNewResponseEnvironmentStatusJSON) RawJSON() string { - return r.raw +func (r EnvironmentSpecAutomationsFileParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -// EnvironmentActivitySignal used to signal activity for an environment. -type EnvironmentNewResponseEnvironmentStatusActivitySignal struct { - // source of the activity signal, such as "VS Code", "SSH", or "Automations". It - // should be a human-readable string that describes the source of the activity - // signal. - Source string `json:"source"` - // 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); +// content is the content spec of the environment +type EnvironmentSpecContentParam struct { + // The Git email address + GitEmail param.Field[string] `json:"gitEmail"` + // The Git username + GitUsername param.Field[string] `json:"gitUsername"` + // EnvironmentInitializer specifies how an environment is to be initialized + Initializer param.Field[EnvironmentInitializerParam] `json:"initializer"` + Session param.Field[string] `json:"session"` +} + +func (r EnvironmentSpecContentParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// devcontainer is the devcontainer spec of the environment +type EnvironmentSpecDevcontainerParam struct { + // devcontainer_file_path is the path to the devcontainer file relative to the repo + // root path must not be absolute (start with a /): // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); + // ``` + // this.matches('^$|^[^/].*') + // ``` + DevcontainerFilePath param.Field[string] `json:"devcontainerFilePath"` + Session param.Field[string] `json:"session"` +} + +func (r EnvironmentSpecDevcontainerParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// machine is the machine spec of the environment +type EnvironmentSpecMachineParam struct { + // Class denotes the class of the environment we ought to start + Class param.Field[string] `json:"class" format:"uuid"` + Session param.Field[string] `json:"session"` +} + +func (r EnvironmentSpecMachineParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type EnvironmentSpecPortParam struct { + // Admission level describes who can access an environment instance and its ports. + Admission param.Field[AdmissionLevel] `json:"admission"` + // name of this port + Name param.Field[string] `json:"name"` + // port number + Port param.Field[int64] `json:"port"` +} + +func (r EnvironmentSpecPortParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type EnvironmentSpecSecretParam struct { + 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"` + // name is the human readable description of the secret + Name param.Field[string] `json:"name"` + // session indicated the current session of the secret. When the session does not + // change, secrets are not reloaded in the environment. + Session param.Field[string] `json:"session"` + // source is the source of the secret, for now control-plane or runner + Source param.Field[string] `json:"source"` + // source_ref into the source, in case of control-plane this is uuid of the secret + SourceRef param.Field[string] `json:"sourceRef"` +} + +func (r EnvironmentSpecSecretParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type EnvironmentSpecSSHPublicKeyParam struct { + // id is the unique identifier of the public key + ID param.Field[string] `json:"id"` + // value is the actual public key in the public key file format + Value param.Field[string] `json:"value"` +} + +func (r EnvironmentSpecSSHPublicKeyParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// Timeout configures the environment timeout +type EnvironmentSpecTimeoutParam struct { + // A Duration represents a signed, fixed-length span of time represented as a count + // of seconds and fractions of seconds at nanosecond resolution. It is independent + // of any calendar and concepts like "day" or "month". It is related to Timestamp + // in that the difference between two Timestamp values is a Duration and it can be + // added or subtracted from a Timestamp. Range is approximately +-10,000 years. // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + // # Examples // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + // Example 1: Compute Duration from two Timestamps in pseudo code. // - // // 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)); + // Timestamp start = ...; + // Timestamp end = ...; + // Duration duration = ...; // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + // duration.seconds = end.seconds - start.seconds; + // duration.nanos = end.nanos - start.nanos; // - // long millis = System.currentTimeMillis(); + // if (duration.seconds < 0 && duration.nanos > 0) { + // duration.seconds += 1; + // duration.nanos -= 1000000000; + // } else if (duration.seconds > 0 && duration.nanos < 0) { + // duration.seconds -= 1; + // duration.nanos += 1000000000; + // } // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); + // Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. // - // Example 5: Compute Timestamp from Java `Instant.now()`. + // Timestamp start = ...; + // Duration duration = ...; + // Timestamp end = ...; // - // Instant now = Instant.now(); + // end.seconds = start.seconds + duration.seconds; + // end.nanos = start.nanos + duration.nanos; // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); + // if (end.nanos < 0) { + // end.seconds -= 1; + // end.nanos += 1000000000; + // } else if (end.nanos >= 1000000000) { + // end.seconds += 1; + // end.nanos -= 1000000000; + // } // - // Example 6: Compute Timestamp from current time in Python. + // Example 3: Compute Duration from datetime.timedelta in Python. // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() + // td = datetime.timedelta(days=3, minutes=10) + // duration = Duration() + // duration.FromTimedelta(td) // // # 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. - Timestamp time.Time `json:"timestamp" format:"date-time"` - JSON environmentNewResponseEnvironmentStatusActivitySignalJSON `json:"-"` + // In JSON format, the Duration type is encoded as a string rather than an object, + // where the string ends in the suffix "s" (indicating seconds) and is preceded by + // the number of seconds, with nanoseconds expressed as fractional seconds. For + // example, 3 seconds with 0 nanoseconds should be encoded in JSON format as "3s", + // while 3 seconds and 1 nanosecond should be expressed in JSON format as + // "3.000000001s", and 3 seconds and 1 microsecond should be expressed in JSON + // format as "3.000001s". + Disconnected param.Field[string] `json:"disconnected" format:"regex"` } -// environmentNewResponseEnvironmentStatusActivitySignalJSON contains the JSON -// metadata for the struct [EnvironmentNewResponseEnvironmentStatusActivitySignal] -type environmentNewResponseEnvironmentStatusActivitySignalJSON struct { - Source apijson.Field - Timestamp apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r EnvironmentSpecTimeoutParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// EnvironmentStatus describes an environment status +type EnvironmentStatus struct { + // EnvironmentActivitySignal used to signal activity for an environment. + ActivitySignal EnvironmentActivitySignal `json:"activitySignal"` + // automations_file contains the status of the automations file. + AutomationsFile EnvironmentStatusAutomationsFile `json:"automationsFile"` + // content contains the status of the environment content. + Content EnvironmentStatusContent `json:"content"` + // devcontainer contains the status of the devcontainer. + Devcontainer EnvironmentStatusDevcontainer `json:"devcontainer"` + // environment_url contains the URL at which the environment can be accessed. This + // field is only set if the environment is running. + EnvironmentURLs EnvironmentStatusEnvironmentURLs `json:"environmentUrls"` + // failure_message summarises why the environment failed to operate. If this is + // non-empty the environment has failed to operate and will likely transition to a + // stopped state. + FailureMessage []string `json:"failureMessage"` + // machine contains the status of the environment machine + Machine EnvironmentStatusMachine `json:"machine"` + // the phase of an environment is a simple, high-level summary of where the + // environment is in its lifecycle + Phase EnvironmentPhase `json:"phase"` + // RunnerACK is the acknowledgement from the runner that is has received the + // environment spec. + RunnerAck EnvironmentStatusRunnerAck `json:"runnerAck"` + // secrets contains the status of the environment secrets + Secrets []EnvironmentStatusSecret `json:"secrets"` + // ssh_public_keys contains the status of the environment ssh public keys + SSHPublicKeys []EnvironmentStatusSSHPublicKey `json:"sshPublicKeys"` + // version of the status update. Environment instances themselves are unversioned, + // but their status has different versions. The value of this field has no semantic + // meaning (e.g. don't interpret it as as a timestamp), but it can be used to + // impose a partial order. If a.status_version < b.status_version then a was the + // status before b. + StatusVersion string `json:"statusVersion"` + // warning_message contains warnings, e.g. when the environment is present but not + // in the expected state. + WarningMessage []string `json:"warningMessage"` + JSON environmentStatusJSON `json:"-"` +} + +// environmentStatusJSON contains the JSON metadata for the struct +// [EnvironmentStatus] +type environmentStatusJSON struct { + ActivitySignal apijson.Field + AutomationsFile apijson.Field + Content apijson.Field + Devcontainer apijson.Field + EnvironmentURLs apijson.Field + FailureMessage apijson.Field + Machine apijson.Field + Phase apijson.Field + RunnerAck apijson.Field + Secrets apijson.Field + SSHPublicKeys apijson.Field + StatusVersion apijson.Field + WarningMessage apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironmentStatusActivitySignal) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentStatus) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentStatusActivitySignalJSON) RawJSON() string { +func (r environmentStatusJSON) RawJSON() string { return r.raw } // automations_file contains the status of the automations file. -type EnvironmentNewResponseEnvironmentStatusAutomationsFile struct { +type EnvironmentStatusAutomationsFile struct { // automations_file_path is the path to the automations file relative to the repo // root. AutomationsFilePath string `json:"automationsFilePath"` // automations_file_presence indicates how an automations file is present in the // environment. - AutomationsFilePresence EnvironmentNewResponseEnvironmentStatusAutomationsFileAutomationsFilePresence `json:"automationsFilePresence"` + AutomationsFilePresence EnvironmentStatusAutomationsFileAutomationsFilePresence `json:"automationsFilePresence"` // failure_message contains the reason the automations file failed to be applied. // This is only set if the phase is FAILED. FailureMessage string `json:"failureMessage"` // phase is the current phase of the automations file. - Phase EnvironmentNewResponseEnvironmentStatusAutomationsFilePhase `json:"phase"` + Phase EnvironmentStatusAutomationsFilePhase `json:"phase"` // session is the automations file session that is currently applied in the // environment. - Session string `json:"session"` - JSON environmentNewResponseEnvironmentStatusAutomationsFileJSON `json:"-"` + Session string `json:"session"` + JSON environmentStatusAutomationsFileJSON `json:"-"` } -// environmentNewResponseEnvironmentStatusAutomationsFileJSON contains the JSON -// metadata for the struct [EnvironmentNewResponseEnvironmentStatusAutomationsFile] -type environmentNewResponseEnvironmentStatusAutomationsFileJSON struct { +// environmentStatusAutomationsFileJSON contains the JSON metadata for the struct +// [EnvironmentStatusAutomationsFile] +type environmentStatusAutomationsFileJSON struct { AutomationsFilePath apijson.Field AutomationsFilePresence apijson.Field FailureMessage apijson.Field @@ -1423,55 +1336,55 @@ type environmentNewResponseEnvironmentStatusAutomationsFileJSON struct { ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironmentStatusAutomationsFile) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentStatusAutomationsFile) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentStatusAutomationsFileJSON) RawJSON() string { +func (r environmentStatusAutomationsFileJSON) RawJSON() string { return r.raw } // automations_file_presence indicates how an automations file is present in the // environment. -type EnvironmentNewResponseEnvironmentStatusAutomationsFileAutomationsFilePresence string +type EnvironmentStatusAutomationsFileAutomationsFilePresence string const ( - EnvironmentNewResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceUnspecified EnvironmentNewResponseEnvironmentStatusAutomationsFileAutomationsFilePresence = "PRESENCE_UNSPECIFIED" - EnvironmentNewResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceAbsent EnvironmentNewResponseEnvironmentStatusAutomationsFileAutomationsFilePresence = "PRESENCE_ABSENT" - EnvironmentNewResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceDiscovered EnvironmentNewResponseEnvironmentStatusAutomationsFileAutomationsFilePresence = "PRESENCE_DISCOVERED" - EnvironmentNewResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceSpecified EnvironmentNewResponseEnvironmentStatusAutomationsFileAutomationsFilePresence = "PRESENCE_SPECIFIED" + EnvironmentStatusAutomationsFileAutomationsFilePresencePresenceUnspecified EnvironmentStatusAutomationsFileAutomationsFilePresence = "PRESENCE_UNSPECIFIED" + EnvironmentStatusAutomationsFileAutomationsFilePresencePresenceAbsent EnvironmentStatusAutomationsFileAutomationsFilePresence = "PRESENCE_ABSENT" + EnvironmentStatusAutomationsFileAutomationsFilePresencePresenceDiscovered EnvironmentStatusAutomationsFileAutomationsFilePresence = "PRESENCE_DISCOVERED" + EnvironmentStatusAutomationsFileAutomationsFilePresencePresenceSpecified EnvironmentStatusAutomationsFileAutomationsFilePresence = "PRESENCE_SPECIFIED" ) -func (r EnvironmentNewResponseEnvironmentStatusAutomationsFileAutomationsFilePresence) IsKnown() bool { +func (r EnvironmentStatusAutomationsFileAutomationsFilePresence) IsKnown() bool { switch r { - case EnvironmentNewResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceUnspecified, EnvironmentNewResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceAbsent, EnvironmentNewResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceDiscovered, EnvironmentNewResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceSpecified: + case EnvironmentStatusAutomationsFileAutomationsFilePresencePresenceUnspecified, EnvironmentStatusAutomationsFileAutomationsFilePresencePresenceAbsent, EnvironmentStatusAutomationsFileAutomationsFilePresencePresenceDiscovered, EnvironmentStatusAutomationsFileAutomationsFilePresencePresenceSpecified: return true } return false } // phase is the current phase of the automations file. -type EnvironmentNewResponseEnvironmentStatusAutomationsFilePhase string +type EnvironmentStatusAutomationsFilePhase string const ( - EnvironmentNewResponseEnvironmentStatusAutomationsFilePhaseContentPhaseUnspecified EnvironmentNewResponseEnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_UNSPECIFIED" - EnvironmentNewResponseEnvironmentStatusAutomationsFilePhaseContentPhaseCreating EnvironmentNewResponseEnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_CREATING" - EnvironmentNewResponseEnvironmentStatusAutomationsFilePhaseContentPhaseInitializing EnvironmentNewResponseEnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_INITIALIZING" - EnvironmentNewResponseEnvironmentStatusAutomationsFilePhaseContentPhaseReady EnvironmentNewResponseEnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_READY" - EnvironmentNewResponseEnvironmentStatusAutomationsFilePhaseContentPhaseUpdating EnvironmentNewResponseEnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_UPDATING" - EnvironmentNewResponseEnvironmentStatusAutomationsFilePhaseContentPhaseFailed EnvironmentNewResponseEnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_FAILED" + EnvironmentStatusAutomationsFilePhaseContentPhaseUnspecified EnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_UNSPECIFIED" + EnvironmentStatusAutomationsFilePhaseContentPhaseCreating EnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_CREATING" + EnvironmentStatusAutomationsFilePhaseContentPhaseInitializing EnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_INITIALIZING" + EnvironmentStatusAutomationsFilePhaseContentPhaseReady EnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_READY" + EnvironmentStatusAutomationsFilePhaseContentPhaseUpdating EnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_UPDATING" + EnvironmentStatusAutomationsFilePhaseContentPhaseFailed EnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_FAILED" ) -func (r EnvironmentNewResponseEnvironmentStatusAutomationsFilePhase) IsKnown() bool { +func (r EnvironmentStatusAutomationsFilePhase) IsKnown() bool { switch r { - case EnvironmentNewResponseEnvironmentStatusAutomationsFilePhaseContentPhaseUnspecified, EnvironmentNewResponseEnvironmentStatusAutomationsFilePhaseContentPhaseCreating, EnvironmentNewResponseEnvironmentStatusAutomationsFilePhaseContentPhaseInitializing, EnvironmentNewResponseEnvironmentStatusAutomationsFilePhaseContentPhaseReady, EnvironmentNewResponseEnvironmentStatusAutomationsFilePhaseContentPhaseUpdating, EnvironmentNewResponseEnvironmentStatusAutomationsFilePhaseContentPhaseFailed: + case EnvironmentStatusAutomationsFilePhaseContentPhaseUnspecified, EnvironmentStatusAutomationsFilePhaseContentPhaseCreating, EnvironmentStatusAutomationsFilePhaseContentPhaseInitializing, EnvironmentStatusAutomationsFilePhaseContentPhaseReady, EnvironmentStatusAutomationsFilePhaseContentPhaseUpdating, EnvironmentStatusAutomationsFilePhaseContentPhaseFailed: return true } return false } // content contains the status of the environment content. -type EnvironmentNewResponseEnvironmentStatusContent struct { +type EnvironmentStatusContent struct { // content_location_in_machine is the location of the content in the machine ContentLocationInMachine string `json:"contentLocationInMachine"` // failure_message contains the reason the content initialization failed. @@ -1479,20 +1392,20 @@ type EnvironmentNewResponseEnvironmentStatusContent struct { // git is the Git working copy status of the environment. Note: this is a // best-effort field and more often than not will not be present. Its absence does // not indicate the absence of a working copy. - Git EnvironmentNewResponseEnvironmentStatusContentGit `json:"git"` + Git EnvironmentStatusContentGit `json:"git"` // phase is the current phase of the environment content - Phase EnvironmentNewResponseEnvironmentStatusContentPhase `json:"phase"` + Phase EnvironmentStatusContentPhase `json:"phase"` // session is the session that is currently active in the environment. Session string `json:"session"` // warning_message contains warnings, e.g. when the content is present but not in // the expected state. - WarningMessage string `json:"warningMessage"` - JSON environmentNewResponseEnvironmentStatusContentJSON `json:"-"` + WarningMessage string `json:"warningMessage"` + JSON environmentStatusContentJSON `json:"-"` } -// environmentNewResponseEnvironmentStatusContentJSON contains the JSON metadata -// for the struct [EnvironmentNewResponseEnvironmentStatusContent] -type environmentNewResponseEnvironmentStatusContentJSON struct { +// environmentStatusContentJSON contains the JSON metadata for the struct +// [EnvironmentStatusContent] +type environmentStatusContentJSON struct { ContentLocationInMachine apijson.Field FailureMessage apijson.Field Git apijson.Field @@ -1503,23 +1416,23 @@ type environmentNewResponseEnvironmentStatusContentJSON struct { ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironmentStatusContent) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentStatusContent) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentStatusContentJSON) RawJSON() string { +func (r environmentStatusContentJSON) RawJSON() string { return r.raw } // git is the Git working copy status of the environment. Note: this is a // best-effort field and more often than not will not be present. Its absence does // not indicate the absence of a working copy. -type EnvironmentNewResponseEnvironmentStatusContentGit struct { +type EnvironmentStatusContentGit struct { // branch is branch we're currently on Branch string `json:"branch"` // changed_files is an array of changed files in the environment, possibly // truncated - ChangedFiles []EnvironmentNewResponseEnvironmentStatusContentGitChangedFile `json:"changedFiles"` + ChangedFiles []EnvironmentStatusContentGitChangedFile `json:"changedFiles"` // clone_url is the repository url as you would pass it to "git clone". Only HTTPS // clone URLs are supported. CloneURL string `json:"cloneUrl"` @@ -1530,13 +1443,13 @@ type EnvironmentNewResponseEnvironmentStatusContentGit struct { TotalUnpushedCommits int64 `json:"totalUnpushedCommits"` // unpushed_commits is an array of unpushed changes in the environment, possibly // truncated - UnpushedCommits []string `json:"unpushedCommits"` - JSON environmentNewResponseEnvironmentStatusContentGitJSON `json:"-"` + UnpushedCommits []string `json:"unpushedCommits"` + JSON environmentStatusContentGitJSON `json:"-"` } -// environmentNewResponseEnvironmentStatusContentGitJSON contains the JSON metadata -// for the struct [EnvironmentNewResponseEnvironmentStatusContentGit] -type environmentNewResponseEnvironmentStatusContentGitJSON struct { +// environmentStatusContentGitJSON contains the JSON metadata for the struct +// [EnvironmentStatusContentGit] +type environmentStatusContentGitJSON struct { Branch apijson.Field ChangedFiles apijson.Field CloneURL apijson.Field @@ -1548,84 +1461,83 @@ type environmentNewResponseEnvironmentStatusContentGitJSON struct { ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironmentStatusContentGit) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentStatusContentGit) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentStatusContentGitJSON) RawJSON() string { +func (r environmentStatusContentGitJSON) RawJSON() string { return r.raw } -type EnvironmentNewResponseEnvironmentStatusContentGitChangedFile struct { +type EnvironmentStatusContentGitChangedFile struct { // ChangeType is the type of change that happened to the file - ChangeType EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeType `json:"changeType"` + ChangeType EnvironmentStatusContentGitChangedFilesChangeType `json:"changeType"` // path is the path of the file - Path string `json:"path"` - JSON environmentNewResponseEnvironmentStatusContentGitChangedFileJSON `json:"-"` + Path string `json:"path"` + JSON environmentStatusContentGitChangedFileJSON `json:"-"` } -// environmentNewResponseEnvironmentStatusContentGitChangedFileJSON contains the -// JSON metadata for the struct -// [EnvironmentNewResponseEnvironmentStatusContentGitChangedFile] -type environmentNewResponseEnvironmentStatusContentGitChangedFileJSON struct { +// environmentStatusContentGitChangedFileJSON contains the JSON metadata for the +// struct [EnvironmentStatusContentGitChangedFile] +type environmentStatusContentGitChangedFileJSON struct { ChangeType apijson.Field Path apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironmentStatusContentGitChangedFile) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentStatusContentGitChangedFile) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentStatusContentGitChangedFileJSON) RawJSON() string { +func (r environmentStatusContentGitChangedFileJSON) RawJSON() string { return r.raw } // ChangeType is the type of change that happened to the file -type EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeType string +type EnvironmentStatusContentGitChangedFilesChangeType string const ( - EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUnspecified EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_UNSPECIFIED" - EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeAdded EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_ADDED" - EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeModified EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_MODIFIED" - EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeDeleted EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_DELETED" - EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeRenamed EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_RENAMED" - EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeCopied EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_COPIED" - EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUpdatedButUnmerged EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_UPDATED_BUT_UNMERGED" - EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUntracked EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_UNTRACKED" + EnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUnspecified EnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_UNSPECIFIED" + EnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeAdded EnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_ADDED" + EnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeModified EnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_MODIFIED" + EnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeDeleted EnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_DELETED" + EnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeRenamed EnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_RENAMED" + EnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeCopied EnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_COPIED" + EnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUpdatedButUnmerged EnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_UPDATED_BUT_UNMERGED" + EnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUntracked EnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_UNTRACKED" ) -func (r EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeType) IsKnown() bool { +func (r EnvironmentStatusContentGitChangedFilesChangeType) IsKnown() bool { switch r { - case EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUnspecified, EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeAdded, EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeModified, EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeDeleted, EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeRenamed, EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeCopied, EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUpdatedButUnmerged, EnvironmentNewResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUntracked: + case EnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUnspecified, EnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeAdded, EnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeModified, EnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeDeleted, EnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeRenamed, EnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeCopied, EnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUpdatedButUnmerged, EnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUntracked: return true } return false } // phase is the current phase of the environment content -type EnvironmentNewResponseEnvironmentStatusContentPhase string +type EnvironmentStatusContentPhase string const ( - EnvironmentNewResponseEnvironmentStatusContentPhaseContentPhaseUnspecified EnvironmentNewResponseEnvironmentStatusContentPhase = "CONTENT_PHASE_UNSPECIFIED" - EnvironmentNewResponseEnvironmentStatusContentPhaseContentPhaseCreating EnvironmentNewResponseEnvironmentStatusContentPhase = "CONTENT_PHASE_CREATING" - EnvironmentNewResponseEnvironmentStatusContentPhaseContentPhaseInitializing EnvironmentNewResponseEnvironmentStatusContentPhase = "CONTENT_PHASE_INITIALIZING" - EnvironmentNewResponseEnvironmentStatusContentPhaseContentPhaseReady EnvironmentNewResponseEnvironmentStatusContentPhase = "CONTENT_PHASE_READY" - EnvironmentNewResponseEnvironmentStatusContentPhaseContentPhaseUpdating EnvironmentNewResponseEnvironmentStatusContentPhase = "CONTENT_PHASE_UPDATING" - EnvironmentNewResponseEnvironmentStatusContentPhaseContentPhaseFailed EnvironmentNewResponseEnvironmentStatusContentPhase = "CONTENT_PHASE_FAILED" + EnvironmentStatusContentPhaseContentPhaseUnspecified EnvironmentStatusContentPhase = "CONTENT_PHASE_UNSPECIFIED" + EnvironmentStatusContentPhaseContentPhaseCreating EnvironmentStatusContentPhase = "CONTENT_PHASE_CREATING" + EnvironmentStatusContentPhaseContentPhaseInitializing EnvironmentStatusContentPhase = "CONTENT_PHASE_INITIALIZING" + EnvironmentStatusContentPhaseContentPhaseReady EnvironmentStatusContentPhase = "CONTENT_PHASE_READY" + EnvironmentStatusContentPhaseContentPhaseUpdating EnvironmentStatusContentPhase = "CONTENT_PHASE_UPDATING" + EnvironmentStatusContentPhaseContentPhaseFailed EnvironmentStatusContentPhase = "CONTENT_PHASE_FAILED" ) -func (r EnvironmentNewResponseEnvironmentStatusContentPhase) IsKnown() bool { +func (r EnvironmentStatusContentPhase) IsKnown() bool { switch r { - case EnvironmentNewResponseEnvironmentStatusContentPhaseContentPhaseUnspecified, EnvironmentNewResponseEnvironmentStatusContentPhaseContentPhaseCreating, EnvironmentNewResponseEnvironmentStatusContentPhaseContentPhaseInitializing, EnvironmentNewResponseEnvironmentStatusContentPhaseContentPhaseReady, EnvironmentNewResponseEnvironmentStatusContentPhaseContentPhaseUpdating, EnvironmentNewResponseEnvironmentStatusContentPhaseContentPhaseFailed: + case EnvironmentStatusContentPhaseContentPhaseUnspecified, EnvironmentStatusContentPhaseContentPhaseCreating, EnvironmentStatusContentPhaseContentPhaseInitializing, EnvironmentStatusContentPhaseContentPhaseReady, EnvironmentStatusContentPhaseContentPhaseUpdating, EnvironmentStatusContentPhaseContentPhaseFailed: return true } return false } // devcontainer contains the status of the devcontainer. -type EnvironmentNewResponseEnvironmentStatusDevcontainer struct { +type EnvironmentStatusDevcontainer struct { // container_id is the ID of the container. ContainerID string `json:"containerId"` // container_name is the name of the container that is used to connect to the @@ -1639,11 +1551,11 @@ type EnvironmentNewResponseEnvironmentStatusDevcontainer struct { DevcontainerFilePath string `json:"devcontainerFilePath"` // devcontainer_file_presence indicates how the devcontainer file is present in the // repo. - DevcontainerFilePresence EnvironmentNewResponseEnvironmentStatusDevcontainerDevcontainerFilePresence `json:"devcontainerFilePresence"` + DevcontainerFilePresence EnvironmentStatusDevcontainerDevcontainerFilePresence `json:"devcontainerFilePresence"` // failure_message contains the reason the devcontainer failed to operate. FailureMessage string `json:"failureMessage"` // phase is the current phase of the devcontainer - Phase EnvironmentNewResponseEnvironmentStatusDevcontainerPhase `json:"phase"` + Phase EnvironmentStatusDevcontainerPhase `json:"phase"` // remote_user is the user that is used to connect to the devcontainer RemoteUser string `json:"remoteUser"` // remote_workspace_folder is the folder that is used to connect to the @@ -1656,13 +1568,13 @@ type EnvironmentNewResponseEnvironmentStatusDevcontainer struct { Session string `json:"session"` // warning_message contains warnings, e.g. when the devcontainer is present but not // in the expected state. - WarningMessage string `json:"warningMessage"` - JSON environmentNewResponseEnvironmentStatusDevcontainerJSON `json:"-"` + WarningMessage string `json:"warningMessage"` + JSON environmentStatusDevcontainerJSON `json:"-"` } -// environmentNewResponseEnvironmentStatusDevcontainerJSON contains the JSON -// metadata for the struct [EnvironmentNewResponseEnvironmentStatusDevcontainer] -type environmentNewResponseEnvironmentStatusDevcontainerJSON struct { +// environmentStatusDevcontainerJSON contains the JSON metadata for the struct +// [EnvironmentStatusDevcontainer] +type environmentStatusDevcontainerJSON struct { ContainerID apijson.Field ContainerName apijson.Field DevcontainerconfigInSync apijson.Field @@ -1679,47 +1591,47 @@ type environmentNewResponseEnvironmentStatusDevcontainerJSON struct { ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironmentStatusDevcontainer) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentStatusDevcontainer) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentStatusDevcontainerJSON) RawJSON() string { +func (r environmentStatusDevcontainerJSON) RawJSON() string { return r.raw } // devcontainer_file_presence indicates how the devcontainer file is present in the // repo. -type EnvironmentNewResponseEnvironmentStatusDevcontainerDevcontainerFilePresence string +type EnvironmentStatusDevcontainerDevcontainerFilePresence string const ( - EnvironmentNewResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceUnspecified EnvironmentNewResponseEnvironmentStatusDevcontainerDevcontainerFilePresence = "PRESENCE_UNSPECIFIED" - EnvironmentNewResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceGenerated EnvironmentNewResponseEnvironmentStatusDevcontainerDevcontainerFilePresence = "PRESENCE_GENERATED" - EnvironmentNewResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceDiscovered EnvironmentNewResponseEnvironmentStatusDevcontainerDevcontainerFilePresence = "PRESENCE_DISCOVERED" - EnvironmentNewResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceSpecified EnvironmentNewResponseEnvironmentStatusDevcontainerDevcontainerFilePresence = "PRESENCE_SPECIFIED" + EnvironmentStatusDevcontainerDevcontainerFilePresencePresenceUnspecified EnvironmentStatusDevcontainerDevcontainerFilePresence = "PRESENCE_UNSPECIFIED" + EnvironmentStatusDevcontainerDevcontainerFilePresencePresenceGenerated EnvironmentStatusDevcontainerDevcontainerFilePresence = "PRESENCE_GENERATED" + EnvironmentStatusDevcontainerDevcontainerFilePresencePresenceDiscovered EnvironmentStatusDevcontainerDevcontainerFilePresence = "PRESENCE_DISCOVERED" + EnvironmentStatusDevcontainerDevcontainerFilePresencePresenceSpecified EnvironmentStatusDevcontainerDevcontainerFilePresence = "PRESENCE_SPECIFIED" ) -func (r EnvironmentNewResponseEnvironmentStatusDevcontainerDevcontainerFilePresence) IsKnown() bool { +func (r EnvironmentStatusDevcontainerDevcontainerFilePresence) IsKnown() bool { switch r { - case EnvironmentNewResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceUnspecified, EnvironmentNewResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceGenerated, EnvironmentNewResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceDiscovered, EnvironmentNewResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceSpecified: + case EnvironmentStatusDevcontainerDevcontainerFilePresencePresenceUnspecified, EnvironmentStatusDevcontainerDevcontainerFilePresencePresenceGenerated, EnvironmentStatusDevcontainerDevcontainerFilePresencePresenceDiscovered, EnvironmentStatusDevcontainerDevcontainerFilePresencePresenceSpecified: return true } return false } // phase is the current phase of the devcontainer -type EnvironmentNewResponseEnvironmentStatusDevcontainerPhase string +type EnvironmentStatusDevcontainerPhase string const ( - EnvironmentNewResponseEnvironmentStatusDevcontainerPhasePhaseUnspecified EnvironmentNewResponseEnvironmentStatusDevcontainerPhase = "PHASE_UNSPECIFIED" - EnvironmentNewResponseEnvironmentStatusDevcontainerPhasePhaseCreating EnvironmentNewResponseEnvironmentStatusDevcontainerPhase = "PHASE_CREATING" - EnvironmentNewResponseEnvironmentStatusDevcontainerPhasePhaseRunning EnvironmentNewResponseEnvironmentStatusDevcontainerPhase = "PHASE_RUNNING" - EnvironmentNewResponseEnvironmentStatusDevcontainerPhasePhaseStopped EnvironmentNewResponseEnvironmentStatusDevcontainerPhase = "PHASE_STOPPED" - EnvironmentNewResponseEnvironmentStatusDevcontainerPhasePhaseFailed EnvironmentNewResponseEnvironmentStatusDevcontainerPhase = "PHASE_FAILED" + EnvironmentStatusDevcontainerPhasePhaseUnspecified EnvironmentStatusDevcontainerPhase = "PHASE_UNSPECIFIED" + EnvironmentStatusDevcontainerPhasePhaseCreating EnvironmentStatusDevcontainerPhase = "PHASE_CREATING" + EnvironmentStatusDevcontainerPhasePhaseRunning EnvironmentStatusDevcontainerPhase = "PHASE_RUNNING" + EnvironmentStatusDevcontainerPhasePhaseStopped EnvironmentStatusDevcontainerPhase = "PHASE_STOPPED" + EnvironmentStatusDevcontainerPhasePhaseFailed EnvironmentStatusDevcontainerPhase = "PHASE_FAILED" ) -func (r EnvironmentNewResponseEnvironmentStatusDevcontainerPhase) IsKnown() bool { +func (r EnvironmentStatusDevcontainerPhase) IsKnown() bool { switch r { - case EnvironmentNewResponseEnvironmentStatusDevcontainerPhasePhaseUnspecified, EnvironmentNewResponseEnvironmentStatusDevcontainerPhasePhaseCreating, EnvironmentNewResponseEnvironmentStatusDevcontainerPhasePhaseRunning, EnvironmentNewResponseEnvironmentStatusDevcontainerPhasePhaseStopped, EnvironmentNewResponseEnvironmentStatusDevcontainerPhasePhaseFailed: + case EnvironmentStatusDevcontainerPhasePhaseUnspecified, EnvironmentStatusDevcontainerPhasePhaseCreating, EnvironmentStatusDevcontainerPhasePhaseRunning, EnvironmentStatusDevcontainerPhasePhaseStopped, EnvironmentStatusDevcontainerPhasePhaseFailed: return true } return false @@ -1727,18 +1639,18 @@ func (r EnvironmentNewResponseEnvironmentStatusDevcontainerPhase) IsKnown() bool // environment_url contains the URL at which the environment can be accessed. This // field is only set if the environment is running. -type EnvironmentNewResponseEnvironmentStatusEnvironmentURLs struct { +type EnvironmentStatusEnvironmentURLs struct { // logs is the URL at which the environment logs can be accessed. - Logs string `json:"logs"` - Ports []EnvironmentNewResponseEnvironmentStatusEnvironmentURLsPort `json:"ports"` + Logs string `json:"logs"` + Ports []EnvironmentStatusEnvironmentURLsPort `json:"ports"` // SSH is the URL at which the environment can be accessed via SSH. - SSH EnvironmentNewResponseEnvironmentStatusEnvironmentURLsSSH `json:"ssh"` - JSON environmentNewResponseEnvironmentStatusEnvironmentURLsJSON `json:"-"` + SSH EnvironmentStatusEnvironmentURLsSSH `json:"ssh"` + JSON environmentStatusEnvironmentURLsJSON `json:"-"` } -// environmentNewResponseEnvironmentStatusEnvironmentURLsJSON contains the JSON -// metadata for the struct [EnvironmentNewResponseEnvironmentStatusEnvironmentURLs] -type environmentNewResponseEnvironmentStatusEnvironmentURLsJSON struct { +// environmentStatusEnvironmentURLsJSON contains the JSON metadata for the struct +// [EnvironmentStatusEnvironmentURLs] +type environmentStatusEnvironmentURLsJSON struct { Logs apijson.Field Ports apijson.Field SSH apijson.Field @@ -1746,85 +1658,83 @@ type environmentNewResponseEnvironmentStatusEnvironmentURLsJSON struct { ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironmentStatusEnvironmentURLs) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentStatusEnvironmentURLs) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentStatusEnvironmentURLsJSON) RawJSON() string { +func (r environmentStatusEnvironmentURLsJSON) RawJSON() string { return r.raw } -type EnvironmentNewResponseEnvironmentStatusEnvironmentURLsPort struct { +type EnvironmentStatusEnvironmentURLsPort struct { // port is the port number of the environment port Port int64 `json:"port"` // url is the URL at which the environment port can be accessed - URL string `json:"url"` - JSON environmentNewResponseEnvironmentStatusEnvironmentURLsPortJSON `json:"-"` + URL string `json:"url"` + JSON environmentStatusEnvironmentURLsPortJSON `json:"-"` } -// environmentNewResponseEnvironmentStatusEnvironmentURLsPortJSON contains the JSON -// metadata for the struct -// [EnvironmentNewResponseEnvironmentStatusEnvironmentURLsPort] -type environmentNewResponseEnvironmentStatusEnvironmentURLsPortJSON struct { +// environmentStatusEnvironmentURLsPortJSON contains the JSON metadata for the +// struct [EnvironmentStatusEnvironmentURLsPort] +type environmentStatusEnvironmentURLsPortJSON struct { Port apijson.Field URL apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironmentStatusEnvironmentURLsPort) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentStatusEnvironmentURLsPort) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentStatusEnvironmentURLsPortJSON) RawJSON() string { +func (r environmentStatusEnvironmentURLsPortJSON) RawJSON() string { return r.raw } // SSH is the URL at which the environment can be accessed via SSH. -type EnvironmentNewResponseEnvironmentStatusEnvironmentURLsSSH struct { - URL string `json:"url"` - JSON environmentNewResponseEnvironmentStatusEnvironmentURLsSSHJSON `json:"-"` +type EnvironmentStatusEnvironmentURLsSSH struct { + URL string `json:"url"` + JSON environmentStatusEnvironmentURLsSSHJSON `json:"-"` } -// environmentNewResponseEnvironmentStatusEnvironmentURLsSSHJSON contains the JSON -// metadata for the struct -// [EnvironmentNewResponseEnvironmentStatusEnvironmentURLsSSH] -type environmentNewResponseEnvironmentStatusEnvironmentURLsSSHJSON struct { +// environmentStatusEnvironmentURLsSSHJSON contains the JSON metadata for the +// struct [EnvironmentStatusEnvironmentURLsSSH] +type environmentStatusEnvironmentURLsSSHJSON struct { URL apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironmentStatusEnvironmentURLsSSH) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentStatusEnvironmentURLsSSH) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentStatusEnvironmentURLsSSHJSON) RawJSON() string { +func (r environmentStatusEnvironmentURLsSSHJSON) RawJSON() string { return r.raw } // machine contains the status of the environment machine -type EnvironmentNewResponseEnvironmentStatusMachine struct { +type EnvironmentStatusMachine struct { // failure_message contains the reason the machine failed to operate. FailureMessage string `json:"failureMessage"` // phase is the current phase of the environment machine - Phase EnvironmentNewResponseEnvironmentStatusMachinePhase `json:"phase"` + Phase EnvironmentStatusMachinePhase `json:"phase"` // session is the session that is currently active in the machine. Session string `json:"session"` // timeout contains the reason the environment has timed out. If this field is // empty, the environment has not timed out. Timeout string `json:"timeout"` // versions contains the versions of components in the machine. - Versions EnvironmentNewResponseEnvironmentStatusMachineVersions `json:"versions"` + Versions EnvironmentStatusMachineVersions `json:"versions"` // warning_message contains warnings, e.g. when the machine is present but not in // the expected state. - WarningMessage string `json:"warningMessage"` - JSON environmentNewResponseEnvironmentStatusMachineJSON `json:"-"` + WarningMessage string `json:"warningMessage"` + JSON environmentStatusMachineJSON `json:"-"` } -// environmentNewResponseEnvironmentStatusMachineJSON contains the JSON metadata -// for the struct [EnvironmentNewResponseEnvironmentStatusMachine] -type environmentNewResponseEnvironmentStatusMachineJSON struct { +// environmentStatusMachineJSON contains the JSON metadata for the struct +// [EnvironmentStatusMachine] +type environmentStatusMachineJSON struct { FailureMessage apijson.Field Phase apijson.Field Session apijson.Field @@ -1835,96 +1745,72 @@ type environmentNewResponseEnvironmentStatusMachineJSON struct { ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironmentStatusMachine) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentStatusMachine) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentStatusMachineJSON) RawJSON() string { +func (r environmentStatusMachineJSON) RawJSON() string { return r.raw } // phase is the current phase of the environment machine -type EnvironmentNewResponseEnvironmentStatusMachinePhase string +type EnvironmentStatusMachinePhase string const ( - EnvironmentNewResponseEnvironmentStatusMachinePhasePhaseUnspecified EnvironmentNewResponseEnvironmentStatusMachinePhase = "PHASE_UNSPECIFIED" - EnvironmentNewResponseEnvironmentStatusMachinePhasePhaseCreating EnvironmentNewResponseEnvironmentStatusMachinePhase = "PHASE_CREATING" - EnvironmentNewResponseEnvironmentStatusMachinePhasePhaseStarting EnvironmentNewResponseEnvironmentStatusMachinePhase = "PHASE_STARTING" - EnvironmentNewResponseEnvironmentStatusMachinePhasePhaseRunning EnvironmentNewResponseEnvironmentStatusMachinePhase = "PHASE_RUNNING" - EnvironmentNewResponseEnvironmentStatusMachinePhasePhaseStopping EnvironmentNewResponseEnvironmentStatusMachinePhase = "PHASE_STOPPING" - EnvironmentNewResponseEnvironmentStatusMachinePhasePhaseStopped EnvironmentNewResponseEnvironmentStatusMachinePhase = "PHASE_STOPPED" - EnvironmentNewResponseEnvironmentStatusMachinePhasePhaseDeleting EnvironmentNewResponseEnvironmentStatusMachinePhase = "PHASE_DELETING" - EnvironmentNewResponseEnvironmentStatusMachinePhasePhaseDeleted EnvironmentNewResponseEnvironmentStatusMachinePhase = "PHASE_DELETED" + EnvironmentStatusMachinePhasePhaseUnspecified EnvironmentStatusMachinePhase = "PHASE_UNSPECIFIED" + EnvironmentStatusMachinePhasePhaseCreating EnvironmentStatusMachinePhase = "PHASE_CREATING" + EnvironmentStatusMachinePhasePhaseStarting EnvironmentStatusMachinePhase = "PHASE_STARTING" + EnvironmentStatusMachinePhasePhaseRunning EnvironmentStatusMachinePhase = "PHASE_RUNNING" + EnvironmentStatusMachinePhasePhaseStopping EnvironmentStatusMachinePhase = "PHASE_STOPPING" + EnvironmentStatusMachinePhasePhaseStopped EnvironmentStatusMachinePhase = "PHASE_STOPPED" + EnvironmentStatusMachinePhasePhaseDeleting EnvironmentStatusMachinePhase = "PHASE_DELETING" + EnvironmentStatusMachinePhasePhaseDeleted EnvironmentStatusMachinePhase = "PHASE_DELETED" ) -func (r EnvironmentNewResponseEnvironmentStatusMachinePhase) IsKnown() bool { +func (r EnvironmentStatusMachinePhase) IsKnown() bool { switch r { - case EnvironmentNewResponseEnvironmentStatusMachinePhasePhaseUnspecified, EnvironmentNewResponseEnvironmentStatusMachinePhasePhaseCreating, EnvironmentNewResponseEnvironmentStatusMachinePhasePhaseStarting, EnvironmentNewResponseEnvironmentStatusMachinePhasePhaseRunning, EnvironmentNewResponseEnvironmentStatusMachinePhasePhaseStopping, EnvironmentNewResponseEnvironmentStatusMachinePhasePhaseStopped, EnvironmentNewResponseEnvironmentStatusMachinePhasePhaseDeleting, EnvironmentNewResponseEnvironmentStatusMachinePhasePhaseDeleted: + case EnvironmentStatusMachinePhasePhaseUnspecified, EnvironmentStatusMachinePhasePhaseCreating, EnvironmentStatusMachinePhasePhaseStarting, EnvironmentStatusMachinePhasePhaseRunning, EnvironmentStatusMachinePhasePhaseStopping, EnvironmentStatusMachinePhasePhaseStopped, EnvironmentStatusMachinePhasePhaseDeleting, EnvironmentStatusMachinePhasePhaseDeleted: return true } return false } // versions contains the versions of components in the machine. -type EnvironmentNewResponseEnvironmentStatusMachineVersions struct { - SupervisorCommit string `json:"supervisorCommit"` - SupervisorVersion string `json:"supervisorVersion"` - JSON environmentNewResponseEnvironmentStatusMachineVersionsJSON `json:"-"` +type EnvironmentStatusMachineVersions struct { + SupervisorCommit string `json:"supervisorCommit"` + SupervisorVersion string `json:"supervisorVersion"` + JSON environmentStatusMachineVersionsJSON `json:"-"` } -// environmentNewResponseEnvironmentStatusMachineVersionsJSON contains the JSON -// metadata for the struct [EnvironmentNewResponseEnvironmentStatusMachineVersions] -type environmentNewResponseEnvironmentStatusMachineVersionsJSON struct { +// environmentStatusMachineVersionsJSON contains the JSON metadata for the struct +// [EnvironmentStatusMachineVersions] +type environmentStatusMachineVersionsJSON struct { SupervisorCommit apijson.Field SupervisorVersion apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironmentStatusMachineVersions) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentStatusMachineVersions) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentStatusMachineVersionsJSON) RawJSON() string { +func (r environmentStatusMachineVersionsJSON) RawJSON() string { return r.raw } -// the phase of an environment is a simple, high-level summary of where the -// environment is in its lifecycle -type EnvironmentNewResponseEnvironmentStatusPhase string - -const ( - EnvironmentNewResponseEnvironmentStatusPhaseEnvironmentPhaseUnspecified EnvironmentNewResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_UNSPECIFIED" - EnvironmentNewResponseEnvironmentStatusPhaseEnvironmentPhaseCreating EnvironmentNewResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_CREATING" - EnvironmentNewResponseEnvironmentStatusPhaseEnvironmentPhaseStarting EnvironmentNewResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_STARTING" - EnvironmentNewResponseEnvironmentStatusPhaseEnvironmentPhaseRunning EnvironmentNewResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_RUNNING" - EnvironmentNewResponseEnvironmentStatusPhaseEnvironmentPhaseUpdating EnvironmentNewResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_UPDATING" - EnvironmentNewResponseEnvironmentStatusPhaseEnvironmentPhaseStopping EnvironmentNewResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_STOPPING" - EnvironmentNewResponseEnvironmentStatusPhaseEnvironmentPhaseStopped EnvironmentNewResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_STOPPED" - EnvironmentNewResponseEnvironmentStatusPhaseEnvironmentPhaseDeleting EnvironmentNewResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_DELETING" - EnvironmentNewResponseEnvironmentStatusPhaseEnvironmentPhaseDeleted EnvironmentNewResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_DELETED" -) - -func (r EnvironmentNewResponseEnvironmentStatusPhase) IsKnown() bool { - switch r { - case EnvironmentNewResponseEnvironmentStatusPhaseEnvironmentPhaseUnspecified, EnvironmentNewResponseEnvironmentStatusPhaseEnvironmentPhaseCreating, EnvironmentNewResponseEnvironmentStatusPhaseEnvironmentPhaseStarting, EnvironmentNewResponseEnvironmentStatusPhaseEnvironmentPhaseRunning, EnvironmentNewResponseEnvironmentStatusPhaseEnvironmentPhaseUpdating, EnvironmentNewResponseEnvironmentStatusPhaseEnvironmentPhaseStopping, EnvironmentNewResponseEnvironmentStatusPhaseEnvironmentPhaseStopped, EnvironmentNewResponseEnvironmentStatusPhaseEnvironmentPhaseDeleting, EnvironmentNewResponseEnvironmentStatusPhaseEnvironmentPhaseDeleted: - return true - } - return false -} - // RunnerACK is the acknowledgement from the runner that is has received the // environment spec. -type EnvironmentNewResponseEnvironmentStatusRunnerAck struct { - Message string `json:"message"` - SpecVersion string `json:"specVersion"` - StatusCode EnvironmentNewResponseEnvironmentStatusRunnerAckStatusCode `json:"statusCode"` - JSON environmentNewResponseEnvironmentStatusRunnerAckJSON `json:"-"` +type EnvironmentStatusRunnerAck struct { + Message string `json:"message"` + SpecVersion string `json:"specVersion"` + StatusCode EnvironmentStatusRunnerAckStatusCode `json:"statusCode"` + JSON environmentStatusRunnerAckJSON `json:"-"` } -// environmentNewResponseEnvironmentStatusRunnerAckJSON contains the JSON metadata -// for the struct [EnvironmentNewResponseEnvironmentStatusRunnerAck] -type environmentNewResponseEnvironmentStatusRunnerAckJSON struct { +// environmentStatusRunnerAckJSON contains the JSON metadata for the struct +// [EnvironmentStatusRunnerAck] +type environmentStatusRunnerAckJSON struct { Message apijson.Field SpecVersion apijson.Field StatusCode apijson.Field @@ -1932,47 +1818,47 @@ type environmentNewResponseEnvironmentStatusRunnerAckJSON struct { ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironmentStatusRunnerAck) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentStatusRunnerAck) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentStatusRunnerAckJSON) RawJSON() string { +func (r environmentStatusRunnerAckJSON) RawJSON() string { return r.raw } -type EnvironmentNewResponseEnvironmentStatusRunnerAckStatusCode string +type EnvironmentStatusRunnerAckStatusCode string const ( - EnvironmentNewResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeUnspecified EnvironmentNewResponseEnvironmentStatusRunnerAckStatusCode = "STATUS_CODE_UNSPECIFIED" - EnvironmentNewResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeOk EnvironmentNewResponseEnvironmentStatusRunnerAckStatusCode = "STATUS_CODE_OK" - EnvironmentNewResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeInvalidResource EnvironmentNewResponseEnvironmentStatusRunnerAckStatusCode = "STATUS_CODE_INVALID_RESOURCE" - EnvironmentNewResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeFailedPrecondition EnvironmentNewResponseEnvironmentStatusRunnerAckStatusCode = "STATUS_CODE_FAILED_PRECONDITION" + EnvironmentStatusRunnerAckStatusCodeStatusCodeUnspecified EnvironmentStatusRunnerAckStatusCode = "STATUS_CODE_UNSPECIFIED" + EnvironmentStatusRunnerAckStatusCodeStatusCodeOk EnvironmentStatusRunnerAckStatusCode = "STATUS_CODE_OK" + EnvironmentStatusRunnerAckStatusCodeStatusCodeInvalidResource EnvironmentStatusRunnerAckStatusCode = "STATUS_CODE_INVALID_RESOURCE" + EnvironmentStatusRunnerAckStatusCodeStatusCodeFailedPrecondition EnvironmentStatusRunnerAckStatusCode = "STATUS_CODE_FAILED_PRECONDITION" ) -func (r EnvironmentNewResponseEnvironmentStatusRunnerAckStatusCode) IsKnown() bool { +func (r EnvironmentStatusRunnerAckStatusCode) IsKnown() bool { switch r { - case EnvironmentNewResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeUnspecified, EnvironmentNewResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeOk, EnvironmentNewResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeInvalidResource, EnvironmentNewResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeFailedPrecondition: + case EnvironmentStatusRunnerAckStatusCodeStatusCodeUnspecified, EnvironmentStatusRunnerAckStatusCodeStatusCodeOk, EnvironmentStatusRunnerAckStatusCodeStatusCodeInvalidResource, EnvironmentStatusRunnerAckStatusCodeStatusCodeFailedPrecondition: return true } return false } -type EnvironmentNewResponseEnvironmentStatusSecret struct { +type EnvironmentStatusSecret struct { // failure_message contains the reason the secret failed to be materialize. - FailureMessage string `json:"failureMessage"` - Phase EnvironmentNewResponseEnvironmentStatusSecretsPhase `json:"phase"` - SecretName string `json:"secretName"` + FailureMessage string `json:"failureMessage"` + Phase EnvironmentStatusSecretsPhase `json:"phase"` + SecretName string `json:"secretName"` // session is the session that is currently active in the environment. Session string `json:"session"` // warning_message contains warnings, e.g. when the secret is present but not in // the expected state. - WarningMessage string `json:"warningMessage"` - JSON environmentNewResponseEnvironmentStatusSecretJSON `json:"-"` + WarningMessage string `json:"warningMessage"` + JSON environmentStatusSecretJSON `json:"-"` } -// environmentNewResponseEnvironmentStatusSecretJSON contains the JSON metadata for -// the struct [EnvironmentNewResponseEnvironmentStatusSecret] -type environmentNewResponseEnvironmentStatusSecretJSON struct { +// environmentStatusSecretJSON contains the JSON metadata for the struct +// [EnvironmentStatusSecret] +type environmentStatusSecretJSON struct { FailureMessage apijson.Field Phase apijson.Field SecretName apijson.Field @@ -1982,82 +1868,104 @@ type environmentNewResponseEnvironmentStatusSecretJSON struct { ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironmentStatusSecret) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentStatusSecret) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentStatusSecretJSON) RawJSON() string { +func (r environmentStatusSecretJSON) RawJSON() string { return r.raw } -type EnvironmentNewResponseEnvironmentStatusSecretsPhase string +type EnvironmentStatusSecretsPhase string const ( - EnvironmentNewResponseEnvironmentStatusSecretsPhaseContentPhaseUnspecified EnvironmentNewResponseEnvironmentStatusSecretsPhase = "CONTENT_PHASE_UNSPECIFIED" - EnvironmentNewResponseEnvironmentStatusSecretsPhaseContentPhaseCreating EnvironmentNewResponseEnvironmentStatusSecretsPhase = "CONTENT_PHASE_CREATING" - EnvironmentNewResponseEnvironmentStatusSecretsPhaseContentPhaseInitializing EnvironmentNewResponseEnvironmentStatusSecretsPhase = "CONTENT_PHASE_INITIALIZING" - EnvironmentNewResponseEnvironmentStatusSecretsPhaseContentPhaseReady EnvironmentNewResponseEnvironmentStatusSecretsPhase = "CONTENT_PHASE_READY" - EnvironmentNewResponseEnvironmentStatusSecretsPhaseContentPhaseUpdating EnvironmentNewResponseEnvironmentStatusSecretsPhase = "CONTENT_PHASE_UPDATING" - EnvironmentNewResponseEnvironmentStatusSecretsPhaseContentPhaseFailed EnvironmentNewResponseEnvironmentStatusSecretsPhase = "CONTENT_PHASE_FAILED" + EnvironmentStatusSecretsPhaseContentPhaseUnspecified EnvironmentStatusSecretsPhase = "CONTENT_PHASE_UNSPECIFIED" + EnvironmentStatusSecretsPhaseContentPhaseCreating EnvironmentStatusSecretsPhase = "CONTENT_PHASE_CREATING" + EnvironmentStatusSecretsPhaseContentPhaseInitializing EnvironmentStatusSecretsPhase = "CONTENT_PHASE_INITIALIZING" + EnvironmentStatusSecretsPhaseContentPhaseReady EnvironmentStatusSecretsPhase = "CONTENT_PHASE_READY" + EnvironmentStatusSecretsPhaseContentPhaseUpdating EnvironmentStatusSecretsPhase = "CONTENT_PHASE_UPDATING" + EnvironmentStatusSecretsPhaseContentPhaseFailed EnvironmentStatusSecretsPhase = "CONTENT_PHASE_FAILED" ) -func (r EnvironmentNewResponseEnvironmentStatusSecretsPhase) IsKnown() bool { +func (r EnvironmentStatusSecretsPhase) IsKnown() bool { switch r { - case EnvironmentNewResponseEnvironmentStatusSecretsPhaseContentPhaseUnspecified, EnvironmentNewResponseEnvironmentStatusSecretsPhaseContentPhaseCreating, EnvironmentNewResponseEnvironmentStatusSecretsPhaseContentPhaseInitializing, EnvironmentNewResponseEnvironmentStatusSecretsPhaseContentPhaseReady, EnvironmentNewResponseEnvironmentStatusSecretsPhaseContentPhaseUpdating, EnvironmentNewResponseEnvironmentStatusSecretsPhaseContentPhaseFailed: + case EnvironmentStatusSecretsPhaseContentPhaseUnspecified, EnvironmentStatusSecretsPhaseContentPhaseCreating, EnvironmentStatusSecretsPhaseContentPhaseInitializing, EnvironmentStatusSecretsPhaseContentPhaseReady, EnvironmentStatusSecretsPhaseContentPhaseUpdating, EnvironmentStatusSecretsPhaseContentPhaseFailed: return true } return false } -type EnvironmentNewResponseEnvironmentStatusSSHPublicKey struct { +type EnvironmentStatusSSHPublicKey struct { // id is the unique identifier of the public key ID string `json:"id"` // phase is the current phase of the public key - Phase EnvironmentNewResponseEnvironmentStatusSSHPublicKeysPhase `json:"phase"` - JSON environmentNewResponseEnvironmentStatusSSHPublicKeyJSON `json:"-"` + Phase EnvironmentStatusSSHPublicKeysPhase `json:"phase"` + JSON environmentStatusSSHPublicKeyJSON `json:"-"` } -// environmentNewResponseEnvironmentStatusSSHPublicKeyJSON contains the JSON -// metadata for the struct [EnvironmentNewResponseEnvironmentStatusSSHPublicKey] -type environmentNewResponseEnvironmentStatusSSHPublicKeyJSON struct { +// environmentStatusSSHPublicKeyJSON contains the JSON metadata for the struct +// [EnvironmentStatusSSHPublicKey] +type environmentStatusSSHPublicKeyJSON struct { ID apijson.Field Phase apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *EnvironmentNewResponseEnvironmentStatusSSHPublicKey) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentStatusSSHPublicKey) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentNewResponseEnvironmentStatusSSHPublicKeyJSON) RawJSON() string { +func (r environmentStatusSSHPublicKeyJSON) RawJSON() string { return r.raw } // phase is the current phase of the public key -type EnvironmentNewResponseEnvironmentStatusSSHPublicKeysPhase string +type EnvironmentStatusSSHPublicKeysPhase string const ( - EnvironmentNewResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseUnspecified EnvironmentNewResponseEnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_UNSPECIFIED" - EnvironmentNewResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseCreating EnvironmentNewResponseEnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_CREATING" - EnvironmentNewResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseInitializing EnvironmentNewResponseEnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_INITIALIZING" - EnvironmentNewResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseReady EnvironmentNewResponseEnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_READY" - EnvironmentNewResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseUpdating EnvironmentNewResponseEnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_UPDATING" - EnvironmentNewResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseFailed EnvironmentNewResponseEnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_FAILED" + EnvironmentStatusSSHPublicKeysPhaseContentPhaseUnspecified EnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_UNSPECIFIED" + EnvironmentStatusSSHPublicKeysPhaseContentPhaseCreating EnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_CREATING" + EnvironmentStatusSSHPublicKeysPhaseContentPhaseInitializing EnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_INITIALIZING" + EnvironmentStatusSSHPublicKeysPhaseContentPhaseReady EnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_READY" + EnvironmentStatusSSHPublicKeysPhaseContentPhaseUpdating EnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_UPDATING" + EnvironmentStatusSSHPublicKeysPhaseContentPhaseFailed EnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_FAILED" ) -func (r EnvironmentNewResponseEnvironmentStatusSSHPublicKeysPhase) IsKnown() bool { +func (r EnvironmentStatusSSHPublicKeysPhase) IsKnown() bool { switch r { - case EnvironmentNewResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseUnspecified, EnvironmentNewResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseCreating, EnvironmentNewResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseInitializing, EnvironmentNewResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseReady, EnvironmentNewResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseUpdating, EnvironmentNewResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseFailed: + case EnvironmentStatusSSHPublicKeysPhaseContentPhaseUnspecified, EnvironmentStatusSSHPublicKeysPhaseContentPhaseCreating, EnvironmentStatusSSHPublicKeysPhaseContentPhaseInitializing, EnvironmentStatusSSHPublicKeysPhaseContentPhaseReady, EnvironmentStatusSSHPublicKeysPhaseContentPhaseUpdating, EnvironmentStatusSSHPublicKeysPhaseContentPhaseFailed: return true } return false } +type EnvironmentNewResponse struct { + // +resource get environment + Environment Environment `json:"environment"` + JSON environmentNewResponseJSON `json:"-"` +} + +// environmentNewResponseJSON contains the JSON metadata for the struct +// [EnvironmentNewResponse] +type environmentNewResponseJSON struct { + Environment apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *EnvironmentNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r environmentNewResponseJSON) RawJSON() string { + return r.raw +} + type EnvironmentGetResponse struct { // +resource get environment - Environment EnvironmentGetResponseEnvironment `json:"environment"` - JSON environmentGetResponseJSON `json:"-"` + Environment Environment `json:"environment"` + JSON environmentGetResponseJSON `json:"-"` } // environmentGetResponseJSON contains the JSON metadata for the struct @@ -2076,7058 +1984,185 @@ func (r environmentGetResponseJSON) RawJSON() string { return r.raw } -// +resource get environment -type EnvironmentGetResponseEnvironment struct { - // ID is a unique identifier of this environment. No other environment with the - // same name must be managed by this environment manager - ID string `json:"id"` - // EnvironmentMetadata is data associated with an environment that's required for - // other parts of the system to function - Metadata EnvironmentGetResponseEnvironmentMetadata `json:"metadata"` - // EnvironmentSpec specifies the configuration of an environment for an environment - // start - Spec EnvironmentGetResponseEnvironmentSpec `json:"spec"` - // EnvironmentStatus describes an environment status - Status EnvironmentGetResponseEnvironmentStatus `json:"status"` - JSON environmentGetResponseEnvironmentJSON `json:"-"` -} - -// environmentGetResponseEnvironmentJSON contains the JSON metadata for the struct -// [EnvironmentGetResponseEnvironment] -type environmentGetResponseEnvironmentJSON struct { - ID apijson.Field - Metadata apijson.Field - Spec apijson.Field - Status apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironment) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentJSON) RawJSON() string { - return r.raw -} - -// EnvironmentMetadata is data associated with an environment that's required for -// other parts of the system to function -type EnvironmentGetResponseEnvironmentMetadata struct { - // annotations are key/value pairs that gets attached to the environment. - // +internal - not yet implemented - Annotations map[string]string `json:"annotations"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - CreatedAt time.Time `json:"createdAt" format:"date-time"` - // creator is the identity of the creator of the environment - Creator EnvironmentGetResponseEnvironmentMetadataCreator `json:"creator"` - // 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. - LastStartedAt time.Time `json:"lastStartedAt" format:"date-time"` - // name is the name of the environment as specified by the user - Name string `json:"name"` - // organization_id is the ID of the organization that contains the environment - OrganizationID string `json:"organizationId" format:"uuid"` - // original_context_url is the normalized URL from which the environment was - // created - OriginalContextURL string `json:"originalContextUrl"` - // If the Environment was started from a project, the project_id will reference the - // project. - ProjectID string `json:"projectId"` - // Runner is the ID of the runner that runs this environment. - RunnerID string `json:"runnerId"` - JSON environmentGetResponseEnvironmentMetadataJSON `json:"-"` -} - -// environmentGetResponseEnvironmentMetadataJSON contains the JSON metadata for the -// struct [EnvironmentGetResponseEnvironmentMetadata] -type environmentGetResponseEnvironmentMetadataJSON struct { - Annotations apijson.Field - CreatedAt apijson.Field - Creator apijson.Field - LastStartedAt apijson.Field - Name apijson.Field - OrganizationID apijson.Field - OriginalContextURL apijson.Field - ProjectID apijson.Field - RunnerID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentMetadata) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentMetadataJSON) RawJSON() string { - return r.raw -} - -// creator is the identity of the creator of the environment -type EnvironmentGetResponseEnvironmentMetadataCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal EnvironmentGetResponseEnvironmentMetadataCreatorPrincipal `json:"principal"` - JSON environmentGetResponseEnvironmentMetadataCreatorJSON `json:"-"` -} - -// environmentGetResponseEnvironmentMetadataCreatorJSON contains the JSON metadata -// for the struct [EnvironmentGetResponseEnvironmentMetadataCreator] -type environmentGetResponseEnvironmentMetadataCreatorJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentMetadataCreator) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentMetadataCreatorJSON) RawJSON() string { - return r.raw -} - -// Principal is the principal of the subject -type EnvironmentGetResponseEnvironmentMetadataCreatorPrincipal string - -const ( - EnvironmentGetResponseEnvironmentMetadataCreatorPrincipalPrincipalUnspecified EnvironmentGetResponseEnvironmentMetadataCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - EnvironmentGetResponseEnvironmentMetadataCreatorPrincipalPrincipalAccount EnvironmentGetResponseEnvironmentMetadataCreatorPrincipal = "PRINCIPAL_ACCOUNT" - EnvironmentGetResponseEnvironmentMetadataCreatorPrincipalPrincipalUser EnvironmentGetResponseEnvironmentMetadataCreatorPrincipal = "PRINCIPAL_USER" - EnvironmentGetResponseEnvironmentMetadataCreatorPrincipalPrincipalRunner EnvironmentGetResponseEnvironmentMetadataCreatorPrincipal = "PRINCIPAL_RUNNER" - EnvironmentGetResponseEnvironmentMetadataCreatorPrincipalPrincipalEnvironment EnvironmentGetResponseEnvironmentMetadataCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - EnvironmentGetResponseEnvironmentMetadataCreatorPrincipalPrincipalServiceAccount EnvironmentGetResponseEnvironmentMetadataCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r EnvironmentGetResponseEnvironmentMetadataCreatorPrincipal) IsKnown() bool { - switch r { - case EnvironmentGetResponseEnvironmentMetadataCreatorPrincipalPrincipalUnspecified, EnvironmentGetResponseEnvironmentMetadataCreatorPrincipalPrincipalAccount, EnvironmentGetResponseEnvironmentMetadataCreatorPrincipalPrincipalUser, EnvironmentGetResponseEnvironmentMetadataCreatorPrincipalPrincipalRunner, EnvironmentGetResponseEnvironmentMetadataCreatorPrincipalPrincipalEnvironment, EnvironmentGetResponseEnvironmentMetadataCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - -// EnvironmentSpec specifies the configuration of an environment for an environment -// start -type EnvironmentGetResponseEnvironmentSpec struct { - // Admission level describes who can access an environment instance and its ports. - Admission EnvironmentGetResponseEnvironmentSpecAdmission `json:"admission"` - // automations_file is the automations file spec of the environment - AutomationsFile EnvironmentGetResponseEnvironmentSpecAutomationsFile `json:"automationsFile"` - // content is the content spec of the environment - Content EnvironmentGetResponseEnvironmentSpecContent `json:"content"` - // Phase is the desired phase of the environment - DesiredPhase EnvironmentGetResponseEnvironmentSpecDesiredPhase `json:"desiredPhase"` - // devcontainer is the devcontainer spec of the environment - Devcontainer EnvironmentGetResponseEnvironmentSpecDevcontainer `json:"devcontainer"` - // machine is the machine spec of the environment - Machine EnvironmentGetResponseEnvironmentSpecMachine `json:"machine"` - // ports is the set of ports which ought to be exposed to the internet - Ports []EnvironmentGetResponseEnvironmentSpecPort `json:"ports"` - // secrets are confidential data that is mounted into the environment - Secrets []EnvironmentGetResponseEnvironmentSpecSecret `json:"secrets"` - // version of the spec. The value of this field has no semantic meaning (e.g. don't - // interpret it as as a timestamp), but it can be used to impose a partial order. - // If a.spec_version < b.spec_version then a was the spec before b. - SpecVersion string `json:"specVersion"` - // ssh_public_keys are the public keys used to ssh into the environment - SSHPublicKeys []EnvironmentGetResponseEnvironmentSpecSSHPublicKey `json:"sshPublicKeys"` - // Timeout configures the environment timeout - Timeout EnvironmentGetResponseEnvironmentSpecTimeout `json:"timeout"` - JSON environmentGetResponseEnvironmentSpecJSON `json:"-"` -} - -// environmentGetResponseEnvironmentSpecJSON contains the JSON metadata for the -// struct [EnvironmentGetResponseEnvironmentSpec] -type environmentGetResponseEnvironmentSpecJSON struct { - Admission apijson.Field - AutomationsFile apijson.Field - Content apijson.Field - DesiredPhase apijson.Field - Devcontainer apijson.Field - Machine apijson.Field - Ports apijson.Field - Secrets apijson.Field - SpecVersion apijson.Field - SSHPublicKeys apijson.Field - Timeout apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentSpec) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentSpecJSON) RawJSON() string { - return r.raw -} - -// Admission level describes who can access an environment instance and its ports. -type EnvironmentGetResponseEnvironmentSpecAdmission string - -const ( - EnvironmentGetResponseEnvironmentSpecAdmissionAdmissionLevelUnspecified EnvironmentGetResponseEnvironmentSpecAdmission = "ADMISSION_LEVEL_UNSPECIFIED" - EnvironmentGetResponseEnvironmentSpecAdmissionAdmissionLevelOwnerOnly EnvironmentGetResponseEnvironmentSpecAdmission = "ADMISSION_LEVEL_OWNER_ONLY" - EnvironmentGetResponseEnvironmentSpecAdmissionAdmissionLevelEveryone EnvironmentGetResponseEnvironmentSpecAdmission = "ADMISSION_LEVEL_EVERYONE" -) - -func (r EnvironmentGetResponseEnvironmentSpecAdmission) IsKnown() bool { - switch r { - case EnvironmentGetResponseEnvironmentSpecAdmissionAdmissionLevelUnspecified, EnvironmentGetResponseEnvironmentSpecAdmissionAdmissionLevelOwnerOnly, EnvironmentGetResponseEnvironmentSpecAdmissionAdmissionLevelEveryone: - return true - } - return false -} - -// automations_file is the automations file spec of the environment -type EnvironmentGetResponseEnvironmentSpecAutomationsFile struct { - // automations_file_path is the path to the automations file that is applied in the - // environment, relative to the repo root. path must not be absolute (start with a - // /): - // - // ``` - // this.matches('^$|^[^/].*') - // ``` - AutomationsFilePath string `json:"automationsFilePath"` - Session string `json:"session"` - JSON environmentGetResponseEnvironmentSpecAutomationsFileJSON `json:"-"` -} - -// environmentGetResponseEnvironmentSpecAutomationsFileJSON contains the JSON -// metadata for the struct [EnvironmentGetResponseEnvironmentSpecAutomationsFile] -type environmentGetResponseEnvironmentSpecAutomationsFileJSON struct { - AutomationsFilePath apijson.Field - Session apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentSpecAutomationsFile) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentSpecAutomationsFileJSON) RawJSON() string { - return r.raw -} - -// content is the content spec of the environment -type EnvironmentGetResponseEnvironmentSpecContent struct { - // The Git email address - GitEmail string `json:"gitEmail"` - // The Git username - GitUsername string `json:"gitUsername"` - // EnvironmentInitializer specifies how an environment is to be initialized - Initializer EnvironmentGetResponseEnvironmentSpecContentInitializer `json:"initializer"` - Session string `json:"session"` - JSON environmentGetResponseEnvironmentSpecContentJSON `json:"-"` -} - -// environmentGetResponseEnvironmentSpecContentJSON contains the JSON metadata for -// the struct [EnvironmentGetResponseEnvironmentSpecContent] -type environmentGetResponseEnvironmentSpecContentJSON struct { - GitEmail apijson.Field - GitUsername apijson.Field - Initializer apijson.Field - Session apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentSpecContent) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentSpecContentJSON) RawJSON() string { - return r.raw -} - -// EnvironmentInitializer specifies how an environment is to be initialized -type EnvironmentGetResponseEnvironmentSpecContentInitializer struct { - Specs []EnvironmentGetResponseEnvironmentSpecContentInitializerSpec `json:"specs"` - JSON environmentGetResponseEnvironmentSpecContentInitializerJSON `json:"-"` -} - -// environmentGetResponseEnvironmentSpecContentInitializerJSON contains the JSON -// metadata for the struct -// [EnvironmentGetResponseEnvironmentSpecContentInitializer] -type environmentGetResponseEnvironmentSpecContentInitializerJSON struct { - Specs apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentSpecContentInitializer) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentSpecContentInitializerJSON) RawJSON() string { - return r.raw -} - -type EnvironmentGetResponseEnvironmentSpecContentInitializerSpec struct { - // This field can have the runtime type of - // [EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsContextURLContextURL]. - ContextURL interface{} `json:"contextUrl"` - // This field can have the runtime type of - // [EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGitGit]. - Git interface{} `json:"git"` - JSON environmentGetResponseEnvironmentSpecContentInitializerSpecJSON `json:"-"` - union EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsUnion -} - -// environmentGetResponseEnvironmentSpecContentInitializerSpecJSON contains the -// JSON metadata for the struct -// [EnvironmentGetResponseEnvironmentSpecContentInitializerSpec] -type environmentGetResponseEnvironmentSpecContentInitializerSpecJSON struct { - ContextURL apijson.Field - Git apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r environmentGetResponseEnvironmentSpecContentInitializerSpecJSON) RawJSON() string { - return r.raw -} - -func (r *EnvironmentGetResponseEnvironmentSpecContentInitializerSpec) UnmarshalJSON(data []byte) (err error) { - *r = EnvironmentGetResponseEnvironmentSpecContentInitializerSpec{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a -// [EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsUnion] interface -// which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsContextURL], -// [EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGit]. -func (r EnvironmentGetResponseEnvironmentSpecContentInitializerSpec) AsUnion() EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsUnion { - return r.union -} - -// Union satisfied by -// [EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsContextURL] or -// [EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGit]. -type EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsUnion interface { - implementsEnvironmentGetResponseEnvironmentSpecContentInitializerSpec() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsContextURL{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGit{}), - }, - ) -} - -type EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsContextURL struct { - ContextURL EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsContextURLContextURL `json:"contextUrl,required"` - JSON environmentGetResponseEnvironmentSpecContentInitializerSpecsContextURLJSON `json:"-"` -} - -// environmentGetResponseEnvironmentSpecContentInitializerSpecsContextURLJSON -// contains the JSON metadata for the struct -// [EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsContextURL] -type environmentGetResponseEnvironmentSpecContentInitializerSpecsContextURLJSON struct { - ContextURL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsContextURL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentSpecContentInitializerSpecsContextURLJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsContextURL) implementsEnvironmentGetResponseEnvironmentSpecContentInitializerSpec() { -} - -type EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsContextURLContextURL struct { - // url is the URL from which the environment is created - URL string `json:"url" format:"uri"` - JSON environmentGetResponseEnvironmentSpecContentInitializerSpecsContextURLContextURLJSON `json:"-"` -} - -// environmentGetResponseEnvironmentSpecContentInitializerSpecsContextURLContextURLJSON -// contains the JSON metadata for the struct -// [EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsContextURLContextURL] -type environmentGetResponseEnvironmentSpecContentInitializerSpecsContextURLContextURLJSON struct { - URL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsContextURLContextURL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentSpecContentInitializerSpecsContextURLContextURLJSON) RawJSON() string { - return r.raw -} - -type EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGit struct { - Git EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGitGit `json:"git,required"` - JSON environmentGetResponseEnvironmentSpecContentInitializerSpecsGitJSON `json:"-"` -} - -// environmentGetResponseEnvironmentSpecContentInitializerSpecsGitJSON contains the -// JSON metadata for the struct -// [EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGit] -type environmentGetResponseEnvironmentSpecContentInitializerSpecsGitJSON struct { - Git apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGit) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentSpecContentInitializerSpecsGitJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGit) implementsEnvironmentGetResponseEnvironmentSpecContentInitializerSpec() { -} - -type EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGitGit struct { - // a path relative to the environment root in which the code will be checked out to - CheckoutLocation string `json:"checkoutLocation"` - // the value for the clone target mode - use depends on the target mode - CloneTarget string `json:"cloneTarget"` - // remote_uri is the Git remote origin - RemoteUri string `json:"remoteUri"` - // CloneTargetMode is the target state in which we want to leave a GitEnvironment - TargetMode EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode `json:"targetMode"` - // upstream_Remote_uri is the fork upstream of a repository - UpstreamRemoteUri string `json:"upstreamRemoteUri"` - JSON environmentGetResponseEnvironmentSpecContentInitializerSpecsGitGitJSON `json:"-"` -} - -// environmentGetResponseEnvironmentSpecContentInitializerSpecsGitGitJSON contains -// the JSON metadata for the struct -// [EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGitGit] -type environmentGetResponseEnvironmentSpecContentInitializerSpecsGitGitJSON struct { - CheckoutLocation apijson.Field - CloneTarget apijson.Field - RemoteUri apijson.Field - TargetMode apijson.Field - UpstreamRemoteUri apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGitGit) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentSpecContentInitializerSpecsGitGitJSON) RawJSON() string { - return r.raw -} - -// CloneTargetMode is the target state in which we want to leave a GitEnvironment -type EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode string - -const ( - EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_UNSPECIFIED" - EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_HEAD" - EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_COMMIT" - EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_BRANCH" - EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_LOCAL_BRANCH" -) - -func (r EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode) IsKnown() bool { - switch r { - case EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified, EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead, EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit, EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch, EnvironmentGetResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch: - return true - } - return false -} - -// Phase is the desired phase of the environment -type EnvironmentGetResponseEnvironmentSpecDesiredPhase string - -const ( - EnvironmentGetResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseUnspecified EnvironmentGetResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_UNSPECIFIED" - EnvironmentGetResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseCreating EnvironmentGetResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_CREATING" - EnvironmentGetResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseStarting EnvironmentGetResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_STARTING" - EnvironmentGetResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseRunning EnvironmentGetResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_RUNNING" - EnvironmentGetResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseUpdating EnvironmentGetResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_UPDATING" - EnvironmentGetResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseStopping EnvironmentGetResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_STOPPING" - EnvironmentGetResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseStopped EnvironmentGetResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_STOPPED" - EnvironmentGetResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseDeleting EnvironmentGetResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_DELETING" - EnvironmentGetResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseDeleted EnvironmentGetResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_DELETED" -) - -func (r EnvironmentGetResponseEnvironmentSpecDesiredPhase) IsKnown() bool { - switch r { - case EnvironmentGetResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseUnspecified, EnvironmentGetResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseCreating, EnvironmentGetResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseStarting, EnvironmentGetResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseRunning, EnvironmentGetResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseUpdating, EnvironmentGetResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseStopping, EnvironmentGetResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseStopped, EnvironmentGetResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseDeleting, EnvironmentGetResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseDeleted: - return true - } - return false -} - -// devcontainer is the devcontainer spec of the environment -type EnvironmentGetResponseEnvironmentSpecDevcontainer struct { - // devcontainer_file_path is the path to the devcontainer file relative to the repo - // root path must not be absolute (start with a /): - // - // ``` - // this.matches('^$|^[^/].*') - // ``` - DevcontainerFilePath string `json:"devcontainerFilePath"` - Session string `json:"session"` - JSON environmentGetResponseEnvironmentSpecDevcontainerJSON `json:"-"` -} - -// environmentGetResponseEnvironmentSpecDevcontainerJSON contains the JSON metadata -// for the struct [EnvironmentGetResponseEnvironmentSpecDevcontainer] -type environmentGetResponseEnvironmentSpecDevcontainerJSON struct { - DevcontainerFilePath apijson.Field - Session apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentSpecDevcontainer) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentSpecDevcontainerJSON) RawJSON() string { - return r.raw -} - -// machine is the machine spec of the environment -type EnvironmentGetResponseEnvironmentSpecMachine struct { - // Class denotes the class of the environment we ought to start - Class string `json:"class" format:"uuid"` - Session string `json:"session"` - JSON environmentGetResponseEnvironmentSpecMachineJSON `json:"-"` -} - -// environmentGetResponseEnvironmentSpecMachineJSON contains the JSON metadata for -// the struct [EnvironmentGetResponseEnvironmentSpecMachine] -type environmentGetResponseEnvironmentSpecMachineJSON struct { - Class apijson.Field - Session apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentSpecMachine) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentSpecMachineJSON) RawJSON() string { - return r.raw -} - -type EnvironmentGetResponseEnvironmentSpecPort struct { - // Admission level describes who can access an environment instance and its ports. - Admission EnvironmentGetResponseEnvironmentSpecPortsAdmission `json:"admission"` - // name of this port - Name string `json:"name"` - // port number - Port int64 `json:"port"` - JSON environmentGetResponseEnvironmentSpecPortJSON `json:"-"` -} - -// environmentGetResponseEnvironmentSpecPortJSON contains the JSON metadata for the -// struct [EnvironmentGetResponseEnvironmentSpecPort] -type environmentGetResponseEnvironmentSpecPortJSON struct { - Admission apijson.Field - Name apijson.Field - Port apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentSpecPort) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentSpecPortJSON) RawJSON() string { - return r.raw -} - -// Admission level describes who can access an environment instance and its ports. -type EnvironmentGetResponseEnvironmentSpecPortsAdmission string - -const ( - EnvironmentGetResponseEnvironmentSpecPortsAdmissionAdmissionLevelUnspecified EnvironmentGetResponseEnvironmentSpecPortsAdmission = "ADMISSION_LEVEL_UNSPECIFIED" - EnvironmentGetResponseEnvironmentSpecPortsAdmissionAdmissionLevelOwnerOnly EnvironmentGetResponseEnvironmentSpecPortsAdmission = "ADMISSION_LEVEL_OWNER_ONLY" - EnvironmentGetResponseEnvironmentSpecPortsAdmissionAdmissionLevelEveryone EnvironmentGetResponseEnvironmentSpecPortsAdmission = "ADMISSION_LEVEL_EVERYONE" -) - -func (r EnvironmentGetResponseEnvironmentSpecPortsAdmission) IsKnown() bool { - switch r { - case EnvironmentGetResponseEnvironmentSpecPortsAdmissionAdmissionLevelUnspecified, EnvironmentGetResponseEnvironmentSpecPortsAdmissionAdmissionLevelOwnerOnly, EnvironmentGetResponseEnvironmentSpecPortsAdmissionAdmissionLevelEveryone: - return true - } - return false -} - -type EnvironmentGetResponseEnvironmentSpecSecret struct { - 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"` - // name is the human readable description of the secret - Name string `json:"name"` - // session indicated the current session of the secret. When the session does not - // change, secrets are not reloaded in the environment. - Session string `json:"session"` - // source is the source of the secret, for now control-plane or runner - Source string `json:"source"` - // source_ref into the source, in case of control-plane this is uuid of the secret - SourceRef string `json:"sourceRef"` - JSON environmentGetResponseEnvironmentSpecSecretJSON `json:"-"` - union EnvironmentGetResponseEnvironmentSpecSecretsUnion -} - -// environmentGetResponseEnvironmentSpecSecretJSON contains the JSON metadata for -// the struct [EnvironmentGetResponseEnvironmentSpecSecret] -type environmentGetResponseEnvironmentSpecSecretJSON 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 -} - -func (r environmentGetResponseEnvironmentSpecSecretJSON) RawJSON() string { - return r.raw -} - -func (r *EnvironmentGetResponseEnvironmentSpecSecret) UnmarshalJSON(data []byte) (err error) { - *r = EnvironmentGetResponseEnvironmentSpecSecret{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a [EnvironmentGetResponseEnvironmentSpecSecretsUnion] interface -// which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [EnvironmentGetResponseEnvironmentSpecSecretsObject], -// [EnvironmentGetResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted], -// [EnvironmentGetResponseEnvironmentSpecSecretsObject]. -func (r EnvironmentGetResponseEnvironmentSpecSecret) AsUnion() EnvironmentGetResponseEnvironmentSpecSecretsUnion { - return r.union -} - -// Union satisfied by [EnvironmentGetResponseEnvironmentSpecSecretsObject], -// [EnvironmentGetResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted] -// or [EnvironmentGetResponseEnvironmentSpecSecretsObject]. -type EnvironmentGetResponseEnvironmentSpecSecretsUnion interface { - implementsEnvironmentGetResponseEnvironmentSpecSecret() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*EnvironmentGetResponseEnvironmentSpecSecretsUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentGetResponseEnvironmentSpecSecretsObject{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentGetResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentGetResponseEnvironmentSpecSecretsObject{}), - }, - ) -} - -type EnvironmentGetResponseEnvironmentSpecSecretsObject struct { - EnvironmentVariable string `json:"environmentVariable,required"` - // name is the human readable description of the secret - Name string `json:"name"` - // session indicated the current session of the secret. When the session does not - // change, secrets are not reloaded in the environment. - Session string `json:"session"` - // source is the source of the secret, for now control-plane or runner - Source string `json:"source"` - // source_ref into the source, in case of control-plane this is uuid of the secret - SourceRef string `json:"sourceRef"` - JSON environmentGetResponseEnvironmentSpecSecretsObjectJSON `json:"-"` -} - -// environmentGetResponseEnvironmentSpecSecretsObjectJSON contains the JSON -// metadata for the struct [EnvironmentGetResponseEnvironmentSpecSecretsObject] -type environmentGetResponseEnvironmentSpecSecretsObjectJSON struct { - EnvironmentVariable apijson.Field - Name apijson.Field - Session apijson.Field - Source apijson.Field - SourceRef apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentSpecSecretsObject) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentSpecSecretsObjectJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentGetResponseEnvironmentSpecSecretsObject) implementsEnvironmentGetResponseEnvironmentSpecSecret() { -} - -type EnvironmentGetResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted struct { - // file_path is the path inside the devcontainer where the secret is mounted - FilePath string `json:"filePath,required"` - // name is the human readable description of the secret - Name string `json:"name"` - // session indicated the current session of the secret. When the session does not - // change, secrets are not reloaded in the environment. - Session string `json:"session"` - // source is the source of the secret, for now control-plane or runner - Source string `json:"source"` - // source_ref into the source, in case of control-plane this is uuid of the secret - SourceRef string `json:"sourceRef"` - JSON environmentGetResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMountedJSON `json:"-"` -} - -// environmentGetResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMountedJSON -// contains the JSON metadata for the struct -// [EnvironmentGetResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted] -type environmentGetResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMountedJSON struct { - FilePath apijson.Field - Name apijson.Field - Session apijson.Field - Source apijson.Field - SourceRef apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMountedJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentGetResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted) implementsEnvironmentGetResponseEnvironmentSpecSecret() { -} - -type EnvironmentGetResponseEnvironmentSpecSSHPublicKey struct { - // id is the unique identifier of the public key - ID string `json:"id"` - // value is the actual public key in the public key file format - Value string `json:"value"` - JSON environmentGetResponseEnvironmentSpecSSHPublicKeyJSON `json:"-"` -} - -// environmentGetResponseEnvironmentSpecSSHPublicKeyJSON contains the JSON metadata -// for the struct [EnvironmentGetResponseEnvironmentSpecSSHPublicKey] -type environmentGetResponseEnvironmentSpecSSHPublicKeyJSON struct { - ID apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentSpecSSHPublicKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentSpecSSHPublicKeyJSON) RawJSON() string { - return r.raw -} - -// Timeout configures the environment timeout -type EnvironmentGetResponseEnvironmentSpecTimeout struct { - // A Duration represents a signed, fixed-length span of time represented as a count - // of seconds and fractions of seconds at nanosecond resolution. It is independent - // of any calendar and concepts like "day" or "month". It is related to Timestamp - // in that the difference between two Timestamp values is a Duration and it can be - // added or subtracted from a Timestamp. Range is approximately +-10,000 years. - // - // # Examples - // - // Example 1: Compute Duration from two Timestamps in pseudo code. - // - // Timestamp start = ...; - // Timestamp end = ...; - // Duration duration = ...; - // - // duration.seconds = end.seconds - start.seconds; - // duration.nanos = end.nanos - start.nanos; - // - // if (duration.seconds < 0 && duration.nanos > 0) { - // duration.seconds += 1; - // duration.nanos -= 1000000000; - // } else if (duration.seconds > 0 && duration.nanos < 0) { - // duration.seconds -= 1; - // duration.nanos += 1000000000; - // } - // - // Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. - // - // Timestamp start = ...; - // Duration duration = ...; - // Timestamp end = ...; - // - // end.seconds = start.seconds + duration.seconds; - // end.nanos = start.nanos + duration.nanos; - // - // if (end.nanos < 0) { - // end.seconds -= 1; - // end.nanos += 1000000000; - // } else if (end.nanos >= 1000000000) { - // end.seconds += 1; - // end.nanos -= 1000000000; - // } - // - // Example 3: Compute Duration from datetime.timedelta in Python. - // - // td = datetime.timedelta(days=3, minutes=10) - // duration = Duration() - // duration.FromTimedelta(td) - // - // # JSON Mapping - // - // In JSON format, the Duration type is encoded as a string rather than an object, - // where the string ends in the suffix "s" (indicating seconds) and is preceded by - // the number of seconds, with nanoseconds expressed as fractional seconds. For - // example, 3 seconds with 0 nanoseconds should be encoded in JSON format as "3s", - // while 3 seconds and 1 nanosecond should be expressed in JSON format as - // "3.000000001s", and 3 seconds and 1 microsecond should be expressed in JSON - // format as "3.000001s". - Disconnected string `json:"disconnected" format:"regex"` - JSON environmentGetResponseEnvironmentSpecTimeoutJSON `json:"-"` -} - -// environmentGetResponseEnvironmentSpecTimeoutJSON contains the JSON metadata for -// the struct [EnvironmentGetResponseEnvironmentSpecTimeout] -type environmentGetResponseEnvironmentSpecTimeoutJSON struct { - Disconnected apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentSpecTimeout) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentSpecTimeoutJSON) RawJSON() string { - return r.raw -} - -// EnvironmentStatus describes an environment status -type EnvironmentGetResponseEnvironmentStatus struct { - // EnvironmentActivitySignal used to signal activity for an environment. - ActivitySignal EnvironmentGetResponseEnvironmentStatusActivitySignal `json:"activitySignal"` - // automations_file contains the status of the automations file. - AutomationsFile EnvironmentGetResponseEnvironmentStatusAutomationsFile `json:"automationsFile"` - // content contains the status of the environment content. - Content EnvironmentGetResponseEnvironmentStatusContent `json:"content"` - // devcontainer contains the status of the devcontainer. - Devcontainer EnvironmentGetResponseEnvironmentStatusDevcontainer `json:"devcontainer"` - // environment_url contains the URL at which the environment can be accessed. This - // field is only set if the environment is running. - EnvironmentURLs EnvironmentGetResponseEnvironmentStatusEnvironmentURLs `json:"environmentUrls"` - // failure_message summarises why the environment failed to operate. If this is - // non-empty the environment has failed to operate and will likely transition to a - // stopped state. - FailureMessage []string `json:"failureMessage"` - // machine contains the status of the environment machine - Machine EnvironmentGetResponseEnvironmentStatusMachine `json:"machine"` - // the phase of an environment is a simple, high-level summary of where the - // environment is in its lifecycle - Phase EnvironmentGetResponseEnvironmentStatusPhase `json:"phase"` - // RunnerACK is the acknowledgement from the runner that is has received the - // environment spec. - RunnerAck EnvironmentGetResponseEnvironmentStatusRunnerAck `json:"runnerAck"` - // secrets contains the status of the environment secrets - Secrets []EnvironmentGetResponseEnvironmentStatusSecret `json:"secrets"` - // ssh_public_keys contains the status of the environment ssh public keys - SSHPublicKeys []EnvironmentGetResponseEnvironmentStatusSSHPublicKey `json:"sshPublicKeys"` - // version of the status update. Environment instances themselves are unversioned, - // but their status has different versions. The value of this field has no semantic - // meaning (e.g. don't interpret it as as a timestamp), but it can be used to - // impose a partial order. If a.status_version < b.status_version then a was the - // status before b. - StatusVersion string `json:"statusVersion"` - // warning_message contains warnings, e.g. when the environment is present but not - // in the expected state. - WarningMessage []string `json:"warningMessage"` - JSON environmentGetResponseEnvironmentStatusJSON `json:"-"` -} - -// environmentGetResponseEnvironmentStatusJSON contains the JSON metadata for the -// struct [EnvironmentGetResponseEnvironmentStatus] -type environmentGetResponseEnvironmentStatusJSON struct { - ActivitySignal apijson.Field - AutomationsFile apijson.Field - Content apijson.Field - Devcontainer apijson.Field - EnvironmentURLs apijson.Field - FailureMessage apijson.Field - Machine apijson.Field - Phase apijson.Field - RunnerAck apijson.Field - Secrets apijson.Field - SSHPublicKeys apijson.Field - StatusVersion apijson.Field - WarningMessage apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentStatus) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentStatusJSON) RawJSON() string { - return r.raw -} - -// EnvironmentActivitySignal used to signal activity for an environment. -type EnvironmentGetResponseEnvironmentStatusActivitySignal struct { - // source of the activity signal, such as "VS Code", "SSH", or "Automations". It - // should be a human-readable string that describes the source of the activity - // signal. - Source string `json:"source"` - // 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. - Timestamp time.Time `json:"timestamp" format:"date-time"` - JSON environmentGetResponseEnvironmentStatusActivitySignalJSON `json:"-"` -} - -// environmentGetResponseEnvironmentStatusActivitySignalJSON contains the JSON -// metadata for the struct [EnvironmentGetResponseEnvironmentStatusActivitySignal] -type environmentGetResponseEnvironmentStatusActivitySignalJSON struct { - Source apijson.Field - Timestamp apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentStatusActivitySignal) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentStatusActivitySignalJSON) RawJSON() string { - return r.raw -} - -// automations_file contains the status of the automations file. -type EnvironmentGetResponseEnvironmentStatusAutomationsFile struct { - // automations_file_path is the path to the automations file relative to the repo - // root. - AutomationsFilePath string `json:"automationsFilePath"` - // automations_file_presence indicates how an automations file is present in the - // environment. - AutomationsFilePresence EnvironmentGetResponseEnvironmentStatusAutomationsFileAutomationsFilePresence `json:"automationsFilePresence"` - // failure_message contains the reason the automations file failed to be applied. - // This is only set if the phase is FAILED. - FailureMessage string `json:"failureMessage"` - // phase is the current phase of the automations file. - Phase EnvironmentGetResponseEnvironmentStatusAutomationsFilePhase `json:"phase"` - // session is the automations file session that is currently applied in the - // environment. - Session string `json:"session"` - JSON environmentGetResponseEnvironmentStatusAutomationsFileJSON `json:"-"` -} - -// environmentGetResponseEnvironmentStatusAutomationsFileJSON contains the JSON -// metadata for the struct [EnvironmentGetResponseEnvironmentStatusAutomationsFile] -type environmentGetResponseEnvironmentStatusAutomationsFileJSON struct { - AutomationsFilePath apijson.Field - AutomationsFilePresence apijson.Field - FailureMessage apijson.Field - Phase apijson.Field - Session apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentStatusAutomationsFile) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentStatusAutomationsFileJSON) RawJSON() string { - return r.raw -} - -// automations_file_presence indicates how an automations file is present in the -// environment. -type EnvironmentGetResponseEnvironmentStatusAutomationsFileAutomationsFilePresence string - -const ( - EnvironmentGetResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceUnspecified EnvironmentGetResponseEnvironmentStatusAutomationsFileAutomationsFilePresence = "PRESENCE_UNSPECIFIED" - EnvironmentGetResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceAbsent EnvironmentGetResponseEnvironmentStatusAutomationsFileAutomationsFilePresence = "PRESENCE_ABSENT" - EnvironmentGetResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceDiscovered EnvironmentGetResponseEnvironmentStatusAutomationsFileAutomationsFilePresence = "PRESENCE_DISCOVERED" - EnvironmentGetResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceSpecified EnvironmentGetResponseEnvironmentStatusAutomationsFileAutomationsFilePresence = "PRESENCE_SPECIFIED" -) - -func (r EnvironmentGetResponseEnvironmentStatusAutomationsFileAutomationsFilePresence) IsKnown() bool { - switch r { - case EnvironmentGetResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceUnspecified, EnvironmentGetResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceAbsent, EnvironmentGetResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceDiscovered, EnvironmentGetResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceSpecified: - return true - } - return false -} - -// phase is the current phase of the automations file. -type EnvironmentGetResponseEnvironmentStatusAutomationsFilePhase string - -const ( - EnvironmentGetResponseEnvironmentStatusAutomationsFilePhaseContentPhaseUnspecified EnvironmentGetResponseEnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_UNSPECIFIED" - EnvironmentGetResponseEnvironmentStatusAutomationsFilePhaseContentPhaseCreating EnvironmentGetResponseEnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_CREATING" - EnvironmentGetResponseEnvironmentStatusAutomationsFilePhaseContentPhaseInitializing EnvironmentGetResponseEnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_INITIALIZING" - EnvironmentGetResponseEnvironmentStatusAutomationsFilePhaseContentPhaseReady EnvironmentGetResponseEnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_READY" - EnvironmentGetResponseEnvironmentStatusAutomationsFilePhaseContentPhaseUpdating EnvironmentGetResponseEnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_UPDATING" - EnvironmentGetResponseEnvironmentStatusAutomationsFilePhaseContentPhaseFailed EnvironmentGetResponseEnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_FAILED" -) - -func (r EnvironmentGetResponseEnvironmentStatusAutomationsFilePhase) IsKnown() bool { - switch r { - case EnvironmentGetResponseEnvironmentStatusAutomationsFilePhaseContentPhaseUnspecified, EnvironmentGetResponseEnvironmentStatusAutomationsFilePhaseContentPhaseCreating, EnvironmentGetResponseEnvironmentStatusAutomationsFilePhaseContentPhaseInitializing, EnvironmentGetResponseEnvironmentStatusAutomationsFilePhaseContentPhaseReady, EnvironmentGetResponseEnvironmentStatusAutomationsFilePhaseContentPhaseUpdating, EnvironmentGetResponseEnvironmentStatusAutomationsFilePhaseContentPhaseFailed: - return true - } - return false -} - -// content contains the status of the environment content. -type EnvironmentGetResponseEnvironmentStatusContent struct { - // content_location_in_machine is the location of the content in the machine - ContentLocationInMachine string `json:"contentLocationInMachine"` - // failure_message contains the reason the content initialization failed. - FailureMessage string `json:"failureMessage"` - // git is the Git working copy status of the environment. Note: this is a - // best-effort field and more often than not will not be present. Its absence does - // not indicate the absence of a working copy. - Git EnvironmentGetResponseEnvironmentStatusContentGit `json:"git"` - // phase is the current phase of the environment content - Phase EnvironmentGetResponseEnvironmentStatusContentPhase `json:"phase"` - // session is the session that is currently active in the environment. - Session string `json:"session"` - // warning_message contains warnings, e.g. when the content is present but not in - // the expected state. - WarningMessage string `json:"warningMessage"` - JSON environmentGetResponseEnvironmentStatusContentJSON `json:"-"` -} - -// environmentGetResponseEnvironmentStatusContentJSON contains the JSON metadata -// for the struct [EnvironmentGetResponseEnvironmentStatusContent] -type environmentGetResponseEnvironmentStatusContentJSON struct { - ContentLocationInMachine apijson.Field - FailureMessage apijson.Field - Git apijson.Field - Phase apijson.Field - Session apijson.Field - WarningMessage apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentStatusContent) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentStatusContentJSON) RawJSON() string { - return r.raw -} - -// git is the Git working copy status of the environment. Note: this is a -// best-effort field and more often than not will not be present. Its absence does -// not indicate the absence of a working copy. -type EnvironmentGetResponseEnvironmentStatusContentGit struct { - // branch is branch we're currently on - Branch string `json:"branch"` - // changed_files is an array of changed files in the environment, possibly - // truncated - ChangedFiles []EnvironmentGetResponseEnvironmentStatusContentGitChangedFile `json:"changedFiles"` - // clone_url is the repository url as you would pass it to "git clone". Only HTTPS - // clone URLs are supported. - CloneURL string `json:"cloneUrl"` - // latest_commit is the most recent commit on the current branch - LatestCommit string `json:"latestCommit"` - TotalChangedFiles int64 `json:"totalChangedFiles"` - // the total number of unpushed changes - TotalUnpushedCommits int64 `json:"totalUnpushedCommits"` - // unpushed_commits is an array of unpushed changes in the environment, possibly - // truncated - UnpushedCommits []string `json:"unpushedCommits"` - JSON environmentGetResponseEnvironmentStatusContentGitJSON `json:"-"` -} - -// environmentGetResponseEnvironmentStatusContentGitJSON contains the JSON metadata -// for the struct [EnvironmentGetResponseEnvironmentStatusContentGit] -type environmentGetResponseEnvironmentStatusContentGitJSON struct { - Branch apijson.Field - ChangedFiles apijson.Field - CloneURL apijson.Field - LatestCommit apijson.Field - TotalChangedFiles apijson.Field - TotalUnpushedCommits apijson.Field - UnpushedCommits apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentStatusContentGit) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentStatusContentGitJSON) RawJSON() string { - return r.raw -} - -type EnvironmentGetResponseEnvironmentStatusContentGitChangedFile struct { - // ChangeType is the type of change that happened to the file - ChangeType EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeType `json:"changeType"` - // path is the path of the file - Path string `json:"path"` - JSON environmentGetResponseEnvironmentStatusContentGitChangedFileJSON `json:"-"` -} - -// environmentGetResponseEnvironmentStatusContentGitChangedFileJSON contains the -// JSON metadata for the struct -// [EnvironmentGetResponseEnvironmentStatusContentGitChangedFile] -type environmentGetResponseEnvironmentStatusContentGitChangedFileJSON struct { - ChangeType apijson.Field - Path apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentStatusContentGitChangedFile) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentStatusContentGitChangedFileJSON) RawJSON() string { - return r.raw -} - -// ChangeType is the type of change that happened to the file -type EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeType string - -const ( - EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUnspecified EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_UNSPECIFIED" - EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeAdded EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_ADDED" - EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeModified EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_MODIFIED" - EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeDeleted EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_DELETED" - EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeRenamed EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_RENAMED" - EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeCopied EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_COPIED" - EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUpdatedButUnmerged EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_UPDATED_BUT_UNMERGED" - EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUntracked EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_UNTRACKED" -) - -func (r EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeType) IsKnown() bool { - switch r { - case EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUnspecified, EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeAdded, EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeModified, EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeDeleted, EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeRenamed, EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeCopied, EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUpdatedButUnmerged, EnvironmentGetResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUntracked: - return true - } - return false -} - -// phase is the current phase of the environment content -type EnvironmentGetResponseEnvironmentStatusContentPhase string - -const ( - EnvironmentGetResponseEnvironmentStatusContentPhaseContentPhaseUnspecified EnvironmentGetResponseEnvironmentStatusContentPhase = "CONTENT_PHASE_UNSPECIFIED" - EnvironmentGetResponseEnvironmentStatusContentPhaseContentPhaseCreating EnvironmentGetResponseEnvironmentStatusContentPhase = "CONTENT_PHASE_CREATING" - EnvironmentGetResponseEnvironmentStatusContentPhaseContentPhaseInitializing EnvironmentGetResponseEnvironmentStatusContentPhase = "CONTENT_PHASE_INITIALIZING" - EnvironmentGetResponseEnvironmentStatusContentPhaseContentPhaseReady EnvironmentGetResponseEnvironmentStatusContentPhase = "CONTENT_PHASE_READY" - EnvironmentGetResponseEnvironmentStatusContentPhaseContentPhaseUpdating EnvironmentGetResponseEnvironmentStatusContentPhase = "CONTENT_PHASE_UPDATING" - EnvironmentGetResponseEnvironmentStatusContentPhaseContentPhaseFailed EnvironmentGetResponseEnvironmentStatusContentPhase = "CONTENT_PHASE_FAILED" -) - -func (r EnvironmentGetResponseEnvironmentStatusContentPhase) IsKnown() bool { - switch r { - case EnvironmentGetResponseEnvironmentStatusContentPhaseContentPhaseUnspecified, EnvironmentGetResponseEnvironmentStatusContentPhaseContentPhaseCreating, EnvironmentGetResponseEnvironmentStatusContentPhaseContentPhaseInitializing, EnvironmentGetResponseEnvironmentStatusContentPhaseContentPhaseReady, EnvironmentGetResponseEnvironmentStatusContentPhaseContentPhaseUpdating, EnvironmentGetResponseEnvironmentStatusContentPhaseContentPhaseFailed: - return true - } - return false -} - -// devcontainer contains the status of the devcontainer. -type EnvironmentGetResponseEnvironmentStatusDevcontainer struct { - // container_id is the ID of the container. - ContainerID string `json:"containerId"` - // container_name is the name of the container that is used to connect to the - // devcontainer - ContainerName string `json:"containerName"` - // devcontainerconfig_in_sync indicates if the devcontainer is up to date w.r.t. - // the devcontainer config file. - DevcontainerconfigInSync bool `json:"devcontainerconfigInSync"` - // devcontainer_file_path is the path to the devcontainer file relative to the repo - // root - DevcontainerFilePath string `json:"devcontainerFilePath"` - // devcontainer_file_presence indicates how the devcontainer file is present in the - // repo. - DevcontainerFilePresence EnvironmentGetResponseEnvironmentStatusDevcontainerDevcontainerFilePresence `json:"devcontainerFilePresence"` - // failure_message contains the reason the devcontainer failed to operate. - FailureMessage string `json:"failureMessage"` - // phase is the current phase of the devcontainer - Phase EnvironmentGetResponseEnvironmentStatusDevcontainerPhase `json:"phase"` - // remote_user is the user that is used to connect to the devcontainer - RemoteUser string `json:"remoteUser"` - // remote_workspace_folder is the folder that is used to connect to the - // devcontainer - RemoteWorkspaceFolder string `json:"remoteWorkspaceFolder"` - // secrets_in_sync indicates if the secrets are up to date w.r.t. the running - // devcontainer. - SecretsInSync bool `json:"secretsInSync"` - // session is the session that is currently active in the devcontainer. - Session string `json:"session"` - // warning_message contains warnings, e.g. when the devcontainer is present but not - // in the expected state. - WarningMessage string `json:"warningMessage"` - JSON environmentGetResponseEnvironmentStatusDevcontainerJSON `json:"-"` -} - -// environmentGetResponseEnvironmentStatusDevcontainerJSON contains the JSON -// metadata for the struct [EnvironmentGetResponseEnvironmentStatusDevcontainer] -type environmentGetResponseEnvironmentStatusDevcontainerJSON struct { - ContainerID apijson.Field - ContainerName apijson.Field - DevcontainerconfigInSync apijson.Field - DevcontainerFilePath apijson.Field - DevcontainerFilePresence apijson.Field - FailureMessage apijson.Field - Phase apijson.Field - RemoteUser apijson.Field - RemoteWorkspaceFolder apijson.Field - SecretsInSync apijson.Field - Session apijson.Field - WarningMessage apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentStatusDevcontainer) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentStatusDevcontainerJSON) RawJSON() string { - return r.raw -} - -// devcontainer_file_presence indicates how the devcontainer file is present in the -// repo. -type EnvironmentGetResponseEnvironmentStatusDevcontainerDevcontainerFilePresence string - -const ( - EnvironmentGetResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceUnspecified EnvironmentGetResponseEnvironmentStatusDevcontainerDevcontainerFilePresence = "PRESENCE_UNSPECIFIED" - EnvironmentGetResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceGenerated EnvironmentGetResponseEnvironmentStatusDevcontainerDevcontainerFilePresence = "PRESENCE_GENERATED" - EnvironmentGetResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceDiscovered EnvironmentGetResponseEnvironmentStatusDevcontainerDevcontainerFilePresence = "PRESENCE_DISCOVERED" - EnvironmentGetResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceSpecified EnvironmentGetResponseEnvironmentStatusDevcontainerDevcontainerFilePresence = "PRESENCE_SPECIFIED" -) - -func (r EnvironmentGetResponseEnvironmentStatusDevcontainerDevcontainerFilePresence) IsKnown() bool { - switch r { - case EnvironmentGetResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceUnspecified, EnvironmentGetResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceGenerated, EnvironmentGetResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceDiscovered, EnvironmentGetResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceSpecified: - return true - } - return false -} - -// phase is the current phase of the devcontainer -type EnvironmentGetResponseEnvironmentStatusDevcontainerPhase string - -const ( - EnvironmentGetResponseEnvironmentStatusDevcontainerPhasePhaseUnspecified EnvironmentGetResponseEnvironmentStatusDevcontainerPhase = "PHASE_UNSPECIFIED" - EnvironmentGetResponseEnvironmentStatusDevcontainerPhasePhaseCreating EnvironmentGetResponseEnvironmentStatusDevcontainerPhase = "PHASE_CREATING" - EnvironmentGetResponseEnvironmentStatusDevcontainerPhasePhaseRunning EnvironmentGetResponseEnvironmentStatusDevcontainerPhase = "PHASE_RUNNING" - EnvironmentGetResponseEnvironmentStatusDevcontainerPhasePhaseStopped EnvironmentGetResponseEnvironmentStatusDevcontainerPhase = "PHASE_STOPPED" - EnvironmentGetResponseEnvironmentStatusDevcontainerPhasePhaseFailed EnvironmentGetResponseEnvironmentStatusDevcontainerPhase = "PHASE_FAILED" -) - -func (r EnvironmentGetResponseEnvironmentStatusDevcontainerPhase) IsKnown() bool { - switch r { - case EnvironmentGetResponseEnvironmentStatusDevcontainerPhasePhaseUnspecified, EnvironmentGetResponseEnvironmentStatusDevcontainerPhasePhaseCreating, EnvironmentGetResponseEnvironmentStatusDevcontainerPhasePhaseRunning, EnvironmentGetResponseEnvironmentStatusDevcontainerPhasePhaseStopped, EnvironmentGetResponseEnvironmentStatusDevcontainerPhasePhaseFailed: - return true - } - return false -} - -// environment_url contains the URL at which the environment can be accessed. This -// field is only set if the environment is running. -type EnvironmentGetResponseEnvironmentStatusEnvironmentURLs struct { - // logs is the URL at which the environment logs can be accessed. - Logs string `json:"logs"` - Ports []EnvironmentGetResponseEnvironmentStatusEnvironmentURLsPort `json:"ports"` - // SSH is the URL at which the environment can be accessed via SSH. - SSH EnvironmentGetResponseEnvironmentStatusEnvironmentURLsSSH `json:"ssh"` - JSON environmentGetResponseEnvironmentStatusEnvironmentURLsJSON `json:"-"` -} - -// environmentGetResponseEnvironmentStatusEnvironmentURLsJSON contains the JSON -// metadata for the struct [EnvironmentGetResponseEnvironmentStatusEnvironmentURLs] -type environmentGetResponseEnvironmentStatusEnvironmentURLsJSON struct { - Logs apijson.Field - Ports apijson.Field - SSH apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentStatusEnvironmentURLs) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentStatusEnvironmentURLsJSON) RawJSON() string { - return r.raw -} - -type EnvironmentGetResponseEnvironmentStatusEnvironmentURLsPort struct { - // port is the port number of the environment port - Port int64 `json:"port"` - // url is the URL at which the environment port can be accessed - URL string `json:"url"` - JSON environmentGetResponseEnvironmentStatusEnvironmentURLsPortJSON `json:"-"` -} - -// environmentGetResponseEnvironmentStatusEnvironmentURLsPortJSON contains the JSON -// metadata for the struct -// [EnvironmentGetResponseEnvironmentStatusEnvironmentURLsPort] -type environmentGetResponseEnvironmentStatusEnvironmentURLsPortJSON struct { - Port apijson.Field - URL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentStatusEnvironmentURLsPort) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentStatusEnvironmentURLsPortJSON) RawJSON() string { - return r.raw -} - -// SSH is the URL at which the environment can be accessed via SSH. -type EnvironmentGetResponseEnvironmentStatusEnvironmentURLsSSH struct { - URL string `json:"url"` - JSON environmentGetResponseEnvironmentStatusEnvironmentURLsSSHJSON `json:"-"` -} - -// environmentGetResponseEnvironmentStatusEnvironmentURLsSSHJSON contains the JSON -// metadata for the struct -// [EnvironmentGetResponseEnvironmentStatusEnvironmentURLsSSH] -type environmentGetResponseEnvironmentStatusEnvironmentURLsSSHJSON struct { - URL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentStatusEnvironmentURLsSSH) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentStatusEnvironmentURLsSSHJSON) RawJSON() string { - return r.raw -} - -// machine contains the status of the environment machine -type EnvironmentGetResponseEnvironmentStatusMachine struct { - // failure_message contains the reason the machine failed to operate. - FailureMessage string `json:"failureMessage"` - // phase is the current phase of the environment machine - Phase EnvironmentGetResponseEnvironmentStatusMachinePhase `json:"phase"` - // session is the session that is currently active in the machine. - Session string `json:"session"` - // timeout contains the reason the environment has timed out. If this field is - // empty, the environment has not timed out. - Timeout string `json:"timeout"` - // versions contains the versions of components in the machine. - Versions EnvironmentGetResponseEnvironmentStatusMachineVersions `json:"versions"` - // warning_message contains warnings, e.g. when the machine is present but not in - // the expected state. - WarningMessage string `json:"warningMessage"` - JSON environmentGetResponseEnvironmentStatusMachineJSON `json:"-"` -} - -// environmentGetResponseEnvironmentStatusMachineJSON contains the JSON metadata -// for the struct [EnvironmentGetResponseEnvironmentStatusMachine] -type environmentGetResponseEnvironmentStatusMachineJSON struct { - FailureMessage apijson.Field - Phase apijson.Field - Session apijson.Field - Timeout apijson.Field - Versions apijson.Field - WarningMessage apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentStatusMachine) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentStatusMachineJSON) RawJSON() string { - return r.raw -} - -// phase is the current phase of the environment machine -type EnvironmentGetResponseEnvironmentStatusMachinePhase string - -const ( - EnvironmentGetResponseEnvironmentStatusMachinePhasePhaseUnspecified EnvironmentGetResponseEnvironmentStatusMachinePhase = "PHASE_UNSPECIFIED" - EnvironmentGetResponseEnvironmentStatusMachinePhasePhaseCreating EnvironmentGetResponseEnvironmentStatusMachinePhase = "PHASE_CREATING" - EnvironmentGetResponseEnvironmentStatusMachinePhasePhaseStarting EnvironmentGetResponseEnvironmentStatusMachinePhase = "PHASE_STARTING" - EnvironmentGetResponseEnvironmentStatusMachinePhasePhaseRunning EnvironmentGetResponseEnvironmentStatusMachinePhase = "PHASE_RUNNING" - EnvironmentGetResponseEnvironmentStatusMachinePhasePhaseStopping EnvironmentGetResponseEnvironmentStatusMachinePhase = "PHASE_STOPPING" - EnvironmentGetResponseEnvironmentStatusMachinePhasePhaseStopped EnvironmentGetResponseEnvironmentStatusMachinePhase = "PHASE_STOPPED" - EnvironmentGetResponseEnvironmentStatusMachinePhasePhaseDeleting EnvironmentGetResponseEnvironmentStatusMachinePhase = "PHASE_DELETING" - EnvironmentGetResponseEnvironmentStatusMachinePhasePhaseDeleted EnvironmentGetResponseEnvironmentStatusMachinePhase = "PHASE_DELETED" -) - -func (r EnvironmentGetResponseEnvironmentStatusMachinePhase) IsKnown() bool { - switch r { - case EnvironmentGetResponseEnvironmentStatusMachinePhasePhaseUnspecified, EnvironmentGetResponseEnvironmentStatusMachinePhasePhaseCreating, EnvironmentGetResponseEnvironmentStatusMachinePhasePhaseStarting, EnvironmentGetResponseEnvironmentStatusMachinePhasePhaseRunning, EnvironmentGetResponseEnvironmentStatusMachinePhasePhaseStopping, EnvironmentGetResponseEnvironmentStatusMachinePhasePhaseStopped, EnvironmentGetResponseEnvironmentStatusMachinePhasePhaseDeleting, EnvironmentGetResponseEnvironmentStatusMachinePhasePhaseDeleted: - return true - } - return false -} - -// versions contains the versions of components in the machine. -type EnvironmentGetResponseEnvironmentStatusMachineVersions struct { - SupervisorCommit string `json:"supervisorCommit"` - SupervisorVersion string `json:"supervisorVersion"` - JSON environmentGetResponseEnvironmentStatusMachineVersionsJSON `json:"-"` -} - -// environmentGetResponseEnvironmentStatusMachineVersionsJSON contains the JSON -// metadata for the struct [EnvironmentGetResponseEnvironmentStatusMachineVersions] -type environmentGetResponseEnvironmentStatusMachineVersionsJSON struct { - SupervisorCommit apijson.Field - SupervisorVersion apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentStatusMachineVersions) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentStatusMachineVersionsJSON) RawJSON() string { - return r.raw -} - -// the phase of an environment is a simple, high-level summary of where the -// environment is in its lifecycle -type EnvironmentGetResponseEnvironmentStatusPhase string - -const ( - EnvironmentGetResponseEnvironmentStatusPhaseEnvironmentPhaseUnspecified EnvironmentGetResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_UNSPECIFIED" - EnvironmentGetResponseEnvironmentStatusPhaseEnvironmentPhaseCreating EnvironmentGetResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_CREATING" - EnvironmentGetResponseEnvironmentStatusPhaseEnvironmentPhaseStarting EnvironmentGetResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_STARTING" - EnvironmentGetResponseEnvironmentStatusPhaseEnvironmentPhaseRunning EnvironmentGetResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_RUNNING" - EnvironmentGetResponseEnvironmentStatusPhaseEnvironmentPhaseUpdating EnvironmentGetResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_UPDATING" - EnvironmentGetResponseEnvironmentStatusPhaseEnvironmentPhaseStopping EnvironmentGetResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_STOPPING" - EnvironmentGetResponseEnvironmentStatusPhaseEnvironmentPhaseStopped EnvironmentGetResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_STOPPED" - EnvironmentGetResponseEnvironmentStatusPhaseEnvironmentPhaseDeleting EnvironmentGetResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_DELETING" - EnvironmentGetResponseEnvironmentStatusPhaseEnvironmentPhaseDeleted EnvironmentGetResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_DELETED" -) - -func (r EnvironmentGetResponseEnvironmentStatusPhase) IsKnown() bool { - switch r { - case EnvironmentGetResponseEnvironmentStatusPhaseEnvironmentPhaseUnspecified, EnvironmentGetResponseEnvironmentStatusPhaseEnvironmentPhaseCreating, EnvironmentGetResponseEnvironmentStatusPhaseEnvironmentPhaseStarting, EnvironmentGetResponseEnvironmentStatusPhaseEnvironmentPhaseRunning, EnvironmentGetResponseEnvironmentStatusPhaseEnvironmentPhaseUpdating, EnvironmentGetResponseEnvironmentStatusPhaseEnvironmentPhaseStopping, EnvironmentGetResponseEnvironmentStatusPhaseEnvironmentPhaseStopped, EnvironmentGetResponseEnvironmentStatusPhaseEnvironmentPhaseDeleting, EnvironmentGetResponseEnvironmentStatusPhaseEnvironmentPhaseDeleted: - return true - } - return false -} - -// RunnerACK is the acknowledgement from the runner that is has received the -// environment spec. -type EnvironmentGetResponseEnvironmentStatusRunnerAck struct { - Message string `json:"message"` - SpecVersion string `json:"specVersion"` - StatusCode EnvironmentGetResponseEnvironmentStatusRunnerAckStatusCode `json:"statusCode"` - JSON environmentGetResponseEnvironmentStatusRunnerAckJSON `json:"-"` -} - -// environmentGetResponseEnvironmentStatusRunnerAckJSON contains the JSON metadata -// for the struct [EnvironmentGetResponseEnvironmentStatusRunnerAck] -type environmentGetResponseEnvironmentStatusRunnerAckJSON struct { - Message apijson.Field - SpecVersion apijson.Field - StatusCode apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentStatusRunnerAck) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentStatusRunnerAckJSON) RawJSON() string { - return r.raw -} - -type EnvironmentGetResponseEnvironmentStatusRunnerAckStatusCode string - -const ( - EnvironmentGetResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeUnspecified EnvironmentGetResponseEnvironmentStatusRunnerAckStatusCode = "STATUS_CODE_UNSPECIFIED" - EnvironmentGetResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeOk EnvironmentGetResponseEnvironmentStatusRunnerAckStatusCode = "STATUS_CODE_OK" - EnvironmentGetResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeInvalidResource EnvironmentGetResponseEnvironmentStatusRunnerAckStatusCode = "STATUS_CODE_INVALID_RESOURCE" - EnvironmentGetResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeFailedPrecondition EnvironmentGetResponseEnvironmentStatusRunnerAckStatusCode = "STATUS_CODE_FAILED_PRECONDITION" -) - -func (r EnvironmentGetResponseEnvironmentStatusRunnerAckStatusCode) IsKnown() bool { - switch r { - case EnvironmentGetResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeUnspecified, EnvironmentGetResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeOk, EnvironmentGetResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeInvalidResource, EnvironmentGetResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeFailedPrecondition: - return true - } - return false -} - -type EnvironmentGetResponseEnvironmentStatusSecret struct { - // failure_message contains the reason the secret failed to be materialize. - FailureMessage string `json:"failureMessage"` - Phase EnvironmentGetResponseEnvironmentStatusSecretsPhase `json:"phase"` - SecretName string `json:"secretName"` - // session is the session that is currently active in the environment. - Session string `json:"session"` - // warning_message contains warnings, e.g. when the secret is present but not in - // the expected state. - WarningMessage string `json:"warningMessage"` - JSON environmentGetResponseEnvironmentStatusSecretJSON `json:"-"` -} - -// environmentGetResponseEnvironmentStatusSecretJSON contains the JSON metadata for -// the struct [EnvironmentGetResponseEnvironmentStatusSecret] -type environmentGetResponseEnvironmentStatusSecretJSON struct { - FailureMessage apijson.Field - Phase apijson.Field - SecretName apijson.Field - Session apijson.Field - WarningMessage apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentStatusSecret) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentStatusSecretJSON) RawJSON() string { - return r.raw -} - -type EnvironmentGetResponseEnvironmentStatusSecretsPhase string - -const ( - EnvironmentGetResponseEnvironmentStatusSecretsPhaseContentPhaseUnspecified EnvironmentGetResponseEnvironmentStatusSecretsPhase = "CONTENT_PHASE_UNSPECIFIED" - EnvironmentGetResponseEnvironmentStatusSecretsPhaseContentPhaseCreating EnvironmentGetResponseEnvironmentStatusSecretsPhase = "CONTENT_PHASE_CREATING" - EnvironmentGetResponseEnvironmentStatusSecretsPhaseContentPhaseInitializing EnvironmentGetResponseEnvironmentStatusSecretsPhase = "CONTENT_PHASE_INITIALIZING" - EnvironmentGetResponseEnvironmentStatusSecretsPhaseContentPhaseReady EnvironmentGetResponseEnvironmentStatusSecretsPhase = "CONTENT_PHASE_READY" - EnvironmentGetResponseEnvironmentStatusSecretsPhaseContentPhaseUpdating EnvironmentGetResponseEnvironmentStatusSecretsPhase = "CONTENT_PHASE_UPDATING" - EnvironmentGetResponseEnvironmentStatusSecretsPhaseContentPhaseFailed EnvironmentGetResponseEnvironmentStatusSecretsPhase = "CONTENT_PHASE_FAILED" -) - -func (r EnvironmentGetResponseEnvironmentStatusSecretsPhase) IsKnown() bool { - switch r { - case EnvironmentGetResponseEnvironmentStatusSecretsPhaseContentPhaseUnspecified, EnvironmentGetResponseEnvironmentStatusSecretsPhaseContentPhaseCreating, EnvironmentGetResponseEnvironmentStatusSecretsPhaseContentPhaseInitializing, EnvironmentGetResponseEnvironmentStatusSecretsPhaseContentPhaseReady, EnvironmentGetResponseEnvironmentStatusSecretsPhaseContentPhaseUpdating, EnvironmentGetResponseEnvironmentStatusSecretsPhaseContentPhaseFailed: - return true - } - return false -} - -type EnvironmentGetResponseEnvironmentStatusSSHPublicKey struct { - // id is the unique identifier of the public key - ID string `json:"id"` - // phase is the current phase of the public key - Phase EnvironmentGetResponseEnvironmentStatusSSHPublicKeysPhase `json:"phase"` - JSON environmentGetResponseEnvironmentStatusSSHPublicKeyJSON `json:"-"` -} - -// environmentGetResponseEnvironmentStatusSSHPublicKeyJSON contains the JSON -// metadata for the struct [EnvironmentGetResponseEnvironmentStatusSSHPublicKey] -type environmentGetResponseEnvironmentStatusSSHPublicKeyJSON struct { - ID apijson.Field - Phase apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentGetResponseEnvironmentStatusSSHPublicKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentGetResponseEnvironmentStatusSSHPublicKeyJSON) RawJSON() string { - return r.raw -} - -// phase is the current phase of the public key -type EnvironmentGetResponseEnvironmentStatusSSHPublicKeysPhase string - -const ( - EnvironmentGetResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseUnspecified EnvironmentGetResponseEnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_UNSPECIFIED" - EnvironmentGetResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseCreating EnvironmentGetResponseEnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_CREATING" - EnvironmentGetResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseInitializing EnvironmentGetResponseEnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_INITIALIZING" - EnvironmentGetResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseReady EnvironmentGetResponseEnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_READY" - EnvironmentGetResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseUpdating EnvironmentGetResponseEnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_UPDATING" - EnvironmentGetResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseFailed EnvironmentGetResponseEnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_FAILED" -) - -func (r EnvironmentGetResponseEnvironmentStatusSSHPublicKeysPhase) IsKnown() bool { - switch r { - case EnvironmentGetResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseUnspecified, EnvironmentGetResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseCreating, EnvironmentGetResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseInitializing, EnvironmentGetResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseReady, EnvironmentGetResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseUpdating, EnvironmentGetResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseFailed: - return true - } - return false -} - -type EnvironmentUpdateResponse = interface{} - -// +resource get environment -type EnvironmentListResponse struct { - // ID is a unique identifier of this environment. No other environment with the - // same name must be managed by this environment manager - ID string `json:"id"` - // EnvironmentMetadata is data associated with an environment that's required for - // other parts of the system to function - Metadata EnvironmentListResponseMetadata `json:"metadata"` - // EnvironmentSpec specifies the configuration of an environment for an environment - // start - Spec EnvironmentListResponseSpec `json:"spec"` - // EnvironmentStatus describes an environment status - Status EnvironmentListResponseStatus `json:"status"` - JSON environmentListResponseJSON `json:"-"` -} - -// environmentListResponseJSON contains the JSON metadata for the struct -// [EnvironmentListResponse] -type environmentListResponseJSON struct { - ID apijson.Field - Metadata apijson.Field - Spec apijson.Field - Status apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseJSON) RawJSON() string { - return r.raw -} - -// EnvironmentMetadata is data associated with an environment that's required for -// other parts of the system to function -type EnvironmentListResponseMetadata struct { - // annotations are key/value pairs that gets attached to the environment. - // +internal - not yet implemented - Annotations map[string]string `json:"annotations"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - CreatedAt time.Time `json:"createdAt" format:"date-time"` - // creator is the identity of the creator of the environment - Creator EnvironmentListResponseMetadataCreator `json:"creator"` - // 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. - LastStartedAt time.Time `json:"lastStartedAt" format:"date-time"` - // name is the name of the environment as specified by the user - Name string `json:"name"` - // organization_id is the ID of the organization that contains the environment - OrganizationID string `json:"organizationId" format:"uuid"` - // original_context_url is the normalized URL from which the environment was - // created - OriginalContextURL string `json:"originalContextUrl"` - // If the Environment was started from a project, the project_id will reference the - // project. - ProjectID string `json:"projectId"` - // Runner is the ID of the runner that runs this environment. - RunnerID string `json:"runnerId"` - JSON environmentListResponseMetadataJSON `json:"-"` -} - -// environmentListResponseMetadataJSON contains the JSON metadata for the struct -// [EnvironmentListResponseMetadata] -type environmentListResponseMetadataJSON struct { - Annotations apijson.Field - CreatedAt apijson.Field - Creator apijson.Field - LastStartedAt apijson.Field - Name apijson.Field - OrganizationID apijson.Field - OriginalContextURL apijson.Field - ProjectID apijson.Field - RunnerID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseMetadata) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseMetadataJSON) RawJSON() string { - return r.raw -} - -// creator is the identity of the creator of the environment -type EnvironmentListResponseMetadataCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal EnvironmentListResponseMetadataCreatorPrincipal `json:"principal"` - JSON environmentListResponseMetadataCreatorJSON `json:"-"` -} - -// environmentListResponseMetadataCreatorJSON contains the JSON metadata for the -// struct [EnvironmentListResponseMetadataCreator] -type environmentListResponseMetadataCreatorJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseMetadataCreator) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseMetadataCreatorJSON) RawJSON() string { - return r.raw -} - -// Principal is the principal of the subject -type EnvironmentListResponseMetadataCreatorPrincipal string - -const ( - EnvironmentListResponseMetadataCreatorPrincipalPrincipalUnspecified EnvironmentListResponseMetadataCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - EnvironmentListResponseMetadataCreatorPrincipalPrincipalAccount EnvironmentListResponseMetadataCreatorPrincipal = "PRINCIPAL_ACCOUNT" - EnvironmentListResponseMetadataCreatorPrincipalPrincipalUser EnvironmentListResponseMetadataCreatorPrincipal = "PRINCIPAL_USER" - EnvironmentListResponseMetadataCreatorPrincipalPrincipalRunner EnvironmentListResponseMetadataCreatorPrincipal = "PRINCIPAL_RUNNER" - EnvironmentListResponseMetadataCreatorPrincipalPrincipalEnvironment EnvironmentListResponseMetadataCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - EnvironmentListResponseMetadataCreatorPrincipalPrincipalServiceAccount EnvironmentListResponseMetadataCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r EnvironmentListResponseMetadataCreatorPrincipal) IsKnown() bool { - switch r { - case EnvironmentListResponseMetadataCreatorPrincipalPrincipalUnspecified, EnvironmentListResponseMetadataCreatorPrincipalPrincipalAccount, EnvironmentListResponseMetadataCreatorPrincipalPrincipalUser, EnvironmentListResponseMetadataCreatorPrincipalPrincipalRunner, EnvironmentListResponseMetadataCreatorPrincipalPrincipalEnvironment, EnvironmentListResponseMetadataCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - -// EnvironmentSpec specifies the configuration of an environment for an environment -// start -type EnvironmentListResponseSpec struct { - // Admission level describes who can access an environment instance and its ports. - Admission EnvironmentListResponseSpecAdmission `json:"admission"` - // automations_file is the automations file spec of the environment - AutomationsFile EnvironmentListResponseSpecAutomationsFile `json:"automationsFile"` - // content is the content spec of the environment - Content EnvironmentListResponseSpecContent `json:"content"` - // Phase is the desired phase of the environment - DesiredPhase EnvironmentListResponseSpecDesiredPhase `json:"desiredPhase"` - // devcontainer is the devcontainer spec of the environment - Devcontainer EnvironmentListResponseSpecDevcontainer `json:"devcontainer"` - // machine is the machine spec of the environment - Machine EnvironmentListResponseSpecMachine `json:"machine"` - // ports is the set of ports which ought to be exposed to the internet - Ports []EnvironmentListResponseSpecPort `json:"ports"` - // secrets are confidential data that is mounted into the environment - Secrets []EnvironmentListResponseSpecSecret `json:"secrets"` - // version of the spec. The value of this field has no semantic meaning (e.g. don't - // interpret it as as a timestamp), but it can be used to impose a partial order. - // If a.spec_version < b.spec_version then a was the spec before b. - SpecVersion string `json:"specVersion"` - // ssh_public_keys are the public keys used to ssh into the environment - SSHPublicKeys []EnvironmentListResponseSpecSSHPublicKey `json:"sshPublicKeys"` - // Timeout configures the environment timeout - Timeout EnvironmentListResponseSpecTimeout `json:"timeout"` - JSON environmentListResponseSpecJSON `json:"-"` -} - -// environmentListResponseSpecJSON contains the JSON metadata for the struct -// [EnvironmentListResponseSpec] -type environmentListResponseSpecJSON struct { - Admission apijson.Field - AutomationsFile apijson.Field - Content apijson.Field - DesiredPhase apijson.Field - Devcontainer apijson.Field - Machine apijson.Field - Ports apijson.Field - Secrets apijson.Field - SpecVersion apijson.Field - SSHPublicKeys apijson.Field - Timeout apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseSpec) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseSpecJSON) RawJSON() string { - return r.raw -} - -// Admission level describes who can access an environment instance and its ports. -type EnvironmentListResponseSpecAdmission string - -const ( - EnvironmentListResponseSpecAdmissionAdmissionLevelUnspecified EnvironmentListResponseSpecAdmission = "ADMISSION_LEVEL_UNSPECIFIED" - EnvironmentListResponseSpecAdmissionAdmissionLevelOwnerOnly EnvironmentListResponseSpecAdmission = "ADMISSION_LEVEL_OWNER_ONLY" - EnvironmentListResponseSpecAdmissionAdmissionLevelEveryone EnvironmentListResponseSpecAdmission = "ADMISSION_LEVEL_EVERYONE" -) - -func (r EnvironmentListResponseSpecAdmission) IsKnown() bool { - switch r { - case EnvironmentListResponseSpecAdmissionAdmissionLevelUnspecified, EnvironmentListResponseSpecAdmissionAdmissionLevelOwnerOnly, EnvironmentListResponseSpecAdmissionAdmissionLevelEveryone: - return true - } - return false -} - -// automations_file is the automations file spec of the environment -type EnvironmentListResponseSpecAutomationsFile struct { - // automations_file_path is the path to the automations file that is applied in the - // environment, relative to the repo root. path must not be absolute (start with a - // /): - // - // ``` - // this.matches('^$|^[^/].*') - // ``` - AutomationsFilePath string `json:"automationsFilePath"` - Session string `json:"session"` - JSON environmentListResponseSpecAutomationsFileJSON `json:"-"` -} - -// environmentListResponseSpecAutomationsFileJSON contains the JSON metadata for -// the struct [EnvironmentListResponseSpecAutomationsFile] -type environmentListResponseSpecAutomationsFileJSON struct { - AutomationsFilePath apijson.Field - Session apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseSpecAutomationsFile) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseSpecAutomationsFileJSON) RawJSON() string { - return r.raw -} - -// content is the content spec of the environment -type EnvironmentListResponseSpecContent struct { - // The Git email address - GitEmail string `json:"gitEmail"` - // The Git username - GitUsername string `json:"gitUsername"` - // EnvironmentInitializer specifies how an environment is to be initialized - Initializer EnvironmentListResponseSpecContentInitializer `json:"initializer"` - Session string `json:"session"` - JSON environmentListResponseSpecContentJSON `json:"-"` -} - -// environmentListResponseSpecContentJSON contains the JSON metadata for the struct -// [EnvironmentListResponseSpecContent] -type environmentListResponseSpecContentJSON struct { - GitEmail apijson.Field - GitUsername apijson.Field - Initializer apijson.Field - Session apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseSpecContent) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseSpecContentJSON) RawJSON() string { - return r.raw -} - -// EnvironmentInitializer specifies how an environment is to be initialized -type EnvironmentListResponseSpecContentInitializer struct { - Specs []EnvironmentListResponseSpecContentInitializerSpec `json:"specs"` - JSON environmentListResponseSpecContentInitializerJSON `json:"-"` -} - -// environmentListResponseSpecContentInitializerJSON contains the JSON metadata for -// the struct [EnvironmentListResponseSpecContentInitializer] -type environmentListResponseSpecContentInitializerJSON struct { - Specs apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseSpecContentInitializer) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseSpecContentInitializerJSON) RawJSON() string { - return r.raw -} - -type EnvironmentListResponseSpecContentInitializerSpec struct { - // This field can have the runtime type of - // [EnvironmentListResponseSpecContentInitializerSpecsContextURLContextURL]. - ContextURL interface{} `json:"contextUrl"` - // This field can have the runtime type of - // [EnvironmentListResponseSpecContentInitializerSpecsGitGit]. - Git interface{} `json:"git"` - JSON environmentListResponseSpecContentInitializerSpecJSON `json:"-"` - union EnvironmentListResponseSpecContentInitializerSpecsUnion -} - -// environmentListResponseSpecContentInitializerSpecJSON contains the JSON metadata -// for the struct [EnvironmentListResponseSpecContentInitializerSpec] -type environmentListResponseSpecContentInitializerSpecJSON struct { - ContextURL apijson.Field - Git apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r environmentListResponseSpecContentInitializerSpecJSON) RawJSON() string { - return r.raw -} - -func (r *EnvironmentListResponseSpecContentInitializerSpec) UnmarshalJSON(data []byte) (err error) { - *r = EnvironmentListResponseSpecContentInitializerSpec{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a [EnvironmentListResponseSpecContentInitializerSpecsUnion] -// interface which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [EnvironmentListResponseSpecContentInitializerSpecsContextURL], -// [EnvironmentListResponseSpecContentInitializerSpecsGit]. -func (r EnvironmentListResponseSpecContentInitializerSpec) AsUnion() EnvironmentListResponseSpecContentInitializerSpecsUnion { - return r.union -} - -// Union satisfied by -// [EnvironmentListResponseSpecContentInitializerSpecsContextURL] or -// [EnvironmentListResponseSpecContentInitializerSpecsGit]. -type EnvironmentListResponseSpecContentInitializerSpecsUnion interface { - implementsEnvironmentListResponseSpecContentInitializerSpec() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*EnvironmentListResponseSpecContentInitializerSpecsUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentListResponseSpecContentInitializerSpecsContextURL{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentListResponseSpecContentInitializerSpecsGit{}), - }, - ) -} - -type EnvironmentListResponseSpecContentInitializerSpecsContextURL struct { - ContextURL EnvironmentListResponseSpecContentInitializerSpecsContextURLContextURL `json:"contextUrl,required"` - JSON environmentListResponseSpecContentInitializerSpecsContextURLJSON `json:"-"` -} - -// environmentListResponseSpecContentInitializerSpecsContextURLJSON contains the -// JSON metadata for the struct -// [EnvironmentListResponseSpecContentInitializerSpecsContextURL] -type environmentListResponseSpecContentInitializerSpecsContextURLJSON struct { - ContextURL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseSpecContentInitializerSpecsContextURL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseSpecContentInitializerSpecsContextURLJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentListResponseSpecContentInitializerSpecsContextURL) implementsEnvironmentListResponseSpecContentInitializerSpec() { -} - -type EnvironmentListResponseSpecContentInitializerSpecsContextURLContextURL struct { - // url is the URL from which the environment is created - URL string `json:"url" format:"uri"` - JSON environmentListResponseSpecContentInitializerSpecsContextURLContextURLJSON `json:"-"` -} - -// environmentListResponseSpecContentInitializerSpecsContextURLContextURLJSON -// contains the JSON metadata for the struct -// [EnvironmentListResponseSpecContentInitializerSpecsContextURLContextURL] -type environmentListResponseSpecContentInitializerSpecsContextURLContextURLJSON struct { - URL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseSpecContentInitializerSpecsContextURLContextURL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseSpecContentInitializerSpecsContextURLContextURLJSON) RawJSON() string { - return r.raw -} - -type EnvironmentListResponseSpecContentInitializerSpecsGit struct { - Git EnvironmentListResponseSpecContentInitializerSpecsGitGit `json:"git,required"` - JSON environmentListResponseSpecContentInitializerSpecsGitJSON `json:"-"` -} - -// environmentListResponseSpecContentInitializerSpecsGitJSON contains the JSON -// metadata for the struct [EnvironmentListResponseSpecContentInitializerSpecsGit] -type environmentListResponseSpecContentInitializerSpecsGitJSON struct { - Git apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseSpecContentInitializerSpecsGit) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseSpecContentInitializerSpecsGitJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentListResponseSpecContentInitializerSpecsGit) implementsEnvironmentListResponseSpecContentInitializerSpec() { -} - -type EnvironmentListResponseSpecContentInitializerSpecsGitGit struct { - // a path relative to the environment root in which the code will be checked out to - CheckoutLocation string `json:"checkoutLocation"` - // the value for the clone target mode - use depends on the target mode - CloneTarget string `json:"cloneTarget"` - // remote_uri is the Git remote origin - RemoteUri string `json:"remoteUri"` - // CloneTargetMode is the target state in which we want to leave a GitEnvironment - TargetMode EnvironmentListResponseSpecContentInitializerSpecsGitGitTargetMode `json:"targetMode"` - // upstream_Remote_uri is the fork upstream of a repository - UpstreamRemoteUri string `json:"upstreamRemoteUri"` - JSON environmentListResponseSpecContentInitializerSpecsGitGitJSON `json:"-"` -} - -// environmentListResponseSpecContentInitializerSpecsGitGitJSON contains the JSON -// metadata for the struct -// [EnvironmentListResponseSpecContentInitializerSpecsGitGit] -type environmentListResponseSpecContentInitializerSpecsGitGitJSON struct { - CheckoutLocation apijson.Field - CloneTarget apijson.Field - RemoteUri apijson.Field - TargetMode apijson.Field - UpstreamRemoteUri apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseSpecContentInitializerSpecsGitGit) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseSpecContentInitializerSpecsGitGitJSON) RawJSON() string { - return r.raw -} - -// CloneTargetMode is the target state in which we want to leave a GitEnvironment -type EnvironmentListResponseSpecContentInitializerSpecsGitGitTargetMode string - -const ( - EnvironmentListResponseSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified EnvironmentListResponseSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_UNSPECIFIED" - EnvironmentListResponseSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead EnvironmentListResponseSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_HEAD" - EnvironmentListResponseSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit EnvironmentListResponseSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_COMMIT" - EnvironmentListResponseSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch EnvironmentListResponseSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_BRANCH" - EnvironmentListResponseSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch EnvironmentListResponseSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_LOCAL_BRANCH" -) - -func (r EnvironmentListResponseSpecContentInitializerSpecsGitGitTargetMode) IsKnown() bool { - switch r { - case EnvironmentListResponseSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified, EnvironmentListResponseSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead, EnvironmentListResponseSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit, EnvironmentListResponseSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch, EnvironmentListResponseSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch: - return true - } - return false -} - -// Phase is the desired phase of the environment -type EnvironmentListResponseSpecDesiredPhase string - -const ( - EnvironmentListResponseSpecDesiredPhaseEnvironmentPhaseUnspecified EnvironmentListResponseSpecDesiredPhase = "ENVIRONMENT_PHASE_UNSPECIFIED" - EnvironmentListResponseSpecDesiredPhaseEnvironmentPhaseCreating EnvironmentListResponseSpecDesiredPhase = "ENVIRONMENT_PHASE_CREATING" - EnvironmentListResponseSpecDesiredPhaseEnvironmentPhaseStarting EnvironmentListResponseSpecDesiredPhase = "ENVIRONMENT_PHASE_STARTING" - EnvironmentListResponseSpecDesiredPhaseEnvironmentPhaseRunning EnvironmentListResponseSpecDesiredPhase = "ENVIRONMENT_PHASE_RUNNING" - EnvironmentListResponseSpecDesiredPhaseEnvironmentPhaseUpdating EnvironmentListResponseSpecDesiredPhase = "ENVIRONMENT_PHASE_UPDATING" - EnvironmentListResponseSpecDesiredPhaseEnvironmentPhaseStopping EnvironmentListResponseSpecDesiredPhase = "ENVIRONMENT_PHASE_STOPPING" - EnvironmentListResponseSpecDesiredPhaseEnvironmentPhaseStopped EnvironmentListResponseSpecDesiredPhase = "ENVIRONMENT_PHASE_STOPPED" - EnvironmentListResponseSpecDesiredPhaseEnvironmentPhaseDeleting EnvironmentListResponseSpecDesiredPhase = "ENVIRONMENT_PHASE_DELETING" - EnvironmentListResponseSpecDesiredPhaseEnvironmentPhaseDeleted EnvironmentListResponseSpecDesiredPhase = "ENVIRONMENT_PHASE_DELETED" -) - -func (r EnvironmentListResponseSpecDesiredPhase) IsKnown() bool { - switch r { - case EnvironmentListResponseSpecDesiredPhaseEnvironmentPhaseUnspecified, EnvironmentListResponseSpecDesiredPhaseEnvironmentPhaseCreating, EnvironmentListResponseSpecDesiredPhaseEnvironmentPhaseStarting, EnvironmentListResponseSpecDesiredPhaseEnvironmentPhaseRunning, EnvironmentListResponseSpecDesiredPhaseEnvironmentPhaseUpdating, EnvironmentListResponseSpecDesiredPhaseEnvironmentPhaseStopping, EnvironmentListResponseSpecDesiredPhaseEnvironmentPhaseStopped, EnvironmentListResponseSpecDesiredPhaseEnvironmentPhaseDeleting, EnvironmentListResponseSpecDesiredPhaseEnvironmentPhaseDeleted: - return true - } - return false -} - -// devcontainer is the devcontainer spec of the environment -type EnvironmentListResponseSpecDevcontainer struct { - // devcontainer_file_path is the path to the devcontainer file relative to the repo - // root path must not be absolute (start with a /): - // - // ``` - // this.matches('^$|^[^/].*') - // ``` - DevcontainerFilePath string `json:"devcontainerFilePath"` - Session string `json:"session"` - JSON environmentListResponseSpecDevcontainerJSON `json:"-"` -} - -// environmentListResponseSpecDevcontainerJSON contains the JSON metadata for the -// struct [EnvironmentListResponseSpecDevcontainer] -type environmentListResponseSpecDevcontainerJSON struct { - DevcontainerFilePath apijson.Field - Session apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseSpecDevcontainer) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseSpecDevcontainerJSON) RawJSON() string { - return r.raw -} - -// machine is the machine spec of the environment -type EnvironmentListResponseSpecMachine struct { - // Class denotes the class of the environment we ought to start - Class string `json:"class" format:"uuid"` - Session string `json:"session"` - JSON environmentListResponseSpecMachineJSON `json:"-"` -} - -// environmentListResponseSpecMachineJSON contains the JSON metadata for the struct -// [EnvironmentListResponseSpecMachine] -type environmentListResponseSpecMachineJSON struct { - Class apijson.Field - Session apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseSpecMachine) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseSpecMachineJSON) RawJSON() string { - return r.raw -} - -type EnvironmentListResponseSpecPort struct { - // Admission level describes who can access an environment instance and its ports. - Admission EnvironmentListResponseSpecPortsAdmission `json:"admission"` - // name of this port - Name string `json:"name"` - // port number - Port int64 `json:"port"` - JSON environmentListResponseSpecPortJSON `json:"-"` -} - -// environmentListResponseSpecPortJSON contains the JSON metadata for the struct -// [EnvironmentListResponseSpecPort] -type environmentListResponseSpecPortJSON struct { - Admission apijson.Field - Name apijson.Field - Port apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseSpecPort) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseSpecPortJSON) RawJSON() string { - return r.raw -} - -// Admission level describes who can access an environment instance and its ports. -type EnvironmentListResponseSpecPortsAdmission string - -const ( - EnvironmentListResponseSpecPortsAdmissionAdmissionLevelUnspecified EnvironmentListResponseSpecPortsAdmission = "ADMISSION_LEVEL_UNSPECIFIED" - EnvironmentListResponseSpecPortsAdmissionAdmissionLevelOwnerOnly EnvironmentListResponseSpecPortsAdmission = "ADMISSION_LEVEL_OWNER_ONLY" - EnvironmentListResponseSpecPortsAdmissionAdmissionLevelEveryone EnvironmentListResponseSpecPortsAdmission = "ADMISSION_LEVEL_EVERYONE" -) - -func (r EnvironmentListResponseSpecPortsAdmission) IsKnown() bool { - switch r { - case EnvironmentListResponseSpecPortsAdmissionAdmissionLevelUnspecified, EnvironmentListResponseSpecPortsAdmissionAdmissionLevelOwnerOnly, EnvironmentListResponseSpecPortsAdmissionAdmissionLevelEveryone: - return true - } - return false -} - -type EnvironmentListResponseSpecSecret struct { - 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"` - // name is the human readable description of the secret - Name string `json:"name"` - // session indicated the current session of the secret. When the session does not - // change, secrets are not reloaded in the environment. - Session string `json:"session"` - // source is the source of the secret, for now control-plane or runner - Source string `json:"source"` - // source_ref into the source, in case of control-plane this is uuid of the secret - SourceRef string `json:"sourceRef"` - JSON environmentListResponseSpecSecretJSON `json:"-"` - union EnvironmentListResponseSpecSecretsUnion -} - -// environmentListResponseSpecSecretJSON contains the JSON metadata for the struct -// [EnvironmentListResponseSpecSecret] -type environmentListResponseSpecSecretJSON 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 -} - -func (r environmentListResponseSpecSecretJSON) RawJSON() string { - return r.raw -} - -func (r *EnvironmentListResponseSpecSecret) UnmarshalJSON(data []byte) (err error) { - *r = EnvironmentListResponseSpecSecret{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a [EnvironmentListResponseSpecSecretsUnion] interface which you -// can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [EnvironmentListResponseSpecSecretsObject], -// [EnvironmentListResponseSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted], -// [EnvironmentListResponseSpecSecretsObject]. -func (r EnvironmentListResponseSpecSecret) AsUnion() EnvironmentListResponseSpecSecretsUnion { - return r.union -} - -// Union satisfied by [EnvironmentListResponseSpecSecretsObject], -// [EnvironmentListResponseSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted] -// or [EnvironmentListResponseSpecSecretsObject]. -type EnvironmentListResponseSpecSecretsUnion interface { - implementsEnvironmentListResponseSpecSecret() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*EnvironmentListResponseSpecSecretsUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentListResponseSpecSecretsObject{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentListResponseSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentListResponseSpecSecretsObject{}), - }, - ) -} - -type EnvironmentListResponseSpecSecretsObject struct { - EnvironmentVariable string `json:"environmentVariable,required"` - // name is the human readable description of the secret - Name string `json:"name"` - // session indicated the current session of the secret. When the session does not - // change, secrets are not reloaded in the environment. - Session string `json:"session"` - // source is the source of the secret, for now control-plane or runner - Source string `json:"source"` - // source_ref into the source, in case of control-plane this is uuid of the secret - SourceRef string `json:"sourceRef"` - JSON environmentListResponseSpecSecretsObjectJSON `json:"-"` -} - -// environmentListResponseSpecSecretsObjectJSON contains the JSON metadata for the -// struct [EnvironmentListResponseSpecSecretsObject] -type environmentListResponseSpecSecretsObjectJSON struct { - EnvironmentVariable apijson.Field - Name apijson.Field - Session apijson.Field - Source apijson.Field - SourceRef apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseSpecSecretsObject) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseSpecSecretsObjectJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentListResponseSpecSecretsObject) implementsEnvironmentListResponseSpecSecret() {} - -type EnvironmentListResponseSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted struct { - // file_path is the path inside the devcontainer where the secret is mounted - FilePath string `json:"filePath,required"` - // name is the human readable description of the secret - Name string `json:"name"` - // session indicated the current session of the secret. When the session does not - // change, secrets are not reloaded in the environment. - Session string `json:"session"` - // source is the source of the secret, for now control-plane or runner - Source string `json:"source"` - // source_ref into the source, in case of control-plane this is uuid of the secret - SourceRef string `json:"sourceRef"` - JSON environmentListResponseSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMountedJSON `json:"-"` -} - -// environmentListResponseSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMountedJSON -// contains the JSON metadata for the struct -// [EnvironmentListResponseSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted] -type environmentListResponseSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMountedJSON struct { - FilePath apijson.Field - Name apijson.Field - Session apijson.Field - Source apijson.Field - SourceRef apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMountedJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentListResponseSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted) implementsEnvironmentListResponseSpecSecret() { -} - -type EnvironmentListResponseSpecSSHPublicKey struct { - // id is the unique identifier of the public key - ID string `json:"id"` - // value is the actual public key in the public key file format - Value string `json:"value"` - JSON environmentListResponseSpecSSHPublicKeyJSON `json:"-"` -} - -// environmentListResponseSpecSSHPublicKeyJSON contains the JSON metadata for the -// struct [EnvironmentListResponseSpecSSHPublicKey] -type environmentListResponseSpecSSHPublicKeyJSON struct { - ID apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseSpecSSHPublicKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseSpecSSHPublicKeyJSON) RawJSON() string { - return r.raw -} - -// Timeout configures the environment timeout -type EnvironmentListResponseSpecTimeout struct { - // A Duration represents a signed, fixed-length span of time represented as a count - // of seconds and fractions of seconds at nanosecond resolution. It is independent - // of any calendar and concepts like "day" or "month". It is related to Timestamp - // in that the difference between two Timestamp values is a Duration and it can be - // added or subtracted from a Timestamp. Range is approximately +-10,000 years. - // - // # Examples - // - // Example 1: Compute Duration from two Timestamps in pseudo code. - // - // Timestamp start = ...; - // Timestamp end = ...; - // Duration duration = ...; - // - // duration.seconds = end.seconds - start.seconds; - // duration.nanos = end.nanos - start.nanos; - // - // if (duration.seconds < 0 && duration.nanos > 0) { - // duration.seconds += 1; - // duration.nanos -= 1000000000; - // } else if (duration.seconds > 0 && duration.nanos < 0) { - // duration.seconds -= 1; - // duration.nanos += 1000000000; - // } - // - // Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. - // - // Timestamp start = ...; - // Duration duration = ...; - // Timestamp end = ...; - // - // end.seconds = start.seconds + duration.seconds; - // end.nanos = start.nanos + duration.nanos; - // - // if (end.nanos < 0) { - // end.seconds -= 1; - // end.nanos += 1000000000; - // } else if (end.nanos >= 1000000000) { - // end.seconds += 1; - // end.nanos -= 1000000000; - // } - // - // Example 3: Compute Duration from datetime.timedelta in Python. - // - // td = datetime.timedelta(days=3, minutes=10) - // duration = Duration() - // duration.FromTimedelta(td) - // - // # JSON Mapping - // - // In JSON format, the Duration type is encoded as a string rather than an object, - // where the string ends in the suffix "s" (indicating seconds) and is preceded by - // the number of seconds, with nanoseconds expressed as fractional seconds. For - // example, 3 seconds with 0 nanoseconds should be encoded in JSON format as "3s", - // while 3 seconds and 1 nanosecond should be expressed in JSON format as - // "3.000000001s", and 3 seconds and 1 microsecond should be expressed in JSON - // format as "3.000001s". - Disconnected string `json:"disconnected" format:"regex"` - JSON environmentListResponseSpecTimeoutJSON `json:"-"` -} - -// environmentListResponseSpecTimeoutJSON contains the JSON metadata for the struct -// [EnvironmentListResponseSpecTimeout] -type environmentListResponseSpecTimeoutJSON struct { - Disconnected apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseSpecTimeout) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseSpecTimeoutJSON) RawJSON() string { - return r.raw -} - -// EnvironmentStatus describes an environment status -type EnvironmentListResponseStatus struct { - // EnvironmentActivitySignal used to signal activity for an environment. - ActivitySignal EnvironmentListResponseStatusActivitySignal `json:"activitySignal"` - // automations_file contains the status of the automations file. - AutomationsFile EnvironmentListResponseStatusAutomationsFile `json:"automationsFile"` - // content contains the status of the environment content. - Content EnvironmentListResponseStatusContent `json:"content"` - // devcontainer contains the status of the devcontainer. - Devcontainer EnvironmentListResponseStatusDevcontainer `json:"devcontainer"` - // environment_url contains the URL at which the environment can be accessed. This - // field is only set if the environment is running. - EnvironmentURLs EnvironmentListResponseStatusEnvironmentURLs `json:"environmentUrls"` - // failure_message summarises why the environment failed to operate. If this is - // non-empty the environment has failed to operate and will likely transition to a - // stopped state. - FailureMessage []string `json:"failureMessage"` - // machine contains the status of the environment machine - Machine EnvironmentListResponseStatusMachine `json:"machine"` - // the phase of an environment is a simple, high-level summary of where the - // environment is in its lifecycle - Phase EnvironmentListResponseStatusPhase `json:"phase"` - // RunnerACK is the acknowledgement from the runner that is has received the - // environment spec. - RunnerAck EnvironmentListResponseStatusRunnerAck `json:"runnerAck"` - // secrets contains the status of the environment secrets - Secrets []EnvironmentListResponseStatusSecret `json:"secrets"` - // ssh_public_keys contains the status of the environment ssh public keys - SSHPublicKeys []EnvironmentListResponseStatusSSHPublicKey `json:"sshPublicKeys"` - // version of the status update. Environment instances themselves are unversioned, - // but their status has different versions. The value of this field has no semantic - // meaning (e.g. don't interpret it as as a timestamp), but it can be used to - // impose a partial order. If a.status_version < b.status_version then a was the - // status before b. - StatusVersion string `json:"statusVersion"` - // warning_message contains warnings, e.g. when the environment is present but not - // in the expected state. - WarningMessage []string `json:"warningMessage"` - JSON environmentListResponseStatusJSON `json:"-"` -} - -// environmentListResponseStatusJSON contains the JSON metadata for the struct -// [EnvironmentListResponseStatus] -type environmentListResponseStatusJSON struct { - ActivitySignal apijson.Field - AutomationsFile apijson.Field - Content apijson.Field - Devcontainer apijson.Field - EnvironmentURLs apijson.Field - FailureMessage apijson.Field - Machine apijson.Field - Phase apijson.Field - RunnerAck apijson.Field - Secrets apijson.Field - SSHPublicKeys apijson.Field - StatusVersion apijson.Field - WarningMessage apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseStatus) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseStatusJSON) RawJSON() string { - return r.raw -} - -// EnvironmentActivitySignal used to signal activity for an environment. -type EnvironmentListResponseStatusActivitySignal struct { - // source of the activity signal, such as "VS Code", "SSH", or "Automations". It - // should be a human-readable string that describes the source of the activity - // signal. - Source string `json:"source"` - // 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. - Timestamp time.Time `json:"timestamp" format:"date-time"` - JSON environmentListResponseStatusActivitySignalJSON `json:"-"` -} - -// environmentListResponseStatusActivitySignalJSON contains the JSON metadata for -// the struct [EnvironmentListResponseStatusActivitySignal] -type environmentListResponseStatusActivitySignalJSON struct { - Source apijson.Field - Timestamp apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseStatusActivitySignal) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseStatusActivitySignalJSON) RawJSON() string { - return r.raw -} - -// automations_file contains the status of the automations file. -type EnvironmentListResponseStatusAutomationsFile struct { - // automations_file_path is the path to the automations file relative to the repo - // root. - AutomationsFilePath string `json:"automationsFilePath"` - // automations_file_presence indicates how an automations file is present in the - // environment. - AutomationsFilePresence EnvironmentListResponseStatusAutomationsFileAutomationsFilePresence `json:"automationsFilePresence"` - // failure_message contains the reason the automations file failed to be applied. - // This is only set if the phase is FAILED. - FailureMessage string `json:"failureMessage"` - // phase is the current phase of the automations file. - Phase EnvironmentListResponseStatusAutomationsFilePhase `json:"phase"` - // session is the automations file session that is currently applied in the - // environment. - Session string `json:"session"` - JSON environmentListResponseStatusAutomationsFileJSON `json:"-"` -} - -// environmentListResponseStatusAutomationsFileJSON contains the JSON metadata for -// the struct [EnvironmentListResponseStatusAutomationsFile] -type environmentListResponseStatusAutomationsFileJSON struct { - AutomationsFilePath apijson.Field - AutomationsFilePresence apijson.Field - FailureMessage apijson.Field - Phase apijson.Field - Session apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseStatusAutomationsFile) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseStatusAutomationsFileJSON) RawJSON() string { - return r.raw -} - -// automations_file_presence indicates how an automations file is present in the -// environment. -type EnvironmentListResponseStatusAutomationsFileAutomationsFilePresence string - -const ( - EnvironmentListResponseStatusAutomationsFileAutomationsFilePresencePresenceUnspecified EnvironmentListResponseStatusAutomationsFileAutomationsFilePresence = "PRESENCE_UNSPECIFIED" - EnvironmentListResponseStatusAutomationsFileAutomationsFilePresencePresenceAbsent EnvironmentListResponseStatusAutomationsFileAutomationsFilePresence = "PRESENCE_ABSENT" - EnvironmentListResponseStatusAutomationsFileAutomationsFilePresencePresenceDiscovered EnvironmentListResponseStatusAutomationsFileAutomationsFilePresence = "PRESENCE_DISCOVERED" - EnvironmentListResponseStatusAutomationsFileAutomationsFilePresencePresenceSpecified EnvironmentListResponseStatusAutomationsFileAutomationsFilePresence = "PRESENCE_SPECIFIED" -) - -func (r EnvironmentListResponseStatusAutomationsFileAutomationsFilePresence) IsKnown() bool { - switch r { - case EnvironmentListResponseStatusAutomationsFileAutomationsFilePresencePresenceUnspecified, EnvironmentListResponseStatusAutomationsFileAutomationsFilePresencePresenceAbsent, EnvironmentListResponseStatusAutomationsFileAutomationsFilePresencePresenceDiscovered, EnvironmentListResponseStatusAutomationsFileAutomationsFilePresencePresenceSpecified: - return true - } - return false -} - -// phase is the current phase of the automations file. -type EnvironmentListResponseStatusAutomationsFilePhase string - -const ( - EnvironmentListResponseStatusAutomationsFilePhaseContentPhaseUnspecified EnvironmentListResponseStatusAutomationsFilePhase = "CONTENT_PHASE_UNSPECIFIED" - EnvironmentListResponseStatusAutomationsFilePhaseContentPhaseCreating EnvironmentListResponseStatusAutomationsFilePhase = "CONTENT_PHASE_CREATING" - EnvironmentListResponseStatusAutomationsFilePhaseContentPhaseInitializing EnvironmentListResponseStatusAutomationsFilePhase = "CONTENT_PHASE_INITIALIZING" - EnvironmentListResponseStatusAutomationsFilePhaseContentPhaseReady EnvironmentListResponseStatusAutomationsFilePhase = "CONTENT_PHASE_READY" - EnvironmentListResponseStatusAutomationsFilePhaseContentPhaseUpdating EnvironmentListResponseStatusAutomationsFilePhase = "CONTENT_PHASE_UPDATING" - EnvironmentListResponseStatusAutomationsFilePhaseContentPhaseFailed EnvironmentListResponseStatusAutomationsFilePhase = "CONTENT_PHASE_FAILED" -) - -func (r EnvironmentListResponseStatusAutomationsFilePhase) IsKnown() bool { - switch r { - case EnvironmentListResponseStatusAutomationsFilePhaseContentPhaseUnspecified, EnvironmentListResponseStatusAutomationsFilePhaseContentPhaseCreating, EnvironmentListResponseStatusAutomationsFilePhaseContentPhaseInitializing, EnvironmentListResponseStatusAutomationsFilePhaseContentPhaseReady, EnvironmentListResponseStatusAutomationsFilePhaseContentPhaseUpdating, EnvironmentListResponseStatusAutomationsFilePhaseContentPhaseFailed: - return true - } - return false -} - -// content contains the status of the environment content. -type EnvironmentListResponseStatusContent struct { - // content_location_in_machine is the location of the content in the machine - ContentLocationInMachine string `json:"contentLocationInMachine"` - // failure_message contains the reason the content initialization failed. - FailureMessage string `json:"failureMessage"` - // git is the Git working copy status of the environment. Note: this is a - // best-effort field and more often than not will not be present. Its absence does - // not indicate the absence of a working copy. - Git EnvironmentListResponseStatusContentGit `json:"git"` - // phase is the current phase of the environment content - Phase EnvironmentListResponseStatusContentPhase `json:"phase"` - // session is the session that is currently active in the environment. - Session string `json:"session"` - // warning_message contains warnings, e.g. when the content is present but not in - // the expected state. - WarningMessage string `json:"warningMessage"` - JSON environmentListResponseStatusContentJSON `json:"-"` -} - -// environmentListResponseStatusContentJSON contains the JSON metadata for the -// struct [EnvironmentListResponseStatusContent] -type environmentListResponseStatusContentJSON struct { - ContentLocationInMachine apijson.Field - FailureMessage apijson.Field - Git apijson.Field - Phase apijson.Field - Session apijson.Field - WarningMessage apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseStatusContent) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseStatusContentJSON) RawJSON() string { - return r.raw -} - -// git is the Git working copy status of the environment. Note: this is a -// best-effort field and more often than not will not be present. Its absence does -// not indicate the absence of a working copy. -type EnvironmentListResponseStatusContentGit struct { - // branch is branch we're currently on - Branch string `json:"branch"` - // changed_files is an array of changed files in the environment, possibly - // truncated - ChangedFiles []EnvironmentListResponseStatusContentGitChangedFile `json:"changedFiles"` - // clone_url is the repository url as you would pass it to "git clone". Only HTTPS - // clone URLs are supported. - CloneURL string `json:"cloneUrl"` - // latest_commit is the most recent commit on the current branch - LatestCommit string `json:"latestCommit"` - TotalChangedFiles int64 `json:"totalChangedFiles"` - // the total number of unpushed changes - TotalUnpushedCommits int64 `json:"totalUnpushedCommits"` - // unpushed_commits is an array of unpushed changes in the environment, possibly - // truncated - UnpushedCommits []string `json:"unpushedCommits"` - JSON environmentListResponseStatusContentGitJSON `json:"-"` -} - -// environmentListResponseStatusContentGitJSON contains the JSON metadata for the -// struct [EnvironmentListResponseStatusContentGit] -type environmentListResponseStatusContentGitJSON struct { - Branch apijson.Field - ChangedFiles apijson.Field - CloneURL apijson.Field - LatestCommit apijson.Field - TotalChangedFiles apijson.Field - TotalUnpushedCommits apijson.Field - UnpushedCommits apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseStatusContentGit) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseStatusContentGitJSON) RawJSON() string { - return r.raw -} - -type EnvironmentListResponseStatusContentGitChangedFile struct { - // ChangeType is the type of change that happened to the file - ChangeType EnvironmentListResponseStatusContentGitChangedFilesChangeType `json:"changeType"` - // path is the path of the file - Path string `json:"path"` - JSON environmentListResponseStatusContentGitChangedFileJSON `json:"-"` -} - -// environmentListResponseStatusContentGitChangedFileJSON contains the JSON -// metadata for the struct [EnvironmentListResponseStatusContentGitChangedFile] -type environmentListResponseStatusContentGitChangedFileJSON struct { - ChangeType apijson.Field - Path apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseStatusContentGitChangedFile) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseStatusContentGitChangedFileJSON) RawJSON() string { - return r.raw -} - -// ChangeType is the type of change that happened to the file -type EnvironmentListResponseStatusContentGitChangedFilesChangeType string - -const ( - EnvironmentListResponseStatusContentGitChangedFilesChangeTypeChangeTypeUnspecified EnvironmentListResponseStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_UNSPECIFIED" - EnvironmentListResponseStatusContentGitChangedFilesChangeTypeChangeTypeAdded EnvironmentListResponseStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_ADDED" - EnvironmentListResponseStatusContentGitChangedFilesChangeTypeChangeTypeModified EnvironmentListResponseStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_MODIFIED" - EnvironmentListResponseStatusContentGitChangedFilesChangeTypeChangeTypeDeleted EnvironmentListResponseStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_DELETED" - EnvironmentListResponseStatusContentGitChangedFilesChangeTypeChangeTypeRenamed EnvironmentListResponseStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_RENAMED" - EnvironmentListResponseStatusContentGitChangedFilesChangeTypeChangeTypeCopied EnvironmentListResponseStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_COPIED" - EnvironmentListResponseStatusContentGitChangedFilesChangeTypeChangeTypeUpdatedButUnmerged EnvironmentListResponseStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_UPDATED_BUT_UNMERGED" - EnvironmentListResponseStatusContentGitChangedFilesChangeTypeChangeTypeUntracked EnvironmentListResponseStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_UNTRACKED" -) - -func (r EnvironmentListResponseStatusContentGitChangedFilesChangeType) IsKnown() bool { - switch r { - case EnvironmentListResponseStatusContentGitChangedFilesChangeTypeChangeTypeUnspecified, EnvironmentListResponseStatusContentGitChangedFilesChangeTypeChangeTypeAdded, EnvironmentListResponseStatusContentGitChangedFilesChangeTypeChangeTypeModified, EnvironmentListResponseStatusContentGitChangedFilesChangeTypeChangeTypeDeleted, EnvironmentListResponseStatusContentGitChangedFilesChangeTypeChangeTypeRenamed, EnvironmentListResponseStatusContentGitChangedFilesChangeTypeChangeTypeCopied, EnvironmentListResponseStatusContentGitChangedFilesChangeTypeChangeTypeUpdatedButUnmerged, EnvironmentListResponseStatusContentGitChangedFilesChangeTypeChangeTypeUntracked: - return true - } - return false -} - -// phase is the current phase of the environment content -type EnvironmentListResponseStatusContentPhase string - -const ( - EnvironmentListResponseStatusContentPhaseContentPhaseUnspecified EnvironmentListResponseStatusContentPhase = "CONTENT_PHASE_UNSPECIFIED" - EnvironmentListResponseStatusContentPhaseContentPhaseCreating EnvironmentListResponseStatusContentPhase = "CONTENT_PHASE_CREATING" - EnvironmentListResponseStatusContentPhaseContentPhaseInitializing EnvironmentListResponseStatusContentPhase = "CONTENT_PHASE_INITIALIZING" - EnvironmentListResponseStatusContentPhaseContentPhaseReady EnvironmentListResponseStatusContentPhase = "CONTENT_PHASE_READY" - EnvironmentListResponseStatusContentPhaseContentPhaseUpdating EnvironmentListResponseStatusContentPhase = "CONTENT_PHASE_UPDATING" - EnvironmentListResponseStatusContentPhaseContentPhaseFailed EnvironmentListResponseStatusContentPhase = "CONTENT_PHASE_FAILED" -) - -func (r EnvironmentListResponseStatusContentPhase) IsKnown() bool { - switch r { - case EnvironmentListResponseStatusContentPhaseContentPhaseUnspecified, EnvironmentListResponseStatusContentPhaseContentPhaseCreating, EnvironmentListResponseStatusContentPhaseContentPhaseInitializing, EnvironmentListResponseStatusContentPhaseContentPhaseReady, EnvironmentListResponseStatusContentPhaseContentPhaseUpdating, EnvironmentListResponseStatusContentPhaseContentPhaseFailed: - return true - } - return false -} - -// devcontainer contains the status of the devcontainer. -type EnvironmentListResponseStatusDevcontainer struct { - // container_id is the ID of the container. - ContainerID string `json:"containerId"` - // container_name is the name of the container that is used to connect to the - // devcontainer - ContainerName string `json:"containerName"` - // devcontainerconfig_in_sync indicates if the devcontainer is up to date w.r.t. - // the devcontainer config file. - DevcontainerconfigInSync bool `json:"devcontainerconfigInSync"` - // devcontainer_file_path is the path to the devcontainer file relative to the repo - // root - DevcontainerFilePath string `json:"devcontainerFilePath"` - // devcontainer_file_presence indicates how the devcontainer file is present in the - // repo. - DevcontainerFilePresence EnvironmentListResponseStatusDevcontainerDevcontainerFilePresence `json:"devcontainerFilePresence"` - // failure_message contains the reason the devcontainer failed to operate. - FailureMessage string `json:"failureMessage"` - // phase is the current phase of the devcontainer - Phase EnvironmentListResponseStatusDevcontainerPhase `json:"phase"` - // remote_user is the user that is used to connect to the devcontainer - RemoteUser string `json:"remoteUser"` - // remote_workspace_folder is the folder that is used to connect to the - // devcontainer - RemoteWorkspaceFolder string `json:"remoteWorkspaceFolder"` - // secrets_in_sync indicates if the secrets are up to date w.r.t. the running - // devcontainer. - SecretsInSync bool `json:"secretsInSync"` - // session is the session that is currently active in the devcontainer. - Session string `json:"session"` - // warning_message contains warnings, e.g. when the devcontainer is present but not - // in the expected state. - WarningMessage string `json:"warningMessage"` - JSON environmentListResponseStatusDevcontainerJSON `json:"-"` -} - -// environmentListResponseStatusDevcontainerJSON contains the JSON metadata for the -// struct [EnvironmentListResponseStatusDevcontainer] -type environmentListResponseStatusDevcontainerJSON struct { - ContainerID apijson.Field - ContainerName apijson.Field - DevcontainerconfigInSync apijson.Field - DevcontainerFilePath apijson.Field - DevcontainerFilePresence apijson.Field - FailureMessage apijson.Field - Phase apijson.Field - RemoteUser apijson.Field - RemoteWorkspaceFolder apijson.Field - SecretsInSync apijson.Field - Session apijson.Field - WarningMessage apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseStatusDevcontainer) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseStatusDevcontainerJSON) RawJSON() string { - return r.raw -} - -// devcontainer_file_presence indicates how the devcontainer file is present in the -// repo. -type EnvironmentListResponseStatusDevcontainerDevcontainerFilePresence string - -const ( - EnvironmentListResponseStatusDevcontainerDevcontainerFilePresencePresenceUnspecified EnvironmentListResponseStatusDevcontainerDevcontainerFilePresence = "PRESENCE_UNSPECIFIED" - EnvironmentListResponseStatusDevcontainerDevcontainerFilePresencePresenceGenerated EnvironmentListResponseStatusDevcontainerDevcontainerFilePresence = "PRESENCE_GENERATED" - EnvironmentListResponseStatusDevcontainerDevcontainerFilePresencePresenceDiscovered EnvironmentListResponseStatusDevcontainerDevcontainerFilePresence = "PRESENCE_DISCOVERED" - EnvironmentListResponseStatusDevcontainerDevcontainerFilePresencePresenceSpecified EnvironmentListResponseStatusDevcontainerDevcontainerFilePresence = "PRESENCE_SPECIFIED" -) - -func (r EnvironmentListResponseStatusDevcontainerDevcontainerFilePresence) IsKnown() bool { - switch r { - case EnvironmentListResponseStatusDevcontainerDevcontainerFilePresencePresenceUnspecified, EnvironmentListResponseStatusDevcontainerDevcontainerFilePresencePresenceGenerated, EnvironmentListResponseStatusDevcontainerDevcontainerFilePresencePresenceDiscovered, EnvironmentListResponseStatusDevcontainerDevcontainerFilePresencePresenceSpecified: - return true - } - return false -} - -// phase is the current phase of the devcontainer -type EnvironmentListResponseStatusDevcontainerPhase string - -const ( - EnvironmentListResponseStatusDevcontainerPhasePhaseUnspecified EnvironmentListResponseStatusDevcontainerPhase = "PHASE_UNSPECIFIED" - EnvironmentListResponseStatusDevcontainerPhasePhaseCreating EnvironmentListResponseStatusDevcontainerPhase = "PHASE_CREATING" - EnvironmentListResponseStatusDevcontainerPhasePhaseRunning EnvironmentListResponseStatusDevcontainerPhase = "PHASE_RUNNING" - EnvironmentListResponseStatusDevcontainerPhasePhaseStopped EnvironmentListResponseStatusDevcontainerPhase = "PHASE_STOPPED" - EnvironmentListResponseStatusDevcontainerPhasePhaseFailed EnvironmentListResponseStatusDevcontainerPhase = "PHASE_FAILED" -) - -func (r EnvironmentListResponseStatusDevcontainerPhase) IsKnown() bool { - switch r { - case EnvironmentListResponseStatusDevcontainerPhasePhaseUnspecified, EnvironmentListResponseStatusDevcontainerPhasePhaseCreating, EnvironmentListResponseStatusDevcontainerPhasePhaseRunning, EnvironmentListResponseStatusDevcontainerPhasePhaseStopped, EnvironmentListResponseStatusDevcontainerPhasePhaseFailed: - return true - } - return false -} - -// environment_url contains the URL at which the environment can be accessed. This -// field is only set if the environment is running. -type EnvironmentListResponseStatusEnvironmentURLs struct { - // logs is the URL at which the environment logs can be accessed. - Logs string `json:"logs"` - Ports []EnvironmentListResponseStatusEnvironmentURLsPort `json:"ports"` - // SSH is the URL at which the environment can be accessed via SSH. - SSH EnvironmentListResponseStatusEnvironmentURLsSSH `json:"ssh"` - JSON environmentListResponseStatusEnvironmentURLsJSON `json:"-"` -} - -// environmentListResponseStatusEnvironmentURLsJSON contains the JSON metadata for -// the struct [EnvironmentListResponseStatusEnvironmentURLs] -type environmentListResponseStatusEnvironmentURLsJSON struct { - Logs apijson.Field - Ports apijson.Field - SSH apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseStatusEnvironmentURLs) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseStatusEnvironmentURLsJSON) RawJSON() string { - return r.raw -} - -type EnvironmentListResponseStatusEnvironmentURLsPort struct { - // port is the port number of the environment port - Port int64 `json:"port"` - // url is the URL at which the environment port can be accessed - URL string `json:"url"` - JSON environmentListResponseStatusEnvironmentURLsPortJSON `json:"-"` -} - -// environmentListResponseStatusEnvironmentURLsPortJSON contains the JSON metadata -// for the struct [EnvironmentListResponseStatusEnvironmentURLsPort] -type environmentListResponseStatusEnvironmentURLsPortJSON struct { - Port apijson.Field - URL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseStatusEnvironmentURLsPort) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseStatusEnvironmentURLsPortJSON) RawJSON() string { - return r.raw -} - -// SSH is the URL at which the environment can be accessed via SSH. -type EnvironmentListResponseStatusEnvironmentURLsSSH struct { - URL string `json:"url"` - JSON environmentListResponseStatusEnvironmentURLsSSHJSON `json:"-"` -} - -// environmentListResponseStatusEnvironmentURLsSSHJSON contains the JSON metadata -// for the struct [EnvironmentListResponseStatusEnvironmentURLsSSH] -type environmentListResponseStatusEnvironmentURLsSSHJSON struct { - URL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseStatusEnvironmentURLsSSH) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseStatusEnvironmentURLsSSHJSON) RawJSON() string { - return r.raw -} - -// machine contains the status of the environment machine -type EnvironmentListResponseStatusMachine struct { - // failure_message contains the reason the machine failed to operate. - FailureMessage string `json:"failureMessage"` - // phase is the current phase of the environment machine - Phase EnvironmentListResponseStatusMachinePhase `json:"phase"` - // session is the session that is currently active in the machine. - Session string `json:"session"` - // timeout contains the reason the environment has timed out. If this field is - // empty, the environment has not timed out. - Timeout string `json:"timeout"` - // versions contains the versions of components in the machine. - Versions EnvironmentListResponseStatusMachineVersions `json:"versions"` - // warning_message contains warnings, e.g. when the machine is present but not in - // the expected state. - WarningMessage string `json:"warningMessage"` - JSON environmentListResponseStatusMachineJSON `json:"-"` -} - -// environmentListResponseStatusMachineJSON contains the JSON metadata for the -// struct [EnvironmentListResponseStatusMachine] -type environmentListResponseStatusMachineJSON struct { - FailureMessage apijson.Field - Phase apijson.Field - Session apijson.Field - Timeout apijson.Field - Versions apijson.Field - WarningMessage apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseStatusMachine) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseStatusMachineJSON) RawJSON() string { - return r.raw -} - -// phase is the current phase of the environment machine -type EnvironmentListResponseStatusMachinePhase string - -const ( - EnvironmentListResponseStatusMachinePhasePhaseUnspecified EnvironmentListResponseStatusMachinePhase = "PHASE_UNSPECIFIED" - EnvironmentListResponseStatusMachinePhasePhaseCreating EnvironmentListResponseStatusMachinePhase = "PHASE_CREATING" - EnvironmentListResponseStatusMachinePhasePhaseStarting EnvironmentListResponseStatusMachinePhase = "PHASE_STARTING" - EnvironmentListResponseStatusMachinePhasePhaseRunning EnvironmentListResponseStatusMachinePhase = "PHASE_RUNNING" - EnvironmentListResponseStatusMachinePhasePhaseStopping EnvironmentListResponseStatusMachinePhase = "PHASE_STOPPING" - EnvironmentListResponseStatusMachinePhasePhaseStopped EnvironmentListResponseStatusMachinePhase = "PHASE_STOPPED" - EnvironmentListResponseStatusMachinePhasePhaseDeleting EnvironmentListResponseStatusMachinePhase = "PHASE_DELETING" - EnvironmentListResponseStatusMachinePhasePhaseDeleted EnvironmentListResponseStatusMachinePhase = "PHASE_DELETED" -) - -func (r EnvironmentListResponseStatusMachinePhase) IsKnown() bool { - switch r { - case EnvironmentListResponseStatusMachinePhasePhaseUnspecified, EnvironmentListResponseStatusMachinePhasePhaseCreating, EnvironmentListResponseStatusMachinePhasePhaseStarting, EnvironmentListResponseStatusMachinePhasePhaseRunning, EnvironmentListResponseStatusMachinePhasePhaseStopping, EnvironmentListResponseStatusMachinePhasePhaseStopped, EnvironmentListResponseStatusMachinePhasePhaseDeleting, EnvironmentListResponseStatusMachinePhasePhaseDeleted: - return true - } - return false -} - -// versions contains the versions of components in the machine. -type EnvironmentListResponseStatusMachineVersions struct { - SupervisorCommit string `json:"supervisorCommit"` - SupervisorVersion string `json:"supervisorVersion"` - JSON environmentListResponseStatusMachineVersionsJSON `json:"-"` -} - -// environmentListResponseStatusMachineVersionsJSON contains the JSON metadata for -// the struct [EnvironmentListResponseStatusMachineVersions] -type environmentListResponseStatusMachineVersionsJSON struct { - SupervisorCommit apijson.Field - SupervisorVersion apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseStatusMachineVersions) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseStatusMachineVersionsJSON) RawJSON() string { - return r.raw -} - -// the phase of an environment is a simple, high-level summary of where the -// environment is in its lifecycle -type EnvironmentListResponseStatusPhase string - -const ( - EnvironmentListResponseStatusPhaseEnvironmentPhaseUnspecified EnvironmentListResponseStatusPhase = "ENVIRONMENT_PHASE_UNSPECIFIED" - EnvironmentListResponseStatusPhaseEnvironmentPhaseCreating EnvironmentListResponseStatusPhase = "ENVIRONMENT_PHASE_CREATING" - EnvironmentListResponseStatusPhaseEnvironmentPhaseStarting EnvironmentListResponseStatusPhase = "ENVIRONMENT_PHASE_STARTING" - EnvironmentListResponseStatusPhaseEnvironmentPhaseRunning EnvironmentListResponseStatusPhase = "ENVIRONMENT_PHASE_RUNNING" - EnvironmentListResponseStatusPhaseEnvironmentPhaseUpdating EnvironmentListResponseStatusPhase = "ENVIRONMENT_PHASE_UPDATING" - EnvironmentListResponseStatusPhaseEnvironmentPhaseStopping EnvironmentListResponseStatusPhase = "ENVIRONMENT_PHASE_STOPPING" - EnvironmentListResponseStatusPhaseEnvironmentPhaseStopped EnvironmentListResponseStatusPhase = "ENVIRONMENT_PHASE_STOPPED" - EnvironmentListResponseStatusPhaseEnvironmentPhaseDeleting EnvironmentListResponseStatusPhase = "ENVIRONMENT_PHASE_DELETING" - EnvironmentListResponseStatusPhaseEnvironmentPhaseDeleted EnvironmentListResponseStatusPhase = "ENVIRONMENT_PHASE_DELETED" -) - -func (r EnvironmentListResponseStatusPhase) IsKnown() bool { - switch r { - case EnvironmentListResponseStatusPhaseEnvironmentPhaseUnspecified, EnvironmentListResponseStatusPhaseEnvironmentPhaseCreating, EnvironmentListResponseStatusPhaseEnvironmentPhaseStarting, EnvironmentListResponseStatusPhaseEnvironmentPhaseRunning, EnvironmentListResponseStatusPhaseEnvironmentPhaseUpdating, EnvironmentListResponseStatusPhaseEnvironmentPhaseStopping, EnvironmentListResponseStatusPhaseEnvironmentPhaseStopped, EnvironmentListResponseStatusPhaseEnvironmentPhaseDeleting, EnvironmentListResponseStatusPhaseEnvironmentPhaseDeleted: - return true - } - return false -} - -// RunnerACK is the acknowledgement from the runner that is has received the -// environment spec. -type EnvironmentListResponseStatusRunnerAck struct { - Message string `json:"message"` - SpecVersion string `json:"specVersion"` - StatusCode EnvironmentListResponseStatusRunnerAckStatusCode `json:"statusCode"` - JSON environmentListResponseStatusRunnerAckJSON `json:"-"` -} - -// environmentListResponseStatusRunnerAckJSON contains the JSON metadata for the -// struct [EnvironmentListResponseStatusRunnerAck] -type environmentListResponseStatusRunnerAckJSON struct { - Message apijson.Field - SpecVersion apijson.Field - StatusCode apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseStatusRunnerAck) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseStatusRunnerAckJSON) RawJSON() string { - return r.raw -} - -type EnvironmentListResponseStatusRunnerAckStatusCode string - -const ( - EnvironmentListResponseStatusRunnerAckStatusCodeStatusCodeUnspecified EnvironmentListResponseStatusRunnerAckStatusCode = "STATUS_CODE_UNSPECIFIED" - EnvironmentListResponseStatusRunnerAckStatusCodeStatusCodeOk EnvironmentListResponseStatusRunnerAckStatusCode = "STATUS_CODE_OK" - EnvironmentListResponseStatusRunnerAckStatusCodeStatusCodeInvalidResource EnvironmentListResponseStatusRunnerAckStatusCode = "STATUS_CODE_INVALID_RESOURCE" - EnvironmentListResponseStatusRunnerAckStatusCodeStatusCodeFailedPrecondition EnvironmentListResponseStatusRunnerAckStatusCode = "STATUS_CODE_FAILED_PRECONDITION" -) - -func (r EnvironmentListResponseStatusRunnerAckStatusCode) IsKnown() bool { - switch r { - case EnvironmentListResponseStatusRunnerAckStatusCodeStatusCodeUnspecified, EnvironmentListResponseStatusRunnerAckStatusCodeStatusCodeOk, EnvironmentListResponseStatusRunnerAckStatusCodeStatusCodeInvalidResource, EnvironmentListResponseStatusRunnerAckStatusCodeStatusCodeFailedPrecondition: - return true - } - return false -} - -type EnvironmentListResponseStatusSecret struct { - // failure_message contains the reason the secret failed to be materialize. - FailureMessage string `json:"failureMessage"` - Phase EnvironmentListResponseStatusSecretsPhase `json:"phase"` - SecretName string `json:"secretName"` - // session is the session that is currently active in the environment. - Session string `json:"session"` - // warning_message contains warnings, e.g. when the secret is present but not in - // the expected state. - WarningMessage string `json:"warningMessage"` - JSON environmentListResponseStatusSecretJSON `json:"-"` -} - -// environmentListResponseStatusSecretJSON contains the JSON metadata for the -// struct [EnvironmentListResponseStatusSecret] -type environmentListResponseStatusSecretJSON struct { - FailureMessage apijson.Field - Phase apijson.Field - SecretName apijson.Field - Session apijson.Field - WarningMessage apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseStatusSecret) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseStatusSecretJSON) RawJSON() string { - return r.raw -} - -type EnvironmentListResponseStatusSecretsPhase string - -const ( - EnvironmentListResponseStatusSecretsPhaseContentPhaseUnspecified EnvironmentListResponseStatusSecretsPhase = "CONTENT_PHASE_UNSPECIFIED" - EnvironmentListResponseStatusSecretsPhaseContentPhaseCreating EnvironmentListResponseStatusSecretsPhase = "CONTENT_PHASE_CREATING" - EnvironmentListResponseStatusSecretsPhaseContentPhaseInitializing EnvironmentListResponseStatusSecretsPhase = "CONTENT_PHASE_INITIALIZING" - EnvironmentListResponseStatusSecretsPhaseContentPhaseReady EnvironmentListResponseStatusSecretsPhase = "CONTENT_PHASE_READY" - EnvironmentListResponseStatusSecretsPhaseContentPhaseUpdating EnvironmentListResponseStatusSecretsPhase = "CONTENT_PHASE_UPDATING" - EnvironmentListResponseStatusSecretsPhaseContentPhaseFailed EnvironmentListResponseStatusSecretsPhase = "CONTENT_PHASE_FAILED" -) - -func (r EnvironmentListResponseStatusSecretsPhase) IsKnown() bool { - switch r { - case EnvironmentListResponseStatusSecretsPhaseContentPhaseUnspecified, EnvironmentListResponseStatusSecretsPhaseContentPhaseCreating, EnvironmentListResponseStatusSecretsPhaseContentPhaseInitializing, EnvironmentListResponseStatusSecretsPhaseContentPhaseReady, EnvironmentListResponseStatusSecretsPhaseContentPhaseUpdating, EnvironmentListResponseStatusSecretsPhaseContentPhaseFailed: - return true - } - return false -} - -type EnvironmentListResponseStatusSSHPublicKey struct { - // id is the unique identifier of the public key - ID string `json:"id"` - // phase is the current phase of the public key - Phase EnvironmentListResponseStatusSSHPublicKeysPhase `json:"phase"` - JSON environmentListResponseStatusSSHPublicKeyJSON `json:"-"` -} - -// environmentListResponseStatusSSHPublicKeyJSON contains the JSON metadata for the -// struct [EnvironmentListResponseStatusSSHPublicKey] -type environmentListResponseStatusSSHPublicKeyJSON struct { - ID apijson.Field - Phase apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentListResponseStatusSSHPublicKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentListResponseStatusSSHPublicKeyJSON) RawJSON() string { - return r.raw -} - -// phase is the current phase of the public key -type EnvironmentListResponseStatusSSHPublicKeysPhase string - -const ( - EnvironmentListResponseStatusSSHPublicKeysPhaseContentPhaseUnspecified EnvironmentListResponseStatusSSHPublicKeysPhase = "CONTENT_PHASE_UNSPECIFIED" - EnvironmentListResponseStatusSSHPublicKeysPhaseContentPhaseCreating EnvironmentListResponseStatusSSHPublicKeysPhase = "CONTENT_PHASE_CREATING" - EnvironmentListResponseStatusSSHPublicKeysPhaseContentPhaseInitializing EnvironmentListResponseStatusSSHPublicKeysPhase = "CONTENT_PHASE_INITIALIZING" - EnvironmentListResponseStatusSSHPublicKeysPhaseContentPhaseReady EnvironmentListResponseStatusSSHPublicKeysPhase = "CONTENT_PHASE_READY" - EnvironmentListResponseStatusSSHPublicKeysPhaseContentPhaseUpdating EnvironmentListResponseStatusSSHPublicKeysPhase = "CONTENT_PHASE_UPDATING" - EnvironmentListResponseStatusSSHPublicKeysPhaseContentPhaseFailed EnvironmentListResponseStatusSSHPublicKeysPhase = "CONTENT_PHASE_FAILED" -) - -func (r EnvironmentListResponseStatusSSHPublicKeysPhase) IsKnown() bool { - switch r { - case EnvironmentListResponseStatusSSHPublicKeysPhaseContentPhaseUnspecified, EnvironmentListResponseStatusSSHPublicKeysPhaseContentPhaseCreating, EnvironmentListResponseStatusSSHPublicKeysPhaseContentPhaseInitializing, EnvironmentListResponseStatusSSHPublicKeysPhaseContentPhaseReady, EnvironmentListResponseStatusSSHPublicKeysPhaseContentPhaseUpdating, EnvironmentListResponseStatusSSHPublicKeysPhaseContentPhaseFailed: - return true - } - return false -} - -type EnvironmentDeleteResponse = interface{} - -type EnvironmentNewFromProjectResponse struct { - // +resource get environment - Environment EnvironmentNewFromProjectResponseEnvironment `json:"environment"` - JSON environmentNewFromProjectResponseJSON `json:"-"` -} - -// environmentNewFromProjectResponseJSON contains the JSON metadata for the struct -// [EnvironmentNewFromProjectResponse] -type environmentNewFromProjectResponseJSON struct { - Environment apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseJSON) RawJSON() string { - return r.raw -} - -// +resource get environment -type EnvironmentNewFromProjectResponseEnvironment struct { - // ID is a unique identifier of this environment. No other environment with the - // same name must be managed by this environment manager - ID string `json:"id"` - // EnvironmentMetadata is data associated with an environment that's required for - // other parts of the system to function - Metadata EnvironmentNewFromProjectResponseEnvironmentMetadata `json:"metadata"` - // EnvironmentSpec specifies the configuration of an environment for an environment - // start - Spec EnvironmentNewFromProjectResponseEnvironmentSpec `json:"spec"` - // EnvironmentStatus describes an environment status - Status EnvironmentNewFromProjectResponseEnvironmentStatus `json:"status"` - JSON environmentNewFromProjectResponseEnvironmentJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentJSON contains the JSON metadata for -// the struct [EnvironmentNewFromProjectResponseEnvironment] -type environmentNewFromProjectResponseEnvironmentJSON struct { - ID apijson.Field - Metadata apijson.Field - Spec apijson.Field - Status apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironment) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentJSON) RawJSON() string { - return r.raw -} - -// EnvironmentMetadata is data associated with an environment that's required for -// other parts of the system to function -type EnvironmentNewFromProjectResponseEnvironmentMetadata struct { - // annotations are key/value pairs that gets attached to the environment. - // +internal - not yet implemented - Annotations map[string]string `json:"annotations"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - CreatedAt time.Time `json:"createdAt" format:"date-time"` - // creator is the identity of the creator of the environment - Creator EnvironmentNewFromProjectResponseEnvironmentMetadataCreator `json:"creator"` - // 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. - LastStartedAt time.Time `json:"lastStartedAt" format:"date-time"` - // name is the name of the environment as specified by the user - Name string `json:"name"` - // organization_id is the ID of the organization that contains the environment - OrganizationID string `json:"organizationId" format:"uuid"` - // original_context_url is the normalized URL from which the environment was - // created - OriginalContextURL string `json:"originalContextUrl"` - // If the Environment was started from a project, the project_id will reference the - // project. - ProjectID string `json:"projectId"` - // Runner is the ID of the runner that runs this environment. - RunnerID string `json:"runnerId"` - JSON environmentNewFromProjectResponseEnvironmentMetadataJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentMetadataJSON contains the JSON -// metadata for the struct [EnvironmentNewFromProjectResponseEnvironmentMetadata] -type environmentNewFromProjectResponseEnvironmentMetadataJSON struct { - Annotations apijson.Field - CreatedAt apijson.Field - Creator apijson.Field - LastStartedAt apijson.Field - Name apijson.Field - OrganizationID apijson.Field - OriginalContextURL apijson.Field - ProjectID apijson.Field - RunnerID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentMetadata) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentMetadataJSON) RawJSON() string { - return r.raw -} - -// creator is the identity of the creator of the environment -type EnvironmentNewFromProjectResponseEnvironmentMetadataCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal EnvironmentNewFromProjectResponseEnvironmentMetadataCreatorPrincipal `json:"principal"` - JSON environmentNewFromProjectResponseEnvironmentMetadataCreatorJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentMetadataCreatorJSON contains the -// JSON metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentMetadataCreator] -type environmentNewFromProjectResponseEnvironmentMetadataCreatorJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentMetadataCreator) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentMetadataCreatorJSON) RawJSON() string { - return r.raw -} - -// Principal is the principal of the subject -type EnvironmentNewFromProjectResponseEnvironmentMetadataCreatorPrincipal string - -const ( - EnvironmentNewFromProjectResponseEnvironmentMetadataCreatorPrincipalPrincipalUnspecified EnvironmentNewFromProjectResponseEnvironmentMetadataCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - EnvironmentNewFromProjectResponseEnvironmentMetadataCreatorPrincipalPrincipalAccount EnvironmentNewFromProjectResponseEnvironmentMetadataCreatorPrincipal = "PRINCIPAL_ACCOUNT" - EnvironmentNewFromProjectResponseEnvironmentMetadataCreatorPrincipalPrincipalUser EnvironmentNewFromProjectResponseEnvironmentMetadataCreatorPrincipal = "PRINCIPAL_USER" - EnvironmentNewFromProjectResponseEnvironmentMetadataCreatorPrincipalPrincipalRunner EnvironmentNewFromProjectResponseEnvironmentMetadataCreatorPrincipal = "PRINCIPAL_RUNNER" - EnvironmentNewFromProjectResponseEnvironmentMetadataCreatorPrincipalPrincipalEnvironment EnvironmentNewFromProjectResponseEnvironmentMetadataCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - EnvironmentNewFromProjectResponseEnvironmentMetadataCreatorPrincipalPrincipalServiceAccount EnvironmentNewFromProjectResponseEnvironmentMetadataCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r EnvironmentNewFromProjectResponseEnvironmentMetadataCreatorPrincipal) IsKnown() bool { - switch r { - case EnvironmentNewFromProjectResponseEnvironmentMetadataCreatorPrincipalPrincipalUnspecified, EnvironmentNewFromProjectResponseEnvironmentMetadataCreatorPrincipalPrincipalAccount, EnvironmentNewFromProjectResponseEnvironmentMetadataCreatorPrincipalPrincipalUser, EnvironmentNewFromProjectResponseEnvironmentMetadataCreatorPrincipalPrincipalRunner, EnvironmentNewFromProjectResponseEnvironmentMetadataCreatorPrincipalPrincipalEnvironment, EnvironmentNewFromProjectResponseEnvironmentMetadataCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - -// EnvironmentSpec specifies the configuration of an environment for an environment -// start -type EnvironmentNewFromProjectResponseEnvironmentSpec struct { - // Admission level describes who can access an environment instance and its ports. - Admission EnvironmentNewFromProjectResponseEnvironmentSpecAdmission `json:"admission"` - // automations_file is the automations file spec of the environment - AutomationsFile EnvironmentNewFromProjectResponseEnvironmentSpecAutomationsFile `json:"automationsFile"` - // content is the content spec of the environment - Content EnvironmentNewFromProjectResponseEnvironmentSpecContent `json:"content"` - // Phase is the desired phase of the environment - DesiredPhase EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhase `json:"desiredPhase"` - // devcontainer is the devcontainer spec of the environment - Devcontainer EnvironmentNewFromProjectResponseEnvironmentSpecDevcontainer `json:"devcontainer"` - // machine is the machine spec of the environment - Machine EnvironmentNewFromProjectResponseEnvironmentSpecMachine `json:"machine"` - // ports is the set of ports which ought to be exposed to the internet - Ports []EnvironmentNewFromProjectResponseEnvironmentSpecPort `json:"ports"` - // secrets are confidential data that is mounted into the environment - Secrets []EnvironmentNewFromProjectResponseEnvironmentSpecSecret `json:"secrets"` - // version of the spec. The value of this field has no semantic meaning (e.g. don't - // interpret it as as a timestamp), but it can be used to impose a partial order. - // If a.spec_version < b.spec_version then a was the spec before b. - SpecVersion string `json:"specVersion"` - // ssh_public_keys are the public keys used to ssh into the environment - SSHPublicKeys []EnvironmentNewFromProjectResponseEnvironmentSpecSSHPublicKey `json:"sshPublicKeys"` - // Timeout configures the environment timeout - Timeout EnvironmentNewFromProjectResponseEnvironmentSpecTimeout `json:"timeout"` - JSON environmentNewFromProjectResponseEnvironmentSpecJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentSpecJSON contains the JSON metadata -// for the struct [EnvironmentNewFromProjectResponseEnvironmentSpec] -type environmentNewFromProjectResponseEnvironmentSpecJSON struct { - Admission apijson.Field - AutomationsFile apijson.Field - Content apijson.Field - DesiredPhase apijson.Field - Devcontainer apijson.Field - Machine apijson.Field - Ports apijson.Field - Secrets apijson.Field - SpecVersion apijson.Field - SSHPublicKeys apijson.Field - Timeout apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentSpec) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentSpecJSON) RawJSON() string { - return r.raw -} - -// Admission level describes who can access an environment instance and its ports. -type EnvironmentNewFromProjectResponseEnvironmentSpecAdmission string - -const ( - EnvironmentNewFromProjectResponseEnvironmentSpecAdmissionAdmissionLevelUnspecified EnvironmentNewFromProjectResponseEnvironmentSpecAdmission = "ADMISSION_LEVEL_UNSPECIFIED" - EnvironmentNewFromProjectResponseEnvironmentSpecAdmissionAdmissionLevelOwnerOnly EnvironmentNewFromProjectResponseEnvironmentSpecAdmission = "ADMISSION_LEVEL_OWNER_ONLY" - EnvironmentNewFromProjectResponseEnvironmentSpecAdmissionAdmissionLevelEveryone EnvironmentNewFromProjectResponseEnvironmentSpecAdmission = "ADMISSION_LEVEL_EVERYONE" -) - -func (r EnvironmentNewFromProjectResponseEnvironmentSpecAdmission) IsKnown() bool { - switch r { - case EnvironmentNewFromProjectResponseEnvironmentSpecAdmissionAdmissionLevelUnspecified, EnvironmentNewFromProjectResponseEnvironmentSpecAdmissionAdmissionLevelOwnerOnly, EnvironmentNewFromProjectResponseEnvironmentSpecAdmissionAdmissionLevelEveryone: - return true - } - return false -} - -// automations_file is the automations file spec of the environment -type EnvironmentNewFromProjectResponseEnvironmentSpecAutomationsFile struct { - // automations_file_path is the path to the automations file that is applied in the - // environment, relative to the repo root. path must not be absolute (start with a - // /): - // - // ``` - // this.matches('^$|^[^/].*') - // ``` - AutomationsFilePath string `json:"automationsFilePath"` - Session string `json:"session"` - JSON environmentNewFromProjectResponseEnvironmentSpecAutomationsFileJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentSpecAutomationsFileJSON contains the -// JSON metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentSpecAutomationsFile] -type environmentNewFromProjectResponseEnvironmentSpecAutomationsFileJSON struct { - AutomationsFilePath apijson.Field - Session apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentSpecAutomationsFile) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentSpecAutomationsFileJSON) RawJSON() string { - return r.raw -} - -// content is the content spec of the environment -type EnvironmentNewFromProjectResponseEnvironmentSpecContent struct { - // The Git email address - GitEmail string `json:"gitEmail"` - // The Git username - GitUsername string `json:"gitUsername"` - // EnvironmentInitializer specifies how an environment is to be initialized - Initializer EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializer `json:"initializer"` - Session string `json:"session"` - JSON environmentNewFromProjectResponseEnvironmentSpecContentJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentSpecContentJSON contains the JSON -// metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentSpecContent] -type environmentNewFromProjectResponseEnvironmentSpecContentJSON struct { - GitEmail apijson.Field - GitUsername apijson.Field - Initializer apijson.Field - Session apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentSpecContent) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentSpecContentJSON) RawJSON() string { - return r.raw -} - -// EnvironmentInitializer specifies how an environment is to be initialized -type EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializer struct { - Specs []EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpec `json:"specs"` - JSON environmentNewFromProjectResponseEnvironmentSpecContentInitializerJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentSpecContentInitializerJSON contains -// the JSON metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializer] -type environmentNewFromProjectResponseEnvironmentSpecContentInitializerJSON struct { - Specs apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializer) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentSpecContentInitializerJSON) RawJSON() string { - return r.raw -} - -type EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpec struct { - // This field can have the runtime type of - // [EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsContextURLContextURL]. - ContextURL interface{} `json:"contextUrl"` - // This field can have the runtime type of - // [EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGit]. - Git interface{} `json:"git"` - JSON environmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecJSON `json:"-"` - union EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsUnion -} - -// environmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecJSON -// contains the JSON metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpec] -type environmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecJSON struct { - ContextURL apijson.Field - Git apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r environmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecJSON) RawJSON() string { - return r.raw -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpec) UnmarshalJSON(data []byte) (err error) { - *r = EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpec{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a -// [EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsUnion] -// interface which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsContextURL], -// [EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGit]. -func (r EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpec) AsUnion() EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsUnion { - return r.union -} - -// Union satisfied by -// [EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsContextURL] -// or [EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGit]. -type EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsUnion interface { - implementsEnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpec() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsContextURL{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGit{}), - }, - ) -} - -type EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsContextURL struct { - ContextURL EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsContextURLContextURL `json:"contextUrl,required"` - JSON environmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsContextURLJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsContextURLJSON -// contains the JSON metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsContextURL] -type environmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsContextURLJSON struct { - ContextURL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsContextURL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsContextURLJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsContextURL) implementsEnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpec() { -} - -type EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsContextURLContextURL struct { - // url is the URL from which the environment is created - URL string `json:"url" format:"uri"` - JSON environmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsContextURLContextURLJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsContextURLContextURLJSON -// contains the JSON metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsContextURLContextURL] -type environmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsContextURLContextURLJSON struct { - URL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsContextURLContextURL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsContextURLContextURLJSON) RawJSON() string { - return r.raw -} - -type EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGit struct { - Git EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGit `json:"git,required"` - JSON environmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitJSON -// contains the JSON metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGit] -type environmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitJSON struct { - Git apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGit) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGit) implementsEnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpec() { -} - -type EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGit struct { - // a path relative to the environment root in which the code will be checked out to - CheckoutLocation string `json:"checkoutLocation"` - // the value for the clone target mode - use depends on the target mode - CloneTarget string `json:"cloneTarget"` - // remote_uri is the Git remote origin - RemoteUri string `json:"remoteUri"` - // CloneTargetMode is the target state in which we want to leave a GitEnvironment - TargetMode EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode `json:"targetMode"` - // upstream_Remote_uri is the fork upstream of a repository - UpstreamRemoteUri string `json:"upstreamRemoteUri"` - JSON environmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGitJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGitJSON -// contains the JSON metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGit] -type environmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGitJSON struct { - CheckoutLocation apijson.Field - CloneTarget apijson.Field - RemoteUri apijson.Field - TargetMode apijson.Field - UpstreamRemoteUri apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGit) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGitJSON) RawJSON() string { - return r.raw -} - -// CloneTargetMode is the target state in which we want to leave a GitEnvironment -type EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode string - -const ( - EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_UNSPECIFIED" - EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_HEAD" - EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_COMMIT" - EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_BRANCH" - EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_LOCAL_BRANCH" -) - -func (r EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGitTargetMode) IsKnown() bool { - switch r { - case EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified, EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead, EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit, EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch, EnvironmentNewFromProjectResponseEnvironmentSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch: - return true - } - return false -} - -// Phase is the desired phase of the environment -type EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhase string - -const ( - EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseUnspecified EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_UNSPECIFIED" - EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseCreating EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_CREATING" - EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseStarting EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_STARTING" - EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseRunning EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_RUNNING" - EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseUpdating EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_UPDATING" - EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseStopping EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_STOPPING" - EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseStopped EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_STOPPED" - EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseDeleting EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_DELETING" - EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseDeleted EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhase = "ENVIRONMENT_PHASE_DELETED" -) - -func (r EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhase) IsKnown() bool { - switch r { - case EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseUnspecified, EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseCreating, EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseStarting, EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseRunning, EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseUpdating, EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseStopping, EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseStopped, EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseDeleting, EnvironmentNewFromProjectResponseEnvironmentSpecDesiredPhaseEnvironmentPhaseDeleted: - return true - } - return false -} - -// devcontainer is the devcontainer spec of the environment -type EnvironmentNewFromProjectResponseEnvironmentSpecDevcontainer struct { - // devcontainer_file_path is the path to the devcontainer file relative to the repo - // root path must not be absolute (start with a /): - // - // ``` - // this.matches('^$|^[^/].*') - // ``` - DevcontainerFilePath string `json:"devcontainerFilePath"` - Session string `json:"session"` - JSON environmentNewFromProjectResponseEnvironmentSpecDevcontainerJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentSpecDevcontainerJSON contains the -// JSON metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentSpecDevcontainer] -type environmentNewFromProjectResponseEnvironmentSpecDevcontainerJSON struct { - DevcontainerFilePath apijson.Field - Session apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentSpecDevcontainer) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentSpecDevcontainerJSON) RawJSON() string { - return r.raw -} - -// machine is the machine spec of the environment -type EnvironmentNewFromProjectResponseEnvironmentSpecMachine struct { - // Class denotes the class of the environment we ought to start - Class string `json:"class" format:"uuid"` - Session string `json:"session"` - JSON environmentNewFromProjectResponseEnvironmentSpecMachineJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentSpecMachineJSON contains the JSON -// metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentSpecMachine] -type environmentNewFromProjectResponseEnvironmentSpecMachineJSON struct { - Class apijson.Field - Session apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentSpecMachine) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentSpecMachineJSON) RawJSON() string { - return r.raw -} - -type EnvironmentNewFromProjectResponseEnvironmentSpecPort struct { - // Admission level describes who can access an environment instance and its ports. - Admission EnvironmentNewFromProjectResponseEnvironmentSpecPortsAdmission `json:"admission"` - // name of this port - Name string `json:"name"` - // port number - Port int64 `json:"port"` - JSON environmentNewFromProjectResponseEnvironmentSpecPortJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentSpecPortJSON contains the JSON -// metadata for the struct [EnvironmentNewFromProjectResponseEnvironmentSpecPort] -type environmentNewFromProjectResponseEnvironmentSpecPortJSON struct { - Admission apijson.Field - Name apijson.Field - Port apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentSpecPort) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentSpecPortJSON) RawJSON() string { - return r.raw -} - -// Admission level describes who can access an environment instance and its ports. -type EnvironmentNewFromProjectResponseEnvironmentSpecPortsAdmission string - -const ( - EnvironmentNewFromProjectResponseEnvironmentSpecPortsAdmissionAdmissionLevelUnspecified EnvironmentNewFromProjectResponseEnvironmentSpecPortsAdmission = "ADMISSION_LEVEL_UNSPECIFIED" - EnvironmentNewFromProjectResponseEnvironmentSpecPortsAdmissionAdmissionLevelOwnerOnly EnvironmentNewFromProjectResponseEnvironmentSpecPortsAdmission = "ADMISSION_LEVEL_OWNER_ONLY" - EnvironmentNewFromProjectResponseEnvironmentSpecPortsAdmissionAdmissionLevelEveryone EnvironmentNewFromProjectResponseEnvironmentSpecPortsAdmission = "ADMISSION_LEVEL_EVERYONE" -) - -func (r EnvironmentNewFromProjectResponseEnvironmentSpecPortsAdmission) IsKnown() bool { - switch r { - case EnvironmentNewFromProjectResponseEnvironmentSpecPortsAdmissionAdmissionLevelUnspecified, EnvironmentNewFromProjectResponseEnvironmentSpecPortsAdmissionAdmissionLevelOwnerOnly, EnvironmentNewFromProjectResponseEnvironmentSpecPortsAdmissionAdmissionLevelEveryone: - return true - } - return false -} - -type EnvironmentNewFromProjectResponseEnvironmentSpecSecret struct { - 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"` - // name is the human readable description of the secret - Name string `json:"name"` - // session indicated the current session of the secret. When the session does not - // change, secrets are not reloaded in the environment. - Session string `json:"session"` - // source is the source of the secret, for now control-plane or runner - Source string `json:"source"` - // source_ref into the source, in case of control-plane this is uuid of the secret - SourceRef string `json:"sourceRef"` - JSON environmentNewFromProjectResponseEnvironmentSpecSecretJSON `json:"-"` - union EnvironmentNewFromProjectResponseEnvironmentSpecSecretsUnion -} - -// environmentNewFromProjectResponseEnvironmentSpecSecretJSON contains the JSON -// metadata for the struct [EnvironmentNewFromProjectResponseEnvironmentSpecSecret] -type environmentNewFromProjectResponseEnvironmentSpecSecretJSON 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 -} - -func (r environmentNewFromProjectResponseEnvironmentSpecSecretJSON) RawJSON() string { - return r.raw -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentSpecSecret) UnmarshalJSON(data []byte) (err error) { - *r = EnvironmentNewFromProjectResponseEnvironmentSpecSecret{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a [EnvironmentNewFromProjectResponseEnvironmentSpecSecretsUnion] -// interface which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [EnvironmentNewFromProjectResponseEnvironmentSpecSecretsObject], -// [EnvironmentNewFromProjectResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted], -// [EnvironmentNewFromProjectResponseEnvironmentSpecSecretsObject]. -func (r EnvironmentNewFromProjectResponseEnvironmentSpecSecret) AsUnion() EnvironmentNewFromProjectResponseEnvironmentSpecSecretsUnion { - return r.union -} - -// Union satisfied by -// [EnvironmentNewFromProjectResponseEnvironmentSpecSecretsObject], -// [EnvironmentNewFromProjectResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted] -// or [EnvironmentNewFromProjectResponseEnvironmentSpecSecretsObject]. -type EnvironmentNewFromProjectResponseEnvironmentSpecSecretsUnion interface { - implementsEnvironmentNewFromProjectResponseEnvironmentSpecSecret() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*EnvironmentNewFromProjectResponseEnvironmentSpecSecretsUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentNewFromProjectResponseEnvironmentSpecSecretsObject{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentNewFromProjectResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentNewFromProjectResponseEnvironmentSpecSecretsObject{}), - }, - ) -} - -type EnvironmentNewFromProjectResponseEnvironmentSpecSecretsObject struct { - EnvironmentVariable string `json:"environmentVariable,required"` - // name is the human readable description of the secret - Name string `json:"name"` - // session indicated the current session of the secret. When the session does not - // change, secrets are not reloaded in the environment. - Session string `json:"session"` - // source is the source of the secret, for now control-plane or runner - Source string `json:"source"` - // source_ref into the source, in case of control-plane this is uuid of the secret - SourceRef string `json:"sourceRef"` - JSON environmentNewFromProjectResponseEnvironmentSpecSecretsObjectJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentSpecSecretsObjectJSON contains the -// JSON metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentSpecSecretsObject] -type environmentNewFromProjectResponseEnvironmentSpecSecretsObjectJSON struct { - EnvironmentVariable apijson.Field - Name apijson.Field - Session apijson.Field - Source apijson.Field - SourceRef apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentSpecSecretsObject) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentSpecSecretsObjectJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentNewFromProjectResponseEnvironmentSpecSecretsObject) implementsEnvironmentNewFromProjectResponseEnvironmentSpecSecret() { -} - -type EnvironmentNewFromProjectResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted struct { - // file_path is the path inside the devcontainer where the secret is mounted - FilePath string `json:"filePath,required"` - // name is the human readable description of the secret - Name string `json:"name"` - // session indicated the current session of the secret. When the session does not - // change, secrets are not reloaded in the environment. - Session string `json:"session"` - // source is the source of the secret, for now control-plane or runner - Source string `json:"source"` - // source_ref into the source, in case of control-plane this is uuid of the secret - SourceRef string `json:"sourceRef"` - JSON environmentNewFromProjectResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMountedJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMountedJSON -// contains the JSON metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted] -type environmentNewFromProjectResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMountedJSON struct { - FilePath apijson.Field - Name apijson.Field - Session apijson.Field - Source apijson.Field - SourceRef apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMountedJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentNewFromProjectResponseEnvironmentSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted) implementsEnvironmentNewFromProjectResponseEnvironmentSpecSecret() { -} - -type EnvironmentNewFromProjectResponseEnvironmentSpecSSHPublicKey struct { - // id is the unique identifier of the public key - ID string `json:"id"` - // value is the actual public key in the public key file format - Value string `json:"value"` - JSON environmentNewFromProjectResponseEnvironmentSpecSSHPublicKeyJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentSpecSSHPublicKeyJSON contains the -// JSON metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentSpecSSHPublicKey] -type environmentNewFromProjectResponseEnvironmentSpecSSHPublicKeyJSON struct { - ID apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentSpecSSHPublicKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentSpecSSHPublicKeyJSON) RawJSON() string { - return r.raw -} - -// Timeout configures the environment timeout -type EnvironmentNewFromProjectResponseEnvironmentSpecTimeout struct { - // A Duration represents a signed, fixed-length span of time represented as a count - // of seconds and fractions of seconds at nanosecond resolution. It is independent - // of any calendar and concepts like "day" or "month". It is related to Timestamp - // in that the difference between two Timestamp values is a Duration and it can be - // added or subtracted from a Timestamp. Range is approximately +-10,000 years. - // - // # Examples - // - // Example 1: Compute Duration from two Timestamps in pseudo code. - // - // Timestamp start = ...; - // Timestamp end = ...; - // Duration duration = ...; - // - // duration.seconds = end.seconds - start.seconds; - // duration.nanos = end.nanos - start.nanos; - // - // if (duration.seconds < 0 && duration.nanos > 0) { - // duration.seconds += 1; - // duration.nanos -= 1000000000; - // } else if (duration.seconds > 0 && duration.nanos < 0) { - // duration.seconds -= 1; - // duration.nanos += 1000000000; - // } - // - // Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. - // - // Timestamp start = ...; - // Duration duration = ...; - // Timestamp end = ...; - // - // end.seconds = start.seconds + duration.seconds; - // end.nanos = start.nanos + duration.nanos; - // - // if (end.nanos < 0) { - // end.seconds -= 1; - // end.nanos += 1000000000; - // } else if (end.nanos >= 1000000000) { - // end.seconds += 1; - // end.nanos -= 1000000000; - // } - // - // Example 3: Compute Duration from datetime.timedelta in Python. - // - // td = datetime.timedelta(days=3, minutes=10) - // duration = Duration() - // duration.FromTimedelta(td) - // - // # JSON Mapping - // - // In JSON format, the Duration type is encoded as a string rather than an object, - // where the string ends in the suffix "s" (indicating seconds) and is preceded by - // the number of seconds, with nanoseconds expressed as fractional seconds. For - // example, 3 seconds with 0 nanoseconds should be encoded in JSON format as "3s", - // while 3 seconds and 1 nanosecond should be expressed in JSON format as - // "3.000000001s", and 3 seconds and 1 microsecond should be expressed in JSON - // format as "3.000001s". - Disconnected string `json:"disconnected" format:"regex"` - JSON environmentNewFromProjectResponseEnvironmentSpecTimeoutJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentSpecTimeoutJSON contains the JSON -// metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentSpecTimeout] -type environmentNewFromProjectResponseEnvironmentSpecTimeoutJSON struct { - Disconnected apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentSpecTimeout) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentSpecTimeoutJSON) RawJSON() string { - return r.raw -} - -// EnvironmentStatus describes an environment status -type EnvironmentNewFromProjectResponseEnvironmentStatus struct { - // EnvironmentActivitySignal used to signal activity for an environment. - ActivitySignal EnvironmentNewFromProjectResponseEnvironmentStatusActivitySignal `json:"activitySignal"` - // automations_file contains the status of the automations file. - AutomationsFile EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFile `json:"automationsFile"` - // content contains the status of the environment content. - Content EnvironmentNewFromProjectResponseEnvironmentStatusContent `json:"content"` - // devcontainer contains the status of the devcontainer. - Devcontainer EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainer `json:"devcontainer"` - // environment_url contains the URL at which the environment can be accessed. This - // field is only set if the environment is running. - EnvironmentURLs EnvironmentNewFromProjectResponseEnvironmentStatusEnvironmentURLs `json:"environmentUrls"` - // failure_message summarises why the environment failed to operate. If this is - // non-empty the environment has failed to operate and will likely transition to a - // stopped state. - FailureMessage []string `json:"failureMessage"` - // machine contains the status of the environment machine - Machine EnvironmentNewFromProjectResponseEnvironmentStatusMachine `json:"machine"` - // the phase of an environment is a simple, high-level summary of where the - // environment is in its lifecycle - Phase EnvironmentNewFromProjectResponseEnvironmentStatusPhase `json:"phase"` - // RunnerACK is the acknowledgement from the runner that is has received the - // environment spec. - RunnerAck EnvironmentNewFromProjectResponseEnvironmentStatusRunnerAck `json:"runnerAck"` - // secrets contains the status of the environment secrets - Secrets []EnvironmentNewFromProjectResponseEnvironmentStatusSecret `json:"secrets"` - // ssh_public_keys contains the status of the environment ssh public keys - SSHPublicKeys []EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKey `json:"sshPublicKeys"` - // version of the status update. Environment instances themselves are unversioned, - // but their status has different versions. The value of this field has no semantic - // meaning (e.g. don't interpret it as as a timestamp), but it can be used to - // impose a partial order. If a.status_version < b.status_version then a was the - // status before b. - StatusVersion string `json:"statusVersion"` - // warning_message contains warnings, e.g. when the environment is present but not - // in the expected state. - WarningMessage []string `json:"warningMessage"` - JSON environmentNewFromProjectResponseEnvironmentStatusJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentStatusJSON contains the JSON -// metadata for the struct [EnvironmentNewFromProjectResponseEnvironmentStatus] -type environmentNewFromProjectResponseEnvironmentStatusJSON struct { - ActivitySignal apijson.Field - AutomationsFile apijson.Field - Content apijson.Field - Devcontainer apijson.Field - EnvironmentURLs apijson.Field - FailureMessage apijson.Field - Machine apijson.Field - Phase apijson.Field - RunnerAck apijson.Field - Secrets apijson.Field - SSHPublicKeys apijson.Field - StatusVersion apijson.Field - WarningMessage apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentStatus) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentStatusJSON) RawJSON() string { - return r.raw -} - -// EnvironmentActivitySignal used to signal activity for an environment. -type EnvironmentNewFromProjectResponseEnvironmentStatusActivitySignal struct { - // source of the activity signal, such as "VS Code", "SSH", or "Automations". It - // should be a human-readable string that describes the source of the activity - // signal. - Source string `json:"source"` - // 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. - Timestamp time.Time `json:"timestamp" format:"date-time"` - JSON environmentNewFromProjectResponseEnvironmentStatusActivitySignalJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentStatusActivitySignalJSON contains -// the JSON metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentStatusActivitySignal] -type environmentNewFromProjectResponseEnvironmentStatusActivitySignalJSON struct { - Source apijson.Field - Timestamp apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentStatusActivitySignal) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentStatusActivitySignalJSON) RawJSON() string { - return r.raw -} - -// automations_file contains the status of the automations file. -type EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFile struct { - // automations_file_path is the path to the automations file relative to the repo - // root. - AutomationsFilePath string `json:"automationsFilePath"` - // automations_file_presence indicates how an automations file is present in the - // environment. - AutomationsFilePresence EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFileAutomationsFilePresence `json:"automationsFilePresence"` - // failure_message contains the reason the automations file failed to be applied. - // This is only set if the phase is FAILED. - FailureMessage string `json:"failureMessage"` - // phase is the current phase of the automations file. - Phase EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFilePhase `json:"phase"` - // session is the automations file session that is currently applied in the - // environment. - Session string `json:"session"` - JSON environmentNewFromProjectResponseEnvironmentStatusAutomationsFileJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentStatusAutomationsFileJSON contains -// the JSON metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFile] -type environmentNewFromProjectResponseEnvironmentStatusAutomationsFileJSON struct { - AutomationsFilePath apijson.Field - AutomationsFilePresence apijson.Field - FailureMessage apijson.Field - Phase apijson.Field - Session apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFile) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentStatusAutomationsFileJSON) RawJSON() string { - return r.raw -} - -// automations_file_presence indicates how an automations file is present in the -// environment. -type EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFileAutomationsFilePresence string - -const ( - EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceUnspecified EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFileAutomationsFilePresence = "PRESENCE_UNSPECIFIED" - EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceAbsent EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFileAutomationsFilePresence = "PRESENCE_ABSENT" - EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceDiscovered EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFileAutomationsFilePresence = "PRESENCE_DISCOVERED" - EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceSpecified EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFileAutomationsFilePresence = "PRESENCE_SPECIFIED" -) - -func (r EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFileAutomationsFilePresence) IsKnown() bool { - switch r { - case EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceUnspecified, EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceAbsent, EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceDiscovered, EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFileAutomationsFilePresencePresenceSpecified: - return true - } - return false -} - -// phase is the current phase of the automations file. -type EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFilePhase string - -const ( - EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFilePhaseContentPhaseUnspecified EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_UNSPECIFIED" - EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFilePhaseContentPhaseCreating EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_CREATING" - EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFilePhaseContentPhaseInitializing EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_INITIALIZING" - EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFilePhaseContentPhaseReady EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_READY" - EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFilePhaseContentPhaseUpdating EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_UPDATING" - EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFilePhaseContentPhaseFailed EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFilePhase = "CONTENT_PHASE_FAILED" -) - -func (r EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFilePhase) IsKnown() bool { - switch r { - case EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFilePhaseContentPhaseUnspecified, EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFilePhaseContentPhaseCreating, EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFilePhaseContentPhaseInitializing, EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFilePhaseContentPhaseReady, EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFilePhaseContentPhaseUpdating, EnvironmentNewFromProjectResponseEnvironmentStatusAutomationsFilePhaseContentPhaseFailed: - return true - } - return false -} - -// content contains the status of the environment content. -type EnvironmentNewFromProjectResponseEnvironmentStatusContent struct { - // content_location_in_machine is the location of the content in the machine - ContentLocationInMachine string `json:"contentLocationInMachine"` - // failure_message contains the reason the content initialization failed. - FailureMessage string `json:"failureMessage"` - // git is the Git working copy status of the environment. Note: this is a - // best-effort field and more often than not will not be present. Its absence does - // not indicate the absence of a working copy. - Git EnvironmentNewFromProjectResponseEnvironmentStatusContentGit `json:"git"` - // phase is the current phase of the environment content - Phase EnvironmentNewFromProjectResponseEnvironmentStatusContentPhase `json:"phase"` - // session is the session that is currently active in the environment. - Session string `json:"session"` - // warning_message contains warnings, e.g. when the content is present but not in - // the expected state. - WarningMessage string `json:"warningMessage"` - JSON environmentNewFromProjectResponseEnvironmentStatusContentJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentStatusContentJSON contains the JSON -// metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentStatusContent] -type environmentNewFromProjectResponseEnvironmentStatusContentJSON struct { - ContentLocationInMachine apijson.Field - FailureMessage apijson.Field - Git apijson.Field - Phase apijson.Field - Session apijson.Field - WarningMessage apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentStatusContent) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentStatusContentJSON) RawJSON() string { - return r.raw -} - -// git is the Git working copy status of the environment. Note: this is a -// best-effort field and more often than not will not be present. Its absence does -// not indicate the absence of a working copy. -type EnvironmentNewFromProjectResponseEnvironmentStatusContentGit struct { - // branch is branch we're currently on - Branch string `json:"branch"` - // changed_files is an array of changed files in the environment, possibly - // truncated - ChangedFiles []EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFile `json:"changedFiles"` - // clone_url is the repository url as you would pass it to "git clone". Only HTTPS - // clone URLs are supported. - CloneURL string `json:"cloneUrl"` - // latest_commit is the most recent commit on the current branch - LatestCommit string `json:"latestCommit"` - TotalChangedFiles int64 `json:"totalChangedFiles"` - // the total number of unpushed changes - TotalUnpushedCommits int64 `json:"totalUnpushedCommits"` - // unpushed_commits is an array of unpushed changes in the environment, possibly - // truncated - UnpushedCommits []string `json:"unpushedCommits"` - JSON environmentNewFromProjectResponseEnvironmentStatusContentGitJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentStatusContentGitJSON contains the -// JSON metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentStatusContentGit] -type environmentNewFromProjectResponseEnvironmentStatusContentGitJSON struct { - Branch apijson.Field - ChangedFiles apijson.Field - CloneURL apijson.Field - LatestCommit apijson.Field - TotalChangedFiles apijson.Field - TotalUnpushedCommits apijson.Field - UnpushedCommits apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentStatusContentGit) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentStatusContentGitJSON) RawJSON() string { - return r.raw -} - -type EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFile struct { - // ChangeType is the type of change that happened to the file - ChangeType EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeType `json:"changeType"` - // path is the path of the file - Path string `json:"path"` - JSON environmentNewFromProjectResponseEnvironmentStatusContentGitChangedFileJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentStatusContentGitChangedFileJSON -// contains the JSON metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFile] -type environmentNewFromProjectResponseEnvironmentStatusContentGitChangedFileJSON struct { - ChangeType apijson.Field - Path apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFile) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentStatusContentGitChangedFileJSON) RawJSON() string { - return r.raw -} - -// ChangeType is the type of change that happened to the file -type EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeType string - -const ( - EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUnspecified EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_UNSPECIFIED" - EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeAdded EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_ADDED" - EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeModified EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_MODIFIED" - EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeDeleted EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_DELETED" - EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeRenamed EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_RENAMED" - EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeCopied EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_COPIED" - EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUpdatedButUnmerged EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_UPDATED_BUT_UNMERGED" - EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUntracked EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeType = "CHANGE_TYPE_UNTRACKED" -) - -func (r EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeType) IsKnown() bool { - switch r { - case EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUnspecified, EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeAdded, EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeModified, EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeDeleted, EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeRenamed, EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeCopied, EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUpdatedButUnmerged, EnvironmentNewFromProjectResponseEnvironmentStatusContentGitChangedFilesChangeTypeChangeTypeUntracked: - return true - } - return false -} - -// phase is the current phase of the environment content -type EnvironmentNewFromProjectResponseEnvironmentStatusContentPhase string - -const ( - EnvironmentNewFromProjectResponseEnvironmentStatusContentPhaseContentPhaseUnspecified EnvironmentNewFromProjectResponseEnvironmentStatusContentPhase = "CONTENT_PHASE_UNSPECIFIED" - EnvironmentNewFromProjectResponseEnvironmentStatusContentPhaseContentPhaseCreating EnvironmentNewFromProjectResponseEnvironmentStatusContentPhase = "CONTENT_PHASE_CREATING" - EnvironmentNewFromProjectResponseEnvironmentStatusContentPhaseContentPhaseInitializing EnvironmentNewFromProjectResponseEnvironmentStatusContentPhase = "CONTENT_PHASE_INITIALIZING" - EnvironmentNewFromProjectResponseEnvironmentStatusContentPhaseContentPhaseReady EnvironmentNewFromProjectResponseEnvironmentStatusContentPhase = "CONTENT_PHASE_READY" - EnvironmentNewFromProjectResponseEnvironmentStatusContentPhaseContentPhaseUpdating EnvironmentNewFromProjectResponseEnvironmentStatusContentPhase = "CONTENT_PHASE_UPDATING" - EnvironmentNewFromProjectResponseEnvironmentStatusContentPhaseContentPhaseFailed EnvironmentNewFromProjectResponseEnvironmentStatusContentPhase = "CONTENT_PHASE_FAILED" -) - -func (r EnvironmentNewFromProjectResponseEnvironmentStatusContentPhase) IsKnown() bool { - switch r { - case EnvironmentNewFromProjectResponseEnvironmentStatusContentPhaseContentPhaseUnspecified, EnvironmentNewFromProjectResponseEnvironmentStatusContentPhaseContentPhaseCreating, EnvironmentNewFromProjectResponseEnvironmentStatusContentPhaseContentPhaseInitializing, EnvironmentNewFromProjectResponseEnvironmentStatusContentPhaseContentPhaseReady, EnvironmentNewFromProjectResponseEnvironmentStatusContentPhaseContentPhaseUpdating, EnvironmentNewFromProjectResponseEnvironmentStatusContentPhaseContentPhaseFailed: - return true - } - return false -} - -// devcontainer contains the status of the devcontainer. -type EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainer struct { - // container_id is the ID of the container. - ContainerID string `json:"containerId"` - // container_name is the name of the container that is used to connect to the - // devcontainer - ContainerName string `json:"containerName"` - // devcontainerconfig_in_sync indicates if the devcontainer is up to date w.r.t. - // the devcontainer config file. - DevcontainerconfigInSync bool `json:"devcontainerconfigInSync"` - // devcontainer_file_path is the path to the devcontainer file relative to the repo - // root - DevcontainerFilePath string `json:"devcontainerFilePath"` - // devcontainer_file_presence indicates how the devcontainer file is present in the - // repo. - DevcontainerFilePresence EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerDevcontainerFilePresence `json:"devcontainerFilePresence"` - // failure_message contains the reason the devcontainer failed to operate. - FailureMessage string `json:"failureMessage"` - // phase is the current phase of the devcontainer - Phase EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerPhase `json:"phase"` - // remote_user is the user that is used to connect to the devcontainer - RemoteUser string `json:"remoteUser"` - // remote_workspace_folder is the folder that is used to connect to the - // devcontainer - RemoteWorkspaceFolder string `json:"remoteWorkspaceFolder"` - // secrets_in_sync indicates if the secrets are up to date w.r.t. the running - // devcontainer. - SecretsInSync bool `json:"secretsInSync"` - // session is the session that is currently active in the devcontainer. - Session string `json:"session"` - // warning_message contains warnings, e.g. when the devcontainer is present but not - // in the expected state. - WarningMessage string `json:"warningMessage"` - JSON environmentNewFromProjectResponseEnvironmentStatusDevcontainerJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentStatusDevcontainerJSON contains the -// JSON metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainer] -type environmentNewFromProjectResponseEnvironmentStatusDevcontainerJSON struct { - ContainerID apijson.Field - ContainerName apijson.Field - DevcontainerconfigInSync apijson.Field - DevcontainerFilePath apijson.Field - DevcontainerFilePresence apijson.Field - FailureMessage apijson.Field - Phase apijson.Field - RemoteUser apijson.Field - RemoteWorkspaceFolder apijson.Field - SecretsInSync apijson.Field - Session apijson.Field - WarningMessage apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainer) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentStatusDevcontainerJSON) RawJSON() string { - return r.raw -} - -// devcontainer_file_presence indicates how the devcontainer file is present in the -// repo. -type EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerDevcontainerFilePresence string - -const ( - EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceUnspecified EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerDevcontainerFilePresence = "PRESENCE_UNSPECIFIED" - EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceGenerated EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerDevcontainerFilePresence = "PRESENCE_GENERATED" - EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceDiscovered EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerDevcontainerFilePresence = "PRESENCE_DISCOVERED" - EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceSpecified EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerDevcontainerFilePresence = "PRESENCE_SPECIFIED" -) - -func (r EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerDevcontainerFilePresence) IsKnown() bool { - switch r { - case EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceUnspecified, EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceGenerated, EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceDiscovered, EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerDevcontainerFilePresencePresenceSpecified: - return true - } - return false -} - -// phase is the current phase of the devcontainer -type EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerPhase string - -const ( - EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerPhasePhaseUnspecified EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerPhase = "PHASE_UNSPECIFIED" - EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerPhasePhaseCreating EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerPhase = "PHASE_CREATING" - EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerPhasePhaseRunning EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerPhase = "PHASE_RUNNING" - EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerPhasePhaseStopped EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerPhase = "PHASE_STOPPED" - EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerPhasePhaseFailed EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerPhase = "PHASE_FAILED" -) - -func (r EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerPhase) IsKnown() bool { - switch r { - case EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerPhasePhaseUnspecified, EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerPhasePhaseCreating, EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerPhasePhaseRunning, EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerPhasePhaseStopped, EnvironmentNewFromProjectResponseEnvironmentStatusDevcontainerPhasePhaseFailed: - return true - } - return false -} - -// environment_url contains the URL at which the environment can be accessed. This -// field is only set if the environment is running. -type EnvironmentNewFromProjectResponseEnvironmentStatusEnvironmentURLs struct { - // logs is the URL at which the environment logs can be accessed. - Logs string `json:"logs"` - Ports []EnvironmentNewFromProjectResponseEnvironmentStatusEnvironmentURLsPort `json:"ports"` - // SSH is the URL at which the environment can be accessed via SSH. - SSH EnvironmentNewFromProjectResponseEnvironmentStatusEnvironmentURLsSSH `json:"ssh"` - JSON environmentNewFromProjectResponseEnvironmentStatusEnvironmentURLsJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentStatusEnvironmentURLsJSON contains -// the JSON metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentStatusEnvironmentURLs] -type environmentNewFromProjectResponseEnvironmentStatusEnvironmentURLsJSON struct { - Logs apijson.Field - Ports apijson.Field - SSH apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentStatusEnvironmentURLs) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentStatusEnvironmentURLsJSON) RawJSON() string { - return r.raw -} - -type EnvironmentNewFromProjectResponseEnvironmentStatusEnvironmentURLsPort struct { - // port is the port number of the environment port - Port int64 `json:"port"` - // url is the URL at which the environment port can be accessed - URL string `json:"url"` - JSON environmentNewFromProjectResponseEnvironmentStatusEnvironmentURLsPortJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentStatusEnvironmentURLsPortJSON -// contains the JSON metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentStatusEnvironmentURLsPort] -type environmentNewFromProjectResponseEnvironmentStatusEnvironmentURLsPortJSON struct { - Port apijson.Field - URL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentStatusEnvironmentURLsPort) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentStatusEnvironmentURLsPortJSON) RawJSON() string { - return r.raw -} - -// SSH is the URL at which the environment can be accessed via SSH. -type EnvironmentNewFromProjectResponseEnvironmentStatusEnvironmentURLsSSH struct { - URL string `json:"url"` - JSON environmentNewFromProjectResponseEnvironmentStatusEnvironmentURLsSSHJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentStatusEnvironmentURLsSSHJSON -// contains the JSON metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentStatusEnvironmentURLsSSH] -type environmentNewFromProjectResponseEnvironmentStatusEnvironmentURLsSSHJSON struct { - URL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentStatusEnvironmentURLsSSH) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentStatusEnvironmentURLsSSHJSON) RawJSON() string { - return r.raw -} - -// machine contains the status of the environment machine -type EnvironmentNewFromProjectResponseEnvironmentStatusMachine struct { - // failure_message contains the reason the machine failed to operate. - FailureMessage string `json:"failureMessage"` - // phase is the current phase of the environment machine - Phase EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhase `json:"phase"` - // session is the session that is currently active in the machine. - Session string `json:"session"` - // timeout contains the reason the environment has timed out. If this field is - // empty, the environment has not timed out. - Timeout string `json:"timeout"` - // versions contains the versions of components in the machine. - Versions EnvironmentNewFromProjectResponseEnvironmentStatusMachineVersions `json:"versions"` - // warning_message contains warnings, e.g. when the machine is present but not in - // the expected state. - WarningMessage string `json:"warningMessage"` - JSON environmentNewFromProjectResponseEnvironmentStatusMachineJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentStatusMachineJSON contains the JSON -// metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentStatusMachine] -type environmentNewFromProjectResponseEnvironmentStatusMachineJSON struct { - FailureMessage apijson.Field - Phase apijson.Field - Session apijson.Field - Timeout apijson.Field - Versions apijson.Field - WarningMessage apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentStatusMachine) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentStatusMachineJSON) RawJSON() string { - return r.raw -} - -// phase is the current phase of the environment machine -type EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhase string - -const ( - EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhasePhaseUnspecified EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhase = "PHASE_UNSPECIFIED" - EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhasePhaseCreating EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhase = "PHASE_CREATING" - EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhasePhaseStarting EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhase = "PHASE_STARTING" - EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhasePhaseRunning EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhase = "PHASE_RUNNING" - EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhasePhaseStopping EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhase = "PHASE_STOPPING" - EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhasePhaseStopped EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhase = "PHASE_STOPPED" - EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhasePhaseDeleting EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhase = "PHASE_DELETING" - EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhasePhaseDeleted EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhase = "PHASE_DELETED" -) - -func (r EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhase) IsKnown() bool { - switch r { - case EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhasePhaseUnspecified, EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhasePhaseCreating, EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhasePhaseStarting, EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhasePhaseRunning, EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhasePhaseStopping, EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhasePhaseStopped, EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhasePhaseDeleting, EnvironmentNewFromProjectResponseEnvironmentStatusMachinePhasePhaseDeleted: - return true - } - return false -} - -// versions contains the versions of components in the machine. -type EnvironmentNewFromProjectResponseEnvironmentStatusMachineVersions struct { - SupervisorCommit string `json:"supervisorCommit"` - SupervisorVersion string `json:"supervisorVersion"` - JSON environmentNewFromProjectResponseEnvironmentStatusMachineVersionsJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentStatusMachineVersionsJSON contains -// the JSON metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentStatusMachineVersions] -type environmentNewFromProjectResponseEnvironmentStatusMachineVersionsJSON struct { - SupervisorCommit apijson.Field - SupervisorVersion apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentStatusMachineVersions) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentStatusMachineVersionsJSON) RawJSON() string { - return r.raw -} - -// the phase of an environment is a simple, high-level summary of where the -// environment is in its lifecycle -type EnvironmentNewFromProjectResponseEnvironmentStatusPhase string - -const ( - EnvironmentNewFromProjectResponseEnvironmentStatusPhaseEnvironmentPhaseUnspecified EnvironmentNewFromProjectResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_UNSPECIFIED" - EnvironmentNewFromProjectResponseEnvironmentStatusPhaseEnvironmentPhaseCreating EnvironmentNewFromProjectResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_CREATING" - EnvironmentNewFromProjectResponseEnvironmentStatusPhaseEnvironmentPhaseStarting EnvironmentNewFromProjectResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_STARTING" - EnvironmentNewFromProjectResponseEnvironmentStatusPhaseEnvironmentPhaseRunning EnvironmentNewFromProjectResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_RUNNING" - EnvironmentNewFromProjectResponseEnvironmentStatusPhaseEnvironmentPhaseUpdating EnvironmentNewFromProjectResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_UPDATING" - EnvironmentNewFromProjectResponseEnvironmentStatusPhaseEnvironmentPhaseStopping EnvironmentNewFromProjectResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_STOPPING" - EnvironmentNewFromProjectResponseEnvironmentStatusPhaseEnvironmentPhaseStopped EnvironmentNewFromProjectResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_STOPPED" - EnvironmentNewFromProjectResponseEnvironmentStatusPhaseEnvironmentPhaseDeleting EnvironmentNewFromProjectResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_DELETING" - EnvironmentNewFromProjectResponseEnvironmentStatusPhaseEnvironmentPhaseDeleted EnvironmentNewFromProjectResponseEnvironmentStatusPhase = "ENVIRONMENT_PHASE_DELETED" -) - -func (r EnvironmentNewFromProjectResponseEnvironmentStatusPhase) IsKnown() bool { - switch r { - case EnvironmentNewFromProjectResponseEnvironmentStatusPhaseEnvironmentPhaseUnspecified, EnvironmentNewFromProjectResponseEnvironmentStatusPhaseEnvironmentPhaseCreating, EnvironmentNewFromProjectResponseEnvironmentStatusPhaseEnvironmentPhaseStarting, EnvironmentNewFromProjectResponseEnvironmentStatusPhaseEnvironmentPhaseRunning, EnvironmentNewFromProjectResponseEnvironmentStatusPhaseEnvironmentPhaseUpdating, EnvironmentNewFromProjectResponseEnvironmentStatusPhaseEnvironmentPhaseStopping, EnvironmentNewFromProjectResponseEnvironmentStatusPhaseEnvironmentPhaseStopped, EnvironmentNewFromProjectResponseEnvironmentStatusPhaseEnvironmentPhaseDeleting, EnvironmentNewFromProjectResponseEnvironmentStatusPhaseEnvironmentPhaseDeleted: - return true - } - return false -} - -// RunnerACK is the acknowledgement from the runner that is has received the -// environment spec. -type EnvironmentNewFromProjectResponseEnvironmentStatusRunnerAck struct { - Message string `json:"message"` - SpecVersion string `json:"specVersion"` - StatusCode EnvironmentNewFromProjectResponseEnvironmentStatusRunnerAckStatusCode `json:"statusCode"` - JSON environmentNewFromProjectResponseEnvironmentStatusRunnerAckJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentStatusRunnerAckJSON contains the -// JSON metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentStatusRunnerAck] -type environmentNewFromProjectResponseEnvironmentStatusRunnerAckJSON struct { - Message apijson.Field - SpecVersion apijson.Field - StatusCode apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentStatusRunnerAck) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentStatusRunnerAckJSON) RawJSON() string { - return r.raw -} - -type EnvironmentNewFromProjectResponseEnvironmentStatusRunnerAckStatusCode string - -const ( - EnvironmentNewFromProjectResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeUnspecified EnvironmentNewFromProjectResponseEnvironmentStatusRunnerAckStatusCode = "STATUS_CODE_UNSPECIFIED" - EnvironmentNewFromProjectResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeOk EnvironmentNewFromProjectResponseEnvironmentStatusRunnerAckStatusCode = "STATUS_CODE_OK" - EnvironmentNewFromProjectResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeInvalidResource EnvironmentNewFromProjectResponseEnvironmentStatusRunnerAckStatusCode = "STATUS_CODE_INVALID_RESOURCE" - EnvironmentNewFromProjectResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeFailedPrecondition EnvironmentNewFromProjectResponseEnvironmentStatusRunnerAckStatusCode = "STATUS_CODE_FAILED_PRECONDITION" -) - -func (r EnvironmentNewFromProjectResponseEnvironmentStatusRunnerAckStatusCode) IsKnown() bool { - switch r { - case EnvironmentNewFromProjectResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeUnspecified, EnvironmentNewFromProjectResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeOk, EnvironmentNewFromProjectResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeInvalidResource, EnvironmentNewFromProjectResponseEnvironmentStatusRunnerAckStatusCodeStatusCodeFailedPrecondition: - return true - } - return false -} - -type EnvironmentNewFromProjectResponseEnvironmentStatusSecret struct { - // failure_message contains the reason the secret failed to be materialize. - FailureMessage string `json:"failureMessage"` - Phase EnvironmentNewFromProjectResponseEnvironmentStatusSecretsPhase `json:"phase"` - SecretName string `json:"secretName"` - // session is the session that is currently active in the environment. - Session string `json:"session"` - // warning_message contains warnings, e.g. when the secret is present but not in - // the expected state. - WarningMessage string `json:"warningMessage"` - JSON environmentNewFromProjectResponseEnvironmentStatusSecretJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentStatusSecretJSON contains the JSON -// metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentStatusSecret] -type environmentNewFromProjectResponseEnvironmentStatusSecretJSON struct { - FailureMessage apijson.Field - Phase apijson.Field - SecretName apijson.Field - Session apijson.Field - WarningMessage apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentStatusSecret) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentStatusSecretJSON) RawJSON() string { - return r.raw -} - -type EnvironmentNewFromProjectResponseEnvironmentStatusSecretsPhase string - -const ( - EnvironmentNewFromProjectResponseEnvironmentStatusSecretsPhaseContentPhaseUnspecified EnvironmentNewFromProjectResponseEnvironmentStatusSecretsPhase = "CONTENT_PHASE_UNSPECIFIED" - EnvironmentNewFromProjectResponseEnvironmentStatusSecretsPhaseContentPhaseCreating EnvironmentNewFromProjectResponseEnvironmentStatusSecretsPhase = "CONTENT_PHASE_CREATING" - EnvironmentNewFromProjectResponseEnvironmentStatusSecretsPhaseContentPhaseInitializing EnvironmentNewFromProjectResponseEnvironmentStatusSecretsPhase = "CONTENT_PHASE_INITIALIZING" - EnvironmentNewFromProjectResponseEnvironmentStatusSecretsPhaseContentPhaseReady EnvironmentNewFromProjectResponseEnvironmentStatusSecretsPhase = "CONTENT_PHASE_READY" - EnvironmentNewFromProjectResponseEnvironmentStatusSecretsPhaseContentPhaseUpdating EnvironmentNewFromProjectResponseEnvironmentStatusSecretsPhase = "CONTENT_PHASE_UPDATING" - EnvironmentNewFromProjectResponseEnvironmentStatusSecretsPhaseContentPhaseFailed EnvironmentNewFromProjectResponseEnvironmentStatusSecretsPhase = "CONTENT_PHASE_FAILED" -) - -func (r EnvironmentNewFromProjectResponseEnvironmentStatusSecretsPhase) IsKnown() bool { - switch r { - case EnvironmentNewFromProjectResponseEnvironmentStatusSecretsPhaseContentPhaseUnspecified, EnvironmentNewFromProjectResponseEnvironmentStatusSecretsPhaseContentPhaseCreating, EnvironmentNewFromProjectResponseEnvironmentStatusSecretsPhaseContentPhaseInitializing, EnvironmentNewFromProjectResponseEnvironmentStatusSecretsPhaseContentPhaseReady, EnvironmentNewFromProjectResponseEnvironmentStatusSecretsPhaseContentPhaseUpdating, EnvironmentNewFromProjectResponseEnvironmentStatusSecretsPhaseContentPhaseFailed: - return true - } - return false -} - -type EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKey struct { - // id is the unique identifier of the public key - ID string `json:"id"` - // phase is the current phase of the public key - Phase EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKeysPhase `json:"phase"` - JSON environmentNewFromProjectResponseEnvironmentStatusSSHPublicKeyJSON `json:"-"` -} - -// environmentNewFromProjectResponseEnvironmentStatusSSHPublicKeyJSON contains the -// JSON metadata for the struct -// [EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKey] -type environmentNewFromProjectResponseEnvironmentStatusSSHPublicKeyJSON struct { - ID apijson.Field - Phase apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKey) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewFromProjectResponseEnvironmentStatusSSHPublicKeyJSON) RawJSON() string { - return r.raw -} - -// phase is the current phase of the public key -type EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKeysPhase string - -const ( - EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseUnspecified EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_UNSPECIFIED" - EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseCreating EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_CREATING" - EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseInitializing EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_INITIALIZING" - EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseReady EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_READY" - EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseUpdating EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_UPDATING" - EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseFailed EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKeysPhase = "CONTENT_PHASE_FAILED" -) - -func (r EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKeysPhase) IsKnown() bool { - switch r { - case EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseUnspecified, EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseCreating, EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseInitializing, EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseReady, EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseUpdating, EnvironmentNewFromProjectResponseEnvironmentStatusSSHPublicKeysPhaseContentPhaseFailed: - return true - } - return false -} - -type EnvironmentNewLogsTokenResponse struct { - // access_token is the token that can be used to access the logs of the environment - AccessToken string `json:"accessToken"` - JSON environmentNewLogsTokenResponseJSON `json:"-"` -} - -// environmentNewLogsTokenResponseJSON contains the JSON metadata for the struct -// [EnvironmentNewLogsTokenResponse] -type environmentNewLogsTokenResponseJSON struct { - AccessToken apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentNewLogsTokenResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentNewLogsTokenResponseJSON) RawJSON() string { - return r.raw -} - -type EnvironmentMarkActiveResponse = interface{} - -type EnvironmentStartResponse = interface{} - -type EnvironmentStopResponse = interface{} - -type EnvironmentNewParams struct { - // EnvironmentSpec specifies the configuration of an environment for an environment - // start - Spec param.Field[EnvironmentNewParamsSpec] `json:"spec"` -} - -func (r EnvironmentNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// EnvironmentSpec specifies the configuration of an environment for an environment -// start -type EnvironmentNewParamsSpec struct { - // Admission level describes who can access an environment instance and its ports. - Admission param.Field[EnvironmentNewParamsSpecAdmission] `json:"admission"` - // automations_file is the automations file spec of the environment - AutomationsFile param.Field[EnvironmentNewParamsSpecAutomationsFile] `json:"automationsFile"` - // content is the content spec of the environment - Content param.Field[EnvironmentNewParamsSpecContent] `json:"content"` - // Phase is the desired phase of the environment - DesiredPhase param.Field[EnvironmentNewParamsSpecDesiredPhase] `json:"desiredPhase"` - // devcontainer is the devcontainer spec of the environment - Devcontainer param.Field[EnvironmentNewParamsSpecDevcontainer] `json:"devcontainer"` - // machine is the machine spec of the environment - Machine param.Field[EnvironmentNewParamsSpecMachine] `json:"machine"` - // ports is the set of ports which ought to be exposed to the internet - Ports param.Field[[]EnvironmentNewParamsSpecPort] `json:"ports"` - // secrets are confidential data that is mounted into the environment - Secrets param.Field[[]EnvironmentNewParamsSpecSecretUnion] `json:"secrets"` - // version of the spec. The value of this field has no semantic meaning (e.g. don't - // interpret it as as a timestamp), but it can be used to impose a partial order. - // If a.spec_version < b.spec_version then a was the spec before b. - SpecVersion param.Field[string] `json:"specVersion"` - // ssh_public_keys are the public keys used to ssh into the environment - SSHPublicKeys param.Field[[]EnvironmentNewParamsSpecSSHPublicKey] `json:"sshPublicKeys"` - // Timeout configures the environment timeout - Timeout param.Field[EnvironmentNewParamsSpecTimeout] `json:"timeout"` -} - -func (r EnvironmentNewParamsSpec) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Admission level describes who can access an environment instance and its ports. -type EnvironmentNewParamsSpecAdmission string - -const ( - EnvironmentNewParamsSpecAdmissionAdmissionLevelUnspecified EnvironmentNewParamsSpecAdmission = "ADMISSION_LEVEL_UNSPECIFIED" - EnvironmentNewParamsSpecAdmissionAdmissionLevelOwnerOnly EnvironmentNewParamsSpecAdmission = "ADMISSION_LEVEL_OWNER_ONLY" - EnvironmentNewParamsSpecAdmissionAdmissionLevelEveryone EnvironmentNewParamsSpecAdmission = "ADMISSION_LEVEL_EVERYONE" -) - -func (r EnvironmentNewParamsSpecAdmission) IsKnown() bool { - switch r { - case EnvironmentNewParamsSpecAdmissionAdmissionLevelUnspecified, EnvironmentNewParamsSpecAdmissionAdmissionLevelOwnerOnly, EnvironmentNewParamsSpecAdmissionAdmissionLevelEveryone: - return true - } - return false -} - -// automations_file is the automations file spec of the environment -type EnvironmentNewParamsSpecAutomationsFile struct { - // automations_file_path is the path to the automations file that is applied in the - // environment, relative to the repo root. path must not be absolute (start with a - // /): - // - // ``` - // this.matches('^$|^[^/].*') - // ``` - AutomationsFilePath param.Field[string] `json:"automationsFilePath"` - Session param.Field[string] `json:"session"` -} - -func (r EnvironmentNewParamsSpecAutomationsFile) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// content is the content spec of the environment -type EnvironmentNewParamsSpecContent struct { - // The Git email address - GitEmail param.Field[string] `json:"gitEmail"` - // The Git username - GitUsername param.Field[string] `json:"gitUsername"` - // EnvironmentInitializer specifies how an environment is to be initialized - Initializer param.Field[EnvironmentNewParamsSpecContentInitializer] `json:"initializer"` - Session param.Field[string] `json:"session"` -} - -func (r EnvironmentNewParamsSpecContent) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// EnvironmentInitializer specifies how an environment is to be initialized -type EnvironmentNewParamsSpecContentInitializer struct { - Specs param.Field[[]EnvironmentNewParamsSpecContentInitializerSpecUnion] `json:"specs"` -} - -func (r EnvironmentNewParamsSpecContentInitializer) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type EnvironmentNewParamsSpecContentInitializerSpec struct { - ContextURL param.Field[interface{}] `json:"contextUrl"` - Git param.Field[interface{}] `json:"git"` -} - -func (r EnvironmentNewParamsSpecContentInitializerSpec) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentNewParamsSpecContentInitializerSpec) implementsEnvironmentNewParamsSpecContentInitializerSpecUnion() { -} - -// Satisfied by [EnvironmentNewParamsSpecContentInitializerSpecsContextURL], -// [EnvironmentNewParamsSpecContentInitializerSpecsGit], -// [EnvironmentNewParamsSpecContentInitializerSpec]. -type EnvironmentNewParamsSpecContentInitializerSpecUnion interface { - implementsEnvironmentNewParamsSpecContentInitializerSpecUnion() -} - -type EnvironmentNewParamsSpecContentInitializerSpecsContextURL struct { - ContextURL param.Field[EnvironmentNewParamsSpecContentInitializerSpecsContextURLContextURL] `json:"contextUrl,required"` -} - -func (r EnvironmentNewParamsSpecContentInitializerSpecsContextURL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentNewParamsSpecContentInitializerSpecsContextURL) implementsEnvironmentNewParamsSpecContentInitializerSpecUnion() { -} - -type EnvironmentNewParamsSpecContentInitializerSpecsContextURLContextURL struct { - // url is the URL from which the environment is created - URL param.Field[string] `json:"url" format:"uri"` -} - -func (r EnvironmentNewParamsSpecContentInitializerSpecsContextURLContextURL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type EnvironmentNewParamsSpecContentInitializerSpecsGit struct { - Git param.Field[EnvironmentNewParamsSpecContentInitializerSpecsGitGit] `json:"git,required"` -} - -func (r EnvironmentNewParamsSpecContentInitializerSpecsGit) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentNewParamsSpecContentInitializerSpecsGit) implementsEnvironmentNewParamsSpecContentInitializerSpecUnion() { -} - -type EnvironmentNewParamsSpecContentInitializerSpecsGitGit struct { - // a path relative to the environment root in which the code will be checked out to - CheckoutLocation param.Field[string] `json:"checkoutLocation"` - // the value for the clone target mode - use depends on the target mode - CloneTarget param.Field[string] `json:"cloneTarget"` - // remote_uri is the Git remote origin - RemoteUri param.Field[string] `json:"remoteUri"` - // CloneTargetMode is the target state in which we want to leave a GitEnvironment - TargetMode param.Field[EnvironmentNewParamsSpecContentInitializerSpecsGitGitTargetMode] `json:"targetMode"` - // upstream_Remote_uri is the fork upstream of a repository - UpstreamRemoteUri param.Field[string] `json:"upstreamRemoteUri"` -} - -func (r EnvironmentNewParamsSpecContentInitializerSpecsGitGit) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// CloneTargetMode is the target state in which we want to leave a GitEnvironment -type EnvironmentNewParamsSpecContentInitializerSpecsGitGitTargetMode string - -const ( - EnvironmentNewParamsSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified EnvironmentNewParamsSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_UNSPECIFIED" - EnvironmentNewParamsSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead EnvironmentNewParamsSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_HEAD" - EnvironmentNewParamsSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit EnvironmentNewParamsSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_COMMIT" - EnvironmentNewParamsSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch EnvironmentNewParamsSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_BRANCH" - EnvironmentNewParamsSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch EnvironmentNewParamsSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_LOCAL_BRANCH" -) - -func (r EnvironmentNewParamsSpecContentInitializerSpecsGitGitTargetMode) IsKnown() bool { - switch r { - case EnvironmentNewParamsSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified, EnvironmentNewParamsSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead, EnvironmentNewParamsSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit, EnvironmentNewParamsSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch, EnvironmentNewParamsSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch: - return true - } - return false -} - -// Phase is the desired phase of the environment -type EnvironmentNewParamsSpecDesiredPhase string - -const ( - EnvironmentNewParamsSpecDesiredPhaseEnvironmentPhaseUnspecified EnvironmentNewParamsSpecDesiredPhase = "ENVIRONMENT_PHASE_UNSPECIFIED" - EnvironmentNewParamsSpecDesiredPhaseEnvironmentPhaseCreating EnvironmentNewParamsSpecDesiredPhase = "ENVIRONMENT_PHASE_CREATING" - EnvironmentNewParamsSpecDesiredPhaseEnvironmentPhaseStarting EnvironmentNewParamsSpecDesiredPhase = "ENVIRONMENT_PHASE_STARTING" - EnvironmentNewParamsSpecDesiredPhaseEnvironmentPhaseRunning EnvironmentNewParamsSpecDesiredPhase = "ENVIRONMENT_PHASE_RUNNING" - EnvironmentNewParamsSpecDesiredPhaseEnvironmentPhaseUpdating EnvironmentNewParamsSpecDesiredPhase = "ENVIRONMENT_PHASE_UPDATING" - EnvironmentNewParamsSpecDesiredPhaseEnvironmentPhaseStopping EnvironmentNewParamsSpecDesiredPhase = "ENVIRONMENT_PHASE_STOPPING" - EnvironmentNewParamsSpecDesiredPhaseEnvironmentPhaseStopped EnvironmentNewParamsSpecDesiredPhase = "ENVIRONMENT_PHASE_STOPPED" - EnvironmentNewParamsSpecDesiredPhaseEnvironmentPhaseDeleting EnvironmentNewParamsSpecDesiredPhase = "ENVIRONMENT_PHASE_DELETING" - EnvironmentNewParamsSpecDesiredPhaseEnvironmentPhaseDeleted EnvironmentNewParamsSpecDesiredPhase = "ENVIRONMENT_PHASE_DELETED" -) - -func (r EnvironmentNewParamsSpecDesiredPhase) IsKnown() bool { - switch r { - case EnvironmentNewParamsSpecDesiredPhaseEnvironmentPhaseUnspecified, EnvironmentNewParamsSpecDesiredPhaseEnvironmentPhaseCreating, EnvironmentNewParamsSpecDesiredPhaseEnvironmentPhaseStarting, EnvironmentNewParamsSpecDesiredPhaseEnvironmentPhaseRunning, EnvironmentNewParamsSpecDesiredPhaseEnvironmentPhaseUpdating, EnvironmentNewParamsSpecDesiredPhaseEnvironmentPhaseStopping, EnvironmentNewParamsSpecDesiredPhaseEnvironmentPhaseStopped, EnvironmentNewParamsSpecDesiredPhaseEnvironmentPhaseDeleting, EnvironmentNewParamsSpecDesiredPhaseEnvironmentPhaseDeleted: - return true - } - return false -} - -// devcontainer is the devcontainer spec of the environment -type EnvironmentNewParamsSpecDevcontainer struct { - // devcontainer_file_path is the path to the devcontainer file relative to the repo - // root path must not be absolute (start with a /): - // - // ``` - // this.matches('^$|^[^/].*') - // ``` - DevcontainerFilePath param.Field[string] `json:"devcontainerFilePath"` - Session param.Field[string] `json:"session"` -} - -func (r EnvironmentNewParamsSpecDevcontainer) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// machine is the machine spec of the environment -type EnvironmentNewParamsSpecMachine struct { - // Class denotes the class of the environment we ought to start - Class param.Field[string] `json:"class" format:"uuid"` - Session param.Field[string] `json:"session"` -} - -func (r EnvironmentNewParamsSpecMachine) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type EnvironmentNewParamsSpecPort struct { - // Admission level describes who can access an environment instance and its ports. - Admission param.Field[EnvironmentNewParamsSpecPortsAdmission] `json:"admission"` - // name of this port - Name param.Field[string] `json:"name"` - // port number - Port param.Field[int64] `json:"port"` -} - -func (r EnvironmentNewParamsSpecPort) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Admission level describes who can access an environment instance and its ports. -type EnvironmentNewParamsSpecPortsAdmission string - -const ( - EnvironmentNewParamsSpecPortsAdmissionAdmissionLevelUnspecified EnvironmentNewParamsSpecPortsAdmission = "ADMISSION_LEVEL_UNSPECIFIED" - EnvironmentNewParamsSpecPortsAdmissionAdmissionLevelOwnerOnly EnvironmentNewParamsSpecPortsAdmission = "ADMISSION_LEVEL_OWNER_ONLY" - EnvironmentNewParamsSpecPortsAdmissionAdmissionLevelEveryone EnvironmentNewParamsSpecPortsAdmission = "ADMISSION_LEVEL_EVERYONE" -) - -func (r EnvironmentNewParamsSpecPortsAdmission) IsKnown() bool { - switch r { - case EnvironmentNewParamsSpecPortsAdmissionAdmissionLevelUnspecified, EnvironmentNewParamsSpecPortsAdmissionAdmissionLevelOwnerOnly, EnvironmentNewParamsSpecPortsAdmissionAdmissionLevelEveryone: - return true - } - return false -} - -type EnvironmentNewParamsSpecSecret struct { - 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"` - // name is the human readable description of the secret - Name param.Field[string] `json:"name"` - // session indicated the current session of the secret. When the session does not - // change, secrets are not reloaded in the environment. - Session param.Field[string] `json:"session"` - // source is the source of the secret, for now control-plane or runner - Source param.Field[string] `json:"source"` - // source_ref into the source, in case of control-plane this is uuid of the secret - SourceRef param.Field[string] `json:"sourceRef"` -} - -func (r EnvironmentNewParamsSpecSecret) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentNewParamsSpecSecret) implementsEnvironmentNewParamsSpecSecretUnion() {} - -// Satisfied by [EnvironmentNewParamsSpecSecretsObject], -// [EnvironmentNewParamsSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted], -// [EnvironmentNewParamsSpecSecretsObject], [EnvironmentNewParamsSpecSecret]. -type EnvironmentNewParamsSpecSecretUnion interface { - implementsEnvironmentNewParamsSpecSecretUnion() -} - -type EnvironmentNewParamsSpecSecretsObject struct { - EnvironmentVariable param.Field[string] `json:"environmentVariable,required"` - // name is the human readable description of the secret - Name param.Field[string] `json:"name"` - // session indicated the current session of the secret. When the session does not - // change, secrets are not reloaded in the environment. - Session param.Field[string] `json:"session"` - // source is the source of the secret, for now control-plane or runner - Source param.Field[string] `json:"source"` - // source_ref into the source, in case of control-plane this is uuid of the secret - SourceRef param.Field[string] `json:"sourceRef"` -} - -func (r EnvironmentNewParamsSpecSecretsObject) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentNewParamsSpecSecretsObject) implementsEnvironmentNewParamsSpecSecretUnion() {} - -type EnvironmentNewParamsSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted struct { - // file_path is the path inside the devcontainer where the secret is mounted - FilePath param.Field[string] `json:"filePath,required"` - // name is the human readable description of the secret - Name param.Field[string] `json:"name"` - // session indicated the current session of the secret. When the session does not - // change, secrets are not reloaded in the environment. - Session param.Field[string] `json:"session"` - // source is the source of the secret, for now control-plane or runner - Source param.Field[string] `json:"source"` - // source_ref into the source, in case of control-plane this is uuid of the secret - SourceRef param.Field[string] `json:"sourceRef"` -} - -func (r EnvironmentNewParamsSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentNewParamsSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted) implementsEnvironmentNewParamsSpecSecretUnion() { -} - -type EnvironmentNewParamsSpecSSHPublicKey struct { - // id is the unique identifier of the public key - ID param.Field[string] `json:"id"` - // value is the actual public key in the public key file format - Value param.Field[string] `json:"value"` -} - -func (r EnvironmentNewParamsSpecSSHPublicKey) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Timeout configures the environment timeout -type EnvironmentNewParamsSpecTimeout struct { - // A Duration represents a signed, fixed-length span of time represented as a count - // of seconds and fractions of seconds at nanosecond resolution. It is independent - // of any calendar and concepts like "day" or "month". It is related to Timestamp - // in that the difference between two Timestamp values is a Duration and it can be - // added or subtracted from a Timestamp. Range is approximately +-10,000 years. - // - // # Examples - // - // Example 1: Compute Duration from two Timestamps in pseudo code. - // - // Timestamp start = ...; - // Timestamp end = ...; - // Duration duration = ...; - // - // duration.seconds = end.seconds - start.seconds; - // duration.nanos = end.nanos - start.nanos; - // - // if (duration.seconds < 0 && duration.nanos > 0) { - // duration.seconds += 1; - // duration.nanos -= 1000000000; - // } else if (duration.seconds > 0 && duration.nanos < 0) { - // duration.seconds -= 1; - // duration.nanos += 1000000000; - // } - // - // Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. - // - // Timestamp start = ...; - // Duration duration = ...; - // Timestamp end = ...; - // - // end.seconds = start.seconds + duration.seconds; - // end.nanos = start.nanos + duration.nanos; - // - // if (end.nanos < 0) { - // end.seconds -= 1; - // end.nanos += 1000000000; - // } else if (end.nanos >= 1000000000) { - // end.seconds += 1; - // end.nanos -= 1000000000; - // } - // - // Example 3: Compute Duration from datetime.timedelta in Python. - // - // td = datetime.timedelta(days=3, minutes=10) - // duration = Duration() - // duration.FromTimedelta(td) - // - // # JSON Mapping - // - // In JSON format, the Duration type is encoded as a string rather than an object, - // where the string ends in the suffix "s" (indicating seconds) and is preceded by - // the number of seconds, with nanoseconds expressed as fractional seconds. For - // example, 3 seconds with 0 nanoseconds should be encoded in JSON format as "3s", - // while 3 seconds and 1 nanosecond should be expressed in JSON format as - // "3.000000001s", and 3 seconds and 1 microsecond should be expressed in JSON - // format as "3.000001s". - Disconnected param.Field[string] `json:"disconnected" format:"regex"` -} - -func (r EnvironmentNewParamsSpecTimeout) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type EnvironmentGetParams struct { - // environment_id specifies the environment to get - EnvironmentID param.Field[string] `json:"environmentId" format:"uuid"` -} - -func (r EnvironmentGetParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type EnvironmentUpdateParams struct { - // environment_id specifies which environment should be updated. - // - // +required - EnvironmentID param.Field[string] `json:"environmentId" format:"uuid"` - Metadata param.Field[interface{}] `json:"metadata"` - Spec param.Field[EnvironmentUpdateParamsSpecUnion] `json:"spec"` -} - -func (r EnvironmentUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type EnvironmentUpdateParamsSpec struct { - AutomationsFile param.Field[interface{}] `json:"automationsFile"` - Content param.Field[interface{}] `json:"content"` - Devcontainer param.Field[interface{}] `json:"devcontainer"` - Timeout param.Field[interface{}] `json:"timeout"` -} - -func (r EnvironmentUpdateParamsSpec) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentUpdateParamsSpec) implementsEnvironmentUpdateParamsSpecUnion() {} - -// Satisfied by -// [EnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironment], -// [EnvironmentUpdateParamsSpecContent], [EnvironmentUpdateParamsSpecDevcontainer], -// [EnvironmentUpdateParamsSpecTimeoutConfiguresTheEnvironmentTimeout], -// [EnvironmentUpdateParamsSpec]. -type EnvironmentUpdateParamsSpecUnion interface { - implementsEnvironmentUpdateParamsSpecUnion() -} - -type EnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironment struct { - // automations_file is the automations file spec of the environment - AutomationsFile param.Field[EnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFileUnion] `json:"automationsFile,required"` -} - -func (r EnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironment) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironment) implementsEnvironmentUpdateParamsSpecUnion() { -} - -// automations_file is the automations file spec of the environment -type EnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFile struct { - // automations_file_path is the path to the automations file that is applied in the - // environment, relative to the repo root. path must not be absolute (start with a - // /): - // - // ``` - // this.matches('^$|^[^/].*') - // ``` - AutomationsFilePath param.Field[string] `json:"automationsFilePath"` - Session param.Field[string] `json:"session"` -} - -func (r EnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFile) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFile) implementsEnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFileUnion() { -} - -// automations_file is the automations file spec of the environment -// -// Satisfied by -// [EnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFileAutomationsFilePathIsThePathToTheAutomationsFileThatIsAppliedInTheEnvironmentRelativeToTheRepoRoot], -// [EnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFileSession], -// [EnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFile]. -type EnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFileUnion interface { - implementsEnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFileUnion() -} - -type EnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFileAutomationsFilePathIsThePathToTheAutomationsFileThatIsAppliedInTheEnvironmentRelativeToTheRepoRoot struct { - // automations_file_path is the path to the automations file that is applied in the - // environment, relative to the repo root. path must not be absolute (start with a - // /): - // - // ``` - // this.matches('^$|^[^/].*') - // ``` - AutomationsFilePath param.Field[string] `json:"automationsFilePath,required"` -} - -func (r EnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFileAutomationsFilePathIsThePathToTheAutomationsFileThatIsAppliedInTheEnvironmentRelativeToTheRepoRoot) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFileAutomationsFilePathIsThePathToTheAutomationsFileThatIsAppliedInTheEnvironmentRelativeToTheRepoRoot) implementsEnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFileUnion() { -} - -type EnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFileSession struct { - Session param.Field[string] `json:"session,required"` -} - -func (r EnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFileSession) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFileSession) implementsEnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFileUnion() { -} - -type EnvironmentUpdateParamsSpecContent struct { - Content param.Field[EnvironmentUpdateParamsSpecContentContentUnion] `json:"content,required"` -} - -func (r EnvironmentUpdateParamsSpecContent) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentUpdateParamsSpecContent) implementsEnvironmentUpdateParamsSpecUnion() {} - -type EnvironmentUpdateParamsSpecContentContent struct { - // The Git email address - GitEmail param.Field[string] `json:"gitEmail"` - // The Git username - GitUsername param.Field[string] `json:"gitUsername"` - Initializer param.Field[interface{}] `json:"initializer"` - // session should be changed to trigger a content reinitialization - Session param.Field[string] `json:"session"` -} - -func (r EnvironmentUpdateParamsSpecContentContent) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentUpdateParamsSpecContentContent) implementsEnvironmentUpdateParamsSpecContentContentUnion() { -} - -// Satisfied by [EnvironmentUpdateParamsSpecContentContentTheGitEmailAddress], -// [EnvironmentUpdateParamsSpecContentContentTheGitUsername], -// [EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitialized], -// [EnvironmentUpdateParamsSpecContentContentSessionShouldBeChangedToTriggerAContentReinitialization], -// [EnvironmentUpdateParamsSpecContentContent]. -type EnvironmentUpdateParamsSpecContentContentUnion interface { - implementsEnvironmentUpdateParamsSpecContentContentUnion() -} - -type EnvironmentUpdateParamsSpecContentContentTheGitEmailAddress struct { - // The Git email address - GitEmail param.Field[string] `json:"gitEmail,required"` -} - -func (r EnvironmentUpdateParamsSpecContentContentTheGitEmailAddress) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentUpdateParamsSpecContentContentTheGitEmailAddress) implementsEnvironmentUpdateParamsSpecContentContentUnion() { -} - -type EnvironmentUpdateParamsSpecContentContentTheGitUsername struct { - // The Git username - GitUsername param.Field[string] `json:"gitUsername,required"` -} - -func (r EnvironmentUpdateParamsSpecContentContentTheGitUsername) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentUpdateParamsSpecContentContentTheGitUsername) implementsEnvironmentUpdateParamsSpecContentContentUnion() { -} - -type EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitialized struct { - // EnvironmentInitializer specifies how an environment is to be initialized - Initializer param.Field[EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializer] `json:"initializer,required"` -} - -func (r EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitialized) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitialized) implementsEnvironmentUpdateParamsSpecContentContentUnion() { -} - -// EnvironmentInitializer specifies how an environment is to be initialized -type EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializer struct { - Specs param.Field[[]EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecUnion] `json:"specs"` -} - -func (r EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializer) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpec struct { - ContextURL param.Field[interface{}] `json:"contextUrl"` - Git param.Field[interface{}] `json:"git"` -} - -func (r EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpec) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpec) implementsEnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecUnion() { -} - -// Satisfied by -// [EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsContextURL], -// [EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGit], -// [EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpec]. -type EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecUnion interface { - implementsEnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecUnion() -} - -type EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsContextURL struct { - ContextURL param.Field[EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsContextURLContextURL] `json:"contextUrl,required"` -} - -func (r EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsContextURL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsContextURL) implementsEnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecUnion() { -} - -type EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsContextURLContextURL struct { - // url is the URL from which the environment is created - URL param.Field[string] `json:"url" format:"uri"` -} - -func (r EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsContextURLContextURL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGit struct { - Git param.Field[EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGitGit] `json:"git,required"` -} - -func (r EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGit) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGit) implementsEnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecUnion() { -} - -type EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGitGit struct { - // a path relative to the environment root in which the code will be checked out to - CheckoutLocation param.Field[string] `json:"checkoutLocation"` - // the value for the clone target mode - use depends on the target mode - CloneTarget param.Field[string] `json:"cloneTarget"` - // remote_uri is the Git remote origin - RemoteUri param.Field[string] `json:"remoteUri"` - // CloneTargetMode is the target state in which we want to leave a GitEnvironment - TargetMode param.Field[EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGitGitTargetMode] `json:"targetMode"` - // upstream_Remote_uri is the fork upstream of a repository - UpstreamRemoteUri param.Field[string] `json:"upstreamRemoteUri"` -} - -func (r EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGitGit) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// CloneTargetMode is the target state in which we want to leave a GitEnvironment -type EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGitGitTargetMode string - -const ( - EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_UNSPECIFIED" - EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_HEAD" - EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_COMMIT" - EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_BRANCH" - EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_LOCAL_BRANCH" -) - -func (r EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGitGitTargetMode) IsKnown() bool { - switch r { - case EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified, EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead, EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit, EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch, EnvironmentUpdateParamsSpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch: - return true - } - return false -} - -type EnvironmentUpdateParamsSpecContentContentSessionShouldBeChangedToTriggerAContentReinitialization struct { - // session should be changed to trigger a content reinitialization - Session param.Field[string] `json:"session,required"` -} - -func (r EnvironmentUpdateParamsSpecContentContentSessionShouldBeChangedToTriggerAContentReinitialization) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentUpdateParamsSpecContentContentSessionShouldBeChangedToTriggerAContentReinitialization) implementsEnvironmentUpdateParamsSpecContentContentUnion() { -} - -type EnvironmentUpdateParamsSpecDevcontainer struct { - Devcontainer param.Field[EnvironmentUpdateParamsSpecDevcontainerDevcontainerUnion] `json:"devcontainer,required"` -} - -func (r EnvironmentUpdateParamsSpecDevcontainer) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentUpdateParamsSpecDevcontainer) implementsEnvironmentUpdateParamsSpecUnion() {} - -type EnvironmentUpdateParamsSpecDevcontainerDevcontainer struct { - // devcontainer_file_path is the path to the devcontainer file relative to the repo - // root path must not be absolute (start with a /): - // - // ``` - // this.matches('^$|^[^/].*') - // ``` - DevcontainerFilePath param.Field[string] `json:"devcontainerFilePath"` - // session should be changed to trigger a devcontainer rebuild - Session param.Field[string] `json:"session"` -} - -func (r EnvironmentUpdateParamsSpecDevcontainerDevcontainer) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentUpdateParamsSpecDevcontainerDevcontainer) implementsEnvironmentUpdateParamsSpecDevcontainerDevcontainerUnion() { -} - -// Satisfied by -// [EnvironmentUpdateParamsSpecDevcontainerDevcontainerDevcontainerFilePathIsThePathToTheDevcontainerFileRelativeToTheRepoRoot], -// [EnvironmentUpdateParamsSpecDevcontainerDevcontainerSessionShouldBeChangedToTriggerADevcontainerRebuild], -// [EnvironmentUpdateParamsSpecDevcontainerDevcontainer]. -type EnvironmentUpdateParamsSpecDevcontainerDevcontainerUnion interface { - implementsEnvironmentUpdateParamsSpecDevcontainerDevcontainerUnion() -} - -type EnvironmentUpdateParamsSpecDevcontainerDevcontainerDevcontainerFilePathIsThePathToTheDevcontainerFileRelativeToTheRepoRoot struct { - // devcontainer_file_path is the path to the devcontainer file relative to the repo - // root path must not be absolute (start with a /): - // - // ``` - // this.matches('^$|^[^/].*') - // ``` - DevcontainerFilePath param.Field[string] `json:"devcontainerFilePath,required"` -} - -func (r EnvironmentUpdateParamsSpecDevcontainerDevcontainerDevcontainerFilePathIsThePathToTheDevcontainerFileRelativeToTheRepoRoot) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentUpdateParamsSpecDevcontainerDevcontainerDevcontainerFilePathIsThePathToTheDevcontainerFileRelativeToTheRepoRoot) implementsEnvironmentUpdateParamsSpecDevcontainerDevcontainerUnion() { -} - -type EnvironmentUpdateParamsSpecDevcontainerDevcontainerSessionShouldBeChangedToTriggerADevcontainerRebuild struct { - // session should be changed to trigger a devcontainer rebuild - Session param.Field[string] `json:"session,required"` -} - -func (r EnvironmentUpdateParamsSpecDevcontainerDevcontainerSessionShouldBeChangedToTriggerADevcontainerRebuild) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentUpdateParamsSpecDevcontainerDevcontainerSessionShouldBeChangedToTriggerADevcontainerRebuild) implementsEnvironmentUpdateParamsSpecDevcontainerDevcontainerUnion() { -} - -type EnvironmentUpdateParamsSpecTimeoutConfiguresTheEnvironmentTimeout struct { - // Timeout configures the environment timeout - Timeout param.Field[EnvironmentUpdateParamsSpecTimeoutConfiguresTheEnvironmentTimeoutTimeout] `json:"timeout,required"` -} - -func (r EnvironmentUpdateParamsSpecTimeoutConfiguresTheEnvironmentTimeout) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentUpdateParamsSpecTimeoutConfiguresTheEnvironmentTimeout) implementsEnvironmentUpdateParamsSpecUnion() { -} - -// Timeout configures the environment timeout -type EnvironmentUpdateParamsSpecTimeoutConfiguresTheEnvironmentTimeoutTimeout struct { - // A Duration represents a signed, fixed-length span of time represented as a count - // of seconds and fractions of seconds at nanosecond resolution. It is independent - // of any calendar and concepts like "day" or "month". It is related to Timestamp - // in that the difference between two Timestamp values is a Duration and it can be - // added or subtracted from a Timestamp. Range is approximately +-10,000 years. - // - // # Examples - // - // Example 1: Compute Duration from two Timestamps in pseudo code. - // - // Timestamp start = ...; - // Timestamp end = ...; - // Duration duration = ...; - // - // duration.seconds = end.seconds - start.seconds; - // duration.nanos = end.nanos - start.nanos; - // - // if (duration.seconds < 0 && duration.nanos > 0) { - // duration.seconds += 1; - // duration.nanos -= 1000000000; - // } else if (duration.seconds > 0 && duration.nanos < 0) { - // duration.seconds -= 1; - // duration.nanos += 1000000000; - // } - // - // Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. - // - // Timestamp start = ...; - // Duration duration = ...; - // Timestamp end = ...; - // - // end.seconds = start.seconds + duration.seconds; - // end.nanos = start.nanos + duration.nanos; - // - // if (end.nanos < 0) { - // end.seconds -= 1; - // end.nanos += 1000000000; - // } else if (end.nanos >= 1000000000) { - // end.seconds += 1; - // end.nanos -= 1000000000; - // } - // - // Example 3: Compute Duration from datetime.timedelta in Python. - // - // td = datetime.timedelta(days=3, minutes=10) - // duration = Duration() - // duration.FromTimedelta(td) - // - // # JSON Mapping - // - // In JSON format, the Duration type is encoded as a string rather than an object, - // where the string ends in the suffix "s" (indicating seconds) and is preceded by - // the number of seconds, with nanoseconds expressed as fractional seconds. For - // example, 3 seconds with 0 nanoseconds should be encoded in JSON format as "3s", - // while 3 seconds and 1 nanosecond should be expressed in JSON format as - // "3.000000001s", and 3 seconds and 1 microsecond should be expressed in JSON - // format as "3.000001s". - Disconnected param.Field[string] `json:"disconnected,required" format:"regex"` -} - -func (r EnvironmentUpdateParamsSpecTimeoutConfiguresTheEnvironmentTimeoutTimeout) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -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"` -} - -func (r EnvironmentListParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// URLQuery serializes [EnvironmentListParams]'s query parameters as `url.Values`. -func (r EnvironmentListParams) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatComma, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} - -type EnvironmentListParamsFilter struct { - // creator_ids filters the response to only Environments created by specified - // members - CreatorIDs param.Field[[]string] `json:"creatorIds" format:"uuid"` - // project_ids filters the response to only Environments associated with the - // specified projects - ProjectIDs param.Field[[]string] `json:"projectIds" format:"uuid"` - // runner_ids filters the response to only Environments running on these Runner IDs - RunnerIDs param.Field[[]string] `json:"runnerIds" format:"uuid"` - // runner_kinds filters the response to only Environments running on these Runner - // Kinds - RunnerKinds param.Field[[]EnvironmentListParamsFilterRunnerKind] `json:"runnerKinds"` - // actual_phases is a list of phases the environment must be in for it to be - // returned in the API call - StatusPhases param.Field[[]EnvironmentListParamsFilterStatusPhase] `json:"statusPhases"` -} - -func (r EnvironmentListParamsFilter) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// RunnerKind represents the kind of a runner -type EnvironmentListParamsFilterRunnerKind string - -const ( - EnvironmentListParamsFilterRunnerKindRunnerKindUnspecified EnvironmentListParamsFilterRunnerKind = "RUNNER_KIND_UNSPECIFIED" - EnvironmentListParamsFilterRunnerKindRunnerKindLocal EnvironmentListParamsFilterRunnerKind = "RUNNER_KIND_LOCAL" - EnvironmentListParamsFilterRunnerKindRunnerKindRemote EnvironmentListParamsFilterRunnerKind = "RUNNER_KIND_REMOTE" - EnvironmentListParamsFilterRunnerKindRunnerKindLocalConfiguration EnvironmentListParamsFilterRunnerKind = "RUNNER_KIND_LOCAL_CONFIGURATION" -) - -func (r EnvironmentListParamsFilterRunnerKind) IsKnown() bool { - switch r { - case EnvironmentListParamsFilterRunnerKindRunnerKindUnspecified, EnvironmentListParamsFilterRunnerKindRunnerKindLocal, EnvironmentListParamsFilterRunnerKindRunnerKindRemote, EnvironmentListParamsFilterRunnerKindRunnerKindLocalConfiguration: - return true - } - return false -} - -type EnvironmentListParamsFilterStatusPhase string - -const ( - EnvironmentListParamsFilterStatusPhaseEnvironmentPhaseUnspecified EnvironmentListParamsFilterStatusPhase = "ENVIRONMENT_PHASE_UNSPECIFIED" - EnvironmentListParamsFilterStatusPhaseEnvironmentPhaseCreating EnvironmentListParamsFilterStatusPhase = "ENVIRONMENT_PHASE_CREATING" - EnvironmentListParamsFilterStatusPhaseEnvironmentPhaseStarting EnvironmentListParamsFilterStatusPhase = "ENVIRONMENT_PHASE_STARTING" - EnvironmentListParamsFilterStatusPhaseEnvironmentPhaseRunning EnvironmentListParamsFilterStatusPhase = "ENVIRONMENT_PHASE_RUNNING" - EnvironmentListParamsFilterStatusPhaseEnvironmentPhaseUpdating EnvironmentListParamsFilterStatusPhase = "ENVIRONMENT_PHASE_UPDATING" - EnvironmentListParamsFilterStatusPhaseEnvironmentPhaseStopping EnvironmentListParamsFilterStatusPhase = "ENVIRONMENT_PHASE_STOPPING" - EnvironmentListParamsFilterStatusPhaseEnvironmentPhaseStopped EnvironmentListParamsFilterStatusPhase = "ENVIRONMENT_PHASE_STOPPED" - EnvironmentListParamsFilterStatusPhaseEnvironmentPhaseDeleting EnvironmentListParamsFilterStatusPhase = "ENVIRONMENT_PHASE_DELETING" - EnvironmentListParamsFilterStatusPhaseEnvironmentPhaseDeleted EnvironmentListParamsFilterStatusPhase = "ENVIRONMENT_PHASE_DELETED" -) - -func (r EnvironmentListParamsFilterStatusPhase) IsKnown() bool { - switch r { - case EnvironmentListParamsFilterStatusPhaseEnvironmentPhaseUnspecified, EnvironmentListParamsFilterStatusPhaseEnvironmentPhaseCreating, EnvironmentListParamsFilterStatusPhaseEnvironmentPhaseStarting, EnvironmentListParamsFilterStatusPhaseEnvironmentPhaseRunning, EnvironmentListParamsFilterStatusPhaseEnvironmentPhaseUpdating, EnvironmentListParamsFilterStatusPhaseEnvironmentPhaseStopping, EnvironmentListParamsFilterStatusPhaseEnvironmentPhaseStopped, EnvironmentListParamsFilterStatusPhaseEnvironmentPhaseDeleting, EnvironmentListParamsFilterStatusPhaseEnvironmentPhaseDeleted: - return true - } - return false -} - -// pagination contains the pagination options for listing environments -type EnvironmentListParamsPagination 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 EnvironmentListParamsPagination) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type EnvironmentDeleteParams struct { - // environment_id specifies the environment that is going to delete. - // - // +required - EnvironmentID param.Field[string] `json:"environmentId" format:"uuid"` - // force indicates whether the environment should be deleted forcefully When force - // deleting an Environment, the Environment is removed immediately and environment - // lifecycle is not respected. Force deleting can result in data loss on the - // environment. - Force param.Field[bool] `json:"force"` -} - -func (r EnvironmentDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type EnvironmentNewFromProjectParams struct { - ProjectID param.Field[string] `json:"projectId" format:"uuid"` - // EnvironmentSpec specifies the configuration of an environment for an environment - // start - Spec param.Field[EnvironmentNewFromProjectParamsSpec] `json:"spec"` -} - -func (r EnvironmentNewFromProjectParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// EnvironmentSpec specifies the configuration of an environment for an environment -// start -type EnvironmentNewFromProjectParamsSpec struct { - // Admission level describes who can access an environment instance and its ports. - Admission param.Field[EnvironmentNewFromProjectParamsSpecAdmission] `json:"admission"` - // automations_file is the automations file spec of the environment - AutomationsFile param.Field[EnvironmentNewFromProjectParamsSpecAutomationsFile] `json:"automationsFile"` - // content is the content spec of the environment - Content param.Field[EnvironmentNewFromProjectParamsSpecContent] `json:"content"` - // Phase is the desired phase of the environment - DesiredPhase param.Field[EnvironmentNewFromProjectParamsSpecDesiredPhase] `json:"desiredPhase"` - // devcontainer is the devcontainer spec of the environment - Devcontainer param.Field[EnvironmentNewFromProjectParamsSpecDevcontainer] `json:"devcontainer"` - // machine is the machine spec of the environment - Machine param.Field[EnvironmentNewFromProjectParamsSpecMachine] `json:"machine"` - // ports is the set of ports which ought to be exposed to the internet - Ports param.Field[[]EnvironmentNewFromProjectParamsSpecPort] `json:"ports"` - // secrets are confidential data that is mounted into the environment - Secrets param.Field[[]EnvironmentNewFromProjectParamsSpecSecretUnion] `json:"secrets"` - // version of the spec. The value of this field has no semantic meaning (e.g. don't - // interpret it as as a timestamp), but it can be used to impose a partial order. - // If a.spec_version < b.spec_version then a was the spec before b. - SpecVersion param.Field[string] `json:"specVersion"` - // ssh_public_keys are the public keys used to ssh into the environment - SSHPublicKeys param.Field[[]EnvironmentNewFromProjectParamsSpecSSHPublicKey] `json:"sshPublicKeys"` - // Timeout configures the environment timeout - Timeout param.Field[EnvironmentNewFromProjectParamsSpecTimeout] `json:"timeout"` -} - -func (r EnvironmentNewFromProjectParamsSpec) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Admission level describes who can access an environment instance and its ports. -type EnvironmentNewFromProjectParamsSpecAdmission string - -const ( - EnvironmentNewFromProjectParamsSpecAdmissionAdmissionLevelUnspecified EnvironmentNewFromProjectParamsSpecAdmission = "ADMISSION_LEVEL_UNSPECIFIED" - EnvironmentNewFromProjectParamsSpecAdmissionAdmissionLevelOwnerOnly EnvironmentNewFromProjectParamsSpecAdmission = "ADMISSION_LEVEL_OWNER_ONLY" - EnvironmentNewFromProjectParamsSpecAdmissionAdmissionLevelEveryone EnvironmentNewFromProjectParamsSpecAdmission = "ADMISSION_LEVEL_EVERYONE" -) - -func (r EnvironmentNewFromProjectParamsSpecAdmission) IsKnown() bool { - switch r { - case EnvironmentNewFromProjectParamsSpecAdmissionAdmissionLevelUnspecified, EnvironmentNewFromProjectParamsSpecAdmissionAdmissionLevelOwnerOnly, EnvironmentNewFromProjectParamsSpecAdmissionAdmissionLevelEveryone: - return true - } - return false -} - -// automations_file is the automations file spec of the environment -type EnvironmentNewFromProjectParamsSpecAutomationsFile struct { - // automations_file_path is the path to the automations file that is applied in the - // environment, relative to the repo root. path must not be absolute (start with a - // /): - // - // ``` - // this.matches('^$|^[^/].*') - // ``` - AutomationsFilePath param.Field[string] `json:"automationsFilePath"` - Session param.Field[string] `json:"session"` -} - -func (r EnvironmentNewFromProjectParamsSpecAutomationsFile) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// content is the content spec of the environment -type EnvironmentNewFromProjectParamsSpecContent struct { - // The Git email address - GitEmail param.Field[string] `json:"gitEmail"` - // The Git username - GitUsername param.Field[string] `json:"gitUsername"` - // EnvironmentInitializer specifies how an environment is to be initialized - Initializer param.Field[EnvironmentNewFromProjectParamsSpecContentInitializer] `json:"initializer"` - Session param.Field[string] `json:"session"` -} +type EnvironmentUpdateResponse = interface{} -func (r EnvironmentNewFromProjectParamsSpecContent) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} +type EnvironmentDeleteResponse = interface{} -// EnvironmentInitializer specifies how an environment is to be initialized -type EnvironmentNewFromProjectParamsSpecContentInitializer struct { - Specs param.Field[[]EnvironmentNewFromProjectParamsSpecContentInitializerSpecUnion] `json:"specs"` +type EnvironmentNewFromProjectResponse struct { + // +resource get environment + Environment Environment `json:"environment"` + JSON environmentNewFromProjectResponseJSON `json:"-"` } -func (r EnvironmentNewFromProjectParamsSpecContentInitializer) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// environmentNewFromProjectResponseJSON contains the JSON metadata for the struct +// [EnvironmentNewFromProjectResponse] +type environmentNewFromProjectResponseJSON struct { + Environment apijson.Field + raw string + ExtraFields map[string]apijson.Field } -type EnvironmentNewFromProjectParamsSpecContentInitializerSpec struct { - ContextURL param.Field[interface{}] `json:"contextUrl"` - Git param.Field[interface{}] `json:"git"` +func (r *EnvironmentNewFromProjectResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r EnvironmentNewFromProjectParamsSpecContentInitializerSpec) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r environmentNewFromProjectResponseJSON) RawJSON() string { + return r.raw } -func (r EnvironmentNewFromProjectParamsSpecContentInitializerSpec) implementsEnvironmentNewFromProjectParamsSpecContentInitializerSpecUnion() { +type EnvironmentNewLogsTokenResponse struct { + // access_token is the token that can be used to access the logs of the environment + AccessToken string `json:"accessToken"` + JSON environmentNewLogsTokenResponseJSON `json:"-"` } -// Satisfied by -// [EnvironmentNewFromProjectParamsSpecContentInitializerSpecsContextURL], -// [EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGit], -// [EnvironmentNewFromProjectParamsSpecContentInitializerSpec]. -type EnvironmentNewFromProjectParamsSpecContentInitializerSpecUnion interface { - implementsEnvironmentNewFromProjectParamsSpecContentInitializerSpecUnion() +// environmentNewLogsTokenResponseJSON contains the JSON metadata for the struct +// [EnvironmentNewLogsTokenResponse] +type environmentNewLogsTokenResponseJSON struct { + AccessToken apijson.Field + raw string + ExtraFields map[string]apijson.Field } -type EnvironmentNewFromProjectParamsSpecContentInitializerSpecsContextURL struct { - ContextURL param.Field[EnvironmentNewFromProjectParamsSpecContentInitializerSpecsContextURLContextURL] `json:"contextUrl,required"` +func (r *EnvironmentNewLogsTokenResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r EnvironmentNewFromProjectParamsSpecContentInitializerSpecsContextURL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r environmentNewLogsTokenResponseJSON) RawJSON() string { + return r.raw } -func (r EnvironmentNewFromProjectParamsSpecContentInitializerSpecsContextURL) implementsEnvironmentNewFromProjectParamsSpecContentInitializerSpecUnion() { -} +type EnvironmentMarkActiveResponse = interface{} -type EnvironmentNewFromProjectParamsSpecContentInitializerSpecsContextURLContextURL struct { - // url is the URL from which the environment is created - URL param.Field[string] `json:"url" format:"uri"` -} +type EnvironmentStartResponse = interface{} -func (r EnvironmentNewFromProjectParamsSpecContentInitializerSpecsContextURLContextURL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} +type EnvironmentStopResponse = interface{} -type EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGit struct { - Git param.Field[EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGitGit] `json:"git,required"` +type EnvironmentNewParams struct { + // EnvironmentSpec specifies the configuration of an environment for an environment + // start + Spec param.Field[EnvironmentSpecParam] `json:"spec"` } -func (r EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGit) MarshalJSON() (data []byte, err error) { +func (r EnvironmentNewParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGit) implementsEnvironmentNewFromProjectParamsSpecContentInitializerSpecUnion() { -} - -type EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGitGit struct { - // a path relative to the environment root in which the code will be checked out to - CheckoutLocation param.Field[string] `json:"checkoutLocation"` - // the value for the clone target mode - use depends on the target mode - CloneTarget param.Field[string] `json:"cloneTarget"` - // remote_uri is the Git remote origin - RemoteUri param.Field[string] `json:"remoteUri"` - // CloneTargetMode is the target state in which we want to leave a GitEnvironment - TargetMode param.Field[EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGitGitTargetMode] `json:"targetMode"` - // upstream_Remote_uri is the fork upstream of a repository - UpstreamRemoteUri param.Field[string] `json:"upstreamRemoteUri"` +type EnvironmentGetParams struct { + // environment_id specifies the environment to get + EnvironmentID param.Field[string] `json:"environmentId" format:"uuid"` } -func (r EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGitGit) MarshalJSON() (data []byte, err error) { +func (r EnvironmentGetParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// CloneTargetMode is the target state in which we want to leave a GitEnvironment -type EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGitGitTargetMode string - -const ( - EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_UNSPECIFIED" - EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_HEAD" - EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_COMMIT" - EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_BRANCH" - EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_LOCAL_BRANCH" -) - -func (r EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGitGitTargetMode) IsKnown() bool { - switch r { - case EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified, EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead, EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit, EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch, EnvironmentNewFromProjectParamsSpecContentInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch: - return true - } - return false -} - -// Phase is the desired phase of the environment -type EnvironmentNewFromProjectParamsSpecDesiredPhase string - -const ( - EnvironmentNewFromProjectParamsSpecDesiredPhaseEnvironmentPhaseUnspecified EnvironmentNewFromProjectParamsSpecDesiredPhase = "ENVIRONMENT_PHASE_UNSPECIFIED" - EnvironmentNewFromProjectParamsSpecDesiredPhaseEnvironmentPhaseCreating EnvironmentNewFromProjectParamsSpecDesiredPhase = "ENVIRONMENT_PHASE_CREATING" - EnvironmentNewFromProjectParamsSpecDesiredPhaseEnvironmentPhaseStarting EnvironmentNewFromProjectParamsSpecDesiredPhase = "ENVIRONMENT_PHASE_STARTING" - EnvironmentNewFromProjectParamsSpecDesiredPhaseEnvironmentPhaseRunning EnvironmentNewFromProjectParamsSpecDesiredPhase = "ENVIRONMENT_PHASE_RUNNING" - EnvironmentNewFromProjectParamsSpecDesiredPhaseEnvironmentPhaseUpdating EnvironmentNewFromProjectParamsSpecDesiredPhase = "ENVIRONMENT_PHASE_UPDATING" - EnvironmentNewFromProjectParamsSpecDesiredPhaseEnvironmentPhaseStopping EnvironmentNewFromProjectParamsSpecDesiredPhase = "ENVIRONMENT_PHASE_STOPPING" - EnvironmentNewFromProjectParamsSpecDesiredPhaseEnvironmentPhaseStopped EnvironmentNewFromProjectParamsSpecDesiredPhase = "ENVIRONMENT_PHASE_STOPPED" - EnvironmentNewFromProjectParamsSpecDesiredPhaseEnvironmentPhaseDeleting EnvironmentNewFromProjectParamsSpecDesiredPhase = "ENVIRONMENT_PHASE_DELETING" - EnvironmentNewFromProjectParamsSpecDesiredPhaseEnvironmentPhaseDeleted EnvironmentNewFromProjectParamsSpecDesiredPhase = "ENVIRONMENT_PHASE_DELETED" -) - -func (r EnvironmentNewFromProjectParamsSpecDesiredPhase) IsKnown() bool { - switch r { - case EnvironmentNewFromProjectParamsSpecDesiredPhaseEnvironmentPhaseUnspecified, EnvironmentNewFromProjectParamsSpecDesiredPhaseEnvironmentPhaseCreating, EnvironmentNewFromProjectParamsSpecDesiredPhaseEnvironmentPhaseStarting, EnvironmentNewFromProjectParamsSpecDesiredPhaseEnvironmentPhaseRunning, EnvironmentNewFromProjectParamsSpecDesiredPhaseEnvironmentPhaseUpdating, EnvironmentNewFromProjectParamsSpecDesiredPhaseEnvironmentPhaseStopping, EnvironmentNewFromProjectParamsSpecDesiredPhaseEnvironmentPhaseStopped, EnvironmentNewFromProjectParamsSpecDesiredPhaseEnvironmentPhaseDeleting, EnvironmentNewFromProjectParamsSpecDesiredPhaseEnvironmentPhaseDeleted: - return true - } - return false -} - -// devcontainer is the devcontainer spec of the environment -type EnvironmentNewFromProjectParamsSpecDevcontainer struct { - // devcontainer_file_path is the path to the devcontainer file relative to the repo - // root path must not be absolute (start with a /): +type EnvironmentUpdateParams struct { + // environment_id specifies which environment should be updated. // - // ``` - // this.matches('^$|^[^/].*') - // ``` - DevcontainerFilePath param.Field[string] `json:"devcontainerFilePath"` - Session param.Field[string] `json:"session"` -} - -func (r EnvironmentNewFromProjectParamsSpecDevcontainer) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// machine is the machine spec of the environment -type EnvironmentNewFromProjectParamsSpecMachine struct { - // Class denotes the class of the environment we ought to start - Class param.Field[string] `json:"class" format:"uuid"` - Session param.Field[string] `json:"session"` -} - -func (r EnvironmentNewFromProjectParamsSpecMachine) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type EnvironmentNewFromProjectParamsSpecPort struct { - // Admission level describes who can access an environment instance and its ports. - Admission param.Field[EnvironmentNewFromProjectParamsSpecPortsAdmission] `json:"admission"` - // name of this port - Name param.Field[string] `json:"name"` - // port number - Port param.Field[int64] `json:"port"` -} - -func (r EnvironmentNewFromProjectParamsSpecPort) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + // +required + EnvironmentID param.Field[string] `json:"environmentId" format:"uuid"` + Metadata param.Field[interface{}] `json:"metadata"` + Spec param.Field[EnvironmentUpdateParamsSpec] `json:"spec"` } -// Admission level describes who can access an environment instance and its ports. -type EnvironmentNewFromProjectParamsSpecPortsAdmission string - -const ( - EnvironmentNewFromProjectParamsSpecPortsAdmissionAdmissionLevelUnspecified EnvironmentNewFromProjectParamsSpecPortsAdmission = "ADMISSION_LEVEL_UNSPECIFIED" - EnvironmentNewFromProjectParamsSpecPortsAdmissionAdmissionLevelOwnerOnly EnvironmentNewFromProjectParamsSpecPortsAdmission = "ADMISSION_LEVEL_OWNER_ONLY" - EnvironmentNewFromProjectParamsSpecPortsAdmissionAdmissionLevelEveryone EnvironmentNewFromProjectParamsSpecPortsAdmission = "ADMISSION_LEVEL_EVERYONE" -) - -func (r EnvironmentNewFromProjectParamsSpecPortsAdmission) IsKnown() bool { - switch r { - case EnvironmentNewFromProjectParamsSpecPortsAdmissionAdmissionLevelUnspecified, EnvironmentNewFromProjectParamsSpecPortsAdmissionAdmissionLevelOwnerOnly, EnvironmentNewFromProjectParamsSpecPortsAdmissionAdmissionLevelEveryone: - return true - } - return false +func (r EnvironmentUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -type EnvironmentNewFromProjectParamsSpecSecret struct { - 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"` - // name is the human readable description of the secret - Name param.Field[string] `json:"name"` - // session indicated the current session of the secret. When the session does not - // change, secrets are not reloaded in the environment. - Session param.Field[string] `json:"session"` - // source is the source of the secret, for now control-plane or runner - Source param.Field[string] `json:"source"` - // source_ref into the source, in case of control-plane this is uuid of the secret - SourceRef param.Field[string] `json:"sourceRef"` +type EnvironmentUpdateParamsSpec struct { + // automations_file is the automations file spec of the environment + AutomationsFile param.Field[EnvironmentUpdateParamsSpecAutomationsFile] `json:"automationsFile"` + Content param.Field[EnvironmentUpdateParamsSpecContent] `json:"content"` + Devcontainer param.Field[EnvironmentUpdateParamsSpecDevcontainer] `json:"devcontainer"` + // ports controls port sharing + Ports param.Field[[]EnvironmentUpdateParamsSpecPort] `json:"ports"` + // ssh_public_keys are the public keys to update empty array means nothing to + // update + SSHPublicKeys param.Field[[]EnvironmentUpdateParamsSpecSSHPublicKey] `json:"sshPublicKeys"` + // Timeout configures the environment timeout + Timeout param.Field[EnvironmentUpdateParamsSpecTimeout] `json:"timeout"` } -func (r EnvironmentNewFromProjectParamsSpecSecret) MarshalJSON() (data []byte, err error) { +func (r EnvironmentUpdateParamsSpec) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r EnvironmentNewFromProjectParamsSpecSecret) implementsEnvironmentNewFromProjectParamsSpecSecretUnion() { +// automations_file is the automations file spec of the environment +type EnvironmentUpdateParamsSpecAutomationsFile struct { + // automations_file_path is the path to the automations file that is applied in the + // environment, relative to the repo root. path must not be absolute (start with a + // /): + // + // ``` + // this.matches('^$|^[^/].*') + // ``` + AutomationsFilePath param.Field[string] `json:"automationsFilePath"` + Session param.Field[string] `json:"session"` } -// Satisfied by [EnvironmentNewFromProjectParamsSpecSecretsObject], -// [EnvironmentNewFromProjectParamsSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted], -// [EnvironmentNewFromProjectParamsSpecSecretsObject], -// [EnvironmentNewFromProjectParamsSpecSecret]. -type EnvironmentNewFromProjectParamsSpecSecretUnion interface { - implementsEnvironmentNewFromProjectParamsSpecSecretUnion() +func (r EnvironmentUpdateParamsSpecAutomationsFile) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -type EnvironmentNewFromProjectParamsSpecSecretsObject struct { - EnvironmentVariable param.Field[string] `json:"environmentVariable,required"` - // name is the human readable description of the secret - Name param.Field[string] `json:"name"` - // session indicated the current session of the secret. When the session does not - // change, secrets are not reloaded in the environment. +type EnvironmentUpdateParamsSpecContent struct { + // The Git email address + GitEmail param.Field[string] `json:"gitEmail"` + // The Git username + GitUsername param.Field[string] `json:"gitUsername"` + // EnvironmentInitializer specifies how an environment is to be initialized + Initializer param.Field[EnvironmentInitializerParam] `json:"initializer"` + // session should be changed to trigger a content reinitialization Session param.Field[string] `json:"session"` - // source is the source of the secret, for now control-plane or runner - Source param.Field[string] `json:"source"` - // source_ref into the source, in case of control-plane this is uuid of the secret - SourceRef param.Field[string] `json:"sourceRef"` } -func (r EnvironmentNewFromProjectParamsSpecSecretsObject) MarshalJSON() (data []byte, err error) { +func (r EnvironmentUpdateParamsSpecContent) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r EnvironmentNewFromProjectParamsSpecSecretsObject) implementsEnvironmentNewFromProjectParamsSpecSecretUnion() { -} - -type EnvironmentNewFromProjectParamsSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted struct { - // file_path is the path inside the devcontainer where the secret is mounted - FilePath param.Field[string] `json:"filePath,required"` - // name is the human readable description of the secret - Name param.Field[string] `json:"name"` - // session indicated the current session of the secret. When the session does not - // change, secrets are not reloaded in the environment. +type EnvironmentUpdateParamsSpecDevcontainer struct { + // devcontainer_file_path is the path to the devcontainer file relative to the repo + // root path must not be absolute (start with a /): + // + // ``` + // this.matches('^$|^[^/].*') + // ``` + DevcontainerFilePath param.Field[string] `json:"devcontainerFilePath"` + // session should be changed to trigger a devcontainer rebuild Session param.Field[string] `json:"session"` - // source is the source of the secret, for now control-plane or runner - Source param.Field[string] `json:"source"` - // source_ref into the source, in case of control-plane this is uuid of the secret - SourceRef param.Field[string] `json:"sourceRef"` } -func (r EnvironmentNewFromProjectParamsSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted) MarshalJSON() (data []byte, err error) { +func (r EnvironmentUpdateParamsSpecDevcontainer) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r EnvironmentNewFromProjectParamsSpecSecretsFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted) implementsEnvironmentNewFromProjectParamsSpecSecretUnion() { +type EnvironmentUpdateParamsSpecPort struct { + // Admission level describes who can access an environment instance and its ports. + Admission param.Field[AdmissionLevel] `json:"admission"` + // name of this port + Name param.Field[string] `json:"name"` + // port number + Port param.Field[int64] `json:"port"` +} + +func (r EnvironmentUpdateParamsSpecPort) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -type EnvironmentNewFromProjectParamsSpecSSHPublicKey struct { +type EnvironmentUpdateParamsSpecSSHPublicKey struct { // id is the unique identifier of the public key ID param.Field[string] `json:"id"` - // value is the actual public key in the public key file format + // value is the actual public key in the public key file format if not provided, + // the public key will be removed Value param.Field[string] `json:"value"` } -func (r EnvironmentNewFromProjectParamsSpecSSHPublicKey) MarshalJSON() (data []byte, err error) { +func (r EnvironmentUpdateParamsSpecSSHPublicKey) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } // Timeout configures the environment timeout -type EnvironmentNewFromProjectParamsSpecTimeout struct { +type EnvironmentUpdateParamsSpecTimeout struct { // A Duration represents a signed, fixed-length span of time represented as a count // of seconds and fractions of seconds at nanosecond resolution. It is independent // of any calendar and concepts like "day" or "month". It is related to Timestamp @@ -9188,7 +2223,91 @@ type EnvironmentNewFromProjectParamsSpecTimeout struct { Disconnected param.Field[string] `json:"disconnected" format:"regex"` } -func (r EnvironmentNewFromProjectParamsSpecTimeout) MarshalJSON() (data []byte, err error) { +func (r EnvironmentUpdateParamsSpecTimeout) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +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"` +} + +func (r EnvironmentListParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// URLQuery serializes [EnvironmentListParams]'s query parameters as `url.Values`. +func (r EnvironmentListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type EnvironmentListParamsFilter struct { + // creator_ids filters the response to only Environments created by specified + // members + CreatorIDs param.Field[[]string] `json:"creatorIds" format:"uuid"` + // project_ids filters the response to only Environments associated with the + // specified projects + ProjectIDs param.Field[[]string] `json:"projectIds" format:"uuid"` + // runner_ids filters the response to only Environments running on these Runner IDs + RunnerIDs param.Field[[]string] `json:"runnerIds" format:"uuid"` + // runner_kinds filters the response to only Environments running on these Runner + // Kinds + RunnerKinds param.Field[[]RunnerKind] `json:"runnerKinds"` + // actual_phases is a list of phases the environment must be in for it to be + // returned in the API call + StatusPhases param.Field[[]EnvironmentPhase] `json:"statusPhases"` +} + +func (r EnvironmentListParamsFilter) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// pagination contains the pagination options for listing environments +type EnvironmentListParamsPagination 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 EnvironmentListParamsPagination) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type EnvironmentDeleteParams struct { + // environment_id specifies the environment that is going to delete. + // + // +required + EnvironmentID param.Field[string] `json:"environmentId" format:"uuid"` + // force indicates whether the environment should be deleted forcefully When force + // deleting an Environment, the Environment is removed immediately and environment + // lifecycle is not respected. Force deleting can result in data loss on the + // environment. + Force param.Field[bool] `json:"force"` +} + +func (r EnvironmentDeleteParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type EnvironmentNewFromProjectParams struct { + ProjectID param.Field[string] `json:"projectId" format:"uuid"` + // EnvironmentSpec specifies the configuration of an environment for an environment + // start + Spec param.Field[EnvironmentSpecParam] `json:"spec"` +} + +func (r EnvironmentNewFromProjectParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } @@ -9206,7 +2325,7 @@ func (r EnvironmentNewLogsTokenParams) MarshalJSON() (data []byte, err error) { type EnvironmentMarkActiveParams struct { // EnvironmentActivitySignal used to signal activity for an environment. - ActivitySignal param.Field[EnvironmentMarkActiveParamsActivitySignal] `json:"activitySignal"` + ActivitySignal param.Field[EnvironmentActivitySignalParam] `json:"activitySignal"` // The ID of the environment to update activity for. EnvironmentID param.Field[string] `json:"environmentId" format:"uuid"` } @@ -9215,107 +2334,6 @@ func (r EnvironmentMarkActiveParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// EnvironmentActivitySignal used to signal activity for an environment. -type EnvironmentMarkActiveParamsActivitySignal struct { - // source of the activity signal, such as "VS Code", "SSH", or "Automations". It - // should be a human-readable string that describes the source of the activity - // signal. - Source param.Field[string] `json:"source"` - // 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. - Timestamp param.Field[time.Time] `json:"timestamp" format:"date-time"` -} - -func (r EnvironmentMarkActiveParamsActivitySignal) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - type EnvironmentStartParams struct { // environment_id specifies which environment should be started. EnvironmentID param.Field[string] `json:"environmentId" format:"uuid"` diff --git a/environment_test.go b/environment_test.go index cde0996..7c77116 100644 --- a/environment_test.go +++ b/environment_test.go @@ -28,51 +28,60 @@ func TestEnvironmentNewWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Environments.New(context.TODO(), gitpod.EnvironmentNewParams{ - Spec: gitpod.F(gitpod.EnvironmentNewParamsSpec{ - Admission: gitpod.F(gitpod.EnvironmentNewParamsSpecAdmissionAdmissionLevelUnspecified), - AutomationsFile: gitpod.F(gitpod.EnvironmentNewParamsSpecAutomationsFile{ + Spec: gitpod.F(gitpod.EnvironmentSpecParam{ + Admission: gitpod.F(gitpod.AdmissionLevelAdmissionLevelUnspecified), + AutomationsFile: gitpod.F(gitpod.EnvironmentSpecAutomationsFileParam{ AutomationsFilePath: gitpod.F("automationsFilePath"), Session: gitpod.F("session"), }), - Content: gitpod.F(gitpod.EnvironmentNewParamsSpecContent{ + Content: gitpod.F(gitpod.EnvironmentSpecContentParam{ GitEmail: gitpod.F("gitEmail"), GitUsername: gitpod.F("gitUsername"), - Initializer: gitpod.F(gitpod.EnvironmentNewParamsSpecContentInitializer{ - Specs: gitpod.F([]gitpod.EnvironmentNewParamsSpecContentInitializerSpecUnion{gitpod.EnvironmentNewParamsSpecContentInitializerSpecsContextURL{ - ContextURL: gitpod.F(gitpod.EnvironmentNewParamsSpecContentInitializerSpecsContextURLContextURL{ - URL: gitpod.F("https://example.com"), + Initializer: gitpod.F(gitpod.EnvironmentInitializerParam{ + Specs: gitpod.F([]gitpod.EnvironmentInitializerSpecParam{{ + ContextURL: gitpod.F(gitpod.EnvironmentInitializerSpecsContextURLParam{ + URL: gitpod.F("https://github.com/gitpod-io/gitpod"), + }), + Git: gitpod.F(gitpod.EnvironmentInitializerSpecsGitParam{ + CheckoutLocation: gitpod.F("checkoutLocation"), + CloneTarget: gitpod.F("cloneTarget"), + RemoteUri: gitpod.F("remoteUri"), + TargetMode: gitpod.F(gitpod.EnvironmentInitializerSpecsGitTargetModeCloneTargetModeUnspecified), + UpstreamRemoteUri: gitpod.F("upstreamRemoteUri"), }), }}), }), Session: gitpod.F("session"), }), - DesiredPhase: gitpod.F(gitpod.EnvironmentNewParamsSpecDesiredPhaseEnvironmentPhaseUnspecified), - Devcontainer: gitpod.F(gitpod.EnvironmentNewParamsSpecDevcontainer{ + DesiredPhase: gitpod.F(gitpod.EnvironmentPhaseEnvironmentPhaseUnspecified), + Devcontainer: gitpod.F(gitpod.EnvironmentSpecDevcontainerParam{ DevcontainerFilePath: gitpod.F("devcontainerFilePath"), Session: gitpod.F("session"), }), - Machine: gitpod.F(gitpod.EnvironmentNewParamsSpecMachine{ - Class: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + Machine: gitpod.F(gitpod.EnvironmentSpecMachineParam{ + Class: gitpod.F("61000000-0000-0000-0000-000000000000"), Session: gitpod.F("session"), }), - Ports: gitpod.F([]gitpod.EnvironmentNewParamsSpecPort{{ - Admission: gitpod.F(gitpod.EnvironmentNewParamsSpecPortsAdmissionAdmissionLevelUnspecified), + Ports: gitpod.F([]gitpod.EnvironmentSpecPortParam{{ + Admission: gitpod.F(gitpod.AdmissionLevelAdmissionLevelUnspecified), Name: gitpod.F("x"), Port: gitpod.F(int64(1)), }}), - Secrets: gitpod.F([]gitpod.EnvironmentNewParamsSpecSecretUnion{gitpod.EnvironmentNewParamsSpecSecretsObject{ + 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"), }}), SpecVersion: gitpod.F("specVersion"), - SSHPublicKeys: gitpod.F([]gitpod.EnvironmentNewParamsSpecSSHPublicKey{{ + SSHPublicKeys: gitpod.F([]gitpod.EnvironmentSpecSSHPublicKeyParam{{ ID: gitpod.F("id"), Value: gitpod.F("value"), }}), - Timeout: gitpod.F(gitpod.EnvironmentNewParamsSpecTimeout{ + Timeout: gitpod.F(gitpod.EnvironmentSpecTimeoutParam{ Disconnected: gitpod.F("+9125115.360s"), }), }), @@ -127,9 +136,45 @@ func TestEnvironmentUpdateWithOptionalParams(t *testing.T) { _, err := client.Environments.Update(context.TODO(), gitpod.EnvironmentUpdateParams{ EnvironmentID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), Metadata: gitpod.F[any](map[string]interface{}{}), - Spec: gitpod.F[gitpod.EnvironmentUpdateParamsSpecUnion](gitpod.EnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironment{ - AutomationsFile: gitpod.F[gitpod.EnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFileUnion](gitpod.EnvironmentUpdateParamsSpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFileAutomationsFilePathIsThePathToTheAutomationsFileThatIsAppliedInTheEnvironmentRelativeToTheRepoRoot{ + Spec: gitpod.F(gitpod.EnvironmentUpdateParamsSpec{ + AutomationsFile: gitpod.F(gitpod.EnvironmentUpdateParamsSpecAutomationsFile{ AutomationsFilePath: gitpod.F("automationsFilePath"), + Session: gitpod.F("session"), + }), + Content: gitpod.F(gitpod.EnvironmentUpdateParamsSpecContent{ + GitEmail: gitpod.F("gitEmail"), + GitUsername: gitpod.F("gitUsername"), + Initializer: gitpod.F(gitpod.EnvironmentInitializerParam{ + Specs: gitpod.F([]gitpod.EnvironmentInitializerSpecParam{{ + ContextURL: gitpod.F(gitpod.EnvironmentInitializerSpecsContextURLParam{ + URL: gitpod.F("https://example.com"), + }), + Git: gitpod.F(gitpod.EnvironmentInitializerSpecsGitParam{ + CheckoutLocation: gitpod.F("checkoutLocation"), + CloneTarget: gitpod.F("cloneTarget"), + RemoteUri: gitpod.F("remoteUri"), + TargetMode: gitpod.F(gitpod.EnvironmentInitializerSpecsGitTargetModeCloneTargetModeUnspecified), + UpstreamRemoteUri: gitpod.F("upstreamRemoteUri"), + }), + }}), + }), + Session: gitpod.F("session"), + }), + Devcontainer: gitpod.F(gitpod.EnvironmentUpdateParamsSpecDevcontainer{ + DevcontainerFilePath: gitpod.F("devcontainerFilePath"), + Session: gitpod.F("session"), + }), + Ports: gitpod.F([]gitpod.EnvironmentUpdateParamsSpecPort{{ + Admission: gitpod.F(gitpod.AdmissionLevelAdmissionLevelUnspecified), + Name: gitpod.F("x"), + Port: gitpod.F(int64(1)), + }}), + SSHPublicKeys: gitpod.F([]gitpod.EnvironmentUpdateParamsSpecSSHPublicKey{{ + ID: gitpod.F("id"), + Value: gitpod.F("value"), + }}), + Timeout: gitpod.F(gitpod.EnvironmentUpdateParamsSpecTimeout{ + Disconnected: gitpod.F("+9125115.360s"), }), }), }) @@ -162,8 +207,8 @@ func TestEnvironmentListWithOptionalParams(t *testing.T) { CreatorIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), ProjectIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), RunnerIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), - RunnerKinds: gitpod.F([]gitpod.EnvironmentListParamsFilterRunnerKind{gitpod.EnvironmentListParamsFilterRunnerKindRunnerKindUnspecified}), - StatusPhases: gitpod.F([]gitpod.EnvironmentListParamsFilterStatusPhase{gitpod.EnvironmentListParamsFilterStatusPhaseEnvironmentPhaseUnspecified}), + RunnerKinds: gitpod.F([]gitpod.RunnerKind{gitpod.RunnerKindRunnerKindUnspecified}), + StatusPhases: gitpod.F([]gitpod.EnvironmentPhase{gitpod.EnvironmentPhaseEnvironmentPhaseUnspecified}), }), OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), Pagination: gitpod.F(gitpod.EnvironmentListParamsPagination{ @@ -221,51 +266,60 @@ func TestEnvironmentNewFromProjectWithOptionalParams(t *testing.T) { ) _, err := client.Environments.NewFromProject(context.TODO(), gitpod.EnvironmentNewFromProjectParams{ ProjectID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - Spec: gitpod.F(gitpod.EnvironmentNewFromProjectParamsSpec{ - Admission: gitpod.F(gitpod.EnvironmentNewFromProjectParamsSpecAdmissionAdmissionLevelUnspecified), - AutomationsFile: gitpod.F(gitpod.EnvironmentNewFromProjectParamsSpecAutomationsFile{ + Spec: gitpod.F(gitpod.EnvironmentSpecParam{ + Admission: gitpod.F(gitpod.AdmissionLevelAdmissionLevelUnspecified), + AutomationsFile: gitpod.F(gitpod.EnvironmentSpecAutomationsFileParam{ AutomationsFilePath: gitpod.F("automationsFilePath"), Session: gitpod.F("session"), }), - Content: gitpod.F(gitpod.EnvironmentNewFromProjectParamsSpecContent{ + Content: gitpod.F(gitpod.EnvironmentSpecContentParam{ GitEmail: gitpod.F("gitEmail"), GitUsername: gitpod.F("gitUsername"), - Initializer: gitpod.F(gitpod.EnvironmentNewFromProjectParamsSpecContentInitializer{ - Specs: gitpod.F([]gitpod.EnvironmentNewFromProjectParamsSpecContentInitializerSpecUnion{gitpod.EnvironmentNewFromProjectParamsSpecContentInitializerSpecsContextURL{ - ContextURL: gitpod.F(gitpod.EnvironmentNewFromProjectParamsSpecContentInitializerSpecsContextURLContextURL{ + Initializer: gitpod.F(gitpod.EnvironmentInitializerParam{ + Specs: gitpod.F([]gitpod.EnvironmentInitializerSpecParam{{ + ContextURL: gitpod.F(gitpod.EnvironmentInitializerSpecsContextURLParam{ URL: gitpod.F("https://example.com"), }), + Git: gitpod.F(gitpod.EnvironmentInitializerSpecsGitParam{ + CheckoutLocation: gitpod.F("checkoutLocation"), + CloneTarget: gitpod.F("cloneTarget"), + RemoteUri: gitpod.F("remoteUri"), + TargetMode: gitpod.F(gitpod.EnvironmentInitializerSpecsGitTargetModeCloneTargetModeUnspecified), + UpstreamRemoteUri: gitpod.F("upstreamRemoteUri"), + }), }}), }), Session: gitpod.F("session"), }), - DesiredPhase: gitpod.F(gitpod.EnvironmentNewFromProjectParamsSpecDesiredPhaseEnvironmentPhaseUnspecified), - Devcontainer: gitpod.F(gitpod.EnvironmentNewFromProjectParamsSpecDevcontainer{ + DesiredPhase: gitpod.F(gitpod.EnvironmentPhaseEnvironmentPhaseUnspecified), + Devcontainer: gitpod.F(gitpod.EnvironmentSpecDevcontainerParam{ DevcontainerFilePath: gitpod.F("devcontainerFilePath"), Session: gitpod.F("session"), }), - Machine: gitpod.F(gitpod.EnvironmentNewFromProjectParamsSpecMachine{ + Machine: gitpod.F(gitpod.EnvironmentSpecMachineParam{ Class: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), Session: gitpod.F("session"), }), - Ports: gitpod.F([]gitpod.EnvironmentNewFromProjectParamsSpecPort{{ - Admission: gitpod.F(gitpod.EnvironmentNewFromProjectParamsSpecPortsAdmissionAdmissionLevelUnspecified), + Ports: gitpod.F([]gitpod.EnvironmentSpecPortParam{{ + Admission: gitpod.F(gitpod.AdmissionLevelAdmissionLevelUnspecified), Name: gitpod.F("x"), Port: gitpod.F(int64(1)), }}), - Secrets: gitpod.F([]gitpod.EnvironmentNewFromProjectParamsSpecSecretUnion{gitpod.EnvironmentNewFromProjectParamsSpecSecretsObject{ + 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"), }}), SpecVersion: gitpod.F("specVersion"), - SSHPublicKeys: gitpod.F([]gitpod.EnvironmentNewFromProjectParamsSpecSSHPublicKey{{ + SSHPublicKeys: gitpod.F([]gitpod.EnvironmentSpecSSHPublicKeyParam{{ ID: gitpod.F("id"), Value: gitpod.F("value"), }}), - Timeout: gitpod.F(gitpod.EnvironmentNewFromProjectParamsSpecTimeout{ + Timeout: gitpod.F(gitpod.EnvironmentSpecTimeoutParam{ Disconnected: gitpod.F("+9125115.360s"), }), }), @@ -318,7 +372,7 @@ func TestEnvironmentMarkActiveWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Environments.MarkActive(context.TODO(), gitpod.EnvironmentMarkActiveParams{ - ActivitySignal: gitpod.F(gitpod.EnvironmentMarkActiveParamsActivitySignal{ + ActivitySignal: gitpod.F(gitpod.EnvironmentActivitySignalParam{ Source: gitpod.F("xxx"), Timestamp: gitpod.F(time.Now()), }), diff --git a/environmentautomation.go b/environmentautomation.go index 7a5abe9..909191c 100644 --- a/environmentautomation.go +++ b/environmentautomation.go @@ -10,6 +10,7 @@ import ( "github.com/gitpod-io/flex-sdk-go/internal/param" "github.com/gitpod-io/flex-sdk-go/internal/requestconfig" "github.com/gitpod-io/flex-sdk-go/option" + "github.com/gitpod-io/flex-sdk-go/shared" ) // EnvironmentAutomationService contains methods and other services that help with @@ -43,68 +44,32 @@ func (r *EnvironmentAutomationService) Upsert(ctx context.Context, body Environm return } -type EnvironmentAutomationUpsertResponse struct { - UpdatedServiceIDs []string `json:"updatedServiceIds"` - UpdatedTaskIDs []string `json:"updatedTaskIds"` - JSON environmentAutomationUpsertResponseJSON `json:"-"` -} - -// environmentAutomationUpsertResponseJSON contains the JSON metadata for the -// struct [EnvironmentAutomationUpsertResponse] -type environmentAutomationUpsertResponseJSON struct { - UpdatedServiceIDs apijson.Field - UpdatedTaskIDs apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationUpsertResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationUpsertResponseJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationUpsertParams struct { - // WARN: Do not remove any field here, as it will break reading automation yaml - // files. We error if there are any unknown fields in the yaml (to ensure the yaml - // is correct), but would break if we removed any fields. This includes marking a - // field as "reserved" in the proto file, this will also break reading the yaml. - AutomationsFile param.Field[EnvironmentAutomationUpsertParamsAutomationsFile] `json:"automationsFile"` - EnvironmentID param.Field[string] `json:"environmentId" format:"uuid"` -} - -func (r EnvironmentAutomationUpsertParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - // WARN: Do not remove any field here, as it will break reading automation yaml // files. We error if there are any unknown fields in the yaml (to ensure the yaml // is correct), but would break if we removed any fields. This includes marking a // field as "reserved" in the proto file, this will also break reading the yaml. -type EnvironmentAutomationUpsertParamsAutomationsFile struct { - Services param.Field[map[string]EnvironmentAutomationUpsertParamsAutomationsFileServices] `json:"services"` - Tasks param.Field[map[string]EnvironmentAutomationUpsertParamsAutomationsFileTasks] `json:"tasks"` +type AutomationsFileParam struct { + Services param.Field[map[string]AutomationsFileServiceParam] `json:"services"` + Tasks param.Field[map[string]AutomationsFileTaskParam] `json:"tasks"` } -func (r EnvironmentAutomationUpsertParamsAutomationsFile) MarshalJSON() (data []byte, err error) { +func (r AutomationsFileParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type EnvironmentAutomationUpsertParamsAutomationsFileServices struct { - Commands param.Field[EnvironmentAutomationUpsertParamsAutomationsFileServicesCommands] `json:"commands"` - Description param.Field[string] `json:"description"` - Name param.Field[string] `json:"name"` - RunsOn param.Field[EnvironmentAutomationUpsertParamsAutomationsFileServicesRunsOn] `json:"runsOn"` - TriggeredBy param.Field[[]EnvironmentAutomationUpsertParamsAutomationsFileServicesTriggeredBy] `json:"triggeredBy"` +type AutomationsFileServiceParam struct { + Commands param.Field[AutomationsFileServicesCommandsParam] `json:"commands"` + Description param.Field[string] `json:"description"` + Name param.Field[string] `json:"name"` + RunsOn param.Field[shared.RunsOnParam] `json:"runsOn"` + TriggeredBy param.Field[[]AutomationsFileServicesTriggeredBy] `json:"triggeredBy"` } -func (r EnvironmentAutomationUpsertParamsAutomationsFileServices) MarshalJSON() (data []byte, err error) { +func (r AutomationsFileServiceParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type EnvironmentAutomationUpsertParamsAutomationsFileServicesCommands struct { +type AutomationsFileServicesCommandsParam struct { // ready is an optional command that is run repeatedly until it exits with a zero // exit code. If set, the service will first go into a Starting phase, and then // into a Running phase once the ready command exits with a zero exit code. @@ -126,85 +91,87 @@ type EnvironmentAutomationUpsertParamsAutomationsFileServicesCommands struct { Stop param.Field[string] `json:"stop"` } -func (r EnvironmentAutomationUpsertParamsAutomationsFileServicesCommands) MarshalJSON() (data []byte, err error) { +func (r AutomationsFileServicesCommandsParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type EnvironmentAutomationUpsertParamsAutomationsFileServicesRunsOn struct { - Docker param.Field[EnvironmentAutomationUpsertParamsAutomationsFileServicesRunsOnDocker] `json:"docker,required"` -} +type AutomationsFileServicesTriggeredBy string -func (r EnvironmentAutomationUpsertParamsAutomationsFileServicesRunsOn) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +const ( + AutomationsFileServicesTriggeredByManual AutomationsFileServicesTriggeredBy = "manual" + AutomationsFileServicesTriggeredByPostEnvironmentStart AutomationsFileServicesTriggeredBy = "postEnvironmentStart" + AutomationsFileServicesTriggeredByPostDevcontainerStart AutomationsFileServicesTriggeredBy = "postDevcontainerStart" +) + +func (r AutomationsFileServicesTriggeredBy) IsKnown() bool { + switch r { + case AutomationsFileServicesTriggeredByManual, AutomationsFileServicesTriggeredByPostEnvironmentStart, AutomationsFileServicesTriggeredByPostDevcontainerStart: + return true + } + return false } -type EnvironmentAutomationUpsertParamsAutomationsFileServicesRunsOnDocker struct { - Environment param.Field[[]string] `json:"environment"` - Image param.Field[string] `json:"image"` +type AutomationsFileTaskParam struct { + Command param.Field[string] `json:"command"` + DependsOn param.Field[[]string] `json:"dependsOn"` + Description param.Field[string] `json:"description"` + Name param.Field[string] `json:"name"` + RunsOn param.Field[shared.RunsOnParam] `json:"runsOn"` + TriggeredBy param.Field[[]AutomationsFileTasksTriggeredBy] `json:"triggeredBy"` } -func (r EnvironmentAutomationUpsertParamsAutomationsFileServicesRunsOnDocker) MarshalJSON() (data []byte, err error) { +func (r AutomationsFileTaskParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type EnvironmentAutomationUpsertParamsAutomationsFileServicesTriggeredBy string +type AutomationsFileTasksTriggeredBy string const ( - EnvironmentAutomationUpsertParamsAutomationsFileServicesTriggeredByManual EnvironmentAutomationUpsertParamsAutomationsFileServicesTriggeredBy = "manual" - EnvironmentAutomationUpsertParamsAutomationsFileServicesTriggeredByPostEnvironmentStart EnvironmentAutomationUpsertParamsAutomationsFileServicesTriggeredBy = "postEnvironmentStart" - EnvironmentAutomationUpsertParamsAutomationsFileServicesTriggeredByPostDevcontainerStart EnvironmentAutomationUpsertParamsAutomationsFileServicesTriggeredBy = "postDevcontainerStart" + AutomationsFileTasksTriggeredByManual AutomationsFileTasksTriggeredBy = "manual" + AutomationsFileTasksTriggeredByPostEnvironmentStart AutomationsFileTasksTriggeredBy = "postEnvironmentStart" + AutomationsFileTasksTriggeredByPostDevcontainerStart AutomationsFileTasksTriggeredBy = "postDevcontainerStart" ) -func (r EnvironmentAutomationUpsertParamsAutomationsFileServicesTriggeredBy) IsKnown() bool { +func (r AutomationsFileTasksTriggeredBy) IsKnown() bool { switch r { - case EnvironmentAutomationUpsertParamsAutomationsFileServicesTriggeredByManual, EnvironmentAutomationUpsertParamsAutomationsFileServicesTriggeredByPostEnvironmentStart, EnvironmentAutomationUpsertParamsAutomationsFileServicesTriggeredByPostDevcontainerStart: + case AutomationsFileTasksTriggeredByManual, AutomationsFileTasksTriggeredByPostEnvironmentStart, AutomationsFileTasksTriggeredByPostDevcontainerStart: return true } return false } -type EnvironmentAutomationUpsertParamsAutomationsFileTasks struct { - Command param.Field[string] `json:"command"` - DependsOn param.Field[[]string] `json:"dependsOn"` - Description param.Field[string] `json:"description"` - Name param.Field[string] `json:"name"` - RunsOn param.Field[EnvironmentAutomationUpsertParamsAutomationsFileTasksRunsOn] `json:"runsOn"` - TriggeredBy param.Field[[]EnvironmentAutomationUpsertParamsAutomationsFileTasksTriggeredBy] `json:"triggeredBy"` +type EnvironmentAutomationUpsertResponse struct { + UpdatedServiceIDs []string `json:"updatedServiceIds"` + UpdatedTaskIDs []string `json:"updatedTaskIds"` + JSON environmentAutomationUpsertResponseJSON `json:"-"` } -func (r EnvironmentAutomationUpsertParamsAutomationsFileTasks) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// environmentAutomationUpsertResponseJSON contains the JSON metadata for the +// struct [EnvironmentAutomationUpsertResponse] +type environmentAutomationUpsertResponseJSON struct { + UpdatedServiceIDs apijson.Field + UpdatedTaskIDs apijson.Field + raw string + ExtraFields map[string]apijson.Field } -type EnvironmentAutomationUpsertParamsAutomationsFileTasksRunsOn struct { - Docker param.Field[EnvironmentAutomationUpsertParamsAutomationsFileTasksRunsOnDocker] `json:"docker,required"` +func (r *EnvironmentAutomationUpsertResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r EnvironmentAutomationUpsertParamsAutomationsFileTasksRunsOn) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r environmentAutomationUpsertResponseJSON) RawJSON() string { + return r.raw } -type EnvironmentAutomationUpsertParamsAutomationsFileTasksRunsOnDocker struct { - Environment param.Field[[]string] `json:"environment"` - Image param.Field[string] `json:"image"` +type EnvironmentAutomationUpsertParams struct { + // WARN: Do not remove any field here, as it will break reading automation yaml + // files. We error if there are any unknown fields in the yaml (to ensure the yaml + // is correct), but would break if we removed any fields. This includes marking a + // field as "reserved" in the proto file, this will also break reading the yaml. + AutomationsFile param.Field[AutomationsFileParam] `json:"automationsFile"` + EnvironmentID param.Field[string] `json:"environmentId" format:"uuid"` } -func (r EnvironmentAutomationUpsertParamsAutomationsFileTasksRunsOnDocker) MarshalJSON() (data []byte, err error) { +func (r EnvironmentAutomationUpsertParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } - -type EnvironmentAutomationUpsertParamsAutomationsFileTasksTriggeredBy string - -const ( - EnvironmentAutomationUpsertParamsAutomationsFileTasksTriggeredByManual EnvironmentAutomationUpsertParamsAutomationsFileTasksTriggeredBy = "manual" - EnvironmentAutomationUpsertParamsAutomationsFileTasksTriggeredByPostEnvironmentStart EnvironmentAutomationUpsertParamsAutomationsFileTasksTriggeredBy = "postEnvironmentStart" - EnvironmentAutomationUpsertParamsAutomationsFileTasksTriggeredByPostDevcontainerStart EnvironmentAutomationUpsertParamsAutomationsFileTasksTriggeredBy = "postDevcontainerStart" -) - -func (r EnvironmentAutomationUpsertParamsAutomationsFileTasksTriggeredBy) IsKnown() bool { - switch r { - case EnvironmentAutomationUpsertParamsAutomationsFileTasksTriggeredByManual, EnvironmentAutomationUpsertParamsAutomationsFileTasksTriggeredByPostEnvironmentStart, EnvironmentAutomationUpsertParamsAutomationsFileTasksTriggeredByPostDevcontainerStart: - return true - } - return false -} diff --git a/environmentautomation_test.go b/environmentautomation_test.go index 6435296..124700f 100644 --- a/environmentautomation_test.go +++ b/environmentautomation_test.go @@ -11,6 +11,7 @@ import ( "github.com/gitpod-io/flex-sdk-go" "github.com/gitpod-io/flex-sdk-go/internal/testutil" "github.com/gitpod-io/flex-sdk-go/option" + "github.com/gitpod-io/flex-sdk-go/shared" ) func TestEnvironmentAutomationUpsertWithOptionalParams(t *testing.T) { @@ -27,38 +28,38 @@ func TestEnvironmentAutomationUpsertWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Environments.Automations.Upsert(context.TODO(), gitpod.EnvironmentAutomationUpsertParams{ - AutomationsFile: gitpod.F(gitpod.EnvironmentAutomationUpsertParamsAutomationsFile{ - Services: gitpod.F(map[string]gitpod.EnvironmentAutomationUpsertParamsAutomationsFileServices{ + AutomationsFile: gitpod.F(gitpod.AutomationsFileParam{ + Services: gitpod.F(map[string]gitpod.AutomationsFileServiceParam{ "foo": { - Commands: gitpod.F(gitpod.EnvironmentAutomationUpsertParamsAutomationsFileServicesCommands{ + Commands: gitpod.F(gitpod.AutomationsFileServicesCommandsParam{ Ready: gitpod.F("ready"), Start: gitpod.F("x"), Stop: gitpod.F("stop"), }), Description: gitpod.F("description"), Name: gitpod.F("x"), - RunsOn: gitpod.F(gitpod.EnvironmentAutomationUpsertParamsAutomationsFileServicesRunsOn{ - Docker: gitpod.F(gitpod.EnvironmentAutomationUpsertParamsAutomationsFileServicesRunsOnDocker{ + RunsOn: gitpod.F(shared.RunsOnParam{ + Docker: gitpod.F(shared.RunsOnDockerParam{ Environment: gitpod.F([]string{"string"}), Image: gitpod.F("x"), }), }), - TriggeredBy: gitpod.F([]gitpod.EnvironmentAutomationUpsertParamsAutomationsFileServicesTriggeredBy{gitpod.EnvironmentAutomationUpsertParamsAutomationsFileServicesTriggeredByManual}), + TriggeredBy: gitpod.F([]gitpod.AutomationsFileServicesTriggeredBy{gitpod.AutomationsFileServicesTriggeredByManual}), }, }), - Tasks: gitpod.F(map[string]gitpod.EnvironmentAutomationUpsertParamsAutomationsFileTasks{ + Tasks: gitpod.F(map[string]gitpod.AutomationsFileTaskParam{ "foo": { Command: gitpod.F("x"), DependsOn: gitpod.F([]string{"string"}), Description: gitpod.F("description"), Name: gitpod.F("x"), - RunsOn: gitpod.F(gitpod.EnvironmentAutomationUpsertParamsAutomationsFileTasksRunsOn{ - Docker: gitpod.F(gitpod.EnvironmentAutomationUpsertParamsAutomationsFileTasksRunsOnDocker{ + RunsOn: gitpod.F(shared.RunsOnParam{ + Docker: gitpod.F(shared.RunsOnDockerParam{ Environment: gitpod.F([]string{"string"}), Image: gitpod.F("x"), }), }), - TriggeredBy: gitpod.F([]gitpod.EnvironmentAutomationUpsertParamsAutomationsFileTasksTriggeredBy{gitpod.EnvironmentAutomationUpsertParamsAutomationsFileTasksTriggeredByManual}), + TriggeredBy: gitpod.F([]gitpod.AutomationsFileTasksTriggeredBy{gitpod.AutomationsFileTasksTriggeredByManual}), }, }), }), diff --git a/environmentautomationservice.go b/environmentautomationservice.go index 21106d6..e2c9382 100644 --- a/environmentautomationservice.go +++ b/environmentautomationservice.go @@ -6,7 +6,6 @@ import ( "context" "net/http" "net/url" - "reflect" "time" "github.com/gitpod-io/flex-sdk-go/internal/apijson" @@ -15,7 +14,7 @@ import ( "github.com/gitpod-io/flex-sdk-go/internal/requestconfig" "github.com/gitpod-io/flex-sdk-go/option" "github.com/gitpod-io/flex-sdk-go/packages/pagination" - "github.com/tidwall/gjson" + "github.com/gitpod-io/flex-sdk-go/shared" ) // EnvironmentAutomationServiceService contains methods and other services that @@ -62,7 +61,7 @@ func (r *EnvironmentAutomationServiceService) Update(ctx context.Context, body E } // ListServices -func (r *EnvironmentAutomationServiceService) List(ctx context.Context, params EnvironmentAutomationServiceListParams, opts ...option.RequestOption) (res *pagination.ServicesPage[EnvironmentAutomationServiceListResponse], err error) { +func (r *EnvironmentAutomationServiceService) List(ctx context.Context, params EnvironmentAutomationServiceListParams, opts ...option.RequestOption) (res *pagination.ServicesPage[Service], err error) { var raw *http.Response opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -80,7 +79,7 @@ func (r *EnvironmentAutomationServiceService) List(ctx context.Context, params E } // ListServices -func (r *EnvironmentAutomationServiceService) ListAutoPaging(ctx context.Context, params EnvironmentAutomationServiceListParams, opts ...option.RequestOption) *pagination.ServicesPageAutoPager[EnvironmentAutomationServiceListResponse] { +func (r *EnvironmentAutomationServiceService) ListAutoPaging(ctx context.Context, params EnvironmentAutomationServiceListParams, opts ...option.RequestOption) *pagination.ServicesPageAutoPager[Service] { return pagination.NewServicesPageAutoPager(r.List(ctx, params, opts...)) } @@ -113,39 +112,17 @@ func (r *EnvironmentAutomationServiceService) Stop(ctx context.Context, body Env return } -type EnvironmentAutomationServiceNewResponse struct { - Service EnvironmentAutomationServiceNewResponseService `json:"service"` - JSON environmentAutomationServiceNewResponseJSON `json:"-"` -} - -// environmentAutomationServiceNewResponseJSON contains the JSON metadata for the -// struct [EnvironmentAutomationServiceNewResponse] -type environmentAutomationServiceNewResponseJSON struct { - Service apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceNewResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceNewResponseJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationServiceNewResponseService struct { - ID string `json:"id" format:"uuid"` - EnvironmentID string `json:"environmentId" format:"uuid"` - Metadata EnvironmentAutomationServiceNewResponseServiceMetadata `json:"metadata"` - Spec EnvironmentAutomationServiceNewResponseServiceSpec `json:"spec"` - Status EnvironmentAutomationServiceNewResponseServiceStatus `json:"status"` - JSON environmentAutomationServiceNewResponseServiceJSON `json:"-"` +type Service struct { + ID string `json:"id" format:"uuid"` + EnvironmentID string `json:"environmentId" format:"uuid"` + Metadata ServiceMetadata `json:"metadata"` + Spec ServiceSpec `json:"spec"` + Status ServiceStatus `json:"status"` + JSON serviceJSON `json:"-"` } -// environmentAutomationServiceNewResponseServiceJSON contains the JSON metadata -// for the struct [EnvironmentAutomationServiceNewResponseService] -type environmentAutomationServiceNewResponseServiceJSON struct { +// serviceJSON contains the JSON metadata for the struct [Service] +type serviceJSON struct { ID apijson.Field EnvironmentID apijson.Field Metadata apijson.Field @@ -155,15 +132,15 @@ type environmentAutomationServiceNewResponseServiceJSON struct { ExtraFields map[string]apijson.Field } -func (r *EnvironmentAutomationServiceNewResponseService) UnmarshalJSON(data []byte) (err error) { +func (r *Service) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentAutomationServiceNewResponseServiceJSON) RawJSON() string { +func (r serviceJSON) RawJSON() string { return r.raw } -type EnvironmentAutomationServiceNewResponseServiceMetadata struct { +type ServiceMetadata 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, @@ -254,7 +231,7 @@ type EnvironmentAutomationServiceNewResponseServiceMetadata struct { // 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 service. - Creator EnvironmentAutomationServiceNewResponseServiceMetadataCreator `json:"creator"` + Creator shared.Subject `json:"creator"` // description is a user-facing description for the service. It can be used to // provide context and documentation for the service. Description string `json:"description"` @@ -267,13 +244,12 @@ type EnvironmentAutomationServiceNewResponseServiceMetadata struct { // identify the service in user interactions (e.g. the CLI). Reference string `json:"reference"` // triggered_by is a list of trigger that start the service. - TriggeredBy []EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredBy `json:"triggeredBy"` - JSON environmentAutomationServiceNewResponseServiceMetadataJSON `json:"-"` + TriggeredBy []shared.AutomationTrigger `json:"triggeredBy"` + JSON serviceMetadataJSON `json:"-"` } -// environmentAutomationServiceNewResponseServiceMetadataJSON contains the JSON -// metadata for the struct [EnvironmentAutomationServiceNewResponseServiceMetadata] -type environmentAutomationServiceNewResponseServiceMetadataJSON struct { +// serviceMetadataJSON contains the JSON metadata for the struct [ServiceMetadata] +type serviceMetadataJSON struct { CreatedAt apijson.Field Creator apijson.Field Description apijson.Field @@ -284,239 +260,166 @@ type environmentAutomationServiceNewResponseServiceMetadataJSON struct { ExtraFields map[string]apijson.Field } -func (r *EnvironmentAutomationServiceNewResponseServiceMetadata) UnmarshalJSON(data []byte) (err error) { +func (r *ServiceMetadata) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentAutomationServiceNewResponseServiceMetadataJSON) RawJSON() string { +func (r serviceMetadataJSON) RawJSON() string { return r.raw } -// creator describes the principal who created the service. -type EnvironmentAutomationServiceNewResponseServiceMetadataCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal EnvironmentAutomationServiceNewResponseServiceMetadataCreatorPrincipal `json:"principal"` - JSON environmentAutomationServiceNewResponseServiceMetadataCreatorJSON `json:"-"` -} - -// environmentAutomationServiceNewResponseServiceMetadataCreatorJSON contains the -// JSON metadata for the struct -// [EnvironmentAutomationServiceNewResponseServiceMetadataCreator] -type environmentAutomationServiceNewResponseServiceMetadataCreatorJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceNewResponseServiceMetadataCreator) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +type ServiceMetadataParam 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 service. + Creator param.Field[shared.SubjectParam] `json:"creator"` + // description is a user-facing description for the service. It can be used to + // provide context and documentation for the service. + Description param.Field[string] `json:"description"` + // name is a user-facing name for the service. Unlike the reference, this field is + // not unique, and not referenced by the system. This is a short descriptive name + // for the service. + Name param.Field[string] `json:"name"` + // reference is a user-facing identifier for the service which must be unique on + // the environment. It is used to express dependencies between services, and to + // identify the service in user interactions (e.g. the CLI). + Reference param.Field[string] `json:"reference"` + // triggered_by is a list of trigger that start the service. + TriggeredBy param.Field[[]shared.AutomationTriggerParam] `json:"triggeredBy"` } -func (r environmentAutomationServiceNewResponseServiceMetadataCreatorJSON) RawJSON() string { - return r.raw +func (r ServiceMetadataParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -// Principal is the principal of the subject -type EnvironmentAutomationServiceNewResponseServiceMetadataCreatorPrincipal string +type ServicePhase string const ( - EnvironmentAutomationServiceNewResponseServiceMetadataCreatorPrincipalPrincipalUnspecified EnvironmentAutomationServiceNewResponseServiceMetadataCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - EnvironmentAutomationServiceNewResponseServiceMetadataCreatorPrincipalPrincipalAccount EnvironmentAutomationServiceNewResponseServiceMetadataCreatorPrincipal = "PRINCIPAL_ACCOUNT" - EnvironmentAutomationServiceNewResponseServiceMetadataCreatorPrincipalPrincipalUser EnvironmentAutomationServiceNewResponseServiceMetadataCreatorPrincipal = "PRINCIPAL_USER" - EnvironmentAutomationServiceNewResponseServiceMetadataCreatorPrincipalPrincipalRunner EnvironmentAutomationServiceNewResponseServiceMetadataCreatorPrincipal = "PRINCIPAL_RUNNER" - EnvironmentAutomationServiceNewResponseServiceMetadataCreatorPrincipalPrincipalEnvironment EnvironmentAutomationServiceNewResponseServiceMetadataCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - EnvironmentAutomationServiceNewResponseServiceMetadataCreatorPrincipalPrincipalServiceAccount EnvironmentAutomationServiceNewResponseServiceMetadataCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" + ServicePhaseServicePhaseUnspecified ServicePhase = "SERVICE_PHASE_UNSPECIFIED" + ServicePhaseServicePhaseStarting ServicePhase = "SERVICE_PHASE_STARTING" + ServicePhaseServicePhaseRunning ServicePhase = "SERVICE_PHASE_RUNNING" + ServicePhaseServicePhaseStopping ServicePhase = "SERVICE_PHASE_STOPPING" + ServicePhaseServicePhaseStopped ServicePhase = "SERVICE_PHASE_STOPPED" + ServicePhaseServicePhaseFailed ServicePhase = "SERVICE_PHASE_FAILED" + ServicePhaseServicePhaseDeleted ServicePhase = "SERVICE_PHASE_DELETED" ) -func (r EnvironmentAutomationServiceNewResponseServiceMetadataCreatorPrincipal) IsKnown() bool { +func (r ServicePhase) IsKnown() bool { switch r { - case EnvironmentAutomationServiceNewResponseServiceMetadataCreatorPrincipalPrincipalUnspecified, EnvironmentAutomationServiceNewResponseServiceMetadataCreatorPrincipalPrincipalAccount, EnvironmentAutomationServiceNewResponseServiceMetadataCreatorPrincipalPrincipalUser, EnvironmentAutomationServiceNewResponseServiceMetadataCreatorPrincipalPrincipalRunner, EnvironmentAutomationServiceNewResponseServiceMetadataCreatorPrincipalPrincipalEnvironment, EnvironmentAutomationServiceNewResponseServiceMetadataCreatorPrincipalPrincipalServiceAccount: + case ServicePhaseServicePhaseUnspecified, ServicePhaseServicePhaseStarting, ServicePhaseServicePhaseRunning, ServicePhaseServicePhaseStopping, ServicePhaseServicePhaseStopped, ServicePhaseServicePhaseFailed, ServicePhaseServicePhaseDeleted: return true } return false } -// An AutomationTrigger represents a trigger for an automation action. The -// `post_environment_start` field indicates that the automation should be triggered -// after the environment has started. The `post_devcontainer_start` field indicates -// that the automation should be triggered after the dev container has started. -type EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredBy struct { - Manual bool `json:"manual"` - PostDevcontainerStart bool `json:"postDevcontainerStart"` - PostEnvironmentStart bool `json:"postEnvironmentStart"` - JSON environmentAutomationServiceNewResponseServiceMetadataTriggeredByJSON `json:"-"` - union EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByUnion -} - -// environmentAutomationServiceNewResponseServiceMetadataTriggeredByJSON contains -// the JSON metadata for the struct -// [EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredBy] -type environmentAutomationServiceNewResponseServiceMetadataTriggeredByJSON struct { - Manual apijson.Field - PostDevcontainerStart apijson.Field - PostEnvironmentStart apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r environmentAutomationServiceNewResponseServiceMetadataTriggeredByJSON) RawJSON() string { - return r.raw -} - -func (r *EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredBy) UnmarshalJSON(data []byte) (err error) { - *r = EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredBy{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a -// [EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByUnion] -// interface which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByManual], -// [EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByPostDevcontainerStart], -// [EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByPostEnvironmentStart]. -func (r EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredBy) AsUnion() EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByUnion { - return r.union -} - -// An AutomationTrigger represents a trigger for an automation action. The -// `post_environment_start` field indicates that the automation should be triggered -// after the environment has started. The `post_devcontainer_start` field indicates -// that the automation should be triggered after the dev container has started. -// -// Union satisfied by -// [EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByManual], -// [EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByPostDevcontainerStart] -// or -// [EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByPostEnvironmentStart]. -type EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByUnion interface { - implementsEnvironmentAutomationServiceNewResponseServiceMetadataTriggeredBy() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByManual{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByPostDevcontainerStart{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByPostEnvironmentStart{}), - }, - ) -} - -type EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByManual struct { - Manual bool `json:"manual,required"` - JSON environmentAutomationServiceNewResponseServiceMetadataTriggeredByManualJSON `json:"-"` -} - -// environmentAutomationServiceNewResponseServiceMetadataTriggeredByManualJSON -// contains the JSON metadata for the struct -// [EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByManual] -type environmentAutomationServiceNewResponseServiceMetadataTriggeredByManualJSON struct { - Manual apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByManual) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceNewResponseServiceMetadataTriggeredByManualJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByManual) implementsEnvironmentAutomationServiceNewResponseServiceMetadataTriggeredBy() { -} - -type EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByPostDevcontainerStart struct { - PostDevcontainerStart bool `json:"postDevcontainerStart,required"` - JSON environmentAutomationServiceNewResponseServiceMetadataTriggeredByPostDevcontainerStartJSON `json:"-"` -} - -// environmentAutomationServiceNewResponseServiceMetadataTriggeredByPostDevcontainerStartJSON -// contains the JSON metadata for the struct -// [EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByPostDevcontainerStart] -type environmentAutomationServiceNewResponseServiceMetadataTriggeredByPostDevcontainerStartJSON struct { - PostDevcontainerStart apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByPostDevcontainerStart) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceNewResponseServiceMetadataTriggeredByPostDevcontainerStartJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByPostDevcontainerStart) implementsEnvironmentAutomationServiceNewResponseServiceMetadataTriggeredBy() { -} - -type EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByPostEnvironmentStart struct { - PostEnvironmentStart bool `json:"postEnvironmentStart,required"` - JSON environmentAutomationServiceNewResponseServiceMetadataTriggeredByPostEnvironmentStartJSON `json:"-"` -} - -// environmentAutomationServiceNewResponseServiceMetadataTriggeredByPostEnvironmentStartJSON -// contains the JSON metadata for the struct -// [EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByPostEnvironmentStart] -type environmentAutomationServiceNewResponseServiceMetadataTriggeredByPostEnvironmentStartJSON struct { - PostEnvironmentStart apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByPostEnvironmentStart) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceNewResponseServiceMetadataTriggeredByPostEnvironmentStartJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentAutomationServiceNewResponseServiceMetadataTriggeredByPostEnvironmentStart) implementsEnvironmentAutomationServiceNewResponseServiceMetadataTriggeredBy() { -} - -type EnvironmentAutomationServiceNewResponseServiceSpec struct { +type ServiceSpec struct { // commands contains the commands to start, stop and check the readiness of the // service - Commands EnvironmentAutomationServiceNewResponseServiceSpecCommands `json:"commands"` + Commands ServiceSpecCommands `json:"commands"` // desired_phase is the phase the service should be in. Used to start or stop the // service. - DesiredPhase EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhase `json:"desiredPhase"` + DesiredPhase ServicePhase `json:"desiredPhase"` // runs_on specifies the environment the service should run on. - RunsOn EnvironmentAutomationServiceNewResponseServiceSpecRunsOn `json:"runsOn"` + RunsOn shared.RunsOn `json:"runsOn"` // session should be changed to trigger a restart of the service. If a service // exits it will not be restarted until the session is changed. Session string `json:"session"` // version of the spec. The value of this field has no semantic meaning (e.g. don't // interpret it as as a timestamp), but it can be used to impose a partial order. // If a.spec_version < b.spec_version then a was the spec before b. - SpecVersion string `json:"specVersion"` - JSON environmentAutomationServiceNewResponseServiceSpecJSON `json:"-"` + SpecVersion string `json:"specVersion"` + JSON serviceSpecJSON `json:"-"` } -// environmentAutomationServiceNewResponseServiceSpecJSON contains the JSON -// metadata for the struct [EnvironmentAutomationServiceNewResponseServiceSpec] -type environmentAutomationServiceNewResponseServiceSpecJSON struct { +// serviceSpecJSON contains the JSON metadata for the struct [ServiceSpec] +type serviceSpecJSON struct { Commands apijson.Field DesiredPhase apijson.Field RunsOn apijson.Field @@ -526,17 +429,17 @@ type environmentAutomationServiceNewResponseServiceSpecJSON struct { ExtraFields map[string]apijson.Field } -func (r *EnvironmentAutomationServiceNewResponseServiceSpec) UnmarshalJSON(data []byte) (err error) { +func (r *ServiceSpec) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentAutomationServiceNewResponseServiceSpecJSON) RawJSON() string { +func (r serviceSpecJSON) RawJSON() string { return r.raw } // commands contains the commands to start, stop and check the readiness of the // service -type EnvironmentAutomationServiceNewResponseServiceSpecCommands struct { +type ServiceSpecCommands struct { // ready is an optional command that is run repeatedly until it exits with a zero // exit code. If set, the service will first go into a Starting phase, and then // into a Running phase once the ready command exits with a zero exit code. @@ -555,14 +458,13 @@ type EnvironmentAutomationServiceNewResponseServiceSpecCommands struct { // SIGKILL signal. If the stop command exits with a non-zero exit code, the service // will transition to the Failed phase. If the stop command does not exit within 2 // minutes, a SIGKILL signal will be sent to both the start and stop commands. - Stop string `json:"stop"` - JSON environmentAutomationServiceNewResponseServiceSpecCommandsJSON `json:"-"` + Stop string `json:"stop"` + JSON serviceSpecCommandsJSON `json:"-"` } -// environmentAutomationServiceNewResponseServiceSpecCommandsJSON contains the JSON -// metadata for the struct -// [EnvironmentAutomationServiceNewResponseServiceSpecCommands] -type environmentAutomationServiceNewResponseServiceSpecCommandsJSON struct { +// serviceSpecCommandsJSON contains the JSON metadata for the struct +// [ServiceSpecCommands] +type serviceSpecCommandsJSON struct { Ready apijson.Field Start apijson.Field Stop apijson.Field @@ -570,84 +472,65 @@ type environmentAutomationServiceNewResponseServiceSpecCommandsJSON struct { ExtraFields map[string]apijson.Field } -func (r *EnvironmentAutomationServiceNewResponseServiceSpecCommands) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceNewResponseServiceSpecCommandsJSON) RawJSON() string { - return r.raw -} - -// desired_phase is the phase the service should be in. Used to start or stop the -// service. -type EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhase string - -const ( - EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhaseServicePhaseUnspecified EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhase = "SERVICE_PHASE_UNSPECIFIED" - EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhaseServicePhaseStarting EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhase = "SERVICE_PHASE_STARTING" - EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhaseServicePhaseRunning EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhase = "SERVICE_PHASE_RUNNING" - EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhaseServicePhaseStopping EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhase = "SERVICE_PHASE_STOPPING" - EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhaseServicePhaseStopped EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhase = "SERVICE_PHASE_STOPPED" - EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhaseServicePhaseFailed EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhase = "SERVICE_PHASE_FAILED" - EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhaseServicePhaseDeleted EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhase = "SERVICE_PHASE_DELETED" -) - -func (r EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhase) IsKnown() bool { - switch r { - case EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhaseServicePhaseUnspecified, EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhaseServicePhaseStarting, EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhaseServicePhaseRunning, EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhaseServicePhaseStopping, EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhaseServicePhaseStopped, EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhaseServicePhaseFailed, EnvironmentAutomationServiceNewResponseServiceSpecDesiredPhaseServicePhaseDeleted: - return true - } - return false -} - -// runs_on specifies the environment the service should run on. -type EnvironmentAutomationServiceNewResponseServiceSpecRunsOn struct { - Docker EnvironmentAutomationServiceNewResponseServiceSpecRunsOnDocker `json:"docker,required"` - JSON environmentAutomationServiceNewResponseServiceSpecRunsOnJSON `json:"-"` -} - -// environmentAutomationServiceNewResponseServiceSpecRunsOnJSON contains the JSON -// metadata for the struct -// [EnvironmentAutomationServiceNewResponseServiceSpecRunsOn] -type environmentAutomationServiceNewResponseServiceSpecRunsOnJSON struct { - Docker apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceNewResponseServiceSpecRunsOn) UnmarshalJSON(data []byte) (err error) { +func (r *ServiceSpecCommands) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentAutomationServiceNewResponseServiceSpecRunsOnJSON) RawJSON() string { +func (r serviceSpecCommandsJSON) RawJSON() string { return r.raw } -type EnvironmentAutomationServiceNewResponseServiceSpecRunsOnDocker struct { - Environment []string `json:"environment"` - Image string `json:"image"` - JSON environmentAutomationServiceNewResponseServiceSpecRunsOnDockerJSON `json:"-"` +type ServiceSpecParam struct { + // commands contains the commands to start, stop and check the readiness of the + // service + Commands param.Field[ServiceSpecCommandsParam] `json:"commands"` + // desired_phase is the phase the service should be in. Used to start or stop the + // service. + DesiredPhase param.Field[ServicePhase] `json:"desiredPhase"` + // runs_on specifies the environment the service should run on. + RunsOn param.Field[shared.RunsOnParam] `json:"runsOn"` + // session should be changed to trigger a restart of the service. If a service + // exits it will not be restarted until the session is changed. + Session param.Field[string] `json:"session"` + // version of the spec. The value of this field has no semantic meaning (e.g. don't + // interpret it as as a timestamp), but it can be used to impose a partial order. + // If a.spec_version < b.spec_version then a was the spec before b. + SpecVersion param.Field[string] `json:"specVersion"` } -// environmentAutomationServiceNewResponseServiceSpecRunsOnDockerJSON contains the -// JSON metadata for the struct -// [EnvironmentAutomationServiceNewResponseServiceSpecRunsOnDocker] -type environmentAutomationServiceNewResponseServiceSpecRunsOnDockerJSON struct { - Environment apijson.Field - Image apijson.Field - raw string - ExtraFields map[string]apijson.Field +func (r ServiceSpecParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r *EnvironmentAutomationServiceNewResponseServiceSpecRunsOnDocker) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +// commands contains the commands to start, stop and check the readiness of the +// service +type ServiceSpecCommandsParam struct { + // ready is an optional command that is run repeatedly until it exits with a zero + // exit code. If set, the service will first go into a Starting phase, and then + // into a Running phase once the ready command exits with a zero exit code. + Ready param.Field[string] `json:"ready"` + // start is the command to start and run the service. If start exits, the service + // will transition to the following phase: + // + // - Stopped: if the exit code is 0 + // - Failed: if the exit code is not 0 If the stop command is not set, the start + // command will receive a SIGTERM signal when the service is requested to stop. + // If it does not exit within 2 minutes, it will receive a SIGKILL signal. + Start param.Field[string] `json:"start"` + // stop is an optional command that runs when the service is requested to stop. If + // set, instead of sending a SIGTERM signal to the start command, the stop command + // will be run. Once the stop command exits, the start command will receive a + // SIGKILL signal. If the stop command exits with a non-zero exit code, the service + // will transition to the Failed phase. If the stop command does not exit within 2 + // minutes, a SIGKILL signal will be sent to both the start and stop commands. + Stop param.Field[string] `json:"stop"` } -func (r environmentAutomationServiceNewResponseServiceSpecRunsOnDockerJSON) RawJSON() string { - return r.raw +func (r ServiceSpecCommandsParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -type EnvironmentAutomationServiceNewResponseServiceStatus struct { +type ServiceStatus struct { // failure_message summarises why the service failed to operate. If this is // non-empty the service has failed to operate and will likely transition to a // failed state. @@ -655,7 +538,7 @@ type EnvironmentAutomationServiceNewResponseServiceStatus struct { // log_url contains the URL at which the service logs can be accessed. LogURL string `json:"logUrl"` // phase is the current phase of the service. - Phase EnvironmentAutomationServiceNewResponseServiceStatusPhase `json:"phase"` + Phase ServicePhase `json:"phase"` // session is the current session of the service. Session string `json:"session"` // version of the status update. Service instances themselves are unversioned, but @@ -663,13 +546,12 @@ type EnvironmentAutomationServiceNewResponseServiceStatus struct { // meaning (e.g. don't interpret it as as a timestamp), but it can be used to // impose a partial order. If a.status_version < b.status_version then a was the // status before b. - StatusVersion string `json:"statusVersion"` - JSON environmentAutomationServiceNewResponseServiceStatusJSON `json:"-"` + StatusVersion string `json:"statusVersion"` + JSON serviceStatusJSON `json:"-"` } -// environmentAutomationServiceNewResponseServiceStatusJSON contains the JSON -// metadata for the struct [EnvironmentAutomationServiceNewResponseServiceStatus] -type environmentAutomationServiceNewResponseServiceStatusJSON struct { +// serviceStatusJSON contains the JSON metadata for the struct [ServiceStatus] +type serviceStatusJSON struct { FailureMessage apijson.Field LogURL apijson.Field Phase apijson.Field @@ -679,1513 +561,71 @@ type environmentAutomationServiceNewResponseServiceStatusJSON struct { ExtraFields map[string]apijson.Field } -func (r *EnvironmentAutomationServiceNewResponseServiceStatus) UnmarshalJSON(data []byte) (err error) { +func (r *ServiceStatus) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentAutomationServiceNewResponseServiceStatusJSON) RawJSON() string { +func (r serviceStatusJSON) RawJSON() string { return r.raw } -// phase is the current phase of the service. -type EnvironmentAutomationServiceNewResponseServiceStatusPhase string - -const ( - EnvironmentAutomationServiceNewResponseServiceStatusPhaseServicePhaseUnspecified EnvironmentAutomationServiceNewResponseServiceStatusPhase = "SERVICE_PHASE_UNSPECIFIED" - EnvironmentAutomationServiceNewResponseServiceStatusPhaseServicePhaseStarting EnvironmentAutomationServiceNewResponseServiceStatusPhase = "SERVICE_PHASE_STARTING" - EnvironmentAutomationServiceNewResponseServiceStatusPhaseServicePhaseRunning EnvironmentAutomationServiceNewResponseServiceStatusPhase = "SERVICE_PHASE_RUNNING" - EnvironmentAutomationServiceNewResponseServiceStatusPhaseServicePhaseStopping EnvironmentAutomationServiceNewResponseServiceStatusPhase = "SERVICE_PHASE_STOPPING" - EnvironmentAutomationServiceNewResponseServiceStatusPhaseServicePhaseStopped EnvironmentAutomationServiceNewResponseServiceStatusPhase = "SERVICE_PHASE_STOPPED" - EnvironmentAutomationServiceNewResponseServiceStatusPhaseServicePhaseFailed EnvironmentAutomationServiceNewResponseServiceStatusPhase = "SERVICE_PHASE_FAILED" - EnvironmentAutomationServiceNewResponseServiceStatusPhaseServicePhaseDeleted EnvironmentAutomationServiceNewResponseServiceStatusPhase = "SERVICE_PHASE_DELETED" -) - -func (r EnvironmentAutomationServiceNewResponseServiceStatusPhase) IsKnown() bool { - switch r { - case EnvironmentAutomationServiceNewResponseServiceStatusPhaseServicePhaseUnspecified, EnvironmentAutomationServiceNewResponseServiceStatusPhaseServicePhaseStarting, EnvironmentAutomationServiceNewResponseServiceStatusPhaseServicePhaseRunning, EnvironmentAutomationServiceNewResponseServiceStatusPhaseServicePhaseStopping, EnvironmentAutomationServiceNewResponseServiceStatusPhaseServicePhaseStopped, EnvironmentAutomationServiceNewResponseServiceStatusPhaseServicePhaseFailed, EnvironmentAutomationServiceNewResponseServiceStatusPhaseServicePhaseDeleted: - return true - } - return false +type EnvironmentAutomationServiceNewResponse struct { + Service Service `json:"service"` + JSON environmentAutomationServiceNewResponseJSON `json:"-"` } -type EnvironmentAutomationServiceGetResponse struct { - Service EnvironmentAutomationServiceGetResponseService `json:"service"` - JSON environmentAutomationServiceGetResponseJSON `json:"-"` +// environmentAutomationServiceNewResponseJSON contains the JSON metadata for the +// struct [EnvironmentAutomationServiceNewResponse] +type environmentAutomationServiceNewResponseJSON struct { + Service apijson.Field + raw string + ExtraFields map[string]apijson.Field } -// environmentAutomationServiceGetResponseJSON contains the JSON metadata for the -// struct [EnvironmentAutomationServiceGetResponse] -type environmentAutomationServiceGetResponseJSON struct { - Service apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceGetResponseJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationServiceGetResponseService struct { - ID string `json:"id" format:"uuid"` - EnvironmentID string `json:"environmentId" format:"uuid"` - Metadata EnvironmentAutomationServiceGetResponseServiceMetadata `json:"metadata"` - Spec EnvironmentAutomationServiceGetResponseServiceSpec `json:"spec"` - Status EnvironmentAutomationServiceGetResponseServiceStatus `json:"status"` - JSON environmentAutomationServiceGetResponseServiceJSON `json:"-"` -} - -// environmentAutomationServiceGetResponseServiceJSON contains the JSON metadata -// for the struct [EnvironmentAutomationServiceGetResponseService] -type environmentAutomationServiceGetResponseServiceJSON struct { - ID apijson.Field - EnvironmentID apijson.Field - Metadata apijson.Field - Spec apijson.Field - Status apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceGetResponseService) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceGetResponseServiceJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationServiceGetResponseServiceMetadata 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 service. - Creator EnvironmentAutomationServiceGetResponseServiceMetadataCreator `json:"creator"` - // description is a user-facing description for the service. It can be used to - // provide context and documentation for the service. - Description string `json:"description"` - // name is a user-facing name for the service. Unlike the reference, this field is - // not unique, and not referenced by the system. This is a short descriptive name - // for the service. - Name string `json:"name"` - // reference is a user-facing identifier for the service which must be unique on - // the environment. It is used to express dependencies between services, and to - // identify the service in user interactions (e.g. the CLI). - Reference string `json:"reference"` - // triggered_by is a list of trigger that start the service. - TriggeredBy []EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredBy `json:"triggeredBy"` - JSON environmentAutomationServiceGetResponseServiceMetadataJSON `json:"-"` -} - -// environmentAutomationServiceGetResponseServiceMetadataJSON contains the JSON -// metadata for the struct [EnvironmentAutomationServiceGetResponseServiceMetadata] -type environmentAutomationServiceGetResponseServiceMetadataJSON 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 *EnvironmentAutomationServiceGetResponseServiceMetadata) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceGetResponseServiceMetadataJSON) RawJSON() string { - return r.raw -} - -// creator describes the principal who created the service. -type EnvironmentAutomationServiceGetResponseServiceMetadataCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal EnvironmentAutomationServiceGetResponseServiceMetadataCreatorPrincipal `json:"principal"` - JSON environmentAutomationServiceGetResponseServiceMetadataCreatorJSON `json:"-"` -} - -// environmentAutomationServiceGetResponseServiceMetadataCreatorJSON contains the -// JSON metadata for the struct -// [EnvironmentAutomationServiceGetResponseServiceMetadataCreator] -type environmentAutomationServiceGetResponseServiceMetadataCreatorJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceGetResponseServiceMetadataCreator) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceGetResponseServiceMetadataCreatorJSON) RawJSON() string { - return r.raw -} - -// Principal is the principal of the subject -type EnvironmentAutomationServiceGetResponseServiceMetadataCreatorPrincipal string - -const ( - EnvironmentAutomationServiceGetResponseServiceMetadataCreatorPrincipalPrincipalUnspecified EnvironmentAutomationServiceGetResponseServiceMetadataCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - EnvironmentAutomationServiceGetResponseServiceMetadataCreatorPrincipalPrincipalAccount EnvironmentAutomationServiceGetResponseServiceMetadataCreatorPrincipal = "PRINCIPAL_ACCOUNT" - EnvironmentAutomationServiceGetResponseServiceMetadataCreatorPrincipalPrincipalUser EnvironmentAutomationServiceGetResponseServiceMetadataCreatorPrincipal = "PRINCIPAL_USER" - EnvironmentAutomationServiceGetResponseServiceMetadataCreatorPrincipalPrincipalRunner EnvironmentAutomationServiceGetResponseServiceMetadataCreatorPrincipal = "PRINCIPAL_RUNNER" - EnvironmentAutomationServiceGetResponseServiceMetadataCreatorPrincipalPrincipalEnvironment EnvironmentAutomationServiceGetResponseServiceMetadataCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - EnvironmentAutomationServiceGetResponseServiceMetadataCreatorPrincipalPrincipalServiceAccount EnvironmentAutomationServiceGetResponseServiceMetadataCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r EnvironmentAutomationServiceGetResponseServiceMetadataCreatorPrincipal) IsKnown() bool { - switch r { - case EnvironmentAutomationServiceGetResponseServiceMetadataCreatorPrincipalPrincipalUnspecified, EnvironmentAutomationServiceGetResponseServiceMetadataCreatorPrincipalPrincipalAccount, EnvironmentAutomationServiceGetResponseServiceMetadataCreatorPrincipalPrincipalUser, EnvironmentAutomationServiceGetResponseServiceMetadataCreatorPrincipalPrincipalRunner, EnvironmentAutomationServiceGetResponseServiceMetadataCreatorPrincipalPrincipalEnvironment, EnvironmentAutomationServiceGetResponseServiceMetadataCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - -// An AutomationTrigger represents a trigger for an automation action. The -// `post_environment_start` field indicates that the automation should be triggered -// after the environment has started. The `post_devcontainer_start` field indicates -// that the automation should be triggered after the dev container has started. -type EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredBy struct { - Manual bool `json:"manual"` - PostDevcontainerStart bool `json:"postDevcontainerStart"` - PostEnvironmentStart bool `json:"postEnvironmentStart"` - JSON environmentAutomationServiceGetResponseServiceMetadataTriggeredByJSON `json:"-"` - union EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByUnion -} - -// environmentAutomationServiceGetResponseServiceMetadataTriggeredByJSON contains -// the JSON metadata for the struct -// [EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredBy] -type environmentAutomationServiceGetResponseServiceMetadataTriggeredByJSON struct { - Manual apijson.Field - PostDevcontainerStart apijson.Field - PostEnvironmentStart apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r environmentAutomationServiceGetResponseServiceMetadataTriggeredByJSON) RawJSON() string { - return r.raw -} - -func (r *EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredBy) UnmarshalJSON(data []byte) (err error) { - *r = EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredBy{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a -// [EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByUnion] -// interface which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByManual], -// [EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByPostDevcontainerStart], -// [EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByPostEnvironmentStart]. -func (r EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredBy) AsUnion() EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByUnion { - return r.union -} - -// An AutomationTrigger represents a trigger for an automation action. The -// `post_environment_start` field indicates that the automation should be triggered -// after the environment has started. The `post_devcontainer_start` field indicates -// that the automation should be triggered after the dev container has started. -// -// Union satisfied by -// [EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByManual], -// [EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByPostDevcontainerStart] -// or -// [EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByPostEnvironmentStart]. -type EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByUnion interface { - implementsEnvironmentAutomationServiceGetResponseServiceMetadataTriggeredBy() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByManual{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByPostDevcontainerStart{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByPostEnvironmentStart{}), - }, - ) -} - -type EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByManual struct { - Manual bool `json:"manual,required"` - JSON environmentAutomationServiceGetResponseServiceMetadataTriggeredByManualJSON `json:"-"` -} - -// environmentAutomationServiceGetResponseServiceMetadataTriggeredByManualJSON -// contains the JSON metadata for the struct -// [EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByManual] -type environmentAutomationServiceGetResponseServiceMetadataTriggeredByManualJSON struct { - Manual apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByManual) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceGetResponseServiceMetadataTriggeredByManualJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByManual) implementsEnvironmentAutomationServiceGetResponseServiceMetadataTriggeredBy() { -} - -type EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByPostDevcontainerStart struct { - PostDevcontainerStart bool `json:"postDevcontainerStart,required"` - JSON environmentAutomationServiceGetResponseServiceMetadataTriggeredByPostDevcontainerStartJSON `json:"-"` -} - -// environmentAutomationServiceGetResponseServiceMetadataTriggeredByPostDevcontainerStartJSON -// contains the JSON metadata for the struct -// [EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByPostDevcontainerStart] -type environmentAutomationServiceGetResponseServiceMetadataTriggeredByPostDevcontainerStartJSON struct { - PostDevcontainerStart apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByPostDevcontainerStart) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceGetResponseServiceMetadataTriggeredByPostDevcontainerStartJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByPostDevcontainerStart) implementsEnvironmentAutomationServiceGetResponseServiceMetadataTriggeredBy() { -} - -type EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByPostEnvironmentStart struct { - PostEnvironmentStart bool `json:"postEnvironmentStart,required"` - JSON environmentAutomationServiceGetResponseServiceMetadataTriggeredByPostEnvironmentStartJSON `json:"-"` -} - -// environmentAutomationServiceGetResponseServiceMetadataTriggeredByPostEnvironmentStartJSON -// contains the JSON metadata for the struct -// [EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByPostEnvironmentStart] -type environmentAutomationServiceGetResponseServiceMetadataTriggeredByPostEnvironmentStartJSON struct { - PostEnvironmentStart apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByPostEnvironmentStart) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceGetResponseServiceMetadataTriggeredByPostEnvironmentStartJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentAutomationServiceGetResponseServiceMetadataTriggeredByPostEnvironmentStart) implementsEnvironmentAutomationServiceGetResponseServiceMetadataTriggeredBy() { -} - -type EnvironmentAutomationServiceGetResponseServiceSpec struct { - // commands contains the commands to start, stop and check the readiness of the - // service - Commands EnvironmentAutomationServiceGetResponseServiceSpecCommands `json:"commands"` - // desired_phase is the phase the service should be in. Used to start or stop the - // service. - DesiredPhase EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhase `json:"desiredPhase"` - // runs_on specifies the environment the service should run on. - RunsOn EnvironmentAutomationServiceGetResponseServiceSpecRunsOn `json:"runsOn"` - // session should be changed to trigger a restart of the service. If a service - // exits it will not be restarted until the session is changed. - Session string `json:"session"` - // version of the spec. The value of this field has no semantic meaning (e.g. don't - // interpret it as as a timestamp), but it can be used to impose a partial order. - // If a.spec_version < b.spec_version then a was the spec before b. - SpecVersion string `json:"specVersion"` - JSON environmentAutomationServiceGetResponseServiceSpecJSON `json:"-"` -} - -// environmentAutomationServiceGetResponseServiceSpecJSON contains the JSON -// metadata for the struct [EnvironmentAutomationServiceGetResponseServiceSpec] -type environmentAutomationServiceGetResponseServiceSpecJSON struct { - Commands apijson.Field - DesiredPhase apijson.Field - RunsOn apijson.Field - Session apijson.Field - SpecVersion apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceGetResponseServiceSpec) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceGetResponseServiceSpecJSON) RawJSON() string { - return r.raw -} - -// commands contains the commands to start, stop and check the readiness of the -// service -type EnvironmentAutomationServiceGetResponseServiceSpecCommands struct { - // ready is an optional command that is run repeatedly until it exits with a zero - // exit code. If set, the service will first go into a Starting phase, and then - // into a Running phase once the ready command exits with a zero exit code. - Ready string `json:"ready"` - // start is the command to start and run the service. If start exits, the service - // will transition to the following phase: - // - // - Stopped: if the exit code is 0 - // - Failed: if the exit code is not 0 If the stop command is not set, the start - // command will receive a SIGTERM signal when the service is requested to stop. - // If it does not exit within 2 minutes, it will receive a SIGKILL signal. - Start string `json:"start"` - // stop is an optional command that runs when the service is requested to stop. If - // set, instead of sending a SIGTERM signal to the start command, the stop command - // will be run. Once the stop command exits, the start command will receive a - // SIGKILL signal. If the stop command exits with a non-zero exit code, the service - // will transition to the Failed phase. If the stop command does not exit within 2 - // minutes, a SIGKILL signal will be sent to both the start and stop commands. - Stop string `json:"stop"` - JSON environmentAutomationServiceGetResponseServiceSpecCommandsJSON `json:"-"` -} - -// environmentAutomationServiceGetResponseServiceSpecCommandsJSON contains the JSON -// metadata for the struct -// [EnvironmentAutomationServiceGetResponseServiceSpecCommands] -type environmentAutomationServiceGetResponseServiceSpecCommandsJSON struct { - Ready apijson.Field - Start apijson.Field - Stop apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceGetResponseServiceSpecCommands) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceGetResponseServiceSpecCommandsJSON) RawJSON() string { - return r.raw -} - -// desired_phase is the phase the service should be in. Used to start or stop the -// service. -type EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhase string - -const ( - EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhaseServicePhaseUnspecified EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhase = "SERVICE_PHASE_UNSPECIFIED" - EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhaseServicePhaseStarting EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhase = "SERVICE_PHASE_STARTING" - EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhaseServicePhaseRunning EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhase = "SERVICE_PHASE_RUNNING" - EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhaseServicePhaseStopping EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhase = "SERVICE_PHASE_STOPPING" - EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhaseServicePhaseStopped EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhase = "SERVICE_PHASE_STOPPED" - EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhaseServicePhaseFailed EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhase = "SERVICE_PHASE_FAILED" - EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhaseServicePhaseDeleted EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhase = "SERVICE_PHASE_DELETED" -) - -func (r EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhase) IsKnown() bool { - switch r { - case EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhaseServicePhaseUnspecified, EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhaseServicePhaseStarting, EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhaseServicePhaseRunning, EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhaseServicePhaseStopping, EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhaseServicePhaseStopped, EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhaseServicePhaseFailed, EnvironmentAutomationServiceGetResponseServiceSpecDesiredPhaseServicePhaseDeleted: - return true - } - return false -} - -// runs_on specifies the environment the service should run on. -type EnvironmentAutomationServiceGetResponseServiceSpecRunsOn struct { - Docker EnvironmentAutomationServiceGetResponseServiceSpecRunsOnDocker `json:"docker,required"` - JSON environmentAutomationServiceGetResponseServiceSpecRunsOnJSON `json:"-"` -} - -// environmentAutomationServiceGetResponseServiceSpecRunsOnJSON contains the JSON -// metadata for the struct -// [EnvironmentAutomationServiceGetResponseServiceSpecRunsOn] -type environmentAutomationServiceGetResponseServiceSpecRunsOnJSON struct { - Docker apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceGetResponseServiceSpecRunsOn) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceGetResponseServiceSpecRunsOnJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationServiceGetResponseServiceSpecRunsOnDocker struct { - Environment []string `json:"environment"` - Image string `json:"image"` - JSON environmentAutomationServiceGetResponseServiceSpecRunsOnDockerJSON `json:"-"` -} - -// environmentAutomationServiceGetResponseServiceSpecRunsOnDockerJSON contains the -// JSON metadata for the struct -// [EnvironmentAutomationServiceGetResponseServiceSpecRunsOnDocker] -type environmentAutomationServiceGetResponseServiceSpecRunsOnDockerJSON struct { - Environment apijson.Field - Image apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceGetResponseServiceSpecRunsOnDocker) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceGetResponseServiceSpecRunsOnDockerJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationServiceGetResponseServiceStatus struct { - // failure_message summarises why the service failed to operate. If this is - // non-empty the service has failed to operate and will likely transition to a - // failed state. - FailureMessage string `json:"failureMessage"` - // log_url contains the URL at which the service logs can be accessed. - LogURL string `json:"logUrl"` - // phase is the current phase of the service. - Phase EnvironmentAutomationServiceGetResponseServiceStatusPhase `json:"phase"` - // session is the current session of the service. - Session string `json:"session"` - // version of the status update. Service instances themselves are unversioned, but - // their status has different versions. The value of this field has no semantic - // meaning (e.g. don't interpret it as as a timestamp), but it can be used to - // impose a partial order. If a.status_version < b.status_version then a was the - // status before b. - StatusVersion string `json:"statusVersion"` - JSON environmentAutomationServiceGetResponseServiceStatusJSON `json:"-"` -} - -// environmentAutomationServiceGetResponseServiceStatusJSON contains the JSON -// metadata for the struct [EnvironmentAutomationServiceGetResponseServiceStatus] -type environmentAutomationServiceGetResponseServiceStatusJSON struct { - FailureMessage apijson.Field - LogURL apijson.Field - Phase apijson.Field - Session apijson.Field - StatusVersion apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceGetResponseServiceStatus) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceGetResponseServiceStatusJSON) RawJSON() string { - return r.raw -} - -// phase is the current phase of the service. -type EnvironmentAutomationServiceGetResponseServiceStatusPhase string - -const ( - EnvironmentAutomationServiceGetResponseServiceStatusPhaseServicePhaseUnspecified EnvironmentAutomationServiceGetResponseServiceStatusPhase = "SERVICE_PHASE_UNSPECIFIED" - EnvironmentAutomationServiceGetResponseServiceStatusPhaseServicePhaseStarting EnvironmentAutomationServiceGetResponseServiceStatusPhase = "SERVICE_PHASE_STARTING" - EnvironmentAutomationServiceGetResponseServiceStatusPhaseServicePhaseRunning EnvironmentAutomationServiceGetResponseServiceStatusPhase = "SERVICE_PHASE_RUNNING" - EnvironmentAutomationServiceGetResponseServiceStatusPhaseServicePhaseStopping EnvironmentAutomationServiceGetResponseServiceStatusPhase = "SERVICE_PHASE_STOPPING" - EnvironmentAutomationServiceGetResponseServiceStatusPhaseServicePhaseStopped EnvironmentAutomationServiceGetResponseServiceStatusPhase = "SERVICE_PHASE_STOPPED" - EnvironmentAutomationServiceGetResponseServiceStatusPhaseServicePhaseFailed EnvironmentAutomationServiceGetResponseServiceStatusPhase = "SERVICE_PHASE_FAILED" - EnvironmentAutomationServiceGetResponseServiceStatusPhaseServicePhaseDeleted EnvironmentAutomationServiceGetResponseServiceStatusPhase = "SERVICE_PHASE_DELETED" -) - -func (r EnvironmentAutomationServiceGetResponseServiceStatusPhase) IsKnown() bool { - switch r { - case EnvironmentAutomationServiceGetResponseServiceStatusPhaseServicePhaseUnspecified, EnvironmentAutomationServiceGetResponseServiceStatusPhaseServicePhaseStarting, EnvironmentAutomationServiceGetResponseServiceStatusPhaseServicePhaseRunning, EnvironmentAutomationServiceGetResponseServiceStatusPhaseServicePhaseStopping, EnvironmentAutomationServiceGetResponseServiceStatusPhaseServicePhaseStopped, EnvironmentAutomationServiceGetResponseServiceStatusPhaseServicePhaseFailed, EnvironmentAutomationServiceGetResponseServiceStatusPhaseServicePhaseDeleted: - return true - } - return false -} - -type EnvironmentAutomationServiceUpdateResponse = interface{} - -type EnvironmentAutomationServiceListResponse struct { - ID string `json:"id" format:"uuid"` - EnvironmentID string `json:"environmentId" format:"uuid"` - Metadata EnvironmentAutomationServiceListResponseMetadata `json:"metadata"` - Spec EnvironmentAutomationServiceListResponseSpec `json:"spec"` - Status EnvironmentAutomationServiceListResponseStatus `json:"status"` - JSON environmentAutomationServiceListResponseJSON `json:"-"` -} - -// environmentAutomationServiceListResponseJSON contains the JSON metadata for the -// struct [EnvironmentAutomationServiceListResponse] -type environmentAutomationServiceListResponseJSON struct { - ID apijson.Field - EnvironmentID apijson.Field - Metadata apijson.Field - Spec apijson.Field - Status apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceListResponseJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationServiceListResponseMetadata 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 service. - Creator EnvironmentAutomationServiceListResponseMetadataCreator `json:"creator"` - // description is a user-facing description for the service. It can be used to - // provide context and documentation for the service. - Description string `json:"description"` - // name is a user-facing name for the service. Unlike the reference, this field is - // not unique, and not referenced by the system. This is a short descriptive name - // for the service. - Name string `json:"name"` - // reference is a user-facing identifier for the service which must be unique on - // the environment. It is used to express dependencies between services, and to - // identify the service in user interactions (e.g. the CLI). - Reference string `json:"reference"` - // triggered_by is a list of trigger that start the service. - TriggeredBy []EnvironmentAutomationServiceListResponseMetadataTriggeredBy `json:"triggeredBy"` - JSON environmentAutomationServiceListResponseMetadataJSON `json:"-"` -} - -// environmentAutomationServiceListResponseMetadataJSON contains the JSON metadata -// for the struct [EnvironmentAutomationServiceListResponseMetadata] -type environmentAutomationServiceListResponseMetadataJSON 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 *EnvironmentAutomationServiceListResponseMetadata) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceListResponseMetadataJSON) RawJSON() string { - return r.raw -} - -// creator describes the principal who created the service. -type EnvironmentAutomationServiceListResponseMetadataCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal EnvironmentAutomationServiceListResponseMetadataCreatorPrincipal `json:"principal"` - JSON environmentAutomationServiceListResponseMetadataCreatorJSON `json:"-"` -} - -// environmentAutomationServiceListResponseMetadataCreatorJSON contains the JSON -// metadata for the struct -// [EnvironmentAutomationServiceListResponseMetadataCreator] -type environmentAutomationServiceListResponseMetadataCreatorJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceListResponseMetadataCreator) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceListResponseMetadataCreatorJSON) RawJSON() string { - return r.raw -} - -// Principal is the principal of the subject -type EnvironmentAutomationServiceListResponseMetadataCreatorPrincipal string - -const ( - EnvironmentAutomationServiceListResponseMetadataCreatorPrincipalPrincipalUnspecified EnvironmentAutomationServiceListResponseMetadataCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - EnvironmentAutomationServiceListResponseMetadataCreatorPrincipalPrincipalAccount EnvironmentAutomationServiceListResponseMetadataCreatorPrincipal = "PRINCIPAL_ACCOUNT" - EnvironmentAutomationServiceListResponseMetadataCreatorPrincipalPrincipalUser EnvironmentAutomationServiceListResponseMetadataCreatorPrincipal = "PRINCIPAL_USER" - EnvironmentAutomationServiceListResponseMetadataCreatorPrincipalPrincipalRunner EnvironmentAutomationServiceListResponseMetadataCreatorPrincipal = "PRINCIPAL_RUNNER" - EnvironmentAutomationServiceListResponseMetadataCreatorPrincipalPrincipalEnvironment EnvironmentAutomationServiceListResponseMetadataCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - EnvironmentAutomationServiceListResponseMetadataCreatorPrincipalPrincipalServiceAccount EnvironmentAutomationServiceListResponseMetadataCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r EnvironmentAutomationServiceListResponseMetadataCreatorPrincipal) IsKnown() bool { - switch r { - case EnvironmentAutomationServiceListResponseMetadataCreatorPrincipalPrincipalUnspecified, EnvironmentAutomationServiceListResponseMetadataCreatorPrincipalPrincipalAccount, EnvironmentAutomationServiceListResponseMetadataCreatorPrincipalPrincipalUser, EnvironmentAutomationServiceListResponseMetadataCreatorPrincipalPrincipalRunner, EnvironmentAutomationServiceListResponseMetadataCreatorPrincipalPrincipalEnvironment, EnvironmentAutomationServiceListResponseMetadataCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - -// An AutomationTrigger represents a trigger for an automation action. The -// `post_environment_start` field indicates that the automation should be triggered -// after the environment has started. The `post_devcontainer_start` field indicates -// that the automation should be triggered after the dev container has started. -type EnvironmentAutomationServiceListResponseMetadataTriggeredBy struct { - Manual bool `json:"manual"` - PostDevcontainerStart bool `json:"postDevcontainerStart"` - PostEnvironmentStart bool `json:"postEnvironmentStart"` - JSON environmentAutomationServiceListResponseMetadataTriggeredByJSON `json:"-"` - union EnvironmentAutomationServiceListResponseMetadataTriggeredByUnion -} - -// environmentAutomationServiceListResponseMetadataTriggeredByJSON contains the -// JSON metadata for the struct -// [EnvironmentAutomationServiceListResponseMetadataTriggeredBy] -type environmentAutomationServiceListResponseMetadataTriggeredByJSON struct { - Manual apijson.Field - PostDevcontainerStart apijson.Field - PostEnvironmentStart apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r environmentAutomationServiceListResponseMetadataTriggeredByJSON) RawJSON() string { - return r.raw -} - -func (r *EnvironmentAutomationServiceListResponseMetadataTriggeredBy) UnmarshalJSON(data []byte) (err error) { - *r = EnvironmentAutomationServiceListResponseMetadataTriggeredBy{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a -// [EnvironmentAutomationServiceListResponseMetadataTriggeredByUnion] interface -// which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [EnvironmentAutomationServiceListResponseMetadataTriggeredByManual], -// [EnvironmentAutomationServiceListResponseMetadataTriggeredByPostDevcontainerStart], -// [EnvironmentAutomationServiceListResponseMetadataTriggeredByPostEnvironmentStart]. -func (r EnvironmentAutomationServiceListResponseMetadataTriggeredBy) AsUnion() EnvironmentAutomationServiceListResponseMetadataTriggeredByUnion { - return r.union -} - -// An AutomationTrigger represents a trigger for an automation action. The -// `post_environment_start` field indicates that the automation should be triggered -// after the environment has started. The `post_devcontainer_start` field indicates -// that the automation should be triggered after the dev container has started. -// -// Union satisfied by -// [EnvironmentAutomationServiceListResponseMetadataTriggeredByManual], -// [EnvironmentAutomationServiceListResponseMetadataTriggeredByPostDevcontainerStart] -// or -// [EnvironmentAutomationServiceListResponseMetadataTriggeredByPostEnvironmentStart]. -type EnvironmentAutomationServiceListResponseMetadataTriggeredByUnion interface { - implementsEnvironmentAutomationServiceListResponseMetadataTriggeredBy() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*EnvironmentAutomationServiceListResponseMetadataTriggeredByUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationServiceListResponseMetadataTriggeredByManual{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationServiceListResponseMetadataTriggeredByPostDevcontainerStart{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationServiceListResponseMetadataTriggeredByPostEnvironmentStart{}), - }, - ) -} - -type EnvironmentAutomationServiceListResponseMetadataTriggeredByManual struct { - Manual bool `json:"manual,required"` - JSON environmentAutomationServiceListResponseMetadataTriggeredByManualJSON `json:"-"` -} - -// environmentAutomationServiceListResponseMetadataTriggeredByManualJSON contains -// the JSON metadata for the struct -// [EnvironmentAutomationServiceListResponseMetadataTriggeredByManual] -type environmentAutomationServiceListResponseMetadataTriggeredByManualJSON struct { - Manual apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceListResponseMetadataTriggeredByManual) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceListResponseMetadataTriggeredByManualJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentAutomationServiceListResponseMetadataTriggeredByManual) implementsEnvironmentAutomationServiceListResponseMetadataTriggeredBy() { -} - -type EnvironmentAutomationServiceListResponseMetadataTriggeredByPostDevcontainerStart struct { - PostDevcontainerStart bool `json:"postDevcontainerStart,required"` - JSON environmentAutomationServiceListResponseMetadataTriggeredByPostDevcontainerStartJSON `json:"-"` -} - -// environmentAutomationServiceListResponseMetadataTriggeredByPostDevcontainerStartJSON -// contains the JSON metadata for the struct -// [EnvironmentAutomationServiceListResponseMetadataTriggeredByPostDevcontainerStart] -type environmentAutomationServiceListResponseMetadataTriggeredByPostDevcontainerStartJSON struct { - PostDevcontainerStart apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceListResponseMetadataTriggeredByPostDevcontainerStart) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceListResponseMetadataTriggeredByPostDevcontainerStartJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentAutomationServiceListResponseMetadataTriggeredByPostDevcontainerStart) implementsEnvironmentAutomationServiceListResponseMetadataTriggeredBy() { -} - -type EnvironmentAutomationServiceListResponseMetadataTriggeredByPostEnvironmentStart struct { - PostEnvironmentStart bool `json:"postEnvironmentStart,required"` - JSON environmentAutomationServiceListResponseMetadataTriggeredByPostEnvironmentStartJSON `json:"-"` -} - -// environmentAutomationServiceListResponseMetadataTriggeredByPostEnvironmentStartJSON -// contains the JSON metadata for the struct -// [EnvironmentAutomationServiceListResponseMetadataTriggeredByPostEnvironmentStart] -type environmentAutomationServiceListResponseMetadataTriggeredByPostEnvironmentStartJSON struct { - PostEnvironmentStart apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceListResponseMetadataTriggeredByPostEnvironmentStart) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceListResponseMetadataTriggeredByPostEnvironmentStartJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentAutomationServiceListResponseMetadataTriggeredByPostEnvironmentStart) implementsEnvironmentAutomationServiceListResponseMetadataTriggeredBy() { -} - -type EnvironmentAutomationServiceListResponseSpec struct { - // commands contains the commands to start, stop and check the readiness of the - // service - Commands EnvironmentAutomationServiceListResponseSpecCommands `json:"commands"` - // desired_phase is the phase the service should be in. Used to start or stop the - // service. - DesiredPhase EnvironmentAutomationServiceListResponseSpecDesiredPhase `json:"desiredPhase"` - // runs_on specifies the environment the service should run on. - RunsOn EnvironmentAutomationServiceListResponseSpecRunsOn `json:"runsOn"` - // session should be changed to trigger a restart of the service. If a service - // exits it will not be restarted until the session is changed. - Session string `json:"session"` - // version of the spec. The value of this field has no semantic meaning (e.g. don't - // interpret it as as a timestamp), but it can be used to impose a partial order. - // If a.spec_version < b.spec_version then a was the spec before b. - SpecVersion string `json:"specVersion"` - JSON environmentAutomationServiceListResponseSpecJSON `json:"-"` -} - -// environmentAutomationServiceListResponseSpecJSON contains the JSON metadata for -// the struct [EnvironmentAutomationServiceListResponseSpec] -type environmentAutomationServiceListResponseSpecJSON struct { - Commands apijson.Field - DesiredPhase apijson.Field - RunsOn apijson.Field - Session apijson.Field - SpecVersion apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceListResponseSpec) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceListResponseSpecJSON) RawJSON() string { - return r.raw -} - -// commands contains the commands to start, stop and check the readiness of the -// service -type EnvironmentAutomationServiceListResponseSpecCommands struct { - // ready is an optional command that is run repeatedly until it exits with a zero - // exit code. If set, the service will first go into a Starting phase, and then - // into a Running phase once the ready command exits with a zero exit code. - Ready string `json:"ready"` - // start is the command to start and run the service. If start exits, the service - // will transition to the following phase: - // - // - Stopped: if the exit code is 0 - // - Failed: if the exit code is not 0 If the stop command is not set, the start - // command will receive a SIGTERM signal when the service is requested to stop. - // If it does not exit within 2 minutes, it will receive a SIGKILL signal. - Start string `json:"start"` - // stop is an optional command that runs when the service is requested to stop. If - // set, instead of sending a SIGTERM signal to the start command, the stop command - // will be run. Once the stop command exits, the start command will receive a - // SIGKILL signal. If the stop command exits with a non-zero exit code, the service - // will transition to the Failed phase. If the stop command does not exit within 2 - // minutes, a SIGKILL signal will be sent to both the start and stop commands. - Stop string `json:"stop"` - JSON environmentAutomationServiceListResponseSpecCommandsJSON `json:"-"` -} - -// environmentAutomationServiceListResponseSpecCommandsJSON contains the JSON -// metadata for the struct [EnvironmentAutomationServiceListResponseSpecCommands] -type environmentAutomationServiceListResponseSpecCommandsJSON struct { - Ready apijson.Field - Start apijson.Field - Stop apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceListResponseSpecCommands) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceListResponseSpecCommandsJSON) RawJSON() string { - return r.raw -} - -// desired_phase is the phase the service should be in. Used to start or stop the -// service. -type EnvironmentAutomationServiceListResponseSpecDesiredPhase string - -const ( - EnvironmentAutomationServiceListResponseSpecDesiredPhaseServicePhaseUnspecified EnvironmentAutomationServiceListResponseSpecDesiredPhase = "SERVICE_PHASE_UNSPECIFIED" - EnvironmentAutomationServiceListResponseSpecDesiredPhaseServicePhaseStarting EnvironmentAutomationServiceListResponseSpecDesiredPhase = "SERVICE_PHASE_STARTING" - EnvironmentAutomationServiceListResponseSpecDesiredPhaseServicePhaseRunning EnvironmentAutomationServiceListResponseSpecDesiredPhase = "SERVICE_PHASE_RUNNING" - EnvironmentAutomationServiceListResponseSpecDesiredPhaseServicePhaseStopping EnvironmentAutomationServiceListResponseSpecDesiredPhase = "SERVICE_PHASE_STOPPING" - EnvironmentAutomationServiceListResponseSpecDesiredPhaseServicePhaseStopped EnvironmentAutomationServiceListResponseSpecDesiredPhase = "SERVICE_PHASE_STOPPED" - EnvironmentAutomationServiceListResponseSpecDesiredPhaseServicePhaseFailed EnvironmentAutomationServiceListResponseSpecDesiredPhase = "SERVICE_PHASE_FAILED" - EnvironmentAutomationServiceListResponseSpecDesiredPhaseServicePhaseDeleted EnvironmentAutomationServiceListResponseSpecDesiredPhase = "SERVICE_PHASE_DELETED" -) - -func (r EnvironmentAutomationServiceListResponseSpecDesiredPhase) IsKnown() bool { - switch r { - case EnvironmentAutomationServiceListResponseSpecDesiredPhaseServicePhaseUnspecified, EnvironmentAutomationServiceListResponseSpecDesiredPhaseServicePhaseStarting, EnvironmentAutomationServiceListResponseSpecDesiredPhaseServicePhaseRunning, EnvironmentAutomationServiceListResponseSpecDesiredPhaseServicePhaseStopping, EnvironmentAutomationServiceListResponseSpecDesiredPhaseServicePhaseStopped, EnvironmentAutomationServiceListResponseSpecDesiredPhaseServicePhaseFailed, EnvironmentAutomationServiceListResponseSpecDesiredPhaseServicePhaseDeleted: - return true - } - return false -} - -// runs_on specifies the environment the service should run on. -type EnvironmentAutomationServiceListResponseSpecRunsOn struct { - Docker EnvironmentAutomationServiceListResponseSpecRunsOnDocker `json:"docker,required"` - JSON environmentAutomationServiceListResponseSpecRunsOnJSON `json:"-"` -} - -// environmentAutomationServiceListResponseSpecRunsOnJSON contains the JSON -// metadata for the struct [EnvironmentAutomationServiceListResponseSpecRunsOn] -type environmentAutomationServiceListResponseSpecRunsOnJSON struct { - Docker apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceListResponseSpecRunsOn) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceListResponseSpecRunsOnJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationServiceListResponseSpecRunsOnDocker struct { - Environment []string `json:"environment"` - Image string `json:"image"` - JSON environmentAutomationServiceListResponseSpecRunsOnDockerJSON `json:"-"` -} - -// environmentAutomationServiceListResponseSpecRunsOnDockerJSON contains the JSON -// metadata for the struct -// [EnvironmentAutomationServiceListResponseSpecRunsOnDocker] -type environmentAutomationServiceListResponseSpecRunsOnDockerJSON struct { - Environment apijson.Field - Image apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceListResponseSpecRunsOnDocker) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceListResponseSpecRunsOnDockerJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationServiceListResponseStatus struct { - // failure_message summarises why the service failed to operate. If this is - // non-empty the service has failed to operate and will likely transition to a - // failed state. - FailureMessage string `json:"failureMessage"` - // log_url contains the URL at which the service logs can be accessed. - LogURL string `json:"logUrl"` - // phase is the current phase of the service. - Phase EnvironmentAutomationServiceListResponseStatusPhase `json:"phase"` - // session is the current session of the service. - Session string `json:"session"` - // version of the status update. Service instances themselves are unversioned, but - // their status has different versions. The value of this field has no semantic - // meaning (e.g. don't interpret it as as a timestamp), but it can be used to - // impose a partial order. If a.status_version < b.status_version then a was the - // status before b. - StatusVersion string `json:"statusVersion"` - JSON environmentAutomationServiceListResponseStatusJSON `json:"-"` -} - -// environmentAutomationServiceListResponseStatusJSON contains the JSON metadata -// for the struct [EnvironmentAutomationServiceListResponseStatus] -type environmentAutomationServiceListResponseStatusJSON struct { - FailureMessage apijson.Field - LogURL apijson.Field - Phase apijson.Field - Session apijson.Field - StatusVersion apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationServiceListResponseStatus) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationServiceListResponseStatusJSON) RawJSON() string { - return r.raw -} - -// phase is the current phase of the service. -type EnvironmentAutomationServiceListResponseStatusPhase string - -const ( - EnvironmentAutomationServiceListResponseStatusPhaseServicePhaseUnspecified EnvironmentAutomationServiceListResponseStatusPhase = "SERVICE_PHASE_UNSPECIFIED" - EnvironmentAutomationServiceListResponseStatusPhaseServicePhaseStarting EnvironmentAutomationServiceListResponseStatusPhase = "SERVICE_PHASE_STARTING" - EnvironmentAutomationServiceListResponseStatusPhaseServicePhaseRunning EnvironmentAutomationServiceListResponseStatusPhase = "SERVICE_PHASE_RUNNING" - EnvironmentAutomationServiceListResponseStatusPhaseServicePhaseStopping EnvironmentAutomationServiceListResponseStatusPhase = "SERVICE_PHASE_STOPPING" - EnvironmentAutomationServiceListResponseStatusPhaseServicePhaseStopped EnvironmentAutomationServiceListResponseStatusPhase = "SERVICE_PHASE_STOPPED" - EnvironmentAutomationServiceListResponseStatusPhaseServicePhaseFailed EnvironmentAutomationServiceListResponseStatusPhase = "SERVICE_PHASE_FAILED" - EnvironmentAutomationServiceListResponseStatusPhaseServicePhaseDeleted EnvironmentAutomationServiceListResponseStatusPhase = "SERVICE_PHASE_DELETED" -) - -func (r EnvironmentAutomationServiceListResponseStatusPhase) IsKnown() bool { - switch r { - case EnvironmentAutomationServiceListResponseStatusPhaseServicePhaseUnspecified, EnvironmentAutomationServiceListResponseStatusPhaseServicePhaseStarting, EnvironmentAutomationServiceListResponseStatusPhaseServicePhaseRunning, EnvironmentAutomationServiceListResponseStatusPhaseServicePhaseStopping, EnvironmentAutomationServiceListResponseStatusPhaseServicePhaseStopped, EnvironmentAutomationServiceListResponseStatusPhaseServicePhaseFailed, EnvironmentAutomationServiceListResponseStatusPhaseServicePhaseDeleted: - return true - } - return false -} - -type EnvironmentAutomationServiceDeleteResponse = interface{} - -type EnvironmentAutomationServiceStartResponse = interface{} - -type EnvironmentAutomationServiceStopResponse = interface{} - -type EnvironmentAutomationServiceNewParams struct { - EnvironmentID param.Field[string] `json:"environmentId" format:"uuid"` - Metadata param.Field[EnvironmentAutomationServiceNewParamsMetadata] `json:"metadata"` - Spec param.Field[EnvironmentAutomationServiceNewParamsSpec] `json:"spec"` -} - -func (r EnvironmentAutomationServiceNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type EnvironmentAutomationServiceNewParamsMetadata 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 service. - Creator param.Field[EnvironmentAutomationServiceNewParamsMetadataCreator] `json:"creator"` - // description is a user-facing description for the service. It can be used to - // provide context and documentation for the service. - Description param.Field[string] `json:"description"` - // name is a user-facing name for the service. Unlike the reference, this field is - // not unique, and not referenced by the system. This is a short descriptive name - // for the service. - Name param.Field[string] `json:"name"` - // reference is a user-facing identifier for the service which must be unique on - // the environment. It is used to express dependencies between services, and to - // identify the service in user interactions (e.g. the CLI). - Reference param.Field[string] `json:"reference"` - // triggered_by is a list of trigger that start the service. - TriggeredBy param.Field[[]EnvironmentAutomationServiceNewParamsMetadataTriggeredByUnion] `json:"triggeredBy"` -} - -func (r EnvironmentAutomationServiceNewParamsMetadata) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// creator describes the principal who created the service. -type EnvironmentAutomationServiceNewParamsMetadataCreator struct { - // id is the UUID of the subject - ID param.Field[string] `json:"id"` - // Principal is the principal of the subject - Principal param.Field[EnvironmentAutomationServiceNewParamsMetadataCreatorPrincipal] `json:"principal"` -} - -func (r EnvironmentAutomationServiceNewParamsMetadataCreator) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Principal is the principal of the subject -type EnvironmentAutomationServiceNewParamsMetadataCreatorPrincipal string - -const ( - EnvironmentAutomationServiceNewParamsMetadataCreatorPrincipalPrincipalUnspecified EnvironmentAutomationServiceNewParamsMetadataCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - EnvironmentAutomationServiceNewParamsMetadataCreatorPrincipalPrincipalAccount EnvironmentAutomationServiceNewParamsMetadataCreatorPrincipal = "PRINCIPAL_ACCOUNT" - EnvironmentAutomationServiceNewParamsMetadataCreatorPrincipalPrincipalUser EnvironmentAutomationServiceNewParamsMetadataCreatorPrincipal = "PRINCIPAL_USER" - EnvironmentAutomationServiceNewParamsMetadataCreatorPrincipalPrincipalRunner EnvironmentAutomationServiceNewParamsMetadataCreatorPrincipal = "PRINCIPAL_RUNNER" - EnvironmentAutomationServiceNewParamsMetadataCreatorPrincipalPrincipalEnvironment EnvironmentAutomationServiceNewParamsMetadataCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - EnvironmentAutomationServiceNewParamsMetadataCreatorPrincipalPrincipalServiceAccount EnvironmentAutomationServiceNewParamsMetadataCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r EnvironmentAutomationServiceNewParamsMetadataCreatorPrincipal) IsKnown() bool { - switch r { - case EnvironmentAutomationServiceNewParamsMetadataCreatorPrincipalPrincipalUnspecified, EnvironmentAutomationServiceNewParamsMetadataCreatorPrincipalPrincipalAccount, EnvironmentAutomationServiceNewParamsMetadataCreatorPrincipalPrincipalUser, EnvironmentAutomationServiceNewParamsMetadataCreatorPrincipalPrincipalRunner, EnvironmentAutomationServiceNewParamsMetadataCreatorPrincipalPrincipalEnvironment, EnvironmentAutomationServiceNewParamsMetadataCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - -// An AutomationTrigger represents a trigger for an automation action. The -// `post_environment_start` field indicates that the automation should be triggered -// after the environment has started. The `post_devcontainer_start` field indicates -// that the automation should be triggered after the dev container has started. -type EnvironmentAutomationServiceNewParamsMetadataTriggeredBy struct { - Manual param.Field[bool] `json:"manual"` - PostDevcontainerStart param.Field[bool] `json:"postDevcontainerStart"` - PostEnvironmentStart param.Field[bool] `json:"postEnvironmentStart"` -} - -func (r EnvironmentAutomationServiceNewParamsMetadataTriggeredBy) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationServiceNewParamsMetadataTriggeredBy) implementsEnvironmentAutomationServiceNewParamsMetadataTriggeredByUnion() { -} - -// An AutomationTrigger represents a trigger for an automation action. The -// `post_environment_start` field indicates that the automation should be triggered -// after the environment has started. The `post_devcontainer_start` field indicates -// that the automation should be triggered after the dev container has started. -// -// Satisfied by [EnvironmentAutomationServiceNewParamsMetadataTriggeredByManual], -// [EnvironmentAutomationServiceNewParamsMetadataTriggeredByPostDevcontainerStart], -// [EnvironmentAutomationServiceNewParamsMetadataTriggeredByPostEnvironmentStart], -// [EnvironmentAutomationServiceNewParamsMetadataTriggeredBy]. -type EnvironmentAutomationServiceNewParamsMetadataTriggeredByUnion interface { - implementsEnvironmentAutomationServiceNewParamsMetadataTriggeredByUnion() -} - -type EnvironmentAutomationServiceNewParamsMetadataTriggeredByManual struct { - Manual param.Field[bool] `json:"manual,required"` -} - -func (r EnvironmentAutomationServiceNewParamsMetadataTriggeredByManual) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationServiceNewParamsMetadataTriggeredByManual) implementsEnvironmentAutomationServiceNewParamsMetadataTriggeredByUnion() { -} - -type EnvironmentAutomationServiceNewParamsMetadataTriggeredByPostDevcontainerStart struct { - PostDevcontainerStart param.Field[bool] `json:"postDevcontainerStart,required"` -} - -func (r EnvironmentAutomationServiceNewParamsMetadataTriggeredByPostDevcontainerStart) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationServiceNewParamsMetadataTriggeredByPostDevcontainerStart) implementsEnvironmentAutomationServiceNewParamsMetadataTriggeredByUnion() { -} - -type EnvironmentAutomationServiceNewParamsMetadataTriggeredByPostEnvironmentStart struct { - PostEnvironmentStart param.Field[bool] `json:"postEnvironmentStart,required"` -} - -func (r EnvironmentAutomationServiceNewParamsMetadataTriggeredByPostEnvironmentStart) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r *EnvironmentAutomationServiceNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r EnvironmentAutomationServiceNewParamsMetadataTriggeredByPostEnvironmentStart) implementsEnvironmentAutomationServiceNewParamsMetadataTriggeredByUnion() { +func (r environmentAutomationServiceNewResponseJSON) RawJSON() string { + return r.raw } -type EnvironmentAutomationServiceNewParamsSpec struct { - // commands contains the commands to start, stop and check the readiness of the - // service - Commands param.Field[EnvironmentAutomationServiceNewParamsSpecCommands] `json:"commands"` - // desired_phase is the phase the service should be in. Used to start or stop the - // service. - DesiredPhase param.Field[EnvironmentAutomationServiceNewParamsSpecDesiredPhase] `json:"desiredPhase"` - // runs_on specifies the environment the service should run on. - RunsOn param.Field[EnvironmentAutomationServiceNewParamsSpecRunsOn] `json:"runsOn"` - // session should be changed to trigger a restart of the service. If a service - // exits it will not be restarted until the session is changed. - Session param.Field[string] `json:"session"` - // version of the spec. The value of this field has no semantic meaning (e.g. don't - // interpret it as as a timestamp), but it can be used to impose a partial order. - // If a.spec_version < b.spec_version then a was the spec before b. - SpecVersion param.Field[string] `json:"specVersion"` +type EnvironmentAutomationServiceGetResponse struct { + Service Service `json:"service"` + JSON environmentAutomationServiceGetResponseJSON `json:"-"` } -func (r EnvironmentAutomationServiceNewParamsSpec) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// environmentAutomationServiceGetResponseJSON contains the JSON metadata for the +// struct [EnvironmentAutomationServiceGetResponse] +type environmentAutomationServiceGetResponseJSON struct { + Service apijson.Field + raw string + ExtraFields map[string]apijson.Field } -// commands contains the commands to start, stop and check the readiness of the -// service -type EnvironmentAutomationServiceNewParamsSpecCommands struct { - // ready is an optional command that is run repeatedly until it exits with a zero - // exit code. If set, the service will first go into a Starting phase, and then - // into a Running phase once the ready command exits with a zero exit code. - Ready param.Field[string] `json:"ready"` - // start is the command to start and run the service. If start exits, the service - // will transition to the following phase: - // - // - Stopped: if the exit code is 0 - // - Failed: if the exit code is not 0 If the stop command is not set, the start - // command will receive a SIGTERM signal when the service is requested to stop. - // If it does not exit within 2 minutes, it will receive a SIGKILL signal. - Start param.Field[string] `json:"start"` - // stop is an optional command that runs when the service is requested to stop. If - // set, instead of sending a SIGTERM signal to the start command, the stop command - // will be run. Once the stop command exits, the start command will receive a - // SIGKILL signal. If the stop command exits with a non-zero exit code, the service - // will transition to the Failed phase. If the stop command does not exit within 2 - // minutes, a SIGKILL signal will be sent to both the start and stop commands. - Stop param.Field[string] `json:"stop"` +func (r *EnvironmentAutomationServiceGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r EnvironmentAutomationServiceNewParamsSpecCommands) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r environmentAutomationServiceGetResponseJSON) RawJSON() string { + return r.raw } -// desired_phase is the phase the service should be in. Used to start or stop the -// service. -type EnvironmentAutomationServiceNewParamsSpecDesiredPhase string - -const ( - EnvironmentAutomationServiceNewParamsSpecDesiredPhaseServicePhaseUnspecified EnvironmentAutomationServiceNewParamsSpecDesiredPhase = "SERVICE_PHASE_UNSPECIFIED" - EnvironmentAutomationServiceNewParamsSpecDesiredPhaseServicePhaseStarting EnvironmentAutomationServiceNewParamsSpecDesiredPhase = "SERVICE_PHASE_STARTING" - EnvironmentAutomationServiceNewParamsSpecDesiredPhaseServicePhaseRunning EnvironmentAutomationServiceNewParamsSpecDesiredPhase = "SERVICE_PHASE_RUNNING" - EnvironmentAutomationServiceNewParamsSpecDesiredPhaseServicePhaseStopping EnvironmentAutomationServiceNewParamsSpecDesiredPhase = "SERVICE_PHASE_STOPPING" - EnvironmentAutomationServiceNewParamsSpecDesiredPhaseServicePhaseStopped EnvironmentAutomationServiceNewParamsSpecDesiredPhase = "SERVICE_PHASE_STOPPED" - EnvironmentAutomationServiceNewParamsSpecDesiredPhaseServicePhaseFailed EnvironmentAutomationServiceNewParamsSpecDesiredPhase = "SERVICE_PHASE_FAILED" - EnvironmentAutomationServiceNewParamsSpecDesiredPhaseServicePhaseDeleted EnvironmentAutomationServiceNewParamsSpecDesiredPhase = "SERVICE_PHASE_DELETED" -) +type EnvironmentAutomationServiceUpdateResponse = interface{} -func (r EnvironmentAutomationServiceNewParamsSpecDesiredPhase) IsKnown() bool { - switch r { - case EnvironmentAutomationServiceNewParamsSpecDesiredPhaseServicePhaseUnspecified, EnvironmentAutomationServiceNewParamsSpecDesiredPhaseServicePhaseStarting, EnvironmentAutomationServiceNewParamsSpecDesiredPhaseServicePhaseRunning, EnvironmentAutomationServiceNewParamsSpecDesiredPhaseServicePhaseStopping, EnvironmentAutomationServiceNewParamsSpecDesiredPhaseServicePhaseStopped, EnvironmentAutomationServiceNewParamsSpecDesiredPhaseServicePhaseFailed, EnvironmentAutomationServiceNewParamsSpecDesiredPhaseServicePhaseDeleted: - return true - } - return false -} +type EnvironmentAutomationServiceDeleteResponse = interface{} -// runs_on specifies the environment the service should run on. -type EnvironmentAutomationServiceNewParamsSpecRunsOn struct { - Docker param.Field[EnvironmentAutomationServiceNewParamsSpecRunsOnDocker] `json:"docker,required"` -} +type EnvironmentAutomationServiceStartResponse = interface{} -func (r EnvironmentAutomationServiceNewParamsSpecRunsOn) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} +type EnvironmentAutomationServiceStopResponse = interface{} -type EnvironmentAutomationServiceNewParamsSpecRunsOnDocker struct { - Environment param.Field[[]string] `json:"environment"` - Image param.Field[string] `json:"image"` +type EnvironmentAutomationServiceNewParams struct { + EnvironmentID param.Field[string] `json:"environmentId" format:"uuid"` + Metadata param.Field[ServiceMetadataParam] `json:"metadata"` + Spec param.Field[ServiceSpecParam] `json:"spec"` } -func (r EnvironmentAutomationServiceNewParamsSpecRunsOnDocker) MarshalJSON() (data []byte, err error) { +func (r EnvironmentAutomationServiceNewParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } @@ -2198,16 +638,16 @@ func (r EnvironmentAutomationServiceGetParams) MarshalJSON() (data []byte, err e } type EnvironmentAutomationServiceUpdateParams struct { - ID param.Field[string] `json:"id" format:"uuid"` - Metadata param.Field[EnvironmentAutomationServiceUpdateParamsMetadataUnion] `json:"metadata"` + ID param.Field[string] `json:"id" format:"uuid"` + Metadata param.Field[EnvironmentAutomationServiceUpdateParamsMetadata] `json:"metadata"` // Changing the spec of a service is a complex operation. The spec of a service can // only be updated if the service is in a stopped state. If the service is running, // it must be stopped first. - Spec param.Field[EnvironmentAutomationServiceUpdateParamsSpecUnion] `json:"spec"` + Spec param.Field[EnvironmentAutomationServiceUpdateParamsSpec] `json:"spec"` // Service status updates are only expected from the executing environment. As a // client of this API you are not expected to provide this field. Updating this // field requires the `environmentservice:update_status` permission. - Status param.Field[EnvironmentAutomationServiceUpdateParamsStatusUnion] `json:"status"` + Status param.Field[EnvironmentAutomationServiceUpdateParamsStatus] `json:"status"` } func (r EnvironmentAutomationServiceUpdateParams) MarshalJSON() (data []byte, err error) { @@ -2215,248 +655,42 @@ func (r EnvironmentAutomationServiceUpdateParams) MarshalJSON() (data []byte, er } type EnvironmentAutomationServiceUpdateParamsMetadata struct { - Description param.Field[string] `json:"description"` - Name param.Field[string] `json:"name"` - TriggeredBy param.Field[interface{}] `json:"triggeredBy"` + Description param.Field[string] `json:"description"` + Name param.Field[string] `json:"name"` + TriggeredBy param.Field[EnvironmentAutomationServiceUpdateParamsMetadataTriggeredBy] `json:"triggeredBy"` } func (r EnvironmentAutomationServiceUpdateParamsMetadata) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r EnvironmentAutomationServiceUpdateParamsMetadata) implementsEnvironmentAutomationServiceUpdateParamsMetadataUnion() { -} - -// Satisfied by [EnvironmentAutomationServiceUpdateParamsMetadataDescription], -// [EnvironmentAutomationServiceUpdateParamsMetadataName], -// [EnvironmentAutomationServiceUpdateParamsMetadataTriggeredBy], -// [EnvironmentAutomationServiceUpdateParamsMetadata]. -type EnvironmentAutomationServiceUpdateParamsMetadataUnion interface { - implementsEnvironmentAutomationServiceUpdateParamsMetadataUnion() -} - -type EnvironmentAutomationServiceUpdateParamsMetadataDescription struct { - Description param.Field[string] `json:"description,required"` -} - -func (r EnvironmentAutomationServiceUpdateParamsMetadataDescription) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationServiceUpdateParamsMetadataDescription) implementsEnvironmentAutomationServiceUpdateParamsMetadataUnion() { -} - -type EnvironmentAutomationServiceUpdateParamsMetadataName struct { - Name param.Field[string] `json:"name,required"` -} - -func (r EnvironmentAutomationServiceUpdateParamsMetadataName) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationServiceUpdateParamsMetadataName) implementsEnvironmentAutomationServiceUpdateParamsMetadataUnion() { -} - type EnvironmentAutomationServiceUpdateParamsMetadataTriggeredBy struct { - TriggeredBy param.Field[EnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredBy] `json:"triggeredBy,required"` + Trigger param.Field[[]shared.AutomationTriggerParam] `json:"trigger"` } func (r EnvironmentAutomationServiceUpdateParamsMetadataTriggeredBy) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r EnvironmentAutomationServiceUpdateParamsMetadataTriggeredBy) implementsEnvironmentAutomationServiceUpdateParamsMetadataUnion() { -} - -type EnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredBy struct { - Trigger param.Field[[]EnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredByTriggerUnion] `json:"trigger"` -} - -func (r EnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredBy) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// An AutomationTrigger represents a trigger for an automation action. The -// `post_environment_start` field indicates that the automation should be triggered -// after the environment has started. The `post_devcontainer_start` field indicates -// that the automation should be triggered after the dev container has started. -type EnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredByTrigger struct { - Manual param.Field[bool] `json:"manual"` - PostDevcontainerStart param.Field[bool] `json:"postDevcontainerStart"` - PostEnvironmentStart param.Field[bool] `json:"postEnvironmentStart"` -} - -func (r EnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredByTrigger) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredByTrigger) implementsEnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredByTriggerUnion() { -} - -// An AutomationTrigger represents a trigger for an automation action. The -// `post_environment_start` field indicates that the automation should be triggered -// after the environment has started. The `post_devcontainer_start` field indicates -// that the automation should be triggered after the dev container has started. -// -// Satisfied by -// [EnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredByTriggerManual], -// [EnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredByTriggerPostDevcontainerStart], -// [EnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredByTriggerPostEnvironmentStart], -// [EnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredByTrigger]. -type EnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredByTriggerUnion interface { - implementsEnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredByTriggerUnion() -} - -type EnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredByTriggerManual struct { - Manual param.Field[bool] `json:"manual,required"` -} - -func (r EnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredByTriggerManual) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredByTriggerManual) implementsEnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredByTriggerUnion() { -} - -type EnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredByTriggerPostDevcontainerStart struct { - PostDevcontainerStart param.Field[bool] `json:"postDevcontainerStart,required"` -} - -func (r EnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredByTriggerPostDevcontainerStart) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredByTriggerPostDevcontainerStart) implementsEnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredByTriggerUnion() { -} - -type EnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredByTriggerPostEnvironmentStart struct { - PostEnvironmentStart param.Field[bool] `json:"postEnvironmentStart,required"` -} - -func (r EnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredByTriggerPostEnvironmentStart) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredByTriggerPostEnvironmentStart) implementsEnvironmentAutomationServiceUpdateParamsMetadataTriggeredByTriggeredByTriggerUnion() { -} - // Changing the spec of a service is a complex operation. The spec of a service can // only be updated if the service is in a stopped state. If the service is running, // it must be stopped first. type EnvironmentAutomationServiceUpdateParamsSpec struct { - Commands param.Field[interface{}] `json:"commands"` - RunsOn param.Field[interface{}] `json:"runsOn"` + Commands param.Field[EnvironmentAutomationServiceUpdateParamsSpecCommands] `json:"commands"` + RunsOn param.Field[shared.RunsOnParam] `json:"runsOn"` } func (r EnvironmentAutomationServiceUpdateParamsSpec) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r EnvironmentAutomationServiceUpdateParamsSpec) implementsEnvironmentAutomationServiceUpdateParamsSpecUnion() { -} - -// Changing the spec of a service is a complex operation. The spec of a service can -// only be updated if the service is in a stopped state. If the service is running, -// it must be stopped first. -// -// Satisfied by [EnvironmentAutomationServiceUpdateParamsSpecCommands], -// [EnvironmentAutomationServiceUpdateParamsSpecRunsOn], -// [EnvironmentAutomationServiceUpdateParamsSpec]. -type EnvironmentAutomationServiceUpdateParamsSpecUnion interface { - implementsEnvironmentAutomationServiceUpdateParamsSpecUnion() -} - type EnvironmentAutomationServiceUpdateParamsSpecCommands struct { - Commands param.Field[EnvironmentAutomationServiceUpdateParamsSpecCommandsCommandsUnion] `json:"commands,required"` -} - -func (r EnvironmentAutomationServiceUpdateParamsSpecCommands) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationServiceUpdateParamsSpecCommands) implementsEnvironmentAutomationServiceUpdateParamsSpecUnion() { -} - -type EnvironmentAutomationServiceUpdateParamsSpecCommandsCommands struct { Ready param.Field[string] `json:"ready"` Start param.Field[string] `json:"start"` Stop param.Field[string] `json:"stop"` } -func (r EnvironmentAutomationServiceUpdateParamsSpecCommandsCommands) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationServiceUpdateParamsSpecCommandsCommands) implementsEnvironmentAutomationServiceUpdateParamsSpecCommandsCommandsUnion() { -} - -// Satisfied by -// [EnvironmentAutomationServiceUpdateParamsSpecCommandsCommandsReady], -// [EnvironmentAutomationServiceUpdateParamsSpecCommandsCommandsStart], -// [EnvironmentAutomationServiceUpdateParamsSpecCommandsCommandsStop], -// [EnvironmentAutomationServiceUpdateParamsSpecCommandsCommands]. -type EnvironmentAutomationServiceUpdateParamsSpecCommandsCommandsUnion interface { - implementsEnvironmentAutomationServiceUpdateParamsSpecCommandsCommandsUnion() -} - -type EnvironmentAutomationServiceUpdateParamsSpecCommandsCommandsReady struct { - Ready param.Field[string] `json:"ready,required"` -} - -func (r EnvironmentAutomationServiceUpdateParamsSpecCommandsCommandsReady) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationServiceUpdateParamsSpecCommandsCommandsReady) implementsEnvironmentAutomationServiceUpdateParamsSpecCommandsCommandsUnion() { -} - -type EnvironmentAutomationServiceUpdateParamsSpecCommandsCommandsStart struct { - Start param.Field[string] `json:"start,required"` -} - -func (r EnvironmentAutomationServiceUpdateParamsSpecCommandsCommandsStart) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationServiceUpdateParamsSpecCommandsCommandsStart) implementsEnvironmentAutomationServiceUpdateParamsSpecCommandsCommandsUnion() { -} - -type EnvironmentAutomationServiceUpdateParamsSpecCommandsCommandsStop struct { - Stop param.Field[string] `json:"stop,required"` -} - -func (r EnvironmentAutomationServiceUpdateParamsSpecCommandsCommandsStop) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationServiceUpdateParamsSpecCommandsCommandsStop) implementsEnvironmentAutomationServiceUpdateParamsSpecCommandsCommandsUnion() { -} - -type EnvironmentAutomationServiceUpdateParamsSpecRunsOn struct { - RunsOn param.Field[EnvironmentAutomationServiceUpdateParamsSpecRunsOnRunsOn] `json:"runsOn,required"` -} - -func (r EnvironmentAutomationServiceUpdateParamsSpecRunsOn) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationServiceUpdateParamsSpecRunsOn) implementsEnvironmentAutomationServiceUpdateParamsSpecUnion() { -} - -type EnvironmentAutomationServiceUpdateParamsSpecRunsOnRunsOn struct { - Docker param.Field[EnvironmentAutomationServiceUpdateParamsSpecRunsOnRunsOnDocker] `json:"docker,required"` -} - -func (r EnvironmentAutomationServiceUpdateParamsSpecRunsOnRunsOn) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type EnvironmentAutomationServiceUpdateParamsSpecRunsOnRunsOnDocker struct { - Environment param.Field[[]string] `json:"environment"` - Image param.Field[string] `json:"image"` -} - -func (r EnvironmentAutomationServiceUpdateParamsSpecRunsOnRunsOnDocker) MarshalJSON() (data []byte, err error) { +func (r EnvironmentAutomationServiceUpdateParamsSpecCommands) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } @@ -2464,96 +698,16 @@ func (r EnvironmentAutomationServiceUpdateParamsSpecRunsOnRunsOnDocker) MarshalJ // client of this API you are not expected to provide this field. Updating this // field requires the `environmentservice:update_status` permission. type EnvironmentAutomationServiceUpdateParamsStatus struct { - FailureMessage param.Field[string] `json:"failureMessage"` - LogURL param.Field[string] `json:"logUrl"` - Phase param.Field[EnvironmentAutomationServiceUpdateParamsStatusPhase] `json:"phase"` - Session param.Field[string] `json:"session"` + FailureMessage param.Field[string] `json:"failureMessage"` + LogURL param.Field[string] `json:"logUrl"` + Phase param.Field[ServicePhase] `json:"phase"` + Session param.Field[string] `json:"session"` } func (r EnvironmentAutomationServiceUpdateParamsStatus) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r EnvironmentAutomationServiceUpdateParamsStatus) implementsEnvironmentAutomationServiceUpdateParamsStatusUnion() { -} - -// Service status updates are only expected from the executing environment. As a -// client of this API you are not expected to provide this field. Updating this -// field requires the `environmentservice:update_status` permission. -// -// Satisfied by [EnvironmentAutomationServiceUpdateParamsStatusFailureMessage], -// [EnvironmentAutomationServiceUpdateParamsStatusLogURL], -// [EnvironmentAutomationServiceUpdateParamsStatusPhase], -// [EnvironmentAutomationServiceUpdateParamsStatusSession], -// [EnvironmentAutomationServiceUpdateParamsStatus]. -type EnvironmentAutomationServiceUpdateParamsStatusUnion interface { - implementsEnvironmentAutomationServiceUpdateParamsStatusUnion() -} - -type EnvironmentAutomationServiceUpdateParamsStatusFailureMessage struct { - FailureMessage param.Field[string] `json:"failureMessage,required"` -} - -func (r EnvironmentAutomationServiceUpdateParamsStatusFailureMessage) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationServiceUpdateParamsStatusFailureMessage) implementsEnvironmentAutomationServiceUpdateParamsStatusUnion() { -} - -type EnvironmentAutomationServiceUpdateParamsStatusLogURL struct { - LogURL param.Field[string] `json:"logUrl,required"` -} - -func (r EnvironmentAutomationServiceUpdateParamsStatusLogURL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationServiceUpdateParamsStatusLogURL) implementsEnvironmentAutomationServiceUpdateParamsStatusUnion() { -} - -type EnvironmentAutomationServiceUpdateParamsStatusPhase struct { - Phase param.Field[EnvironmentAutomationServiceUpdateParamsStatusPhasePhase] `json:"phase,required"` -} - -func (r EnvironmentAutomationServiceUpdateParamsStatusPhase) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationServiceUpdateParamsStatusPhase) implementsEnvironmentAutomationServiceUpdateParamsStatusUnion() { -} - -type EnvironmentAutomationServiceUpdateParamsStatusPhasePhase string - -const ( - EnvironmentAutomationServiceUpdateParamsStatusPhasePhaseServicePhaseUnspecified EnvironmentAutomationServiceUpdateParamsStatusPhasePhase = "SERVICE_PHASE_UNSPECIFIED" - EnvironmentAutomationServiceUpdateParamsStatusPhasePhaseServicePhaseStarting EnvironmentAutomationServiceUpdateParamsStatusPhasePhase = "SERVICE_PHASE_STARTING" - EnvironmentAutomationServiceUpdateParamsStatusPhasePhaseServicePhaseRunning EnvironmentAutomationServiceUpdateParamsStatusPhasePhase = "SERVICE_PHASE_RUNNING" - EnvironmentAutomationServiceUpdateParamsStatusPhasePhaseServicePhaseStopping EnvironmentAutomationServiceUpdateParamsStatusPhasePhase = "SERVICE_PHASE_STOPPING" - EnvironmentAutomationServiceUpdateParamsStatusPhasePhaseServicePhaseStopped EnvironmentAutomationServiceUpdateParamsStatusPhasePhase = "SERVICE_PHASE_STOPPED" - EnvironmentAutomationServiceUpdateParamsStatusPhasePhaseServicePhaseFailed EnvironmentAutomationServiceUpdateParamsStatusPhasePhase = "SERVICE_PHASE_FAILED" - EnvironmentAutomationServiceUpdateParamsStatusPhasePhaseServicePhaseDeleted EnvironmentAutomationServiceUpdateParamsStatusPhasePhase = "SERVICE_PHASE_DELETED" -) - -func (r EnvironmentAutomationServiceUpdateParamsStatusPhasePhase) IsKnown() bool { - switch r { - case EnvironmentAutomationServiceUpdateParamsStatusPhasePhaseServicePhaseUnspecified, EnvironmentAutomationServiceUpdateParamsStatusPhasePhaseServicePhaseStarting, EnvironmentAutomationServiceUpdateParamsStatusPhasePhaseServicePhaseRunning, EnvironmentAutomationServiceUpdateParamsStatusPhasePhaseServicePhaseStopping, EnvironmentAutomationServiceUpdateParamsStatusPhasePhaseServicePhaseStopped, EnvironmentAutomationServiceUpdateParamsStatusPhasePhaseServicePhaseFailed, EnvironmentAutomationServiceUpdateParamsStatusPhasePhaseServicePhaseDeleted: - return true - } - return false -} - -type EnvironmentAutomationServiceUpdateParamsStatusSession struct { - Session param.Field[string] `json:"session,required"` -} - -func (r EnvironmentAutomationServiceUpdateParamsStatusSession) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationServiceUpdateParamsStatusSession) implementsEnvironmentAutomationServiceUpdateParamsStatusUnion() { -} - type EnvironmentAutomationServiceListParams struct { Token param.Field[string] `query:"token"` PageSize param.Field[int64] `query:"pageSize"` diff --git a/environmentautomationservice_test.go b/environmentautomationservice_test.go index 19e2d50..9d8a3d6 100644 --- a/environmentautomationservice_test.go +++ b/environmentautomationservice_test.go @@ -12,6 +12,7 @@ import ( "github.com/gitpod-io/flex-sdk-go" "github.com/gitpod-io/flex-sdk-go/internal/testutil" "github.com/gitpod-io/flex-sdk-go/option" + "github.com/gitpod-io/flex-sdk-go/shared" ) func TestEnvironmentAutomationServiceNewWithOptionalParams(t *testing.T) { @@ -29,28 +30,30 @@ func TestEnvironmentAutomationServiceNewWithOptionalParams(t *testing.T) { ) _, err := client.Environments.Automations.Services.New(context.TODO(), gitpod.EnvironmentAutomationServiceNewParams{ EnvironmentID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - Metadata: gitpod.F(gitpod.EnvironmentAutomationServiceNewParamsMetadata{ + Metadata: gitpod.F(gitpod.ServiceMetadataParam{ CreatedAt: gitpod.F(time.Now()), - Creator: gitpod.F(gitpod.EnvironmentAutomationServiceNewParamsMetadataCreator{ + Creator: gitpod.F(shared.SubjectParam{ ID: gitpod.F("id"), - Principal: gitpod.F(gitpod.EnvironmentAutomationServiceNewParamsMetadataCreatorPrincipalPrincipalUnspecified), + Principal: gitpod.F(shared.PrincipalPrincipalUnspecified), }), Description: gitpod.F("description"), Name: gitpod.F("x"), Reference: gitpod.F("reference"), - TriggeredBy: gitpod.F([]gitpod.EnvironmentAutomationServiceNewParamsMetadataTriggeredByUnion{gitpod.EnvironmentAutomationServiceNewParamsMetadataTriggeredByManual{ - Manual: gitpod.F(true), + TriggeredBy: gitpod.F([]shared.AutomationTriggerParam{{ + Manual: gitpod.F(true), + PostDevcontainerStart: gitpod.F(true), + PostEnvironmentStart: gitpod.F(true), }}), }), - Spec: gitpod.F(gitpod.EnvironmentAutomationServiceNewParamsSpec{ - Commands: gitpod.F(gitpod.EnvironmentAutomationServiceNewParamsSpecCommands{ + Spec: gitpod.F(gitpod.ServiceSpecParam{ + Commands: gitpod.F(gitpod.ServiceSpecCommandsParam{ Ready: gitpod.F("ready"), Start: gitpod.F("x"), Stop: gitpod.F("stop"), }), - DesiredPhase: gitpod.F(gitpod.EnvironmentAutomationServiceNewParamsSpecDesiredPhaseServicePhaseUnspecified), - RunsOn: gitpod.F(gitpod.EnvironmentAutomationServiceNewParamsSpecRunsOn{ - Docker: gitpod.F(gitpod.EnvironmentAutomationServiceNewParamsSpecRunsOnDocker{ + DesiredPhase: gitpod.F(gitpod.ServicePhaseServicePhaseUnspecified), + RunsOn: gitpod.F(shared.RunsOnParam{ + Docker: gitpod.F(shared.RunsOnDockerParam{ Environment: gitpod.F([]string{"string"}), Image: gitpod.F("x"), }), @@ -108,16 +111,35 @@ func TestEnvironmentAutomationServiceUpdateWithOptionalParams(t *testing.T) { ) _, err := client.Environments.Automations.Services.Update(context.TODO(), gitpod.EnvironmentAutomationServiceUpdateParams{ ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - Metadata: gitpod.F[gitpod.EnvironmentAutomationServiceUpdateParamsMetadataUnion](gitpod.EnvironmentAutomationServiceUpdateParamsMetadataDescription{ + Metadata: gitpod.F(gitpod.EnvironmentAutomationServiceUpdateParamsMetadata{ Description: gitpod.F("description"), + Name: gitpod.F("x"), + TriggeredBy: gitpod.F(gitpod.EnvironmentAutomationServiceUpdateParamsMetadataTriggeredBy{ + Trigger: gitpod.F([]shared.AutomationTriggerParam{{ + Manual: gitpod.F(true), + PostDevcontainerStart: gitpod.F(true), + PostEnvironmentStart: gitpod.F(true), + }}), + }), }), - Spec: gitpod.F[gitpod.EnvironmentAutomationServiceUpdateParamsSpecUnion](gitpod.EnvironmentAutomationServiceUpdateParamsSpecCommands{ - Commands: gitpod.F[gitpod.EnvironmentAutomationServiceUpdateParamsSpecCommandsCommandsUnion](gitpod.EnvironmentAutomationServiceUpdateParamsSpecCommandsCommandsReady{ + Spec: gitpod.F(gitpod.EnvironmentAutomationServiceUpdateParamsSpec{ + Commands: gitpod.F(gitpod.EnvironmentAutomationServiceUpdateParamsSpecCommands{ Ready: gitpod.F("ready"), + Start: gitpod.F("start"), + Stop: gitpod.F("stop"), + }), + RunsOn: gitpod.F(shared.RunsOnParam{ + Docker: gitpod.F(shared.RunsOnDockerParam{ + Environment: gitpod.F([]string{"string"}), + Image: gitpod.F("x"), + }), }), }), - Status: gitpod.F[gitpod.EnvironmentAutomationServiceUpdateParamsStatusUnion](gitpod.EnvironmentAutomationServiceUpdateParamsStatusFailureMessage{ + Status: gitpod.F(gitpod.EnvironmentAutomationServiceUpdateParamsStatus{ FailureMessage: gitpod.F("failureMessage"), + LogURL: gitpod.F("logUrl"), + Phase: gitpod.F(gitpod.ServicePhaseServicePhaseUnspecified), + Session: gitpod.F("session"), }), }) if err != nil { diff --git a/environmentautomationtask.go b/environmentautomationtask.go index 7508507..383907a 100644 --- a/environmentautomationtask.go +++ b/environmentautomationtask.go @@ -6,7 +6,6 @@ import ( "context" "net/http" "net/url" - "reflect" "time" "github.com/gitpod-io/flex-sdk-go/internal/apijson" @@ -15,7 +14,7 @@ import ( "github.com/gitpod-io/flex-sdk-go/internal/requestconfig" "github.com/gitpod-io/flex-sdk-go/option" "github.com/gitpod-io/flex-sdk-go/packages/pagination" - "github.com/tidwall/gjson" + "github.com/gitpod-io/flex-sdk-go/shared" ) // EnvironmentAutomationTaskService contains methods and other services that help @@ -64,7 +63,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[EnvironmentAutomationTaskListResponse], err error) { +func (r *EnvironmentAutomationTaskService) List(ctx context.Context, params EnvironmentAutomationTaskListParams, opts ...option.RequestOption) (res *pagination.TasksPage[Task], err error) { var raw *http.Response opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -82,7 +81,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[EnvironmentAutomationTaskListResponse] { +func (r *EnvironmentAutomationTaskService) ListAutoPaging(ctx context.Context, params EnvironmentAutomationTaskListParams, opts ...option.RequestOption) *pagination.TasksPageAutoPager[Task] { return pagination.NewTasksPageAutoPager(r.List(ctx, params, opts...)) } @@ -103,40 +102,18 @@ func (r *EnvironmentAutomationTaskService) Start(ctx context.Context, body Envir return } -type EnvironmentAutomationTaskNewResponse struct { - Task EnvironmentAutomationTaskNewResponseTask `json:"task"` - JSON environmentAutomationTaskNewResponseJSON `json:"-"` -} - -// environmentAutomationTaskNewResponseJSON contains the JSON metadata for the -// struct [EnvironmentAutomationTaskNewResponse] -type environmentAutomationTaskNewResponseJSON struct { - Task apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskNewResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskNewResponseJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationTaskNewResponseTask struct { +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 EnvironmentAutomationTaskNewResponseTaskMetadata `json:"metadata"` - Spec EnvironmentAutomationTaskNewResponseTaskSpec `json:"spec"` - JSON environmentAutomationTaskNewResponseTaskJSON `json:"-"` + DependsOn []string `json:"dependsOn" format:"uuid"` + EnvironmentID string `json:"environmentId" format:"uuid"` + Metadata TaskMetadata `json:"metadata"` + Spec TaskSpec `json:"spec"` + JSON taskJSON `json:"-"` } -// environmentAutomationTaskNewResponseTaskJSON contains the JSON metadata for the -// struct [EnvironmentAutomationTaskNewResponseTask] -type environmentAutomationTaskNewResponseTaskJSON struct { +// taskJSON contains the JSON metadata for the struct [Task] +type taskJSON struct { ID apijson.Field DependsOn apijson.Field EnvironmentID apijson.Field @@ -146,15 +123,15 @@ type environmentAutomationTaskNewResponseTaskJSON struct { ExtraFields map[string]apijson.Field } -func (r *EnvironmentAutomationTaskNewResponseTask) UnmarshalJSON(data []byte) (err error) { +func (r *Task) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentAutomationTaskNewResponseTaskJSON) RawJSON() string { +func (r taskJSON) RawJSON() string { return r.raw } -type EnvironmentAutomationTaskNewResponseTaskMetadata struct { +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, @@ -245,7 +222,7 @@ type EnvironmentAutomationTaskNewResponseTaskMetadata struct { // 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 EnvironmentAutomationTaskNewResponseTaskMetadataCreator `json:"creator"` + 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"` @@ -258,13 +235,12 @@ type EnvironmentAutomationTaskNewResponseTaskMetadata struct { // 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 []EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredBy `json:"triggeredBy"` - JSON environmentAutomationTaskNewResponseTaskMetadataJSON `json:"-"` + TriggeredBy []shared.AutomationTrigger `json:"triggeredBy"` + JSON taskMetadataJSON `json:"-"` } -// environmentAutomationTaskNewResponseTaskMetadataJSON contains the JSON metadata -// for the struct [EnvironmentAutomationTaskNewResponseTaskMetadata] -type environmentAutomationTaskNewResponseTaskMetadataJSON struct { +// taskMetadataJSON contains the JSON metadata for the struct [TaskMetadata] +type taskMetadataJSON struct { CreatedAt apijson.Field Creator apijson.Field Description apijson.Field @@ -275,340 +251,15 @@ type environmentAutomationTaskNewResponseTaskMetadataJSON struct { ExtraFields map[string]apijson.Field } -func (r *EnvironmentAutomationTaskNewResponseTaskMetadata) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskNewResponseTaskMetadataJSON) RawJSON() string { - return r.raw -} - -// creator describes the principal who created the task. -type EnvironmentAutomationTaskNewResponseTaskMetadataCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal EnvironmentAutomationTaskNewResponseTaskMetadataCreatorPrincipal `json:"principal"` - JSON environmentAutomationTaskNewResponseTaskMetadataCreatorJSON `json:"-"` -} - -// environmentAutomationTaskNewResponseTaskMetadataCreatorJSON contains the JSON -// metadata for the struct -// [EnvironmentAutomationTaskNewResponseTaskMetadataCreator] -type environmentAutomationTaskNewResponseTaskMetadataCreatorJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskNewResponseTaskMetadataCreator) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskNewResponseTaskMetadataCreatorJSON) RawJSON() string { - return r.raw -} - -// Principal is the principal of the subject -type EnvironmentAutomationTaskNewResponseTaskMetadataCreatorPrincipal string - -const ( - EnvironmentAutomationTaskNewResponseTaskMetadataCreatorPrincipalPrincipalUnspecified EnvironmentAutomationTaskNewResponseTaskMetadataCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - EnvironmentAutomationTaskNewResponseTaskMetadataCreatorPrincipalPrincipalAccount EnvironmentAutomationTaskNewResponseTaskMetadataCreatorPrincipal = "PRINCIPAL_ACCOUNT" - EnvironmentAutomationTaskNewResponseTaskMetadataCreatorPrincipalPrincipalUser EnvironmentAutomationTaskNewResponseTaskMetadataCreatorPrincipal = "PRINCIPAL_USER" - EnvironmentAutomationTaskNewResponseTaskMetadataCreatorPrincipalPrincipalRunner EnvironmentAutomationTaskNewResponseTaskMetadataCreatorPrincipal = "PRINCIPAL_RUNNER" - EnvironmentAutomationTaskNewResponseTaskMetadataCreatorPrincipalPrincipalEnvironment EnvironmentAutomationTaskNewResponseTaskMetadataCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - EnvironmentAutomationTaskNewResponseTaskMetadataCreatorPrincipalPrincipalServiceAccount EnvironmentAutomationTaskNewResponseTaskMetadataCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r EnvironmentAutomationTaskNewResponseTaskMetadataCreatorPrincipal) IsKnown() bool { - switch r { - case EnvironmentAutomationTaskNewResponseTaskMetadataCreatorPrincipalPrincipalUnspecified, EnvironmentAutomationTaskNewResponseTaskMetadataCreatorPrincipalPrincipalAccount, EnvironmentAutomationTaskNewResponseTaskMetadataCreatorPrincipalPrincipalUser, EnvironmentAutomationTaskNewResponseTaskMetadataCreatorPrincipalPrincipalRunner, EnvironmentAutomationTaskNewResponseTaskMetadataCreatorPrincipalPrincipalEnvironment, EnvironmentAutomationTaskNewResponseTaskMetadataCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - -// An AutomationTrigger represents a trigger for an automation action. The -// `post_environment_start` field indicates that the automation should be triggered -// after the environment has started. The `post_devcontainer_start` field indicates -// that the automation should be triggered after the dev container has started. -type EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredBy struct { - Manual bool `json:"manual"` - PostDevcontainerStart bool `json:"postDevcontainerStart"` - PostEnvironmentStart bool `json:"postEnvironmentStart"` - JSON environmentAutomationTaskNewResponseTaskMetadataTriggeredByJSON `json:"-"` - union EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByUnion -} - -// environmentAutomationTaskNewResponseTaskMetadataTriggeredByJSON contains the -// JSON metadata for the struct -// [EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredBy] -type environmentAutomationTaskNewResponseTaskMetadataTriggeredByJSON struct { - Manual apijson.Field - PostDevcontainerStart apijson.Field - PostEnvironmentStart apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r environmentAutomationTaskNewResponseTaskMetadataTriggeredByJSON) RawJSON() string { - return r.raw -} - -func (r *EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredBy) UnmarshalJSON(data []byte) (err error) { - *r = EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredBy{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a -// [EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByUnion] interface -// which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByManual], -// [EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByPostDevcontainerStart], -// [EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByPostEnvironmentStart]. -func (r EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredBy) AsUnion() EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByUnion { - return r.union -} - -// An AutomationTrigger represents a trigger for an automation action. The -// `post_environment_start` field indicates that the automation should be triggered -// after the environment has started. The `post_devcontainer_start` field indicates -// that the automation should be triggered after the dev container has started. -// -// Union satisfied by -// [EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByManual], -// [EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByPostDevcontainerStart] -// or -// [EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByPostEnvironmentStart]. -type EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByUnion interface { - implementsEnvironmentAutomationTaskNewResponseTaskMetadataTriggeredBy() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByManual{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByPostDevcontainerStart{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByPostEnvironmentStart{}), - }, - ) -} - -type EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByManual struct { - Manual bool `json:"manual,required"` - JSON environmentAutomationTaskNewResponseTaskMetadataTriggeredByManualJSON `json:"-"` -} - -// environmentAutomationTaskNewResponseTaskMetadataTriggeredByManualJSON contains -// the JSON metadata for the struct -// [EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByManual] -type environmentAutomationTaskNewResponseTaskMetadataTriggeredByManualJSON struct { - Manual apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByManual) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskNewResponseTaskMetadataTriggeredByManualJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByManual) implementsEnvironmentAutomationTaskNewResponseTaskMetadataTriggeredBy() { -} - -type EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByPostDevcontainerStart struct { - PostDevcontainerStart bool `json:"postDevcontainerStart,required"` - JSON environmentAutomationTaskNewResponseTaskMetadataTriggeredByPostDevcontainerStartJSON `json:"-"` -} - -// environmentAutomationTaskNewResponseTaskMetadataTriggeredByPostDevcontainerStartJSON -// contains the JSON metadata for the struct -// [EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByPostDevcontainerStart] -type environmentAutomationTaskNewResponseTaskMetadataTriggeredByPostDevcontainerStartJSON struct { - PostDevcontainerStart apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByPostDevcontainerStart) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskNewResponseTaskMetadataTriggeredByPostDevcontainerStartJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByPostDevcontainerStart) implementsEnvironmentAutomationTaskNewResponseTaskMetadataTriggeredBy() { -} - -type EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByPostEnvironmentStart struct { - PostEnvironmentStart bool `json:"postEnvironmentStart,required"` - JSON environmentAutomationTaskNewResponseTaskMetadataTriggeredByPostEnvironmentStartJSON `json:"-"` -} - -// environmentAutomationTaskNewResponseTaskMetadataTriggeredByPostEnvironmentStartJSON -// contains the JSON metadata for the struct -// [EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByPostEnvironmentStart] -type environmentAutomationTaskNewResponseTaskMetadataTriggeredByPostEnvironmentStartJSON struct { - PostEnvironmentStart apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByPostEnvironmentStart) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskNewResponseTaskMetadataTriggeredByPostEnvironmentStartJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentAutomationTaskNewResponseTaskMetadataTriggeredByPostEnvironmentStart) implementsEnvironmentAutomationTaskNewResponseTaskMetadataTriggeredBy() { -} - -type EnvironmentAutomationTaskNewResponseTaskSpec struct { - // command contains the command the task should execute - Command string `json:"command"` - // runs_on specifies the environment the task should run on. - RunsOn EnvironmentAutomationTaskNewResponseTaskSpecRunsOn `json:"runsOn"` - JSON environmentAutomationTaskNewResponseTaskSpecJSON `json:"-"` -} - -// environmentAutomationTaskNewResponseTaskSpecJSON contains the JSON metadata for -// the struct [EnvironmentAutomationTaskNewResponseTaskSpec] -type environmentAutomationTaskNewResponseTaskSpecJSON struct { - Command apijson.Field - RunsOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskNewResponseTaskSpec) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskNewResponseTaskSpecJSON) RawJSON() string { - return r.raw -} - -// runs_on specifies the environment the task should run on. -type EnvironmentAutomationTaskNewResponseTaskSpecRunsOn struct { - Docker EnvironmentAutomationTaskNewResponseTaskSpecRunsOnDocker `json:"docker,required"` - JSON environmentAutomationTaskNewResponseTaskSpecRunsOnJSON `json:"-"` -} - -// environmentAutomationTaskNewResponseTaskSpecRunsOnJSON contains the JSON -// metadata for the struct [EnvironmentAutomationTaskNewResponseTaskSpecRunsOn] -type environmentAutomationTaskNewResponseTaskSpecRunsOnJSON struct { - Docker apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskNewResponseTaskSpecRunsOn) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskNewResponseTaskSpecRunsOnJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationTaskNewResponseTaskSpecRunsOnDocker struct { - Environment []string `json:"environment"` - Image string `json:"image"` - JSON environmentAutomationTaskNewResponseTaskSpecRunsOnDockerJSON `json:"-"` -} - -// environmentAutomationTaskNewResponseTaskSpecRunsOnDockerJSON contains the JSON -// metadata for the struct -// [EnvironmentAutomationTaskNewResponseTaskSpecRunsOnDocker] -type environmentAutomationTaskNewResponseTaskSpecRunsOnDockerJSON struct { - Environment apijson.Field - Image apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskNewResponseTaskSpecRunsOnDocker) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskNewResponseTaskSpecRunsOnDockerJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationTaskGetResponse struct { - Task EnvironmentAutomationTaskGetResponseTask `json:"task"` - JSON environmentAutomationTaskGetResponseJSON `json:"-"` -} - -// environmentAutomationTaskGetResponseJSON contains the JSON metadata for the -// struct [EnvironmentAutomationTaskGetResponse] -type environmentAutomationTaskGetResponseJSON struct { - Task apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskGetResponseJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationTaskGetResponseTask 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 EnvironmentAutomationTaskGetResponseTaskMetadata `json:"metadata"` - Spec EnvironmentAutomationTaskGetResponseTaskSpec `json:"spec"` - JSON environmentAutomationTaskGetResponseTaskJSON `json:"-"` -} - -// environmentAutomationTaskGetResponseTaskJSON contains the JSON metadata for the -// struct [EnvironmentAutomationTaskGetResponseTask] -type environmentAutomationTaskGetResponseTaskJSON 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 *EnvironmentAutomationTaskGetResponseTask) UnmarshalJSON(data []byte) (err error) { +func (r *TaskMetadata) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentAutomationTaskGetResponseTaskJSON) RawJSON() string { +func (r taskMetadataJSON) RawJSON() string { return r.raw } -type EnvironmentAutomationTaskGetResponseTaskMetadata struct { +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, @@ -697,1686 +348,139 @@ type EnvironmentAutomationTaskGetResponseTaskMetadata 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"` + CreatedAt param.Field[time.Time] `json:"createdAt" format:"date-time"` // creator describes the principal who created the task. - Creator EnvironmentAutomationTaskGetResponseTaskMetadataCreator `json:"creator"` + 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 string `json:"description"` + 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 string `json:"name"` + 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 string `json:"reference"` + Reference param.Field[string] `json:"reference"` // triggered_by is a list of trigger that start the task. - TriggeredBy []EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredBy `json:"triggeredBy"` - JSON environmentAutomationTaskGetResponseTaskMetadataJSON `json:"-"` -} - -// environmentAutomationTaskGetResponseTaskMetadataJSON contains the JSON metadata -// for the struct [EnvironmentAutomationTaskGetResponseTaskMetadata] -type environmentAutomationTaskGetResponseTaskMetadataJSON 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 *EnvironmentAutomationTaskGetResponseTaskMetadata) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + TriggeredBy param.Field[[]shared.AutomationTriggerParam] `json:"triggeredBy"` } -func (r environmentAutomationTaskGetResponseTaskMetadataJSON) RawJSON() string { - return r.raw +func (r TaskMetadataParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -// creator describes the principal who created the task. -type EnvironmentAutomationTaskGetResponseTaskMetadataCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal EnvironmentAutomationTaskGetResponseTaskMetadataCreatorPrincipal `json:"principal"` - JSON environmentAutomationTaskGetResponseTaskMetadataCreatorJSON `json:"-"` +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:"-"` } -// environmentAutomationTaskGetResponseTaskMetadataCreatorJSON contains the JSON -// metadata for the struct -// [EnvironmentAutomationTaskGetResponseTaskMetadataCreator] -type environmentAutomationTaskGetResponseTaskMetadataCreatorJSON struct { - ID apijson.Field - Principal apijson.Field +// 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 *EnvironmentAutomationTaskGetResponseTaskMetadataCreator) UnmarshalJSON(data []byte) (err error) { +func (r *TaskSpec) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentAutomationTaskGetResponseTaskMetadataCreatorJSON) RawJSON() string { +func (r taskSpecJSON) RawJSON() string { return r.raw } -// Principal is the principal of the subject -type EnvironmentAutomationTaskGetResponseTaskMetadataCreatorPrincipal string - -const ( - EnvironmentAutomationTaskGetResponseTaskMetadataCreatorPrincipalPrincipalUnspecified EnvironmentAutomationTaskGetResponseTaskMetadataCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - EnvironmentAutomationTaskGetResponseTaskMetadataCreatorPrincipalPrincipalAccount EnvironmentAutomationTaskGetResponseTaskMetadataCreatorPrincipal = "PRINCIPAL_ACCOUNT" - EnvironmentAutomationTaskGetResponseTaskMetadataCreatorPrincipalPrincipalUser EnvironmentAutomationTaskGetResponseTaskMetadataCreatorPrincipal = "PRINCIPAL_USER" - EnvironmentAutomationTaskGetResponseTaskMetadataCreatorPrincipalPrincipalRunner EnvironmentAutomationTaskGetResponseTaskMetadataCreatorPrincipal = "PRINCIPAL_RUNNER" - EnvironmentAutomationTaskGetResponseTaskMetadataCreatorPrincipalPrincipalEnvironment EnvironmentAutomationTaskGetResponseTaskMetadataCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - EnvironmentAutomationTaskGetResponseTaskMetadataCreatorPrincipalPrincipalServiceAccount EnvironmentAutomationTaskGetResponseTaskMetadataCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r EnvironmentAutomationTaskGetResponseTaskMetadataCreatorPrincipal) IsKnown() bool { - switch r { - case EnvironmentAutomationTaskGetResponseTaskMetadataCreatorPrincipalPrincipalUnspecified, EnvironmentAutomationTaskGetResponseTaskMetadataCreatorPrincipalPrincipalAccount, EnvironmentAutomationTaskGetResponseTaskMetadataCreatorPrincipalPrincipalUser, EnvironmentAutomationTaskGetResponseTaskMetadataCreatorPrincipalPrincipalRunner, EnvironmentAutomationTaskGetResponseTaskMetadataCreatorPrincipalPrincipalEnvironment, EnvironmentAutomationTaskGetResponseTaskMetadataCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - -// An AutomationTrigger represents a trigger for an automation action. The -// `post_environment_start` field indicates that the automation should be triggered -// after the environment has started. The `post_devcontainer_start` field indicates -// that the automation should be triggered after the dev container has started. -type EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredBy struct { - Manual bool `json:"manual"` - PostDevcontainerStart bool `json:"postDevcontainerStart"` - PostEnvironmentStart bool `json:"postEnvironmentStart"` - JSON environmentAutomationTaskGetResponseTaskMetadataTriggeredByJSON `json:"-"` - union EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByUnion -} - -// environmentAutomationTaskGetResponseTaskMetadataTriggeredByJSON contains the -// JSON metadata for the struct -// [EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredBy] -type environmentAutomationTaskGetResponseTaskMetadataTriggeredByJSON struct { - Manual apijson.Field - PostDevcontainerStart apijson.Field - PostEnvironmentStart apijson.Field - raw string - ExtraFields map[string]apijson.Field +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 environmentAutomationTaskGetResponseTaskMetadataTriggeredByJSON) RawJSON() string { - return r.raw +func (r TaskSpecParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r *EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredBy) UnmarshalJSON(data []byte) (err error) { - *r = EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredBy{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) +type EnvironmentAutomationTaskNewResponse struct { + Task Task `json:"task"` + JSON environmentAutomationTaskNewResponseJSON `json:"-"` } -// AsUnion returns a -// [EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByUnion] interface -// which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByManual], -// [EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByPostDevcontainerStart], -// [EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByPostEnvironmentStart]. -func (r EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredBy) AsUnion() EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByUnion { - return r.union +// environmentAutomationTaskNewResponseJSON contains the JSON metadata for the +// struct [EnvironmentAutomationTaskNewResponse] +type environmentAutomationTaskNewResponseJSON struct { + Task apijson.Field + raw string + ExtraFields map[string]apijson.Field } -// An AutomationTrigger represents a trigger for an automation action. The -// `post_environment_start` field indicates that the automation should be triggered -// after the environment has started. The `post_devcontainer_start` field indicates -// that the automation should be triggered after the dev container has started. -// -// Union satisfied by -// [EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByManual], -// [EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByPostDevcontainerStart] -// or -// [EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByPostEnvironmentStart]. -type EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByUnion interface { - implementsEnvironmentAutomationTaskGetResponseTaskMetadataTriggeredBy() +func (r *EnvironmentAutomationTaskNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByManual{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByPostDevcontainerStart{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByPostEnvironmentStart{}), - }, - ) +func (r environmentAutomationTaskNewResponseJSON) RawJSON() string { + return r.raw } -type EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByManual struct { - Manual bool `json:"manual,required"` - JSON environmentAutomationTaskGetResponseTaskMetadataTriggeredByManualJSON `json:"-"` +type EnvironmentAutomationTaskGetResponse struct { + Task Task `json:"task"` + JSON environmentAutomationTaskGetResponseJSON `json:"-"` } -// environmentAutomationTaskGetResponseTaskMetadataTriggeredByManualJSON contains -// the JSON metadata for the struct -// [EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByManual] -type environmentAutomationTaskGetResponseTaskMetadataTriggeredByManualJSON struct { - Manual apijson.Field +// environmentAutomationTaskGetResponseJSON contains the JSON metadata for the +// struct [EnvironmentAutomationTaskGetResponse] +type environmentAutomationTaskGetResponseJSON struct { + Task apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByManual) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentAutomationTaskGetResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentAutomationTaskGetResponseTaskMetadataTriggeredByManualJSON) RawJSON() string { +func (r environmentAutomationTaskGetResponseJSON) RawJSON() string { return r.raw } -func (r EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByManual) implementsEnvironmentAutomationTaskGetResponseTaskMetadataTriggeredBy() { -} +type EnvironmentAutomationTaskUpdateResponse = interface{} + +type EnvironmentAutomationTaskDeleteResponse = interface{} -type EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByPostDevcontainerStart struct { - PostDevcontainerStart bool `json:"postDevcontainerStart,required"` - JSON environmentAutomationTaskGetResponseTaskMetadataTriggeredByPostDevcontainerStartJSON `json:"-"` +type EnvironmentAutomationTaskStartResponse struct { + TaskExecution shared.TaskExecution `json:"taskExecution"` + JSON environmentAutomationTaskStartResponseJSON `json:"-"` } -// environmentAutomationTaskGetResponseTaskMetadataTriggeredByPostDevcontainerStartJSON -// contains the JSON metadata for the struct -// [EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByPostDevcontainerStart] -type environmentAutomationTaskGetResponseTaskMetadataTriggeredByPostDevcontainerStartJSON struct { - PostDevcontainerStart apijson.Field - raw string - ExtraFields map[string]apijson.Field +// environmentAutomationTaskStartResponseJSON contains the JSON metadata for the +// struct [EnvironmentAutomationTaskStartResponse] +type environmentAutomationTaskStartResponseJSON struct { + TaskExecution apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByPostDevcontainerStart) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentAutomationTaskStartResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r environmentAutomationTaskGetResponseTaskMetadataTriggeredByPostDevcontainerStartJSON) RawJSON() string { +func (r environmentAutomationTaskStartResponseJSON) RawJSON() string { return r.raw } -func (r EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByPostDevcontainerStart) implementsEnvironmentAutomationTaskGetResponseTaskMetadataTriggeredBy() { +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"` } -type EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByPostEnvironmentStart struct { - PostEnvironmentStart bool `json:"postEnvironmentStart,required"` - JSON environmentAutomationTaskGetResponseTaskMetadataTriggeredByPostEnvironmentStartJSON `json:"-"` -} - -// environmentAutomationTaskGetResponseTaskMetadataTriggeredByPostEnvironmentStartJSON -// contains the JSON metadata for the struct -// [EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByPostEnvironmentStart] -type environmentAutomationTaskGetResponseTaskMetadataTriggeredByPostEnvironmentStartJSON struct { - PostEnvironmentStart apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByPostEnvironmentStart) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskGetResponseTaskMetadataTriggeredByPostEnvironmentStartJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentAutomationTaskGetResponseTaskMetadataTriggeredByPostEnvironmentStart) implementsEnvironmentAutomationTaskGetResponseTaskMetadataTriggeredBy() { -} - -type EnvironmentAutomationTaskGetResponseTaskSpec struct { - // command contains the command the task should execute - Command string `json:"command"` - // runs_on specifies the environment the task should run on. - RunsOn EnvironmentAutomationTaskGetResponseTaskSpecRunsOn `json:"runsOn"` - JSON environmentAutomationTaskGetResponseTaskSpecJSON `json:"-"` -} - -// environmentAutomationTaskGetResponseTaskSpecJSON contains the JSON metadata for -// the struct [EnvironmentAutomationTaskGetResponseTaskSpec] -type environmentAutomationTaskGetResponseTaskSpecJSON struct { - Command apijson.Field - RunsOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskGetResponseTaskSpec) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskGetResponseTaskSpecJSON) RawJSON() string { - return r.raw -} - -// runs_on specifies the environment the task should run on. -type EnvironmentAutomationTaskGetResponseTaskSpecRunsOn struct { - Docker EnvironmentAutomationTaskGetResponseTaskSpecRunsOnDocker `json:"docker,required"` - JSON environmentAutomationTaskGetResponseTaskSpecRunsOnJSON `json:"-"` -} - -// environmentAutomationTaskGetResponseTaskSpecRunsOnJSON contains the JSON -// metadata for the struct [EnvironmentAutomationTaskGetResponseTaskSpecRunsOn] -type environmentAutomationTaskGetResponseTaskSpecRunsOnJSON struct { - Docker apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskGetResponseTaskSpecRunsOn) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskGetResponseTaskSpecRunsOnJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationTaskGetResponseTaskSpecRunsOnDocker struct { - Environment []string `json:"environment"` - Image string `json:"image"` - JSON environmentAutomationTaskGetResponseTaskSpecRunsOnDockerJSON `json:"-"` -} - -// environmentAutomationTaskGetResponseTaskSpecRunsOnDockerJSON contains the JSON -// metadata for the struct -// [EnvironmentAutomationTaskGetResponseTaskSpecRunsOnDocker] -type environmentAutomationTaskGetResponseTaskSpecRunsOnDockerJSON struct { - Environment apijson.Field - Image apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskGetResponseTaskSpecRunsOnDocker) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskGetResponseTaskSpecRunsOnDockerJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationTaskUpdateResponse = interface{} - -type EnvironmentAutomationTaskListResponse 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 EnvironmentAutomationTaskListResponseMetadata `json:"metadata"` - Spec EnvironmentAutomationTaskListResponseSpec `json:"spec"` - JSON environmentAutomationTaskListResponseJSON `json:"-"` -} - -// environmentAutomationTaskListResponseJSON contains the JSON metadata for the -// struct [EnvironmentAutomationTaskListResponse] -type environmentAutomationTaskListResponseJSON 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 *EnvironmentAutomationTaskListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskListResponseJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationTaskListResponseMetadata 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 EnvironmentAutomationTaskListResponseMetadataCreator `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 []EnvironmentAutomationTaskListResponseMetadataTriggeredBy `json:"triggeredBy"` - JSON environmentAutomationTaskListResponseMetadataJSON `json:"-"` -} - -// environmentAutomationTaskListResponseMetadataJSON contains the JSON metadata for -// the struct [EnvironmentAutomationTaskListResponseMetadata] -type environmentAutomationTaskListResponseMetadataJSON 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 *EnvironmentAutomationTaskListResponseMetadata) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskListResponseMetadataJSON) RawJSON() string { - return r.raw -} - -// creator describes the principal who created the task. -type EnvironmentAutomationTaskListResponseMetadataCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal EnvironmentAutomationTaskListResponseMetadataCreatorPrincipal `json:"principal"` - JSON environmentAutomationTaskListResponseMetadataCreatorJSON `json:"-"` -} - -// environmentAutomationTaskListResponseMetadataCreatorJSON contains the JSON -// metadata for the struct [EnvironmentAutomationTaskListResponseMetadataCreator] -type environmentAutomationTaskListResponseMetadataCreatorJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskListResponseMetadataCreator) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskListResponseMetadataCreatorJSON) RawJSON() string { - return r.raw -} - -// Principal is the principal of the subject -type EnvironmentAutomationTaskListResponseMetadataCreatorPrincipal string - -const ( - EnvironmentAutomationTaskListResponseMetadataCreatorPrincipalPrincipalUnspecified EnvironmentAutomationTaskListResponseMetadataCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - EnvironmentAutomationTaskListResponseMetadataCreatorPrincipalPrincipalAccount EnvironmentAutomationTaskListResponseMetadataCreatorPrincipal = "PRINCIPAL_ACCOUNT" - EnvironmentAutomationTaskListResponseMetadataCreatorPrincipalPrincipalUser EnvironmentAutomationTaskListResponseMetadataCreatorPrincipal = "PRINCIPAL_USER" - EnvironmentAutomationTaskListResponseMetadataCreatorPrincipalPrincipalRunner EnvironmentAutomationTaskListResponseMetadataCreatorPrincipal = "PRINCIPAL_RUNNER" - EnvironmentAutomationTaskListResponseMetadataCreatorPrincipalPrincipalEnvironment EnvironmentAutomationTaskListResponseMetadataCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - EnvironmentAutomationTaskListResponseMetadataCreatorPrincipalPrincipalServiceAccount EnvironmentAutomationTaskListResponseMetadataCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r EnvironmentAutomationTaskListResponseMetadataCreatorPrincipal) IsKnown() bool { - switch r { - case EnvironmentAutomationTaskListResponseMetadataCreatorPrincipalPrincipalUnspecified, EnvironmentAutomationTaskListResponseMetadataCreatorPrincipalPrincipalAccount, EnvironmentAutomationTaskListResponseMetadataCreatorPrincipalPrincipalUser, EnvironmentAutomationTaskListResponseMetadataCreatorPrincipalPrincipalRunner, EnvironmentAutomationTaskListResponseMetadataCreatorPrincipalPrincipalEnvironment, EnvironmentAutomationTaskListResponseMetadataCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - -// An AutomationTrigger represents a trigger for an automation action. The -// `post_environment_start` field indicates that the automation should be triggered -// after the environment has started. The `post_devcontainer_start` field indicates -// that the automation should be triggered after the dev container has started. -type EnvironmentAutomationTaskListResponseMetadataTriggeredBy struct { - Manual bool `json:"manual"` - PostDevcontainerStart bool `json:"postDevcontainerStart"` - PostEnvironmentStart bool `json:"postEnvironmentStart"` - JSON environmentAutomationTaskListResponseMetadataTriggeredByJSON `json:"-"` - union EnvironmentAutomationTaskListResponseMetadataTriggeredByUnion -} - -// environmentAutomationTaskListResponseMetadataTriggeredByJSON contains the JSON -// metadata for the struct -// [EnvironmentAutomationTaskListResponseMetadataTriggeredBy] -type environmentAutomationTaskListResponseMetadataTriggeredByJSON struct { - Manual apijson.Field - PostDevcontainerStart apijson.Field - PostEnvironmentStart apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r environmentAutomationTaskListResponseMetadataTriggeredByJSON) RawJSON() string { - return r.raw -} - -func (r *EnvironmentAutomationTaskListResponseMetadataTriggeredBy) UnmarshalJSON(data []byte) (err error) { - *r = EnvironmentAutomationTaskListResponseMetadataTriggeredBy{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a -// [EnvironmentAutomationTaskListResponseMetadataTriggeredByUnion] interface which -// you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [EnvironmentAutomationTaskListResponseMetadataTriggeredByManual], -// [EnvironmentAutomationTaskListResponseMetadataTriggeredByPostDevcontainerStart], -// [EnvironmentAutomationTaskListResponseMetadataTriggeredByPostEnvironmentStart]. -func (r EnvironmentAutomationTaskListResponseMetadataTriggeredBy) AsUnion() EnvironmentAutomationTaskListResponseMetadataTriggeredByUnion { - return r.union -} - -// An AutomationTrigger represents a trigger for an automation action. The -// `post_environment_start` field indicates that the automation should be triggered -// after the environment has started. The `post_devcontainer_start` field indicates -// that the automation should be triggered after the dev container has started. -// -// Union satisfied by -// [EnvironmentAutomationTaskListResponseMetadataTriggeredByManual], -// [EnvironmentAutomationTaskListResponseMetadataTriggeredByPostDevcontainerStart] -// or -// [EnvironmentAutomationTaskListResponseMetadataTriggeredByPostEnvironmentStart]. -type EnvironmentAutomationTaskListResponseMetadataTriggeredByUnion interface { - implementsEnvironmentAutomationTaskListResponseMetadataTriggeredBy() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*EnvironmentAutomationTaskListResponseMetadataTriggeredByUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationTaskListResponseMetadataTriggeredByManual{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationTaskListResponseMetadataTriggeredByPostDevcontainerStart{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationTaskListResponseMetadataTriggeredByPostEnvironmentStart{}), - }, - ) -} - -type EnvironmentAutomationTaskListResponseMetadataTriggeredByManual struct { - Manual bool `json:"manual,required"` - JSON environmentAutomationTaskListResponseMetadataTriggeredByManualJSON `json:"-"` -} - -// environmentAutomationTaskListResponseMetadataTriggeredByManualJSON contains the -// JSON metadata for the struct -// [EnvironmentAutomationTaskListResponseMetadataTriggeredByManual] -type environmentAutomationTaskListResponseMetadataTriggeredByManualJSON struct { - Manual apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskListResponseMetadataTriggeredByManual) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskListResponseMetadataTriggeredByManualJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentAutomationTaskListResponseMetadataTriggeredByManual) implementsEnvironmentAutomationTaskListResponseMetadataTriggeredBy() { -} - -type EnvironmentAutomationTaskListResponseMetadataTriggeredByPostDevcontainerStart struct { - PostDevcontainerStart bool `json:"postDevcontainerStart,required"` - JSON environmentAutomationTaskListResponseMetadataTriggeredByPostDevcontainerStartJSON `json:"-"` -} - -// environmentAutomationTaskListResponseMetadataTriggeredByPostDevcontainerStartJSON -// contains the JSON metadata for the struct -// [EnvironmentAutomationTaskListResponseMetadataTriggeredByPostDevcontainerStart] -type environmentAutomationTaskListResponseMetadataTriggeredByPostDevcontainerStartJSON struct { - PostDevcontainerStart apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskListResponseMetadataTriggeredByPostDevcontainerStart) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskListResponseMetadataTriggeredByPostDevcontainerStartJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentAutomationTaskListResponseMetadataTriggeredByPostDevcontainerStart) implementsEnvironmentAutomationTaskListResponseMetadataTriggeredBy() { -} - -type EnvironmentAutomationTaskListResponseMetadataTriggeredByPostEnvironmentStart struct { - PostEnvironmentStart bool `json:"postEnvironmentStart,required"` - JSON environmentAutomationTaskListResponseMetadataTriggeredByPostEnvironmentStartJSON `json:"-"` -} - -// environmentAutomationTaskListResponseMetadataTriggeredByPostEnvironmentStartJSON -// contains the JSON metadata for the struct -// [EnvironmentAutomationTaskListResponseMetadataTriggeredByPostEnvironmentStart] -type environmentAutomationTaskListResponseMetadataTriggeredByPostEnvironmentStartJSON struct { - PostEnvironmentStart apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskListResponseMetadataTriggeredByPostEnvironmentStart) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskListResponseMetadataTriggeredByPostEnvironmentStartJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentAutomationTaskListResponseMetadataTriggeredByPostEnvironmentStart) implementsEnvironmentAutomationTaskListResponseMetadataTriggeredBy() { -} - -type EnvironmentAutomationTaskListResponseSpec struct { - // command contains the command the task should execute - Command string `json:"command"` - // runs_on specifies the environment the task should run on. - RunsOn EnvironmentAutomationTaskListResponseSpecRunsOn `json:"runsOn"` - JSON environmentAutomationTaskListResponseSpecJSON `json:"-"` -} - -// environmentAutomationTaskListResponseSpecJSON contains the JSON metadata for the -// struct [EnvironmentAutomationTaskListResponseSpec] -type environmentAutomationTaskListResponseSpecJSON struct { - Command apijson.Field - RunsOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskListResponseSpec) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskListResponseSpecJSON) RawJSON() string { - return r.raw -} - -// runs_on specifies the environment the task should run on. -type EnvironmentAutomationTaskListResponseSpecRunsOn struct { - Docker EnvironmentAutomationTaskListResponseSpecRunsOnDocker `json:"docker,required"` - JSON environmentAutomationTaskListResponseSpecRunsOnJSON `json:"-"` -} - -// environmentAutomationTaskListResponseSpecRunsOnJSON contains the JSON metadata -// for the struct [EnvironmentAutomationTaskListResponseSpecRunsOn] -type environmentAutomationTaskListResponseSpecRunsOnJSON struct { - Docker apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskListResponseSpecRunsOn) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskListResponseSpecRunsOnJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationTaskListResponseSpecRunsOnDocker struct { - Environment []string `json:"environment"` - Image string `json:"image"` - JSON environmentAutomationTaskListResponseSpecRunsOnDockerJSON `json:"-"` -} - -// environmentAutomationTaskListResponseSpecRunsOnDockerJSON contains the JSON -// metadata for the struct [EnvironmentAutomationTaskListResponseSpecRunsOnDocker] -type environmentAutomationTaskListResponseSpecRunsOnDockerJSON struct { - Environment apijson.Field - Image apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskListResponseSpecRunsOnDocker) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskListResponseSpecRunsOnDockerJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationTaskDeleteResponse = interface{} - -type EnvironmentAutomationTaskStartResponse struct { - TaskExecution EnvironmentAutomationTaskStartResponseTaskExecution `json:"taskExecution"` - JSON environmentAutomationTaskStartResponseJSON `json:"-"` -} - -// environmentAutomationTaskStartResponseJSON contains the JSON metadata for the -// struct [EnvironmentAutomationTaskStartResponse] -type environmentAutomationTaskStartResponseJSON struct { - TaskExecution apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskStartResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskStartResponseJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationTaskStartResponseTaskExecution struct { - ID string `json:"id" format:"uuid"` - Metadata EnvironmentAutomationTaskStartResponseTaskExecutionMetadata `json:"metadata"` - Spec EnvironmentAutomationTaskStartResponseTaskExecutionSpec `json:"spec"` - Status EnvironmentAutomationTaskStartResponseTaskExecutionStatus `json:"status"` - JSON environmentAutomationTaskStartResponseTaskExecutionJSON `json:"-"` -} - -// environmentAutomationTaskStartResponseTaskExecutionJSON contains the JSON -// metadata for the struct [EnvironmentAutomationTaskStartResponseTaskExecution] -type environmentAutomationTaskStartResponseTaskExecutionJSON struct { - ID apijson.Field - Metadata apijson.Field - Spec apijson.Field - Status apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskStartResponseTaskExecution) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskStartResponseTaskExecutionJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationTaskStartResponseTaskExecutionMetadata 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. - CompletedAt time.Time `json:"completedAt" format:"date-time"` - // 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/started the task run. - Creator EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreator `json:"creator"` - // environment_id is the ID of the environment in which the task run is executed. - EnvironmentID string `json:"environmentId" format:"uuid"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - StartedAt time.Time `json:"startedAt" format:"date-time"` - // started_by describes the trigger that started the task execution. - StartedBy string `json:"startedBy"` - // task_id is the ID of the main task being executed. - TaskID string `json:"taskId" format:"uuid"` - JSON environmentAutomationTaskStartResponseTaskExecutionMetadataJSON `json:"-"` -} - -// environmentAutomationTaskStartResponseTaskExecutionMetadataJSON contains the -// JSON metadata for the struct -// [EnvironmentAutomationTaskStartResponseTaskExecutionMetadata] -type environmentAutomationTaskStartResponseTaskExecutionMetadataJSON struct { - CompletedAt apijson.Field - CreatedAt apijson.Field - Creator apijson.Field - EnvironmentID apijson.Field - StartedAt apijson.Field - StartedBy apijson.Field - TaskID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskStartResponseTaskExecutionMetadata) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskStartResponseTaskExecutionMetadataJSON) RawJSON() string { - return r.raw -} - -// creator describes the principal who created/started the task run. -type EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreatorPrincipal `json:"principal"` - JSON environmentAutomationTaskStartResponseTaskExecutionMetadataCreatorJSON `json:"-"` -} - -// environmentAutomationTaskStartResponseTaskExecutionMetadataCreatorJSON contains -// the JSON metadata for the struct -// [EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreator] -type environmentAutomationTaskStartResponseTaskExecutionMetadataCreatorJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreator) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskStartResponseTaskExecutionMetadataCreatorJSON) RawJSON() string { - return r.raw -} - -// Principal is the principal of the subject -type EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreatorPrincipal string - -const ( - EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreatorPrincipalPrincipalUnspecified EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreatorPrincipalPrincipalAccount EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreatorPrincipal = "PRINCIPAL_ACCOUNT" - EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreatorPrincipalPrincipalUser EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreatorPrincipal = "PRINCIPAL_USER" - EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreatorPrincipalPrincipalRunner EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreatorPrincipal = "PRINCIPAL_RUNNER" - EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreatorPrincipalPrincipalEnvironment EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreatorPrincipalPrincipalServiceAccount EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreatorPrincipal) IsKnown() bool { - switch r { - case EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreatorPrincipalPrincipalUnspecified, EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreatorPrincipalPrincipalAccount, EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreatorPrincipalPrincipalUser, EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreatorPrincipalPrincipalRunner, EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreatorPrincipalPrincipalEnvironment, EnvironmentAutomationTaskStartResponseTaskExecutionMetadataCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - -type EnvironmentAutomationTaskStartResponseTaskExecutionSpec struct { - // desired_phase is the phase the task execution should be in. Used to stop a - // running task execution early. - DesiredPhase EnvironmentAutomationTaskStartResponseTaskExecutionSpecDesiredPhase `json:"desiredPhase"` - // plan is a list of groups of steps. The steps in a group are executed - // concurrently, while the groups are executed sequentially. The order of the - // groups is the order in which they are executed. - Plan []EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlan `json:"plan"` - JSON environmentAutomationTaskStartResponseTaskExecutionSpecJSON `json:"-"` -} - -// environmentAutomationTaskStartResponseTaskExecutionSpecJSON contains the JSON -// metadata for the struct -// [EnvironmentAutomationTaskStartResponseTaskExecutionSpec] -type environmentAutomationTaskStartResponseTaskExecutionSpecJSON struct { - DesiredPhase apijson.Field - Plan apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskStartResponseTaskExecutionSpec) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskStartResponseTaskExecutionSpecJSON) RawJSON() string { - return r.raw -} - -// desired_phase is the phase the task execution should be in. Used to stop a -// running task execution early. -type EnvironmentAutomationTaskStartResponseTaskExecutionSpecDesiredPhase string - -const ( - EnvironmentAutomationTaskStartResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhaseUnspecified EnvironmentAutomationTaskStartResponseTaskExecutionSpecDesiredPhase = "TASK_EXECUTION_PHASE_UNSPECIFIED" - EnvironmentAutomationTaskStartResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhasePending EnvironmentAutomationTaskStartResponseTaskExecutionSpecDesiredPhase = "TASK_EXECUTION_PHASE_PENDING" - EnvironmentAutomationTaskStartResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhaseRunning EnvironmentAutomationTaskStartResponseTaskExecutionSpecDesiredPhase = "TASK_EXECUTION_PHASE_RUNNING" - EnvironmentAutomationTaskStartResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhaseSucceeded EnvironmentAutomationTaskStartResponseTaskExecutionSpecDesiredPhase = "TASK_EXECUTION_PHASE_SUCCEEDED" - EnvironmentAutomationTaskStartResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhaseFailed EnvironmentAutomationTaskStartResponseTaskExecutionSpecDesiredPhase = "TASK_EXECUTION_PHASE_FAILED" - EnvironmentAutomationTaskStartResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhaseStopped EnvironmentAutomationTaskStartResponseTaskExecutionSpecDesiredPhase = "TASK_EXECUTION_PHASE_STOPPED" -) - -func (r EnvironmentAutomationTaskStartResponseTaskExecutionSpecDesiredPhase) IsKnown() bool { - switch r { - case EnvironmentAutomationTaskStartResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhaseUnspecified, EnvironmentAutomationTaskStartResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhasePending, EnvironmentAutomationTaskStartResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhaseRunning, EnvironmentAutomationTaskStartResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhaseSucceeded, EnvironmentAutomationTaskStartResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhaseFailed, EnvironmentAutomationTaskStartResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhaseStopped: - return true - } - return false -} - -type EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlan struct { - Steps []EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStep `json:"steps"` - JSON environmentAutomationTaskStartResponseTaskExecutionSpecPlanJSON `json:"-"` -} - -// environmentAutomationTaskStartResponseTaskExecutionSpecPlanJSON contains the -// JSON metadata for the struct -// [EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlan] -type environmentAutomationTaskStartResponseTaskExecutionSpecPlanJSON struct { - Steps apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlan) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskStartResponseTaskExecutionSpecPlanJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStep struct { - // ID is the ID of the execution step - ID string `json:"id" format:"uuid"` - // This field can have the runtime type of [[]string]. - DependsOn interface{} `json:"dependsOn"` - Label string `json:"label"` - ServiceID string `json:"serviceId" format:"uuid"` - // This field can have the runtime type of - // [EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStepsObjectTask]. - Task interface{} `json:"task"` - JSON environmentAutomationTaskStartResponseTaskExecutionSpecPlanStepJSON `json:"-"` - union EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStepsUnion -} - -// environmentAutomationTaskStartResponseTaskExecutionSpecPlanStepJSON contains the -// JSON metadata for the struct -// [EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStep] -type environmentAutomationTaskStartResponseTaskExecutionSpecPlanStepJSON struct { - ID apijson.Field - DependsOn apijson.Field - Label apijson.Field - ServiceID apijson.Field - Task apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r environmentAutomationTaskStartResponseTaskExecutionSpecPlanStepJSON) RawJSON() string { - return r.raw -} - -func (r *EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStep) UnmarshalJSON(data []byte) (err error) { - *r = EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStep{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a -// [EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStepsUnion] -// interface which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStepsObject], -// [EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStepsObject]. -func (r EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStep) AsUnion() EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStepsUnion { - return r.union -} - -// Union satisfied by -// [EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStepsObject] or -// [EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStepsObject]. -type EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStepsUnion interface { - implementsEnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStep() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStepsUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStepsObject{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStepsObject{}), - }, - ) -} - -type EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStepsObject struct { - ServiceID string `json:"serviceId,required" format:"uuid"` - // ID is the ID of the execution step - ID string `json:"id" format:"uuid"` - DependsOn []string `json:"dependsOn"` - Label string `json:"label"` - JSON environmentAutomationTaskStartResponseTaskExecutionSpecPlanStepsObjectJSON `json:"-"` -} - -// environmentAutomationTaskStartResponseTaskExecutionSpecPlanStepsObjectJSON -// contains the JSON metadata for the struct -// [EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStepsObject] -type environmentAutomationTaskStartResponseTaskExecutionSpecPlanStepsObjectJSON struct { - ServiceID apijson.Field - ID apijson.Field - DependsOn apijson.Field - Label apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStepsObject) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskStartResponseTaskExecutionSpecPlanStepsObjectJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStepsObject) implementsEnvironmentAutomationTaskStartResponseTaskExecutionSpecPlanStep() { -} - -type EnvironmentAutomationTaskStartResponseTaskExecutionStatus struct { - // failure_message summarises why the task execution failed to operate. If this is - // non-empty the task execution has failed to operate and will likely transition to - // a failed state. - FailureMessage string `json:"failureMessage"` - // log_url is the URL to the logs of the task's steps. If this is empty, the task - // either has no logs or has not yet started. - LogURL string `json:"logUrl"` - // the phase of a task execution represents the aggregated phase of all steps. - Phase EnvironmentAutomationTaskStartResponseTaskExecutionStatusPhase `json:"phase"` - // version of the status update. Task executions themselves are unversioned, but - // their status has different versions. The value of this field has no semantic - // meaning (e.g. don't interpret it as as a timestamp), but it can be used to - // impose a partial order. If a.status_version < b.status_version then a was the - // status before b. - StatusVersion string `json:"statusVersion"` - // steps provides the status for each individual step of the task execution. If a - // step is missing it has not yet started. - Steps []EnvironmentAutomationTaskStartResponseTaskExecutionStatusStep `json:"steps"` - JSON environmentAutomationTaskStartResponseTaskExecutionStatusJSON `json:"-"` -} - -// environmentAutomationTaskStartResponseTaskExecutionStatusJSON contains the JSON -// metadata for the struct -// [EnvironmentAutomationTaskStartResponseTaskExecutionStatus] -type environmentAutomationTaskStartResponseTaskExecutionStatusJSON struct { - FailureMessage apijson.Field - LogURL apijson.Field - Phase apijson.Field - StatusVersion apijson.Field - Steps apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskStartResponseTaskExecutionStatus) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskStartResponseTaskExecutionStatusJSON) RawJSON() string { - return r.raw -} - -// the phase of a task execution represents the aggregated phase of all steps. -type EnvironmentAutomationTaskStartResponseTaskExecutionStatusPhase string - -const ( - EnvironmentAutomationTaskStartResponseTaskExecutionStatusPhaseTaskExecutionPhaseUnspecified EnvironmentAutomationTaskStartResponseTaskExecutionStatusPhase = "TASK_EXECUTION_PHASE_UNSPECIFIED" - EnvironmentAutomationTaskStartResponseTaskExecutionStatusPhaseTaskExecutionPhasePending EnvironmentAutomationTaskStartResponseTaskExecutionStatusPhase = "TASK_EXECUTION_PHASE_PENDING" - EnvironmentAutomationTaskStartResponseTaskExecutionStatusPhaseTaskExecutionPhaseRunning EnvironmentAutomationTaskStartResponseTaskExecutionStatusPhase = "TASK_EXECUTION_PHASE_RUNNING" - EnvironmentAutomationTaskStartResponseTaskExecutionStatusPhaseTaskExecutionPhaseSucceeded EnvironmentAutomationTaskStartResponseTaskExecutionStatusPhase = "TASK_EXECUTION_PHASE_SUCCEEDED" - EnvironmentAutomationTaskStartResponseTaskExecutionStatusPhaseTaskExecutionPhaseFailed EnvironmentAutomationTaskStartResponseTaskExecutionStatusPhase = "TASK_EXECUTION_PHASE_FAILED" - EnvironmentAutomationTaskStartResponseTaskExecutionStatusPhaseTaskExecutionPhaseStopped EnvironmentAutomationTaskStartResponseTaskExecutionStatusPhase = "TASK_EXECUTION_PHASE_STOPPED" -) - -func (r EnvironmentAutomationTaskStartResponseTaskExecutionStatusPhase) IsKnown() bool { - switch r { - case EnvironmentAutomationTaskStartResponseTaskExecutionStatusPhaseTaskExecutionPhaseUnspecified, EnvironmentAutomationTaskStartResponseTaskExecutionStatusPhaseTaskExecutionPhasePending, EnvironmentAutomationTaskStartResponseTaskExecutionStatusPhaseTaskExecutionPhaseRunning, EnvironmentAutomationTaskStartResponseTaskExecutionStatusPhaseTaskExecutionPhaseSucceeded, EnvironmentAutomationTaskStartResponseTaskExecutionStatusPhaseTaskExecutionPhaseFailed, EnvironmentAutomationTaskStartResponseTaskExecutionStatusPhaseTaskExecutionPhaseStopped: - return true - } - return false -} - -type EnvironmentAutomationTaskStartResponseTaskExecutionStatusStep struct { - // ID is the ID of the execution step - ID string `json:"id" format:"uuid"` - // failure_message summarises why the step failed to operate. If this is non-empty - // the step has failed to operate and will likely transition to a failed state. - FailureMessage string `json:"failureMessage"` - // phase is the current phase of the execution step - Phase EnvironmentAutomationTaskStartResponseTaskExecutionStatusStepsPhase `json:"phase"` - JSON environmentAutomationTaskStartResponseTaskExecutionStatusStepJSON `json:"-"` -} - -// environmentAutomationTaskStartResponseTaskExecutionStatusStepJSON contains the -// JSON metadata for the struct -// [EnvironmentAutomationTaskStartResponseTaskExecutionStatusStep] -type environmentAutomationTaskStartResponseTaskExecutionStatusStepJSON struct { - ID apijson.Field - FailureMessage apijson.Field - Phase apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskStartResponseTaskExecutionStatusStep) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskStartResponseTaskExecutionStatusStepJSON) RawJSON() string { - return r.raw -} - -// phase is the current phase of the execution step -type EnvironmentAutomationTaskStartResponseTaskExecutionStatusStepsPhase string - -const ( - EnvironmentAutomationTaskStartResponseTaskExecutionStatusStepsPhaseTaskExecutionPhaseUnspecified EnvironmentAutomationTaskStartResponseTaskExecutionStatusStepsPhase = "TASK_EXECUTION_PHASE_UNSPECIFIED" - EnvironmentAutomationTaskStartResponseTaskExecutionStatusStepsPhaseTaskExecutionPhasePending EnvironmentAutomationTaskStartResponseTaskExecutionStatusStepsPhase = "TASK_EXECUTION_PHASE_PENDING" - EnvironmentAutomationTaskStartResponseTaskExecutionStatusStepsPhaseTaskExecutionPhaseRunning EnvironmentAutomationTaskStartResponseTaskExecutionStatusStepsPhase = "TASK_EXECUTION_PHASE_RUNNING" - EnvironmentAutomationTaskStartResponseTaskExecutionStatusStepsPhaseTaskExecutionPhaseSucceeded EnvironmentAutomationTaskStartResponseTaskExecutionStatusStepsPhase = "TASK_EXECUTION_PHASE_SUCCEEDED" - EnvironmentAutomationTaskStartResponseTaskExecutionStatusStepsPhaseTaskExecutionPhaseFailed EnvironmentAutomationTaskStartResponseTaskExecutionStatusStepsPhase = "TASK_EXECUTION_PHASE_FAILED" - EnvironmentAutomationTaskStartResponseTaskExecutionStatusStepsPhaseTaskExecutionPhaseStopped EnvironmentAutomationTaskStartResponseTaskExecutionStatusStepsPhase = "TASK_EXECUTION_PHASE_STOPPED" -) - -func (r EnvironmentAutomationTaskStartResponseTaskExecutionStatusStepsPhase) IsKnown() bool { - switch r { - case EnvironmentAutomationTaskStartResponseTaskExecutionStatusStepsPhaseTaskExecutionPhaseUnspecified, EnvironmentAutomationTaskStartResponseTaskExecutionStatusStepsPhaseTaskExecutionPhasePending, EnvironmentAutomationTaskStartResponseTaskExecutionStatusStepsPhaseTaskExecutionPhaseRunning, EnvironmentAutomationTaskStartResponseTaskExecutionStatusStepsPhaseTaskExecutionPhaseSucceeded, EnvironmentAutomationTaskStartResponseTaskExecutionStatusStepsPhaseTaskExecutionPhaseFailed, EnvironmentAutomationTaskStartResponseTaskExecutionStatusStepsPhaseTaskExecutionPhaseStopped: - return true - } - return false -} - -type EnvironmentAutomationTaskNewParams struct { - DependsOn param.Field[[]string] `json:"dependsOn" format:"uuid"` - EnvironmentID param.Field[string] `json:"environmentId" format:"uuid"` - Metadata param.Field[EnvironmentAutomationTaskNewParamsMetadata] `json:"metadata"` - Spec param.Field[EnvironmentAutomationTaskNewParamsSpec] `json:"spec"` -} - -func (r EnvironmentAutomationTaskNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type EnvironmentAutomationTaskNewParamsMetadata 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[EnvironmentAutomationTaskNewParamsMetadataCreator] `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[[]EnvironmentAutomationTaskNewParamsMetadataTriggeredByUnion] `json:"triggeredBy"` -} - -func (r EnvironmentAutomationTaskNewParamsMetadata) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// creator describes the principal who created the task. -type EnvironmentAutomationTaskNewParamsMetadataCreator struct { - // id is the UUID of the subject - ID param.Field[string] `json:"id"` - // Principal is the principal of the subject - Principal param.Field[EnvironmentAutomationTaskNewParamsMetadataCreatorPrincipal] `json:"principal"` -} - -func (r EnvironmentAutomationTaskNewParamsMetadataCreator) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// Principal is the principal of the subject -type EnvironmentAutomationTaskNewParamsMetadataCreatorPrincipal string - -const ( - EnvironmentAutomationTaskNewParamsMetadataCreatorPrincipalPrincipalUnspecified EnvironmentAutomationTaskNewParamsMetadataCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - EnvironmentAutomationTaskNewParamsMetadataCreatorPrincipalPrincipalAccount EnvironmentAutomationTaskNewParamsMetadataCreatorPrincipal = "PRINCIPAL_ACCOUNT" - EnvironmentAutomationTaskNewParamsMetadataCreatorPrincipalPrincipalUser EnvironmentAutomationTaskNewParamsMetadataCreatorPrincipal = "PRINCIPAL_USER" - EnvironmentAutomationTaskNewParamsMetadataCreatorPrincipalPrincipalRunner EnvironmentAutomationTaskNewParamsMetadataCreatorPrincipal = "PRINCIPAL_RUNNER" - EnvironmentAutomationTaskNewParamsMetadataCreatorPrincipalPrincipalEnvironment EnvironmentAutomationTaskNewParamsMetadataCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - EnvironmentAutomationTaskNewParamsMetadataCreatorPrincipalPrincipalServiceAccount EnvironmentAutomationTaskNewParamsMetadataCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r EnvironmentAutomationTaskNewParamsMetadataCreatorPrincipal) IsKnown() bool { - switch r { - case EnvironmentAutomationTaskNewParamsMetadataCreatorPrincipalPrincipalUnspecified, EnvironmentAutomationTaskNewParamsMetadataCreatorPrincipalPrincipalAccount, EnvironmentAutomationTaskNewParamsMetadataCreatorPrincipalPrincipalUser, EnvironmentAutomationTaskNewParamsMetadataCreatorPrincipalPrincipalRunner, EnvironmentAutomationTaskNewParamsMetadataCreatorPrincipalPrincipalEnvironment, EnvironmentAutomationTaskNewParamsMetadataCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - -// An AutomationTrigger represents a trigger for an automation action. The -// `post_environment_start` field indicates that the automation should be triggered -// after the environment has started. The `post_devcontainer_start` field indicates -// that the automation should be triggered after the dev container has started. -type EnvironmentAutomationTaskNewParamsMetadataTriggeredBy struct { - Manual param.Field[bool] `json:"manual"` - PostDevcontainerStart param.Field[bool] `json:"postDevcontainerStart"` - PostEnvironmentStart param.Field[bool] `json:"postEnvironmentStart"` -} - -func (r EnvironmentAutomationTaskNewParamsMetadataTriggeredBy) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationTaskNewParamsMetadataTriggeredBy) implementsEnvironmentAutomationTaskNewParamsMetadataTriggeredByUnion() { -} - -// An AutomationTrigger represents a trigger for an automation action. The -// `post_environment_start` field indicates that the automation should be triggered -// after the environment has started. The `post_devcontainer_start` field indicates -// that the automation should be triggered after the dev container has started. -// -// Satisfied by [EnvironmentAutomationTaskNewParamsMetadataTriggeredByManual], -// [EnvironmentAutomationTaskNewParamsMetadataTriggeredByPostDevcontainerStart], -// [EnvironmentAutomationTaskNewParamsMetadataTriggeredByPostEnvironmentStart], -// [EnvironmentAutomationTaskNewParamsMetadataTriggeredBy]. -type EnvironmentAutomationTaskNewParamsMetadataTriggeredByUnion interface { - implementsEnvironmentAutomationTaskNewParamsMetadataTriggeredByUnion() -} - -type EnvironmentAutomationTaskNewParamsMetadataTriggeredByManual struct { - Manual param.Field[bool] `json:"manual,required"` -} - -func (r EnvironmentAutomationTaskNewParamsMetadataTriggeredByManual) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationTaskNewParamsMetadataTriggeredByManual) implementsEnvironmentAutomationTaskNewParamsMetadataTriggeredByUnion() { -} - -type EnvironmentAutomationTaskNewParamsMetadataTriggeredByPostDevcontainerStart struct { - PostDevcontainerStart param.Field[bool] `json:"postDevcontainerStart,required"` -} - -func (r EnvironmentAutomationTaskNewParamsMetadataTriggeredByPostDevcontainerStart) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationTaskNewParamsMetadataTriggeredByPostDevcontainerStart) implementsEnvironmentAutomationTaskNewParamsMetadataTriggeredByUnion() { -} - -type EnvironmentAutomationTaskNewParamsMetadataTriggeredByPostEnvironmentStart struct { - PostEnvironmentStart param.Field[bool] `json:"postEnvironmentStart,required"` -} - -func (r EnvironmentAutomationTaskNewParamsMetadataTriggeredByPostEnvironmentStart) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationTaskNewParamsMetadataTriggeredByPostEnvironmentStart) implementsEnvironmentAutomationTaskNewParamsMetadataTriggeredByUnion() { -} - -type EnvironmentAutomationTaskNewParamsSpec 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[EnvironmentAutomationTaskNewParamsSpecRunsOn] `json:"runsOn"` -} - -func (r EnvironmentAutomationTaskNewParamsSpec) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// runs_on specifies the environment the task should run on. -type EnvironmentAutomationTaskNewParamsSpecRunsOn struct { - Docker param.Field[EnvironmentAutomationTaskNewParamsSpecRunsOnDocker] `json:"docker,required"` -} - -func (r EnvironmentAutomationTaskNewParamsSpecRunsOn) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type EnvironmentAutomationTaskNewParamsSpecRunsOnDocker struct { - Environment param.Field[[]string] `json:"environment"` - Image param.Field[string] `json:"image"` -} - -func (r EnvironmentAutomationTaskNewParamsSpecRunsOnDocker) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r EnvironmentAutomationTaskNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } type EnvironmentAutomationTaskGetParams struct { @@ -2390,9 +494,9 @@ func (r EnvironmentAutomationTaskGetParams) MarshalJSON() (data []byte, err erro type EnvironmentAutomationTaskUpdateParams struct { ID param.Field[string] `json:"id" format:"uuid"` // dependencies specifies the IDs of the automations this task depends on. - DependsOn param.Field[[]string] `json:"dependsOn" format:"uuid"` - Metadata param.Field[EnvironmentAutomationTaskUpdateParamsMetadataUnion] `json:"metadata"` - Spec param.Field[EnvironmentAutomationTaskUpdateParamsSpecUnion] `json:"spec"` + DependsOn param.Field[[]string] `json:"dependsOn" format:"uuid"` + Metadata param.Field[EnvironmentAutomationTaskUpdateParamsMetadata] `json:"metadata"` + Spec param.Field[EnvironmentAutomationTaskUpdateParamsSpec] `json:"spec"` } func (r EnvironmentAutomationTaskUpdateParams) MarshalJSON() (data []byte, err error) { @@ -2400,189 +504,32 @@ func (r EnvironmentAutomationTaskUpdateParams) MarshalJSON() (data []byte, err e } type EnvironmentAutomationTaskUpdateParamsMetadata struct { - Description param.Field[string] `json:"description"` - Name param.Field[string] `json:"name"` - TriggeredBy param.Field[interface{}] `json:"triggeredBy"` + Description param.Field[string] `json:"description"` + Name param.Field[string] `json:"name"` + TriggeredBy param.Field[EnvironmentAutomationTaskUpdateParamsMetadataTriggeredBy] `json:"triggeredBy"` } func (r EnvironmentAutomationTaskUpdateParamsMetadata) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r EnvironmentAutomationTaskUpdateParamsMetadata) implementsEnvironmentAutomationTaskUpdateParamsMetadataUnion() { -} - -// Satisfied by [EnvironmentAutomationTaskUpdateParamsMetadataDescription], -// [EnvironmentAutomationTaskUpdateParamsMetadataName], -// [EnvironmentAutomationTaskUpdateParamsMetadataTriggeredBy], -// [EnvironmentAutomationTaskUpdateParamsMetadata]. -type EnvironmentAutomationTaskUpdateParamsMetadataUnion interface { - implementsEnvironmentAutomationTaskUpdateParamsMetadataUnion() -} - -type EnvironmentAutomationTaskUpdateParamsMetadataDescription struct { - Description param.Field[string] `json:"description,required"` -} - -func (r EnvironmentAutomationTaskUpdateParamsMetadataDescription) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationTaskUpdateParamsMetadataDescription) implementsEnvironmentAutomationTaskUpdateParamsMetadataUnion() { -} - -type EnvironmentAutomationTaskUpdateParamsMetadataName struct { - Name param.Field[string] `json:"name,required"` -} - -func (r EnvironmentAutomationTaskUpdateParamsMetadataName) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationTaskUpdateParamsMetadataName) implementsEnvironmentAutomationTaskUpdateParamsMetadataUnion() { -} - type EnvironmentAutomationTaskUpdateParamsMetadataTriggeredBy struct { - TriggeredBy param.Field[EnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredBy] `json:"triggeredBy,required"` + Trigger param.Field[[]shared.AutomationTriggerParam] `json:"trigger"` } func (r EnvironmentAutomationTaskUpdateParamsMetadataTriggeredBy) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r EnvironmentAutomationTaskUpdateParamsMetadataTriggeredBy) implementsEnvironmentAutomationTaskUpdateParamsMetadataUnion() { -} - -type EnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredBy struct { - Trigger param.Field[[]EnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredByTriggerUnion] `json:"trigger"` -} - -func (r EnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredBy) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// An AutomationTrigger represents a trigger for an automation action. The -// `post_environment_start` field indicates that the automation should be triggered -// after the environment has started. The `post_devcontainer_start` field indicates -// that the automation should be triggered after the dev container has started. -type EnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredByTrigger struct { - Manual param.Field[bool] `json:"manual"` - PostDevcontainerStart param.Field[bool] `json:"postDevcontainerStart"` - PostEnvironmentStart param.Field[bool] `json:"postEnvironmentStart"` -} - -func (r EnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredByTrigger) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredByTrigger) implementsEnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredByTriggerUnion() { -} - -// An AutomationTrigger represents a trigger for an automation action. The -// `post_environment_start` field indicates that the automation should be triggered -// after the environment has started. The `post_devcontainer_start` field indicates -// that the automation should be triggered after the dev container has started. -// -// Satisfied by -// [EnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredByTriggerManual], -// [EnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredByTriggerPostDevcontainerStart], -// [EnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredByTriggerPostEnvironmentStart], -// [EnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredByTrigger]. -type EnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredByTriggerUnion interface { - implementsEnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredByTriggerUnion() -} - -type EnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredByTriggerManual struct { - Manual param.Field[bool] `json:"manual,required"` -} - -func (r EnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredByTriggerManual) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredByTriggerManual) implementsEnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredByTriggerUnion() { -} - -type EnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredByTriggerPostDevcontainerStart struct { - PostDevcontainerStart param.Field[bool] `json:"postDevcontainerStart,required"` -} - -func (r EnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredByTriggerPostDevcontainerStart) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredByTriggerPostDevcontainerStart) implementsEnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredByTriggerUnion() { -} - -type EnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredByTriggerPostEnvironmentStart struct { - PostEnvironmentStart param.Field[bool] `json:"postEnvironmentStart,required"` -} - -func (r EnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredByTriggerPostEnvironmentStart) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredByTriggerPostEnvironmentStart) implementsEnvironmentAutomationTaskUpdateParamsMetadataTriggeredByTriggeredByTriggerUnion() { -} - type EnvironmentAutomationTaskUpdateParamsSpec struct { - Command param.Field[string] `json:"command"` - RunsOn param.Field[interface{}] `json:"runsOn"` + Command param.Field[string] `json:"command"` + RunsOn param.Field[shared.RunsOnParam] `json:"runsOn"` } func (r EnvironmentAutomationTaskUpdateParamsSpec) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r EnvironmentAutomationTaskUpdateParamsSpec) implementsEnvironmentAutomationTaskUpdateParamsSpecUnion() { -} - -// Satisfied by [EnvironmentAutomationTaskUpdateParamsSpecCommand], -// [EnvironmentAutomationTaskUpdateParamsSpecRunsOn], -// [EnvironmentAutomationTaskUpdateParamsSpec]. -type EnvironmentAutomationTaskUpdateParamsSpecUnion interface { - implementsEnvironmentAutomationTaskUpdateParamsSpecUnion() -} - -type EnvironmentAutomationTaskUpdateParamsSpecCommand struct { - Command param.Field[string] `json:"command,required"` -} - -func (r EnvironmentAutomationTaskUpdateParamsSpecCommand) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationTaskUpdateParamsSpecCommand) implementsEnvironmentAutomationTaskUpdateParamsSpecUnion() { -} - -type EnvironmentAutomationTaskUpdateParamsSpecRunsOn struct { - RunsOn param.Field[EnvironmentAutomationTaskUpdateParamsSpecRunsOnRunsOn] `json:"runsOn,required"` -} - -func (r EnvironmentAutomationTaskUpdateParamsSpecRunsOn) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EnvironmentAutomationTaskUpdateParamsSpecRunsOn) implementsEnvironmentAutomationTaskUpdateParamsSpecUnion() { -} - -type EnvironmentAutomationTaskUpdateParamsSpecRunsOnRunsOn struct { - Docker param.Field[EnvironmentAutomationTaskUpdateParamsSpecRunsOnRunsOnDocker] `json:"docker,required"` -} - -func (r EnvironmentAutomationTaskUpdateParamsSpecRunsOnRunsOn) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type EnvironmentAutomationTaskUpdateParamsSpecRunsOnRunsOnDocker struct { - Environment param.Field[[]string] `json:"environment"` - Image param.Field[string] `json:"image"` -} - -func (r EnvironmentAutomationTaskUpdateParamsSpecRunsOnRunsOnDocker) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - type EnvironmentAutomationTaskListParams struct { Token param.Field[string] `query:"token"` PageSize param.Field[int64] `query:"pageSize"` diff --git a/environmentautomationtask_test.go b/environmentautomationtask_test.go index b59bf85..fea2171 100644 --- a/environmentautomationtask_test.go +++ b/environmentautomationtask_test.go @@ -12,6 +12,7 @@ import ( "github.com/gitpod-io/flex-sdk-go" "github.com/gitpod-io/flex-sdk-go/internal/testutil" "github.com/gitpod-io/flex-sdk-go/option" + "github.com/gitpod-io/flex-sdk-go/shared" ) func TestEnvironmentAutomationTaskNewWithOptionalParams(t *testing.T) { @@ -30,23 +31,25 @@ 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.EnvironmentAutomationTaskNewParamsMetadata{ + Metadata: gitpod.F(gitpod.TaskMetadataParam{ CreatedAt: gitpod.F(time.Now()), - Creator: gitpod.F(gitpod.EnvironmentAutomationTaskNewParamsMetadataCreator{ + Creator: gitpod.F(shared.SubjectParam{ ID: gitpod.F("id"), - Principal: gitpod.F(gitpod.EnvironmentAutomationTaskNewParamsMetadataCreatorPrincipalPrincipalUnspecified), + Principal: gitpod.F(shared.PrincipalPrincipalUnspecified), }), Description: gitpod.F("description"), Name: gitpod.F("x"), Reference: gitpod.F("reference"), - TriggeredBy: gitpod.F([]gitpod.EnvironmentAutomationTaskNewParamsMetadataTriggeredByUnion{gitpod.EnvironmentAutomationTaskNewParamsMetadataTriggeredByManual{ - Manual: gitpod.F(true), + TriggeredBy: gitpod.F([]shared.AutomationTriggerParam{{ + Manual: gitpod.F(true), + PostDevcontainerStart: gitpod.F(true), + PostEnvironmentStart: gitpod.F(true), }}), }), - Spec: gitpod.F(gitpod.EnvironmentAutomationTaskNewParamsSpec{ + Spec: gitpod.F(gitpod.TaskSpecParam{ Command: gitpod.F("command"), - RunsOn: gitpod.F(gitpod.EnvironmentAutomationTaskNewParamsSpecRunsOn{ - Docker: gitpod.F(gitpod.EnvironmentAutomationTaskNewParamsSpecRunsOnDocker{ + RunsOn: gitpod.F(shared.RunsOnParam{ + Docker: gitpod.F(shared.RunsOnDockerParam{ Environment: gitpod.F([]string{"string"}), Image: gitpod.F("x"), }), @@ -103,11 +106,25 @@ func TestEnvironmentAutomationTaskUpdateWithOptionalParams(t *testing.T) { _, err := client.Environments.Automations.Tasks.Update(context.TODO(), gitpod.EnvironmentAutomationTaskUpdateParams{ ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), DependsOn: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), - Metadata: gitpod.F[gitpod.EnvironmentAutomationTaskUpdateParamsMetadataUnion](gitpod.EnvironmentAutomationTaskUpdateParamsMetadataDescription{ + Metadata: gitpod.F(gitpod.EnvironmentAutomationTaskUpdateParamsMetadata{ Description: gitpod.F("description"), + Name: gitpod.F("x"), + TriggeredBy: gitpod.F(gitpod.EnvironmentAutomationTaskUpdateParamsMetadataTriggeredBy{ + Trigger: gitpod.F([]shared.AutomationTriggerParam{{ + Manual: gitpod.F(true), + PostDevcontainerStart: gitpod.F(true), + PostEnvironmentStart: gitpod.F(true), + }}), + }), }), - Spec: gitpod.F[gitpod.EnvironmentAutomationTaskUpdateParamsSpecUnion](gitpod.EnvironmentAutomationTaskUpdateParamsSpecCommand{ + Spec: gitpod.F(gitpod.EnvironmentAutomationTaskUpdateParamsSpec{ Command: gitpod.F("command"), + RunsOn: gitpod.F(shared.RunsOnParam{ + Docker: gitpod.F(shared.RunsOnDockerParam{ + Environment: gitpod.F([]string{"string"}), + Image: gitpod.F("x"), + }), + }), }), }) if err != nil { diff --git a/environmentautomationtaskexecution.go b/environmentautomationtaskexecution.go index ff70f83..f939f9a 100644 --- a/environmentautomationtaskexecution.go +++ b/environmentautomationtaskexecution.go @@ -6,8 +6,6 @@ import ( "context" "net/http" "net/url" - "reflect" - "time" "github.com/gitpod-io/flex-sdk-go/internal/apijson" "github.com/gitpod-io/flex-sdk-go/internal/apiquery" @@ -15,7 +13,7 @@ import ( "github.com/gitpod-io/flex-sdk-go/internal/requestconfig" "github.com/gitpod-io/flex-sdk-go/option" "github.com/gitpod-io/flex-sdk-go/packages/pagination" - "github.com/tidwall/gjson" + "github.com/gitpod-io/flex-sdk-go/shared" ) // EnvironmentAutomationTaskExecutionService contains methods and other services @@ -47,7 +45,7 @@ func (r *EnvironmentAutomationTaskExecutionService) Get(ctx context.Context, bod } // ListTaskExecutions -func (r *EnvironmentAutomationTaskExecutionService) List(ctx context.Context, params EnvironmentAutomationTaskExecutionListParams, opts ...option.RequestOption) (res *pagination.TaskExecutionsPage[EnvironmentAutomationTaskExecutionListResponse], err error) { +func (r *EnvironmentAutomationTaskExecutionService) List(ctx context.Context, params EnvironmentAutomationTaskExecutionListParams, opts ...option.RequestOption) (res *pagination.TaskExecutionsPage[shared.TaskExecution], err error) { var raw *http.Response opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -65,7 +63,7 @@ func (r *EnvironmentAutomationTaskExecutionService) List(ctx context.Context, pa } // ListTaskExecutions -func (r *EnvironmentAutomationTaskExecutionService) ListAutoPaging(ctx context.Context, params EnvironmentAutomationTaskExecutionListParams, opts ...option.RequestOption) *pagination.TaskExecutionsPageAutoPager[EnvironmentAutomationTaskExecutionListResponse] { +func (r *EnvironmentAutomationTaskExecutionService) ListAutoPaging(ctx context.Context, params EnvironmentAutomationTaskExecutionListParams, opts ...option.RequestOption) *pagination.TaskExecutionsPageAutoPager[shared.TaskExecution] { return pagination.NewTaskExecutionsPageAutoPager(r.List(ctx, params, opts...)) } @@ -78,8 +76,8 @@ func (r *EnvironmentAutomationTaskExecutionService) Stop(ctx context.Context, bo } type EnvironmentAutomationTaskExecutionGetResponse struct { - TaskExecution EnvironmentAutomationTaskExecutionGetResponseTaskExecution `json:"taskExecution"` - JSON environmentAutomationTaskExecutionGetResponseJSON `json:"-"` + TaskExecution shared.TaskExecution `json:"taskExecution"` + JSON environmentAutomationTaskExecutionGetResponseJSON `json:"-"` } // environmentAutomationTaskExecutionGetResponseJSON contains the JSON metadata for @@ -98,1336 +96,6 @@ func (r environmentAutomationTaskExecutionGetResponseJSON) RawJSON() string { return r.raw } -type EnvironmentAutomationTaskExecutionGetResponseTaskExecution struct { - ID string `json:"id" format:"uuid"` - Metadata EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadata `json:"metadata"` - Spec EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpec `json:"spec"` - Status EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatus `json:"status"` - JSON environmentAutomationTaskExecutionGetResponseTaskExecutionJSON `json:"-"` -} - -// environmentAutomationTaskExecutionGetResponseTaskExecutionJSON contains the JSON -// metadata for the struct -// [EnvironmentAutomationTaskExecutionGetResponseTaskExecution] -type environmentAutomationTaskExecutionGetResponseTaskExecutionJSON struct { - ID apijson.Field - Metadata apijson.Field - Spec apijson.Field - Status apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskExecutionGetResponseTaskExecution) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskExecutionGetResponseTaskExecutionJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadata 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. - CompletedAt time.Time `json:"completedAt" format:"date-time"` - // 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/started the task run. - Creator EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreator `json:"creator"` - // environment_id is the ID of the environment in which the task run is executed. - EnvironmentID string `json:"environmentId" format:"uuid"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - StartedAt time.Time `json:"startedAt" format:"date-time"` - // started_by describes the trigger that started the task execution. - StartedBy string `json:"startedBy"` - // task_id is the ID of the main task being executed. - TaskID string `json:"taskId" format:"uuid"` - JSON environmentAutomationTaskExecutionGetResponseTaskExecutionMetadataJSON `json:"-"` -} - -// environmentAutomationTaskExecutionGetResponseTaskExecutionMetadataJSON contains -// the JSON metadata for the struct -// [EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadata] -type environmentAutomationTaskExecutionGetResponseTaskExecutionMetadataJSON struct { - CompletedAt apijson.Field - CreatedAt apijson.Field - Creator apijson.Field - EnvironmentID apijson.Field - StartedAt apijson.Field - StartedBy apijson.Field - TaskID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadata) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskExecutionGetResponseTaskExecutionMetadataJSON) RawJSON() string { - return r.raw -} - -// creator describes the principal who created/started the task run. -type EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorPrincipal `json:"principal"` - JSON environmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorJSON `json:"-"` -} - -// environmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorJSON -// contains the JSON metadata for the struct -// [EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreator] -type environmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreator) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorJSON) RawJSON() string { - return r.raw -} - -// Principal is the principal of the subject -type EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorPrincipal string - -const ( - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorPrincipalPrincipalUnspecified EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorPrincipalPrincipalAccount EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorPrincipal = "PRINCIPAL_ACCOUNT" - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorPrincipalPrincipalUser EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorPrincipal = "PRINCIPAL_USER" - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorPrincipalPrincipalRunner EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorPrincipal = "PRINCIPAL_RUNNER" - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorPrincipalPrincipalEnvironment EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorPrincipalPrincipalServiceAccount EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorPrincipal) IsKnown() bool { - switch r { - case EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorPrincipalPrincipalUnspecified, EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorPrincipalPrincipalAccount, EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorPrincipalPrincipalUser, EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorPrincipalPrincipalRunner, EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorPrincipalPrincipalEnvironment, EnvironmentAutomationTaskExecutionGetResponseTaskExecutionMetadataCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - -type EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpec struct { - // desired_phase is the phase the task execution should be in. Used to stop a - // running task execution early. - DesiredPhase EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecDesiredPhase `json:"desiredPhase"` - // plan is a list of groups of steps. The steps in a group are executed - // concurrently, while the groups are executed sequentially. The order of the - // groups is the order in which they are executed. - Plan []EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlan `json:"plan"` - JSON environmentAutomationTaskExecutionGetResponseTaskExecutionSpecJSON `json:"-"` -} - -// environmentAutomationTaskExecutionGetResponseTaskExecutionSpecJSON contains the -// JSON metadata for the struct -// [EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpec] -type environmentAutomationTaskExecutionGetResponseTaskExecutionSpecJSON struct { - DesiredPhase apijson.Field - Plan apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpec) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskExecutionGetResponseTaskExecutionSpecJSON) RawJSON() string { - return r.raw -} - -// desired_phase is the phase the task execution should be in. Used to stop a -// running task execution early. -type EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecDesiredPhase string - -const ( - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhaseUnspecified EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecDesiredPhase = "TASK_EXECUTION_PHASE_UNSPECIFIED" - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhasePending EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecDesiredPhase = "TASK_EXECUTION_PHASE_PENDING" - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhaseRunning EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecDesiredPhase = "TASK_EXECUTION_PHASE_RUNNING" - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhaseSucceeded EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecDesiredPhase = "TASK_EXECUTION_PHASE_SUCCEEDED" - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhaseFailed EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecDesiredPhase = "TASK_EXECUTION_PHASE_FAILED" - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhaseStopped EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecDesiredPhase = "TASK_EXECUTION_PHASE_STOPPED" -) - -func (r EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecDesiredPhase) IsKnown() bool { - switch r { - case EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhaseUnspecified, EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhasePending, EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhaseRunning, EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhaseSucceeded, EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhaseFailed, EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecDesiredPhaseTaskExecutionPhaseStopped: - return true - } - return false -} - -type EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlan struct { - Steps []EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStep `json:"steps"` - JSON environmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanJSON `json:"-"` -} - -// environmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanJSON contains -// the JSON metadata for the struct -// [EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlan] -type environmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanJSON struct { - Steps apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlan) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStep struct { - // ID is the ID of the execution step - ID string `json:"id" format:"uuid"` - // This field can have the runtime type of [[]string]. - DependsOn interface{} `json:"dependsOn"` - Label string `json:"label"` - ServiceID string `json:"serviceId" format:"uuid"` - // This field can have the runtime type of - // [EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepsObjectTask]. - Task interface{} `json:"task"` - JSON environmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepJSON `json:"-"` - union EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepsUnion -} - -// environmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepJSON -// contains the JSON metadata for the struct -// [EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStep] -type environmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepJSON struct { - ID apijson.Field - DependsOn apijson.Field - Label apijson.Field - ServiceID apijson.Field - Task apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r environmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepJSON) RawJSON() string { - return r.raw -} - -func (r *EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStep) UnmarshalJSON(data []byte) (err error) { - *r = EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStep{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a -// [EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepsUnion] -// interface which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepsObject], -// [EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepsObject]. -func (r EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStep) AsUnion() EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepsUnion { - return r.union -} - -// Union satisfied by -// [EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepsObject] -// or -// [EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepsObject]. -type EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepsUnion interface { - implementsEnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStep() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepsUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepsObject{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepsObject{}), - }, - ) -} - -type EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepsObject struct { - ServiceID string `json:"serviceId,required" format:"uuid"` - // ID is the ID of the execution step - ID string `json:"id" format:"uuid"` - DependsOn []string `json:"dependsOn"` - Label string `json:"label"` - JSON environmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepsObjectJSON `json:"-"` -} - -// environmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepsObjectJSON -// contains the JSON metadata for the struct -// [EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepsObject] -type environmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepsObjectJSON struct { - ServiceID apijson.Field - ID apijson.Field - DependsOn apijson.Field - Label apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepsObject) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepsObjectJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStepsObject) implementsEnvironmentAutomationTaskExecutionGetResponseTaskExecutionSpecPlanStep() { -} - -type EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatus struct { - // failure_message summarises why the task execution failed to operate. If this is - // non-empty the task execution has failed to operate and will likely transition to - // a failed state. - FailureMessage string `json:"failureMessage"` - // log_url is the URL to the logs of the task's steps. If this is empty, the task - // either has no logs or has not yet started. - LogURL string `json:"logUrl"` - // the phase of a task execution represents the aggregated phase of all steps. - Phase EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusPhase `json:"phase"` - // version of the status update. Task executions themselves are unversioned, but - // their status has different versions. The value of this field has no semantic - // meaning (e.g. don't interpret it as as a timestamp), but it can be used to - // impose a partial order. If a.status_version < b.status_version then a was the - // status before b. - StatusVersion string `json:"statusVersion"` - // steps provides the status for each individual step of the task execution. If a - // step is missing it has not yet started. - Steps []EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStep `json:"steps"` - JSON environmentAutomationTaskExecutionGetResponseTaskExecutionStatusJSON `json:"-"` -} - -// environmentAutomationTaskExecutionGetResponseTaskExecutionStatusJSON contains -// the JSON metadata for the struct -// [EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatus] -type environmentAutomationTaskExecutionGetResponseTaskExecutionStatusJSON struct { - FailureMessage apijson.Field - LogURL apijson.Field - Phase apijson.Field - StatusVersion apijson.Field - Steps apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatus) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskExecutionGetResponseTaskExecutionStatusJSON) RawJSON() string { - return r.raw -} - -// the phase of a task execution represents the aggregated phase of all steps. -type EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusPhase string - -const ( - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusPhaseTaskExecutionPhaseUnspecified EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusPhase = "TASK_EXECUTION_PHASE_UNSPECIFIED" - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusPhaseTaskExecutionPhasePending EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusPhase = "TASK_EXECUTION_PHASE_PENDING" - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusPhaseTaskExecutionPhaseRunning EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusPhase = "TASK_EXECUTION_PHASE_RUNNING" - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusPhaseTaskExecutionPhaseSucceeded EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusPhase = "TASK_EXECUTION_PHASE_SUCCEEDED" - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusPhaseTaskExecutionPhaseFailed EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusPhase = "TASK_EXECUTION_PHASE_FAILED" - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusPhaseTaskExecutionPhaseStopped EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusPhase = "TASK_EXECUTION_PHASE_STOPPED" -) - -func (r EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusPhase) IsKnown() bool { - switch r { - case EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusPhaseTaskExecutionPhaseUnspecified, EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusPhaseTaskExecutionPhasePending, EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusPhaseTaskExecutionPhaseRunning, EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusPhaseTaskExecutionPhaseSucceeded, EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusPhaseTaskExecutionPhaseFailed, EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusPhaseTaskExecutionPhaseStopped: - return true - } - return false -} - -type EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStep struct { - // ID is the ID of the execution step - ID string `json:"id" format:"uuid"` - // failure_message summarises why the step failed to operate. If this is non-empty - // the step has failed to operate and will likely transition to a failed state. - FailureMessage string `json:"failureMessage"` - // phase is the current phase of the execution step - Phase EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepsPhase `json:"phase"` - JSON environmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepJSON `json:"-"` -} - -// environmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepJSON -// contains the JSON metadata for the struct -// [EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStep] -type environmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepJSON struct { - ID apijson.Field - FailureMessage apijson.Field - Phase apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStep) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepJSON) RawJSON() string { - return r.raw -} - -// phase is the current phase of the execution step -type EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepsPhase string - -const ( - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepsPhaseTaskExecutionPhaseUnspecified EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepsPhase = "TASK_EXECUTION_PHASE_UNSPECIFIED" - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepsPhaseTaskExecutionPhasePending EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepsPhase = "TASK_EXECUTION_PHASE_PENDING" - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepsPhaseTaskExecutionPhaseRunning EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepsPhase = "TASK_EXECUTION_PHASE_RUNNING" - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepsPhaseTaskExecutionPhaseSucceeded EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepsPhase = "TASK_EXECUTION_PHASE_SUCCEEDED" - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepsPhaseTaskExecutionPhaseFailed EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepsPhase = "TASK_EXECUTION_PHASE_FAILED" - EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepsPhaseTaskExecutionPhaseStopped EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepsPhase = "TASK_EXECUTION_PHASE_STOPPED" -) - -func (r EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepsPhase) IsKnown() bool { - switch r { - case EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepsPhaseTaskExecutionPhaseUnspecified, EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepsPhaseTaskExecutionPhasePending, EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepsPhaseTaskExecutionPhaseRunning, EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepsPhaseTaskExecutionPhaseSucceeded, EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepsPhaseTaskExecutionPhaseFailed, EnvironmentAutomationTaskExecutionGetResponseTaskExecutionStatusStepsPhaseTaskExecutionPhaseStopped: - return true - } - return false -} - -type EnvironmentAutomationTaskExecutionListResponse struct { - ID string `json:"id" format:"uuid"` - Metadata EnvironmentAutomationTaskExecutionListResponseMetadata `json:"metadata"` - Spec EnvironmentAutomationTaskExecutionListResponseSpec `json:"spec"` - Status EnvironmentAutomationTaskExecutionListResponseStatus `json:"status"` - JSON environmentAutomationTaskExecutionListResponseJSON `json:"-"` -} - -// environmentAutomationTaskExecutionListResponseJSON contains the JSON metadata -// for the struct [EnvironmentAutomationTaskExecutionListResponse] -type environmentAutomationTaskExecutionListResponseJSON struct { - ID apijson.Field - Metadata apijson.Field - Spec apijson.Field - Status apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskExecutionListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskExecutionListResponseJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationTaskExecutionListResponseMetadata 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. - CompletedAt time.Time `json:"completedAt" format:"date-time"` - // 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/started the task run. - Creator EnvironmentAutomationTaskExecutionListResponseMetadataCreator `json:"creator"` - // environment_id is the ID of the environment in which the task run is executed. - EnvironmentID string `json:"environmentId" format:"uuid"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - StartedAt time.Time `json:"startedAt" format:"date-time"` - // started_by describes the trigger that started the task execution. - StartedBy string `json:"startedBy"` - // task_id is the ID of the main task being executed. - TaskID string `json:"taskId" format:"uuid"` - JSON environmentAutomationTaskExecutionListResponseMetadataJSON `json:"-"` -} - -// environmentAutomationTaskExecutionListResponseMetadataJSON contains the JSON -// metadata for the struct [EnvironmentAutomationTaskExecutionListResponseMetadata] -type environmentAutomationTaskExecutionListResponseMetadataJSON struct { - CompletedAt apijson.Field - CreatedAt apijson.Field - Creator apijson.Field - EnvironmentID apijson.Field - StartedAt apijson.Field - StartedBy apijson.Field - TaskID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskExecutionListResponseMetadata) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskExecutionListResponseMetadataJSON) RawJSON() string { - return r.raw -} - -// creator describes the principal who created/started the task run. -type EnvironmentAutomationTaskExecutionListResponseMetadataCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal EnvironmentAutomationTaskExecutionListResponseMetadataCreatorPrincipal `json:"principal"` - JSON environmentAutomationTaskExecutionListResponseMetadataCreatorJSON `json:"-"` -} - -// environmentAutomationTaskExecutionListResponseMetadataCreatorJSON contains the -// JSON metadata for the struct -// [EnvironmentAutomationTaskExecutionListResponseMetadataCreator] -type environmentAutomationTaskExecutionListResponseMetadataCreatorJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskExecutionListResponseMetadataCreator) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskExecutionListResponseMetadataCreatorJSON) RawJSON() string { - return r.raw -} - -// Principal is the principal of the subject -type EnvironmentAutomationTaskExecutionListResponseMetadataCreatorPrincipal string - -const ( - EnvironmentAutomationTaskExecutionListResponseMetadataCreatorPrincipalPrincipalUnspecified EnvironmentAutomationTaskExecutionListResponseMetadataCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - EnvironmentAutomationTaskExecutionListResponseMetadataCreatorPrincipalPrincipalAccount EnvironmentAutomationTaskExecutionListResponseMetadataCreatorPrincipal = "PRINCIPAL_ACCOUNT" - EnvironmentAutomationTaskExecutionListResponseMetadataCreatorPrincipalPrincipalUser EnvironmentAutomationTaskExecutionListResponseMetadataCreatorPrincipal = "PRINCIPAL_USER" - EnvironmentAutomationTaskExecutionListResponseMetadataCreatorPrincipalPrincipalRunner EnvironmentAutomationTaskExecutionListResponseMetadataCreatorPrincipal = "PRINCIPAL_RUNNER" - EnvironmentAutomationTaskExecutionListResponseMetadataCreatorPrincipalPrincipalEnvironment EnvironmentAutomationTaskExecutionListResponseMetadataCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - EnvironmentAutomationTaskExecutionListResponseMetadataCreatorPrincipalPrincipalServiceAccount EnvironmentAutomationTaskExecutionListResponseMetadataCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r EnvironmentAutomationTaskExecutionListResponseMetadataCreatorPrincipal) IsKnown() bool { - switch r { - case EnvironmentAutomationTaskExecutionListResponseMetadataCreatorPrincipalPrincipalUnspecified, EnvironmentAutomationTaskExecutionListResponseMetadataCreatorPrincipalPrincipalAccount, EnvironmentAutomationTaskExecutionListResponseMetadataCreatorPrincipalPrincipalUser, EnvironmentAutomationTaskExecutionListResponseMetadataCreatorPrincipalPrincipalRunner, EnvironmentAutomationTaskExecutionListResponseMetadataCreatorPrincipalPrincipalEnvironment, EnvironmentAutomationTaskExecutionListResponseMetadataCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - -type EnvironmentAutomationTaskExecutionListResponseSpec struct { - // desired_phase is the phase the task execution should be in. Used to stop a - // running task execution early. - DesiredPhase EnvironmentAutomationTaskExecutionListResponseSpecDesiredPhase `json:"desiredPhase"` - // plan is a list of groups of steps. The steps in a group are executed - // concurrently, while the groups are executed sequentially. The order of the - // groups is the order in which they are executed. - Plan []EnvironmentAutomationTaskExecutionListResponseSpecPlan `json:"plan"` - JSON environmentAutomationTaskExecutionListResponseSpecJSON `json:"-"` -} - -// environmentAutomationTaskExecutionListResponseSpecJSON contains the JSON -// metadata for the struct [EnvironmentAutomationTaskExecutionListResponseSpec] -type environmentAutomationTaskExecutionListResponseSpecJSON struct { - DesiredPhase apijson.Field - Plan apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskExecutionListResponseSpec) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskExecutionListResponseSpecJSON) RawJSON() string { - return r.raw -} - -// desired_phase is the phase the task execution should be in. Used to stop a -// running task execution early. -type EnvironmentAutomationTaskExecutionListResponseSpecDesiredPhase string - -const ( - EnvironmentAutomationTaskExecutionListResponseSpecDesiredPhaseTaskExecutionPhaseUnspecified EnvironmentAutomationTaskExecutionListResponseSpecDesiredPhase = "TASK_EXECUTION_PHASE_UNSPECIFIED" - EnvironmentAutomationTaskExecutionListResponseSpecDesiredPhaseTaskExecutionPhasePending EnvironmentAutomationTaskExecutionListResponseSpecDesiredPhase = "TASK_EXECUTION_PHASE_PENDING" - EnvironmentAutomationTaskExecutionListResponseSpecDesiredPhaseTaskExecutionPhaseRunning EnvironmentAutomationTaskExecutionListResponseSpecDesiredPhase = "TASK_EXECUTION_PHASE_RUNNING" - EnvironmentAutomationTaskExecutionListResponseSpecDesiredPhaseTaskExecutionPhaseSucceeded EnvironmentAutomationTaskExecutionListResponseSpecDesiredPhase = "TASK_EXECUTION_PHASE_SUCCEEDED" - EnvironmentAutomationTaskExecutionListResponseSpecDesiredPhaseTaskExecutionPhaseFailed EnvironmentAutomationTaskExecutionListResponseSpecDesiredPhase = "TASK_EXECUTION_PHASE_FAILED" - EnvironmentAutomationTaskExecutionListResponseSpecDesiredPhaseTaskExecutionPhaseStopped EnvironmentAutomationTaskExecutionListResponseSpecDesiredPhase = "TASK_EXECUTION_PHASE_STOPPED" -) - -func (r EnvironmentAutomationTaskExecutionListResponseSpecDesiredPhase) IsKnown() bool { - switch r { - case EnvironmentAutomationTaskExecutionListResponseSpecDesiredPhaseTaskExecutionPhaseUnspecified, EnvironmentAutomationTaskExecutionListResponseSpecDesiredPhaseTaskExecutionPhasePending, EnvironmentAutomationTaskExecutionListResponseSpecDesiredPhaseTaskExecutionPhaseRunning, EnvironmentAutomationTaskExecutionListResponseSpecDesiredPhaseTaskExecutionPhaseSucceeded, EnvironmentAutomationTaskExecutionListResponseSpecDesiredPhaseTaskExecutionPhaseFailed, EnvironmentAutomationTaskExecutionListResponseSpecDesiredPhaseTaskExecutionPhaseStopped: - return true - } - return false -} - -type EnvironmentAutomationTaskExecutionListResponseSpecPlan struct { - Steps []EnvironmentAutomationTaskExecutionListResponseSpecPlanStep `json:"steps"` - JSON environmentAutomationTaskExecutionListResponseSpecPlanJSON `json:"-"` -} - -// environmentAutomationTaskExecutionListResponseSpecPlanJSON contains the JSON -// metadata for the struct [EnvironmentAutomationTaskExecutionListResponseSpecPlan] -type environmentAutomationTaskExecutionListResponseSpecPlanJSON struct { - Steps apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskExecutionListResponseSpecPlan) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskExecutionListResponseSpecPlanJSON) RawJSON() string { - return r.raw -} - -type EnvironmentAutomationTaskExecutionListResponseSpecPlanStep struct { - // ID is the ID of the execution step - ID string `json:"id" format:"uuid"` - // This field can have the runtime type of [[]string]. - DependsOn interface{} `json:"dependsOn"` - Label string `json:"label"` - ServiceID string `json:"serviceId" format:"uuid"` - // This field can have the runtime type of - // [EnvironmentAutomationTaskExecutionListResponseSpecPlanStepsObjectTask]. - Task interface{} `json:"task"` - JSON environmentAutomationTaskExecutionListResponseSpecPlanStepJSON `json:"-"` - union EnvironmentAutomationTaskExecutionListResponseSpecPlanStepsUnion -} - -// environmentAutomationTaskExecutionListResponseSpecPlanStepJSON contains the JSON -// metadata for the struct -// [EnvironmentAutomationTaskExecutionListResponseSpecPlanStep] -type environmentAutomationTaskExecutionListResponseSpecPlanStepJSON struct { - ID apijson.Field - DependsOn apijson.Field - Label apijson.Field - ServiceID apijson.Field - Task apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r environmentAutomationTaskExecutionListResponseSpecPlanStepJSON) RawJSON() string { - return r.raw -} - -func (r *EnvironmentAutomationTaskExecutionListResponseSpecPlanStep) UnmarshalJSON(data []byte) (err error) { - *r = EnvironmentAutomationTaskExecutionListResponseSpecPlanStep{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a -// [EnvironmentAutomationTaskExecutionListResponseSpecPlanStepsUnion] interface -// which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [EnvironmentAutomationTaskExecutionListResponseSpecPlanStepsObject], -// [EnvironmentAutomationTaskExecutionListResponseSpecPlanStepsObject]. -func (r EnvironmentAutomationTaskExecutionListResponseSpecPlanStep) AsUnion() EnvironmentAutomationTaskExecutionListResponseSpecPlanStepsUnion { - return r.union -} - -// Union satisfied by -// [EnvironmentAutomationTaskExecutionListResponseSpecPlanStepsObject] or -// [EnvironmentAutomationTaskExecutionListResponseSpecPlanStepsObject]. -type EnvironmentAutomationTaskExecutionListResponseSpecPlanStepsUnion interface { - implementsEnvironmentAutomationTaskExecutionListResponseSpecPlanStep() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*EnvironmentAutomationTaskExecutionListResponseSpecPlanStepsUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationTaskExecutionListResponseSpecPlanStepsObject{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EnvironmentAutomationTaskExecutionListResponseSpecPlanStepsObject{}), - }, - ) -} - -type EnvironmentAutomationTaskExecutionListResponseSpecPlanStepsObject struct { - ServiceID string `json:"serviceId,required" format:"uuid"` - // ID is the ID of the execution step - ID string `json:"id" format:"uuid"` - DependsOn []string `json:"dependsOn"` - Label string `json:"label"` - JSON environmentAutomationTaskExecutionListResponseSpecPlanStepsObjectJSON `json:"-"` -} - -// environmentAutomationTaskExecutionListResponseSpecPlanStepsObjectJSON contains -// the JSON metadata for the struct -// [EnvironmentAutomationTaskExecutionListResponseSpecPlanStepsObject] -type environmentAutomationTaskExecutionListResponseSpecPlanStepsObjectJSON struct { - ServiceID apijson.Field - ID apijson.Field - DependsOn apijson.Field - Label apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskExecutionListResponseSpecPlanStepsObject) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskExecutionListResponseSpecPlanStepsObjectJSON) RawJSON() string { - return r.raw -} - -func (r EnvironmentAutomationTaskExecutionListResponseSpecPlanStepsObject) implementsEnvironmentAutomationTaskExecutionListResponseSpecPlanStep() { -} - -type EnvironmentAutomationTaskExecutionListResponseStatus struct { - // failure_message summarises why the task execution failed to operate. If this is - // non-empty the task execution has failed to operate and will likely transition to - // a failed state. - FailureMessage string `json:"failureMessage"` - // log_url is the URL to the logs of the task's steps. If this is empty, the task - // either has no logs or has not yet started. - LogURL string `json:"logUrl"` - // the phase of a task execution represents the aggregated phase of all steps. - Phase EnvironmentAutomationTaskExecutionListResponseStatusPhase `json:"phase"` - // version of the status update. Task executions themselves are unversioned, but - // their status has different versions. The value of this field has no semantic - // meaning (e.g. don't interpret it as as a timestamp), but it can be used to - // impose a partial order. If a.status_version < b.status_version then a was the - // status before b. - StatusVersion string `json:"statusVersion"` - // steps provides the status for each individual step of the task execution. If a - // step is missing it has not yet started. - Steps []EnvironmentAutomationTaskExecutionListResponseStatusStep `json:"steps"` - JSON environmentAutomationTaskExecutionListResponseStatusJSON `json:"-"` -} - -// environmentAutomationTaskExecutionListResponseStatusJSON contains the JSON -// metadata for the struct [EnvironmentAutomationTaskExecutionListResponseStatus] -type environmentAutomationTaskExecutionListResponseStatusJSON struct { - FailureMessage apijson.Field - LogURL apijson.Field - Phase apijson.Field - StatusVersion apijson.Field - Steps apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskExecutionListResponseStatus) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskExecutionListResponseStatusJSON) RawJSON() string { - return r.raw -} - -// the phase of a task execution represents the aggregated phase of all steps. -type EnvironmentAutomationTaskExecutionListResponseStatusPhase string - -const ( - EnvironmentAutomationTaskExecutionListResponseStatusPhaseTaskExecutionPhaseUnspecified EnvironmentAutomationTaskExecutionListResponseStatusPhase = "TASK_EXECUTION_PHASE_UNSPECIFIED" - EnvironmentAutomationTaskExecutionListResponseStatusPhaseTaskExecutionPhasePending EnvironmentAutomationTaskExecutionListResponseStatusPhase = "TASK_EXECUTION_PHASE_PENDING" - EnvironmentAutomationTaskExecutionListResponseStatusPhaseTaskExecutionPhaseRunning EnvironmentAutomationTaskExecutionListResponseStatusPhase = "TASK_EXECUTION_PHASE_RUNNING" - EnvironmentAutomationTaskExecutionListResponseStatusPhaseTaskExecutionPhaseSucceeded EnvironmentAutomationTaskExecutionListResponseStatusPhase = "TASK_EXECUTION_PHASE_SUCCEEDED" - EnvironmentAutomationTaskExecutionListResponseStatusPhaseTaskExecutionPhaseFailed EnvironmentAutomationTaskExecutionListResponseStatusPhase = "TASK_EXECUTION_PHASE_FAILED" - EnvironmentAutomationTaskExecutionListResponseStatusPhaseTaskExecutionPhaseStopped EnvironmentAutomationTaskExecutionListResponseStatusPhase = "TASK_EXECUTION_PHASE_STOPPED" -) - -func (r EnvironmentAutomationTaskExecutionListResponseStatusPhase) IsKnown() bool { - switch r { - case EnvironmentAutomationTaskExecutionListResponseStatusPhaseTaskExecutionPhaseUnspecified, EnvironmentAutomationTaskExecutionListResponseStatusPhaseTaskExecutionPhasePending, EnvironmentAutomationTaskExecutionListResponseStatusPhaseTaskExecutionPhaseRunning, EnvironmentAutomationTaskExecutionListResponseStatusPhaseTaskExecutionPhaseSucceeded, EnvironmentAutomationTaskExecutionListResponseStatusPhaseTaskExecutionPhaseFailed, EnvironmentAutomationTaskExecutionListResponseStatusPhaseTaskExecutionPhaseStopped: - return true - } - return false -} - -type EnvironmentAutomationTaskExecutionListResponseStatusStep struct { - // ID is the ID of the execution step - ID string `json:"id" format:"uuid"` - // failure_message summarises why the step failed to operate. If this is non-empty - // the step has failed to operate and will likely transition to a failed state. - FailureMessage string `json:"failureMessage"` - // phase is the current phase of the execution step - Phase EnvironmentAutomationTaskExecutionListResponseStatusStepsPhase `json:"phase"` - JSON environmentAutomationTaskExecutionListResponseStatusStepJSON `json:"-"` -} - -// environmentAutomationTaskExecutionListResponseStatusStepJSON contains the JSON -// metadata for the struct -// [EnvironmentAutomationTaskExecutionListResponseStatusStep] -type environmentAutomationTaskExecutionListResponseStatusStepJSON struct { - ID apijson.Field - FailureMessage apijson.Field - Phase apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentAutomationTaskExecutionListResponseStatusStep) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentAutomationTaskExecutionListResponseStatusStepJSON) RawJSON() string { - return r.raw -} - -// phase is the current phase of the execution step -type EnvironmentAutomationTaskExecutionListResponseStatusStepsPhase string - -const ( - EnvironmentAutomationTaskExecutionListResponseStatusStepsPhaseTaskExecutionPhaseUnspecified EnvironmentAutomationTaskExecutionListResponseStatusStepsPhase = "TASK_EXECUTION_PHASE_UNSPECIFIED" - EnvironmentAutomationTaskExecutionListResponseStatusStepsPhaseTaskExecutionPhasePending EnvironmentAutomationTaskExecutionListResponseStatusStepsPhase = "TASK_EXECUTION_PHASE_PENDING" - EnvironmentAutomationTaskExecutionListResponseStatusStepsPhaseTaskExecutionPhaseRunning EnvironmentAutomationTaskExecutionListResponseStatusStepsPhase = "TASK_EXECUTION_PHASE_RUNNING" - EnvironmentAutomationTaskExecutionListResponseStatusStepsPhaseTaskExecutionPhaseSucceeded EnvironmentAutomationTaskExecutionListResponseStatusStepsPhase = "TASK_EXECUTION_PHASE_SUCCEEDED" - EnvironmentAutomationTaskExecutionListResponseStatusStepsPhaseTaskExecutionPhaseFailed EnvironmentAutomationTaskExecutionListResponseStatusStepsPhase = "TASK_EXECUTION_PHASE_FAILED" - EnvironmentAutomationTaskExecutionListResponseStatusStepsPhaseTaskExecutionPhaseStopped EnvironmentAutomationTaskExecutionListResponseStatusStepsPhase = "TASK_EXECUTION_PHASE_STOPPED" -) - -func (r EnvironmentAutomationTaskExecutionListResponseStatusStepsPhase) IsKnown() bool { - switch r { - case EnvironmentAutomationTaskExecutionListResponseStatusStepsPhaseTaskExecutionPhaseUnspecified, EnvironmentAutomationTaskExecutionListResponseStatusStepsPhaseTaskExecutionPhasePending, EnvironmentAutomationTaskExecutionListResponseStatusStepsPhaseTaskExecutionPhaseRunning, EnvironmentAutomationTaskExecutionListResponseStatusStepsPhaseTaskExecutionPhaseSucceeded, EnvironmentAutomationTaskExecutionListResponseStatusStepsPhaseTaskExecutionPhaseFailed, EnvironmentAutomationTaskExecutionListResponseStatusStepsPhaseTaskExecutionPhaseStopped: - return true - } - return false -} - type EnvironmentAutomationTaskExecutionStopResponse = interface{} type EnvironmentAutomationTaskExecutionGetParams struct { @@ -1465,7 +133,7 @@ type EnvironmentAutomationTaskExecutionListParamsFilter struct { // environment_ids filters the response to only task runs of these environments EnvironmentIDs param.Field[[]string] `json:"environmentIds" format:"uuid"` // phases filters the response to only task runs in these phases - Phases param.Field[[]EnvironmentAutomationTaskExecutionListParamsFilterPhase] `json:"phases"` + Phases param.Field[[]shared.TaskExecutionPhase] `json:"phases"` // task_ids filters the response to only task runs of these tasks TaskIDs param.Field[[]string] `json:"taskIds" format:"uuid"` // task_references filters the response to only task runs with this reference @@ -1476,25 +144,6 @@ func (r EnvironmentAutomationTaskExecutionListParamsFilter) MarshalJSON() (data return apijson.MarshalRoot(r) } -type EnvironmentAutomationTaskExecutionListParamsFilterPhase string - -const ( - EnvironmentAutomationTaskExecutionListParamsFilterPhaseTaskExecutionPhaseUnspecified EnvironmentAutomationTaskExecutionListParamsFilterPhase = "TASK_EXECUTION_PHASE_UNSPECIFIED" - EnvironmentAutomationTaskExecutionListParamsFilterPhaseTaskExecutionPhasePending EnvironmentAutomationTaskExecutionListParamsFilterPhase = "TASK_EXECUTION_PHASE_PENDING" - EnvironmentAutomationTaskExecutionListParamsFilterPhaseTaskExecutionPhaseRunning EnvironmentAutomationTaskExecutionListParamsFilterPhase = "TASK_EXECUTION_PHASE_RUNNING" - EnvironmentAutomationTaskExecutionListParamsFilterPhaseTaskExecutionPhaseSucceeded EnvironmentAutomationTaskExecutionListParamsFilterPhase = "TASK_EXECUTION_PHASE_SUCCEEDED" - EnvironmentAutomationTaskExecutionListParamsFilterPhaseTaskExecutionPhaseFailed EnvironmentAutomationTaskExecutionListParamsFilterPhase = "TASK_EXECUTION_PHASE_FAILED" - EnvironmentAutomationTaskExecutionListParamsFilterPhaseTaskExecutionPhaseStopped EnvironmentAutomationTaskExecutionListParamsFilterPhase = "TASK_EXECUTION_PHASE_STOPPED" -) - -func (r EnvironmentAutomationTaskExecutionListParamsFilterPhase) IsKnown() bool { - switch r { - case EnvironmentAutomationTaskExecutionListParamsFilterPhaseTaskExecutionPhaseUnspecified, EnvironmentAutomationTaskExecutionListParamsFilterPhaseTaskExecutionPhasePending, EnvironmentAutomationTaskExecutionListParamsFilterPhaseTaskExecutionPhaseRunning, EnvironmentAutomationTaskExecutionListParamsFilterPhaseTaskExecutionPhaseSucceeded, EnvironmentAutomationTaskExecutionListParamsFilterPhaseTaskExecutionPhaseFailed, EnvironmentAutomationTaskExecutionListParamsFilterPhaseTaskExecutionPhaseStopped: - return true - } - return false -} - // pagination contains the pagination options for listing task runs type EnvironmentAutomationTaskExecutionListParamsPagination struct { // Token for the next set of results that was returned as next_token of a diff --git a/environmentautomationtaskexecution_test.go b/environmentautomationtaskexecution_test.go index 737c2c0..b457e82 100644 --- a/environmentautomationtaskexecution_test.go +++ b/environmentautomationtaskexecution_test.go @@ -11,6 +11,7 @@ import ( "github.com/gitpod-io/flex-sdk-go" "github.com/gitpod-io/flex-sdk-go/internal/testutil" "github.com/gitpod-io/flex-sdk-go/option" + "github.com/gitpod-io/flex-sdk-go/shared" ) func TestEnvironmentAutomationTaskExecutionGetWithOptionalParams(t *testing.T) { @@ -56,7 +57,7 @@ func TestEnvironmentAutomationTaskExecutionListWithOptionalParams(t *testing.T) PageSize: gitpod.F(int64(0)), Filter: gitpod.F(gitpod.EnvironmentAutomationTaskExecutionListParamsFilter{ EnvironmentIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), - Phases: gitpod.F([]gitpod.EnvironmentAutomationTaskExecutionListParamsFilterPhase{gitpod.EnvironmentAutomationTaskExecutionListParamsFilterPhaseTaskExecutionPhaseUnspecified}), + Phases: gitpod.F([]shared.TaskExecutionPhase{shared.TaskExecutionPhaseTaskExecutionPhaseUnspecified}), TaskIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), TaskReferences: gitpod.F([]string{"string"}), }), diff --git a/environmentclass.go b/environmentclass.go index e27631b..c8e4a0b 100644 --- a/environmentclass.go +++ b/environmentclass.go @@ -13,6 +13,7 @@ import ( "github.com/gitpod-io/flex-sdk-go/internal/requestconfig" "github.com/gitpod-io/flex-sdk-go/option" "github.com/gitpod-io/flex-sdk-go/packages/pagination" + "github.com/gitpod-io/flex-sdk-go/shared" ) // EnvironmentClassService contains methods and other services that help with @@ -37,7 +38,7 @@ func NewEnvironmentClassService(opts ...option.RequestOption) (r *EnvironmentCla // 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 -func (r *EnvironmentClassService) List(ctx context.Context, params EnvironmentClassListParams, opts ...option.RequestOption) (res *pagination.EnvironmentClassesPage[EnvironmentClassListResponse], err error) { +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...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -57,72 +58,10 @@ func (r *EnvironmentClassService) List(ctx context.Context, params EnvironmentCl // 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 -func (r *EnvironmentClassService) ListAutoPaging(ctx context.Context, params EnvironmentClassListParams, opts ...option.RequestOption) *pagination.EnvironmentClassesPageAutoPager[EnvironmentClassListResponse] { +func (r *EnvironmentClassService) ListAutoPaging(ctx context.Context, params EnvironmentClassListParams, opts ...option.RequestOption) *pagination.EnvironmentClassesPageAutoPager[shared.EnvironmentClass] { return pagination.NewEnvironmentClassesPageAutoPager(r.List(ctx, params, opts...)) } -type EnvironmentClassListResponse struct { - // id is the unique identifier of the environment class - ID string `json:"id"` - // configuration describes the configuration of the environment class - Configuration []EnvironmentClassListResponseConfiguration `json:"configuration"` - // description is a human readable description of the environment class - Description string `json:"description"` - // display_name is the human readable name of the environment class - DisplayName string `json:"displayName"` - // enabled indicates whether the environment class can be used to create new - // environments. - Enabled bool `json:"enabled"` - // runner_id is the unique identifier of the runner the environment class belongs - // to - RunnerID string `json:"runnerId"` - JSON environmentClassListResponseJSON `json:"-"` -} - -// environmentClassListResponseJSON contains the JSON metadata for the struct -// [EnvironmentClassListResponse] -type environmentClassListResponseJSON struct { - ID apijson.Field - Configuration apijson.Field - Description apijson.Field - DisplayName apijson.Field - Enabled apijson.Field - RunnerID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentClassListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentClassListResponseJSON) RawJSON() string { - return r.raw -} - -type EnvironmentClassListResponseConfiguration struct { - Key string `json:"key"` - Value string `json:"value"` - JSON environmentClassListResponseConfigurationJSON `json:"-"` -} - -// environmentClassListResponseConfigurationJSON contains the JSON metadata for the -// struct [EnvironmentClassListResponseConfiguration] -type environmentClassListResponseConfigurationJSON struct { - Key apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EnvironmentClassListResponseConfiguration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r environmentClassListResponseConfigurationJSON) RawJSON() string { - return r.raw -} - type EnvironmentClassListParams struct { Token param.Field[string] `query:"token"` PageSize param.Field[int64] `query:"pageSize"` @@ -147,7 +86,9 @@ func (r EnvironmentClassListParams) URLQuery() (v url.Values) { type EnvironmentClassListParamsFilter struct { // 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,required"` + 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"` } func (r EnvironmentClassListParamsFilter) MarshalJSON() (data []byte, err error) { diff --git a/environmentclass_test.go b/environmentclass_test.go index 3998b12..05321ab 100644 --- a/environmentclass_test.go +++ b/environmentclass_test.go @@ -30,7 +30,8 @@ func TestEnvironmentClassListWithOptionalParams(t *testing.T) { Token: gitpod.F("token"), PageSize: gitpod.F(int64(0)), Filter: gitpod.F(gitpod.EnvironmentClassListParamsFilter{ - Enabled: gitpod.F(true), + Enabled: gitpod.F(true), + RunnerIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), }), Pagination: gitpod.F(gitpod.EnvironmentClassListParamsPagination{ Token: gitpod.F("token"), diff --git a/event.go b/event.go index a1602b7..9711d3e 100644 --- a/event.go +++ b/event.go @@ -15,6 +15,7 @@ import ( "github.com/gitpod-io/flex-sdk-go/option" "github.com/gitpod-io/flex-sdk-go/packages/jsonl" "github.com/gitpod-io/flex-sdk-go/packages/pagination" + "github.com/gitpod-io/flex-sdk-go/shared" ) // EventService contains methods and other services that help with interacting with @@ -74,11 +75,60 @@ func (r *EventService) WatchStreaming(ctx context.Context, body EventWatchParams return jsonl.NewStream[EventWatchResponse](raw, err) } +type ResourceOperation string + +const ( + ResourceOperationResourceOperationUnspecified ResourceOperation = "RESOURCE_OPERATION_UNSPECIFIED" + ResourceOperationResourceOperationCreate ResourceOperation = "RESOURCE_OPERATION_CREATE" + ResourceOperationResourceOperationUpdate ResourceOperation = "RESOURCE_OPERATION_UPDATE" + ResourceOperationResourceOperationDelete ResourceOperation = "RESOURCE_OPERATION_DELETE" + ResourceOperationResourceOperationUpdateStatus ResourceOperation = "RESOURCE_OPERATION_UPDATE_STATUS" +) + +func (r ResourceOperation) IsKnown() bool { + switch r { + case ResourceOperationResourceOperationUnspecified, ResourceOperationResourceOperationCreate, ResourceOperationResourceOperationUpdate, ResourceOperationResourceOperationDelete, ResourceOperationResourceOperationUpdateStatus: + return true + } + return false +} + +type ResourceType string + +const ( + ResourceTypeResourceTypeUnspecified ResourceType = "RESOURCE_TYPE_UNSPECIFIED" + ResourceTypeResourceTypeEnvironment ResourceType = "RESOURCE_TYPE_ENVIRONMENT" + ResourceTypeResourceTypeRunner ResourceType = "RESOURCE_TYPE_RUNNER" + ResourceTypeResourceTypeProject ResourceType = "RESOURCE_TYPE_PROJECT" + ResourceTypeResourceTypeTask ResourceType = "RESOURCE_TYPE_TASK" + ResourceTypeResourceTypeTaskExecution ResourceType = "RESOURCE_TYPE_TASK_EXECUTION" + ResourceTypeResourceTypeService ResourceType = "RESOURCE_TYPE_SERVICE" + ResourceTypeResourceTypeOrganization ResourceType = "RESOURCE_TYPE_ORGANIZATION" + ResourceTypeResourceTypeUser ResourceType = "RESOURCE_TYPE_USER" + ResourceTypeResourceTypeEnvironmentClass ResourceType = "RESOURCE_TYPE_ENVIRONMENT_CLASS" + ResourceTypeResourceTypeRunnerScmIntegration ResourceType = "RESOURCE_TYPE_RUNNER_SCM_INTEGRATION" + ResourceTypeResourceTypeHostAuthenticationToken ResourceType = "RESOURCE_TYPE_HOST_AUTHENTICATION_TOKEN" + ResourceTypeResourceTypeGroup ResourceType = "RESOURCE_TYPE_GROUP" + ResourceTypeResourceTypePersonalAccessToken ResourceType = "RESOURCE_TYPE_PERSONAL_ACCESS_TOKEN" + ResourceTypeResourceTypeUserPreference ResourceType = "RESOURCE_TYPE_USER_PREFERENCE" + ResourceTypeResourceTypeServiceAccount ResourceType = "RESOURCE_TYPE_SERVICE_ACCOUNT" + ResourceTypeResourceTypeSecret ResourceType = "RESOURCE_TYPE_SECRET" + ResourceTypeResourceTypeSSOConfig ResourceType = "RESOURCE_TYPE_SSO_CONFIG" +) + +func (r ResourceType) IsKnown() bool { + switch r { + case ResourceTypeResourceTypeUnspecified, ResourceTypeResourceTypeEnvironment, ResourceTypeResourceTypeRunner, ResourceTypeResourceTypeProject, ResourceTypeResourceTypeTask, ResourceTypeResourceTypeTaskExecution, ResourceTypeResourceTypeService, ResourceTypeResourceTypeOrganization, ResourceTypeResourceTypeUser, ResourceTypeResourceTypeEnvironmentClass, ResourceTypeResourceTypeRunnerScmIntegration, ResourceTypeResourceTypeHostAuthenticationToken, ResourceTypeResourceTypeGroup, ResourceTypeResourceTypePersonalAccessToken, ResourceTypeResourceTypeUserPreference, ResourceTypeResourceTypeServiceAccount, ResourceTypeResourceTypeSecret, ResourceTypeResourceTypeSSOConfig: + return true + } + return false +} + type EventListResponse struct { - ID string `json:"id"` - Action string `json:"action"` - ActorID string `json:"actorId"` - ActorPrincipal EventListResponseActorPrincipal `json:"actorPrincipal"` + ID string `json:"id"` + Action string `json:"action"` + ActorID string `json:"actorId"` + ActorPrincipal shared.Principal `json:"actorPrincipal"` // 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, @@ -167,10 +217,10 @@ type EventListResponse 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"` - SubjectID string `json:"subjectId"` - SubjectType EventListResponseSubjectType `json:"subjectType"` - JSON eventListResponseJSON `json:"-"` + CreatedAt time.Time `json:"createdAt" format:"date-time"` + SubjectID string `json:"subjectId"` + SubjectType ResourceType `json:"subjectType"` + JSON eventListResponseJSON `json:"-"` } // eventListResponseJSON contains the JSON metadata for the struct @@ -195,61 +245,11 @@ func (r eventListResponseJSON) RawJSON() string { return r.raw } -type EventListResponseActorPrincipal string - -const ( - EventListResponseActorPrincipalPrincipalUnspecified EventListResponseActorPrincipal = "PRINCIPAL_UNSPECIFIED" - EventListResponseActorPrincipalPrincipalAccount EventListResponseActorPrincipal = "PRINCIPAL_ACCOUNT" - EventListResponseActorPrincipalPrincipalUser EventListResponseActorPrincipal = "PRINCIPAL_USER" - EventListResponseActorPrincipalPrincipalRunner EventListResponseActorPrincipal = "PRINCIPAL_RUNNER" - EventListResponseActorPrincipalPrincipalEnvironment EventListResponseActorPrincipal = "PRINCIPAL_ENVIRONMENT" - EventListResponseActorPrincipalPrincipalServiceAccount EventListResponseActorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r EventListResponseActorPrincipal) IsKnown() bool { - switch r { - case EventListResponseActorPrincipalPrincipalUnspecified, EventListResponseActorPrincipalPrincipalAccount, EventListResponseActorPrincipalPrincipalUser, EventListResponseActorPrincipalPrincipalRunner, EventListResponseActorPrincipalPrincipalEnvironment, EventListResponseActorPrincipalPrincipalServiceAccount: - return true - } - return false -} - -type EventListResponseSubjectType string - -const ( - EventListResponseSubjectTypeResourceTypeUnspecified EventListResponseSubjectType = "RESOURCE_TYPE_UNSPECIFIED" - EventListResponseSubjectTypeResourceTypeEnvironment EventListResponseSubjectType = "RESOURCE_TYPE_ENVIRONMENT" - EventListResponseSubjectTypeResourceTypeRunner EventListResponseSubjectType = "RESOURCE_TYPE_RUNNER" - EventListResponseSubjectTypeResourceTypeProject EventListResponseSubjectType = "RESOURCE_TYPE_PROJECT" - EventListResponseSubjectTypeResourceTypeTask EventListResponseSubjectType = "RESOURCE_TYPE_TASK" - EventListResponseSubjectTypeResourceTypeTaskExecution EventListResponseSubjectType = "RESOURCE_TYPE_TASK_EXECUTION" - EventListResponseSubjectTypeResourceTypeService EventListResponseSubjectType = "RESOURCE_TYPE_SERVICE" - EventListResponseSubjectTypeResourceTypeOrganization EventListResponseSubjectType = "RESOURCE_TYPE_ORGANIZATION" - EventListResponseSubjectTypeResourceTypeUser EventListResponseSubjectType = "RESOURCE_TYPE_USER" - EventListResponseSubjectTypeResourceTypeEnvironmentClass EventListResponseSubjectType = "RESOURCE_TYPE_ENVIRONMENT_CLASS" - EventListResponseSubjectTypeResourceTypeRunnerScmIntegration EventListResponseSubjectType = "RESOURCE_TYPE_RUNNER_SCM_INTEGRATION" - EventListResponseSubjectTypeResourceTypeHostAuthenticationToken EventListResponseSubjectType = "RESOURCE_TYPE_HOST_AUTHENTICATION_TOKEN" - EventListResponseSubjectTypeResourceTypeGroup EventListResponseSubjectType = "RESOURCE_TYPE_GROUP" - EventListResponseSubjectTypeResourceTypePersonalAccessToken EventListResponseSubjectType = "RESOURCE_TYPE_PERSONAL_ACCESS_TOKEN" - EventListResponseSubjectTypeResourceTypeUserPreference EventListResponseSubjectType = "RESOURCE_TYPE_USER_PREFERENCE" - EventListResponseSubjectTypeResourceTypeServiceAccount EventListResponseSubjectType = "RESOURCE_TYPE_SERVICE_ACCOUNT" - EventListResponseSubjectTypeResourceTypeSecret EventListResponseSubjectType = "RESOURCE_TYPE_SECRET" - EventListResponseSubjectTypeResourceTypeSSOConfig EventListResponseSubjectType = "RESOURCE_TYPE_SSO_CONFIG" -) - -func (r EventListResponseSubjectType) IsKnown() bool { - switch r { - case EventListResponseSubjectTypeResourceTypeUnspecified, EventListResponseSubjectTypeResourceTypeEnvironment, EventListResponseSubjectTypeResourceTypeRunner, EventListResponseSubjectTypeResourceTypeProject, EventListResponseSubjectTypeResourceTypeTask, EventListResponseSubjectTypeResourceTypeTaskExecution, EventListResponseSubjectTypeResourceTypeService, EventListResponseSubjectTypeResourceTypeOrganization, EventListResponseSubjectTypeResourceTypeUser, EventListResponseSubjectTypeResourceTypeEnvironmentClass, EventListResponseSubjectTypeResourceTypeRunnerScmIntegration, EventListResponseSubjectTypeResourceTypeHostAuthenticationToken, EventListResponseSubjectTypeResourceTypeGroup, EventListResponseSubjectTypeResourceTypePersonalAccessToken, EventListResponseSubjectTypeResourceTypeUserPreference, EventListResponseSubjectTypeResourceTypeServiceAccount, EventListResponseSubjectTypeResourceTypeSecret, EventListResponseSubjectTypeResourceTypeSSOConfig: - return true - } - return false -} - type EventWatchResponse struct { - Operation EventWatchResponseOperation `json:"operation"` - ResourceID string `json:"resourceId" format:"uuid"` - ResourceType EventWatchResponseResourceType `json:"resourceType"` - JSON eventWatchResponseJSON `json:"-"` + Operation ResourceOperation `json:"operation"` + ResourceID string `json:"resourceId" format:"uuid"` + ResourceType ResourceType `json:"resourceType"` + JSON eventWatchResponseJSON `json:"-"` } // eventWatchResponseJSON contains the JSON metadata for the struct @@ -270,55 +270,6 @@ func (r eventWatchResponseJSON) RawJSON() string { return r.raw } -type EventWatchResponseOperation string - -const ( - EventWatchResponseOperationResourceOperationUnspecified EventWatchResponseOperation = "RESOURCE_OPERATION_UNSPECIFIED" - EventWatchResponseOperationResourceOperationCreate EventWatchResponseOperation = "RESOURCE_OPERATION_CREATE" - EventWatchResponseOperationResourceOperationUpdate EventWatchResponseOperation = "RESOURCE_OPERATION_UPDATE" - EventWatchResponseOperationResourceOperationDelete EventWatchResponseOperation = "RESOURCE_OPERATION_DELETE" - EventWatchResponseOperationResourceOperationUpdateStatus EventWatchResponseOperation = "RESOURCE_OPERATION_UPDATE_STATUS" -) - -func (r EventWatchResponseOperation) IsKnown() bool { - switch r { - case EventWatchResponseOperationResourceOperationUnspecified, EventWatchResponseOperationResourceOperationCreate, EventWatchResponseOperationResourceOperationUpdate, EventWatchResponseOperationResourceOperationDelete, EventWatchResponseOperationResourceOperationUpdateStatus: - return true - } - return false -} - -type EventWatchResponseResourceType string - -const ( - EventWatchResponseResourceTypeResourceTypeUnspecified EventWatchResponseResourceType = "RESOURCE_TYPE_UNSPECIFIED" - EventWatchResponseResourceTypeResourceTypeEnvironment EventWatchResponseResourceType = "RESOURCE_TYPE_ENVIRONMENT" - EventWatchResponseResourceTypeResourceTypeRunner EventWatchResponseResourceType = "RESOURCE_TYPE_RUNNER" - EventWatchResponseResourceTypeResourceTypeProject EventWatchResponseResourceType = "RESOURCE_TYPE_PROJECT" - EventWatchResponseResourceTypeResourceTypeTask EventWatchResponseResourceType = "RESOURCE_TYPE_TASK" - EventWatchResponseResourceTypeResourceTypeTaskExecution EventWatchResponseResourceType = "RESOURCE_TYPE_TASK_EXECUTION" - EventWatchResponseResourceTypeResourceTypeService EventWatchResponseResourceType = "RESOURCE_TYPE_SERVICE" - EventWatchResponseResourceTypeResourceTypeOrganization EventWatchResponseResourceType = "RESOURCE_TYPE_ORGANIZATION" - EventWatchResponseResourceTypeResourceTypeUser EventWatchResponseResourceType = "RESOURCE_TYPE_USER" - EventWatchResponseResourceTypeResourceTypeEnvironmentClass EventWatchResponseResourceType = "RESOURCE_TYPE_ENVIRONMENT_CLASS" - EventWatchResponseResourceTypeResourceTypeRunnerScmIntegration EventWatchResponseResourceType = "RESOURCE_TYPE_RUNNER_SCM_INTEGRATION" - EventWatchResponseResourceTypeResourceTypeHostAuthenticationToken EventWatchResponseResourceType = "RESOURCE_TYPE_HOST_AUTHENTICATION_TOKEN" - EventWatchResponseResourceTypeResourceTypeGroup EventWatchResponseResourceType = "RESOURCE_TYPE_GROUP" - EventWatchResponseResourceTypeResourceTypePersonalAccessToken EventWatchResponseResourceType = "RESOURCE_TYPE_PERSONAL_ACCESS_TOKEN" - EventWatchResponseResourceTypeResourceTypeUserPreference EventWatchResponseResourceType = "RESOURCE_TYPE_USER_PREFERENCE" - EventWatchResponseResourceTypeResourceTypeServiceAccount EventWatchResponseResourceType = "RESOURCE_TYPE_SERVICE_ACCOUNT" - EventWatchResponseResourceTypeResourceTypeSecret EventWatchResponseResourceType = "RESOURCE_TYPE_SECRET" - EventWatchResponseResourceTypeResourceTypeSSOConfig EventWatchResponseResourceType = "RESOURCE_TYPE_SSO_CONFIG" -) - -func (r EventWatchResponseResourceType) IsKnown() bool { - switch r { - case EventWatchResponseResourceTypeResourceTypeUnspecified, EventWatchResponseResourceTypeResourceTypeEnvironment, EventWatchResponseResourceTypeResourceTypeRunner, EventWatchResponseResourceTypeResourceTypeProject, EventWatchResponseResourceTypeResourceTypeTask, EventWatchResponseResourceTypeResourceTypeTaskExecution, EventWatchResponseResourceTypeResourceTypeService, EventWatchResponseResourceTypeResourceTypeOrganization, EventWatchResponseResourceTypeResourceTypeUser, EventWatchResponseResourceTypeResourceTypeEnvironmentClass, EventWatchResponseResourceTypeResourceTypeRunnerScmIntegration, EventWatchResponseResourceTypeResourceTypeHostAuthenticationToken, EventWatchResponseResourceTypeResourceTypeGroup, EventWatchResponseResourceTypeResourceTypePersonalAccessToken, EventWatchResponseResourceTypeResourceTypeUserPreference, EventWatchResponseResourceTypeResourceTypeServiceAccount, EventWatchResponseResourceTypeResourceTypeSecret, EventWatchResponseResourceTypeResourceTypeSSOConfig: - return true - } - return false -} - type EventListParams struct { Token param.Field[string] `query:"token"` PageSize param.Field[int64] `query:"pageSize"` @@ -340,66 +291,16 @@ func (r EventListParams) URLQuery() (v url.Values) { } type EventListParamsFilter struct { - ActorIDs param.Field[[]string] `json:"actorIds" format:"uuid"` - ActorPrincipals param.Field[[]EventListParamsFilterActorPrincipal] `json:"actorPrincipals"` - SubjectIDs param.Field[[]string] `json:"subjectIds" format:"uuid"` - SubjectTypes param.Field[[]EventListParamsFilterSubjectType] `json:"subjectTypes"` + ActorIDs param.Field[[]string] `json:"actorIds" format:"uuid"` + ActorPrincipals param.Field[[]shared.Principal] `json:"actorPrincipals"` + SubjectIDs param.Field[[]string] `json:"subjectIds" format:"uuid"` + SubjectTypes param.Field[[]ResourceType] `json:"subjectTypes"` } func (r EventListParamsFilter) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type EventListParamsFilterActorPrincipal string - -const ( - EventListParamsFilterActorPrincipalPrincipalUnspecified EventListParamsFilterActorPrincipal = "PRINCIPAL_UNSPECIFIED" - EventListParamsFilterActorPrincipalPrincipalAccount EventListParamsFilterActorPrincipal = "PRINCIPAL_ACCOUNT" - EventListParamsFilterActorPrincipalPrincipalUser EventListParamsFilterActorPrincipal = "PRINCIPAL_USER" - EventListParamsFilterActorPrincipalPrincipalRunner EventListParamsFilterActorPrincipal = "PRINCIPAL_RUNNER" - EventListParamsFilterActorPrincipalPrincipalEnvironment EventListParamsFilterActorPrincipal = "PRINCIPAL_ENVIRONMENT" - EventListParamsFilterActorPrincipalPrincipalServiceAccount EventListParamsFilterActorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r EventListParamsFilterActorPrincipal) IsKnown() bool { - switch r { - case EventListParamsFilterActorPrincipalPrincipalUnspecified, EventListParamsFilterActorPrincipalPrincipalAccount, EventListParamsFilterActorPrincipalPrincipalUser, EventListParamsFilterActorPrincipalPrincipalRunner, EventListParamsFilterActorPrincipalPrincipalEnvironment, EventListParamsFilterActorPrincipalPrincipalServiceAccount: - return true - } - return false -} - -type EventListParamsFilterSubjectType string - -const ( - EventListParamsFilterSubjectTypeResourceTypeUnspecified EventListParamsFilterSubjectType = "RESOURCE_TYPE_UNSPECIFIED" - EventListParamsFilterSubjectTypeResourceTypeEnvironment EventListParamsFilterSubjectType = "RESOURCE_TYPE_ENVIRONMENT" - EventListParamsFilterSubjectTypeResourceTypeRunner EventListParamsFilterSubjectType = "RESOURCE_TYPE_RUNNER" - EventListParamsFilterSubjectTypeResourceTypeProject EventListParamsFilterSubjectType = "RESOURCE_TYPE_PROJECT" - EventListParamsFilterSubjectTypeResourceTypeTask EventListParamsFilterSubjectType = "RESOURCE_TYPE_TASK" - EventListParamsFilterSubjectTypeResourceTypeTaskExecution EventListParamsFilterSubjectType = "RESOURCE_TYPE_TASK_EXECUTION" - EventListParamsFilterSubjectTypeResourceTypeService EventListParamsFilterSubjectType = "RESOURCE_TYPE_SERVICE" - EventListParamsFilterSubjectTypeResourceTypeOrganization EventListParamsFilterSubjectType = "RESOURCE_TYPE_ORGANIZATION" - EventListParamsFilterSubjectTypeResourceTypeUser EventListParamsFilterSubjectType = "RESOURCE_TYPE_USER" - EventListParamsFilterSubjectTypeResourceTypeEnvironmentClass EventListParamsFilterSubjectType = "RESOURCE_TYPE_ENVIRONMENT_CLASS" - EventListParamsFilterSubjectTypeResourceTypeRunnerScmIntegration EventListParamsFilterSubjectType = "RESOURCE_TYPE_RUNNER_SCM_INTEGRATION" - EventListParamsFilterSubjectTypeResourceTypeHostAuthenticationToken EventListParamsFilterSubjectType = "RESOURCE_TYPE_HOST_AUTHENTICATION_TOKEN" - EventListParamsFilterSubjectTypeResourceTypeGroup EventListParamsFilterSubjectType = "RESOURCE_TYPE_GROUP" - EventListParamsFilterSubjectTypeResourceTypePersonalAccessToken EventListParamsFilterSubjectType = "RESOURCE_TYPE_PERSONAL_ACCESS_TOKEN" - EventListParamsFilterSubjectTypeResourceTypeUserPreference EventListParamsFilterSubjectType = "RESOURCE_TYPE_USER_PREFERENCE" - EventListParamsFilterSubjectTypeResourceTypeServiceAccount EventListParamsFilterSubjectType = "RESOURCE_TYPE_SERVICE_ACCOUNT" - EventListParamsFilterSubjectTypeResourceTypeSecret EventListParamsFilterSubjectType = "RESOURCE_TYPE_SECRET" - EventListParamsFilterSubjectTypeResourceTypeSSOConfig EventListParamsFilterSubjectType = "RESOURCE_TYPE_SSO_CONFIG" -) - -func (r EventListParamsFilterSubjectType) IsKnown() bool { - switch r { - case EventListParamsFilterSubjectTypeResourceTypeUnspecified, EventListParamsFilterSubjectTypeResourceTypeEnvironment, EventListParamsFilterSubjectTypeResourceTypeRunner, EventListParamsFilterSubjectTypeResourceTypeProject, EventListParamsFilterSubjectTypeResourceTypeTask, EventListParamsFilterSubjectTypeResourceTypeTaskExecution, EventListParamsFilterSubjectTypeResourceTypeService, EventListParamsFilterSubjectTypeResourceTypeOrganization, EventListParamsFilterSubjectTypeResourceTypeUser, EventListParamsFilterSubjectTypeResourceTypeEnvironmentClass, EventListParamsFilterSubjectTypeResourceTypeRunnerScmIntegration, EventListParamsFilterSubjectTypeResourceTypeHostAuthenticationToken, EventListParamsFilterSubjectTypeResourceTypeGroup, EventListParamsFilterSubjectTypeResourceTypePersonalAccessToken, EventListParamsFilterSubjectTypeResourceTypeUserPreference, EventListParamsFilterSubjectTypeResourceTypeServiceAccount, EventListParamsFilterSubjectTypeResourceTypeSecret, EventListParamsFilterSubjectTypeResourceTypeSSOConfig: - return true - } - return false -} - // pagination contains the pagination options for listing environments type EventListParamsPagination struct { // Token for the next set of results that was returned as next_token of a @@ -415,14 +316,6 @@ func (r EventListParamsPagination) MarshalJSON() (data []byte, err error) { } type EventWatchParams struct { - Body EventWatchParamsBodyUnion `json:"body,required"` -} - -func (r EventWatchParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - -type EventWatchParamsBody struct { // Environment scope produces events for the environment itself, all tasks, task // executions, and services associated with that environment. EnvironmentID param.Field[string] `json:"environmentId"` @@ -432,43 +325,6 @@ type EventWatchParamsBody struct { Organization param.Field[bool] `json:"organization"` } -func (r EventWatchParamsBody) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EventWatchParamsBody) implementsEventWatchParamsBodyUnion() {} - -// Satisfied by -// [EventWatchParamsBodyEnvironmentScopeProducesEventsForTheEnvironmentItselfAllTasksTaskExecutionsAndServicesAssociatedWithThatEnvironment], -// [EventWatchParamsBodyOrganizationScopeProducesEventsForAllProjectsRunnersAndEnvironmentsTheCallerCanSeeWithinTheirOrganizationNoTaskTaskExecutionOrServiceEventsAreProdued], -// [EventWatchParamsBody]. -type EventWatchParamsBodyUnion interface { - implementsEventWatchParamsBodyUnion() -} - -type EventWatchParamsBodyEnvironmentScopeProducesEventsForTheEnvironmentItselfAllTasksTaskExecutionsAndServicesAssociatedWithThatEnvironment struct { - // Environment scope produces events for the environment itself, all tasks, task - // executions, and services associated with that environment. - EnvironmentID param.Field[string] `json:"environmentId,required"` -} - -func (r EventWatchParamsBodyEnvironmentScopeProducesEventsForTheEnvironmentItselfAllTasksTaskExecutionsAndServicesAssociatedWithThatEnvironment) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r EventWatchParamsBodyEnvironmentScopeProducesEventsForTheEnvironmentItselfAllTasksTaskExecutionsAndServicesAssociatedWithThatEnvironment) implementsEventWatchParamsBodyUnion() { -} - -type EventWatchParamsBodyOrganizationScopeProducesEventsForAllProjectsRunnersAndEnvironmentsTheCallerCanSeeWithinTheirOrganizationNoTaskTaskExecutionOrServiceEventsAreProdued struct { - // Organization scope produces events for all projects, runners and environments - // the caller can see within their organization. No task, task execution or service - // events are produed. - Organization param.Field[bool] `json:"organization,required"` -} - -func (r EventWatchParamsBodyOrganizationScopeProducesEventsForAllProjectsRunnersAndEnvironmentsTheCallerCanSeeWithinTheirOrganizationNoTaskTaskExecutionOrServiceEventsAreProdued) MarshalJSON() (data []byte, err error) { +func (r EventWatchParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } - -func (r EventWatchParamsBodyOrganizationScopeProducesEventsForAllProjectsRunnersAndEnvironmentsTheCallerCanSeeWithinTheirOrganizationNoTaskTaskExecutionOrServiceEventsAreProdued) implementsEventWatchParamsBodyUnion() { -} diff --git a/event_test.go b/event_test.go index 0620def..b0bd19d 100644 --- a/event_test.go +++ b/event_test.go @@ -11,6 +11,7 @@ import ( "github.com/gitpod-io/flex-sdk-go" "github.com/gitpod-io/flex-sdk-go/internal/testutil" "github.com/gitpod-io/flex-sdk-go/option" + "github.com/gitpod-io/flex-sdk-go/shared" ) func TestEventListWithOptionalParams(t *testing.T) { @@ -31,9 +32,9 @@ func TestEventListWithOptionalParams(t *testing.T) { PageSize: gitpod.F(int64(0)), Filter: gitpod.F(gitpod.EventListParamsFilter{ ActorIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), - ActorPrincipals: gitpod.F([]gitpod.EventListParamsFilterActorPrincipal{gitpod.EventListParamsFilterActorPrincipalPrincipalUnspecified}), + ActorPrincipals: gitpod.F([]shared.Principal{shared.PrincipalPrincipalUnspecified}), SubjectIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), - SubjectTypes: gitpod.F([]gitpod.EventListParamsFilterSubjectType{gitpod.EventListParamsFilterSubjectTypeResourceTypeUnspecified}), + SubjectTypes: gitpod.F([]gitpod.ResourceType{gitpod.ResourceTypeResourceTypeUnspecified}), }), Pagination: gitpod.F(gitpod.EventListParamsPagination{ Token: gitpod.F("token"), diff --git a/group.go b/group.go index 05008e7..87cec88 100644 --- a/group.go +++ b/group.go @@ -36,7 +36,7 @@ func NewGroupService(opts ...option.RequestOption) (r *GroupService) { } // ListGroups lists groups -func (r *GroupService) List(ctx context.Context, params GroupListParams, opts ...option.RequestOption) (res *pagination.GroupsPage[GroupListResponse], err error) { +func (r *GroupService) List(ctx context.Context, params GroupListParams, opts ...option.RequestOption) (res *pagination.GroupsPage[Group], err error) { var raw *http.Response opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -54,11 +54,11 @@ func (r *GroupService) List(ctx context.Context, params GroupListParams, opts .. } // ListGroups lists groups -func (r *GroupService) ListAutoPaging(ctx context.Context, params GroupListParams, opts ...option.RequestOption) *pagination.GroupsPageAutoPager[GroupListResponse] { +func (r *GroupService) ListAutoPaging(ctx context.Context, params GroupListParams, opts ...option.RequestOption) *pagination.GroupsPageAutoPager[Group] { return pagination.NewGroupsPageAutoPager(r.List(ctx, params, opts...)) } -type GroupListResponse struct { +type Group struct { ID string `json:"id" 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 @@ -241,13 +241,12 @@ type GroupListResponse 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 groupListResponseJSON `json:"-"` + UpdatedAt time.Time `json:"updatedAt" format:"date-time"` + JSON groupJSON `json:"-"` } -// groupListResponseJSON contains the JSON metadata for the struct -// [GroupListResponse] -type groupListResponseJSON struct { +// groupJSON contains the JSON metadata for the struct [Group] +type groupJSON struct { ID apijson.Field CreatedAt apijson.Field Name apijson.Field @@ -258,11 +257,11 @@ type groupListResponseJSON struct { ExtraFields map[string]apijson.Field } -func (r *GroupListResponse) UnmarshalJSON(data []byte) (err error) { +func (r *Group) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r groupListResponseJSON) RawJSON() string { +func (r groupJSON) RawJSON() string { return r.raw } diff --git a/identity.go b/identity.go index c19c3c1..6041118 100644 --- a/identity.go +++ b/identity.go @@ -10,6 +10,7 @@ import ( "github.com/gitpod-io/flex-sdk-go/internal/param" "github.com/gitpod-io/flex-sdk-go/internal/requestconfig" "github.com/gitpod-io/flex-sdk-go/option" + "github.com/gitpod-io/flex-sdk-go/shared" ) // IdentityService contains methods and other services that help with interacting @@ -81,8 +82,8 @@ func (r identityExchangeTokenResponseJSON) RawJSON() string { type IdentityGetAuthenticatedIdentityResponse struct { OrganizationID string `json:"organizationId"` // subject is the identity of the current user - Subject IdentityGetAuthenticatedIdentityResponseSubject `json:"subject"` - JSON identityGetAuthenticatedIdentityResponseJSON `json:"-"` + Subject shared.Subject `json:"subject"` + JSON identityGetAuthenticatedIdentityResponseJSON `json:"-"` } // identityGetAuthenticatedIdentityResponseJSON contains the JSON metadata for the @@ -102,52 +103,6 @@ func (r identityGetAuthenticatedIdentityResponseJSON) RawJSON() string { return r.raw } -// subject is the identity of the current user -type IdentityGetAuthenticatedIdentityResponseSubject struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal IdentityGetAuthenticatedIdentityResponseSubjectPrincipal `json:"principal"` - JSON identityGetAuthenticatedIdentityResponseSubjectJSON `json:"-"` -} - -// identityGetAuthenticatedIdentityResponseSubjectJSON contains the JSON metadata -// for the struct [IdentityGetAuthenticatedIdentityResponseSubject] -type identityGetAuthenticatedIdentityResponseSubjectJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *IdentityGetAuthenticatedIdentityResponseSubject) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r identityGetAuthenticatedIdentityResponseSubjectJSON) RawJSON() string { - return r.raw -} - -// Principal is the principal of the subject -type IdentityGetAuthenticatedIdentityResponseSubjectPrincipal string - -const ( - IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalUnspecified IdentityGetAuthenticatedIdentityResponseSubjectPrincipal = "PRINCIPAL_UNSPECIFIED" - IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalAccount IdentityGetAuthenticatedIdentityResponseSubjectPrincipal = "PRINCIPAL_ACCOUNT" - IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalUser IdentityGetAuthenticatedIdentityResponseSubjectPrincipal = "PRINCIPAL_USER" - IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalRunner IdentityGetAuthenticatedIdentityResponseSubjectPrincipal = "PRINCIPAL_RUNNER" - IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalEnvironment IdentityGetAuthenticatedIdentityResponseSubjectPrincipal = "PRINCIPAL_ENVIRONMENT" - IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalServiceAccount IdentityGetAuthenticatedIdentityResponseSubjectPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r IdentityGetAuthenticatedIdentityResponseSubjectPrincipal) IsKnown() bool { - switch r { - case IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalUnspecified, IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalAccount, IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalUser, IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalRunner, IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalEnvironment, IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalServiceAccount: - return true - } - return false -} - type IdentityGetIDTokenResponse struct { Token string `json:"token"` JSON identityGetIDTokenResponseJSON `json:"-"` diff --git a/organization.go b/organization.go index 33471c0..074e9b1 100644 --- a/organization.go +++ b/organization.go @@ -14,6 +14,7 @@ import ( "github.com/gitpod-io/flex-sdk-go/internal/requestconfig" "github.com/gitpod-io/flex-sdk-go/option" "github.com/gitpod-io/flex-sdk-go/packages/pagination" + "github.com/gitpod-io/flex-sdk-go/shared" ) // OrganizationService contains methods and other services that help with @@ -64,7 +65,7 @@ func (r *OrganizationService) Update(ctx context.Context, body OrganizationUpdat } // ListOrganizations lists all organization the caller has access to. -func (r *OrganizationService) List(ctx context.Context, params OrganizationListParams, opts ...option.RequestOption) (res *pagination.OrganizationsPage[OrganizationListResponse], err error) { +func (r *OrganizationService) List(ctx context.Context, params OrganizationListParams, opts ...option.RequestOption) (res *pagination.OrganizationsPage[Organization], err error) { var raw *http.Response opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -82,7 +83,7 @@ func (r *OrganizationService) List(ctx context.Context, params OrganizationListP } // ListOrganizations lists all organization the caller has access to. -func (r *OrganizationService) ListAutoPaging(ctx context.Context, params OrganizationListParams, opts ...option.RequestOption) *pagination.OrganizationsPageAutoPager[OrganizationListResponse] { +func (r *OrganizationService) ListAutoPaging(ctx context.Context, params OrganizationListParams, opts ...option.RequestOption) *pagination.OrganizationsPageAutoPager[Organization] { return pagination.NewOrganizationsPageAutoPager(r.List(ctx, params, opts...)) } @@ -111,7 +112,7 @@ func (r *OrganizationService) Leave(ctx context.Context, body OrganizationLeaveP } // ListMembers lists all members of the specified organization. -func (r *OrganizationService) ListMembers(ctx context.Context, params OrganizationListMembersParams, opts ...option.RequestOption) (res *pagination.MembersPage[OrganizationListMembersResponse], err error) { +func (r *OrganizationService) ListMembers(ctx context.Context, params OrganizationListMembersParams, opts ...option.RequestOption) (res *pagination.MembersPage[OrganizationMember], err error) { var raw *http.Response opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -129,7 +130,7 @@ func (r *OrganizationService) ListMembers(ctx context.Context, params Organizati } // ListMembers lists all members of the specified organization. -func (r *OrganizationService) ListMembersAutoPaging(ctx context.Context, params OrganizationListMembersParams, opts ...option.RequestOption) *pagination.MembersPageAutoPager[OrganizationListMembersResponse] { +func (r *OrganizationService) ListMembersAutoPaging(ctx context.Context, params OrganizationListMembersParams, opts ...option.RequestOption) *pagination.MembersPageAutoPager[OrganizationMember] { return pagination.NewMembersPageAutoPager(r.ListMembers(ctx, params, opts...)) } @@ -141,1012 +142,38 @@ func (r *OrganizationService) SetRole(ctx context.Context, body OrganizationSetR return } -type OrganizationNewResponse struct { - // member is the member that joined the org on creation. Only set if specified - // "join_organization" is "true" in the request. - Member OrganizationNewResponseMember `json:"member"` - // organization is the created organization - Organization OrganizationNewResponseOrganization `json:"organization"` - JSON organizationNewResponseJSON `json:"-"` -} - -// organizationNewResponseJSON contains the JSON metadata for the struct -// [OrganizationNewResponse] -type organizationNewResponseJSON struct { - Member apijson.Field - Organization apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *OrganizationNewResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r organizationNewResponseJSON) RawJSON() string { - return r.raw -} - -// member is the member that joined the org on creation. Only set if specified -// "join_organization" is "true" in the request. -type OrganizationNewResponseMember struct { - AvatarURL string `json:"avatarUrl"` - Email string `json:"email"` - FullName string `json:"fullName"` - // login_provider is the login provider the user uses to sign in - LoginProvider string `json:"loginProvider"` - // 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. - MemberSince time.Time `json:"memberSince" format:"date-time"` - Role OrganizationNewResponseMemberRole `json:"role"` - Status OrganizationNewResponseMemberStatus `json:"status"` - UserID string `json:"userId" format:"uuid"` - JSON organizationNewResponseMemberJSON `json:"-"` -} - -// organizationNewResponseMemberJSON contains the JSON metadata for the struct -// [OrganizationNewResponseMember] -type organizationNewResponseMemberJSON struct { - AvatarURL apijson.Field - Email apijson.Field - FullName apijson.Field - LoginProvider apijson.Field - MemberSince apijson.Field - Role apijson.Field - Status apijson.Field - UserID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *OrganizationNewResponseMember) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r organizationNewResponseMemberJSON) RawJSON() string { - return r.raw -} - -type OrganizationNewResponseMemberRole string - -const ( - OrganizationNewResponseMemberRoleOrganizationRoleUnspecified OrganizationNewResponseMemberRole = "ORGANIZATION_ROLE_UNSPECIFIED" - OrganizationNewResponseMemberRoleOrganizationRoleAdmin OrganizationNewResponseMemberRole = "ORGANIZATION_ROLE_ADMIN" - OrganizationNewResponseMemberRoleOrganizationRoleMember OrganizationNewResponseMemberRole = "ORGANIZATION_ROLE_MEMBER" -) - -func (r OrganizationNewResponseMemberRole) IsKnown() bool { - switch r { - case OrganizationNewResponseMemberRoleOrganizationRoleUnspecified, OrganizationNewResponseMemberRoleOrganizationRoleAdmin, OrganizationNewResponseMemberRoleOrganizationRoleMember: - return true - } - return false -} - -type OrganizationNewResponseMemberStatus string - -const ( - OrganizationNewResponseMemberStatusUserStatusUnspecified OrganizationNewResponseMemberStatus = "USER_STATUS_UNSPECIFIED" - OrganizationNewResponseMemberStatusUserStatusActive OrganizationNewResponseMemberStatus = "USER_STATUS_ACTIVE" - OrganizationNewResponseMemberStatusUserStatusSuspended OrganizationNewResponseMemberStatus = "USER_STATUS_SUSPENDED" - OrganizationNewResponseMemberStatusUserStatusLeft OrganizationNewResponseMemberStatus = "USER_STATUS_LEFT" -) - -func (r OrganizationNewResponseMemberStatus) IsKnown() bool { - switch r { - case OrganizationNewResponseMemberStatusUserStatusUnspecified, OrganizationNewResponseMemberStatusUserStatusActive, OrganizationNewResponseMemberStatusUserStatusSuspended, OrganizationNewResponseMemberStatusUserStatusLeft: - return true - } - return false -} - -// organization is the created organization -type OrganizationNewResponseOrganization struct { - ID string `json:"id" format:"uuid"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - CreatedAt time.Time `json:"createdAt" format:"date-time"` - InviteDomains OrganizationNewResponseOrganizationInviteDomains `json:"inviteDomains"` - Name string `json:"name"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - UpdatedAt time.Time `json:"updatedAt" format:"date-time"` - JSON organizationNewResponseOrganizationJSON `json:"-"` -} - -// organizationNewResponseOrganizationJSON contains the JSON metadata for the -// struct [OrganizationNewResponseOrganization] -type organizationNewResponseOrganizationJSON struct { - ID apijson.Field - CreatedAt apijson.Field - InviteDomains apijson.Field - Name apijson.Field - UpdatedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *OrganizationNewResponseOrganization) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r organizationNewResponseOrganizationJSON) RawJSON() string { - return r.raw -} - -type OrganizationNewResponseOrganizationInviteDomains struct { - // domains is the list of domains that are allowed to join the organization - Domains []string `json:"domains"` - JSON organizationNewResponseOrganizationInviteDomainsJSON `json:"-"` -} - -// organizationNewResponseOrganizationInviteDomainsJSON contains the JSON metadata -// for the struct [OrganizationNewResponseOrganizationInviteDomains] -type organizationNewResponseOrganizationInviteDomainsJSON struct { - Domains apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *OrganizationNewResponseOrganizationInviteDomains) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r organizationNewResponseOrganizationInviteDomainsJSON) RawJSON() string { - return r.raw -} - -type OrganizationGetResponse struct { - // organization is the requested organization - Organization OrganizationGetResponseOrganization `json:"organization"` - JSON organizationGetResponseJSON `json:"-"` -} - -// organizationGetResponseJSON contains the JSON metadata for the struct -// [OrganizationGetResponse] -type organizationGetResponseJSON struct { - Organization apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *OrganizationGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r organizationGetResponseJSON) RawJSON() string { - return r.raw -} - -// organization is the requested organization -type OrganizationGetResponseOrganization struct { - ID string `json:"id" format:"uuid"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - CreatedAt time.Time `json:"createdAt" format:"date-time"` - InviteDomains OrganizationGetResponseOrganizationInviteDomains `json:"inviteDomains"` - Name string `json:"name"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - UpdatedAt time.Time `json:"updatedAt" format:"date-time"` - JSON organizationGetResponseOrganizationJSON `json:"-"` -} - -// organizationGetResponseOrganizationJSON contains the JSON metadata for the -// struct [OrganizationGetResponseOrganization] -type organizationGetResponseOrganizationJSON struct { - ID apijson.Field - CreatedAt apijson.Field - InviteDomains apijson.Field - Name apijson.Field - UpdatedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *OrganizationGetResponseOrganization) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r organizationGetResponseOrganizationJSON) RawJSON() string { - return r.raw -} - -type OrganizationGetResponseOrganizationInviteDomains struct { - // domains is the list of domains that are allowed to join the organization - Domains []string `json:"domains"` - JSON organizationGetResponseOrganizationInviteDomainsJSON `json:"-"` -} - -// organizationGetResponseOrganizationInviteDomainsJSON contains the JSON metadata -// for the struct [OrganizationGetResponseOrganizationInviteDomains] -type organizationGetResponseOrganizationInviteDomainsJSON struct { - Domains apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *OrganizationGetResponseOrganizationInviteDomains) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r organizationGetResponseOrganizationInviteDomainsJSON) RawJSON() string { - return r.raw -} - -type OrganizationUpdateResponse struct { - // organization is the updated organization - Organization OrganizationUpdateResponseOrganization `json:"organization"` - JSON organizationUpdateResponseJSON `json:"-"` -} - -// organizationUpdateResponseJSON contains the JSON metadata for the struct -// [OrganizationUpdateResponse] -type organizationUpdateResponseJSON struct { - Organization apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *OrganizationUpdateResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r organizationUpdateResponseJSON) RawJSON() string { - return r.raw -} - -// organization is the updated organization -type OrganizationUpdateResponseOrganization struct { - ID string `json:"id" format:"uuid"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - CreatedAt time.Time `json:"createdAt" format:"date-time"` - InviteDomains OrganizationUpdateResponseOrganizationInviteDomains `json:"inviteDomains"` - Name string `json:"name"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - UpdatedAt time.Time `json:"updatedAt" format:"date-time"` - JSON organizationUpdateResponseOrganizationJSON `json:"-"` -} - -// organizationUpdateResponseOrganizationJSON contains the JSON metadata for the -// struct [OrganizationUpdateResponseOrganization] -type organizationUpdateResponseOrganizationJSON struct { - ID apijson.Field - CreatedAt apijson.Field - InviteDomains apijson.Field - Name apijson.Field - UpdatedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *OrganizationUpdateResponseOrganization) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r organizationUpdateResponseOrganizationJSON) RawJSON() string { - return r.raw -} - -type OrganizationUpdateResponseOrganizationInviteDomains struct { +type InviteDomains struct { // domains is the list of domains that are allowed to join the organization - Domains []string `json:"domains"` - JSON organizationUpdateResponseOrganizationInviteDomainsJSON `json:"-"` + Domains []string `json:"domains"` + JSON inviteDomainsJSON `json:"-"` } -// organizationUpdateResponseOrganizationInviteDomainsJSON contains the JSON -// metadata for the struct [OrganizationUpdateResponseOrganizationInviteDomains] -type organizationUpdateResponseOrganizationInviteDomainsJSON struct { +// inviteDomainsJSON contains the JSON metadata for the struct [InviteDomains] +type inviteDomainsJSON struct { Domains apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *OrganizationUpdateResponseOrganizationInviteDomains) UnmarshalJSON(data []byte) (err error) { +func (r *InviteDomains) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r organizationUpdateResponseOrganizationInviteDomainsJSON) RawJSON() string { +func (r inviteDomainsJSON) RawJSON() string { return r.raw } -type OrganizationListResponse struct { - ID string `json:"id" format:"uuid"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - CreatedAt time.Time `json:"createdAt" format:"date-time"` - InviteDomains OrganizationListResponseInviteDomains `json:"inviteDomains"` - Name string `json:"name"` +type InviteDomainsParam struct { + // domains is the list of domains that are allowed to join the organization + Domains param.Field[[]string] `json:"domains"` +} + +func (r InviteDomainsParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type Organization struct { + ID string `json:"id" 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, @@ -1235,83 +262,9 @@ type OrganizationListResponse 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 organizationListResponseJSON `json:"-"` -} - -// organizationListResponseJSON contains the JSON metadata for the struct -// [OrganizationListResponse] -type organizationListResponseJSON struct { - ID apijson.Field - CreatedAt apijson.Field - InviteDomains apijson.Field - Name apijson.Field - UpdatedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *OrganizationListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r organizationListResponseJSON) RawJSON() string { - return r.raw -} - -type OrganizationListResponseInviteDomains struct { - // domains is the list of domains that are allowed to join the organization - Domains []string `json:"domains"` - JSON organizationListResponseInviteDomainsJSON `json:"-"` -} - -// organizationListResponseInviteDomainsJSON contains the JSON metadata for the -// struct [OrganizationListResponseInviteDomains] -type organizationListResponseInviteDomainsJSON struct { - Domains apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *OrganizationListResponseInviteDomains) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r organizationListResponseInviteDomainsJSON) RawJSON() string { - return r.raw -} - -type OrganizationDeleteResponse = interface{} - -type OrganizationJoinResponse struct { - // member is the member that was created by joining the organization. - Member OrganizationJoinResponseMember `json:"member"` - JSON organizationJoinResponseJSON `json:"-"` -} - -// organizationJoinResponseJSON contains the JSON metadata for the struct -// [OrganizationJoinResponse] -type organizationJoinResponseJSON struct { - Member apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *OrganizationJoinResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r organizationJoinResponseJSON) RawJSON() string { - return r.raw -} - -// member is the member that was created by joining the organization. -type OrganizationJoinResponseMember struct { - AvatarURL string `json:"avatarUrl"` - Email string `json:"email"` - FullName string `json:"fullName"` - // login_provider is the login provider the user uses to sign in - LoginProvider string `json:"loginProvider"` + CreatedAt time.Time `json:"createdAt" format:"date-time"` + InviteDomains InviteDomains `json:"inviteDomains"` + Name string `json:"name"` // 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, @@ -1400,72 +353,30 @@ type OrganizationJoinResponseMember 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 OrganizationJoinResponseMemberRole `json:"role"` - Status OrganizationJoinResponseMemberStatus `json:"status"` - UserID string `json:"userId" format:"uuid"` - JSON organizationJoinResponseMemberJSON `json:"-"` + UpdatedAt time.Time `json:"updatedAt" format:"date-time"` + JSON organizationJSON `json:"-"` } -// organizationJoinResponseMemberJSON contains the JSON metadata for the struct -// [OrganizationJoinResponseMember] -type organizationJoinResponseMemberJSON struct { - AvatarURL apijson.Field - Email apijson.Field - FullName apijson.Field - LoginProvider apijson.Field - MemberSince apijson.Field - Role apijson.Field - Status apijson.Field - UserID apijson.Field +// 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 raw string ExtraFields map[string]apijson.Field } -func (r *OrganizationJoinResponseMember) UnmarshalJSON(data []byte) (err error) { +func (r *Organization) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r organizationJoinResponseMemberJSON) RawJSON() string { +func (r organizationJSON) RawJSON() string { return r.raw } -type OrganizationJoinResponseMemberRole string - -const ( - OrganizationJoinResponseMemberRoleOrganizationRoleUnspecified OrganizationJoinResponseMemberRole = "ORGANIZATION_ROLE_UNSPECIFIED" - OrganizationJoinResponseMemberRoleOrganizationRoleAdmin OrganizationJoinResponseMemberRole = "ORGANIZATION_ROLE_ADMIN" - OrganizationJoinResponseMemberRoleOrganizationRoleMember OrganizationJoinResponseMemberRole = "ORGANIZATION_ROLE_MEMBER" -) - -func (r OrganizationJoinResponseMemberRole) IsKnown() bool { - switch r { - case OrganizationJoinResponseMemberRoleOrganizationRoleUnspecified, OrganizationJoinResponseMemberRoleOrganizationRoleAdmin, OrganizationJoinResponseMemberRoleOrganizationRoleMember: - return true - } - return false -} - -type OrganizationJoinResponseMemberStatus string - -const ( - OrganizationJoinResponseMemberStatusUserStatusUnspecified OrganizationJoinResponseMemberStatus = "USER_STATUS_UNSPECIFIED" - OrganizationJoinResponseMemberStatusUserStatusActive OrganizationJoinResponseMemberStatus = "USER_STATUS_ACTIVE" - OrganizationJoinResponseMemberStatusUserStatusSuspended OrganizationJoinResponseMemberStatus = "USER_STATUS_SUSPENDED" - OrganizationJoinResponseMemberStatusUserStatusLeft OrganizationJoinResponseMemberStatus = "USER_STATUS_LEFT" -) - -func (r OrganizationJoinResponseMemberStatus) IsKnown() bool { - switch r { - case OrganizationJoinResponseMemberStatusUserStatusUnspecified, OrganizationJoinResponseMemberStatusUserStatusActive, OrganizationJoinResponseMemberStatusUserStatusSuspended, OrganizationJoinResponseMemberStatusUserStatusLeft: - return true - } - return false -} - -type OrganizationLeaveResponse = interface{} - -type OrganizationListMembersResponse struct { +type OrganizationMember struct { AvatarURL string `json:"avatarUrl"` Email string `json:"email"` FullName string `json:"fullName"` @@ -1559,16 +470,16 @@ type OrganizationListMembersResponse 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 OrganizationListMembersResponseRole `json:"role"` - Status OrganizationListMembersResponseStatus `json:"status"` - UserID string `json:"userId" format:"uuid"` - JSON organizationListMembersResponseJSON `json:"-"` + MemberSince time.Time `json:"memberSince" format:"date-time"` + Role shared.OrganizationRole `json:"role"` + Status shared.UserStatus `json:"status"` + UserID string `json:"userId" format:"uuid"` + JSON organizationMemberJSON `json:"-"` } -// organizationListMembersResponseJSON contains the JSON metadata for the struct -// [OrganizationListMembersResponse] -type organizationListMembersResponseJSON struct { +// organizationMemberJSON contains the JSON metadata for the struct +// [OrganizationMember] +type organizationMemberJSON struct { AvatarURL apijson.Field Email apijson.Field FullName apijson.Field @@ -1581,133 +492,163 @@ type organizationListMembersResponseJSON struct { ExtraFields map[string]apijson.Field } -func (r *OrganizationListMembersResponse) UnmarshalJSON(data []byte) (err error) { +func (r *OrganizationMember) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r organizationListMembersResponseJSON) RawJSON() string { +func (r organizationMemberJSON) RawJSON() string { return r.raw } -type OrganizationListMembersResponseRole string +type Scope string const ( - OrganizationListMembersResponseRoleOrganizationRoleUnspecified OrganizationListMembersResponseRole = "ORGANIZATION_ROLE_UNSPECIFIED" - OrganizationListMembersResponseRoleOrganizationRoleAdmin OrganizationListMembersResponseRole = "ORGANIZATION_ROLE_ADMIN" - OrganizationListMembersResponseRoleOrganizationRoleMember OrganizationListMembersResponseRole = "ORGANIZATION_ROLE_MEMBER" + ScopeScopeUnspecified Scope = "SCOPE_UNSPECIFIED" + ScopeScopeMember Scope = "SCOPE_MEMBER" + ScopeScopeAll Scope = "SCOPE_ALL" ) -func (r OrganizationListMembersResponseRole) IsKnown() bool { +func (r Scope) IsKnown() bool { switch r { - case OrganizationListMembersResponseRoleOrganizationRoleUnspecified, OrganizationListMembersResponseRoleOrganizationRoleAdmin, OrganizationListMembersResponseRoleOrganizationRoleMember: + case ScopeScopeUnspecified, ScopeScopeMember, ScopeScopeAll: return true } return false } -type OrganizationListMembersResponseStatus string +type OrganizationNewResponse struct { + // 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:"-"` +} -const ( - OrganizationListMembersResponseStatusUserStatusUnspecified OrganizationListMembersResponseStatus = "USER_STATUS_UNSPECIFIED" - OrganizationListMembersResponseStatusUserStatusActive OrganizationListMembersResponseStatus = "USER_STATUS_ACTIVE" - OrganizationListMembersResponseStatusUserStatusSuspended OrganizationListMembersResponseStatus = "USER_STATUS_SUSPENDED" - OrganizationListMembersResponseStatusUserStatusLeft OrganizationListMembersResponseStatus = "USER_STATUS_LEFT" -) +// organizationNewResponseJSON contains the JSON metadata for the struct +// [OrganizationNewResponse] +type organizationNewResponseJSON struct { + Member apijson.Field + Organization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} -func (r OrganizationListMembersResponseStatus) IsKnown() bool { - switch r { - case OrganizationListMembersResponseStatusUserStatusUnspecified, OrganizationListMembersResponseStatusUserStatusActive, OrganizationListMembersResponseStatusUserStatusSuspended, OrganizationListMembersResponseStatusUserStatusLeft: - return true - } - return false +func (r *OrganizationNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -type OrganizationSetRoleResponse = interface{} +func (r organizationNewResponseJSON) RawJSON() string { + return r.raw +} -type OrganizationNewParams struct { - // 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"` +type OrganizationGetResponse struct { + // organization is the requested organization + Organization Organization `json:"organization"` + JSON organizationGetResponseJSON `json:"-"` } -func (r OrganizationNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +// organizationGetResponseJSON contains the JSON metadata for the struct +// [OrganizationGetResponse] +type organizationGetResponseJSON struct { + Organization apijson.Field + raw string + ExtraFields map[string]apijson.Field } -type OrganizationGetParams struct { - // organization_id is the unique identifier of the Organization to retreive. - OrganizationID param.Field[string] `json:"organizationId" format:"uuid"` +func (r *OrganizationGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r OrganizationGetParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r organizationGetResponseJSON) RawJSON() string { + return r.raw } -type OrganizationUpdateParams struct { - Body OrganizationUpdateParamsBodyUnion `json:"body,required"` +type OrganizationUpdateResponse struct { + // organization is the updated organization + Organization Organization `json:"organization"` + JSON organizationUpdateResponseJSON `json:"-"` } -func (r OrganizationUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) +// organizationUpdateResponseJSON contains the JSON metadata for the struct +// [OrganizationUpdateResponse] +type organizationUpdateResponseJSON struct { + Organization apijson.Field + raw string + ExtraFields map[string]apijson.Field } -type OrganizationUpdateParamsBody struct { - InviteDomains param.Field[interface{}] `json:"inviteDomains"` - // name is the new name of the organization - Name param.Field[string] `json:"name"` +func (r *OrganizationUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r OrganizationUpdateParamsBody) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r organizationUpdateResponseJSON) RawJSON() string { + return r.raw } -func (r OrganizationUpdateParamsBody) implementsOrganizationUpdateParamsBodyUnion() {} +type OrganizationDeleteResponse = interface{} -// Satisfied by -// [OrganizationUpdateParamsBodyInviteDomainsIsTheDomainAllowlistOfTheOrganization], -// [OrganizationUpdateParamsBodyNameIsTheNewNameOfTheOrganization], -// [OrganizationUpdateParamsBody]. -type OrganizationUpdateParamsBodyUnion interface { - implementsOrganizationUpdateParamsBodyUnion() +type OrganizationJoinResponse struct { + // member is the member that was created by joining the organization. + Member OrganizationMember `json:"member"` + JSON organizationJoinResponseJSON `json:"-"` } -type OrganizationUpdateParamsBodyInviteDomainsIsTheDomainAllowlistOfTheOrganization struct { - // invite_domains is the domain allowlist of the organization - InviteDomains param.Field[OrganizationUpdateParamsBodyInviteDomainsIsTheDomainAllowlistOfTheOrganizationInviteDomains] `json:"inviteDomains,required"` +// organizationJoinResponseJSON contains the JSON metadata for the struct +// [OrganizationJoinResponse] +type organizationJoinResponseJSON struct { + Member apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r OrganizationUpdateParamsBodyInviteDomainsIsTheDomainAllowlistOfTheOrganization) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) +func (r *OrganizationJoinResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func (r OrganizationUpdateParamsBodyInviteDomainsIsTheDomainAllowlistOfTheOrganization) implementsOrganizationUpdateParamsBodyUnion() { +func (r organizationJoinResponseJSON) RawJSON() string { + return r.raw } -// invite_domains is the domain allowlist of the organization -type OrganizationUpdateParamsBodyInviteDomainsIsTheDomainAllowlistOfTheOrganizationInviteDomains struct { - // domains is the list of domains that are allowed to join the organization - Domains param.Field[[]string] `json:"domains"` +type OrganizationLeaveResponse = interface{} + +type OrganizationSetRoleResponse = interface{} + +type OrganizationNewParams struct { + // 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 OrganizationUpdateParamsBodyInviteDomainsIsTheDomainAllowlistOfTheOrganizationInviteDomains) MarshalJSON() (data []byte, err error) { +func (r OrganizationNewParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type OrganizationUpdateParamsBodyNameIsTheNewNameOfTheOrganization struct { - // name is the new name of the organization - Name param.Field[string] `json:"name,required"` +type OrganizationGetParams struct { + // organization_id is the unique identifier of the Organization to retreive. + OrganizationID param.Field[string] `json:"organizationId" format:"uuid"` } -func (r OrganizationUpdateParamsBodyNameIsTheNewNameOfTheOrganization) MarshalJSON() (data []byte, err error) { +func (r OrganizationGetParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r OrganizationUpdateParamsBodyNameIsTheNewNameOfTheOrganization) implementsOrganizationUpdateParamsBodyUnion() { +type OrganizationUpdateParams struct { + // 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) { + return apijson.MarshalRoot(r) } type OrganizationListParams struct { @@ -1716,7 +657,7 @@ type OrganizationListParams struct { // pagination contains the pagination options for listing organizations Pagination param.Field[OrganizationListParamsPagination] `json:"pagination"` // scope is the scope of the organizations to list - Scope param.Field[OrganizationListParamsScope] `json:"scope"` + Scope param.Field[Scope] `json:"scope"` } func (r OrganizationListParams) MarshalJSON() (data []byte, err error) { @@ -1745,23 +686,6 @@ func (r OrganizationListParamsPagination) MarshalJSON() (data []byte, err error) return apijson.MarshalRoot(r) } -// scope is the scope of the organizations to list -type OrganizationListParamsScope string - -const ( - OrganizationListParamsScopeScopeUnspecified OrganizationListParamsScope = "SCOPE_UNSPECIFIED" - OrganizationListParamsScopeScopeMember OrganizationListParamsScope = "SCOPE_MEMBER" - OrganizationListParamsScopeScopeAll OrganizationListParamsScope = "SCOPE_ALL" -) - -func (r OrganizationListParamsScope) IsKnown() bool { - switch r { - case OrganizationListParamsScopeScopeUnspecified, OrganizationListParamsScopeScopeMember, OrganizationListParamsScopeScopeAll: - return true - } - return false -} - type OrganizationDeleteParams struct { // organization_id is the ID of the organization to delete OrganizationID param.Field[string] `json:"organizationId" format:"uuid"` @@ -1772,58 +696,16 @@ func (r OrganizationDeleteParams) MarshalJSON() (data []byte, err error) { } type OrganizationJoinParams struct { - Body OrganizationJoinParamsBodyUnion `json:"body,required"` -} - -func (r OrganizationJoinParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - -type OrganizationJoinParamsBody struct { // invite_id is the unique identifier of the invite to join the organization. InviteID param.Field[string] `json:"inviteId" format:"uuid"` // organization_id is the unique identifier of the Organization to join. OrganizationID param.Field[string] `json:"organizationId" format:"uuid"` } -func (r OrganizationJoinParamsBody) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r OrganizationJoinParamsBody) implementsOrganizationJoinParamsBodyUnion() {} - -// Satisfied by -// [OrganizationJoinParamsBodyInviteIDIsTheUniqueIdentifierOfTheInviteToJoinTheOrganization], -// [OrganizationJoinParamsBodyOrganizationIDIsTheUniqueIdentifierOfTheOrganizationToJoin], -// [OrganizationJoinParamsBody]. -type OrganizationJoinParamsBodyUnion interface { - implementsOrganizationJoinParamsBodyUnion() -} - -type OrganizationJoinParamsBodyInviteIDIsTheUniqueIdentifierOfTheInviteToJoinTheOrganization struct { - // invite_id is the unique identifier of the invite to join the organization. - InviteID param.Field[string] `json:"inviteId,required" format:"uuid"` -} - -func (r OrganizationJoinParamsBodyInviteIDIsTheUniqueIdentifierOfTheInviteToJoinTheOrganization) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r OrganizationJoinParamsBodyInviteIDIsTheUniqueIdentifierOfTheInviteToJoinTheOrganization) implementsOrganizationJoinParamsBodyUnion() { -} - -type OrganizationJoinParamsBodyOrganizationIDIsTheUniqueIdentifierOfTheOrganizationToJoin struct { - // organization_id is the unique identifier of the Organization to join. - OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"` -} - -func (r OrganizationJoinParamsBodyOrganizationIDIsTheUniqueIdentifierOfTheOrganizationToJoin) MarshalJSON() (data []byte, err error) { +func (r OrganizationJoinParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r OrganizationJoinParamsBodyOrganizationIDIsTheUniqueIdentifierOfTheOrganizationToJoin) implementsOrganizationJoinParamsBodyUnion() { -} - type OrganizationLeaveParams struct { UserID param.Field[string] `json:"userId" format:"uuid"` } @@ -1869,27 +751,11 @@ func (r OrganizationListMembersParamsPagination) MarshalJSON() (data []byte, err } type OrganizationSetRoleParams struct { - OrganizationID param.Field[string] `json:"organizationId" format:"uuid"` - Role param.Field[OrganizationSetRoleParamsRole] `json:"role"` - UserID param.Field[string] `json:"userId" format:"uuid"` + OrganizationID param.Field[string] `json:"organizationId" 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) { return apijson.MarshalRoot(r) } - -type OrganizationSetRoleParamsRole string - -const ( - OrganizationSetRoleParamsRoleOrganizationRoleUnspecified OrganizationSetRoleParamsRole = "ORGANIZATION_ROLE_UNSPECIFIED" - OrganizationSetRoleParamsRoleOrganizationRoleAdmin OrganizationSetRoleParamsRole = "ORGANIZATION_ROLE_ADMIN" - OrganizationSetRoleParamsRoleOrganizationRoleMember OrganizationSetRoleParamsRole = "ORGANIZATION_ROLE_MEMBER" -) - -func (r OrganizationSetRoleParamsRole) IsKnown() bool { - switch r { - case OrganizationSetRoleParamsRoleOrganizationRoleUnspecified, OrganizationSetRoleParamsRoleOrganizationRoleAdmin, OrganizationSetRoleParamsRoleOrganizationRoleMember: - return true - } - return false -} diff --git a/organization_test.go b/organization_test.go index 4a56c25..523c8c1 100644 --- a/organization_test.go +++ b/organization_test.go @@ -11,6 +11,7 @@ import ( "github.com/gitpod-io/flex-sdk-go" "github.com/gitpod-io/flex-sdk-go/internal/testutil" "github.com/gitpod-io/flex-sdk-go/option" + "github.com/gitpod-io/flex-sdk-go/shared" ) func TestOrganizationNewWithOptionalParams(t *testing.T) { @@ -79,11 +80,11 @@ func TestOrganizationUpdateWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Organizations.Update(context.TODO(), gitpod.OrganizationUpdateParams{ - Body: gitpod.OrganizationUpdateParamsBodyInviteDomainsIsTheDomainAllowlistOfTheOrganization{ - InviteDomains: gitpod.F(gitpod.OrganizationUpdateParamsBodyInviteDomainsIsTheDomainAllowlistOfTheOrganizationInviteDomains{ - Domains: gitpod.F([]string{"sfN2.l.iJR-BU.u9JV9.a.m.o2D-4b-Jd.0Z-kX.L.n.S.f.UKbxB"}), - }), - }, + 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"), }) if err != nil { var apierr *gitpod.Error @@ -114,7 +115,7 @@ func TestOrganizationListWithOptionalParams(t *testing.T) { Token: gitpod.F("token"), PageSize: gitpod.F(int64(100)), }), - Scope: gitpod.F(gitpod.OrganizationListParamsScopeScopeUnspecified), + Scope: gitpod.F(gitpod.ScopeScopeUnspecified), }) if err != nil { var apierr *gitpod.Error @@ -150,7 +151,7 @@ func TestOrganizationDeleteWithOptionalParams(t *testing.T) { } } -func TestOrganizationJoin(t *testing.T) { +func TestOrganizationJoinWithOptionalParams(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 { @@ -164,9 +165,8 @@ func TestOrganizationJoin(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Organizations.Join(context.TODO(), gitpod.OrganizationJoinParams{ - Body: gitpod.OrganizationJoinParamsBodyInviteIDIsTheUniqueIdentifierOfTheInviteToJoinTheOrganization{ - InviteID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - }, + InviteID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), }) if err != nil { var apierr *gitpod.Error @@ -248,7 +248,7 @@ func TestOrganizationSetRoleWithOptionalParams(t *testing.T) { ) _, err := client.Organizations.SetRole(context.TODO(), gitpod.OrganizationSetRoleParams{ OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - Role: gitpod.F(gitpod.OrganizationSetRoleParamsRoleOrganizationRoleUnspecified), + Role: gitpod.F(shared.OrganizationRoleOrganizationRoleUnspecified), UserID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), }) if err != nil { diff --git a/organizationinvite.go b/organizationinvite.go index 07e28e9..da4ad9f 100644 --- a/organizationinvite.go +++ b/organizationinvite.go @@ -58,53 +58,53 @@ func (r *OrganizationInviteService) GetSummary(ctx context.Context, body Organiz return } -type OrganizationInviteNewResponse struct { - Invite OrganizationInviteNewResponseInvite `json:"invite"` - JSON organizationInviteNewResponseJSON `json:"-"` +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"` + JSON organizationInviteJSON `json:"-"` } -// organizationInviteNewResponseJSON contains the JSON metadata for the struct -// [OrganizationInviteNewResponse] -type organizationInviteNewResponseJSON struct { - Invite apijson.Field +// organizationInviteJSON contains the JSON metadata for the struct +// [OrganizationInvite] +type organizationInviteJSON struct { + InviteID apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *OrganizationInviteNewResponse) UnmarshalJSON(data []byte) (err error) { +func (r *OrganizationInvite) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r organizationInviteNewResponseJSON) RawJSON() string { +func (r organizationInviteJSON) RawJSON() string { return r.raw } -type OrganizationInviteNewResponseInvite 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"` - JSON organizationInviteNewResponseInviteJSON `json:"-"` +type OrganizationInviteNewResponse struct { + Invite OrganizationInvite `json:"invite"` + JSON organizationInviteNewResponseJSON `json:"-"` } -// organizationInviteNewResponseInviteJSON contains the JSON metadata for the -// struct [OrganizationInviteNewResponseInvite] -type organizationInviteNewResponseInviteJSON struct { - InviteID apijson.Field +// organizationInviteNewResponseJSON contains the JSON metadata for the struct +// [OrganizationInviteNewResponse] +type organizationInviteNewResponseJSON struct { + Invite apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *OrganizationInviteNewResponseInvite) UnmarshalJSON(data []byte) (err error) { +func (r *OrganizationInviteNewResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r organizationInviteNewResponseInviteJSON) RawJSON() string { +func (r organizationInviteNewResponseJSON) RawJSON() string { return r.raw } type OrganizationInviteGetResponse struct { - Invite OrganizationInviteGetResponseInvite `json:"invite"` - JSON organizationInviteGetResponseJSON `json:"-"` + Invite OrganizationInvite `json:"invite"` + JSON organizationInviteGetResponseJSON `json:"-"` } // organizationInviteGetResponseJSON contains the JSON metadata for the struct @@ -123,29 +123,6 @@ func (r organizationInviteGetResponseJSON) RawJSON() string { return r.raw } -type OrganizationInviteGetResponseInvite 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"` - JSON organizationInviteGetResponseInviteJSON `json:"-"` -} - -// organizationInviteGetResponseInviteJSON contains the JSON metadata for the -// struct [OrganizationInviteGetResponseInvite] -type organizationInviteGetResponseInviteJSON struct { - InviteID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *OrganizationInviteGetResponseInvite) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r organizationInviteGetResponseInviteJSON) RawJSON() string { - return r.raw -} - type OrganizationInviteGetSummaryResponse struct { OrganizationID string `json:"organizationId" format:"uuid"` OrganizationMemberCount int64 `json:"organizationMemberCount"` diff --git a/organizationssoconfiguration.go b/organizationssoconfiguration.go index 7bd57f4..ca9f231 100644 --- a/organizationssoconfiguration.go +++ b/organizationssoconfiguration.go @@ -59,7 +59,7 @@ func (r *OrganizationSSOConfigurationService) Update(ctx context.Context, body O } // ListSSOConfigurations lists all SSO configurations matching provided filters. -func (r *OrganizationSSOConfigurationService) List(ctx context.Context, params OrganizationSSOConfigurationListParams, opts ...option.RequestOption) (res *pagination.SSOConfigurationsPage[OrganizationSSOConfigurationListResponse], err error) { +func (r *OrganizationSSOConfigurationService) List(ctx context.Context, params OrganizationSSOConfigurationListParams, opts ...option.RequestOption) (res *pagination.SSOConfigurationsPage[SSOConfiguration], err error) { var raw *http.Response opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -77,7 +77,7 @@ func (r *OrganizationSSOConfigurationService) List(ctx context.Context, params O } // ListSSOConfigurations lists all SSO configurations matching provided filters. -func (r *OrganizationSSOConfigurationService) ListAutoPaging(ctx context.Context, params OrganizationSSOConfigurationListParams, opts ...option.RequestOption) *pagination.SSOConfigurationsPageAutoPager[OrganizationSSOConfigurationListResponse] { +func (r *OrganizationSSOConfigurationService) ListAutoPaging(ctx context.Context, params OrganizationSSOConfigurationListParams, opts ...option.RequestOption) *pagination.SSOConfigurationsPageAutoPager[SSOConfiguration] { return pagination.NewSSOConfigurationsPageAutoPager(r.List(ctx, params, opts...)) } @@ -89,30 +89,23 @@ func (r *OrganizationSSOConfigurationService) Delete(ctx context.Context, body O return } -type OrganizationSSOConfigurationNewResponse struct { - // sso_configuration is the created SSO configuration - SSOConfiguration OrganizationSSOConfigurationNewResponseSSOConfiguration `json:"ssoConfiguration"` - JSON organizationSSOConfigurationNewResponseJSON `json:"-"` -} - -// organizationSSOConfigurationNewResponseJSON contains the JSON metadata for the -// struct [OrganizationSSOConfigurationNewResponse] -type organizationSSOConfigurationNewResponseJSON struct { - SSOConfiguration apijson.Field - raw string - ExtraFields map[string]apijson.Field -} +type ProviderType string -func (r *OrganizationSSOConfigurationNewResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} +const ( + ProviderTypeProviderTypeUnspecified ProviderType = "PROVIDER_TYPE_UNSPECIFIED" + ProviderTypeProviderTypeBuiltin ProviderType = "PROVIDER_TYPE_BUILTIN" + ProviderTypeProviderTypeCustom ProviderType = "PROVIDER_TYPE_CUSTOM" +) -func (r organizationSSOConfigurationNewResponseJSON) RawJSON() string { - return r.raw +func (r ProviderType) IsKnown() bool { + switch r { + case ProviderTypeProviderTypeUnspecified, ProviderTypeProviderTypeBuiltin, ProviderTypeProviderTypeCustom: + return true + } + return false } -// sso_configuration is the created SSO configuration -type OrganizationSSOConfigurationNewResponseSSOConfiguration struct { +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. @@ -124,16 +117,15 @@ type OrganizationSSOConfigurationNewResponseSSOConfiguration struct { IssuerURL string `json:"issuerUrl"` OrganizationID string `json:"organizationId" format:"uuid"` // provider_type defines the type of the SSO configuration - ProviderType OrganizationSSOConfigurationNewResponseSSOConfigurationProviderType `json:"providerType"` + ProviderType ProviderType `json:"providerType"` // state is the state of the SSO configuration - State OrganizationSSOConfigurationNewResponseSSOConfigurationState `json:"state"` - JSON organizationSSOConfigurationNewResponseSSOConfigurationJSON `json:"-"` + State SSOConfigurationState `json:"state"` + JSON ssoConfigurationJSON `json:"-"` } -// organizationSSOConfigurationNewResponseSSOConfigurationJSON contains the JSON -// metadata for the struct -// [OrganizationSSOConfigurationNewResponseSSOConfiguration] -type organizationSSOConfigurationNewResponseSSOConfigurationJSON struct { +// ssoConfigurationJSON contains the JSON metadata for the struct +// [SSOConfiguration] +type ssoConfigurationJSON struct { ID apijson.Field Claims apijson.Field ClientID apijson.Field @@ -146,52 +138,56 @@ type organizationSSOConfigurationNewResponseSSOConfigurationJSON struct { ExtraFields map[string]apijson.Field } -func (r *OrganizationSSOConfigurationNewResponseSSOConfiguration) UnmarshalJSON(data []byte) (err error) { +func (r *SSOConfiguration) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r organizationSSOConfigurationNewResponseSSOConfigurationJSON) RawJSON() string { +func (r ssoConfigurationJSON) RawJSON() string { return r.raw } -// provider_type defines the type of the SSO configuration -type OrganizationSSOConfigurationNewResponseSSOConfigurationProviderType string +type SSOConfigurationState string const ( - OrganizationSSOConfigurationNewResponseSSOConfigurationProviderTypeProviderTypeUnspecified OrganizationSSOConfigurationNewResponseSSOConfigurationProviderType = "PROVIDER_TYPE_UNSPECIFIED" - OrganizationSSOConfigurationNewResponseSSOConfigurationProviderTypeProviderTypeBuiltin OrganizationSSOConfigurationNewResponseSSOConfigurationProviderType = "PROVIDER_TYPE_BUILTIN" - OrganizationSSOConfigurationNewResponseSSOConfigurationProviderTypeProviderTypeCustom OrganizationSSOConfigurationNewResponseSSOConfigurationProviderType = "PROVIDER_TYPE_CUSTOM" + SSOConfigurationStateSSOConfigurationStateUnspecified SSOConfigurationState = "SSO_CONFIGURATION_STATE_UNSPECIFIED" + SSOConfigurationStateSSOConfigurationStateInactive SSOConfigurationState = "SSO_CONFIGURATION_STATE_INACTIVE" + SSOConfigurationStateSSOConfigurationStateActive SSOConfigurationState = "SSO_CONFIGURATION_STATE_ACTIVE" ) -func (r OrganizationSSOConfigurationNewResponseSSOConfigurationProviderType) IsKnown() bool { +func (r SSOConfigurationState) IsKnown() bool { switch r { - case OrganizationSSOConfigurationNewResponseSSOConfigurationProviderTypeProviderTypeUnspecified, OrganizationSSOConfigurationNewResponseSSOConfigurationProviderTypeProviderTypeBuiltin, OrganizationSSOConfigurationNewResponseSSOConfigurationProviderTypeProviderTypeCustom: + case SSOConfigurationStateSSOConfigurationStateUnspecified, SSOConfigurationStateSSOConfigurationStateInactive, SSOConfigurationStateSSOConfigurationStateActive: return true } return false } -// state is the state of the SSO configuration -type OrganizationSSOConfigurationNewResponseSSOConfigurationState string +type OrganizationSSOConfigurationNewResponse struct { + // sso_configuration is the created SSO configuration + SSOConfiguration SSOConfiguration `json:"ssoConfiguration"` + JSON organizationSSOConfigurationNewResponseJSON `json:"-"` +} -const ( - OrganizationSSOConfigurationNewResponseSSOConfigurationStateSSOConfigurationStateUnspecified OrganizationSSOConfigurationNewResponseSSOConfigurationState = "SSO_CONFIGURATION_STATE_UNSPECIFIED" - OrganizationSSOConfigurationNewResponseSSOConfigurationStateSSOConfigurationStateInactive OrganizationSSOConfigurationNewResponseSSOConfigurationState = "SSO_CONFIGURATION_STATE_INACTIVE" - OrganizationSSOConfigurationNewResponseSSOConfigurationStateSSOConfigurationStateActive OrganizationSSOConfigurationNewResponseSSOConfigurationState = "SSO_CONFIGURATION_STATE_ACTIVE" -) +// organizationSSOConfigurationNewResponseJSON contains the JSON metadata for the +// struct [OrganizationSSOConfigurationNewResponse] +type organizationSSOConfigurationNewResponseJSON struct { + SSOConfiguration apijson.Field + raw string + ExtraFields map[string]apijson.Field +} -func (r OrganizationSSOConfigurationNewResponseSSOConfigurationState) IsKnown() bool { - switch r { - case OrganizationSSOConfigurationNewResponseSSOConfigurationStateSSOConfigurationStateUnspecified, OrganizationSSOConfigurationNewResponseSSOConfigurationStateSSOConfigurationStateInactive, OrganizationSSOConfigurationNewResponseSSOConfigurationStateSSOConfigurationStateActive: - return true - } - return false +func (r *OrganizationSSOConfigurationNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r organizationSSOConfigurationNewResponseJSON) RawJSON() string { + return r.raw } type OrganizationSSOConfigurationGetResponse struct { // sso_configuration is the SSO configuration identified by the ID - SSOConfiguration OrganizationSSOConfigurationGetResponseSSOConfiguration `json:"ssoConfiguration"` - JSON organizationSSOConfigurationGetResponseJSON `json:"-"` + SSOConfiguration SSOConfiguration `json:"ssoConfiguration"` + JSON organizationSSOConfigurationGetResponseJSON `json:"-"` } // organizationSSOConfigurationGetResponseJSON contains the JSON metadata for the @@ -210,160 +206,8 @@ func (r organizationSSOConfigurationGetResponseJSON) RawJSON() string { return r.raw } -// sso_configuration is the SSO configuration identified by the ID -type OrganizationSSOConfigurationGetResponseSSOConfiguration 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"` - // client_id is the client ID of the OIDC application set on the IdP - ClientID string `json:"clientId"` - EmailDomain string `json:"emailDomain"` - // issuer_url is the URL of the IdP issuer - IssuerURL string `json:"issuerUrl"` - OrganizationID string `json:"organizationId" format:"uuid"` - // provider_type defines the type of the SSO configuration - ProviderType OrganizationSSOConfigurationGetResponseSSOConfigurationProviderType `json:"providerType"` - // state is the state of the SSO configuration - State OrganizationSSOConfigurationGetResponseSSOConfigurationState `json:"state"` - JSON organizationSSOConfigurationGetResponseSSOConfigurationJSON `json:"-"` -} - -// organizationSSOConfigurationGetResponseSSOConfigurationJSON contains the JSON -// metadata for the struct -// [OrganizationSSOConfigurationGetResponseSSOConfiguration] -type organizationSSOConfigurationGetResponseSSOConfigurationJSON 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 - raw string - ExtraFields map[string]apijson.Field -} - -func (r *OrganizationSSOConfigurationGetResponseSSOConfiguration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r organizationSSOConfigurationGetResponseSSOConfigurationJSON) RawJSON() string { - return r.raw -} - -// provider_type defines the type of the SSO configuration -type OrganizationSSOConfigurationGetResponseSSOConfigurationProviderType string - -const ( - OrganizationSSOConfigurationGetResponseSSOConfigurationProviderTypeProviderTypeUnspecified OrganizationSSOConfigurationGetResponseSSOConfigurationProviderType = "PROVIDER_TYPE_UNSPECIFIED" - OrganizationSSOConfigurationGetResponseSSOConfigurationProviderTypeProviderTypeBuiltin OrganizationSSOConfigurationGetResponseSSOConfigurationProviderType = "PROVIDER_TYPE_BUILTIN" - OrganizationSSOConfigurationGetResponseSSOConfigurationProviderTypeProviderTypeCustom OrganizationSSOConfigurationGetResponseSSOConfigurationProviderType = "PROVIDER_TYPE_CUSTOM" -) - -func (r OrganizationSSOConfigurationGetResponseSSOConfigurationProviderType) IsKnown() bool { - switch r { - case OrganizationSSOConfigurationGetResponseSSOConfigurationProviderTypeProviderTypeUnspecified, OrganizationSSOConfigurationGetResponseSSOConfigurationProviderTypeProviderTypeBuiltin, OrganizationSSOConfigurationGetResponseSSOConfigurationProviderTypeProviderTypeCustom: - return true - } - return false -} - -// state is the state of the SSO configuration -type OrganizationSSOConfigurationGetResponseSSOConfigurationState string - -const ( - OrganizationSSOConfigurationGetResponseSSOConfigurationStateSSOConfigurationStateUnspecified OrganizationSSOConfigurationGetResponseSSOConfigurationState = "SSO_CONFIGURATION_STATE_UNSPECIFIED" - OrganizationSSOConfigurationGetResponseSSOConfigurationStateSSOConfigurationStateInactive OrganizationSSOConfigurationGetResponseSSOConfigurationState = "SSO_CONFIGURATION_STATE_INACTIVE" - OrganizationSSOConfigurationGetResponseSSOConfigurationStateSSOConfigurationStateActive OrganizationSSOConfigurationGetResponseSSOConfigurationState = "SSO_CONFIGURATION_STATE_ACTIVE" -) - -func (r OrganizationSSOConfigurationGetResponseSSOConfigurationState) IsKnown() bool { - switch r { - case OrganizationSSOConfigurationGetResponseSSOConfigurationStateSSOConfigurationStateUnspecified, OrganizationSSOConfigurationGetResponseSSOConfigurationStateSSOConfigurationStateInactive, OrganizationSSOConfigurationGetResponseSSOConfigurationStateSSOConfigurationStateActive: - return true - } - return false -} - type OrganizationSSOConfigurationUpdateResponse = interface{} -type OrganizationSSOConfigurationListResponse 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"` - // client_id is the client ID of the OIDC application set on the IdP - ClientID string `json:"clientId"` - EmailDomain string `json:"emailDomain"` - // issuer_url is the URL of the IdP issuer - IssuerURL string `json:"issuerUrl"` - OrganizationID string `json:"organizationId" format:"uuid"` - // provider_type defines the type of the SSO configuration - ProviderType OrganizationSSOConfigurationListResponseProviderType `json:"providerType"` - // state is the state of the SSO configuration - State OrganizationSSOConfigurationListResponseState `json:"state"` - JSON organizationSSOConfigurationListResponseJSON `json:"-"` -} - -// organizationSSOConfigurationListResponseJSON contains the JSON metadata for the -// struct [OrganizationSSOConfigurationListResponse] -type organizationSSOConfigurationListResponseJSON 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 - raw string - ExtraFields map[string]apijson.Field -} - -func (r *OrganizationSSOConfigurationListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r organizationSSOConfigurationListResponseJSON) RawJSON() string { - return r.raw -} - -// provider_type defines the type of the SSO configuration -type OrganizationSSOConfigurationListResponseProviderType string - -const ( - OrganizationSSOConfigurationListResponseProviderTypeProviderTypeUnspecified OrganizationSSOConfigurationListResponseProviderType = "PROVIDER_TYPE_UNSPECIFIED" - OrganizationSSOConfigurationListResponseProviderTypeProviderTypeBuiltin OrganizationSSOConfigurationListResponseProviderType = "PROVIDER_TYPE_BUILTIN" - OrganizationSSOConfigurationListResponseProviderTypeProviderTypeCustom OrganizationSSOConfigurationListResponseProviderType = "PROVIDER_TYPE_CUSTOM" -) - -func (r OrganizationSSOConfigurationListResponseProviderType) IsKnown() bool { - switch r { - case OrganizationSSOConfigurationListResponseProviderTypeProviderTypeUnspecified, OrganizationSSOConfigurationListResponseProviderTypeProviderTypeBuiltin, OrganizationSSOConfigurationListResponseProviderTypeProviderTypeCustom: - return true - } - return false -} - -// state is the state of the SSO configuration -type OrganizationSSOConfigurationListResponseState string - -const ( - OrganizationSSOConfigurationListResponseStateSSOConfigurationStateUnspecified OrganizationSSOConfigurationListResponseState = "SSO_CONFIGURATION_STATE_UNSPECIFIED" - OrganizationSSOConfigurationListResponseStateSSOConfigurationStateInactive OrganizationSSOConfigurationListResponseState = "SSO_CONFIGURATION_STATE_INACTIVE" - OrganizationSSOConfigurationListResponseStateSSOConfigurationStateActive OrganizationSSOConfigurationListResponseState = "SSO_CONFIGURATION_STATE_ACTIVE" -) - -func (r OrganizationSSOConfigurationListResponseState) IsKnown() bool { - switch r { - case OrganizationSSOConfigurationListResponseStateSSOConfigurationStateUnspecified, OrganizationSSOConfigurationListResponseStateSSOConfigurationStateInactive, OrganizationSSOConfigurationListResponseStateSSOConfigurationStateActive: - return true - } - return false -} - type OrganizationSSOConfigurationDeleteResponse = interface{} type OrganizationSSOConfigurationNewParams struct { @@ -392,14 +236,8 @@ func (r OrganizationSSOConfigurationGetParams) MarshalJSON() (data []byte, err e } type OrganizationSSOConfigurationUpdateParams struct { - Body OrganizationSSOConfigurationUpdateParamsBodyUnion `json:"body,required"` -} - -func (r OrganizationSSOConfigurationUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - -type OrganizationSSOConfigurationUpdateParamsBody struct { + // 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 ClientID param.Field[string] `json:"clientId"` // client_secret is the client secret of the SSO provider @@ -407,121 +245,16 @@ type OrganizationSSOConfigurationUpdateParamsBody 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[OrganizationSSOConfigurationUpdateParamsBodyState] `json:"state"` -} - -func (r OrganizationSSOConfigurationUpdateParamsBody) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r OrganizationSSOConfigurationUpdateParamsBody) implementsOrganizationSSOConfigurationUpdateParamsBodyUnion() { -} - -// Satisfied by -// [OrganizationSSOConfigurationUpdateParamsBodyClientIDIsTheClientIDOfTheSSOProvider], -// [OrganizationSSOConfigurationUpdateParamsBodyClientSecretIsTheClientSecretOfTheSSOProvider], -// [OrganizationSSOConfigurationUpdateParamsBodyEmailDomain], -// [OrganizationSSOConfigurationUpdateParamsBodyIssuerURLIsTheURLOfTheIDPIssuer], -// [OrganizationSSOConfigurationUpdateParamsBodyStateIsTheStateOfTheSSOConfiguration], -// [OrganizationSSOConfigurationUpdateParamsBody]. -type OrganizationSSOConfigurationUpdateParamsBodyUnion interface { - implementsOrganizationSSOConfigurationUpdateParamsBodyUnion() -} - -type OrganizationSSOConfigurationUpdateParamsBodyClientIDIsTheClientIDOfTheSSOProvider struct { - // client_id is the client ID of the SSO provider - ClientID param.Field[string] `json:"clientId,required"` -} - -func (r OrganizationSSOConfigurationUpdateParamsBodyClientIDIsTheClientIDOfTheSSOProvider) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r OrganizationSSOConfigurationUpdateParamsBodyClientIDIsTheClientIDOfTheSSOProvider) implementsOrganizationSSOConfigurationUpdateParamsBodyUnion() { -} - -type OrganizationSSOConfigurationUpdateParamsBodyClientSecretIsTheClientSecretOfTheSSOProvider struct { - // client_secret is the client secret of the SSO provider - ClientSecret param.Field[string] `json:"clientSecret,required"` -} - -func (r OrganizationSSOConfigurationUpdateParamsBodyClientSecretIsTheClientSecretOfTheSSOProvider) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r OrganizationSSOConfigurationUpdateParamsBodyClientSecretIsTheClientSecretOfTheSSOProvider) implementsOrganizationSSOConfigurationUpdateParamsBodyUnion() { -} - -type OrganizationSSOConfigurationUpdateParamsBodyEmailDomain struct { - EmailDomain param.Field[string] `json:"emailDomain,required"` -} - -func (r OrganizationSSOConfigurationUpdateParamsBodyEmailDomain) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r OrganizationSSOConfigurationUpdateParamsBodyEmailDomain) implementsOrganizationSSOConfigurationUpdateParamsBodyUnion() { -} - -type OrganizationSSOConfigurationUpdateParamsBodyIssuerURLIsTheURLOfTheIDPIssuer struct { - // issuer_url is the URL of the IdP issuer - IssuerURL param.Field[string] `json:"issuerUrl,required" format:"uri"` -} - -func (r OrganizationSSOConfigurationUpdateParamsBodyIssuerURLIsTheURLOfTheIDPIssuer) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r OrganizationSSOConfigurationUpdateParamsBodyIssuerURLIsTheURLOfTheIDPIssuer) implementsOrganizationSSOConfigurationUpdateParamsBodyUnion() { -} - -type OrganizationSSOConfigurationUpdateParamsBodyStateIsTheStateOfTheSSOConfiguration struct { - // state is the state of the SSO configuration - State param.Field[OrganizationSSOConfigurationUpdateParamsBodyStateIsTheStateOfTheSSOConfigurationState] `json:"state,required"` + State param.Field[SSOConfigurationState] `json:"state"` } -func (r OrganizationSSOConfigurationUpdateParamsBodyStateIsTheStateOfTheSSOConfiguration) MarshalJSON() (data []byte, err error) { +func (r OrganizationSSOConfigurationUpdateParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r OrganizationSSOConfigurationUpdateParamsBodyStateIsTheStateOfTheSSOConfiguration) implementsOrganizationSSOConfigurationUpdateParamsBodyUnion() { -} - -// state is the state of the SSO configuration -type OrganizationSSOConfigurationUpdateParamsBodyStateIsTheStateOfTheSSOConfigurationState string - -const ( - OrganizationSSOConfigurationUpdateParamsBodyStateIsTheStateOfTheSSOConfigurationStateSSOConfigurationStateUnspecified OrganizationSSOConfigurationUpdateParamsBodyStateIsTheStateOfTheSSOConfigurationState = "SSO_CONFIGURATION_STATE_UNSPECIFIED" - OrganizationSSOConfigurationUpdateParamsBodyStateIsTheStateOfTheSSOConfigurationStateSSOConfigurationStateInactive OrganizationSSOConfigurationUpdateParamsBodyStateIsTheStateOfTheSSOConfigurationState = "SSO_CONFIGURATION_STATE_INACTIVE" - OrganizationSSOConfigurationUpdateParamsBodyStateIsTheStateOfTheSSOConfigurationStateSSOConfigurationStateActive OrganizationSSOConfigurationUpdateParamsBodyStateIsTheStateOfTheSSOConfigurationState = "SSO_CONFIGURATION_STATE_ACTIVE" -) - -func (r OrganizationSSOConfigurationUpdateParamsBodyStateIsTheStateOfTheSSOConfigurationState) IsKnown() bool { - switch r { - case OrganizationSSOConfigurationUpdateParamsBodyStateIsTheStateOfTheSSOConfigurationStateSSOConfigurationStateUnspecified, OrganizationSSOConfigurationUpdateParamsBodyStateIsTheStateOfTheSSOConfigurationStateSSOConfigurationStateInactive, OrganizationSSOConfigurationUpdateParamsBodyStateIsTheStateOfTheSSOConfigurationStateSSOConfigurationStateActive: - return true - } - return false -} - -// state is the state of the SSO configuration -type OrganizationSSOConfigurationUpdateParamsBodyState string - -const ( - OrganizationSSOConfigurationUpdateParamsBodyStateSSOConfigurationStateUnspecified OrganizationSSOConfigurationUpdateParamsBodyState = "SSO_CONFIGURATION_STATE_UNSPECIFIED" - OrganizationSSOConfigurationUpdateParamsBodyStateSSOConfigurationStateInactive OrganizationSSOConfigurationUpdateParamsBodyState = "SSO_CONFIGURATION_STATE_INACTIVE" - OrganizationSSOConfigurationUpdateParamsBodyStateSSOConfigurationStateActive OrganizationSSOConfigurationUpdateParamsBodyState = "SSO_CONFIGURATION_STATE_ACTIVE" -) - -func (r OrganizationSSOConfigurationUpdateParamsBodyState) IsKnown() bool { - switch r { - case OrganizationSSOConfigurationUpdateParamsBodyStateSSOConfigurationStateUnspecified, OrganizationSSOConfigurationUpdateParamsBodyStateSSOConfigurationStateInactive, OrganizationSSOConfigurationUpdateParamsBodyStateSSOConfigurationStateActive: - return true - } - return false -} - type OrganizationSSOConfigurationListParams struct { Token param.Field[string] `query:"token"` PageSize param.Field[int64] `query:"pageSize"` diff --git a/organizationssoconfiguration_test.go b/organizationssoconfiguration_test.go index ab631d3..fec6b73 100644 --- a/organizationssoconfiguration_test.go +++ b/organizationssoconfiguration_test.go @@ -67,7 +67,7 @@ func TestOrganizationSSOConfigurationGetWithOptionalParams(t *testing.T) { } } -func TestOrganizationSSOConfigurationUpdate(t *testing.T) { +func TestOrganizationSSOConfigurationUpdateWithOptionalParams(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,9 +81,15 @@ func TestOrganizationSSOConfigurationUpdate(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Organizations.SSOConfigurations.Update(context.TODO(), gitpod.OrganizationSSOConfigurationUpdateParams{ - Body: gitpod.OrganizationSSOConfigurationUpdateParamsBodyClientIDIsTheClientIDOfTheSSOProvider{ - ClientID: gitpod.F("x"), - }, + 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.SSOConfigurationStateSSOConfigurationStateUnspecified), }) if err != nil { var apierr *gitpod.Error diff --git a/project.go b/project.go index 6bbfe0d..424b240 100644 --- a/project.go +++ b/project.go @@ -6,7 +6,6 @@ import ( "context" "net/http" "net/url" - "reflect" "time" "github.com/gitpod-io/flex-sdk-go/internal/apijson" @@ -15,7 +14,7 @@ import ( "github.com/gitpod-io/flex-sdk-go/internal/requestconfig" "github.com/gitpod-io/flex-sdk-go/option" "github.com/gitpod-io/flex-sdk-go/packages/pagination" - "github.com/tidwall/gjson" + "github.com/gitpod-io/flex-sdk-go/shared" ) // ProjectService contains methods and other services that help with interacting @@ -64,7 +63,7 @@ func (r *ProjectService) Update(ctx context.Context, body ProjectUpdateParams, o } // ListProjects lists all projects the caller has access to. -func (r *ProjectService) List(ctx context.Context, params ProjectListParams, opts ...option.RequestOption) (res *pagination.ProjectsPage[ProjectListResponse], err error) { +func (r *ProjectService) List(ctx context.Context, params ProjectListParams, opts ...option.RequestOption) (res *pagination.ProjectsPage[Project], err error) { var raw *http.Response opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -82,7 +81,7 @@ func (r *ProjectService) List(ctx context.Context, params ProjectListParams, opt } // ListProjects lists all projects the caller has access to. -func (r *ProjectService) ListAutoPaging(ctx context.Context, params ProjectListParams, opts ...option.RequestOption) *pagination.ProjectsPageAutoPager[ProjectListResponse] { +func (r *ProjectService) ListAutoPaging(ctx context.Context, params ProjectListParams, opts ...option.RequestOption) *pagination.ProjectsPageAutoPager[Project] { return pagination.NewProjectsPageAutoPager(r.List(ctx, params, opts...)) } @@ -102,394 +101,272 @@ func (r *ProjectService) NewFromEnvironment(ctx context.Context, body ProjectNew return } -type ProjectNewResponse struct { - Project ProjectNewResponseProject `json:"project"` - JSON projectNewResponseJSON `json:"-"` +// EnvironmentInitializer specifies how an environment is to be initialized +type EnvironmentInitializer struct { + Specs []EnvironmentInitializerSpec `json:"specs"` + JSON environmentInitializerJSON `json:"-"` } -// projectNewResponseJSON contains the JSON metadata for the struct -// [ProjectNewResponse] -type projectNewResponseJSON struct { - Project apijson.Field +// environmentInitializerJSON contains the JSON metadata for the struct +// [EnvironmentInitializer] +type environmentInitializerJSON struct { + Specs apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ProjectNewResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectNewResponseJSON) RawJSON() string { - return r.raw -} - -type ProjectNewResponseProject struct { - EnvironmentClass ProjectNewResponseProjectEnvironmentClass `json:"environmentClass,required"` - // id is the unique identifier for the project - ID string `json:"id" format:"uuid"` - // automations_file_path is the path to the automations file relative to the repo - // root - AutomationsFilePath string `json:"automationsFilePath"` - // devcontainer_file_path is the path to the devcontainer file relative to the repo - // root - DevcontainerFilePath string `json:"devcontainerFilePath"` - // EnvironmentInitializer specifies how an environment is to be initialized - Initializer ProjectNewResponseProjectInitializer `json:"initializer"` - Metadata ProjectNewResponseProjectMetadata `json:"metadata"` - UsedBy ProjectNewResponseProjectUsedBy `json:"usedBy"` - JSON projectNewResponseProjectJSON `json:"-"` -} - -// projectNewResponseProjectJSON contains the JSON metadata for the struct -// [ProjectNewResponseProject] -type projectNewResponseProjectJSON struct { - EnvironmentClass apijson.Field - ID apijson.Field - AutomationsFilePath apijson.Field - DevcontainerFilePath apijson.Field - Initializer apijson.Field - Metadata apijson.Field - UsedBy apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectNewResponseProject) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentInitializer) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r projectNewResponseProjectJSON) RawJSON() string { - return r.raw -} - -type ProjectNewResponseProjectEnvironmentClass struct { - // Use a fixed environment class on a given Runner. This cannot be a local runner's - // environment class. - EnvironmentClassID string `json:"environmentClassId" format:"uuid"` - // Use a local runner for the user - LocalRunner bool `json:"localRunner"` - JSON projectNewResponseProjectEnvironmentClassJSON `json:"-"` - union ProjectNewResponseProjectEnvironmentClassUnion -} - -// projectNewResponseProjectEnvironmentClassJSON contains the JSON metadata for the -// struct [ProjectNewResponseProjectEnvironmentClass] -type projectNewResponseProjectEnvironmentClassJSON struct { - EnvironmentClassID apijson.Field - LocalRunner apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r projectNewResponseProjectEnvironmentClassJSON) RawJSON() string { +func (r environmentInitializerJSON) RawJSON() string { return r.raw } -func (r *ProjectNewResponseProjectEnvironmentClass) UnmarshalJSON(data []byte) (err error) { - *r = ProjectNewResponseProjectEnvironmentClass{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a [ProjectNewResponseProjectEnvironmentClassUnion] interface -// which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [ProjectNewResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass], -// [ProjectNewResponseProjectEnvironmentClassUseALocalRunnerForTheUser]. -func (r ProjectNewResponseProjectEnvironmentClass) AsUnion() ProjectNewResponseProjectEnvironmentClassUnion { - return r.union -} - -// Union satisfied by -// [ProjectNewResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass] -// or [ProjectNewResponseProjectEnvironmentClassUseALocalRunnerForTheUser]. -type ProjectNewResponseProjectEnvironmentClassUnion interface { - implementsProjectNewResponseProjectEnvironmentClass() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*ProjectNewResponseProjectEnvironmentClassUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ProjectNewResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ProjectNewResponseProjectEnvironmentClassUseALocalRunnerForTheUser{}), - }, - ) -} - -type ProjectNewResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass struct { - // Use a fixed environment class on a given Runner. This cannot be a local runner's - // environment class. - EnvironmentClassID string `json:"environmentClassId,required" format:"uuid"` - JSON projectNewResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClassJSON `json:"-"` +type EnvironmentInitializerSpec struct { + ContextURL EnvironmentInitializerSpecsContextURL `json:"contextUrl"` + Git EnvironmentInitializerSpecsGit `json:"git"` + JSON environmentInitializerSpecJSON `json:"-"` } -// projectNewResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClassJSON -// contains the JSON metadata for the struct -// [ProjectNewResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass] -type projectNewResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClassJSON struct { - EnvironmentClassID apijson.Field - raw string - ExtraFields map[string]apijson.Field +// environmentInitializerSpecJSON contains the JSON metadata for the struct +// [EnvironmentInitializerSpec] +type environmentInitializerSpecJSON struct { + ContextURL apijson.Field + Git apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *ProjectNewResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentInitializerSpec) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r projectNewResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClassJSON) RawJSON() string { +func (r environmentInitializerSpecJSON) RawJSON() string { return r.raw } -func (r ProjectNewResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass) implementsProjectNewResponseProjectEnvironmentClass() { -} - -type ProjectNewResponseProjectEnvironmentClassUseALocalRunnerForTheUser struct { - // Use a local runner for the user - LocalRunner bool `json:"localRunner,required"` - JSON projectNewResponseProjectEnvironmentClassUseALocalRunnerForTheUserJSON `json:"-"` +type EnvironmentInitializerSpecsContextURL struct { + // url is the URL from which the environment is created + URL string `json:"url" format:"uri"` + JSON environmentInitializerSpecsContextURLJSON `json:"-"` } -// projectNewResponseProjectEnvironmentClassUseALocalRunnerForTheUserJSON contains -// the JSON metadata for the struct -// [ProjectNewResponseProjectEnvironmentClassUseALocalRunnerForTheUser] -type projectNewResponseProjectEnvironmentClassUseALocalRunnerForTheUserJSON struct { - LocalRunner apijson.Field +// environmentInitializerSpecsContextURLJSON contains the JSON metadata for the +// struct [EnvironmentInitializerSpecsContextURL] +type environmentInitializerSpecsContextURLJSON struct { + URL apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ProjectNewResponseProjectEnvironmentClassUseALocalRunnerForTheUser) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentInitializerSpecsContextURL) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r projectNewResponseProjectEnvironmentClassUseALocalRunnerForTheUserJSON) RawJSON() string { +func (r environmentInitializerSpecsContextURLJSON) RawJSON() string { return r.raw } -func (r ProjectNewResponseProjectEnvironmentClassUseALocalRunnerForTheUser) implementsProjectNewResponseProjectEnvironmentClass() { -} - -// EnvironmentInitializer specifies how an environment is to be initialized -type ProjectNewResponseProjectInitializer struct { - Specs []ProjectNewResponseProjectInitializerSpec `json:"specs"` - JSON projectNewResponseProjectInitializerJSON `json:"-"` +type EnvironmentInitializerSpecsGit struct { + // a path relative to the environment root in which the code will be checked out to + CheckoutLocation string `json:"checkoutLocation"` + // the value for the clone target mode - use depends on the target mode + CloneTarget string `json:"cloneTarget"` + // remote_uri is the Git remote origin + RemoteUri string `json:"remoteUri"` + // CloneTargetMode is the target state in which we want to leave a GitEnvironment + TargetMode EnvironmentInitializerSpecsGitTargetMode `json:"targetMode"` + // upstream_Remote_uri is the fork upstream of a repository + UpstreamRemoteUri string `json:"upstreamRemoteUri"` + JSON environmentInitializerSpecsGitJSON `json:"-"` } -// projectNewResponseProjectInitializerJSON contains the JSON metadata for the -// struct [ProjectNewResponseProjectInitializer] -type projectNewResponseProjectInitializerJSON struct { - Specs apijson.Field - raw string - ExtraFields map[string]apijson.Field +// environmentInitializerSpecsGitJSON contains the JSON metadata for the struct +// [EnvironmentInitializerSpecsGit] +type environmentInitializerSpecsGitJSON struct { + CheckoutLocation apijson.Field + CloneTarget apijson.Field + RemoteUri apijson.Field + TargetMode apijson.Field + UpstreamRemoteUri apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *ProjectNewResponseProjectInitializer) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentInitializerSpecsGit) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r projectNewResponseProjectInitializerJSON) RawJSON() string { +func (r environmentInitializerSpecsGitJSON) RawJSON() string { return r.raw } -type ProjectNewResponseProjectInitializerSpec struct { - // This field can have the runtime type of - // [ProjectNewResponseProjectInitializerSpecsContextURLContextURL]. - ContextURL interface{} `json:"contextUrl"` - // This field can have the runtime type of - // [ProjectNewResponseProjectInitializerSpecsGitGit]. - Git interface{} `json:"git"` - JSON projectNewResponseProjectInitializerSpecJSON `json:"-"` - union ProjectNewResponseProjectInitializerSpecsUnion -} - -// projectNewResponseProjectInitializerSpecJSON contains the JSON metadata for the -// struct [ProjectNewResponseProjectInitializerSpec] -type projectNewResponseProjectInitializerSpecJSON struct { - ContextURL apijson.Field - Git apijson.Field - raw string - ExtraFields map[string]apijson.Field -} +// CloneTargetMode is the target state in which we want to leave a GitEnvironment +type EnvironmentInitializerSpecsGitTargetMode string -func (r projectNewResponseProjectInitializerSpecJSON) RawJSON() string { - return r.raw -} +const ( + EnvironmentInitializerSpecsGitTargetModeCloneTargetModeUnspecified EnvironmentInitializerSpecsGitTargetMode = "CLONE_TARGET_MODE_UNSPECIFIED" + EnvironmentInitializerSpecsGitTargetModeCloneTargetModeRemoteHead EnvironmentInitializerSpecsGitTargetMode = "CLONE_TARGET_MODE_REMOTE_HEAD" + EnvironmentInitializerSpecsGitTargetModeCloneTargetModeRemoteCommit EnvironmentInitializerSpecsGitTargetMode = "CLONE_TARGET_MODE_REMOTE_COMMIT" + EnvironmentInitializerSpecsGitTargetModeCloneTargetModeRemoteBranch EnvironmentInitializerSpecsGitTargetMode = "CLONE_TARGET_MODE_REMOTE_BRANCH" + EnvironmentInitializerSpecsGitTargetModeCloneTargetModeLocalBranch EnvironmentInitializerSpecsGitTargetMode = "CLONE_TARGET_MODE_LOCAL_BRANCH" +) -func (r *ProjectNewResponseProjectInitializerSpec) UnmarshalJSON(data []byte) (err error) { - *r = ProjectNewResponseProjectInitializerSpec{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err +func (r EnvironmentInitializerSpecsGitTargetMode) IsKnown() bool { + switch r { + case EnvironmentInitializerSpecsGitTargetModeCloneTargetModeUnspecified, EnvironmentInitializerSpecsGitTargetModeCloneTargetModeRemoteHead, EnvironmentInitializerSpecsGitTargetModeCloneTargetModeRemoteCommit, EnvironmentInitializerSpecsGitTargetModeCloneTargetModeRemoteBranch, EnvironmentInitializerSpecsGitTargetModeCloneTargetModeLocalBranch: + return true } - return apijson.Port(r.union, &r) + return false } -// AsUnion returns a [ProjectNewResponseProjectInitializerSpecsUnion] interface -// which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [ProjectNewResponseProjectInitializerSpecsContextURL], -// [ProjectNewResponseProjectInitializerSpecsGit]. -func (r ProjectNewResponseProjectInitializerSpec) AsUnion() ProjectNewResponseProjectInitializerSpecsUnion { - return r.union +// EnvironmentInitializer specifies how an environment is to be initialized +type EnvironmentInitializerParam struct { + Specs param.Field[[]EnvironmentInitializerSpecParam] `json:"specs"` } -// Union satisfied by [ProjectNewResponseProjectInitializerSpecsContextURL] or -// [ProjectNewResponseProjectInitializerSpecsGit]. -type ProjectNewResponseProjectInitializerSpecsUnion interface { - implementsProjectNewResponseProjectInitializerSpec() +func (r EnvironmentInitializerParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*ProjectNewResponseProjectInitializerSpecsUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ProjectNewResponseProjectInitializerSpecsContextURL{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ProjectNewResponseProjectInitializerSpecsGit{}), - }, - ) +type EnvironmentInitializerSpecParam struct { + ContextURL param.Field[EnvironmentInitializerSpecsContextURLParam] `json:"contextUrl"` + Git param.Field[EnvironmentInitializerSpecsGitParam] `json:"git"` } -type ProjectNewResponseProjectInitializerSpecsContextURL struct { - ContextURL ProjectNewResponseProjectInitializerSpecsContextURLContextURL `json:"contextUrl,required"` - JSON projectNewResponseProjectInitializerSpecsContextURLJSON `json:"-"` +func (r EnvironmentInitializerSpecParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -// projectNewResponseProjectInitializerSpecsContextURLJSON contains the JSON -// metadata for the struct [ProjectNewResponseProjectInitializerSpecsContextURL] -type projectNewResponseProjectInitializerSpecsContextURLJSON struct { - ContextURL apijson.Field - raw string - ExtraFields map[string]apijson.Field +type EnvironmentInitializerSpecsContextURLParam struct { + // url is the URL from which the environment is created + URL param.Field[string] `json:"url" format:"uri"` } -func (r *ProjectNewResponseProjectInitializerSpecsContextURL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +func (r EnvironmentInitializerSpecsContextURLParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -func (r projectNewResponseProjectInitializerSpecsContextURLJSON) RawJSON() string { - return r.raw +type EnvironmentInitializerSpecsGitParam struct { + // a path relative to the environment root in which the code will be checked out to + CheckoutLocation param.Field[string] `json:"checkoutLocation"` + // the value for the clone target mode - use depends on the target mode + CloneTarget param.Field[string] `json:"cloneTarget"` + // remote_uri is the Git remote origin + RemoteUri param.Field[string] `json:"remoteUri"` + // CloneTargetMode is the target state in which we want to leave a GitEnvironment + TargetMode param.Field[EnvironmentInitializerSpecsGitTargetMode] `json:"targetMode"` + // upstream_Remote_uri is the fork upstream of a repository + UpstreamRemoteUri param.Field[string] `json:"upstreamRemoteUri"` } -func (r ProjectNewResponseProjectInitializerSpecsContextURL) implementsProjectNewResponseProjectInitializerSpec() { +func (r EnvironmentInitializerSpecsGitParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -type ProjectNewResponseProjectInitializerSpecsContextURLContextURL struct { - // url is the URL from which the environment is created - URL string `json:"url" format:"uri"` - JSON projectNewResponseProjectInitializerSpecsContextURLContextURLJSON `json:"-"` +type Project struct { + EnvironmentClass ProjectEnvironmentClass `json:"environmentClass,required"` + // id is the unique identifier for the project + ID string `json:"id" format:"uuid"` + // automations_file_path is the path to the automations file relative to the repo + // root + AutomationsFilePath string `json:"automationsFilePath"` + // devcontainer_file_path is the path to the devcontainer file relative to the repo + // root + DevcontainerFilePath string `json:"devcontainerFilePath"` + // EnvironmentInitializer specifies how an environment is to be initialized + Initializer EnvironmentInitializer `json:"initializer"` + Metadata ProjectMetadata `json:"metadata"` + UsedBy ProjectUsedBy `json:"usedBy"` + JSON projectJSON `json:"-"` } -// projectNewResponseProjectInitializerSpecsContextURLContextURLJSON contains the -// JSON metadata for the struct -// [ProjectNewResponseProjectInitializerSpecsContextURLContextURL] -type projectNewResponseProjectInitializerSpecsContextURLContextURLJSON struct { - URL apijson.Field - raw string - ExtraFields map[string]apijson.Field +// projectJSON contains the JSON metadata for the struct [Project] +type projectJSON struct { + EnvironmentClass apijson.Field + ID apijson.Field + AutomationsFilePath apijson.Field + DevcontainerFilePath apijson.Field + Initializer apijson.Field + Metadata apijson.Field + UsedBy apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *ProjectNewResponseProjectInitializerSpecsContextURLContextURL) UnmarshalJSON(data []byte) (err error) { +func (r *Project) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r projectNewResponseProjectInitializerSpecsContextURLContextURLJSON) RawJSON() string { +func (r projectJSON) RawJSON() string { return r.raw } -type ProjectNewResponseProjectInitializerSpecsGit struct { - Git ProjectNewResponseProjectInitializerSpecsGitGit `json:"git,required"` - JSON projectNewResponseProjectInitializerSpecsGitJSON `json:"-"` +type ProjectUsedBy struct { + // Subjects are the 10 most recent subjects who have used the project to create an + // environment + Subjects []shared.Subject `json:"subjects"` + // Total number of unique subjects who have used the project + TotalSubjects int64 `json:"totalSubjects"` + JSON projectUsedByJSON `json:"-"` } -// projectNewResponseProjectInitializerSpecsGitJSON contains the JSON metadata for -// the struct [ProjectNewResponseProjectInitializerSpecsGit] -type projectNewResponseProjectInitializerSpecsGitJSON struct { - Git apijson.Field - raw string - ExtraFields map[string]apijson.Field +// projectUsedByJSON contains the JSON metadata for the struct [ProjectUsedBy] +type projectUsedByJSON struct { + Subjects apijson.Field + TotalSubjects apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *ProjectNewResponseProjectInitializerSpecsGit) UnmarshalJSON(data []byte) (err error) { +func (r *ProjectUsedBy) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r projectNewResponseProjectInitializerSpecsGitJSON) RawJSON() string { +func (r projectUsedByJSON) RawJSON() string { return r.raw } -func (r ProjectNewResponseProjectInitializerSpecsGit) implementsProjectNewResponseProjectInitializerSpec() { -} - -type ProjectNewResponseProjectInitializerSpecsGitGit struct { - // a path relative to the environment root in which the code will be checked out to - CheckoutLocation string `json:"checkoutLocation"` - // the value for the clone target mode - use depends on the target mode - CloneTarget string `json:"cloneTarget"` - // remote_uri is the Git remote origin - RemoteUri string `json:"remoteUri"` - // CloneTargetMode is the target state in which we want to leave a GitEnvironment - TargetMode ProjectNewResponseProjectInitializerSpecsGitGitTargetMode `json:"targetMode"` - // upstream_Remote_uri is the fork upstream of a repository - UpstreamRemoteUri string `json:"upstreamRemoteUri"` - JSON projectNewResponseProjectInitializerSpecsGitGitJSON `json:"-"` +type ProjectEnvironmentClass struct { + // Use a fixed environment class on a given Runner. This cannot be a local runner's + // environment class. + EnvironmentClassID string `json:"environmentClassId" format:"uuid"` + // Use a local runner for the user + LocalRunner bool `json:"localRunner"` + JSON projectEnvironmentClassJSON `json:"-"` } -// projectNewResponseProjectInitializerSpecsGitGitJSON contains the JSON metadata -// for the struct [ProjectNewResponseProjectInitializerSpecsGitGit] -type projectNewResponseProjectInitializerSpecsGitGitJSON struct { - CheckoutLocation apijson.Field - CloneTarget apijson.Field - RemoteUri apijson.Field - TargetMode apijson.Field - UpstreamRemoteUri apijson.Field - raw string - ExtraFields map[string]apijson.Field +// projectEnvironmentClassJSON contains the JSON metadata for the struct +// [ProjectEnvironmentClass] +type projectEnvironmentClassJSON struct { + EnvironmentClassID apijson.Field + LocalRunner apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *ProjectNewResponseProjectInitializerSpecsGitGit) UnmarshalJSON(data []byte) (err error) { +func (r *ProjectEnvironmentClass) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r projectNewResponseProjectInitializerSpecsGitGitJSON) RawJSON() string { +func (r projectEnvironmentClassJSON) RawJSON() string { return r.raw } -// CloneTargetMode is the target state in which we want to leave a GitEnvironment -type ProjectNewResponseProjectInitializerSpecsGitGitTargetMode string - -const ( - ProjectNewResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified ProjectNewResponseProjectInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_UNSPECIFIED" - ProjectNewResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead ProjectNewResponseProjectInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_HEAD" - ProjectNewResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit ProjectNewResponseProjectInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_COMMIT" - ProjectNewResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch ProjectNewResponseProjectInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_BRANCH" - ProjectNewResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch ProjectNewResponseProjectInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_LOCAL_BRANCH" -) +type ProjectEnvironmentClassParam struct { + // Use a fixed environment class on a given Runner. This cannot be a local runner's + // environment class. + EnvironmentClassID param.Field[string] `json:"environmentClassId" format:"uuid"` + // Use a local runner for the user + LocalRunner param.Field[bool] `json:"localRunner"` +} -func (r ProjectNewResponseProjectInitializerSpecsGitGitTargetMode) IsKnown() bool { - switch r { - case ProjectNewResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified, ProjectNewResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead, ProjectNewResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit, ProjectNewResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch, ProjectNewResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch: - return true - } - return false +func (r ProjectEnvironmentClassParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } -type ProjectNewResponseProjectMetadata struct { +type ProjectMetadata struct { // A Timestamp represents a point in time independent of any time zone or local // calendar, encoded as a count of seconds and fractions of seconds at nanosecond // resolution. The count is relative to an epoch at UTC midnight on January 1, @@ -580,7 +457,7 @@ type ProjectNewResponseProjectMetadata struct { // to obtain a formatter capable of generating timestamps in this format. CreatedAt time.Time `json:"createdAt" format:"date-time"` // creator is the identity of the project creator - Creator ProjectNewResponseProjectMetadataCreator `json:"creator"` + Creator shared.Subject `json:"creator"` // name is the human readable name of the project Name string `json:"name"` // organization_id is the ID of the organization that contains the environment @@ -673,13 +550,12 @@ type ProjectNewResponseProjectMetadata 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 projectNewResponseProjectMetadataJSON `json:"-"` + UpdatedAt time.Time `json:"updatedAt" format:"date-time"` + JSON projectMetadataJSON `json:"-"` } -// projectNewResponseProjectMetadataJSON contains the JSON metadata for the struct -// [ProjectNewResponseProjectMetadata] -type projectNewResponseProjectMetadataJSON struct { +// projectMetadataJSON contains the JSON metadata for the struct [ProjectMetadata] +type projectMetadataJSON struct { CreatedAt apijson.Field Creator apijson.Field Name apijson.Field @@ -689,2973 +565,104 @@ type projectNewResponseProjectMetadataJSON struct { ExtraFields map[string]apijson.Field } -func (r *ProjectNewResponseProjectMetadata) UnmarshalJSON(data []byte) (err error) { +func (r *ProjectMetadata) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r projectNewResponseProjectMetadataJSON) RawJSON() string { +func (r projectMetadataJSON) RawJSON() string { return r.raw } -// creator is the identity of the project creator -type ProjectNewResponseProjectMetadataCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal ProjectNewResponseProjectMetadataCreatorPrincipal `json:"principal"` - JSON projectNewResponseProjectMetadataCreatorJSON `json:"-"` +type ProjectNewResponse struct { + Project Project `json:"project"` + JSON projectNewResponseJSON `json:"-"` } -// projectNewResponseProjectMetadataCreatorJSON contains the JSON metadata for the -// struct [ProjectNewResponseProjectMetadataCreator] -type projectNewResponseProjectMetadataCreatorJSON struct { - ID apijson.Field - Principal apijson.Field +// projectNewResponseJSON contains the JSON metadata for the struct +// [ProjectNewResponse] +type projectNewResponseJSON struct { + Project apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ProjectNewResponseProjectMetadataCreator) UnmarshalJSON(data []byte) (err error) { +func (r *ProjectNewResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r projectNewResponseProjectMetadataCreatorJSON) RawJSON() string { +func (r projectNewResponseJSON) RawJSON() string { return r.raw } -// Principal is the principal of the subject -type ProjectNewResponseProjectMetadataCreatorPrincipal string - -const ( - ProjectNewResponseProjectMetadataCreatorPrincipalPrincipalUnspecified ProjectNewResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - ProjectNewResponseProjectMetadataCreatorPrincipalPrincipalAccount ProjectNewResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_ACCOUNT" - ProjectNewResponseProjectMetadataCreatorPrincipalPrincipalUser ProjectNewResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_USER" - ProjectNewResponseProjectMetadataCreatorPrincipalPrincipalRunner ProjectNewResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_RUNNER" - ProjectNewResponseProjectMetadataCreatorPrincipalPrincipalEnvironment ProjectNewResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - ProjectNewResponseProjectMetadataCreatorPrincipalPrincipalServiceAccount ProjectNewResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r ProjectNewResponseProjectMetadataCreatorPrincipal) IsKnown() bool { - switch r { - case ProjectNewResponseProjectMetadataCreatorPrincipalPrincipalUnspecified, ProjectNewResponseProjectMetadataCreatorPrincipalPrincipalAccount, ProjectNewResponseProjectMetadataCreatorPrincipalPrincipalUser, ProjectNewResponseProjectMetadataCreatorPrincipalPrincipalRunner, ProjectNewResponseProjectMetadataCreatorPrincipalPrincipalEnvironment, ProjectNewResponseProjectMetadataCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - -type ProjectNewResponseProjectUsedBy struct { - // Subjects are the 10 most recent subjects who have used the project to create an - // environment - Subjects []ProjectNewResponseProjectUsedBySubject `json:"subjects"` - // Total number of unique subjects who have used the project - TotalSubjects int64 `json:"totalSubjects"` - JSON projectNewResponseProjectUsedByJSON `json:"-"` +type ProjectGetResponse struct { + Project Project `json:"project"` + JSON projectGetResponseJSON `json:"-"` } -// projectNewResponseProjectUsedByJSON contains the JSON metadata for the struct -// [ProjectNewResponseProjectUsedBy] -type projectNewResponseProjectUsedByJSON struct { - Subjects apijson.Field - TotalSubjects apijson.Field - raw string - ExtraFields map[string]apijson.Field +// projectGetResponseJSON contains the JSON metadata for the struct +// [ProjectGetResponse] +type projectGetResponseJSON struct { + Project apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *ProjectNewResponseProjectUsedBy) UnmarshalJSON(data []byte) (err error) { +func (r *ProjectGetResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r projectNewResponseProjectUsedByJSON) RawJSON() string { +func (r projectGetResponseJSON) RawJSON() string { return r.raw } -type ProjectNewResponseProjectUsedBySubject struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal ProjectNewResponseProjectUsedBySubjectsPrincipal `json:"principal"` - JSON projectNewResponseProjectUsedBySubjectJSON `json:"-"` +type ProjectUpdateResponse struct { + Project Project `json:"project"` + JSON projectUpdateResponseJSON `json:"-"` } -// projectNewResponseProjectUsedBySubjectJSON contains the JSON metadata for the -// struct [ProjectNewResponseProjectUsedBySubject] -type projectNewResponseProjectUsedBySubjectJSON struct { - ID apijson.Field - Principal apijson.Field +// projectUpdateResponseJSON contains the JSON metadata for the struct +// [ProjectUpdateResponse] +type projectUpdateResponseJSON struct { + Project apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ProjectNewResponseProjectUsedBySubject) UnmarshalJSON(data []byte) (err error) { +func (r *ProjectUpdateResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r projectNewResponseProjectUsedBySubjectJSON) RawJSON() string { +func (r projectUpdateResponseJSON) RawJSON() string { return r.raw } -// Principal is the principal of the subject -type ProjectNewResponseProjectUsedBySubjectsPrincipal string +type ProjectDeleteResponse = interface{} -const ( - ProjectNewResponseProjectUsedBySubjectsPrincipalPrincipalUnspecified ProjectNewResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_UNSPECIFIED" - ProjectNewResponseProjectUsedBySubjectsPrincipalPrincipalAccount ProjectNewResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_ACCOUNT" - ProjectNewResponseProjectUsedBySubjectsPrincipalPrincipalUser ProjectNewResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_USER" - ProjectNewResponseProjectUsedBySubjectsPrincipalPrincipalRunner ProjectNewResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_RUNNER" - ProjectNewResponseProjectUsedBySubjectsPrincipalPrincipalEnvironment ProjectNewResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_ENVIRONMENT" - ProjectNewResponseProjectUsedBySubjectsPrincipalPrincipalServiceAccount ProjectNewResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) +type ProjectNewFromEnvironmentResponse struct { + Project Project `json:"project"` + JSON projectNewFromEnvironmentResponseJSON `json:"-"` +} -func (r ProjectNewResponseProjectUsedBySubjectsPrincipal) IsKnown() bool { - switch r { - case ProjectNewResponseProjectUsedBySubjectsPrincipalPrincipalUnspecified, ProjectNewResponseProjectUsedBySubjectsPrincipalPrincipalAccount, ProjectNewResponseProjectUsedBySubjectsPrincipalPrincipalUser, ProjectNewResponseProjectUsedBySubjectsPrincipalPrincipalRunner, ProjectNewResponseProjectUsedBySubjectsPrincipalPrincipalEnvironment, ProjectNewResponseProjectUsedBySubjectsPrincipalPrincipalServiceAccount: - return true - } - return false -} - -type ProjectGetResponse struct { - Project ProjectGetResponseProject `json:"project"` - JSON projectGetResponseJSON `json:"-"` -} - -// projectGetResponseJSON contains the JSON metadata for the struct -// [ProjectGetResponse] -type projectGetResponseJSON struct { - Project apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectGetResponseJSON) RawJSON() string { - return r.raw -} - -type ProjectGetResponseProject struct { - EnvironmentClass ProjectGetResponseProjectEnvironmentClass `json:"environmentClass,required"` - // id is the unique identifier for the project - ID string `json:"id" format:"uuid"` - // automations_file_path is the path to the automations file relative to the repo - // root - AutomationsFilePath string `json:"automationsFilePath"` - // devcontainer_file_path is the path to the devcontainer file relative to the repo - // root - DevcontainerFilePath string `json:"devcontainerFilePath"` - // EnvironmentInitializer specifies how an environment is to be initialized - Initializer ProjectGetResponseProjectInitializer `json:"initializer"` - Metadata ProjectGetResponseProjectMetadata `json:"metadata"` - UsedBy ProjectGetResponseProjectUsedBy `json:"usedBy"` - JSON projectGetResponseProjectJSON `json:"-"` -} - -// projectGetResponseProjectJSON contains the JSON metadata for the struct -// [ProjectGetResponseProject] -type projectGetResponseProjectJSON struct { - EnvironmentClass apijson.Field - ID apijson.Field - AutomationsFilePath apijson.Field - DevcontainerFilePath apijson.Field - Initializer apijson.Field - Metadata apijson.Field - UsedBy apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectGetResponseProject) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectGetResponseProjectJSON) RawJSON() string { - return r.raw -} - -type ProjectGetResponseProjectEnvironmentClass struct { - // Use a fixed environment class on a given Runner. This cannot be a local runner's - // environment class. - EnvironmentClassID string `json:"environmentClassId" format:"uuid"` - // Use a local runner for the user - LocalRunner bool `json:"localRunner"` - JSON projectGetResponseProjectEnvironmentClassJSON `json:"-"` - union ProjectGetResponseProjectEnvironmentClassUnion -} - -// projectGetResponseProjectEnvironmentClassJSON contains the JSON metadata for the -// struct [ProjectGetResponseProjectEnvironmentClass] -type projectGetResponseProjectEnvironmentClassJSON struct { - EnvironmentClassID apijson.Field - LocalRunner apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r projectGetResponseProjectEnvironmentClassJSON) RawJSON() string { - return r.raw -} - -func (r *ProjectGetResponseProjectEnvironmentClass) UnmarshalJSON(data []byte) (err error) { - *r = ProjectGetResponseProjectEnvironmentClass{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a [ProjectGetResponseProjectEnvironmentClassUnion] interface -// which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [ProjectGetResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass], -// [ProjectGetResponseProjectEnvironmentClassUseALocalRunnerForTheUser]. -func (r ProjectGetResponseProjectEnvironmentClass) AsUnion() ProjectGetResponseProjectEnvironmentClassUnion { - return r.union -} - -// Union satisfied by -// [ProjectGetResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass] -// or [ProjectGetResponseProjectEnvironmentClassUseALocalRunnerForTheUser]. -type ProjectGetResponseProjectEnvironmentClassUnion interface { - implementsProjectGetResponseProjectEnvironmentClass() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*ProjectGetResponseProjectEnvironmentClassUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ProjectGetResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ProjectGetResponseProjectEnvironmentClassUseALocalRunnerForTheUser{}), - }, - ) -} - -type ProjectGetResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass struct { - // Use a fixed environment class on a given Runner. This cannot be a local runner's - // environment class. - EnvironmentClassID string `json:"environmentClassId,required" format:"uuid"` - JSON projectGetResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClassJSON `json:"-"` -} - -// projectGetResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClassJSON -// contains the JSON metadata for the struct -// [ProjectGetResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass] -type projectGetResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClassJSON struct { - EnvironmentClassID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectGetResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectGetResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClassJSON) RawJSON() string { - return r.raw -} - -func (r ProjectGetResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass) implementsProjectGetResponseProjectEnvironmentClass() { -} - -type ProjectGetResponseProjectEnvironmentClassUseALocalRunnerForTheUser struct { - // Use a local runner for the user - LocalRunner bool `json:"localRunner,required"` - JSON projectGetResponseProjectEnvironmentClassUseALocalRunnerForTheUserJSON `json:"-"` -} - -// projectGetResponseProjectEnvironmentClassUseALocalRunnerForTheUserJSON contains -// the JSON metadata for the struct -// [ProjectGetResponseProjectEnvironmentClassUseALocalRunnerForTheUser] -type projectGetResponseProjectEnvironmentClassUseALocalRunnerForTheUserJSON struct { - LocalRunner apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectGetResponseProjectEnvironmentClassUseALocalRunnerForTheUser) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectGetResponseProjectEnvironmentClassUseALocalRunnerForTheUserJSON) RawJSON() string { - return r.raw -} - -func (r ProjectGetResponseProjectEnvironmentClassUseALocalRunnerForTheUser) implementsProjectGetResponseProjectEnvironmentClass() { -} - -// EnvironmentInitializer specifies how an environment is to be initialized -type ProjectGetResponseProjectInitializer struct { - Specs []ProjectGetResponseProjectInitializerSpec `json:"specs"` - JSON projectGetResponseProjectInitializerJSON `json:"-"` -} - -// projectGetResponseProjectInitializerJSON contains the JSON metadata for the -// struct [ProjectGetResponseProjectInitializer] -type projectGetResponseProjectInitializerJSON struct { - Specs apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectGetResponseProjectInitializer) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectGetResponseProjectInitializerJSON) RawJSON() string { - return r.raw -} - -type ProjectGetResponseProjectInitializerSpec struct { - // This field can have the runtime type of - // [ProjectGetResponseProjectInitializerSpecsContextURLContextURL]. - ContextURL interface{} `json:"contextUrl"` - // This field can have the runtime type of - // [ProjectGetResponseProjectInitializerSpecsGitGit]. - Git interface{} `json:"git"` - JSON projectGetResponseProjectInitializerSpecJSON `json:"-"` - union ProjectGetResponseProjectInitializerSpecsUnion -} - -// projectGetResponseProjectInitializerSpecJSON contains the JSON metadata for the -// struct [ProjectGetResponseProjectInitializerSpec] -type projectGetResponseProjectInitializerSpecJSON struct { - ContextURL apijson.Field - Git apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r projectGetResponseProjectInitializerSpecJSON) RawJSON() string { - return r.raw -} - -func (r *ProjectGetResponseProjectInitializerSpec) UnmarshalJSON(data []byte) (err error) { - *r = ProjectGetResponseProjectInitializerSpec{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a [ProjectGetResponseProjectInitializerSpecsUnion] interface -// which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [ProjectGetResponseProjectInitializerSpecsContextURL], -// [ProjectGetResponseProjectInitializerSpecsGit]. -func (r ProjectGetResponseProjectInitializerSpec) AsUnion() ProjectGetResponseProjectInitializerSpecsUnion { - return r.union -} - -// Union satisfied by [ProjectGetResponseProjectInitializerSpecsContextURL] or -// [ProjectGetResponseProjectInitializerSpecsGit]. -type ProjectGetResponseProjectInitializerSpecsUnion interface { - implementsProjectGetResponseProjectInitializerSpec() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*ProjectGetResponseProjectInitializerSpecsUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ProjectGetResponseProjectInitializerSpecsContextURL{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ProjectGetResponseProjectInitializerSpecsGit{}), - }, - ) -} - -type ProjectGetResponseProjectInitializerSpecsContextURL struct { - ContextURL ProjectGetResponseProjectInitializerSpecsContextURLContextURL `json:"contextUrl,required"` - JSON projectGetResponseProjectInitializerSpecsContextURLJSON `json:"-"` -} - -// projectGetResponseProjectInitializerSpecsContextURLJSON contains the JSON -// metadata for the struct [ProjectGetResponseProjectInitializerSpecsContextURL] -type projectGetResponseProjectInitializerSpecsContextURLJSON struct { - ContextURL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectGetResponseProjectInitializerSpecsContextURL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectGetResponseProjectInitializerSpecsContextURLJSON) RawJSON() string { - return r.raw -} - -func (r ProjectGetResponseProjectInitializerSpecsContextURL) implementsProjectGetResponseProjectInitializerSpec() { -} - -type ProjectGetResponseProjectInitializerSpecsContextURLContextURL struct { - // url is the URL from which the environment is created - URL string `json:"url" format:"uri"` - JSON projectGetResponseProjectInitializerSpecsContextURLContextURLJSON `json:"-"` -} - -// projectGetResponseProjectInitializerSpecsContextURLContextURLJSON contains the -// JSON metadata for the struct -// [ProjectGetResponseProjectInitializerSpecsContextURLContextURL] -type projectGetResponseProjectInitializerSpecsContextURLContextURLJSON struct { - URL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectGetResponseProjectInitializerSpecsContextURLContextURL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectGetResponseProjectInitializerSpecsContextURLContextURLJSON) RawJSON() string { - return r.raw -} - -type ProjectGetResponseProjectInitializerSpecsGit struct { - Git ProjectGetResponseProjectInitializerSpecsGitGit `json:"git,required"` - JSON projectGetResponseProjectInitializerSpecsGitJSON `json:"-"` -} - -// projectGetResponseProjectInitializerSpecsGitJSON contains the JSON metadata for -// the struct [ProjectGetResponseProjectInitializerSpecsGit] -type projectGetResponseProjectInitializerSpecsGitJSON struct { - Git apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectGetResponseProjectInitializerSpecsGit) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectGetResponseProjectInitializerSpecsGitJSON) RawJSON() string { - return r.raw -} - -func (r ProjectGetResponseProjectInitializerSpecsGit) implementsProjectGetResponseProjectInitializerSpec() { -} - -type ProjectGetResponseProjectInitializerSpecsGitGit struct { - // a path relative to the environment root in which the code will be checked out to - CheckoutLocation string `json:"checkoutLocation"` - // the value for the clone target mode - use depends on the target mode - CloneTarget string `json:"cloneTarget"` - // remote_uri is the Git remote origin - RemoteUri string `json:"remoteUri"` - // CloneTargetMode is the target state in which we want to leave a GitEnvironment - TargetMode ProjectGetResponseProjectInitializerSpecsGitGitTargetMode `json:"targetMode"` - // upstream_Remote_uri is the fork upstream of a repository - UpstreamRemoteUri string `json:"upstreamRemoteUri"` - JSON projectGetResponseProjectInitializerSpecsGitGitJSON `json:"-"` -} - -// projectGetResponseProjectInitializerSpecsGitGitJSON contains the JSON metadata -// for the struct [ProjectGetResponseProjectInitializerSpecsGitGit] -type projectGetResponseProjectInitializerSpecsGitGitJSON struct { - CheckoutLocation apijson.Field - CloneTarget apijson.Field - RemoteUri apijson.Field - TargetMode apijson.Field - UpstreamRemoteUri apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectGetResponseProjectInitializerSpecsGitGit) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectGetResponseProjectInitializerSpecsGitGitJSON) RawJSON() string { - return r.raw -} - -// CloneTargetMode is the target state in which we want to leave a GitEnvironment -type ProjectGetResponseProjectInitializerSpecsGitGitTargetMode string - -const ( - ProjectGetResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified ProjectGetResponseProjectInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_UNSPECIFIED" - ProjectGetResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead ProjectGetResponseProjectInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_HEAD" - ProjectGetResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit ProjectGetResponseProjectInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_COMMIT" - ProjectGetResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch ProjectGetResponseProjectInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_BRANCH" - ProjectGetResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch ProjectGetResponseProjectInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_LOCAL_BRANCH" -) - -func (r ProjectGetResponseProjectInitializerSpecsGitGitTargetMode) IsKnown() bool { - switch r { - case ProjectGetResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified, ProjectGetResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead, ProjectGetResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit, ProjectGetResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch, ProjectGetResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch: - return true - } - return false -} - -type ProjectGetResponseProjectMetadata struct { - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - CreatedAt time.Time `json:"createdAt" format:"date-time"` - // creator is the identity of the project creator - Creator ProjectGetResponseProjectMetadataCreator `json:"creator"` - // name is the human readable name of the project - Name string `json:"name"` - // organization_id is the ID of the organization that contains the environment - OrganizationID string `json:"organizationId" format:"uuid"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - UpdatedAt time.Time `json:"updatedAt" format:"date-time"` - JSON projectGetResponseProjectMetadataJSON `json:"-"` -} - -// projectGetResponseProjectMetadataJSON contains the JSON metadata for the struct -// [ProjectGetResponseProjectMetadata] -type projectGetResponseProjectMetadataJSON struct { - CreatedAt apijson.Field - Creator apijson.Field - Name apijson.Field - OrganizationID apijson.Field - UpdatedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectGetResponseProjectMetadata) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectGetResponseProjectMetadataJSON) RawJSON() string { - return r.raw -} - -// creator is the identity of the project creator -type ProjectGetResponseProjectMetadataCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal ProjectGetResponseProjectMetadataCreatorPrincipal `json:"principal"` - JSON projectGetResponseProjectMetadataCreatorJSON `json:"-"` -} - -// projectGetResponseProjectMetadataCreatorJSON contains the JSON metadata for the -// struct [ProjectGetResponseProjectMetadataCreator] -type projectGetResponseProjectMetadataCreatorJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectGetResponseProjectMetadataCreator) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectGetResponseProjectMetadataCreatorJSON) RawJSON() string { - return r.raw -} - -// Principal is the principal of the subject -type ProjectGetResponseProjectMetadataCreatorPrincipal string - -const ( - ProjectGetResponseProjectMetadataCreatorPrincipalPrincipalUnspecified ProjectGetResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - ProjectGetResponseProjectMetadataCreatorPrincipalPrincipalAccount ProjectGetResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_ACCOUNT" - ProjectGetResponseProjectMetadataCreatorPrincipalPrincipalUser ProjectGetResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_USER" - ProjectGetResponseProjectMetadataCreatorPrincipalPrincipalRunner ProjectGetResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_RUNNER" - ProjectGetResponseProjectMetadataCreatorPrincipalPrincipalEnvironment ProjectGetResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - ProjectGetResponseProjectMetadataCreatorPrincipalPrincipalServiceAccount ProjectGetResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r ProjectGetResponseProjectMetadataCreatorPrincipal) IsKnown() bool { - switch r { - case ProjectGetResponseProjectMetadataCreatorPrincipalPrincipalUnspecified, ProjectGetResponseProjectMetadataCreatorPrincipalPrincipalAccount, ProjectGetResponseProjectMetadataCreatorPrincipalPrincipalUser, ProjectGetResponseProjectMetadataCreatorPrincipalPrincipalRunner, ProjectGetResponseProjectMetadataCreatorPrincipalPrincipalEnvironment, ProjectGetResponseProjectMetadataCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - -type ProjectGetResponseProjectUsedBy struct { - // Subjects are the 10 most recent subjects who have used the project to create an - // environment - Subjects []ProjectGetResponseProjectUsedBySubject `json:"subjects"` - // Total number of unique subjects who have used the project - TotalSubjects int64 `json:"totalSubjects"` - JSON projectGetResponseProjectUsedByJSON `json:"-"` -} - -// projectGetResponseProjectUsedByJSON contains the JSON metadata for the struct -// [ProjectGetResponseProjectUsedBy] -type projectGetResponseProjectUsedByJSON struct { - Subjects apijson.Field - TotalSubjects apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectGetResponseProjectUsedBy) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectGetResponseProjectUsedByJSON) RawJSON() string { - return r.raw -} - -type ProjectGetResponseProjectUsedBySubject struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal ProjectGetResponseProjectUsedBySubjectsPrincipal `json:"principal"` - JSON projectGetResponseProjectUsedBySubjectJSON `json:"-"` -} - -// projectGetResponseProjectUsedBySubjectJSON contains the JSON metadata for the -// struct [ProjectGetResponseProjectUsedBySubject] -type projectGetResponseProjectUsedBySubjectJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectGetResponseProjectUsedBySubject) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectGetResponseProjectUsedBySubjectJSON) RawJSON() string { - return r.raw -} - -// Principal is the principal of the subject -type ProjectGetResponseProjectUsedBySubjectsPrincipal string - -const ( - ProjectGetResponseProjectUsedBySubjectsPrincipalPrincipalUnspecified ProjectGetResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_UNSPECIFIED" - ProjectGetResponseProjectUsedBySubjectsPrincipalPrincipalAccount ProjectGetResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_ACCOUNT" - ProjectGetResponseProjectUsedBySubjectsPrincipalPrincipalUser ProjectGetResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_USER" - ProjectGetResponseProjectUsedBySubjectsPrincipalPrincipalRunner ProjectGetResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_RUNNER" - ProjectGetResponseProjectUsedBySubjectsPrincipalPrincipalEnvironment ProjectGetResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_ENVIRONMENT" - ProjectGetResponseProjectUsedBySubjectsPrincipalPrincipalServiceAccount ProjectGetResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r ProjectGetResponseProjectUsedBySubjectsPrincipal) IsKnown() bool { - switch r { - case ProjectGetResponseProjectUsedBySubjectsPrincipalPrincipalUnspecified, ProjectGetResponseProjectUsedBySubjectsPrincipalPrincipalAccount, ProjectGetResponseProjectUsedBySubjectsPrincipalPrincipalUser, ProjectGetResponseProjectUsedBySubjectsPrincipalPrincipalRunner, ProjectGetResponseProjectUsedBySubjectsPrincipalPrincipalEnvironment, ProjectGetResponseProjectUsedBySubjectsPrincipalPrincipalServiceAccount: - return true - } - return false -} - -type ProjectUpdateResponse struct { - Project ProjectUpdateResponseProject `json:"project"` - JSON projectUpdateResponseJSON `json:"-"` -} - -// projectUpdateResponseJSON contains the JSON metadata for the struct -// [ProjectUpdateResponse] -type projectUpdateResponseJSON struct { - Project apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectUpdateResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectUpdateResponseJSON) RawJSON() string { - return r.raw -} - -type ProjectUpdateResponseProject struct { - EnvironmentClass ProjectUpdateResponseProjectEnvironmentClass `json:"environmentClass,required"` - // id is the unique identifier for the project - ID string `json:"id" format:"uuid"` - // automations_file_path is the path to the automations file relative to the repo - // root - AutomationsFilePath string `json:"automationsFilePath"` - // devcontainer_file_path is the path to the devcontainer file relative to the repo - // root - DevcontainerFilePath string `json:"devcontainerFilePath"` - // EnvironmentInitializer specifies how an environment is to be initialized - Initializer ProjectUpdateResponseProjectInitializer `json:"initializer"` - Metadata ProjectUpdateResponseProjectMetadata `json:"metadata"` - UsedBy ProjectUpdateResponseProjectUsedBy `json:"usedBy"` - JSON projectUpdateResponseProjectJSON `json:"-"` -} - -// projectUpdateResponseProjectJSON contains the JSON metadata for the struct -// [ProjectUpdateResponseProject] -type projectUpdateResponseProjectJSON struct { - EnvironmentClass apijson.Field - ID apijson.Field - AutomationsFilePath apijson.Field - DevcontainerFilePath apijson.Field - Initializer apijson.Field - Metadata apijson.Field - UsedBy apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectUpdateResponseProject) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectUpdateResponseProjectJSON) RawJSON() string { - return r.raw -} - -type ProjectUpdateResponseProjectEnvironmentClass struct { - // Use a fixed environment class on a given Runner. This cannot be a local runner's - // environment class. - EnvironmentClassID string `json:"environmentClassId" format:"uuid"` - // Use a local runner for the user - LocalRunner bool `json:"localRunner"` - JSON projectUpdateResponseProjectEnvironmentClassJSON `json:"-"` - union ProjectUpdateResponseProjectEnvironmentClassUnion -} - -// projectUpdateResponseProjectEnvironmentClassJSON contains the JSON metadata for -// the struct [ProjectUpdateResponseProjectEnvironmentClass] -type projectUpdateResponseProjectEnvironmentClassJSON struct { - EnvironmentClassID apijson.Field - LocalRunner apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r projectUpdateResponseProjectEnvironmentClassJSON) RawJSON() string { - return r.raw -} - -func (r *ProjectUpdateResponseProjectEnvironmentClass) UnmarshalJSON(data []byte) (err error) { - *r = ProjectUpdateResponseProjectEnvironmentClass{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a [ProjectUpdateResponseProjectEnvironmentClassUnion] interface -// which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [ProjectUpdateResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass], -// [ProjectUpdateResponseProjectEnvironmentClassUseALocalRunnerForTheUser]. -func (r ProjectUpdateResponseProjectEnvironmentClass) AsUnion() ProjectUpdateResponseProjectEnvironmentClassUnion { - return r.union -} - -// Union satisfied by -// [ProjectUpdateResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass] -// or [ProjectUpdateResponseProjectEnvironmentClassUseALocalRunnerForTheUser]. -type ProjectUpdateResponseProjectEnvironmentClassUnion interface { - implementsProjectUpdateResponseProjectEnvironmentClass() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*ProjectUpdateResponseProjectEnvironmentClassUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ProjectUpdateResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ProjectUpdateResponseProjectEnvironmentClassUseALocalRunnerForTheUser{}), - }, - ) -} - -type ProjectUpdateResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass struct { - // Use a fixed environment class on a given Runner. This cannot be a local runner's - // environment class. - EnvironmentClassID string `json:"environmentClassId,required" format:"uuid"` - JSON projectUpdateResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClassJSON `json:"-"` -} - -// projectUpdateResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClassJSON -// contains the JSON metadata for the struct -// [ProjectUpdateResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass] -type projectUpdateResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClassJSON struct { - EnvironmentClassID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectUpdateResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectUpdateResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClassJSON) RawJSON() string { - return r.raw -} - -func (r ProjectUpdateResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass) implementsProjectUpdateResponseProjectEnvironmentClass() { -} - -type ProjectUpdateResponseProjectEnvironmentClassUseALocalRunnerForTheUser struct { - // Use a local runner for the user - LocalRunner bool `json:"localRunner,required"` - JSON projectUpdateResponseProjectEnvironmentClassUseALocalRunnerForTheUserJSON `json:"-"` -} - -// projectUpdateResponseProjectEnvironmentClassUseALocalRunnerForTheUserJSON -// contains the JSON metadata for the struct -// [ProjectUpdateResponseProjectEnvironmentClassUseALocalRunnerForTheUser] -type projectUpdateResponseProjectEnvironmentClassUseALocalRunnerForTheUserJSON struct { - LocalRunner apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectUpdateResponseProjectEnvironmentClassUseALocalRunnerForTheUser) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectUpdateResponseProjectEnvironmentClassUseALocalRunnerForTheUserJSON) RawJSON() string { - return r.raw -} - -func (r ProjectUpdateResponseProjectEnvironmentClassUseALocalRunnerForTheUser) implementsProjectUpdateResponseProjectEnvironmentClass() { -} - -// EnvironmentInitializer specifies how an environment is to be initialized -type ProjectUpdateResponseProjectInitializer struct { - Specs []ProjectUpdateResponseProjectInitializerSpec `json:"specs"` - JSON projectUpdateResponseProjectInitializerJSON `json:"-"` -} - -// projectUpdateResponseProjectInitializerJSON contains the JSON metadata for the -// struct [ProjectUpdateResponseProjectInitializer] -type projectUpdateResponseProjectInitializerJSON struct { - Specs apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectUpdateResponseProjectInitializer) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectUpdateResponseProjectInitializerJSON) RawJSON() string { - return r.raw -} - -type ProjectUpdateResponseProjectInitializerSpec struct { - // This field can have the runtime type of - // [ProjectUpdateResponseProjectInitializerSpecsContextURLContextURL]. - ContextURL interface{} `json:"contextUrl"` - // This field can have the runtime type of - // [ProjectUpdateResponseProjectInitializerSpecsGitGit]. - Git interface{} `json:"git"` - JSON projectUpdateResponseProjectInitializerSpecJSON `json:"-"` - union ProjectUpdateResponseProjectInitializerSpecsUnion -} - -// projectUpdateResponseProjectInitializerSpecJSON contains the JSON metadata for -// the struct [ProjectUpdateResponseProjectInitializerSpec] -type projectUpdateResponseProjectInitializerSpecJSON struct { - ContextURL apijson.Field - Git apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r projectUpdateResponseProjectInitializerSpecJSON) RawJSON() string { - return r.raw -} - -func (r *ProjectUpdateResponseProjectInitializerSpec) UnmarshalJSON(data []byte) (err error) { - *r = ProjectUpdateResponseProjectInitializerSpec{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a [ProjectUpdateResponseProjectInitializerSpecsUnion] interface -// which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [ProjectUpdateResponseProjectInitializerSpecsContextURL], -// [ProjectUpdateResponseProjectInitializerSpecsGit]. -func (r ProjectUpdateResponseProjectInitializerSpec) AsUnion() ProjectUpdateResponseProjectInitializerSpecsUnion { - return r.union -} - -// Union satisfied by [ProjectUpdateResponseProjectInitializerSpecsContextURL] or -// [ProjectUpdateResponseProjectInitializerSpecsGit]. -type ProjectUpdateResponseProjectInitializerSpecsUnion interface { - implementsProjectUpdateResponseProjectInitializerSpec() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*ProjectUpdateResponseProjectInitializerSpecsUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ProjectUpdateResponseProjectInitializerSpecsContextURL{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ProjectUpdateResponseProjectInitializerSpecsGit{}), - }, - ) -} - -type ProjectUpdateResponseProjectInitializerSpecsContextURL struct { - ContextURL ProjectUpdateResponseProjectInitializerSpecsContextURLContextURL `json:"contextUrl,required"` - JSON projectUpdateResponseProjectInitializerSpecsContextURLJSON `json:"-"` -} - -// projectUpdateResponseProjectInitializerSpecsContextURLJSON contains the JSON -// metadata for the struct [ProjectUpdateResponseProjectInitializerSpecsContextURL] -type projectUpdateResponseProjectInitializerSpecsContextURLJSON struct { - ContextURL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectUpdateResponseProjectInitializerSpecsContextURL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectUpdateResponseProjectInitializerSpecsContextURLJSON) RawJSON() string { - return r.raw -} - -func (r ProjectUpdateResponseProjectInitializerSpecsContextURL) implementsProjectUpdateResponseProjectInitializerSpec() { -} - -type ProjectUpdateResponseProjectInitializerSpecsContextURLContextURL struct { - // url is the URL from which the environment is created - URL string `json:"url" format:"uri"` - JSON projectUpdateResponseProjectInitializerSpecsContextURLContextURLJSON `json:"-"` -} - -// projectUpdateResponseProjectInitializerSpecsContextURLContextURLJSON contains -// the JSON metadata for the struct -// [ProjectUpdateResponseProjectInitializerSpecsContextURLContextURL] -type projectUpdateResponseProjectInitializerSpecsContextURLContextURLJSON struct { - URL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectUpdateResponseProjectInitializerSpecsContextURLContextURL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectUpdateResponseProjectInitializerSpecsContextURLContextURLJSON) RawJSON() string { - return r.raw -} - -type ProjectUpdateResponseProjectInitializerSpecsGit struct { - Git ProjectUpdateResponseProjectInitializerSpecsGitGit `json:"git,required"` - JSON projectUpdateResponseProjectInitializerSpecsGitJSON `json:"-"` -} - -// projectUpdateResponseProjectInitializerSpecsGitJSON contains the JSON metadata -// for the struct [ProjectUpdateResponseProjectInitializerSpecsGit] -type projectUpdateResponseProjectInitializerSpecsGitJSON struct { - Git apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectUpdateResponseProjectInitializerSpecsGit) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectUpdateResponseProjectInitializerSpecsGitJSON) RawJSON() string { - return r.raw -} - -func (r ProjectUpdateResponseProjectInitializerSpecsGit) implementsProjectUpdateResponseProjectInitializerSpec() { -} - -type ProjectUpdateResponseProjectInitializerSpecsGitGit struct { - // a path relative to the environment root in which the code will be checked out to - CheckoutLocation string `json:"checkoutLocation"` - // the value for the clone target mode - use depends on the target mode - CloneTarget string `json:"cloneTarget"` - // remote_uri is the Git remote origin - RemoteUri string `json:"remoteUri"` - // CloneTargetMode is the target state in which we want to leave a GitEnvironment - TargetMode ProjectUpdateResponseProjectInitializerSpecsGitGitTargetMode `json:"targetMode"` - // upstream_Remote_uri is the fork upstream of a repository - UpstreamRemoteUri string `json:"upstreamRemoteUri"` - JSON projectUpdateResponseProjectInitializerSpecsGitGitJSON `json:"-"` -} - -// projectUpdateResponseProjectInitializerSpecsGitGitJSON contains the JSON -// metadata for the struct [ProjectUpdateResponseProjectInitializerSpecsGitGit] -type projectUpdateResponseProjectInitializerSpecsGitGitJSON struct { - CheckoutLocation apijson.Field - CloneTarget apijson.Field - RemoteUri apijson.Field - TargetMode apijson.Field - UpstreamRemoteUri apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectUpdateResponseProjectInitializerSpecsGitGit) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectUpdateResponseProjectInitializerSpecsGitGitJSON) RawJSON() string { - return r.raw -} - -// CloneTargetMode is the target state in which we want to leave a GitEnvironment -type ProjectUpdateResponseProjectInitializerSpecsGitGitTargetMode string - -const ( - ProjectUpdateResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified ProjectUpdateResponseProjectInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_UNSPECIFIED" - ProjectUpdateResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead ProjectUpdateResponseProjectInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_HEAD" - ProjectUpdateResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit ProjectUpdateResponseProjectInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_COMMIT" - ProjectUpdateResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch ProjectUpdateResponseProjectInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_BRANCH" - ProjectUpdateResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch ProjectUpdateResponseProjectInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_LOCAL_BRANCH" -) - -func (r ProjectUpdateResponseProjectInitializerSpecsGitGitTargetMode) IsKnown() bool { - switch r { - case ProjectUpdateResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified, ProjectUpdateResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead, ProjectUpdateResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit, ProjectUpdateResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch, ProjectUpdateResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch: - return true - } - return false -} - -type ProjectUpdateResponseProjectMetadata struct { - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - CreatedAt time.Time `json:"createdAt" format:"date-time"` - // creator is the identity of the project creator - Creator ProjectUpdateResponseProjectMetadataCreator `json:"creator"` - // name is the human readable name of the project - Name string `json:"name"` - // organization_id is the ID of the organization that contains the environment - OrganizationID string `json:"organizationId" format:"uuid"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - UpdatedAt time.Time `json:"updatedAt" format:"date-time"` - JSON projectUpdateResponseProjectMetadataJSON `json:"-"` -} - -// projectUpdateResponseProjectMetadataJSON contains the JSON metadata for the -// struct [ProjectUpdateResponseProjectMetadata] -type projectUpdateResponseProjectMetadataJSON struct { - CreatedAt apijson.Field - Creator apijson.Field - Name apijson.Field - OrganizationID apijson.Field - UpdatedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectUpdateResponseProjectMetadata) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectUpdateResponseProjectMetadataJSON) RawJSON() string { - return r.raw -} - -// creator is the identity of the project creator -type ProjectUpdateResponseProjectMetadataCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal ProjectUpdateResponseProjectMetadataCreatorPrincipal `json:"principal"` - JSON projectUpdateResponseProjectMetadataCreatorJSON `json:"-"` -} - -// projectUpdateResponseProjectMetadataCreatorJSON contains the JSON metadata for -// the struct [ProjectUpdateResponseProjectMetadataCreator] -type projectUpdateResponseProjectMetadataCreatorJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectUpdateResponseProjectMetadataCreator) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectUpdateResponseProjectMetadataCreatorJSON) RawJSON() string { - return r.raw -} - -// Principal is the principal of the subject -type ProjectUpdateResponseProjectMetadataCreatorPrincipal string - -const ( - ProjectUpdateResponseProjectMetadataCreatorPrincipalPrincipalUnspecified ProjectUpdateResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - ProjectUpdateResponseProjectMetadataCreatorPrincipalPrincipalAccount ProjectUpdateResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_ACCOUNT" - ProjectUpdateResponseProjectMetadataCreatorPrincipalPrincipalUser ProjectUpdateResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_USER" - ProjectUpdateResponseProjectMetadataCreatorPrincipalPrincipalRunner ProjectUpdateResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_RUNNER" - ProjectUpdateResponseProjectMetadataCreatorPrincipalPrincipalEnvironment ProjectUpdateResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - ProjectUpdateResponseProjectMetadataCreatorPrincipalPrincipalServiceAccount ProjectUpdateResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r ProjectUpdateResponseProjectMetadataCreatorPrincipal) IsKnown() bool { - switch r { - case ProjectUpdateResponseProjectMetadataCreatorPrincipalPrincipalUnspecified, ProjectUpdateResponseProjectMetadataCreatorPrincipalPrincipalAccount, ProjectUpdateResponseProjectMetadataCreatorPrincipalPrincipalUser, ProjectUpdateResponseProjectMetadataCreatorPrincipalPrincipalRunner, ProjectUpdateResponseProjectMetadataCreatorPrincipalPrincipalEnvironment, ProjectUpdateResponseProjectMetadataCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - -type ProjectUpdateResponseProjectUsedBy struct { - // Subjects are the 10 most recent subjects who have used the project to create an - // environment - Subjects []ProjectUpdateResponseProjectUsedBySubject `json:"subjects"` - // Total number of unique subjects who have used the project - TotalSubjects int64 `json:"totalSubjects"` - JSON projectUpdateResponseProjectUsedByJSON `json:"-"` -} - -// projectUpdateResponseProjectUsedByJSON contains the JSON metadata for the struct -// [ProjectUpdateResponseProjectUsedBy] -type projectUpdateResponseProjectUsedByJSON struct { - Subjects apijson.Field - TotalSubjects apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectUpdateResponseProjectUsedBy) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectUpdateResponseProjectUsedByJSON) RawJSON() string { - return r.raw -} - -type ProjectUpdateResponseProjectUsedBySubject struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal ProjectUpdateResponseProjectUsedBySubjectsPrincipal `json:"principal"` - JSON projectUpdateResponseProjectUsedBySubjectJSON `json:"-"` -} - -// projectUpdateResponseProjectUsedBySubjectJSON contains the JSON metadata for the -// struct [ProjectUpdateResponseProjectUsedBySubject] -type projectUpdateResponseProjectUsedBySubjectJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectUpdateResponseProjectUsedBySubject) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectUpdateResponseProjectUsedBySubjectJSON) RawJSON() string { - return r.raw -} - -// Principal is the principal of the subject -type ProjectUpdateResponseProjectUsedBySubjectsPrincipal string - -const ( - ProjectUpdateResponseProjectUsedBySubjectsPrincipalPrincipalUnspecified ProjectUpdateResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_UNSPECIFIED" - ProjectUpdateResponseProjectUsedBySubjectsPrincipalPrincipalAccount ProjectUpdateResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_ACCOUNT" - ProjectUpdateResponseProjectUsedBySubjectsPrincipalPrincipalUser ProjectUpdateResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_USER" - ProjectUpdateResponseProjectUsedBySubjectsPrincipalPrincipalRunner ProjectUpdateResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_RUNNER" - ProjectUpdateResponseProjectUsedBySubjectsPrincipalPrincipalEnvironment ProjectUpdateResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_ENVIRONMENT" - ProjectUpdateResponseProjectUsedBySubjectsPrincipalPrincipalServiceAccount ProjectUpdateResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r ProjectUpdateResponseProjectUsedBySubjectsPrincipal) IsKnown() bool { - switch r { - case ProjectUpdateResponseProjectUsedBySubjectsPrincipalPrincipalUnspecified, ProjectUpdateResponseProjectUsedBySubjectsPrincipalPrincipalAccount, ProjectUpdateResponseProjectUsedBySubjectsPrincipalPrincipalUser, ProjectUpdateResponseProjectUsedBySubjectsPrincipalPrincipalRunner, ProjectUpdateResponseProjectUsedBySubjectsPrincipalPrincipalEnvironment, ProjectUpdateResponseProjectUsedBySubjectsPrincipalPrincipalServiceAccount: - return true - } - return false -} - -type ProjectListResponse struct { - EnvironmentClass ProjectListResponseEnvironmentClass `json:"environmentClass,required"` - // id is the unique identifier for the project - ID string `json:"id" format:"uuid"` - // automations_file_path is the path to the automations file relative to the repo - // root - AutomationsFilePath string `json:"automationsFilePath"` - // devcontainer_file_path is the path to the devcontainer file relative to the repo - // root - DevcontainerFilePath string `json:"devcontainerFilePath"` - // EnvironmentInitializer specifies how an environment is to be initialized - Initializer ProjectListResponseInitializer `json:"initializer"` - Metadata ProjectListResponseMetadata `json:"metadata"` - UsedBy ProjectListResponseUsedBy `json:"usedBy"` - JSON projectListResponseJSON `json:"-"` -} - -// projectListResponseJSON contains the JSON metadata for the struct -// [ProjectListResponse] -type projectListResponseJSON struct { - EnvironmentClass apijson.Field - ID apijson.Field - AutomationsFilePath apijson.Field - DevcontainerFilePath apijson.Field - Initializer apijson.Field - Metadata apijson.Field - UsedBy apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectListResponseJSON) RawJSON() string { - return r.raw -} - -type ProjectListResponseEnvironmentClass struct { - // Use a fixed environment class on a given Runner. This cannot be a local runner's - // environment class. - EnvironmentClassID string `json:"environmentClassId" format:"uuid"` - // Use a local runner for the user - LocalRunner bool `json:"localRunner"` - JSON projectListResponseEnvironmentClassJSON `json:"-"` - union ProjectListResponseEnvironmentClassUnion -} - -// projectListResponseEnvironmentClassJSON contains the JSON metadata for the -// struct [ProjectListResponseEnvironmentClass] -type projectListResponseEnvironmentClassJSON struct { - EnvironmentClassID apijson.Field - LocalRunner apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r projectListResponseEnvironmentClassJSON) RawJSON() string { - return r.raw -} - -func (r *ProjectListResponseEnvironmentClass) UnmarshalJSON(data []byte) (err error) { - *r = ProjectListResponseEnvironmentClass{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a [ProjectListResponseEnvironmentClassUnion] interface which you -// can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [ProjectListResponseEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass], -// [ProjectListResponseEnvironmentClassUseALocalRunnerForTheUser]. -func (r ProjectListResponseEnvironmentClass) AsUnion() ProjectListResponseEnvironmentClassUnion { - return r.union -} - -// Union satisfied by -// [ProjectListResponseEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass] -// or [ProjectListResponseEnvironmentClassUseALocalRunnerForTheUser]. -type ProjectListResponseEnvironmentClassUnion interface { - implementsProjectListResponseEnvironmentClass() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*ProjectListResponseEnvironmentClassUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ProjectListResponseEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ProjectListResponseEnvironmentClassUseALocalRunnerForTheUser{}), - }, - ) -} - -type ProjectListResponseEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass struct { - // Use a fixed environment class on a given Runner. This cannot be a local runner's - // environment class. - EnvironmentClassID string `json:"environmentClassId,required" format:"uuid"` - JSON projectListResponseEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClassJSON `json:"-"` -} - -// projectListResponseEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClassJSON -// contains the JSON metadata for the struct -// [ProjectListResponseEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass] -type projectListResponseEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClassJSON struct { - EnvironmentClassID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectListResponseEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectListResponseEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClassJSON) RawJSON() string { - return r.raw -} - -func (r ProjectListResponseEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass) implementsProjectListResponseEnvironmentClass() { -} - -type ProjectListResponseEnvironmentClassUseALocalRunnerForTheUser struct { - // Use a local runner for the user - LocalRunner bool `json:"localRunner,required"` - JSON projectListResponseEnvironmentClassUseALocalRunnerForTheUserJSON `json:"-"` -} - -// projectListResponseEnvironmentClassUseALocalRunnerForTheUserJSON contains the -// JSON metadata for the struct -// [ProjectListResponseEnvironmentClassUseALocalRunnerForTheUser] -type projectListResponseEnvironmentClassUseALocalRunnerForTheUserJSON struct { - LocalRunner apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectListResponseEnvironmentClassUseALocalRunnerForTheUser) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectListResponseEnvironmentClassUseALocalRunnerForTheUserJSON) RawJSON() string { - return r.raw -} - -func (r ProjectListResponseEnvironmentClassUseALocalRunnerForTheUser) implementsProjectListResponseEnvironmentClass() { -} - -// EnvironmentInitializer specifies how an environment is to be initialized -type ProjectListResponseInitializer struct { - Specs []ProjectListResponseInitializerSpec `json:"specs"` - JSON projectListResponseInitializerJSON `json:"-"` -} - -// projectListResponseInitializerJSON contains the JSON metadata for the struct -// [ProjectListResponseInitializer] -type projectListResponseInitializerJSON struct { - Specs apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectListResponseInitializer) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectListResponseInitializerJSON) RawJSON() string { - return r.raw -} - -type ProjectListResponseInitializerSpec struct { - // This field can have the runtime type of - // [ProjectListResponseInitializerSpecsContextURLContextURL]. - ContextURL interface{} `json:"contextUrl"` - // This field can have the runtime type of - // [ProjectListResponseInitializerSpecsGitGit]. - Git interface{} `json:"git"` - JSON projectListResponseInitializerSpecJSON `json:"-"` - union ProjectListResponseInitializerSpecsUnion -} - -// projectListResponseInitializerSpecJSON contains the JSON metadata for the struct -// [ProjectListResponseInitializerSpec] -type projectListResponseInitializerSpecJSON struct { - ContextURL apijson.Field - Git apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r projectListResponseInitializerSpecJSON) RawJSON() string { - return r.raw -} - -func (r *ProjectListResponseInitializerSpec) UnmarshalJSON(data []byte) (err error) { - *r = ProjectListResponseInitializerSpec{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a [ProjectListResponseInitializerSpecsUnion] interface which you -// can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [ProjectListResponseInitializerSpecsContextURL], -// [ProjectListResponseInitializerSpecsGit]. -func (r ProjectListResponseInitializerSpec) AsUnion() ProjectListResponseInitializerSpecsUnion { - return r.union -} - -// Union satisfied by [ProjectListResponseInitializerSpecsContextURL] or -// [ProjectListResponseInitializerSpecsGit]. -type ProjectListResponseInitializerSpecsUnion interface { - implementsProjectListResponseInitializerSpec() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*ProjectListResponseInitializerSpecsUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ProjectListResponseInitializerSpecsContextURL{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ProjectListResponseInitializerSpecsGit{}), - }, - ) -} - -type ProjectListResponseInitializerSpecsContextURL struct { - ContextURL ProjectListResponseInitializerSpecsContextURLContextURL `json:"contextUrl,required"` - JSON projectListResponseInitializerSpecsContextURLJSON `json:"-"` -} - -// projectListResponseInitializerSpecsContextURLJSON contains the JSON metadata for -// the struct [ProjectListResponseInitializerSpecsContextURL] -type projectListResponseInitializerSpecsContextURLJSON struct { - ContextURL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectListResponseInitializerSpecsContextURL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectListResponseInitializerSpecsContextURLJSON) RawJSON() string { - return r.raw -} - -func (r ProjectListResponseInitializerSpecsContextURL) implementsProjectListResponseInitializerSpec() { -} - -type ProjectListResponseInitializerSpecsContextURLContextURL struct { - // url is the URL from which the environment is created - URL string `json:"url" format:"uri"` - JSON projectListResponseInitializerSpecsContextURLContextURLJSON `json:"-"` -} - -// projectListResponseInitializerSpecsContextURLContextURLJSON contains the JSON -// metadata for the struct -// [ProjectListResponseInitializerSpecsContextURLContextURL] -type projectListResponseInitializerSpecsContextURLContextURLJSON struct { - URL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectListResponseInitializerSpecsContextURLContextURL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectListResponseInitializerSpecsContextURLContextURLJSON) RawJSON() string { - return r.raw -} - -type ProjectListResponseInitializerSpecsGit struct { - Git ProjectListResponseInitializerSpecsGitGit `json:"git,required"` - JSON projectListResponseInitializerSpecsGitJSON `json:"-"` -} - -// projectListResponseInitializerSpecsGitJSON contains the JSON metadata for the -// struct [ProjectListResponseInitializerSpecsGit] -type projectListResponseInitializerSpecsGitJSON struct { - Git apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectListResponseInitializerSpecsGit) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectListResponseInitializerSpecsGitJSON) RawJSON() string { - return r.raw -} - -func (r ProjectListResponseInitializerSpecsGit) implementsProjectListResponseInitializerSpec() {} - -type ProjectListResponseInitializerSpecsGitGit struct { - // a path relative to the environment root in which the code will be checked out to - CheckoutLocation string `json:"checkoutLocation"` - // the value for the clone target mode - use depends on the target mode - CloneTarget string `json:"cloneTarget"` - // remote_uri is the Git remote origin - RemoteUri string `json:"remoteUri"` - // CloneTargetMode is the target state in which we want to leave a GitEnvironment - TargetMode ProjectListResponseInitializerSpecsGitGitTargetMode `json:"targetMode"` - // upstream_Remote_uri is the fork upstream of a repository - UpstreamRemoteUri string `json:"upstreamRemoteUri"` - JSON projectListResponseInitializerSpecsGitGitJSON `json:"-"` -} - -// projectListResponseInitializerSpecsGitGitJSON contains the JSON metadata for the -// struct [ProjectListResponseInitializerSpecsGitGit] -type projectListResponseInitializerSpecsGitGitJSON struct { - CheckoutLocation apijson.Field - CloneTarget apijson.Field - RemoteUri apijson.Field - TargetMode apijson.Field - UpstreamRemoteUri apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectListResponseInitializerSpecsGitGit) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectListResponseInitializerSpecsGitGitJSON) RawJSON() string { - return r.raw -} - -// CloneTargetMode is the target state in which we want to leave a GitEnvironment -type ProjectListResponseInitializerSpecsGitGitTargetMode string - -const ( - ProjectListResponseInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified ProjectListResponseInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_UNSPECIFIED" - ProjectListResponseInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead ProjectListResponseInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_HEAD" - ProjectListResponseInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit ProjectListResponseInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_COMMIT" - ProjectListResponseInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch ProjectListResponseInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_BRANCH" - ProjectListResponseInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch ProjectListResponseInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_LOCAL_BRANCH" -) - -func (r ProjectListResponseInitializerSpecsGitGitTargetMode) IsKnown() bool { - switch r { - case ProjectListResponseInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified, ProjectListResponseInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead, ProjectListResponseInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit, ProjectListResponseInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch, ProjectListResponseInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch: - return true - } - return false -} - -type ProjectListResponseMetadata struct { - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - CreatedAt time.Time `json:"createdAt" format:"date-time"` - // creator is the identity of the project creator - Creator ProjectListResponseMetadataCreator `json:"creator"` - // name is the human readable name of the project - Name string `json:"name"` - // organization_id is the ID of the organization that contains the environment - OrganizationID string `json:"organizationId" format:"uuid"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - UpdatedAt time.Time `json:"updatedAt" format:"date-time"` - JSON projectListResponseMetadataJSON `json:"-"` -} - -// projectListResponseMetadataJSON contains the JSON metadata for the struct -// [ProjectListResponseMetadata] -type projectListResponseMetadataJSON struct { - CreatedAt apijson.Field - Creator apijson.Field - Name apijson.Field - OrganizationID apijson.Field - UpdatedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectListResponseMetadata) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectListResponseMetadataJSON) RawJSON() string { - return r.raw -} - -// creator is the identity of the project creator -type ProjectListResponseMetadataCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal ProjectListResponseMetadataCreatorPrincipal `json:"principal"` - JSON projectListResponseMetadataCreatorJSON `json:"-"` -} - -// projectListResponseMetadataCreatorJSON contains the JSON metadata for the struct -// [ProjectListResponseMetadataCreator] -type projectListResponseMetadataCreatorJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectListResponseMetadataCreator) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectListResponseMetadataCreatorJSON) RawJSON() string { - return r.raw -} - -// Principal is the principal of the subject -type ProjectListResponseMetadataCreatorPrincipal string - -const ( - ProjectListResponseMetadataCreatorPrincipalPrincipalUnspecified ProjectListResponseMetadataCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - ProjectListResponseMetadataCreatorPrincipalPrincipalAccount ProjectListResponseMetadataCreatorPrincipal = "PRINCIPAL_ACCOUNT" - ProjectListResponseMetadataCreatorPrincipalPrincipalUser ProjectListResponseMetadataCreatorPrincipal = "PRINCIPAL_USER" - ProjectListResponseMetadataCreatorPrincipalPrincipalRunner ProjectListResponseMetadataCreatorPrincipal = "PRINCIPAL_RUNNER" - ProjectListResponseMetadataCreatorPrincipalPrincipalEnvironment ProjectListResponseMetadataCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - ProjectListResponseMetadataCreatorPrincipalPrincipalServiceAccount ProjectListResponseMetadataCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r ProjectListResponseMetadataCreatorPrincipal) IsKnown() bool { - switch r { - case ProjectListResponseMetadataCreatorPrincipalPrincipalUnspecified, ProjectListResponseMetadataCreatorPrincipalPrincipalAccount, ProjectListResponseMetadataCreatorPrincipalPrincipalUser, ProjectListResponseMetadataCreatorPrincipalPrincipalRunner, ProjectListResponseMetadataCreatorPrincipalPrincipalEnvironment, ProjectListResponseMetadataCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - -type ProjectListResponseUsedBy struct { - // Subjects are the 10 most recent subjects who have used the project to create an - // environment - Subjects []ProjectListResponseUsedBySubject `json:"subjects"` - // Total number of unique subjects who have used the project - TotalSubjects int64 `json:"totalSubjects"` - JSON projectListResponseUsedByJSON `json:"-"` -} - -// projectListResponseUsedByJSON contains the JSON metadata for the struct -// [ProjectListResponseUsedBy] -type projectListResponseUsedByJSON struct { - Subjects apijson.Field - TotalSubjects apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectListResponseUsedBy) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectListResponseUsedByJSON) RawJSON() string { - return r.raw -} - -type ProjectListResponseUsedBySubject struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal ProjectListResponseUsedBySubjectsPrincipal `json:"principal"` - JSON projectListResponseUsedBySubjectJSON `json:"-"` -} - -// projectListResponseUsedBySubjectJSON contains the JSON metadata for the struct -// [ProjectListResponseUsedBySubject] -type projectListResponseUsedBySubjectJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectListResponseUsedBySubject) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectListResponseUsedBySubjectJSON) RawJSON() string { - return r.raw -} - -// Principal is the principal of the subject -type ProjectListResponseUsedBySubjectsPrincipal string - -const ( - ProjectListResponseUsedBySubjectsPrincipalPrincipalUnspecified ProjectListResponseUsedBySubjectsPrincipal = "PRINCIPAL_UNSPECIFIED" - ProjectListResponseUsedBySubjectsPrincipalPrincipalAccount ProjectListResponseUsedBySubjectsPrincipal = "PRINCIPAL_ACCOUNT" - ProjectListResponseUsedBySubjectsPrincipalPrincipalUser ProjectListResponseUsedBySubjectsPrincipal = "PRINCIPAL_USER" - ProjectListResponseUsedBySubjectsPrincipalPrincipalRunner ProjectListResponseUsedBySubjectsPrincipal = "PRINCIPAL_RUNNER" - ProjectListResponseUsedBySubjectsPrincipalPrincipalEnvironment ProjectListResponseUsedBySubjectsPrincipal = "PRINCIPAL_ENVIRONMENT" - ProjectListResponseUsedBySubjectsPrincipalPrincipalServiceAccount ProjectListResponseUsedBySubjectsPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r ProjectListResponseUsedBySubjectsPrincipal) IsKnown() bool { - switch r { - case ProjectListResponseUsedBySubjectsPrincipalPrincipalUnspecified, ProjectListResponseUsedBySubjectsPrincipalPrincipalAccount, ProjectListResponseUsedBySubjectsPrincipalPrincipalUser, ProjectListResponseUsedBySubjectsPrincipalPrincipalRunner, ProjectListResponseUsedBySubjectsPrincipalPrincipalEnvironment, ProjectListResponseUsedBySubjectsPrincipalPrincipalServiceAccount: - return true - } - return false -} - -type ProjectDeleteResponse = interface{} - -type ProjectNewFromEnvironmentResponse struct { - Project ProjectNewFromEnvironmentResponseProject `json:"project"` - JSON projectNewFromEnvironmentResponseJSON `json:"-"` -} - -// projectNewFromEnvironmentResponseJSON contains the JSON metadata for the struct -// [ProjectNewFromEnvironmentResponse] -type projectNewFromEnvironmentResponseJSON struct { - Project apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectNewFromEnvironmentResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectNewFromEnvironmentResponseJSON) RawJSON() string { - return r.raw -} - -type ProjectNewFromEnvironmentResponseProject struct { - EnvironmentClass ProjectNewFromEnvironmentResponseProjectEnvironmentClass `json:"environmentClass,required"` - // id is the unique identifier for the project - ID string `json:"id" format:"uuid"` - // automations_file_path is the path to the automations file relative to the repo - // root - AutomationsFilePath string `json:"automationsFilePath"` - // devcontainer_file_path is the path to the devcontainer file relative to the repo - // root - DevcontainerFilePath string `json:"devcontainerFilePath"` - // EnvironmentInitializer specifies how an environment is to be initialized - Initializer ProjectNewFromEnvironmentResponseProjectInitializer `json:"initializer"` - Metadata ProjectNewFromEnvironmentResponseProjectMetadata `json:"metadata"` - UsedBy ProjectNewFromEnvironmentResponseProjectUsedBy `json:"usedBy"` - JSON projectNewFromEnvironmentResponseProjectJSON `json:"-"` -} - -// projectNewFromEnvironmentResponseProjectJSON contains the JSON metadata for the -// struct [ProjectNewFromEnvironmentResponseProject] -type projectNewFromEnvironmentResponseProjectJSON struct { - EnvironmentClass apijson.Field - ID apijson.Field - AutomationsFilePath apijson.Field - DevcontainerFilePath apijson.Field - Initializer apijson.Field - Metadata apijson.Field - UsedBy apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectNewFromEnvironmentResponseProject) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectNewFromEnvironmentResponseProjectJSON) RawJSON() string { - return r.raw -} - -type ProjectNewFromEnvironmentResponseProjectEnvironmentClass struct { - // Use a fixed environment class on a given Runner. This cannot be a local runner's - // environment class. - EnvironmentClassID string `json:"environmentClassId" format:"uuid"` - // Use a local runner for the user - LocalRunner bool `json:"localRunner"` - JSON projectNewFromEnvironmentResponseProjectEnvironmentClassJSON `json:"-"` - union ProjectNewFromEnvironmentResponseProjectEnvironmentClassUnion -} - -// projectNewFromEnvironmentResponseProjectEnvironmentClassJSON contains the JSON -// metadata for the struct -// [ProjectNewFromEnvironmentResponseProjectEnvironmentClass] -type projectNewFromEnvironmentResponseProjectEnvironmentClassJSON struct { - EnvironmentClassID apijson.Field - LocalRunner apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r projectNewFromEnvironmentResponseProjectEnvironmentClassJSON) RawJSON() string { - return r.raw -} - -func (r *ProjectNewFromEnvironmentResponseProjectEnvironmentClass) UnmarshalJSON(data []byte) (err error) { - *r = ProjectNewFromEnvironmentResponseProjectEnvironmentClass{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a -// [ProjectNewFromEnvironmentResponseProjectEnvironmentClassUnion] interface which -// you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [ProjectNewFromEnvironmentResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass], -// [ProjectNewFromEnvironmentResponseProjectEnvironmentClassUseALocalRunnerForTheUser]. -func (r ProjectNewFromEnvironmentResponseProjectEnvironmentClass) AsUnion() ProjectNewFromEnvironmentResponseProjectEnvironmentClassUnion { - return r.union -} - -// Union satisfied by -// [ProjectNewFromEnvironmentResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass] -// or -// [ProjectNewFromEnvironmentResponseProjectEnvironmentClassUseALocalRunnerForTheUser]. -type ProjectNewFromEnvironmentResponseProjectEnvironmentClassUnion interface { - implementsProjectNewFromEnvironmentResponseProjectEnvironmentClass() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*ProjectNewFromEnvironmentResponseProjectEnvironmentClassUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ProjectNewFromEnvironmentResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ProjectNewFromEnvironmentResponseProjectEnvironmentClassUseALocalRunnerForTheUser{}), - }, - ) -} - -type ProjectNewFromEnvironmentResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass struct { - // Use a fixed environment class on a given Runner. This cannot be a local runner's - // environment class. - EnvironmentClassID string `json:"environmentClassId,required" format:"uuid"` - JSON projectNewFromEnvironmentResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClassJSON `json:"-"` -} - -// projectNewFromEnvironmentResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClassJSON -// contains the JSON metadata for the struct -// [ProjectNewFromEnvironmentResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass] -type projectNewFromEnvironmentResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClassJSON struct { - EnvironmentClassID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectNewFromEnvironmentResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectNewFromEnvironmentResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClassJSON) RawJSON() string { - return r.raw -} - -func (r ProjectNewFromEnvironmentResponseProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass) implementsProjectNewFromEnvironmentResponseProjectEnvironmentClass() { -} - -type ProjectNewFromEnvironmentResponseProjectEnvironmentClassUseALocalRunnerForTheUser struct { - // Use a local runner for the user - LocalRunner bool `json:"localRunner,required"` - JSON projectNewFromEnvironmentResponseProjectEnvironmentClassUseALocalRunnerForTheUserJSON `json:"-"` -} - -// projectNewFromEnvironmentResponseProjectEnvironmentClassUseALocalRunnerForTheUserJSON -// contains the JSON metadata for the struct -// [ProjectNewFromEnvironmentResponseProjectEnvironmentClassUseALocalRunnerForTheUser] -type projectNewFromEnvironmentResponseProjectEnvironmentClassUseALocalRunnerForTheUserJSON struct { - LocalRunner apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectNewFromEnvironmentResponseProjectEnvironmentClassUseALocalRunnerForTheUser) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectNewFromEnvironmentResponseProjectEnvironmentClassUseALocalRunnerForTheUserJSON) RawJSON() string { - return r.raw -} - -func (r ProjectNewFromEnvironmentResponseProjectEnvironmentClassUseALocalRunnerForTheUser) implementsProjectNewFromEnvironmentResponseProjectEnvironmentClass() { -} - -// EnvironmentInitializer specifies how an environment is to be initialized -type ProjectNewFromEnvironmentResponseProjectInitializer struct { - Specs []ProjectNewFromEnvironmentResponseProjectInitializerSpec `json:"specs"` - JSON projectNewFromEnvironmentResponseProjectInitializerJSON `json:"-"` -} - -// projectNewFromEnvironmentResponseProjectInitializerJSON contains the JSON -// metadata for the struct [ProjectNewFromEnvironmentResponseProjectInitializer] -type projectNewFromEnvironmentResponseProjectInitializerJSON struct { - Specs apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectNewFromEnvironmentResponseProjectInitializer) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectNewFromEnvironmentResponseProjectInitializerJSON) RawJSON() string { - return r.raw -} - -type ProjectNewFromEnvironmentResponseProjectInitializerSpec struct { - // This field can have the runtime type of - // [ProjectNewFromEnvironmentResponseProjectInitializerSpecsContextURLContextURL]. - ContextURL interface{} `json:"contextUrl"` - // This field can have the runtime type of - // [ProjectNewFromEnvironmentResponseProjectInitializerSpecsGitGit]. - Git interface{} `json:"git"` - JSON projectNewFromEnvironmentResponseProjectInitializerSpecJSON `json:"-"` - union ProjectNewFromEnvironmentResponseProjectInitializerSpecsUnion -} - -// projectNewFromEnvironmentResponseProjectInitializerSpecJSON contains the JSON -// metadata for the struct -// [ProjectNewFromEnvironmentResponseProjectInitializerSpec] -type projectNewFromEnvironmentResponseProjectInitializerSpecJSON struct { - ContextURL apijson.Field - Git apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r projectNewFromEnvironmentResponseProjectInitializerSpecJSON) RawJSON() string { - return r.raw -} - -func (r *ProjectNewFromEnvironmentResponseProjectInitializerSpec) UnmarshalJSON(data []byte) (err error) { - *r = ProjectNewFromEnvironmentResponseProjectInitializerSpec{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a -// [ProjectNewFromEnvironmentResponseProjectInitializerSpecsUnion] interface which -// you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [ProjectNewFromEnvironmentResponseProjectInitializerSpecsContextURL], -// [ProjectNewFromEnvironmentResponseProjectInitializerSpecsGit]. -func (r ProjectNewFromEnvironmentResponseProjectInitializerSpec) AsUnion() ProjectNewFromEnvironmentResponseProjectInitializerSpecsUnion { - return r.union -} - -// Union satisfied by -// [ProjectNewFromEnvironmentResponseProjectInitializerSpecsContextURL] or -// [ProjectNewFromEnvironmentResponseProjectInitializerSpecsGit]. -type ProjectNewFromEnvironmentResponseProjectInitializerSpecsUnion interface { - implementsProjectNewFromEnvironmentResponseProjectInitializerSpec() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*ProjectNewFromEnvironmentResponseProjectInitializerSpecsUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ProjectNewFromEnvironmentResponseProjectInitializerSpecsContextURL{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(ProjectNewFromEnvironmentResponseProjectInitializerSpecsGit{}), - }, - ) -} - -type ProjectNewFromEnvironmentResponseProjectInitializerSpecsContextURL struct { - ContextURL ProjectNewFromEnvironmentResponseProjectInitializerSpecsContextURLContextURL `json:"contextUrl,required"` - JSON projectNewFromEnvironmentResponseProjectInitializerSpecsContextURLJSON `json:"-"` -} - -// projectNewFromEnvironmentResponseProjectInitializerSpecsContextURLJSON contains -// the JSON metadata for the struct -// [ProjectNewFromEnvironmentResponseProjectInitializerSpecsContextURL] -type projectNewFromEnvironmentResponseProjectInitializerSpecsContextURLJSON struct { - ContextURL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectNewFromEnvironmentResponseProjectInitializerSpecsContextURL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectNewFromEnvironmentResponseProjectInitializerSpecsContextURLJSON) RawJSON() string { - return r.raw -} - -func (r ProjectNewFromEnvironmentResponseProjectInitializerSpecsContextURL) implementsProjectNewFromEnvironmentResponseProjectInitializerSpec() { -} - -type ProjectNewFromEnvironmentResponseProjectInitializerSpecsContextURLContextURL struct { - // url is the URL from which the environment is created - URL string `json:"url" format:"uri"` - JSON projectNewFromEnvironmentResponseProjectInitializerSpecsContextURLContextURLJSON `json:"-"` -} - -// projectNewFromEnvironmentResponseProjectInitializerSpecsContextURLContextURLJSON -// contains the JSON metadata for the struct -// [ProjectNewFromEnvironmentResponseProjectInitializerSpecsContextURLContextURL] -type projectNewFromEnvironmentResponseProjectInitializerSpecsContextURLContextURLJSON struct { - URL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectNewFromEnvironmentResponseProjectInitializerSpecsContextURLContextURL) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectNewFromEnvironmentResponseProjectInitializerSpecsContextURLContextURLJSON) RawJSON() string { - return r.raw -} - -type ProjectNewFromEnvironmentResponseProjectInitializerSpecsGit struct { - Git ProjectNewFromEnvironmentResponseProjectInitializerSpecsGitGit `json:"git,required"` - JSON projectNewFromEnvironmentResponseProjectInitializerSpecsGitJSON `json:"-"` -} - -// projectNewFromEnvironmentResponseProjectInitializerSpecsGitJSON contains the -// JSON metadata for the struct -// [ProjectNewFromEnvironmentResponseProjectInitializerSpecsGit] -type projectNewFromEnvironmentResponseProjectInitializerSpecsGitJSON struct { - Git apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectNewFromEnvironmentResponseProjectInitializerSpecsGit) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectNewFromEnvironmentResponseProjectInitializerSpecsGitJSON) RawJSON() string { - return r.raw -} - -func (r ProjectNewFromEnvironmentResponseProjectInitializerSpecsGit) implementsProjectNewFromEnvironmentResponseProjectInitializerSpec() { -} - -type ProjectNewFromEnvironmentResponseProjectInitializerSpecsGitGit struct { - // a path relative to the environment root in which the code will be checked out to - CheckoutLocation string `json:"checkoutLocation"` - // the value for the clone target mode - use depends on the target mode - CloneTarget string `json:"cloneTarget"` - // remote_uri is the Git remote origin - RemoteUri string `json:"remoteUri"` - // CloneTargetMode is the target state in which we want to leave a GitEnvironment - TargetMode ProjectNewFromEnvironmentResponseProjectInitializerSpecsGitGitTargetMode `json:"targetMode"` - // upstream_Remote_uri is the fork upstream of a repository - UpstreamRemoteUri string `json:"upstreamRemoteUri"` - JSON projectNewFromEnvironmentResponseProjectInitializerSpecsGitGitJSON `json:"-"` -} - -// projectNewFromEnvironmentResponseProjectInitializerSpecsGitGitJSON contains the -// JSON metadata for the struct -// [ProjectNewFromEnvironmentResponseProjectInitializerSpecsGitGit] -type projectNewFromEnvironmentResponseProjectInitializerSpecsGitGitJSON struct { - CheckoutLocation apijson.Field - CloneTarget apijson.Field - RemoteUri apijson.Field - TargetMode apijson.Field - UpstreamRemoteUri apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectNewFromEnvironmentResponseProjectInitializerSpecsGitGit) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectNewFromEnvironmentResponseProjectInitializerSpecsGitGitJSON) RawJSON() string { - return r.raw -} - -// CloneTargetMode is the target state in which we want to leave a GitEnvironment -type ProjectNewFromEnvironmentResponseProjectInitializerSpecsGitGitTargetMode string - -const ( - ProjectNewFromEnvironmentResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified ProjectNewFromEnvironmentResponseProjectInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_UNSPECIFIED" - ProjectNewFromEnvironmentResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead ProjectNewFromEnvironmentResponseProjectInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_HEAD" - ProjectNewFromEnvironmentResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit ProjectNewFromEnvironmentResponseProjectInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_COMMIT" - ProjectNewFromEnvironmentResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch ProjectNewFromEnvironmentResponseProjectInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_BRANCH" - ProjectNewFromEnvironmentResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch ProjectNewFromEnvironmentResponseProjectInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_LOCAL_BRANCH" -) - -func (r ProjectNewFromEnvironmentResponseProjectInitializerSpecsGitGitTargetMode) IsKnown() bool { - switch r { - case ProjectNewFromEnvironmentResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified, ProjectNewFromEnvironmentResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead, ProjectNewFromEnvironmentResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit, ProjectNewFromEnvironmentResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch, ProjectNewFromEnvironmentResponseProjectInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch: - return true - } - return false -} - -type ProjectNewFromEnvironmentResponseProjectMetadata struct { - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - CreatedAt time.Time `json:"createdAt" format:"date-time"` - // creator is the identity of the project creator - Creator ProjectNewFromEnvironmentResponseProjectMetadataCreator `json:"creator"` - // name is the human readable name of the project - Name string `json:"name"` - // organization_id is the ID of the organization that contains the environment - OrganizationID string `json:"organizationId" format:"uuid"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - UpdatedAt time.Time `json:"updatedAt" format:"date-time"` - JSON projectNewFromEnvironmentResponseProjectMetadataJSON `json:"-"` -} - -// projectNewFromEnvironmentResponseProjectMetadataJSON contains the JSON metadata -// for the struct [ProjectNewFromEnvironmentResponseProjectMetadata] -type projectNewFromEnvironmentResponseProjectMetadataJSON struct { - CreatedAt apijson.Field - Creator apijson.Field - Name apijson.Field - OrganizationID apijson.Field - UpdatedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectNewFromEnvironmentResponseProjectMetadata) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectNewFromEnvironmentResponseProjectMetadataJSON) RawJSON() string { - return r.raw -} - -// creator is the identity of the project creator -type ProjectNewFromEnvironmentResponseProjectMetadataCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal ProjectNewFromEnvironmentResponseProjectMetadataCreatorPrincipal `json:"principal"` - JSON projectNewFromEnvironmentResponseProjectMetadataCreatorJSON `json:"-"` -} - -// projectNewFromEnvironmentResponseProjectMetadataCreatorJSON contains the JSON -// metadata for the struct -// [ProjectNewFromEnvironmentResponseProjectMetadataCreator] -type projectNewFromEnvironmentResponseProjectMetadataCreatorJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectNewFromEnvironmentResponseProjectMetadataCreator) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectNewFromEnvironmentResponseProjectMetadataCreatorJSON) RawJSON() string { - return r.raw -} - -// Principal is the principal of the subject -type ProjectNewFromEnvironmentResponseProjectMetadataCreatorPrincipal string - -const ( - ProjectNewFromEnvironmentResponseProjectMetadataCreatorPrincipalPrincipalUnspecified ProjectNewFromEnvironmentResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - ProjectNewFromEnvironmentResponseProjectMetadataCreatorPrincipalPrincipalAccount ProjectNewFromEnvironmentResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_ACCOUNT" - ProjectNewFromEnvironmentResponseProjectMetadataCreatorPrincipalPrincipalUser ProjectNewFromEnvironmentResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_USER" - ProjectNewFromEnvironmentResponseProjectMetadataCreatorPrincipalPrincipalRunner ProjectNewFromEnvironmentResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_RUNNER" - ProjectNewFromEnvironmentResponseProjectMetadataCreatorPrincipalPrincipalEnvironment ProjectNewFromEnvironmentResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - ProjectNewFromEnvironmentResponseProjectMetadataCreatorPrincipalPrincipalServiceAccount ProjectNewFromEnvironmentResponseProjectMetadataCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r ProjectNewFromEnvironmentResponseProjectMetadataCreatorPrincipal) IsKnown() bool { - switch r { - case ProjectNewFromEnvironmentResponseProjectMetadataCreatorPrincipalPrincipalUnspecified, ProjectNewFromEnvironmentResponseProjectMetadataCreatorPrincipalPrincipalAccount, ProjectNewFromEnvironmentResponseProjectMetadataCreatorPrincipalPrincipalUser, ProjectNewFromEnvironmentResponseProjectMetadataCreatorPrincipalPrincipalRunner, ProjectNewFromEnvironmentResponseProjectMetadataCreatorPrincipalPrincipalEnvironment, ProjectNewFromEnvironmentResponseProjectMetadataCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - -type ProjectNewFromEnvironmentResponseProjectUsedBy struct { - // Subjects are the 10 most recent subjects who have used the project to create an - // environment - Subjects []ProjectNewFromEnvironmentResponseProjectUsedBySubject `json:"subjects"` - // Total number of unique subjects who have used the project - TotalSubjects int64 `json:"totalSubjects"` - JSON projectNewFromEnvironmentResponseProjectUsedByJSON `json:"-"` -} - -// projectNewFromEnvironmentResponseProjectUsedByJSON contains the JSON metadata -// for the struct [ProjectNewFromEnvironmentResponseProjectUsedBy] -type projectNewFromEnvironmentResponseProjectUsedByJSON struct { - Subjects apijson.Field - TotalSubjects apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectNewFromEnvironmentResponseProjectUsedBy) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectNewFromEnvironmentResponseProjectUsedByJSON) RawJSON() string { - return r.raw -} - -type ProjectNewFromEnvironmentResponseProjectUsedBySubject struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal ProjectNewFromEnvironmentResponseProjectUsedBySubjectsPrincipal `json:"principal"` - JSON projectNewFromEnvironmentResponseProjectUsedBySubjectJSON `json:"-"` -} - -// projectNewFromEnvironmentResponseProjectUsedBySubjectJSON contains the JSON -// metadata for the struct [ProjectNewFromEnvironmentResponseProjectUsedBySubject] -type projectNewFromEnvironmentResponseProjectUsedBySubjectJSON struct { - ID apijson.Field - Principal apijson.Field +// projectNewFromEnvironmentResponseJSON contains the JSON metadata for the struct +// [ProjectNewFromEnvironmentResponse] +type projectNewFromEnvironmentResponseJSON struct { + Project apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ProjectNewFromEnvironmentResponseProjectUsedBySubject) UnmarshalJSON(data []byte) (err error) { +func (r *ProjectNewFromEnvironmentResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r projectNewFromEnvironmentResponseProjectUsedBySubjectJSON) RawJSON() string { +func (r projectNewFromEnvironmentResponseJSON) RawJSON() string { return r.raw } -// Principal is the principal of the subject -type ProjectNewFromEnvironmentResponseProjectUsedBySubjectsPrincipal string - -const ( - ProjectNewFromEnvironmentResponseProjectUsedBySubjectsPrincipalPrincipalUnspecified ProjectNewFromEnvironmentResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_UNSPECIFIED" - ProjectNewFromEnvironmentResponseProjectUsedBySubjectsPrincipalPrincipalAccount ProjectNewFromEnvironmentResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_ACCOUNT" - ProjectNewFromEnvironmentResponseProjectUsedBySubjectsPrincipalPrincipalUser ProjectNewFromEnvironmentResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_USER" - ProjectNewFromEnvironmentResponseProjectUsedBySubjectsPrincipalPrincipalRunner ProjectNewFromEnvironmentResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_RUNNER" - ProjectNewFromEnvironmentResponseProjectUsedBySubjectsPrincipalPrincipalEnvironment ProjectNewFromEnvironmentResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_ENVIRONMENT" - ProjectNewFromEnvironmentResponseProjectUsedBySubjectsPrincipalPrincipalServiceAccount ProjectNewFromEnvironmentResponseProjectUsedBySubjectsPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r ProjectNewFromEnvironmentResponseProjectUsedBySubjectsPrincipal) IsKnown() bool { - switch r { - case ProjectNewFromEnvironmentResponseProjectUsedBySubjectsPrincipalPrincipalUnspecified, ProjectNewFromEnvironmentResponseProjectUsedBySubjectsPrincipalPrincipalAccount, ProjectNewFromEnvironmentResponseProjectUsedBySubjectsPrincipalPrincipalUser, ProjectNewFromEnvironmentResponseProjectUsedBySubjectsPrincipalPrincipalRunner, ProjectNewFromEnvironmentResponseProjectUsedBySubjectsPrincipalPrincipalEnvironment, ProjectNewFromEnvironmentResponseProjectUsedBySubjectsPrincipalPrincipalServiceAccount: - return true - } - return false -} - type ProjectNewParams struct { - EnvironmentClass param.Field[ProjectNewParamsEnvironmentClassUnion] `json:"environmentClass,required"` + EnvironmentClass param.Field[ProjectEnvironmentClassParam] `json:"environmentClass,required"` // EnvironmentInitializer specifies how an environment is to be initialized - Initializer param.Field[ProjectNewParamsInitializer] `json:"initializer,required"` + Initializer param.Field[EnvironmentInitializerParam] `json:"initializer,required"` // automations_file_path is the path to the automations file relative to the repo // root path must not be absolute (start with a /): // @@ -3677,145 +684,6 @@ func (r ProjectNewParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type ProjectNewParamsEnvironmentClass struct { - // Use a fixed environment class on a given Runner. This cannot be a local runner's - // environment class. - EnvironmentClassID param.Field[string] `json:"environmentClassId" format:"uuid"` - // Use a local runner for the user - LocalRunner param.Field[bool] `json:"localRunner"` -} - -func (r ProjectNewParamsEnvironmentClass) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r ProjectNewParamsEnvironmentClass) implementsProjectNewParamsEnvironmentClassUnion() {} - -// Satisfied by -// [ProjectNewParamsEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass], -// [ProjectNewParamsEnvironmentClassUseALocalRunnerForTheUser], -// [ProjectNewParamsEnvironmentClass]. -type ProjectNewParamsEnvironmentClassUnion interface { - implementsProjectNewParamsEnvironmentClassUnion() -} - -type ProjectNewParamsEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass struct { - // Use a fixed environment class on a given Runner. This cannot be a local runner's - // environment class. - EnvironmentClassID param.Field[string] `json:"environmentClassId,required" format:"uuid"` -} - -func (r ProjectNewParamsEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r ProjectNewParamsEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass) implementsProjectNewParamsEnvironmentClassUnion() { -} - -type ProjectNewParamsEnvironmentClassUseALocalRunnerForTheUser struct { - // Use a local runner for the user - LocalRunner param.Field[bool] `json:"localRunner,required"` -} - -func (r ProjectNewParamsEnvironmentClassUseALocalRunnerForTheUser) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r ProjectNewParamsEnvironmentClassUseALocalRunnerForTheUser) implementsProjectNewParamsEnvironmentClassUnion() { -} - -// EnvironmentInitializer specifies how an environment is to be initialized -type ProjectNewParamsInitializer struct { - Specs param.Field[[]ProjectNewParamsInitializerSpecUnion] `json:"specs"` -} - -func (r ProjectNewParamsInitializer) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type ProjectNewParamsInitializerSpec struct { - ContextURL param.Field[interface{}] `json:"contextUrl"` - Git param.Field[interface{}] `json:"git"` -} - -func (r ProjectNewParamsInitializerSpec) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r ProjectNewParamsInitializerSpec) implementsProjectNewParamsInitializerSpecUnion() {} - -// Satisfied by [ProjectNewParamsInitializerSpecsContextURL], -// [ProjectNewParamsInitializerSpecsGit], [ProjectNewParamsInitializerSpec]. -type ProjectNewParamsInitializerSpecUnion interface { - implementsProjectNewParamsInitializerSpecUnion() -} - -type ProjectNewParamsInitializerSpecsContextURL struct { - ContextURL param.Field[ProjectNewParamsInitializerSpecsContextURLContextURL] `json:"contextUrl,required"` -} - -func (r ProjectNewParamsInitializerSpecsContextURL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r ProjectNewParamsInitializerSpecsContextURL) implementsProjectNewParamsInitializerSpecUnion() { -} - -type ProjectNewParamsInitializerSpecsContextURLContextURL struct { - // url is the URL from which the environment is created - URL param.Field[string] `json:"url" format:"uri"` -} - -func (r ProjectNewParamsInitializerSpecsContextURLContextURL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type ProjectNewParamsInitializerSpecsGit struct { - Git param.Field[ProjectNewParamsInitializerSpecsGitGit] `json:"git,required"` -} - -func (r ProjectNewParamsInitializerSpecsGit) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r ProjectNewParamsInitializerSpecsGit) implementsProjectNewParamsInitializerSpecUnion() {} - -type ProjectNewParamsInitializerSpecsGitGit struct { - // a path relative to the environment root in which the code will be checked out to - CheckoutLocation param.Field[string] `json:"checkoutLocation"` - // the value for the clone target mode - use depends on the target mode - CloneTarget param.Field[string] `json:"cloneTarget"` - // remote_uri is the Git remote origin - RemoteUri param.Field[string] `json:"remoteUri"` - // CloneTargetMode is the target state in which we want to leave a GitEnvironment - TargetMode param.Field[ProjectNewParamsInitializerSpecsGitGitTargetMode] `json:"targetMode"` - // upstream_Remote_uri is the fork upstream of a repository - UpstreamRemoteUri param.Field[string] `json:"upstreamRemoteUri"` -} - -func (r ProjectNewParamsInitializerSpecsGitGit) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// CloneTargetMode is the target state in which we want to leave a GitEnvironment -type ProjectNewParamsInitializerSpecsGitGitTargetMode string - -const ( - ProjectNewParamsInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified ProjectNewParamsInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_UNSPECIFIED" - ProjectNewParamsInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead ProjectNewParamsInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_HEAD" - ProjectNewParamsInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit ProjectNewParamsInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_COMMIT" - ProjectNewParamsInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch ProjectNewParamsInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_BRANCH" - ProjectNewParamsInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch ProjectNewParamsInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_LOCAL_BRANCH" -) - -func (r ProjectNewParamsInitializerSpecsGitGitTargetMode) IsKnown() bool { - switch r { - case ProjectNewParamsInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified, ProjectNewParamsInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead, ProjectNewParamsInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit, ProjectNewParamsInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch, ProjectNewParamsInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch: - return true - } - return false -} - type ProjectGetParams struct { // project_id specifies the project identifier ProjectID param.Field[string] `json:"projectId" format:"uuid"` @@ -3826,14 +694,6 @@ func (r ProjectGetParams) MarshalJSON() (data []byte, err error) { } type ProjectUpdateParams struct { - Body ProjectUpdateParamsBodyUnion `json:"body,required"` -} - -func (r ProjectUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - -type ProjectUpdateParamsBody struct { // automations_file_path is the path to the automations file relative to the repo // root path must not be absolute (start with a /): // @@ -3847,238 +707,19 @@ type ProjectUpdateParamsBody struct { // ``` // this.matches('^$|^[^/].*') // ``` - DevcontainerFilePath param.Field[string] `json:"devcontainerFilePath"` - EnvironmentClass param.Field[interface{}] `json:"environmentClass"` - Initializer param.Field[interface{}] `json:"initializer"` - Name param.Field[string] `json:"name"` -} - -func (r ProjectUpdateParamsBody) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r ProjectUpdateParamsBody) implementsProjectUpdateParamsBodyUnion() {} - -// Satisfied by -// [ProjectUpdateParamsBodyAutomationsFilePathIsThePathToTheAutomationsFileRelativeToTheRepoRoot], -// [ProjectUpdateParamsBodyDevcontainerFilePathIsThePathToTheDevcontainerFileRelativeToTheRepoRoot], -// [ProjectUpdateParamsBodyEnvironmentClass], -// [ProjectUpdateParamsBodyInitializerIsTheContentInitializer], -// [ProjectUpdateParamsBodyName], [ProjectUpdateParamsBody]. -type ProjectUpdateParamsBodyUnion interface { - implementsProjectUpdateParamsBodyUnion() -} - -type ProjectUpdateParamsBodyAutomationsFilePathIsThePathToTheAutomationsFileRelativeToTheRepoRoot struct { - // automations_file_path is the path to the automations file relative to the repo - // root path must not be absolute (start with a /): - // - // ``` - // this.matches('^$|^[^/].*') - // ``` - AutomationsFilePath param.Field[string] `json:"automationsFilePath,required"` -} - -func (r ProjectUpdateParamsBodyAutomationsFilePathIsThePathToTheAutomationsFileRelativeToTheRepoRoot) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r ProjectUpdateParamsBodyAutomationsFilePathIsThePathToTheAutomationsFileRelativeToTheRepoRoot) implementsProjectUpdateParamsBodyUnion() { -} - -type ProjectUpdateParamsBodyDevcontainerFilePathIsThePathToTheDevcontainerFileRelativeToTheRepoRoot struct { - // devcontainer_file_path is the path to the devcontainer file relative to the repo - // root path must not be absolute (start with a /): - // - // ``` - // this.matches('^$|^[^/].*') - // ``` - DevcontainerFilePath param.Field[string] `json:"devcontainerFilePath,required"` -} - -func (r ProjectUpdateParamsBodyDevcontainerFilePathIsThePathToTheDevcontainerFileRelativeToTheRepoRoot) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r ProjectUpdateParamsBodyDevcontainerFilePathIsThePathToTheDevcontainerFileRelativeToTheRepoRoot) implementsProjectUpdateParamsBodyUnion() { -} - -type ProjectUpdateParamsBodyEnvironmentClass struct { - EnvironmentClass param.Field[ProjectUpdateParamsBodyEnvironmentClassEnvironmentClassUnion] `json:"environmentClass,required"` -} - -func (r ProjectUpdateParamsBodyEnvironmentClass) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r ProjectUpdateParamsBodyEnvironmentClass) implementsProjectUpdateParamsBodyUnion() {} - -type ProjectUpdateParamsBodyEnvironmentClassEnvironmentClass struct { - // Use a fixed environment class on a given Runner. This cannot be a local runner's - // environment class. - EnvironmentClassID param.Field[string] `json:"environmentClassId" format:"uuid"` - // Use a local runner for the user - LocalRunner param.Field[bool] `json:"localRunner"` -} - -func (r ProjectUpdateParamsBodyEnvironmentClassEnvironmentClass) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r ProjectUpdateParamsBodyEnvironmentClassEnvironmentClass) implementsProjectUpdateParamsBodyEnvironmentClassEnvironmentClassUnion() { -} - -// Satisfied by -// [ProjectUpdateParamsBodyEnvironmentClassEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass], -// [ProjectUpdateParamsBodyEnvironmentClassEnvironmentClassUseALocalRunnerForTheUser], -// [ProjectUpdateParamsBodyEnvironmentClassEnvironmentClass]. -type ProjectUpdateParamsBodyEnvironmentClassEnvironmentClassUnion interface { - implementsProjectUpdateParamsBodyEnvironmentClassEnvironmentClassUnion() -} - -type ProjectUpdateParamsBodyEnvironmentClassEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass struct { - // Use a fixed environment class on a given Runner. This cannot be a local runner's - // environment class. - EnvironmentClassID param.Field[string] `json:"environmentClassId,required" format:"uuid"` -} - -func (r ProjectUpdateParamsBodyEnvironmentClassEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r ProjectUpdateParamsBodyEnvironmentClassEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass) implementsProjectUpdateParamsBodyEnvironmentClassEnvironmentClassUnion() { -} - -type ProjectUpdateParamsBodyEnvironmentClassEnvironmentClassUseALocalRunnerForTheUser struct { - // Use a local runner for the user - LocalRunner param.Field[bool] `json:"localRunner,required"` -} - -func (r ProjectUpdateParamsBodyEnvironmentClassEnvironmentClassUseALocalRunnerForTheUser) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r ProjectUpdateParamsBodyEnvironmentClassEnvironmentClassUseALocalRunnerForTheUser) implementsProjectUpdateParamsBodyEnvironmentClassEnvironmentClassUnion() { -} - -type ProjectUpdateParamsBodyInitializerIsTheContentInitializer struct { + DevcontainerFilePath param.Field[string] `json:"devcontainerFilePath"` + EnvironmentClass param.Field[ProjectEnvironmentClassParam] `json:"environmentClass"` // EnvironmentInitializer specifies how an environment is to be initialized - Initializer param.Field[ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializer] `json:"initializer,required"` -} - -func (r ProjectUpdateParamsBodyInitializerIsTheContentInitializer) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r ProjectUpdateParamsBodyInitializerIsTheContentInitializer) implementsProjectUpdateParamsBodyUnion() { -} - -// EnvironmentInitializer specifies how an environment is to be initialized -type ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializer struct { - Specs param.Field[[]ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecUnion] `json:"specs"` -} - -func (r ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializer) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpec struct { - ContextURL param.Field[interface{}] `json:"contextUrl"` - Git param.Field[interface{}] `json:"git"` -} - -func (r ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpec) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpec) implementsProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecUnion() { -} - -// Satisfied by -// [ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsContextURL], -// [ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGit], -// [ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpec]. -type ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecUnion interface { - implementsProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecUnion() -} - -type ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsContextURL struct { - ContextURL param.Field[ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsContextURLContextURL] `json:"contextUrl,required"` -} - -func (r ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsContextURL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsContextURL) implementsProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecUnion() { -} - -type ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsContextURLContextURL struct { - // url is the URL from which the environment is created - URL param.Field[string] `json:"url" format:"uri"` -} - -func (r ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsContextURLContextURL) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGit struct { - Git param.Field[ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGitGit] `json:"git,required"` -} - -func (r ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGit) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGit) implementsProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecUnion() { -} - -type ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGitGit struct { - // a path relative to the environment root in which the code will be checked out to - CheckoutLocation param.Field[string] `json:"checkoutLocation"` - // the value for the clone target mode - use depends on the target mode - CloneTarget param.Field[string] `json:"cloneTarget"` - // remote_uri is the Git remote origin - RemoteUri param.Field[string] `json:"remoteUri"` - // CloneTargetMode is the target state in which we want to leave a GitEnvironment - TargetMode param.Field[ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGitGitTargetMode] `json:"targetMode"` - // upstream_Remote_uri is the fork upstream of a repository - UpstreamRemoteUri param.Field[string] `json:"upstreamRemoteUri"` -} - -func (r ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGitGit) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// CloneTargetMode is the target state in which we want to leave a GitEnvironment -type ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGitGitTargetMode string - -const ( - ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_UNSPECIFIED" - ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_HEAD" - ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_COMMIT" - ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_REMOTE_BRANCH" - ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGitGitTargetMode = "CLONE_TARGET_MODE_LOCAL_BRANCH" -) - -func (r ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGitGitTargetMode) IsKnown() bool { - switch r { - case ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGitGitTargetModeCloneTargetModeUnspecified, ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGitGitTargetModeCloneTargetModeRemoteHead, ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGitGitTargetModeCloneTargetModeRemoteCommit, ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGitGitTargetModeCloneTargetModeRemoteBranch, ProjectUpdateParamsBodyInitializerIsTheContentInitializerInitializerSpecsGitGitTargetModeCloneTargetModeLocalBranch: - return true - } - return false -} - -type ProjectUpdateParamsBodyName struct { - Name param.Field[string] `json:"name,required"` + Initializer param.Field[EnvironmentInitializerParam] `json:"initializer"` + Name param.Field[string] `json:"name"` + // project_id specifies the project identifier + ProjectID param.Field[string] `json:"projectId" format:"uuid"` } -func (r ProjectUpdateParamsBodyName) MarshalJSON() (data []byte, err error) { +func (r ProjectUpdateParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r ProjectUpdateParamsBodyName) implementsProjectUpdateParamsBodyUnion() {} - type ProjectListParams struct { Token param.Field[string] `query:"token"` PageSize param.Field[int64] `query:"pageSize"` diff --git a/project_test.go b/project_test.go index 4d5ef17..14aab80 100644 --- a/project_test.go +++ b/project_test.go @@ -27,14 +27,22 @@ func TestProjectNewWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Projects.New(context.TODO(), gitpod.ProjectNewParams{ - EnvironmentClass: gitpod.F[gitpod.ProjectNewParamsEnvironmentClassUnion](gitpod.ProjectNewParamsEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass{ + EnvironmentClass: gitpod.F(gitpod.ProjectEnvironmentClassParam{ EnvironmentClassID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + LocalRunner: gitpod.F(true), }), - Initializer: gitpod.F(gitpod.ProjectNewParamsInitializer{ - Specs: gitpod.F([]gitpod.ProjectNewParamsInitializerSpecUnion{gitpod.ProjectNewParamsInitializerSpecsContextURL{ - ContextURL: gitpod.F(gitpod.ProjectNewParamsInitializerSpecsContextURLContextURL{ + Initializer: gitpod.F(gitpod.EnvironmentInitializerParam{ + Specs: gitpod.F([]gitpod.EnvironmentInitializerSpecParam{{ + ContextURL: gitpod.F(gitpod.EnvironmentInitializerSpecsContextURLParam{ URL: gitpod.F("https://example.com"), }), + Git: gitpod.F(gitpod.EnvironmentInitializerSpecsGitParam{ + CheckoutLocation: gitpod.F("checkoutLocation"), + CloneTarget: gitpod.F("cloneTarget"), + RemoteUri: gitpod.F("remoteUri"), + TargetMode: gitpod.F(gitpod.EnvironmentInitializerSpecsGitTargetModeCloneTargetModeUnspecified), + UpstreamRemoteUri: gitpod.F("upstreamRemoteUri"), + }), }}), }), AutomationsFilePath: gitpod.F("automationsFilePath"), @@ -89,9 +97,28 @@ func TestProjectUpdateWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Projects.Update(context.TODO(), gitpod.ProjectUpdateParams{ - Body: gitpod.ProjectUpdateParamsBodyAutomationsFilePathIsThePathToTheAutomationsFileRelativeToTheRepoRoot{ - AutomationsFilePath: gitpod.F("automationsFilePath"), - }, + AutomationsFilePath: gitpod.F("automationsFilePath"), + DevcontainerFilePath: gitpod.F("devcontainerFilePath"), + EnvironmentClass: gitpod.F(gitpod.ProjectEnvironmentClassParam{ + EnvironmentClassID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + LocalRunner: gitpod.F(true), + }), + Initializer: gitpod.F(gitpod.EnvironmentInitializerParam{ + Specs: gitpod.F([]gitpod.EnvironmentInitializerSpecParam{{ + ContextURL: gitpod.F(gitpod.EnvironmentInitializerSpecsContextURLParam{ + URL: gitpod.F("https://example.com"), + }), + Git: gitpod.F(gitpod.EnvironmentInitializerSpecsGitParam{ + CheckoutLocation: gitpod.F("checkoutLocation"), + CloneTarget: gitpod.F("cloneTarget"), + RemoteUri: gitpod.F("remoteUri"), + TargetMode: gitpod.F(gitpod.EnvironmentInitializerSpecsGitTargetModeCloneTargetModeUnspecified), + UpstreamRemoteUri: gitpod.F("upstreamRemoteUri"), + }), + }}), + }), + Name: gitpod.F("x"), + ProjectID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), }) if err != nil { var apierr *gitpod.Error diff --git a/projectpolicy.go b/projectpolicy.go index abe7006..2300da1 100644 --- a/projectpolicy.go +++ b/projectpolicy.go @@ -51,7 +51,7 @@ func (r *ProjectPolicyService) Update(ctx context.Context, body ProjectPolicyUpd } // ListProjectPolicies lists policies for a project. -func (r *ProjectPolicyService) List(ctx context.Context, params ProjectPolicyListParams, opts ...option.RequestOption) (res *pagination.PoliciesPage[ProjectPolicyListResponse], err error) { +func (r *ProjectPolicyService) List(ctx context.Context, params ProjectPolicyListParams, opts ...option.RequestOption) (res *pagination.PoliciesPage[ProjectPolicy], err error) { var raw *http.Response opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -69,7 +69,7 @@ func (r *ProjectPolicyService) List(ctx context.Context, params ProjectPolicyLis } // ListProjectPolicies lists policies for a project. -func (r *ProjectPolicyService) ListAutoPaging(ctx context.Context, params ProjectPolicyListParams, opts ...option.RequestOption) *pagination.PoliciesPageAutoPager[ProjectPolicyListResponse] { +func (r *ProjectPolicyService) ListAutoPaging(ctx context.Context, params ProjectPolicyListParams, opts ...option.RequestOption) *pagination.PoliciesPageAutoPager[ProjectPolicy] { return pagination.NewPoliciesPageAutoPager(r.List(ctx, params, opts...)) } @@ -81,229 +81,113 @@ func (r *ProjectPolicyService) Delete(ctx context.Context, body ProjectPolicyDel return } -type ProjectPolicyNewResponse struct { - Policy ProjectPolicyNewResponsePolicy `json:"policy"` - JSON projectPolicyNewResponseJSON `json:"-"` -} - -// projectPolicyNewResponseJSON contains the JSON metadata for the struct -// [ProjectPolicyNewResponse] -type projectPolicyNewResponseJSON struct { - Policy apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectPolicyNewResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectPolicyNewResponseJSON) RawJSON() string { - return r.raw -} - -type ProjectPolicyNewResponsePolicy struct { +type ProjectPolicy struct { GroupID string `json:"groupId" format:"uuid"` // role is the role assigned to the group - Role ProjectPolicyNewResponsePolicyRole `json:"role"` - JSON projectPolicyNewResponsePolicyJSON `json:"-"` + Role ProjectRole `json:"role"` + JSON projectPolicyJSON `json:"-"` } -// projectPolicyNewResponsePolicyJSON contains the JSON metadata for the struct -// [ProjectPolicyNewResponsePolicy] -type projectPolicyNewResponsePolicyJSON struct { +// projectPolicyJSON contains the JSON metadata for the struct [ProjectPolicy] +type projectPolicyJSON struct { GroupID apijson.Field Role apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ProjectPolicyNewResponsePolicy) UnmarshalJSON(data []byte) (err error) { +func (r *ProjectPolicy) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r projectPolicyNewResponsePolicyJSON) RawJSON() string { +func (r projectPolicyJSON) RawJSON() string { return r.raw } -// role is the role assigned to the group -type ProjectPolicyNewResponsePolicyRole string +type ProjectRole string const ( - ProjectPolicyNewResponsePolicyRoleProjectRoleUnspecified ProjectPolicyNewResponsePolicyRole = "PROJECT_ROLE_UNSPECIFIED" - ProjectPolicyNewResponsePolicyRoleProjectRoleAdmin ProjectPolicyNewResponsePolicyRole = "PROJECT_ROLE_ADMIN" - ProjectPolicyNewResponsePolicyRoleProjectRoleUser ProjectPolicyNewResponsePolicyRole = "PROJECT_ROLE_USER" + ProjectRoleProjectRoleUnspecified ProjectRole = "PROJECT_ROLE_UNSPECIFIED" + ProjectRoleProjectRoleAdmin ProjectRole = "PROJECT_ROLE_ADMIN" + ProjectRoleProjectRoleUser ProjectRole = "PROJECT_ROLE_USER" ) -func (r ProjectPolicyNewResponsePolicyRole) IsKnown() bool { +func (r ProjectRole) IsKnown() bool { switch r { - case ProjectPolicyNewResponsePolicyRoleProjectRoleUnspecified, ProjectPolicyNewResponsePolicyRoleProjectRoleAdmin, ProjectPolicyNewResponsePolicyRoleProjectRoleUser: + case ProjectRoleProjectRoleUnspecified, ProjectRoleProjectRoleAdmin, ProjectRoleProjectRoleUser: return true } return false } -type ProjectPolicyUpdateResponse struct { - Policy ProjectPolicyUpdateResponsePolicy `json:"policy"` - JSON projectPolicyUpdateResponseJSON `json:"-"` +type ProjectPolicyNewResponse struct { + Policy ProjectPolicy `json:"policy"` + JSON projectPolicyNewResponseJSON `json:"-"` } -// projectPolicyUpdateResponseJSON contains the JSON metadata for the struct -// [ProjectPolicyUpdateResponse] -type projectPolicyUpdateResponseJSON struct { +// projectPolicyNewResponseJSON contains the JSON metadata for the struct +// [ProjectPolicyNewResponse] +type projectPolicyNewResponseJSON struct { Policy apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ProjectPolicyUpdateResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectPolicyUpdateResponseJSON) RawJSON() string { - return r.raw -} - -type ProjectPolicyUpdateResponsePolicy struct { - GroupID string `json:"groupId" format:"uuid"` - // role is the role assigned to the group - Role ProjectPolicyUpdateResponsePolicyRole `json:"role"` - JSON projectPolicyUpdateResponsePolicyJSON `json:"-"` -} - -// projectPolicyUpdateResponsePolicyJSON contains the JSON metadata for the struct -// [ProjectPolicyUpdateResponsePolicy] -type projectPolicyUpdateResponsePolicyJSON struct { - GroupID apijson.Field - Role apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectPolicyUpdateResponsePolicy) UnmarshalJSON(data []byte) (err error) { +func (r *ProjectPolicyNewResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r projectPolicyUpdateResponsePolicyJSON) RawJSON() string { +func (r projectPolicyNewResponseJSON) RawJSON() string { return r.raw } -// role is the role assigned to the group -type ProjectPolicyUpdateResponsePolicyRole string - -const ( - ProjectPolicyUpdateResponsePolicyRoleProjectRoleUnspecified ProjectPolicyUpdateResponsePolicyRole = "PROJECT_ROLE_UNSPECIFIED" - ProjectPolicyUpdateResponsePolicyRoleProjectRoleAdmin ProjectPolicyUpdateResponsePolicyRole = "PROJECT_ROLE_ADMIN" - ProjectPolicyUpdateResponsePolicyRoleProjectRoleUser ProjectPolicyUpdateResponsePolicyRole = "PROJECT_ROLE_USER" -) - -func (r ProjectPolicyUpdateResponsePolicyRole) IsKnown() bool { - switch r { - case ProjectPolicyUpdateResponsePolicyRoleProjectRoleUnspecified, ProjectPolicyUpdateResponsePolicyRoleProjectRoleAdmin, ProjectPolicyUpdateResponsePolicyRoleProjectRoleUser: - return true - } - return false -} - -type ProjectPolicyListResponse struct { - GroupID string `json:"groupId" format:"uuid"` - // role is the role assigned to the group - Role ProjectPolicyListResponseRole `json:"role"` - JSON projectPolicyListResponseJSON `json:"-"` +type ProjectPolicyUpdateResponse struct { + Policy ProjectPolicy `json:"policy"` + JSON projectPolicyUpdateResponseJSON `json:"-"` } -// projectPolicyListResponseJSON contains the JSON metadata for the struct -// [ProjectPolicyListResponse] -type projectPolicyListResponseJSON struct { - GroupID apijson.Field - Role apijson.Field +// projectPolicyUpdateResponseJSON contains the JSON metadata for the struct +// [ProjectPolicyUpdateResponse] +type projectPolicyUpdateResponseJSON struct { + Policy apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *ProjectPolicyListResponse) UnmarshalJSON(data []byte) (err error) { +func (r *ProjectPolicyUpdateResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r projectPolicyListResponseJSON) RawJSON() string { +func (r projectPolicyUpdateResponseJSON) RawJSON() string { return r.raw } -// role is the role assigned to the group -type ProjectPolicyListResponseRole string - -const ( - ProjectPolicyListResponseRoleProjectRoleUnspecified ProjectPolicyListResponseRole = "PROJECT_ROLE_UNSPECIFIED" - ProjectPolicyListResponseRoleProjectRoleAdmin ProjectPolicyListResponseRole = "PROJECT_ROLE_ADMIN" - ProjectPolicyListResponseRoleProjectRoleUser ProjectPolicyListResponseRole = "PROJECT_ROLE_USER" -) - -func (r ProjectPolicyListResponseRole) IsKnown() bool { - switch r { - case ProjectPolicyListResponseRoleProjectRoleUnspecified, ProjectPolicyListResponseRoleProjectRoleAdmin, ProjectPolicyListResponseRoleProjectRoleUser: - return true - } - return false -} - type ProjectPolicyDeleteResponse = interface{} type ProjectPolicyNewParams struct { // group_id specifies the group_id identifier GroupID param.Field[string] `json:"groupId" format:"uuid"` // project_id specifies the project identifier - ProjectID param.Field[string] `json:"projectId" format:"uuid"` - Role param.Field[ProjectPolicyNewParamsRole] `json:"role"` + ProjectID param.Field[string] `json:"projectId" format:"uuid"` + Role param.Field[ProjectRole] `json:"role"` } func (r ProjectPolicyNewParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type ProjectPolicyNewParamsRole string - -const ( - ProjectPolicyNewParamsRoleProjectRoleUnspecified ProjectPolicyNewParamsRole = "PROJECT_ROLE_UNSPECIFIED" - ProjectPolicyNewParamsRoleProjectRoleAdmin ProjectPolicyNewParamsRole = "PROJECT_ROLE_ADMIN" - ProjectPolicyNewParamsRoleProjectRoleUser ProjectPolicyNewParamsRole = "PROJECT_ROLE_USER" -) - -func (r ProjectPolicyNewParamsRole) IsKnown() bool { - switch r { - case ProjectPolicyNewParamsRoleProjectRoleUnspecified, ProjectPolicyNewParamsRoleProjectRoleAdmin, ProjectPolicyNewParamsRoleProjectRoleUser: - return true - } - return false -} - type ProjectPolicyUpdateParams struct { // group_id specifies the group_id identifier GroupID param.Field[string] `json:"groupId" format:"uuid"` // project_id specifies the project identifier - ProjectID param.Field[string] `json:"projectId" format:"uuid"` - Role param.Field[ProjectPolicyUpdateParamsRole] `json:"role"` + ProjectID param.Field[string] `json:"projectId" format:"uuid"` + Role param.Field[ProjectRole] `json:"role"` } func (r ProjectPolicyUpdateParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type ProjectPolicyUpdateParamsRole string - -const ( - ProjectPolicyUpdateParamsRoleProjectRoleUnspecified ProjectPolicyUpdateParamsRole = "PROJECT_ROLE_UNSPECIFIED" - ProjectPolicyUpdateParamsRoleProjectRoleAdmin ProjectPolicyUpdateParamsRole = "PROJECT_ROLE_ADMIN" - ProjectPolicyUpdateParamsRoleProjectRoleUser ProjectPolicyUpdateParamsRole = "PROJECT_ROLE_USER" -) - -func (r ProjectPolicyUpdateParamsRole) IsKnown() bool { - switch r { - case ProjectPolicyUpdateParamsRoleProjectRoleUnspecified, ProjectPolicyUpdateParamsRoleProjectRoleAdmin, ProjectPolicyUpdateParamsRoleProjectRoleUser: - return true - } - return false -} - type ProjectPolicyListParams struct { Token param.Field[string] `query:"token"` PageSize param.Field[int64] `query:"pageSize"` diff --git a/projectpolicy_test.go b/projectpolicy_test.go index 8076f57..d360543 100644 --- a/projectpolicy_test.go +++ b/projectpolicy_test.go @@ -29,7 +29,7 @@ func TestProjectPolicyNewWithOptionalParams(t *testing.T) { _, err := client.Projects.Policies.New(context.TODO(), gitpod.ProjectPolicyNewParams{ GroupID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), ProjectID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - Role: gitpod.F(gitpod.ProjectPolicyNewParamsRoleProjectRoleUnspecified), + Role: gitpod.F(gitpod.ProjectRoleProjectRoleUnspecified), }) if err != nil { var apierr *gitpod.Error @@ -56,7 +56,7 @@ func TestProjectPolicyUpdateWithOptionalParams(t *testing.T) { _, err := client.Projects.Policies.Update(context.TODO(), gitpod.ProjectPolicyUpdateParams{ GroupID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), ProjectID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - Role: gitpod.F(gitpod.ProjectPolicyUpdateParamsRoleProjectRoleUnspecified), + Role: gitpod.F(gitpod.ProjectRoleProjectRoleUnspecified), }) if err != nil { var apierr *gitpod.Error diff --git a/runner.go b/runner.go index 30bc1fa..6f577b6 100644 --- a/runner.go +++ b/runner.go @@ -14,6 +14,7 @@ import ( "github.com/gitpod-io/flex-sdk-go/internal/requestconfig" "github.com/gitpod-io/flex-sdk-go/option" "github.com/gitpod-io/flex-sdk-go/packages/pagination" + "github.com/gitpod-io/flex-sdk-go/shared" ) // RunnerService contains methods and other services that help with interacting @@ -66,7 +67,7 @@ func (r *RunnerService) Update(ctx context.Context, body RunnerUpdateParams, opt } // ListRunners returns all runners registered in the scope. -func (r *RunnerService) List(ctx context.Context, params RunnerListParams, opts ...option.RequestOption) (res *pagination.RunnersPage[RunnerListResponse], err error) { +func (r *RunnerService) List(ctx context.Context, params RunnerListParams, opts ...option.RequestOption) (res *pagination.RunnersPage[Runner], err error) { var raw *http.Response opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -84,7 +85,7 @@ func (r *RunnerService) List(ctx context.Context, params RunnerListParams, opts } // ListRunners returns all runners registered in the scope. -func (r *RunnerService) ListAutoPaging(ctx context.Context, params RunnerListParams, opts ...option.RequestOption) *pagination.RunnersPageAutoPager[RunnerListResponse] { +func (r *RunnerService) ListAutoPaging(ctx context.Context, params RunnerListParams, opts ...option.RequestOption) *pagination.RunnersPageAutoPager[Runner] { return pagination.NewRunnersPageAutoPager(r.List(ctx, params, opts...)) } @@ -109,7 +110,7 @@ func (r *RunnerService) CheckAuthenticationForHost(ctx context.Context, body Run // CreateRunnerToken returns a token that can be used to authenticate as the // runner. Use this call to renew an outdated token - this does not expire any -// previouly issued tokens. +// previously issued tokens. func (r *RunnerService) NewRunnerToken(ctx context.Context, body RunnerNewRunnerTokenParams, opts ...option.RequestOption) (res *RunnerNewRunnerTokenResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.RunnerService/CreateRunnerToken" @@ -136,30 +137,7 @@ func (r *RunnerService) ParseContextURL(ctx context.Context, body RunnerParseCon return } -type RunnerNewResponse struct { - AccessToken string `json:"accessToken"` - Runner RunnerNewResponseRunner `json:"runner"` - JSON runnerNewResponseJSON `json:"-"` -} - -// runnerNewResponseJSON contains the JSON metadata for the struct -// [RunnerNewResponse] -type runnerNewResponseJSON struct { - AccessToken apijson.Field - Runner apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerNewResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerNewResponseJSON) RawJSON() string { - return r.raw -} - -type RunnerNewResponseRunner struct { +type Runner 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, @@ -250,20 +228,20 @@ type RunnerNewResponseRunner struct { // to obtain a formatter capable of generating timestamps in this format. CreatedAt time.Time `json:"createdAt" format:"date-time"` // creator is the identity of the creator of the environment - Creator RunnerNewResponseRunnerCreator `json:"creator"` + Creator shared.Subject `json:"creator"` // RunnerKind represents the kind of a runner - Kind RunnerNewResponseRunnerKind `json:"kind"` + Kind RunnerKind `json:"kind"` // The runner's name which is shown to users Name string `json:"name"` // RunnerProvider identifies the specific implementation type of a runner. Each // provider maps to a specific kind of runner (local or remote), as specified below // for each provider. - Provider RunnerNewResponseRunnerProvider `json:"provider"` - RunnerID string `json:"runnerId"` + Provider RunnerProvider `json:"provider"` + RunnerID string `json:"runnerId"` // The runner's specification - Spec RunnerNewResponseRunnerSpec `json:"spec"` + Spec RunnerSpec `json:"spec"` // RunnerStatus represents the status of a runner - Status RunnerNewResponseRunnerStatus `json:"status"` + Status RunnerStatus `json:"status"` // 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, @@ -352,13 +330,12 @@ type RunnerNewResponseRunner 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 runnerNewResponseRunnerJSON `json:"-"` + UpdatedAt time.Time `json:"updatedAt" format:"date-time"` + JSON runnerJSON `json:"-"` } -// runnerNewResponseRunnerJSON contains the JSON metadata for the struct -// [RunnerNewResponseRunner] -type runnerNewResponseRunnerJSON struct { +// runnerJSON contains the JSON metadata for the struct [Runner] +type runnerJSON struct { CreatedAt apijson.Field Creator apijson.Field Kind apijson.Field @@ -372,73 +349,108 @@ type runnerNewResponseRunnerJSON struct { ExtraFields map[string]apijson.Field } -func (r *RunnerNewResponseRunner) UnmarshalJSON(data []byte) (err error) { +func (r *Runner) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerNewResponseRunnerJSON) RawJSON() string { +func (r runnerJSON) RawJSON() string { return r.raw } -// creator is the identity of the creator of the environment -type RunnerNewResponseRunnerCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal RunnerNewResponseRunnerCreatorPrincipal `json:"principal"` - JSON runnerNewResponseRunnerCreatorJSON `json:"-"` +type RunnerCapability string + +const ( + RunnerCapabilityRunnerCapabilityUnspecified RunnerCapability = "RUNNER_CAPABILITY_UNSPECIFIED" + RunnerCapabilityRunnerCapabilityFetchLocalScmIntegrations RunnerCapability = "RUNNER_CAPABILITY_FETCH_LOCAL_SCM_INTEGRATIONS" +) + +func (r RunnerCapability) IsKnown() bool { + switch r { + case RunnerCapabilityRunnerCapabilityUnspecified, RunnerCapabilityRunnerCapabilityFetchLocalScmIntegrations: + return true + } + return false } -// runnerNewResponseRunnerCreatorJSON contains the JSON metadata for the struct -// [RunnerNewResponseRunnerCreator] -type runnerNewResponseRunnerCreatorJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field +type RunnerConfiguration struct { + // auto_update indicates whether the runner should automatically update itself. + AutoUpdate bool `json:"autoUpdate"` + // Region to deploy the runner in, if applicable. This is mainly used for remote + // runners, and is only a hint. The runner may be deployed in a different region. + // See the runner's status for the actual region. + Region string `json:"region"` + // The release channel the runner is on + ReleaseChannel RunnerReleaseChannel `json:"releaseChannel"` + JSON runnerConfigurationJSON `json:"-"` +} + +// runnerConfigurationJSON contains the JSON metadata for the struct +// [RunnerConfiguration] +type runnerConfigurationJSON struct { + AutoUpdate apijson.Field + Region apijson.Field + ReleaseChannel apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *RunnerNewResponseRunnerCreator) UnmarshalJSON(data []byte) (err error) { +func (r *RunnerConfiguration) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerNewResponseRunnerCreatorJSON) RawJSON() string { +func (r runnerConfigurationJSON) RawJSON() string { return r.raw } -// Principal is the principal of the subject -type RunnerNewResponseRunnerCreatorPrincipal string +type RunnerConfigurationParam struct { + // auto_update indicates whether the runner should automatically update itself. + AutoUpdate param.Field[bool] `json:"autoUpdate"` + // Region to deploy the runner in, if applicable. This is mainly used for remote + // runners, and is only a hint. The runner may be deployed in a different region. + // See the runner's status for the actual region. + Region param.Field[string] `json:"region"` + // The release channel the runner is on + ReleaseChannel param.Field[RunnerReleaseChannel] `json:"releaseChannel"` +} + +func (r RunnerConfigurationParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// RunnerKind represents the kind of a runner +type RunnerKind string const ( - RunnerNewResponseRunnerCreatorPrincipalPrincipalUnspecified RunnerNewResponseRunnerCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - RunnerNewResponseRunnerCreatorPrincipalPrincipalAccount RunnerNewResponseRunnerCreatorPrincipal = "PRINCIPAL_ACCOUNT" - RunnerNewResponseRunnerCreatorPrincipalPrincipalUser RunnerNewResponseRunnerCreatorPrincipal = "PRINCIPAL_USER" - RunnerNewResponseRunnerCreatorPrincipalPrincipalRunner RunnerNewResponseRunnerCreatorPrincipal = "PRINCIPAL_RUNNER" - RunnerNewResponseRunnerCreatorPrincipalPrincipalEnvironment RunnerNewResponseRunnerCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - RunnerNewResponseRunnerCreatorPrincipalPrincipalServiceAccount RunnerNewResponseRunnerCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" + RunnerKindRunnerKindUnspecified RunnerKind = "RUNNER_KIND_UNSPECIFIED" + RunnerKindRunnerKindLocal RunnerKind = "RUNNER_KIND_LOCAL" + RunnerKindRunnerKindRemote RunnerKind = "RUNNER_KIND_REMOTE" + RunnerKindRunnerKindLocalConfiguration RunnerKind = "RUNNER_KIND_LOCAL_CONFIGURATION" ) -func (r RunnerNewResponseRunnerCreatorPrincipal) IsKnown() bool { +func (r RunnerKind) IsKnown() bool { switch r { - case RunnerNewResponseRunnerCreatorPrincipalPrincipalUnspecified, RunnerNewResponseRunnerCreatorPrincipalPrincipalAccount, RunnerNewResponseRunnerCreatorPrincipalPrincipalUser, RunnerNewResponseRunnerCreatorPrincipalPrincipalRunner, RunnerNewResponseRunnerCreatorPrincipalPrincipalEnvironment, RunnerNewResponseRunnerCreatorPrincipalPrincipalServiceAccount: + case RunnerKindRunnerKindUnspecified, RunnerKindRunnerKindLocal, RunnerKindRunnerKindRemote, RunnerKindRunnerKindLocalConfiguration: return true } return false } -// RunnerKind represents the kind of a runner -type RunnerNewResponseRunnerKind string +// RunnerPhase represents the phase a runner is in +type RunnerPhase string const ( - RunnerNewResponseRunnerKindRunnerKindUnspecified RunnerNewResponseRunnerKind = "RUNNER_KIND_UNSPECIFIED" - RunnerNewResponseRunnerKindRunnerKindLocal RunnerNewResponseRunnerKind = "RUNNER_KIND_LOCAL" - RunnerNewResponseRunnerKindRunnerKindRemote RunnerNewResponseRunnerKind = "RUNNER_KIND_REMOTE" - RunnerNewResponseRunnerKindRunnerKindLocalConfiguration RunnerNewResponseRunnerKind = "RUNNER_KIND_LOCAL_CONFIGURATION" + RunnerPhaseRunnerPhaseUnspecified RunnerPhase = "RUNNER_PHASE_UNSPECIFIED" + RunnerPhaseRunnerPhaseCreated RunnerPhase = "RUNNER_PHASE_CREATED" + RunnerPhaseRunnerPhaseInactive RunnerPhase = "RUNNER_PHASE_INACTIVE" + RunnerPhaseRunnerPhaseActive RunnerPhase = "RUNNER_PHASE_ACTIVE" + RunnerPhaseRunnerPhaseDeleting RunnerPhase = "RUNNER_PHASE_DELETING" + RunnerPhaseRunnerPhaseDeleted RunnerPhase = "RUNNER_PHASE_DELETED" + RunnerPhaseRunnerPhaseDegraded RunnerPhase = "RUNNER_PHASE_DEGRADED" ) -func (r RunnerNewResponseRunnerKind) IsKnown() bool { +func (r RunnerPhase) IsKnown() bool { switch r { - case RunnerNewResponseRunnerKindRunnerKindUnspecified, RunnerNewResponseRunnerKindRunnerKindLocal, RunnerNewResponseRunnerKindRunnerKindRemote, RunnerNewResponseRunnerKindRunnerKindLocalConfiguration: + case RunnerPhaseRunnerPhaseUnspecified, RunnerPhaseRunnerPhaseCreated, RunnerPhaseRunnerPhaseInactive, RunnerPhaseRunnerPhaseActive, RunnerPhaseRunnerPhaseDeleting, RunnerPhaseRunnerPhaseDeleted, RunnerPhaseRunnerPhaseDegraded: return true } return false @@ -447,131 +459,87 @@ func (r RunnerNewResponseRunnerKind) IsKnown() bool { // RunnerProvider identifies the specific implementation type of a runner. Each // provider maps to a specific kind of runner (local or remote), as specified below // for each provider. -type RunnerNewResponseRunnerProvider string +type RunnerProvider string + +const ( + RunnerProviderRunnerProviderUnspecified RunnerProvider = "RUNNER_PROVIDER_UNSPECIFIED" + RunnerProviderRunnerProviderAwsEc2 RunnerProvider = "RUNNER_PROVIDER_AWS_EC2" + RunnerProviderRunnerProviderLinuxHost RunnerProvider = "RUNNER_PROVIDER_LINUX_HOST" + RunnerProviderRunnerProviderDesktopMac RunnerProvider = "RUNNER_PROVIDER_DESKTOP_MAC" +) + +func (r RunnerProvider) IsKnown() bool { + switch r { + case RunnerProviderRunnerProviderUnspecified, RunnerProviderRunnerProviderAwsEc2, RunnerProviderRunnerProviderLinuxHost, RunnerProviderRunnerProviderDesktopMac: + return true + } + return false +} + +type RunnerReleaseChannel string const ( - RunnerNewResponseRunnerProviderRunnerProviderUnspecified RunnerNewResponseRunnerProvider = "RUNNER_PROVIDER_UNSPECIFIED" - RunnerNewResponseRunnerProviderRunnerProviderAwsEc2 RunnerNewResponseRunnerProvider = "RUNNER_PROVIDER_AWS_EC2" - RunnerNewResponseRunnerProviderRunnerProviderLinuxHost RunnerNewResponseRunnerProvider = "RUNNER_PROVIDER_LINUX_HOST" - RunnerNewResponseRunnerProviderRunnerProviderDesktopMac RunnerNewResponseRunnerProvider = "RUNNER_PROVIDER_DESKTOP_MAC" + RunnerReleaseChannelRunnerReleaseChannelUnspecified RunnerReleaseChannel = "RUNNER_RELEASE_CHANNEL_UNSPECIFIED" + RunnerReleaseChannelRunnerReleaseChannelStable RunnerReleaseChannel = "RUNNER_RELEASE_CHANNEL_STABLE" + RunnerReleaseChannelRunnerReleaseChannelLatest RunnerReleaseChannel = "RUNNER_RELEASE_CHANNEL_LATEST" ) -func (r RunnerNewResponseRunnerProvider) IsKnown() bool { +func (r RunnerReleaseChannel) IsKnown() bool { switch r { - case RunnerNewResponseRunnerProviderRunnerProviderUnspecified, RunnerNewResponseRunnerProviderRunnerProviderAwsEc2, RunnerNewResponseRunnerProviderRunnerProviderLinuxHost, RunnerNewResponseRunnerProviderRunnerProviderDesktopMac: + case RunnerReleaseChannelRunnerReleaseChannelUnspecified, RunnerReleaseChannelRunnerReleaseChannelStable, RunnerReleaseChannelRunnerReleaseChannelLatest: return true } return false } -// The runner's specification -type RunnerNewResponseRunnerSpec struct { +type RunnerSpec struct { // The runner's configuration - Configuration RunnerNewResponseRunnerSpecConfiguration `json:"configuration"` + Configuration RunnerConfiguration `json:"configuration"` // RunnerPhase represents the phase a runner is in - DesiredPhase RunnerNewResponseRunnerSpecDesiredPhase `json:"desiredPhase"` - JSON runnerNewResponseRunnerSpecJSON `json:"-"` + DesiredPhase RunnerPhase `json:"desiredPhase"` + JSON runnerSpecJSON `json:"-"` } -// runnerNewResponseRunnerSpecJSON contains the JSON metadata for the struct -// [RunnerNewResponseRunnerSpec] -type runnerNewResponseRunnerSpecJSON struct { +// runnerSpecJSON contains the JSON metadata for the struct [RunnerSpec] +type runnerSpecJSON struct { Configuration apijson.Field DesiredPhase apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RunnerNewResponseRunnerSpec) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerNewResponseRunnerSpecJSON) RawJSON() string { - return r.raw -} - -// The runner's configuration -type RunnerNewResponseRunnerSpecConfiguration struct { - // auto_update indicates whether the runner should automatically update itself. - AutoUpdate bool `json:"autoUpdate"` - // Region to deploy the runner in, if applicable. This is mainly used for remote - // runners, and is only a hint. The runner may be deployed in a different region. - // See the runner's status for the actual region. - Region string `json:"region"` - // The release channel the runner is on - ReleaseChannel RunnerNewResponseRunnerSpecConfigurationReleaseChannel `json:"releaseChannel"` - JSON runnerNewResponseRunnerSpecConfigurationJSON `json:"-"` -} - -// runnerNewResponseRunnerSpecConfigurationJSON contains the JSON metadata for the -// struct [RunnerNewResponseRunnerSpecConfiguration] -type runnerNewResponseRunnerSpecConfigurationJSON struct { - AutoUpdate apijson.Field - Region apijson.Field - ReleaseChannel apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerNewResponseRunnerSpecConfiguration) UnmarshalJSON(data []byte) (err error) { +func (r *RunnerSpec) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerNewResponseRunnerSpecConfigurationJSON) RawJSON() string { +func (r runnerSpecJSON) RawJSON() string { return r.raw } -// The release channel the runner is on -type RunnerNewResponseRunnerSpecConfigurationReleaseChannel string - -const ( - RunnerNewResponseRunnerSpecConfigurationReleaseChannelRunnerReleaseChannelUnspecified RunnerNewResponseRunnerSpecConfigurationReleaseChannel = "RUNNER_RELEASE_CHANNEL_UNSPECIFIED" - RunnerNewResponseRunnerSpecConfigurationReleaseChannelRunnerReleaseChannelStable RunnerNewResponseRunnerSpecConfigurationReleaseChannel = "RUNNER_RELEASE_CHANNEL_STABLE" - RunnerNewResponseRunnerSpecConfigurationReleaseChannelRunnerReleaseChannelLatest RunnerNewResponseRunnerSpecConfigurationReleaseChannel = "RUNNER_RELEASE_CHANNEL_LATEST" -) - -func (r RunnerNewResponseRunnerSpecConfigurationReleaseChannel) IsKnown() bool { - switch r { - case RunnerNewResponseRunnerSpecConfigurationReleaseChannelRunnerReleaseChannelUnspecified, RunnerNewResponseRunnerSpecConfigurationReleaseChannelRunnerReleaseChannelStable, RunnerNewResponseRunnerSpecConfigurationReleaseChannelRunnerReleaseChannelLatest: - return true - } - return false +type RunnerSpecParam struct { + // The runner's configuration + Configuration param.Field[RunnerConfigurationParam] `json:"configuration"` + // RunnerPhase represents the phase a runner is in + DesiredPhase param.Field[RunnerPhase] `json:"desiredPhase"` } -// RunnerPhase represents the phase a runner is in -type RunnerNewResponseRunnerSpecDesiredPhase string - -const ( - RunnerNewResponseRunnerSpecDesiredPhaseRunnerPhaseUnspecified RunnerNewResponseRunnerSpecDesiredPhase = "RUNNER_PHASE_UNSPECIFIED" - RunnerNewResponseRunnerSpecDesiredPhaseRunnerPhaseCreated RunnerNewResponseRunnerSpecDesiredPhase = "RUNNER_PHASE_CREATED" - RunnerNewResponseRunnerSpecDesiredPhaseRunnerPhaseInactive RunnerNewResponseRunnerSpecDesiredPhase = "RUNNER_PHASE_INACTIVE" - RunnerNewResponseRunnerSpecDesiredPhaseRunnerPhaseActive RunnerNewResponseRunnerSpecDesiredPhase = "RUNNER_PHASE_ACTIVE" - RunnerNewResponseRunnerSpecDesiredPhaseRunnerPhaseDeleting RunnerNewResponseRunnerSpecDesiredPhase = "RUNNER_PHASE_DELETING" - RunnerNewResponseRunnerSpecDesiredPhaseRunnerPhaseDeleted RunnerNewResponseRunnerSpecDesiredPhase = "RUNNER_PHASE_DELETED" - RunnerNewResponseRunnerSpecDesiredPhaseRunnerPhaseDegraded RunnerNewResponseRunnerSpecDesiredPhase = "RUNNER_PHASE_DEGRADED" -) - -func (r RunnerNewResponseRunnerSpecDesiredPhase) IsKnown() bool { - switch r { - case RunnerNewResponseRunnerSpecDesiredPhaseRunnerPhaseUnspecified, RunnerNewResponseRunnerSpecDesiredPhaseRunnerPhaseCreated, RunnerNewResponseRunnerSpecDesiredPhaseRunnerPhaseInactive, RunnerNewResponseRunnerSpecDesiredPhaseRunnerPhaseActive, RunnerNewResponseRunnerSpecDesiredPhaseRunnerPhaseDeleting, RunnerNewResponseRunnerSpecDesiredPhaseRunnerPhaseDeleted, RunnerNewResponseRunnerSpecDesiredPhaseRunnerPhaseDegraded: - return true - } - return false +func (r RunnerSpecParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } // RunnerStatus represents the status of a runner -type RunnerNewResponseRunnerStatus struct { +type RunnerStatus struct { // additional_info contains additional information about the runner, e.g. a // CloudFormation stack URL. - AdditionalInfo []RunnerNewResponseRunnerStatusAdditionalInfo `json:"additionalInfo"` + AdditionalInfo []shared.FieldValue `json:"additionalInfo"` // capabilities is a list of capabilities the runner supports. - Capabilities []RunnerNewResponseRunnerStatusCapability `json:"capabilities"` - LogURL string `json:"logUrl"` + Capabilities []RunnerCapability `json:"capabilities"` + LogURL string `json:"logUrl"` // The runner's reported message which is shown to users. This message adds more // context to the runner's phase. Message string `json:"message"` // RunnerPhase represents the phase a runner is in - Phase RunnerNewResponseRunnerStatusPhase `json:"phase"` + Phase RunnerPhase `json:"phase"` // region is the region the runner is running in, if applicable. Region string `json:"region"` SystemDetails string `json:"systemDetails"` @@ -663,14 +631,13 @@ type RunnerNewResponseRunnerStatus 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"` - Version string `json:"version"` - JSON runnerNewResponseRunnerStatusJSON `json:"-"` + UpdatedAt time.Time `json:"updatedAt" format:"date-time"` + Version string `json:"version"` + JSON runnerStatusJSON `json:"-"` } -// runnerNewResponseRunnerStatusJSON contains the JSON metadata for the struct -// [RunnerNewResponseRunnerStatus] -type runnerNewResponseRunnerStatusJSON struct { +// runnerStatusJSON contains the JSON metadata for the struct [RunnerStatus] +type runnerStatusJSON struct { AdditionalInfo apijson.Field Capabilities apijson.Field LogURL apijson.Field @@ -684,1327 +651,119 @@ type runnerNewResponseRunnerStatusJSON struct { ExtraFields map[string]apijson.Field } -func (r *RunnerNewResponseRunnerStatus) UnmarshalJSON(data []byte) (err error) { +func (r *RunnerStatus) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r runnerStatusJSON) RawJSON() string { + return r.raw +} + +type RunnerNewResponse struct { + // deprecated, will be removed. Use exchange_token instead. + AccessToken string `json:"accessToken"` + // exchange_token is a one-time use token that should be exchanged by the runner + // for an access token, using the IdentityService.ExchangeToken rpc. The token + // expires after 24 hours. + ExchangeToken string `json:"exchangeToken"` + Runner Runner `json:"runner"` + JSON runnerNewResponseJSON `json:"-"` +} + +// runnerNewResponseJSON contains the JSON metadata for the struct +// [RunnerNewResponse] +type runnerNewResponseJSON struct { + AccessToken apijson.Field + ExchangeToken apijson.Field + Runner apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RunnerNewResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerNewResponseRunnerStatusJSON) RawJSON() string { +func (r runnerNewResponseJSON) RawJSON() string { return r.raw } -type RunnerNewResponseRunnerStatusAdditionalInfo struct { - Key string `json:"key"` - Value string `json:"value"` - JSON runnerNewResponseRunnerStatusAdditionalInfoJSON `json:"-"` +type RunnerGetResponse struct { + Runner Runner `json:"runner"` + JSON runnerGetResponseJSON `json:"-"` } -// runnerNewResponseRunnerStatusAdditionalInfoJSON contains the JSON metadata for -// the struct [RunnerNewResponseRunnerStatusAdditionalInfo] -type runnerNewResponseRunnerStatusAdditionalInfoJSON struct { - Key apijson.Field - Value apijson.Field +// runnerGetResponseJSON contains the JSON metadata for the struct +// [RunnerGetResponse] +type runnerGetResponseJSON struct { + Runner apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RunnerNewResponseRunnerStatusAdditionalInfo) UnmarshalJSON(data []byte) (err error) { +func (r *RunnerGetResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerNewResponseRunnerStatusAdditionalInfoJSON) RawJSON() string { +func (r runnerGetResponseJSON) RawJSON() string { return r.raw } -type RunnerNewResponseRunnerStatusCapability string +type RunnerUpdateResponse = interface{} -const ( - RunnerNewResponseRunnerStatusCapabilityRunnerCapabilityUnspecified RunnerNewResponseRunnerStatusCapability = "RUNNER_CAPABILITY_UNSPECIFIED" - RunnerNewResponseRunnerStatusCapabilityRunnerCapabilityFetchLocalScmIntegrations RunnerNewResponseRunnerStatusCapability = "RUNNER_CAPABILITY_FETCH_LOCAL_SCM_INTEGRATIONS" -) +type RunnerDeleteResponse = interface{} -func (r RunnerNewResponseRunnerStatusCapability) IsKnown() bool { - switch r { - case RunnerNewResponseRunnerStatusCapabilityRunnerCapabilityUnspecified, RunnerNewResponseRunnerStatusCapabilityRunnerCapabilityFetchLocalScmIntegrations: - return true - } - return false +type RunnerCheckAuthenticationForHostResponse struct { + Authenticated bool `json:"authenticated"` + AuthenticationURL string `json:"authenticationUrl"` + PatSupported bool `json:"patSupported"` + ScmID string `json:"scmId"` + JSON runnerCheckAuthenticationForHostResponseJSON `json:"-"` } -// RunnerPhase represents the phase a runner is in -type RunnerNewResponseRunnerStatusPhase string +// runnerCheckAuthenticationForHostResponseJSON contains the JSON metadata for the +// struct [RunnerCheckAuthenticationForHostResponse] +type runnerCheckAuthenticationForHostResponseJSON struct { + Authenticated apijson.Field + AuthenticationURL apijson.Field + PatSupported apijson.Field + ScmID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} -const ( - RunnerNewResponseRunnerStatusPhaseRunnerPhaseUnspecified RunnerNewResponseRunnerStatusPhase = "RUNNER_PHASE_UNSPECIFIED" - RunnerNewResponseRunnerStatusPhaseRunnerPhaseCreated RunnerNewResponseRunnerStatusPhase = "RUNNER_PHASE_CREATED" - RunnerNewResponseRunnerStatusPhaseRunnerPhaseInactive RunnerNewResponseRunnerStatusPhase = "RUNNER_PHASE_INACTIVE" - RunnerNewResponseRunnerStatusPhaseRunnerPhaseActive RunnerNewResponseRunnerStatusPhase = "RUNNER_PHASE_ACTIVE" - RunnerNewResponseRunnerStatusPhaseRunnerPhaseDeleting RunnerNewResponseRunnerStatusPhase = "RUNNER_PHASE_DELETING" - RunnerNewResponseRunnerStatusPhaseRunnerPhaseDeleted RunnerNewResponseRunnerStatusPhase = "RUNNER_PHASE_DELETED" - RunnerNewResponseRunnerStatusPhaseRunnerPhaseDegraded RunnerNewResponseRunnerStatusPhase = "RUNNER_PHASE_DEGRADED" -) +func (r *RunnerCheckAuthenticationForHostResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} -func (r RunnerNewResponseRunnerStatusPhase) IsKnown() bool { - switch r { - case RunnerNewResponseRunnerStatusPhaseRunnerPhaseUnspecified, RunnerNewResponseRunnerStatusPhaseRunnerPhaseCreated, RunnerNewResponseRunnerStatusPhaseRunnerPhaseInactive, RunnerNewResponseRunnerStatusPhaseRunnerPhaseActive, RunnerNewResponseRunnerStatusPhaseRunnerPhaseDeleting, RunnerNewResponseRunnerStatusPhaseRunnerPhaseDeleted, RunnerNewResponseRunnerStatusPhaseRunnerPhaseDegraded: - return true - } - return false +func (r runnerCheckAuthenticationForHostResponseJSON) RawJSON() string { + return r.raw } -type RunnerGetResponse struct { - Runner RunnerGetResponseRunner `json:"runner"` - JSON runnerGetResponseJSON `json:"-"` +type RunnerNewRunnerTokenResponse struct { + // deprecated, will be removed. Use exchange_token instead. + AccessToken string `json:"accessToken"` + // exchange_token is a one-time use token that should be exchanged by the runner + // for an access token, using the IdentityService.ExchangeToken rpc. The token + // expires after 24 hours. + ExchangeToken string `json:"exchangeToken"` + JSON runnerNewRunnerTokenResponseJSON `json:"-"` } -// runnerGetResponseJSON contains the JSON metadata for the struct -// [RunnerGetResponse] -type runnerGetResponseJSON struct { - Runner apijson.Field - raw string - ExtraFields map[string]apijson.Field +// runnerNewRunnerTokenResponseJSON contains the JSON metadata for the struct +// [RunnerNewRunnerTokenResponse] +type runnerNewRunnerTokenResponseJSON struct { + AccessToken apijson.Field + ExchangeToken apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *RunnerGetResponse) UnmarshalJSON(data []byte) (err error) { +func (r *RunnerNewRunnerTokenResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerGetResponseJSON) RawJSON() string { - return r.raw -} - -type RunnerGetResponseRunner struct { - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - CreatedAt time.Time `json:"createdAt" format:"date-time"` - // creator is the identity of the creator of the environment - Creator RunnerGetResponseRunnerCreator `json:"creator"` - // RunnerKind represents the kind of a runner - Kind RunnerGetResponseRunnerKind `json:"kind"` - // The runner's name which is shown to users - Name string `json:"name"` - // RunnerProvider identifies the specific implementation type of a runner. Each - // provider maps to a specific kind of runner (local or remote), as specified below - // for each provider. - Provider RunnerGetResponseRunnerProvider `json:"provider"` - RunnerID string `json:"runnerId"` - // The runner's specification - Spec RunnerGetResponseRunnerSpec `json:"spec"` - // RunnerStatus represents the status of a runner - Status RunnerGetResponseRunnerStatus `json:"status"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - UpdatedAt time.Time `json:"updatedAt" format:"date-time"` - JSON runnerGetResponseRunnerJSON `json:"-"` -} - -// runnerGetResponseRunnerJSON contains the JSON metadata for the struct -// [RunnerGetResponseRunner] -type runnerGetResponseRunnerJSON struct { - CreatedAt apijson.Field - Creator apijson.Field - Kind apijson.Field - Name apijson.Field - Provider apijson.Field - RunnerID apijson.Field - Spec apijson.Field - Status apijson.Field - UpdatedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerGetResponseRunner) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerGetResponseRunnerJSON) RawJSON() string { - return r.raw -} - -// creator is the identity of the creator of the environment -type RunnerGetResponseRunnerCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal RunnerGetResponseRunnerCreatorPrincipal `json:"principal"` - JSON runnerGetResponseRunnerCreatorJSON `json:"-"` -} - -// runnerGetResponseRunnerCreatorJSON contains the JSON metadata for the struct -// [RunnerGetResponseRunnerCreator] -type runnerGetResponseRunnerCreatorJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerGetResponseRunnerCreator) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerGetResponseRunnerCreatorJSON) RawJSON() string { - return r.raw -} - -// Principal is the principal of the subject -type RunnerGetResponseRunnerCreatorPrincipal string - -const ( - RunnerGetResponseRunnerCreatorPrincipalPrincipalUnspecified RunnerGetResponseRunnerCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - RunnerGetResponseRunnerCreatorPrincipalPrincipalAccount RunnerGetResponseRunnerCreatorPrincipal = "PRINCIPAL_ACCOUNT" - RunnerGetResponseRunnerCreatorPrincipalPrincipalUser RunnerGetResponseRunnerCreatorPrincipal = "PRINCIPAL_USER" - RunnerGetResponseRunnerCreatorPrincipalPrincipalRunner RunnerGetResponseRunnerCreatorPrincipal = "PRINCIPAL_RUNNER" - RunnerGetResponseRunnerCreatorPrincipalPrincipalEnvironment RunnerGetResponseRunnerCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - RunnerGetResponseRunnerCreatorPrincipalPrincipalServiceAccount RunnerGetResponseRunnerCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r RunnerGetResponseRunnerCreatorPrincipal) IsKnown() bool { - switch r { - case RunnerGetResponseRunnerCreatorPrincipalPrincipalUnspecified, RunnerGetResponseRunnerCreatorPrincipalPrincipalAccount, RunnerGetResponseRunnerCreatorPrincipalPrincipalUser, RunnerGetResponseRunnerCreatorPrincipalPrincipalRunner, RunnerGetResponseRunnerCreatorPrincipalPrincipalEnvironment, RunnerGetResponseRunnerCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - -// RunnerKind represents the kind of a runner -type RunnerGetResponseRunnerKind string - -const ( - RunnerGetResponseRunnerKindRunnerKindUnspecified RunnerGetResponseRunnerKind = "RUNNER_KIND_UNSPECIFIED" - RunnerGetResponseRunnerKindRunnerKindLocal RunnerGetResponseRunnerKind = "RUNNER_KIND_LOCAL" - RunnerGetResponseRunnerKindRunnerKindRemote RunnerGetResponseRunnerKind = "RUNNER_KIND_REMOTE" - RunnerGetResponseRunnerKindRunnerKindLocalConfiguration RunnerGetResponseRunnerKind = "RUNNER_KIND_LOCAL_CONFIGURATION" -) - -func (r RunnerGetResponseRunnerKind) IsKnown() bool { - switch r { - case RunnerGetResponseRunnerKindRunnerKindUnspecified, RunnerGetResponseRunnerKindRunnerKindLocal, RunnerGetResponseRunnerKindRunnerKindRemote, RunnerGetResponseRunnerKindRunnerKindLocalConfiguration: - return true - } - return false -} - -// RunnerProvider identifies the specific implementation type of a runner. Each -// provider maps to a specific kind of runner (local or remote), as specified below -// for each provider. -type RunnerGetResponseRunnerProvider string - -const ( - RunnerGetResponseRunnerProviderRunnerProviderUnspecified RunnerGetResponseRunnerProvider = "RUNNER_PROVIDER_UNSPECIFIED" - RunnerGetResponseRunnerProviderRunnerProviderAwsEc2 RunnerGetResponseRunnerProvider = "RUNNER_PROVIDER_AWS_EC2" - RunnerGetResponseRunnerProviderRunnerProviderLinuxHost RunnerGetResponseRunnerProvider = "RUNNER_PROVIDER_LINUX_HOST" - RunnerGetResponseRunnerProviderRunnerProviderDesktopMac RunnerGetResponseRunnerProvider = "RUNNER_PROVIDER_DESKTOP_MAC" -) - -func (r RunnerGetResponseRunnerProvider) IsKnown() bool { - switch r { - case RunnerGetResponseRunnerProviderRunnerProviderUnspecified, RunnerGetResponseRunnerProviderRunnerProviderAwsEc2, RunnerGetResponseRunnerProviderRunnerProviderLinuxHost, RunnerGetResponseRunnerProviderRunnerProviderDesktopMac: - return true - } - return false -} - -// The runner's specification -type RunnerGetResponseRunnerSpec struct { - // The runner's configuration - Configuration RunnerGetResponseRunnerSpecConfiguration `json:"configuration"` - // RunnerPhase represents the phase a runner is in - DesiredPhase RunnerGetResponseRunnerSpecDesiredPhase `json:"desiredPhase"` - JSON runnerGetResponseRunnerSpecJSON `json:"-"` -} - -// runnerGetResponseRunnerSpecJSON contains the JSON metadata for the struct -// [RunnerGetResponseRunnerSpec] -type runnerGetResponseRunnerSpecJSON struct { - Configuration apijson.Field - DesiredPhase apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerGetResponseRunnerSpec) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerGetResponseRunnerSpecJSON) RawJSON() string { - return r.raw -} - -// The runner's configuration -type RunnerGetResponseRunnerSpecConfiguration struct { - // auto_update indicates whether the runner should automatically update itself. - AutoUpdate bool `json:"autoUpdate"` - // Region to deploy the runner in, if applicable. This is mainly used for remote - // runners, and is only a hint. The runner may be deployed in a different region. - // See the runner's status for the actual region. - Region string `json:"region"` - // The release channel the runner is on - ReleaseChannel RunnerGetResponseRunnerSpecConfigurationReleaseChannel `json:"releaseChannel"` - JSON runnerGetResponseRunnerSpecConfigurationJSON `json:"-"` -} - -// runnerGetResponseRunnerSpecConfigurationJSON contains the JSON metadata for the -// struct [RunnerGetResponseRunnerSpecConfiguration] -type runnerGetResponseRunnerSpecConfigurationJSON struct { - AutoUpdate apijson.Field - Region apijson.Field - ReleaseChannel apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerGetResponseRunnerSpecConfiguration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerGetResponseRunnerSpecConfigurationJSON) RawJSON() string { - return r.raw -} - -// The release channel the runner is on -type RunnerGetResponseRunnerSpecConfigurationReleaseChannel string - -const ( - RunnerGetResponseRunnerSpecConfigurationReleaseChannelRunnerReleaseChannelUnspecified RunnerGetResponseRunnerSpecConfigurationReleaseChannel = "RUNNER_RELEASE_CHANNEL_UNSPECIFIED" - RunnerGetResponseRunnerSpecConfigurationReleaseChannelRunnerReleaseChannelStable RunnerGetResponseRunnerSpecConfigurationReleaseChannel = "RUNNER_RELEASE_CHANNEL_STABLE" - RunnerGetResponseRunnerSpecConfigurationReleaseChannelRunnerReleaseChannelLatest RunnerGetResponseRunnerSpecConfigurationReleaseChannel = "RUNNER_RELEASE_CHANNEL_LATEST" -) - -func (r RunnerGetResponseRunnerSpecConfigurationReleaseChannel) IsKnown() bool { - switch r { - case RunnerGetResponseRunnerSpecConfigurationReleaseChannelRunnerReleaseChannelUnspecified, RunnerGetResponseRunnerSpecConfigurationReleaseChannelRunnerReleaseChannelStable, RunnerGetResponseRunnerSpecConfigurationReleaseChannelRunnerReleaseChannelLatest: - return true - } - return false -} - -// RunnerPhase represents the phase a runner is in -type RunnerGetResponseRunnerSpecDesiredPhase string - -const ( - RunnerGetResponseRunnerSpecDesiredPhaseRunnerPhaseUnspecified RunnerGetResponseRunnerSpecDesiredPhase = "RUNNER_PHASE_UNSPECIFIED" - RunnerGetResponseRunnerSpecDesiredPhaseRunnerPhaseCreated RunnerGetResponseRunnerSpecDesiredPhase = "RUNNER_PHASE_CREATED" - RunnerGetResponseRunnerSpecDesiredPhaseRunnerPhaseInactive RunnerGetResponseRunnerSpecDesiredPhase = "RUNNER_PHASE_INACTIVE" - RunnerGetResponseRunnerSpecDesiredPhaseRunnerPhaseActive RunnerGetResponseRunnerSpecDesiredPhase = "RUNNER_PHASE_ACTIVE" - RunnerGetResponseRunnerSpecDesiredPhaseRunnerPhaseDeleting RunnerGetResponseRunnerSpecDesiredPhase = "RUNNER_PHASE_DELETING" - RunnerGetResponseRunnerSpecDesiredPhaseRunnerPhaseDeleted RunnerGetResponseRunnerSpecDesiredPhase = "RUNNER_PHASE_DELETED" - RunnerGetResponseRunnerSpecDesiredPhaseRunnerPhaseDegraded RunnerGetResponseRunnerSpecDesiredPhase = "RUNNER_PHASE_DEGRADED" -) - -func (r RunnerGetResponseRunnerSpecDesiredPhase) IsKnown() bool { - switch r { - case RunnerGetResponseRunnerSpecDesiredPhaseRunnerPhaseUnspecified, RunnerGetResponseRunnerSpecDesiredPhaseRunnerPhaseCreated, RunnerGetResponseRunnerSpecDesiredPhaseRunnerPhaseInactive, RunnerGetResponseRunnerSpecDesiredPhaseRunnerPhaseActive, RunnerGetResponseRunnerSpecDesiredPhaseRunnerPhaseDeleting, RunnerGetResponseRunnerSpecDesiredPhaseRunnerPhaseDeleted, RunnerGetResponseRunnerSpecDesiredPhaseRunnerPhaseDegraded: - return true - } - return false -} - -// RunnerStatus represents the status of a runner -type RunnerGetResponseRunnerStatus struct { - // additional_info contains additional information about the runner, e.g. a - // CloudFormation stack URL. - AdditionalInfo []RunnerGetResponseRunnerStatusAdditionalInfo `json:"additionalInfo"` - // capabilities is a list of capabilities the runner supports. - Capabilities []RunnerGetResponseRunnerStatusCapability `json:"capabilities"` - LogURL string `json:"logUrl"` - // The runner's reported message which is shown to users. This message adds more - // context to the runner's phase. - Message string `json:"message"` - // RunnerPhase represents the phase a runner is in - Phase RunnerGetResponseRunnerStatusPhase `json:"phase"` - // region is the region the runner is running in, if applicable. - Region string `json:"region"` - SystemDetails string `json:"systemDetails"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - UpdatedAt time.Time `json:"updatedAt" format:"date-time"` - Version string `json:"version"` - JSON runnerGetResponseRunnerStatusJSON `json:"-"` -} - -// runnerGetResponseRunnerStatusJSON contains the JSON metadata for the struct -// [RunnerGetResponseRunnerStatus] -type runnerGetResponseRunnerStatusJSON struct { - AdditionalInfo apijson.Field - Capabilities apijson.Field - LogURL apijson.Field - Message apijson.Field - Phase apijson.Field - Region apijson.Field - SystemDetails apijson.Field - UpdatedAt apijson.Field - Version apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerGetResponseRunnerStatus) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerGetResponseRunnerStatusJSON) RawJSON() string { - return r.raw -} - -type RunnerGetResponseRunnerStatusAdditionalInfo struct { - Key string `json:"key"` - Value string `json:"value"` - JSON runnerGetResponseRunnerStatusAdditionalInfoJSON `json:"-"` -} - -// runnerGetResponseRunnerStatusAdditionalInfoJSON contains the JSON metadata for -// the struct [RunnerGetResponseRunnerStatusAdditionalInfo] -type runnerGetResponseRunnerStatusAdditionalInfoJSON struct { - Key apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerGetResponseRunnerStatusAdditionalInfo) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerGetResponseRunnerStatusAdditionalInfoJSON) RawJSON() string { - return r.raw -} - -type RunnerGetResponseRunnerStatusCapability string - -const ( - RunnerGetResponseRunnerStatusCapabilityRunnerCapabilityUnspecified RunnerGetResponseRunnerStatusCapability = "RUNNER_CAPABILITY_UNSPECIFIED" - RunnerGetResponseRunnerStatusCapabilityRunnerCapabilityFetchLocalScmIntegrations RunnerGetResponseRunnerStatusCapability = "RUNNER_CAPABILITY_FETCH_LOCAL_SCM_INTEGRATIONS" -) - -func (r RunnerGetResponseRunnerStatusCapability) IsKnown() bool { - switch r { - case RunnerGetResponseRunnerStatusCapabilityRunnerCapabilityUnspecified, RunnerGetResponseRunnerStatusCapabilityRunnerCapabilityFetchLocalScmIntegrations: - return true - } - return false -} - -// RunnerPhase represents the phase a runner is in -type RunnerGetResponseRunnerStatusPhase string - -const ( - RunnerGetResponseRunnerStatusPhaseRunnerPhaseUnspecified RunnerGetResponseRunnerStatusPhase = "RUNNER_PHASE_UNSPECIFIED" - RunnerGetResponseRunnerStatusPhaseRunnerPhaseCreated RunnerGetResponseRunnerStatusPhase = "RUNNER_PHASE_CREATED" - RunnerGetResponseRunnerStatusPhaseRunnerPhaseInactive RunnerGetResponseRunnerStatusPhase = "RUNNER_PHASE_INACTIVE" - RunnerGetResponseRunnerStatusPhaseRunnerPhaseActive RunnerGetResponseRunnerStatusPhase = "RUNNER_PHASE_ACTIVE" - RunnerGetResponseRunnerStatusPhaseRunnerPhaseDeleting RunnerGetResponseRunnerStatusPhase = "RUNNER_PHASE_DELETING" - RunnerGetResponseRunnerStatusPhaseRunnerPhaseDeleted RunnerGetResponseRunnerStatusPhase = "RUNNER_PHASE_DELETED" - RunnerGetResponseRunnerStatusPhaseRunnerPhaseDegraded RunnerGetResponseRunnerStatusPhase = "RUNNER_PHASE_DEGRADED" -) - -func (r RunnerGetResponseRunnerStatusPhase) IsKnown() bool { - switch r { - case RunnerGetResponseRunnerStatusPhaseRunnerPhaseUnspecified, RunnerGetResponseRunnerStatusPhaseRunnerPhaseCreated, RunnerGetResponseRunnerStatusPhaseRunnerPhaseInactive, RunnerGetResponseRunnerStatusPhaseRunnerPhaseActive, RunnerGetResponseRunnerStatusPhaseRunnerPhaseDeleting, RunnerGetResponseRunnerStatusPhaseRunnerPhaseDeleted, RunnerGetResponseRunnerStatusPhaseRunnerPhaseDegraded: - return true - } - return false -} - -type RunnerUpdateResponse = interface{} - -type RunnerListResponse struct { - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - CreatedAt time.Time `json:"createdAt" format:"date-time"` - // creator is the identity of the creator of the environment - Creator RunnerListResponseCreator `json:"creator"` - // RunnerKind represents the kind of a runner - Kind RunnerListResponseKind `json:"kind"` - // The runner's name which is shown to users - Name string `json:"name"` - // RunnerProvider identifies the specific implementation type of a runner. Each - // provider maps to a specific kind of runner (local or remote), as specified below - // for each provider. - Provider RunnerListResponseProvider `json:"provider"` - RunnerID string `json:"runnerId"` - // The runner's specification - Spec RunnerListResponseSpec `json:"spec"` - // RunnerStatus represents the status of a runner - Status RunnerListResponseStatus `json:"status"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - UpdatedAt time.Time `json:"updatedAt" format:"date-time"` - JSON runnerListResponseJSON `json:"-"` -} - -// runnerListResponseJSON contains the JSON metadata for the struct -// [RunnerListResponse] -type runnerListResponseJSON struct { - CreatedAt apijson.Field - Creator apijson.Field - Kind apijson.Field - Name apijson.Field - Provider apijson.Field - RunnerID apijson.Field - Spec apijson.Field - Status apijson.Field - UpdatedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerListResponseJSON) RawJSON() string { - return r.raw -} - -// creator is the identity of the creator of the environment -type RunnerListResponseCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal RunnerListResponseCreatorPrincipal `json:"principal"` - JSON runnerListResponseCreatorJSON `json:"-"` -} - -// runnerListResponseCreatorJSON contains the JSON metadata for the struct -// [RunnerListResponseCreator] -type runnerListResponseCreatorJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerListResponseCreator) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerListResponseCreatorJSON) RawJSON() string { - return r.raw -} - -// Principal is the principal of the subject -type RunnerListResponseCreatorPrincipal string - -const ( - RunnerListResponseCreatorPrincipalPrincipalUnspecified RunnerListResponseCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - RunnerListResponseCreatorPrincipalPrincipalAccount RunnerListResponseCreatorPrincipal = "PRINCIPAL_ACCOUNT" - RunnerListResponseCreatorPrincipalPrincipalUser RunnerListResponseCreatorPrincipal = "PRINCIPAL_USER" - RunnerListResponseCreatorPrincipalPrincipalRunner RunnerListResponseCreatorPrincipal = "PRINCIPAL_RUNNER" - RunnerListResponseCreatorPrincipalPrincipalEnvironment RunnerListResponseCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - RunnerListResponseCreatorPrincipalPrincipalServiceAccount RunnerListResponseCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r RunnerListResponseCreatorPrincipal) IsKnown() bool { - switch r { - case RunnerListResponseCreatorPrincipalPrincipalUnspecified, RunnerListResponseCreatorPrincipalPrincipalAccount, RunnerListResponseCreatorPrincipalPrincipalUser, RunnerListResponseCreatorPrincipalPrincipalRunner, RunnerListResponseCreatorPrincipalPrincipalEnvironment, RunnerListResponseCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - -// RunnerKind represents the kind of a runner -type RunnerListResponseKind string - -const ( - RunnerListResponseKindRunnerKindUnspecified RunnerListResponseKind = "RUNNER_KIND_UNSPECIFIED" - RunnerListResponseKindRunnerKindLocal RunnerListResponseKind = "RUNNER_KIND_LOCAL" - RunnerListResponseKindRunnerKindRemote RunnerListResponseKind = "RUNNER_KIND_REMOTE" - RunnerListResponseKindRunnerKindLocalConfiguration RunnerListResponseKind = "RUNNER_KIND_LOCAL_CONFIGURATION" -) - -func (r RunnerListResponseKind) IsKnown() bool { - switch r { - case RunnerListResponseKindRunnerKindUnspecified, RunnerListResponseKindRunnerKindLocal, RunnerListResponseKindRunnerKindRemote, RunnerListResponseKindRunnerKindLocalConfiguration: - return true - } - return false -} - -// RunnerProvider identifies the specific implementation type of a runner. Each -// provider maps to a specific kind of runner (local or remote), as specified below -// for each provider. -type RunnerListResponseProvider string - -const ( - RunnerListResponseProviderRunnerProviderUnspecified RunnerListResponseProvider = "RUNNER_PROVIDER_UNSPECIFIED" - RunnerListResponseProviderRunnerProviderAwsEc2 RunnerListResponseProvider = "RUNNER_PROVIDER_AWS_EC2" - RunnerListResponseProviderRunnerProviderLinuxHost RunnerListResponseProvider = "RUNNER_PROVIDER_LINUX_HOST" - RunnerListResponseProviderRunnerProviderDesktopMac RunnerListResponseProvider = "RUNNER_PROVIDER_DESKTOP_MAC" -) - -func (r RunnerListResponseProvider) IsKnown() bool { - switch r { - case RunnerListResponseProviderRunnerProviderUnspecified, RunnerListResponseProviderRunnerProviderAwsEc2, RunnerListResponseProviderRunnerProviderLinuxHost, RunnerListResponseProviderRunnerProviderDesktopMac: - return true - } - return false -} - -// The runner's specification -type RunnerListResponseSpec struct { - // The runner's configuration - Configuration RunnerListResponseSpecConfiguration `json:"configuration"` - // RunnerPhase represents the phase a runner is in - DesiredPhase RunnerListResponseSpecDesiredPhase `json:"desiredPhase"` - JSON runnerListResponseSpecJSON `json:"-"` -} - -// runnerListResponseSpecJSON contains the JSON metadata for the struct -// [RunnerListResponseSpec] -type runnerListResponseSpecJSON struct { - Configuration apijson.Field - DesiredPhase apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerListResponseSpec) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerListResponseSpecJSON) RawJSON() string { - return r.raw -} - -// The runner's configuration -type RunnerListResponseSpecConfiguration struct { - // auto_update indicates whether the runner should automatically update itself. - AutoUpdate bool `json:"autoUpdate"` - // Region to deploy the runner in, if applicable. This is mainly used for remote - // runners, and is only a hint. The runner may be deployed in a different region. - // See the runner's status for the actual region. - Region string `json:"region"` - // The release channel the runner is on - ReleaseChannel RunnerListResponseSpecConfigurationReleaseChannel `json:"releaseChannel"` - JSON runnerListResponseSpecConfigurationJSON `json:"-"` -} - -// runnerListResponseSpecConfigurationJSON contains the JSON metadata for the -// struct [RunnerListResponseSpecConfiguration] -type runnerListResponseSpecConfigurationJSON struct { - AutoUpdate apijson.Field - Region apijson.Field - ReleaseChannel apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerListResponseSpecConfiguration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerListResponseSpecConfigurationJSON) RawJSON() string { - return r.raw -} - -// The release channel the runner is on -type RunnerListResponseSpecConfigurationReleaseChannel string - -const ( - RunnerListResponseSpecConfigurationReleaseChannelRunnerReleaseChannelUnspecified RunnerListResponseSpecConfigurationReleaseChannel = "RUNNER_RELEASE_CHANNEL_UNSPECIFIED" - RunnerListResponseSpecConfigurationReleaseChannelRunnerReleaseChannelStable RunnerListResponseSpecConfigurationReleaseChannel = "RUNNER_RELEASE_CHANNEL_STABLE" - RunnerListResponseSpecConfigurationReleaseChannelRunnerReleaseChannelLatest RunnerListResponseSpecConfigurationReleaseChannel = "RUNNER_RELEASE_CHANNEL_LATEST" -) - -func (r RunnerListResponseSpecConfigurationReleaseChannel) IsKnown() bool { - switch r { - case RunnerListResponseSpecConfigurationReleaseChannelRunnerReleaseChannelUnspecified, RunnerListResponseSpecConfigurationReleaseChannelRunnerReleaseChannelStable, RunnerListResponseSpecConfigurationReleaseChannelRunnerReleaseChannelLatest: - return true - } - return false -} - -// RunnerPhase represents the phase a runner is in -type RunnerListResponseSpecDesiredPhase string - -const ( - RunnerListResponseSpecDesiredPhaseRunnerPhaseUnspecified RunnerListResponseSpecDesiredPhase = "RUNNER_PHASE_UNSPECIFIED" - RunnerListResponseSpecDesiredPhaseRunnerPhaseCreated RunnerListResponseSpecDesiredPhase = "RUNNER_PHASE_CREATED" - RunnerListResponseSpecDesiredPhaseRunnerPhaseInactive RunnerListResponseSpecDesiredPhase = "RUNNER_PHASE_INACTIVE" - RunnerListResponseSpecDesiredPhaseRunnerPhaseActive RunnerListResponseSpecDesiredPhase = "RUNNER_PHASE_ACTIVE" - RunnerListResponseSpecDesiredPhaseRunnerPhaseDeleting RunnerListResponseSpecDesiredPhase = "RUNNER_PHASE_DELETING" - RunnerListResponseSpecDesiredPhaseRunnerPhaseDeleted RunnerListResponseSpecDesiredPhase = "RUNNER_PHASE_DELETED" - RunnerListResponseSpecDesiredPhaseRunnerPhaseDegraded RunnerListResponseSpecDesiredPhase = "RUNNER_PHASE_DEGRADED" -) - -func (r RunnerListResponseSpecDesiredPhase) IsKnown() bool { - switch r { - case RunnerListResponseSpecDesiredPhaseRunnerPhaseUnspecified, RunnerListResponseSpecDesiredPhaseRunnerPhaseCreated, RunnerListResponseSpecDesiredPhaseRunnerPhaseInactive, RunnerListResponseSpecDesiredPhaseRunnerPhaseActive, RunnerListResponseSpecDesiredPhaseRunnerPhaseDeleting, RunnerListResponseSpecDesiredPhaseRunnerPhaseDeleted, RunnerListResponseSpecDesiredPhaseRunnerPhaseDegraded: - return true - } - return false -} - -// RunnerStatus represents the status of a runner -type RunnerListResponseStatus struct { - // additional_info contains additional information about the runner, e.g. a - // CloudFormation stack URL. - AdditionalInfo []RunnerListResponseStatusAdditionalInfo `json:"additionalInfo"` - // capabilities is a list of capabilities the runner supports. - Capabilities []RunnerListResponseStatusCapability `json:"capabilities"` - LogURL string `json:"logUrl"` - // The runner's reported message which is shown to users. This message adds more - // context to the runner's phase. - Message string `json:"message"` - // RunnerPhase represents the phase a runner is in - Phase RunnerListResponseStatusPhase `json:"phase"` - // region is the region the runner is running in, if applicable. - Region string `json:"region"` - SystemDetails string `json:"systemDetails"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - UpdatedAt time.Time `json:"updatedAt" format:"date-time"` - Version string `json:"version"` - JSON runnerListResponseStatusJSON `json:"-"` -} - -// runnerListResponseStatusJSON contains the JSON metadata for the struct -// [RunnerListResponseStatus] -type runnerListResponseStatusJSON struct { - AdditionalInfo apijson.Field - Capabilities apijson.Field - LogURL apijson.Field - Message apijson.Field - Phase apijson.Field - Region apijson.Field - SystemDetails apijson.Field - UpdatedAt apijson.Field - Version apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerListResponseStatus) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerListResponseStatusJSON) RawJSON() string { - return r.raw -} - -type RunnerListResponseStatusAdditionalInfo struct { - Key string `json:"key"` - Value string `json:"value"` - JSON runnerListResponseStatusAdditionalInfoJSON `json:"-"` -} - -// runnerListResponseStatusAdditionalInfoJSON contains the JSON metadata for the -// struct [RunnerListResponseStatusAdditionalInfo] -type runnerListResponseStatusAdditionalInfoJSON struct { - Key apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerListResponseStatusAdditionalInfo) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerListResponseStatusAdditionalInfoJSON) RawJSON() string { - return r.raw -} - -type RunnerListResponseStatusCapability string - -const ( - RunnerListResponseStatusCapabilityRunnerCapabilityUnspecified RunnerListResponseStatusCapability = "RUNNER_CAPABILITY_UNSPECIFIED" - RunnerListResponseStatusCapabilityRunnerCapabilityFetchLocalScmIntegrations RunnerListResponseStatusCapability = "RUNNER_CAPABILITY_FETCH_LOCAL_SCM_INTEGRATIONS" -) - -func (r RunnerListResponseStatusCapability) IsKnown() bool { - switch r { - case RunnerListResponseStatusCapabilityRunnerCapabilityUnspecified, RunnerListResponseStatusCapabilityRunnerCapabilityFetchLocalScmIntegrations: - return true - } - return false -} - -// RunnerPhase represents the phase a runner is in -type RunnerListResponseStatusPhase string - -const ( - RunnerListResponseStatusPhaseRunnerPhaseUnspecified RunnerListResponseStatusPhase = "RUNNER_PHASE_UNSPECIFIED" - RunnerListResponseStatusPhaseRunnerPhaseCreated RunnerListResponseStatusPhase = "RUNNER_PHASE_CREATED" - RunnerListResponseStatusPhaseRunnerPhaseInactive RunnerListResponseStatusPhase = "RUNNER_PHASE_INACTIVE" - RunnerListResponseStatusPhaseRunnerPhaseActive RunnerListResponseStatusPhase = "RUNNER_PHASE_ACTIVE" - RunnerListResponseStatusPhaseRunnerPhaseDeleting RunnerListResponseStatusPhase = "RUNNER_PHASE_DELETING" - RunnerListResponseStatusPhaseRunnerPhaseDeleted RunnerListResponseStatusPhase = "RUNNER_PHASE_DELETED" - RunnerListResponseStatusPhaseRunnerPhaseDegraded RunnerListResponseStatusPhase = "RUNNER_PHASE_DEGRADED" -) - -func (r RunnerListResponseStatusPhase) IsKnown() bool { - switch r { - case RunnerListResponseStatusPhaseRunnerPhaseUnspecified, RunnerListResponseStatusPhaseRunnerPhaseCreated, RunnerListResponseStatusPhaseRunnerPhaseInactive, RunnerListResponseStatusPhaseRunnerPhaseActive, RunnerListResponseStatusPhaseRunnerPhaseDeleting, RunnerListResponseStatusPhaseRunnerPhaseDeleted, RunnerListResponseStatusPhaseRunnerPhaseDegraded: - return true - } - return false -} - -type RunnerDeleteResponse = interface{} - -type RunnerCheckAuthenticationForHostResponse struct { - Authenticated bool `json:"authenticated"` - AuthenticationURL string `json:"authenticationUrl"` - PatSupported bool `json:"patSupported"` - ScmID string `json:"scmId"` - JSON runnerCheckAuthenticationForHostResponseJSON `json:"-"` -} - -// runnerCheckAuthenticationForHostResponseJSON contains the JSON metadata for the -// struct [RunnerCheckAuthenticationForHostResponse] -type runnerCheckAuthenticationForHostResponseJSON struct { - Authenticated apijson.Field - AuthenticationURL apijson.Field - PatSupported apijson.Field - ScmID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerCheckAuthenticationForHostResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerCheckAuthenticationForHostResponseJSON) RawJSON() string { - return r.raw -} - -type RunnerNewRunnerTokenResponse struct { - AccessToken string `json:"accessToken"` - JSON runnerNewRunnerTokenResponseJSON `json:"-"` -} - -// runnerNewRunnerTokenResponseJSON contains the JSON metadata for the struct -// [RunnerNewRunnerTokenResponse] -type runnerNewRunnerTokenResponseJSON struct { - AccessToken apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerNewRunnerTokenResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerNewRunnerTokenResponseJSON) RawJSON() string { +func (r runnerNewRunnerTokenResponseJSON) RawJSON() string { return r.raw } @@ -2066,123 +825,20 @@ func (r runnerParseContextURLResponseGitJSON) RawJSON() string { type RunnerNewParams struct { // RunnerKind represents the kind of a runner - Kind param.Field[RunnerNewParamsKind] `json:"kind"` + Kind param.Field[RunnerKind] `json:"kind"` // The runner name for humans Name param.Field[string] `json:"name"` // RunnerProvider identifies the specific implementation type of a runner. Each // provider maps to a specific kind of runner (local or remote), as specified below // for each provider. - Provider param.Field[RunnerNewParamsProvider] `json:"provider"` - Spec param.Field[RunnerNewParamsSpec] `json:"spec"` + Provider param.Field[RunnerProvider] `json:"provider"` + Spec param.Field[RunnerSpecParam] `json:"spec"` } func (r RunnerNewParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// RunnerKind represents the kind of a runner -type RunnerNewParamsKind string - -const ( - RunnerNewParamsKindRunnerKindUnspecified RunnerNewParamsKind = "RUNNER_KIND_UNSPECIFIED" - RunnerNewParamsKindRunnerKindLocal RunnerNewParamsKind = "RUNNER_KIND_LOCAL" - RunnerNewParamsKindRunnerKindRemote RunnerNewParamsKind = "RUNNER_KIND_REMOTE" - RunnerNewParamsKindRunnerKindLocalConfiguration RunnerNewParamsKind = "RUNNER_KIND_LOCAL_CONFIGURATION" -) - -func (r RunnerNewParamsKind) IsKnown() bool { - switch r { - case RunnerNewParamsKindRunnerKindUnspecified, RunnerNewParamsKindRunnerKindLocal, RunnerNewParamsKindRunnerKindRemote, RunnerNewParamsKindRunnerKindLocalConfiguration: - return true - } - return false -} - -// RunnerProvider identifies the specific implementation type of a runner. Each -// provider maps to a specific kind of runner (local or remote), as specified below -// for each provider. -type RunnerNewParamsProvider string - -const ( - RunnerNewParamsProviderRunnerProviderUnspecified RunnerNewParamsProvider = "RUNNER_PROVIDER_UNSPECIFIED" - RunnerNewParamsProviderRunnerProviderAwsEc2 RunnerNewParamsProvider = "RUNNER_PROVIDER_AWS_EC2" - RunnerNewParamsProviderRunnerProviderLinuxHost RunnerNewParamsProvider = "RUNNER_PROVIDER_LINUX_HOST" - RunnerNewParamsProviderRunnerProviderDesktopMac RunnerNewParamsProvider = "RUNNER_PROVIDER_DESKTOP_MAC" -) - -func (r RunnerNewParamsProvider) IsKnown() bool { - switch r { - case RunnerNewParamsProviderRunnerProviderUnspecified, RunnerNewParamsProviderRunnerProviderAwsEc2, RunnerNewParamsProviderRunnerProviderLinuxHost, RunnerNewParamsProviderRunnerProviderDesktopMac: - return true - } - return false -} - -type RunnerNewParamsSpec struct { - // The runner's configuration - Configuration param.Field[RunnerNewParamsSpecConfiguration] `json:"configuration"` - // RunnerPhase represents the phase a runner is in - DesiredPhase param.Field[RunnerNewParamsSpecDesiredPhase] `json:"desiredPhase"` -} - -func (r RunnerNewParamsSpec) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The runner's configuration -type RunnerNewParamsSpecConfiguration struct { - // auto_update indicates whether the runner should automatically update itself. - AutoUpdate param.Field[bool] `json:"autoUpdate"` - // Region to deploy the runner in, if applicable. This is mainly used for remote - // runners, and is only a hint. The runner may be deployed in a different region. - // See the runner's status for the actual region. - Region param.Field[string] `json:"region"` - // The release channel the runner is on - ReleaseChannel param.Field[RunnerNewParamsSpecConfigurationReleaseChannel] `json:"releaseChannel"` -} - -func (r RunnerNewParamsSpecConfiguration) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The release channel the runner is on -type RunnerNewParamsSpecConfigurationReleaseChannel string - -const ( - RunnerNewParamsSpecConfigurationReleaseChannelRunnerReleaseChannelUnspecified RunnerNewParamsSpecConfigurationReleaseChannel = "RUNNER_RELEASE_CHANNEL_UNSPECIFIED" - RunnerNewParamsSpecConfigurationReleaseChannelRunnerReleaseChannelStable RunnerNewParamsSpecConfigurationReleaseChannel = "RUNNER_RELEASE_CHANNEL_STABLE" - RunnerNewParamsSpecConfigurationReleaseChannelRunnerReleaseChannelLatest RunnerNewParamsSpecConfigurationReleaseChannel = "RUNNER_RELEASE_CHANNEL_LATEST" -) - -func (r RunnerNewParamsSpecConfigurationReleaseChannel) IsKnown() bool { - switch r { - case RunnerNewParamsSpecConfigurationReleaseChannelRunnerReleaseChannelUnspecified, RunnerNewParamsSpecConfigurationReleaseChannelRunnerReleaseChannelStable, RunnerNewParamsSpecConfigurationReleaseChannelRunnerReleaseChannelLatest: - return true - } - return false -} - -// RunnerPhase represents the phase a runner is in -type RunnerNewParamsSpecDesiredPhase string - -const ( - RunnerNewParamsSpecDesiredPhaseRunnerPhaseUnspecified RunnerNewParamsSpecDesiredPhase = "RUNNER_PHASE_UNSPECIFIED" - RunnerNewParamsSpecDesiredPhaseRunnerPhaseCreated RunnerNewParamsSpecDesiredPhase = "RUNNER_PHASE_CREATED" - RunnerNewParamsSpecDesiredPhaseRunnerPhaseInactive RunnerNewParamsSpecDesiredPhase = "RUNNER_PHASE_INACTIVE" - RunnerNewParamsSpecDesiredPhaseRunnerPhaseActive RunnerNewParamsSpecDesiredPhase = "RUNNER_PHASE_ACTIVE" - RunnerNewParamsSpecDesiredPhaseRunnerPhaseDeleting RunnerNewParamsSpecDesiredPhase = "RUNNER_PHASE_DELETING" - RunnerNewParamsSpecDesiredPhaseRunnerPhaseDeleted RunnerNewParamsSpecDesiredPhase = "RUNNER_PHASE_DELETED" - RunnerNewParamsSpecDesiredPhaseRunnerPhaseDegraded RunnerNewParamsSpecDesiredPhase = "RUNNER_PHASE_DEGRADED" -) - -func (r RunnerNewParamsSpecDesiredPhase) IsKnown() bool { - switch r { - case RunnerNewParamsSpecDesiredPhaseRunnerPhaseUnspecified, RunnerNewParamsSpecDesiredPhaseRunnerPhaseCreated, RunnerNewParamsSpecDesiredPhaseRunnerPhaseInactive, RunnerNewParamsSpecDesiredPhaseRunnerPhaseActive, RunnerNewParamsSpecDesiredPhaseRunnerPhaseDeleting, RunnerNewParamsSpecDesiredPhaseRunnerPhaseDeleted, RunnerNewParamsSpecDesiredPhaseRunnerPhaseDegraded: - return true - } - return false -} - type RunnerGetParams struct { RunnerID param.Field[string] `json:"runnerId" format:"uuid"` } @@ -2192,217 +848,40 @@ func (r RunnerGetParams) MarshalJSON() (data []byte, err error) { } type RunnerUpdateParams struct { - Body RunnerUpdateParamsBodyUnion `json:"body,required"` -} - -func (r RunnerUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - -type RunnerUpdateParamsBody struct { - // The runner's name which is shown to users - Name param.Field[string] `json:"name"` - Spec param.Field[interface{}] `json:"spec"` -} - -func (r RunnerUpdateParamsBody) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RunnerUpdateParamsBody) implementsRunnerUpdateParamsBodyUnion() {} - -// Satisfied by [RunnerUpdateParamsBodyTheRunnerSNameWhichIsShownToUsers], -// [RunnerUpdateParamsBodySpec], [RunnerUpdateParamsBody]. -type RunnerUpdateParamsBodyUnion interface { - implementsRunnerUpdateParamsBodyUnion() -} - -type RunnerUpdateParamsBodyTheRunnerSNameWhichIsShownToUsers struct { // The runner's name which is shown to users - Name param.Field[string] `json:"name,required"` -} - -func (r RunnerUpdateParamsBodyTheRunnerSNameWhichIsShownToUsers) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RunnerUpdateParamsBodyTheRunnerSNameWhichIsShownToUsers) implementsRunnerUpdateParamsBodyUnion() { -} - -type RunnerUpdateParamsBodySpec struct { - Spec param.Field[RunnerUpdateParamsBodySpecSpecUnion] `json:"spec,required"` + Name param.Field[string] `json:"name"` + // runner_id specifies which runner to be updated. + // + // +required + RunnerID param.Field[string] `json:"runnerId" format:"uuid"` + Spec param.Field[RunnerUpdateParamsSpec] `json:"spec"` } -func (r RunnerUpdateParamsBodySpec) MarshalJSON() (data []byte, err error) { +func (r RunnerUpdateParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r RunnerUpdateParamsBodySpec) implementsRunnerUpdateParamsBodyUnion() {} - -type RunnerUpdateParamsBodySpecSpec struct { - Configuration param.Field[interface{}] `json:"configuration"` +type RunnerUpdateParamsSpec struct { + Configuration param.Field[RunnerUpdateParamsSpecConfiguration] `json:"configuration"` // RunnerPhase represents the phase a runner is in - DesiredPhase param.Field[RunnerUpdateParamsBodySpecSpecDesiredPhase] `json:"desiredPhase"` -} - -func (r RunnerUpdateParamsBodySpecSpec) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RunnerUpdateParamsBodySpecSpec) implementsRunnerUpdateParamsBodySpecSpecUnion() {} - -// Satisfied by [RunnerUpdateParamsBodySpecSpecConfiguration], -// [RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunners], -// [RunnerUpdateParamsBodySpecSpec]. -type RunnerUpdateParamsBodySpecSpecUnion interface { - implementsRunnerUpdateParamsBodySpecSpecUnion() -} - -type RunnerUpdateParamsBodySpecSpecConfiguration struct { - Configuration param.Field[RunnerUpdateParamsBodySpecSpecConfigurationConfigurationUnion] `json:"configuration,required"` + DesiredPhase param.Field[RunnerPhase] `json:"desiredPhase"` } -func (r RunnerUpdateParamsBodySpecSpecConfiguration) MarshalJSON() (data []byte, err error) { +func (r RunnerUpdateParamsSpec) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r RunnerUpdateParamsBodySpecSpecConfiguration) implementsRunnerUpdateParamsBodySpecSpecUnion() { -} - -type RunnerUpdateParamsBodySpecSpecConfigurationConfiguration struct { +type RunnerUpdateParamsSpecConfiguration struct { // auto_update indicates whether the runner should automatically update itself. AutoUpdate param.Field[bool] `json:"autoUpdate"` // The release channel the runner is on - ReleaseChannel param.Field[RunnerUpdateParamsBodySpecSpecConfigurationConfigurationReleaseChannel] `json:"releaseChannel"` -} - -func (r RunnerUpdateParamsBodySpecSpecConfigurationConfiguration) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RunnerUpdateParamsBodySpecSpecConfigurationConfiguration) implementsRunnerUpdateParamsBodySpecSpecConfigurationConfigurationUnion() { -} - -// Satisfied by -// [RunnerUpdateParamsBodySpecSpecConfigurationConfigurationAutoUpdateIndicatesWhetherTheRunnerShouldAutomaticallyUpdateItself], -// [RunnerUpdateParamsBodySpecSpecConfigurationConfigurationTheReleaseChannelTheRunnerIsOn], -// [RunnerUpdateParamsBodySpecSpecConfigurationConfiguration]. -type RunnerUpdateParamsBodySpecSpecConfigurationConfigurationUnion interface { - implementsRunnerUpdateParamsBodySpecSpecConfigurationConfigurationUnion() -} - -type RunnerUpdateParamsBodySpecSpecConfigurationConfigurationAutoUpdateIndicatesWhetherTheRunnerShouldAutomaticallyUpdateItself struct { - // auto_update indicates whether the runner should automatically update itself. - AutoUpdate param.Field[bool] `json:"autoUpdate,required"` -} - -func (r RunnerUpdateParamsBodySpecSpecConfigurationConfigurationAutoUpdateIndicatesWhetherTheRunnerShouldAutomaticallyUpdateItself) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RunnerUpdateParamsBodySpecSpecConfigurationConfigurationAutoUpdateIndicatesWhetherTheRunnerShouldAutomaticallyUpdateItself) implementsRunnerUpdateParamsBodySpecSpecConfigurationConfigurationUnion() { -} - -type RunnerUpdateParamsBodySpecSpecConfigurationConfigurationTheReleaseChannelTheRunnerIsOn struct { - // The release channel the runner is on - ReleaseChannel param.Field[RunnerUpdateParamsBodySpecSpecConfigurationConfigurationTheReleaseChannelTheRunnerIsOnReleaseChannel] `json:"releaseChannel,required"` -} - -func (r RunnerUpdateParamsBodySpecSpecConfigurationConfigurationTheReleaseChannelTheRunnerIsOn) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RunnerUpdateParamsBodySpecSpecConfigurationConfigurationTheReleaseChannelTheRunnerIsOn) implementsRunnerUpdateParamsBodySpecSpecConfigurationConfigurationUnion() { -} - -// The release channel the runner is on -type RunnerUpdateParamsBodySpecSpecConfigurationConfigurationTheReleaseChannelTheRunnerIsOnReleaseChannel string - -const ( - RunnerUpdateParamsBodySpecSpecConfigurationConfigurationTheReleaseChannelTheRunnerIsOnReleaseChannelRunnerReleaseChannelUnspecified RunnerUpdateParamsBodySpecSpecConfigurationConfigurationTheReleaseChannelTheRunnerIsOnReleaseChannel = "RUNNER_RELEASE_CHANNEL_UNSPECIFIED" - RunnerUpdateParamsBodySpecSpecConfigurationConfigurationTheReleaseChannelTheRunnerIsOnReleaseChannelRunnerReleaseChannelStable RunnerUpdateParamsBodySpecSpecConfigurationConfigurationTheReleaseChannelTheRunnerIsOnReleaseChannel = "RUNNER_RELEASE_CHANNEL_STABLE" - RunnerUpdateParamsBodySpecSpecConfigurationConfigurationTheReleaseChannelTheRunnerIsOnReleaseChannelRunnerReleaseChannelLatest RunnerUpdateParamsBodySpecSpecConfigurationConfigurationTheReleaseChannelTheRunnerIsOnReleaseChannel = "RUNNER_RELEASE_CHANNEL_LATEST" -) - -func (r RunnerUpdateParamsBodySpecSpecConfigurationConfigurationTheReleaseChannelTheRunnerIsOnReleaseChannel) IsKnown() bool { - switch r { - case RunnerUpdateParamsBodySpecSpecConfigurationConfigurationTheReleaseChannelTheRunnerIsOnReleaseChannelRunnerReleaseChannelUnspecified, RunnerUpdateParamsBodySpecSpecConfigurationConfigurationTheReleaseChannelTheRunnerIsOnReleaseChannelRunnerReleaseChannelStable, RunnerUpdateParamsBodySpecSpecConfigurationConfigurationTheReleaseChannelTheRunnerIsOnReleaseChannelRunnerReleaseChannelLatest: - return true - } - return false -} - -// The release channel the runner is on -type RunnerUpdateParamsBodySpecSpecConfigurationConfigurationReleaseChannel string - -const ( - RunnerUpdateParamsBodySpecSpecConfigurationConfigurationReleaseChannelRunnerReleaseChannelUnspecified RunnerUpdateParamsBodySpecSpecConfigurationConfigurationReleaseChannel = "RUNNER_RELEASE_CHANNEL_UNSPECIFIED" - RunnerUpdateParamsBodySpecSpecConfigurationConfigurationReleaseChannelRunnerReleaseChannelStable RunnerUpdateParamsBodySpecSpecConfigurationConfigurationReleaseChannel = "RUNNER_RELEASE_CHANNEL_STABLE" - RunnerUpdateParamsBodySpecSpecConfigurationConfigurationReleaseChannelRunnerReleaseChannelLatest RunnerUpdateParamsBodySpecSpecConfigurationConfigurationReleaseChannel = "RUNNER_RELEASE_CHANNEL_LATEST" -) - -func (r RunnerUpdateParamsBodySpecSpecConfigurationConfigurationReleaseChannel) IsKnown() bool { - switch r { - case RunnerUpdateParamsBodySpecSpecConfigurationConfigurationReleaseChannelRunnerReleaseChannelUnspecified, RunnerUpdateParamsBodySpecSpecConfigurationConfigurationReleaseChannelRunnerReleaseChannelStable, RunnerUpdateParamsBodySpecSpecConfigurationConfigurationReleaseChannelRunnerReleaseChannelLatest: - return true - } - return false -} - -type RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunners struct { - // RunnerPhase represents the phase a runner is in - DesiredPhase param.Field[RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhase] `json:"desiredPhase,required"` + ReleaseChannel param.Field[RunnerReleaseChannel] `json:"releaseChannel"` } -func (r RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunners) MarshalJSON() (data []byte, err error) { +func (r RunnerUpdateParamsSpecConfiguration) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunners) implementsRunnerUpdateParamsBodySpecSpecUnion() { -} - -// RunnerPhase represents the phase a runner is in -type RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhase string - -const ( - RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhaseRunnerPhaseUnspecified RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhase = "RUNNER_PHASE_UNSPECIFIED" - RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhaseRunnerPhaseCreated RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhase = "RUNNER_PHASE_CREATED" - RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhaseRunnerPhaseInactive RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhase = "RUNNER_PHASE_INACTIVE" - RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhaseRunnerPhaseActive RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhase = "RUNNER_PHASE_ACTIVE" - RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhaseRunnerPhaseDeleting RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhase = "RUNNER_PHASE_DELETING" - RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhaseRunnerPhaseDeleted RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhase = "RUNNER_PHASE_DELETED" - RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhaseRunnerPhaseDegraded RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhase = "RUNNER_PHASE_DEGRADED" -) - -func (r RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhase) IsKnown() bool { - switch r { - case RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhaseRunnerPhaseUnspecified, RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhaseRunnerPhaseCreated, RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhaseRunnerPhaseInactive, RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhaseRunnerPhaseActive, RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhaseRunnerPhaseDeleting, RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhaseRunnerPhaseDeleted, RunnerUpdateParamsBodySpecSpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunnersDesiredPhaseRunnerPhaseDegraded: - return true - } - return false -} - -// RunnerPhase represents the phase a runner is in -type RunnerUpdateParamsBodySpecSpecDesiredPhase string - -const ( - RunnerUpdateParamsBodySpecSpecDesiredPhaseRunnerPhaseUnspecified RunnerUpdateParamsBodySpecSpecDesiredPhase = "RUNNER_PHASE_UNSPECIFIED" - RunnerUpdateParamsBodySpecSpecDesiredPhaseRunnerPhaseCreated RunnerUpdateParamsBodySpecSpecDesiredPhase = "RUNNER_PHASE_CREATED" - RunnerUpdateParamsBodySpecSpecDesiredPhaseRunnerPhaseInactive RunnerUpdateParamsBodySpecSpecDesiredPhase = "RUNNER_PHASE_INACTIVE" - RunnerUpdateParamsBodySpecSpecDesiredPhaseRunnerPhaseActive RunnerUpdateParamsBodySpecSpecDesiredPhase = "RUNNER_PHASE_ACTIVE" - RunnerUpdateParamsBodySpecSpecDesiredPhaseRunnerPhaseDeleting RunnerUpdateParamsBodySpecSpecDesiredPhase = "RUNNER_PHASE_DELETING" - RunnerUpdateParamsBodySpecSpecDesiredPhaseRunnerPhaseDeleted RunnerUpdateParamsBodySpecSpecDesiredPhase = "RUNNER_PHASE_DELETED" - RunnerUpdateParamsBodySpecSpecDesiredPhaseRunnerPhaseDegraded RunnerUpdateParamsBodySpecSpecDesiredPhase = "RUNNER_PHASE_DEGRADED" -) - -func (r RunnerUpdateParamsBodySpecSpecDesiredPhase) IsKnown() bool { - switch r { - case RunnerUpdateParamsBodySpecSpecDesiredPhaseRunnerPhaseUnspecified, RunnerUpdateParamsBodySpecSpecDesiredPhaseRunnerPhaseCreated, RunnerUpdateParamsBodySpecSpecDesiredPhaseRunnerPhaseInactive, RunnerUpdateParamsBodySpecSpecDesiredPhaseRunnerPhaseActive, RunnerUpdateParamsBodySpecSpecDesiredPhaseRunnerPhaseDeleting, RunnerUpdateParamsBodySpecSpecDesiredPhaseRunnerPhaseDeleted, RunnerUpdateParamsBodySpecSpecDesiredPhaseRunnerPhaseDegraded: - return true - } - return false -} - type RunnerListParams struct { Token param.Field[string] `query:"token"` PageSize param.Field[int64] `query:"pageSize"` @@ -2427,53 +906,15 @@ type RunnerListParamsFilter struct { // creator_ids filters the response to only runner created by specified users CreatorIDs param.Field[[]string] `json:"creatorIds" format:"uuid"` // kinds filters the response to only runners of the specified kinds - Kinds param.Field[[]RunnerListParamsFilterKind] `json:"kinds"` + Kinds param.Field[[]RunnerKind] `json:"kinds"` // providers filters the response to only runners of the specified providers - Providers param.Field[[]RunnerListParamsFilterProvider] `json:"providers"` + Providers param.Field[[]RunnerProvider] `json:"providers"` } func (r RunnerListParamsFilter) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// RunnerKind represents the kind of a runner -type RunnerListParamsFilterKind string - -const ( - RunnerListParamsFilterKindRunnerKindUnspecified RunnerListParamsFilterKind = "RUNNER_KIND_UNSPECIFIED" - RunnerListParamsFilterKindRunnerKindLocal RunnerListParamsFilterKind = "RUNNER_KIND_LOCAL" - RunnerListParamsFilterKindRunnerKindRemote RunnerListParamsFilterKind = "RUNNER_KIND_REMOTE" - RunnerListParamsFilterKindRunnerKindLocalConfiguration RunnerListParamsFilterKind = "RUNNER_KIND_LOCAL_CONFIGURATION" -) - -func (r RunnerListParamsFilterKind) IsKnown() bool { - switch r { - case RunnerListParamsFilterKindRunnerKindUnspecified, RunnerListParamsFilterKindRunnerKindLocal, RunnerListParamsFilterKindRunnerKindRemote, RunnerListParamsFilterKindRunnerKindLocalConfiguration: - return true - } - return false -} - -// RunnerProvider identifies the specific implementation type of a runner. Each -// provider maps to a specific kind of runner (local or remote), as specified below -// for each provider. -type RunnerListParamsFilterProvider string - -const ( - RunnerListParamsFilterProviderRunnerProviderUnspecified RunnerListParamsFilterProvider = "RUNNER_PROVIDER_UNSPECIFIED" - RunnerListParamsFilterProviderRunnerProviderAwsEc2 RunnerListParamsFilterProvider = "RUNNER_PROVIDER_AWS_EC2" - RunnerListParamsFilterProviderRunnerProviderLinuxHost RunnerListParamsFilterProvider = "RUNNER_PROVIDER_LINUX_HOST" - RunnerListParamsFilterProviderRunnerProviderDesktopMac RunnerListParamsFilterProvider = "RUNNER_PROVIDER_DESKTOP_MAC" -) - -func (r RunnerListParamsFilterProvider) IsKnown() bool { - switch r { - case RunnerListParamsFilterProviderRunnerProviderUnspecified, RunnerListParamsFilterProviderRunnerProviderAwsEc2, RunnerListParamsFilterProviderRunnerProviderLinuxHost, RunnerListParamsFilterProviderRunnerProviderDesktopMac: - return true - } - return false -} - // pagination contains the pagination options for listing runners type RunnerListParamsPagination struct { // Token for the next set of results that was returned as next_token of a diff --git a/runner_test.go b/runner_test.go index ead6915..7db38ab 100644 --- a/runner_test.go +++ b/runner_test.go @@ -27,16 +27,16 @@ func TestRunnerNewWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.New(context.TODO(), gitpod.RunnerNewParams{ - Kind: gitpod.F(gitpod.RunnerNewParamsKindRunnerKindUnspecified), + Kind: gitpod.F(gitpod.RunnerKindRunnerKindUnspecified), Name: gitpod.F("xxx"), - Provider: gitpod.F(gitpod.RunnerNewParamsProviderRunnerProviderUnspecified), - Spec: gitpod.F(gitpod.RunnerNewParamsSpec{ - Configuration: gitpod.F(gitpod.RunnerNewParamsSpecConfiguration{ + Provider: gitpod.F(gitpod.RunnerProviderRunnerProviderUnspecified), + Spec: gitpod.F(gitpod.RunnerSpecParam{ + Configuration: gitpod.F(gitpod.RunnerConfigurationParam{ AutoUpdate: gitpod.F(true), Region: gitpod.F("region"), - ReleaseChannel: gitpod.F(gitpod.RunnerNewParamsSpecConfigurationReleaseChannelRunnerReleaseChannelUnspecified), + ReleaseChannel: gitpod.F(gitpod.RunnerReleaseChannelRunnerReleaseChannelUnspecified), }), - DesiredPhase: gitpod.F(gitpod.RunnerNewParamsSpecDesiredPhaseRunnerPhaseUnspecified), + DesiredPhase: gitpod.F(gitpod.RunnerPhaseRunnerPhaseUnspecified), }), }) if err != nil { @@ -73,7 +73,7 @@ func TestRunnerGetWithOptionalParams(t *testing.T) { } } -func TestRunnerUpdate(t *testing.T) { +func TestRunnerUpdateWithOptionalParams(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 { @@ -87,9 +87,15 @@ func TestRunnerUpdate(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.Update(context.TODO(), gitpod.RunnerUpdateParams{ - Body: gitpod.RunnerUpdateParamsBodyTheRunnerSNameWhichIsShownToUsers{ - Name: gitpod.F("xxx"), - }, + Name: gitpod.F("xxx"), + RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + Spec: gitpod.F(gitpod.RunnerUpdateParamsSpec{ + Configuration: gitpod.F(gitpod.RunnerUpdateParamsSpecConfiguration{ + AutoUpdate: gitpod.F(true), + ReleaseChannel: gitpod.F(gitpod.RunnerReleaseChannelRunnerReleaseChannelUnspecified), + }), + DesiredPhase: gitpod.F(gitpod.RunnerPhaseRunnerPhaseUnspecified), + }), }) if err != nil { var apierr *gitpod.Error @@ -118,8 +124,8 @@ func TestRunnerListWithOptionalParams(t *testing.T) { PageSize: gitpod.F(int64(0)), Filter: gitpod.F(gitpod.RunnerListParamsFilter{ CreatorIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), - Kinds: gitpod.F([]gitpod.RunnerListParamsFilterKind{gitpod.RunnerListParamsFilterKindRunnerKindUnspecified}), - Providers: gitpod.F([]gitpod.RunnerListParamsFilterProvider{gitpod.RunnerListParamsFilterProviderRunnerProviderUnspecified}), + Kinds: gitpod.F([]gitpod.RunnerKind{gitpod.RunnerKindRunnerKindUnspecified}), + Providers: gitpod.F([]gitpod.RunnerProvider{gitpod.RunnerProviderRunnerProviderUnspecified}), }), Pagination: gitpod.F(gitpod.RunnerListParamsPagination{ Token: gitpod.F("token"), diff --git a/runnerconfiguration.go b/runnerconfiguration.go index 326a1f0..a22e231 100644 --- a/runnerconfiguration.go +++ b/runnerconfiguration.go @@ -5,13 +5,12 @@ package gitpod import ( "context" "net/http" - "reflect" "github.com/gitpod-io/flex-sdk-go/internal/apijson" "github.com/gitpod-io/flex-sdk-go/internal/param" "github.com/gitpod-io/flex-sdk-go/internal/requestconfig" "github.com/gitpod-io/flex-sdk-go/option" - "github.com/tidwall/gjson" + "github.com/gitpod-io/flex-sdk-go/shared" ) // RunnerConfigurationService contains methods and other services that help with @@ -50,477 +49,140 @@ func (r *RunnerConfigurationService) Validate(ctx context.Context, body RunnerCo return } -type RunnerConfigurationValidateResponse struct { - // This field can have the runtime type of - // [RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClass]. - EnvironmentClass interface{} `json:"environmentClass"` - // This field can have the runtime type of - // [RunnerConfigurationValidateResponseScmIntegrationScmIntegration]. - ScmIntegration interface{} `json:"scmIntegration"` - JSON runnerConfigurationValidateResponseJSON `json:"-"` - union RunnerConfigurationValidateResponseUnion -} - -// runnerConfigurationValidateResponseJSON contains the JSON metadata for the -// struct [RunnerConfigurationValidateResponse] -type runnerConfigurationValidateResponseJSON struct { - EnvironmentClass apijson.Field - ScmIntegration apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r runnerConfigurationValidateResponseJSON) RawJSON() string { - return r.raw -} - -func (r *RunnerConfigurationValidateResponse) UnmarshalJSON(data []byte) (err error) { - *r = RunnerConfigurationValidateResponse{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a [RunnerConfigurationValidateResponseUnion] interface which you -// can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [RunnerConfigurationValidateResponseEnvironmentClass], -// [RunnerConfigurationValidateResponseScmIntegration]. -func (r RunnerConfigurationValidateResponse) AsUnion() RunnerConfigurationValidateResponseUnion { - return r.union -} - -// Union satisfied by [RunnerConfigurationValidateResponseEnvironmentClass] or -// [RunnerConfigurationValidateResponseScmIntegration]. -type RunnerConfigurationValidateResponseUnion interface { - implementsRunnerConfigurationValidateResponse() +type EnvironmentClassValidationResult struct { + ConfigurationErrors []FieldValidationError `json:"configurationErrors"` + DescriptionError string `json:"descriptionError,nullable"` + DisplayNameError string `json:"displayNameError,nullable"` + Valid bool `json:"valid"` + JSON environmentClassValidationResultJSON `json:"-"` } -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RunnerConfigurationValidateResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RunnerConfigurationValidateResponseEnvironmentClass{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RunnerConfigurationValidateResponseScmIntegration{}), - }, - ) +// environmentClassValidationResultJSON contains the JSON metadata for the struct +// [EnvironmentClassValidationResult] +type environmentClassValidationResultJSON struct { + ConfigurationErrors apijson.Field + DescriptionError apijson.Field + DisplayNameError apijson.Field + Valid apijson.Field + raw string + ExtraFields map[string]apijson.Field } -type RunnerConfigurationValidateResponseEnvironmentClass struct { - EnvironmentClass RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClass `json:"environmentClass,required"` - JSON runnerConfigurationValidateResponseEnvironmentClassJSON `json:"-"` -} - -// runnerConfigurationValidateResponseEnvironmentClassJSON contains the JSON -// metadata for the struct [RunnerConfigurationValidateResponseEnvironmentClass] -type runnerConfigurationValidateResponseEnvironmentClassJSON struct { - EnvironmentClass apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerConfigurationValidateResponseEnvironmentClass) UnmarshalJSON(data []byte) (err error) { +func (r *EnvironmentClassValidationResult) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerConfigurationValidateResponseEnvironmentClassJSON) RawJSON() string { +func (r environmentClassValidationResultJSON) RawJSON() string { return r.raw } -func (r RunnerConfigurationValidateResponseEnvironmentClass) implementsRunnerConfigurationValidateResponse() { -} - -type RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClass struct { - DescriptionError string `json:"descriptionError"` - DisplayNameError string `json:"displayNameError"` - JSON runnerConfigurationValidateResponseEnvironmentClassEnvironmentClassJSON `json:"-"` - union RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClassUnion -} - -// runnerConfigurationValidateResponseEnvironmentClassEnvironmentClassJSON contains -// the JSON metadata for the struct -// [RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClass] -type runnerConfigurationValidateResponseEnvironmentClassEnvironmentClassJSON struct { - DescriptionError apijson.Field - DisplayNameError apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r runnerConfigurationValidateResponseEnvironmentClassEnvironmentClassJSON) RawJSON() string { - return r.raw -} - -func (r *RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClass) UnmarshalJSON(data []byte) (err error) { - *r = RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClass{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a -// [RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClassUnion] -// interface which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClassDescriptionError], -// [RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClassDisplayNameError]. -func (r RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClass) AsUnion() RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClassUnion { - return r.union -} - -// Union satisfied by -// [RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClassDescriptionError] -// or -// [RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClassDisplayNameError]. -type RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClassUnion interface { - implementsRunnerConfigurationValidateResponseEnvironmentClassEnvironmentClass() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClassUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClassDescriptionError{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClassDisplayNameError{}), - }, - ) -} - -type RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClassDescriptionError struct { - DescriptionError string `json:"descriptionError,required"` - JSON runnerConfigurationValidateResponseEnvironmentClassEnvironmentClassDescriptionErrorJSON `json:"-"` -} - -// runnerConfigurationValidateResponseEnvironmentClassEnvironmentClassDescriptionErrorJSON -// contains the JSON metadata for the struct -// [RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClassDescriptionError] -type runnerConfigurationValidateResponseEnvironmentClassEnvironmentClassDescriptionErrorJSON struct { - DescriptionError apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClassDescriptionError) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerConfigurationValidateResponseEnvironmentClassEnvironmentClassDescriptionErrorJSON) RawJSON() string { - return r.raw -} - -func (r RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClassDescriptionError) implementsRunnerConfigurationValidateResponseEnvironmentClassEnvironmentClass() { -} - -type RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClassDisplayNameError struct { - DisplayNameError string `json:"displayNameError,required"` - JSON runnerConfigurationValidateResponseEnvironmentClassEnvironmentClassDisplayNameErrorJSON `json:"-"` -} - -// runnerConfigurationValidateResponseEnvironmentClassEnvironmentClassDisplayNameErrorJSON -// contains the JSON metadata for the struct -// [RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClassDisplayNameError] -type runnerConfigurationValidateResponseEnvironmentClassEnvironmentClassDisplayNameErrorJSON struct { - DisplayNameError apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClassDisplayNameError) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerConfigurationValidateResponseEnvironmentClassEnvironmentClassDisplayNameErrorJSON) RawJSON() string { - return r.raw -} - -func (r RunnerConfigurationValidateResponseEnvironmentClassEnvironmentClassDisplayNameError) implementsRunnerConfigurationValidateResponseEnvironmentClassEnvironmentClass() { -} - -type RunnerConfigurationValidateResponseScmIntegration struct { - ScmIntegration RunnerConfigurationValidateResponseScmIntegrationScmIntegration `json:"scmIntegration,required"` - JSON runnerConfigurationValidateResponseScmIntegrationJSON `json:"-"` -} - -// runnerConfigurationValidateResponseScmIntegrationJSON contains the JSON metadata -// for the struct [RunnerConfigurationValidateResponseScmIntegration] -type runnerConfigurationValidateResponseScmIntegrationJSON struct { - ScmIntegration apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerConfigurationValidateResponseScmIntegration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerConfigurationValidateResponseScmIntegrationJSON) RawJSON() string { - return r.raw +type FieldValidationError struct { + Error string `json:"error"` + Key string `json:"key"` + JSON fieldValidationErrorJSON `json:"-"` } -func (r RunnerConfigurationValidateResponseScmIntegration) implementsRunnerConfigurationValidateResponse() { -} - -type RunnerConfigurationValidateResponseScmIntegrationScmIntegration struct { - HostError string `json:"hostError"` - OAuthError string `json:"oauthError"` - PatError string `json:"patError"` - ScmIDError string `json:"scmIdError"` - JSON runnerConfigurationValidateResponseScmIntegrationScmIntegrationJSON `json:"-"` - union RunnerConfigurationValidateResponseScmIntegrationScmIntegrationUnion -} - -// runnerConfigurationValidateResponseScmIntegrationScmIntegrationJSON contains the -// JSON metadata for the struct -// [RunnerConfigurationValidateResponseScmIntegrationScmIntegration] -type runnerConfigurationValidateResponseScmIntegrationScmIntegrationJSON struct { - HostError apijson.Field - OAuthError apijson.Field - PatError apijson.Field - ScmIDError apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r runnerConfigurationValidateResponseScmIntegrationScmIntegrationJSON) RawJSON() string { - return r.raw -} - -func (r *RunnerConfigurationValidateResponseScmIntegrationScmIntegration) UnmarshalJSON(data []byte) (err error) { - *r = RunnerConfigurationValidateResponseScmIntegrationScmIntegration{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a -// [RunnerConfigurationValidateResponseScmIntegrationScmIntegrationUnion] interface -// which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [RunnerConfigurationValidateResponseScmIntegrationScmIntegrationHostError], -// [RunnerConfigurationValidateResponseScmIntegrationScmIntegrationOAuthError], -// [RunnerConfigurationValidateResponseScmIntegrationScmIntegrationPatError], -// [RunnerConfigurationValidateResponseScmIntegrationScmIntegrationScmIDError]. -func (r RunnerConfigurationValidateResponseScmIntegrationScmIntegration) AsUnion() RunnerConfigurationValidateResponseScmIntegrationScmIntegrationUnion { - return r.union -} - -// Union satisfied by -// [RunnerConfigurationValidateResponseScmIntegrationScmIntegrationHostError], -// [RunnerConfigurationValidateResponseScmIntegrationScmIntegrationOAuthError], -// [RunnerConfigurationValidateResponseScmIntegrationScmIntegrationPatError] or -// [RunnerConfigurationValidateResponseScmIntegrationScmIntegrationScmIDError]. -type RunnerConfigurationValidateResponseScmIntegrationScmIntegrationUnion interface { - implementsRunnerConfigurationValidateResponseScmIntegrationScmIntegration() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RunnerConfigurationValidateResponseScmIntegrationScmIntegrationUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RunnerConfigurationValidateResponseScmIntegrationScmIntegrationHostError{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RunnerConfigurationValidateResponseScmIntegrationScmIntegrationOAuthError{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RunnerConfigurationValidateResponseScmIntegrationScmIntegrationPatError{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RunnerConfigurationValidateResponseScmIntegrationScmIntegrationScmIDError{}), - }, - ) -} - -type RunnerConfigurationValidateResponseScmIntegrationScmIntegrationHostError struct { - HostError string `json:"hostError,required"` - JSON runnerConfigurationValidateResponseScmIntegrationScmIntegrationHostErrorJSON `json:"-"` -} - -// runnerConfigurationValidateResponseScmIntegrationScmIntegrationHostErrorJSON -// contains the JSON metadata for the struct -// [RunnerConfigurationValidateResponseScmIntegrationScmIntegrationHostError] -type runnerConfigurationValidateResponseScmIntegrationScmIntegrationHostErrorJSON struct { - HostError apijson.Field +// fieldValidationErrorJSON contains the JSON metadata for the struct +// [FieldValidationError] +type fieldValidationErrorJSON struct { + Error apijson.Field + Key apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RunnerConfigurationValidateResponseScmIntegrationScmIntegrationHostError) UnmarshalJSON(data []byte) (err error) { +func (r *FieldValidationError) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerConfigurationValidateResponseScmIntegrationScmIntegrationHostErrorJSON) RawJSON() string { +func (r fieldValidationErrorJSON) RawJSON() string { return r.raw } -func (r RunnerConfigurationValidateResponseScmIntegrationScmIntegrationHostError) implementsRunnerConfigurationValidateResponseScmIntegrationScmIntegration() { +type ScmIntegrationValidationResult struct { + HostError string `json:"hostError,nullable"` + OAuthError string `json:"oauthError,nullable"` + PatError string `json:"patError,nullable"` + ScmIDError string `json:"scmIdError,nullable"` + Valid bool `json:"valid"` + JSON scmIntegrationValidationResultJSON `json:"-"` } -type RunnerConfigurationValidateResponseScmIntegrationScmIntegrationOAuthError struct { - OAuthError string `json:"oauthError,required"` - JSON runnerConfigurationValidateResponseScmIntegrationScmIntegrationOAuthErrorJSON `json:"-"` -} - -// runnerConfigurationValidateResponseScmIntegrationScmIntegrationOAuthErrorJSON -// contains the JSON metadata for the struct -// [RunnerConfigurationValidateResponseScmIntegrationScmIntegrationOAuthError] -type runnerConfigurationValidateResponseScmIntegrationScmIntegrationOAuthErrorJSON struct { +// scmIntegrationValidationResultJSON contains the JSON metadata for the struct +// [ScmIntegrationValidationResult] +type scmIntegrationValidationResultJSON struct { + HostError apijson.Field OAuthError apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerConfigurationValidateResponseScmIntegrationScmIntegrationOAuthError) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerConfigurationValidateResponseScmIntegrationScmIntegrationOAuthErrorJSON) RawJSON() string { - return r.raw -} - -func (r RunnerConfigurationValidateResponseScmIntegrationScmIntegrationOAuthError) implementsRunnerConfigurationValidateResponseScmIntegrationScmIntegration() { -} - -type RunnerConfigurationValidateResponseScmIntegrationScmIntegrationPatError struct { - PatError string `json:"patError,required"` - JSON runnerConfigurationValidateResponseScmIntegrationScmIntegrationPatErrorJSON `json:"-"` -} - -// runnerConfigurationValidateResponseScmIntegrationScmIntegrationPatErrorJSON -// contains the JSON metadata for the struct -// [RunnerConfigurationValidateResponseScmIntegrationScmIntegrationPatError] -type runnerConfigurationValidateResponseScmIntegrationScmIntegrationPatErrorJSON struct { PatError apijson.Field + ScmIDError apijson.Field + Valid apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RunnerConfigurationValidateResponseScmIntegrationScmIntegrationPatError) UnmarshalJSON(data []byte) (err error) { +func (r *ScmIntegrationValidationResult) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerConfigurationValidateResponseScmIntegrationScmIntegrationPatErrorJSON) RawJSON() string { +func (r scmIntegrationValidationResultJSON) RawJSON() string { return r.raw } -func (r RunnerConfigurationValidateResponseScmIntegrationScmIntegrationPatError) implementsRunnerConfigurationValidateResponseScmIntegrationScmIntegration() { -} - -type RunnerConfigurationValidateResponseScmIntegrationScmIntegrationScmIDError struct { - ScmIDError string `json:"scmIdError,required"` - JSON runnerConfigurationValidateResponseScmIntegrationScmIntegrationScmIDErrorJSON `json:"-"` +type RunnerConfigurationValidateResponse struct { + EnvironmentClass EnvironmentClassValidationResult `json:"environmentClass"` + ScmIntegration ScmIntegrationValidationResult `json:"scmIntegration"` + JSON runnerConfigurationValidateResponseJSON `json:"-"` } -// runnerConfigurationValidateResponseScmIntegrationScmIntegrationScmIDErrorJSON -// contains the JSON metadata for the struct -// [RunnerConfigurationValidateResponseScmIntegrationScmIntegrationScmIDError] -type runnerConfigurationValidateResponseScmIntegrationScmIntegrationScmIDErrorJSON struct { - ScmIDError apijson.Field - raw string - ExtraFields map[string]apijson.Field +// runnerConfigurationValidateResponseJSON contains the JSON metadata for the +// struct [RunnerConfigurationValidateResponse] +type runnerConfigurationValidateResponseJSON struct { + EnvironmentClass apijson.Field + ScmIntegration apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *RunnerConfigurationValidateResponseScmIntegrationScmIntegrationScmIDError) UnmarshalJSON(data []byte) (err error) { +func (r *RunnerConfigurationValidateResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerConfigurationValidateResponseScmIntegrationScmIntegrationScmIDErrorJSON) RawJSON() string { +func (r runnerConfigurationValidateResponseJSON) RawJSON() string { return r.raw } -func (r RunnerConfigurationValidateResponseScmIntegrationScmIntegrationScmIDError) implementsRunnerConfigurationValidateResponseScmIntegrationScmIntegration() { -} - type RunnerConfigurationValidateParams struct { - Body RunnerConfigurationValidateParamsBodyUnion `json:"body,required"` + EnvironmentClass param.Field[shared.EnvironmentClassParam] `json:"environmentClass"` + RunnerID param.Field[string] `json:"runnerId" format:"uuid"` + ScmIntegration param.Field[RunnerConfigurationValidateParamsScmIntegration] `json:"scmIntegration"` } func (r RunnerConfigurationValidateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - -type RunnerConfigurationValidateParamsBody struct { - EnvironmentClass param.Field[interface{}] `json:"environmentClass"` - RunnerID param.Field[string] `json:"runnerId" format:"uuid"` - ScmIntegration param.Field[interface{}] `json:"scmIntegration"` -} - -func (r RunnerConfigurationValidateParamsBody) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r RunnerConfigurationValidateParamsBody) implementsRunnerConfigurationValidateParamsBodyUnion() { -} - -// Satisfied by [RunnerConfigurationValidateParamsBodyObject], -// [RunnerConfigurationValidateParamsBodyObject], -// [RunnerConfigurationValidateParamsBody]. -type RunnerConfigurationValidateParamsBodyUnion interface { - implementsRunnerConfigurationValidateParamsBodyUnion() -} - -type RunnerConfigurationValidateParamsBodyObject struct { - EnvironmentClass param.Field[RunnerConfigurationValidateParamsBodyObjectEnvironmentClass] `json:"environmentClass,required"` - RunnerID param.Field[string] `json:"runnerId" format:"uuid"` -} - -func (r RunnerConfigurationValidateParamsBodyObject) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RunnerConfigurationValidateParamsBodyObject) implementsRunnerConfigurationValidateParamsBodyUnion() { -} - -type RunnerConfigurationValidateParamsBodyObjectEnvironmentClass struct { - // id is the unique identifier of the environment class - ID param.Field[string] `json:"id"` - // configuration describes the configuration of the environment class - Configuration param.Field[[]RunnerConfigurationValidateParamsBodyObjectEnvironmentClassConfiguration] `json:"configuration"` - // description is a human readable description of the environment class - Description param.Field[string] `json:"description"` - // display_name is the human readable name of the environment class - DisplayName param.Field[string] `json:"displayName"` - // enabled indicates whether the environment class can be used to create new - // environments. - Enabled param.Field[bool] `json:"enabled"` - // runner_id is the unique identifier of the runner the environment class belongs - // to - RunnerID param.Field[string] `json:"runnerId"` -} - -func (r RunnerConfigurationValidateParamsBodyObjectEnvironmentClass) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type RunnerConfigurationValidateParamsBodyObjectEnvironmentClassConfiguration struct { - Key param.Field[string] `json:"key"` - Value param.Field[string] `json:"value"` -} - -func (r RunnerConfigurationValidateParamsBodyObjectEnvironmentClassConfiguration) MarshalJSON() (data []byte, err error) { +type RunnerConfigurationValidateParamsScmIntegration struct { + // id is the unique identifier of the SCM integration + ID param.Field[string] `json:"id"` + Host param.Field[string] `json:"host"` + // oauth_client_id is the OAuth app's client ID, if OAuth is configured. If + // configured, oauth_client_secret must also be set. + OAuthClientID param.Field[string] `json:"oauthClientId"` + // oauth_encrypted_client_secret is the OAuth app's client secret encrypted with + // the runner's public key, if OAuth is configured. This can be used to e.g. + // validate an already encrypted client secret of an existing SCM integration. + OAuthEncryptedClientSecret param.Field[string] `json:"oauthEncryptedClientSecret" format:"byte"` + // oauth_plaintext_client_secret is the OAuth app's client secret in clear text, if + // OAuth is configured. This can be set to validate any new client secret before it + // is encrypted and stored. This value will not be stored and get encrypted with + // the runner's public key before passing it to the runner. + OAuthPlaintextClientSecret param.Field[string] `json:"oauthPlaintextClientSecret"` + Pat param.Field[bool] `json:"pat"` + // scm_id references the scm_id in the runner's configuration schema that this + // integration is for + ScmID param.Field[string] `json:"scmId"` +} + +func (r RunnerConfigurationValidateParamsScmIntegration) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } diff --git a/runnerconfiguration_test.go b/runnerconfiguration_test.go index 5dbb567..1d8fedc 100644 --- a/runnerconfiguration_test.go +++ b/runnerconfiguration_test.go @@ -11,6 +11,7 @@ import ( "github.com/gitpod-io/flex-sdk-go" "github.com/gitpod-io/flex-sdk-go/internal/testutil" "github.com/gitpod-io/flex-sdk-go/option" + "github.com/gitpod-io/flex-sdk-go/shared" ) func TestRunnerConfigurationValidateWithOptionalParams(t *testing.T) { @@ -27,20 +28,27 @@ func TestRunnerConfigurationValidateWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.Configurations.Validate(context.TODO(), gitpod.RunnerConfigurationValidateParams{ - Body: gitpod.RunnerConfigurationValidateParamsBodyObject{ - EnvironmentClass: gitpod.F(gitpod.RunnerConfigurationValidateParamsBodyObjectEnvironmentClass{ - ID: gitpod.F("id"), - Configuration: gitpod.F([]gitpod.RunnerConfigurationValidateParamsBodyObjectEnvironmentClassConfiguration{{ - Key: gitpod.F("key"), - Value: gitpod.F("value"), - }}), - Description: gitpod.F("xxx"), - DisplayName: gitpod.F("xxx"), - Enabled: gitpod.F(true), - RunnerID: gitpod.F("runnerId"), - }), - RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - }, + EnvironmentClass: gitpod.F(shared.EnvironmentClassParam{ + ID: gitpod.F("id"), + Configuration: gitpod.F([]shared.FieldValueParam{{ + Key: gitpod.F("key"), + Value: gitpod.F("value"), + }}), + Description: gitpod.F("xxx"), + DisplayName: gitpod.F("xxx"), + Enabled: gitpod.F(true), + RunnerID: gitpod.F("runnerId"), + }), + RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + ScmIntegration: gitpod.F(gitpod.RunnerConfigurationValidateParamsScmIntegration{ + ID: gitpod.F("id"), + Host: gitpod.F("host"), + OAuthClientID: gitpod.F("oauthClientId"), + OAuthEncryptedClientSecret: gitpod.F("U3RhaW5sZXNzIHJvY2tz"), + OAuthPlaintextClientSecret: gitpod.F("oauthPlaintextClientSecret"), + Pat: gitpod.F(true), + ScmID: gitpod.F("scmId"), + }), }) if err != nil { var apierr *gitpod.Error diff --git a/runnerconfigurationenvironmentclass.go b/runnerconfigurationenvironmentclass.go index b76d600..03ae4f8 100644 --- a/runnerconfigurationenvironmentclass.go +++ b/runnerconfigurationenvironmentclass.go @@ -13,6 +13,7 @@ import ( "github.com/gitpod-io/flex-sdk-go/internal/requestconfig" "github.com/gitpod-io/flex-sdk-go/option" "github.com/gitpod-io/flex-sdk-go/packages/pagination" + "github.com/gitpod-io/flex-sdk-go/shared" ) // RunnerConfigurationEnvironmentClassService contains methods and other services @@ -61,7 +62,7 @@ func (r *RunnerConfigurationEnvironmentClassService) Update(ctx context.Context, // ListEnvironmentClasses returns all environment classes configured for a runner. // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE -func (r *RunnerConfigurationEnvironmentClassService) List(ctx context.Context, params RunnerConfigurationEnvironmentClassListParams, opts ...option.RequestOption) (res *pagination.EnvironmentClassesPage[RunnerConfigurationEnvironmentClassListResponse], err error) { +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...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -80,7 +81,7 @@ func (r *RunnerConfigurationEnvironmentClassService) List(ctx context.Context, p // ListEnvironmentClasses returns all environment classes configured for a runner. // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE -func (r *RunnerConfigurationEnvironmentClassService) ListAutoPaging(ctx context.Context, params RunnerConfigurationEnvironmentClassListParams, opts ...option.RequestOption) *pagination.EnvironmentClassesPageAutoPager[RunnerConfigurationEnvironmentClassListResponse] { +func (r *RunnerConfigurationEnvironmentClassService) ListAutoPaging(ctx context.Context, params RunnerConfigurationEnvironmentClassListParams, opts ...option.RequestOption) *pagination.EnvironmentClassesPageAutoPager[shared.EnvironmentClass] { return pagination.NewEnvironmentClassesPageAutoPager(r.List(ctx, params, opts...)) } @@ -106,8 +107,8 @@ func (r runnerConfigurationEnvironmentClassNewResponseJSON) RawJSON() string { } type RunnerConfigurationEnvironmentClassGetResponse struct { - EnvironmentClass RunnerConfigurationEnvironmentClassGetResponseEnvironmentClass `json:"environmentClass"` - JSON runnerConfigurationEnvironmentClassGetResponseJSON `json:"-"` + EnvironmentClass shared.EnvironmentClass `json:"environmentClass"` + JSON runnerConfigurationEnvironmentClassGetResponseJSON `json:"-"` } // runnerConfigurationEnvironmentClassGetResponseJSON contains the JSON metadata @@ -126,155 +127,19 @@ func (r runnerConfigurationEnvironmentClassGetResponseJSON) RawJSON() string { return r.raw } -type RunnerConfigurationEnvironmentClassGetResponseEnvironmentClass struct { - // id is the unique identifier of the environment class - ID string `json:"id"` - // configuration describes the configuration of the environment class - Configuration []RunnerConfigurationEnvironmentClassGetResponseEnvironmentClassConfiguration `json:"configuration"` - // description is a human readable description of the environment class - Description string `json:"description"` - // display_name is the human readable name of the environment class - DisplayName string `json:"displayName"` - // enabled indicates whether the environment class can be used to create new - // environments. - Enabled bool `json:"enabled"` - // runner_id is the unique identifier of the runner the environment class belongs - // to - RunnerID string `json:"runnerId"` - JSON runnerConfigurationEnvironmentClassGetResponseEnvironmentClassJSON `json:"-"` -} - -// runnerConfigurationEnvironmentClassGetResponseEnvironmentClassJSON contains the -// JSON metadata for the struct -// [RunnerConfigurationEnvironmentClassGetResponseEnvironmentClass] -type runnerConfigurationEnvironmentClassGetResponseEnvironmentClassJSON struct { - ID apijson.Field - Configuration apijson.Field - Description apijson.Field - DisplayName apijson.Field - Enabled apijson.Field - RunnerID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerConfigurationEnvironmentClassGetResponseEnvironmentClass) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerConfigurationEnvironmentClassGetResponseEnvironmentClassJSON) RawJSON() string { - return r.raw -} - -type RunnerConfigurationEnvironmentClassGetResponseEnvironmentClassConfiguration struct { - Key string `json:"key"` - Value string `json:"value"` - JSON runnerConfigurationEnvironmentClassGetResponseEnvironmentClassConfigurationJSON `json:"-"` -} - -// runnerConfigurationEnvironmentClassGetResponseEnvironmentClassConfigurationJSON -// contains the JSON metadata for the struct -// [RunnerConfigurationEnvironmentClassGetResponseEnvironmentClassConfiguration] -type runnerConfigurationEnvironmentClassGetResponseEnvironmentClassConfigurationJSON struct { - Key apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerConfigurationEnvironmentClassGetResponseEnvironmentClassConfiguration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerConfigurationEnvironmentClassGetResponseEnvironmentClassConfigurationJSON) RawJSON() string { - return r.raw -} - type RunnerConfigurationEnvironmentClassUpdateResponse = interface{} -type RunnerConfigurationEnvironmentClassListResponse struct { - // id is the unique identifier of the environment class - ID string `json:"id"` - // configuration describes the configuration of the environment class - Configuration []RunnerConfigurationEnvironmentClassListResponseConfiguration `json:"configuration"` - // description is a human readable description of the environment class - Description string `json:"description"` - // display_name is the human readable name of the environment class - DisplayName string `json:"displayName"` - // enabled indicates whether the environment class can be used to create new - // environments. - Enabled bool `json:"enabled"` - // runner_id is the unique identifier of the runner the environment class belongs - // to - RunnerID string `json:"runnerId"` - JSON runnerConfigurationEnvironmentClassListResponseJSON `json:"-"` -} - -// runnerConfigurationEnvironmentClassListResponseJSON contains the JSON metadata -// for the struct [RunnerConfigurationEnvironmentClassListResponse] -type runnerConfigurationEnvironmentClassListResponseJSON struct { - ID apijson.Field - Configuration apijson.Field - Description apijson.Field - DisplayName apijson.Field - Enabled apijson.Field - RunnerID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerConfigurationEnvironmentClassListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerConfigurationEnvironmentClassListResponseJSON) RawJSON() string { - return r.raw -} - -type RunnerConfigurationEnvironmentClassListResponseConfiguration struct { - Key string `json:"key"` - Value string `json:"value"` - JSON runnerConfigurationEnvironmentClassListResponseConfigurationJSON `json:"-"` -} - -// runnerConfigurationEnvironmentClassListResponseConfigurationJSON contains the -// JSON metadata for the struct -// [RunnerConfigurationEnvironmentClassListResponseConfiguration] -type runnerConfigurationEnvironmentClassListResponseConfigurationJSON struct { - Key apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerConfigurationEnvironmentClassListResponseConfiguration) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerConfigurationEnvironmentClassListResponseConfigurationJSON) RawJSON() string { - return r.raw -} - type RunnerConfigurationEnvironmentClassNewParams struct { - Configuration param.Field[[]RunnerConfigurationEnvironmentClassNewParamsConfiguration] `json:"configuration"` - Description param.Field[string] `json:"description"` - DisplayName param.Field[string] `json:"displayName"` - RunnerID param.Field[string] `json:"runnerId" format:"uuid"` + Configuration param.Field[[]shared.FieldValueParam] `json:"configuration"` + Description param.Field[string] `json:"description"` + DisplayName param.Field[string] `json:"displayName"` + RunnerID param.Field[string] `json:"runnerId" format:"uuid"` } func (r RunnerConfigurationEnvironmentClassNewParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type RunnerConfigurationEnvironmentClassNewParamsConfiguration struct { - Key param.Field[string] `json:"key"` - Value param.Field[string] `json:"value"` -} - -func (r RunnerConfigurationEnvironmentClassNewParamsConfiguration) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - type RunnerConfigurationEnvironmentClassGetParams struct { EnvironmentClassID param.Field[string] `json:"environmentClassId" format:"uuid"` } @@ -284,67 +149,16 @@ func (r RunnerConfigurationEnvironmentClassGetParams) MarshalJSON() (data []byte } type RunnerConfigurationEnvironmentClassUpdateParams struct { - Body RunnerConfigurationEnvironmentClassUpdateParamsBodyUnion `json:"body,required"` + Description param.Field[string] `json:"description"` + DisplayName param.Field[string] `json:"displayName"` + Enabled param.Field[bool] `json:"enabled"` + EnvironmentClassID param.Field[string] `json:"environmentClassId" format:"uuid"` } func (r RunnerConfigurationEnvironmentClassUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - -type RunnerConfigurationEnvironmentClassUpdateParamsBody struct { - Description param.Field[string] `json:"description"` - DisplayName param.Field[string] `json:"displayName"` - Enabled param.Field[bool] `json:"enabled"` -} - -func (r RunnerConfigurationEnvironmentClassUpdateParamsBody) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r RunnerConfigurationEnvironmentClassUpdateParamsBody) implementsRunnerConfigurationEnvironmentClassUpdateParamsBodyUnion() { -} - -// Satisfied by [RunnerConfigurationEnvironmentClassUpdateParamsBodyDescription], -// [RunnerConfigurationEnvironmentClassUpdateParamsBodyDisplayName], -// [RunnerConfigurationEnvironmentClassUpdateParamsBodyEnabled], -// [RunnerConfigurationEnvironmentClassUpdateParamsBody]. -type RunnerConfigurationEnvironmentClassUpdateParamsBodyUnion interface { - implementsRunnerConfigurationEnvironmentClassUpdateParamsBodyUnion() -} - -type RunnerConfigurationEnvironmentClassUpdateParamsBodyDescription struct { - Description param.Field[string] `json:"description,required"` -} - -func (r RunnerConfigurationEnvironmentClassUpdateParamsBodyDescription) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RunnerConfigurationEnvironmentClassUpdateParamsBodyDescription) implementsRunnerConfigurationEnvironmentClassUpdateParamsBodyUnion() { -} - -type RunnerConfigurationEnvironmentClassUpdateParamsBodyDisplayName struct { - DisplayName param.Field[string] `json:"displayName,required"` -} - -func (r RunnerConfigurationEnvironmentClassUpdateParamsBodyDisplayName) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RunnerConfigurationEnvironmentClassUpdateParamsBodyDisplayName) implementsRunnerConfigurationEnvironmentClassUpdateParamsBodyUnion() { -} - -type RunnerConfigurationEnvironmentClassUpdateParamsBodyEnabled struct { - Enabled param.Field[bool] `json:"enabled,required"` -} - -func (r RunnerConfigurationEnvironmentClassUpdateParamsBodyEnabled) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RunnerConfigurationEnvironmentClassUpdateParamsBodyEnabled) implementsRunnerConfigurationEnvironmentClassUpdateParamsBodyUnion() { -} - type RunnerConfigurationEnvironmentClassListParams struct { Token param.Field[string] `query:"token"` PageSize param.Field[int64] `query:"pageSize"` @@ -369,7 +183,9 @@ func (r RunnerConfigurationEnvironmentClassListParams) URLQuery() (v url.Values) type RunnerConfigurationEnvironmentClassListParamsFilter struct { // 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,required"` + 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"` } func (r RunnerConfigurationEnvironmentClassListParamsFilter) MarshalJSON() (data []byte, err error) { diff --git a/runnerconfigurationenvironmentclass_test.go b/runnerconfigurationenvironmentclass_test.go index 5a32e84..dc3b68d 100644 --- a/runnerconfigurationenvironmentclass_test.go +++ b/runnerconfigurationenvironmentclass_test.go @@ -11,6 +11,7 @@ import ( "github.com/gitpod-io/flex-sdk-go" "github.com/gitpod-io/flex-sdk-go/internal/testutil" "github.com/gitpod-io/flex-sdk-go/option" + "github.com/gitpod-io/flex-sdk-go/shared" ) func TestRunnerConfigurationEnvironmentClassNewWithOptionalParams(t *testing.T) { @@ -27,7 +28,7 @@ func TestRunnerConfigurationEnvironmentClassNewWithOptionalParams(t *testing.T) option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.Configurations.EnvironmentClasses.New(context.TODO(), gitpod.RunnerConfigurationEnvironmentClassNewParams{ - Configuration: gitpod.F([]gitpod.RunnerConfigurationEnvironmentClassNewParamsConfiguration{{ + Configuration: gitpod.F([]shared.FieldValueParam{{ Key: gitpod.F("key"), Value: gitpod.F("value"), }}), @@ -69,7 +70,7 @@ func TestRunnerConfigurationEnvironmentClassGetWithOptionalParams(t *testing.T) } } -func TestRunnerConfigurationEnvironmentClassUpdate(t *testing.T) { +func TestRunnerConfigurationEnvironmentClassUpdateWithOptionalParams(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 { @@ -83,9 +84,10 @@ func TestRunnerConfigurationEnvironmentClassUpdate(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.Configurations.EnvironmentClasses.Update(context.TODO(), gitpod.RunnerConfigurationEnvironmentClassUpdateParams{ - Body: gitpod.RunnerConfigurationEnvironmentClassUpdateParamsBodyDescription{ - Description: gitpod.F("xxx"), - }, + Description: gitpod.F("xxx"), + DisplayName: gitpod.F("xxx"), + Enabled: gitpod.F(true), + EnvironmentClassID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), }) if err != nil { var apierr *gitpod.Error @@ -113,7 +115,8 @@ func TestRunnerConfigurationEnvironmentClassListWithOptionalParams(t *testing.T) Token: gitpod.F("token"), PageSize: gitpod.F(int64(0)), Filter: gitpod.F(gitpod.RunnerConfigurationEnvironmentClassListParamsFilter{ - Enabled: gitpod.F(true), + Enabled: gitpod.F(true), + RunnerIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), }), Pagination: gitpod.F(gitpod.RunnerConfigurationEnvironmentClassListParamsPagination{ Token: gitpod.F("token"), diff --git a/runnerconfigurationhostauthenticationtoken.go b/runnerconfigurationhostauthenticationtoken.go index 2ffc919..42acdf3 100644 --- a/runnerconfigurationhostauthenticationtoken.go +++ b/runnerconfigurationhostauthenticationtoken.go @@ -61,7 +61,7 @@ func (r *RunnerConfigurationHostAuthenticationTokenService) Update(ctx context.C } // ListHostAuthenticationTokens -func (r *RunnerConfigurationHostAuthenticationTokenService) List(ctx context.Context, params RunnerConfigurationHostAuthenticationTokenListParams, opts ...option.RequestOption) (res *pagination.TokensPage[RunnerConfigurationHostAuthenticationTokenListResponse], err error) { +func (r *RunnerConfigurationHostAuthenticationTokenService) List(ctx context.Context, params RunnerConfigurationHostAuthenticationTokenListParams, opts ...option.RequestOption) (res *pagination.TokensPage[HostAuthenticationToken], err error) { var raw *http.Response opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -79,7 +79,7 @@ func (r *RunnerConfigurationHostAuthenticationTokenService) List(ctx context.Con } // ListHostAuthenticationTokens -func (r *RunnerConfigurationHostAuthenticationTokenService) ListAutoPaging(ctx context.Context, params RunnerConfigurationHostAuthenticationTokenListParams, opts ...option.RequestOption) *pagination.TokensPageAutoPager[RunnerConfigurationHostAuthenticationTokenListResponse] { +func (r *RunnerConfigurationHostAuthenticationTokenService) ListAutoPaging(ctx context.Context, params RunnerConfigurationHostAuthenticationTokenListParams, opts ...option.RequestOption) *pagination.TokensPageAutoPager[HostAuthenticationToken] { return pagination.NewTokensPageAutoPager(r.List(ctx, params, opts...)) } @@ -91,28 +91,7 @@ func (r *RunnerConfigurationHostAuthenticationTokenService) Delete(ctx context.C return } -type RunnerConfigurationHostAuthenticationTokenNewResponse struct { - Token RunnerConfigurationHostAuthenticationTokenNewResponseToken `json:"token"` - JSON runnerConfigurationHostAuthenticationTokenNewResponseJSON `json:"-"` -} - -// runnerConfigurationHostAuthenticationTokenNewResponseJSON contains the JSON -// metadata for the struct [RunnerConfigurationHostAuthenticationTokenNewResponse] -type runnerConfigurationHostAuthenticationTokenNewResponseJSON struct { - Token apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerConfigurationHostAuthenticationTokenNewResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerConfigurationHostAuthenticationTokenNewResponseJSON) RawJSON() string { - return r.raw -} - -type RunnerConfigurationHostAuthenticationTokenNewResponseToken struct { +type HostAuthenticationToken struct { ID string `json:"id"` // 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 @@ -202,18 +181,17 @@ type RunnerConfigurationHostAuthenticationTokenNewResponseToken struct { // Joda Time's // [`ISODateTimeFormat.dateTime()`]() // to obtain a formatter capable of generating timestamps in this format. - ExpiresAt time.Time `json:"expiresAt" format:"date-time"` - Host string `json:"host"` - RunnerID string `json:"runnerId"` - Source RunnerConfigurationHostAuthenticationTokenNewResponseTokenSource `json:"source"` - UserID string `json:"userId"` - JSON runnerConfigurationHostAuthenticationTokenNewResponseTokenJSON `json:"-"` -} - -// runnerConfigurationHostAuthenticationTokenNewResponseTokenJSON contains the JSON -// metadata for the struct -// [RunnerConfigurationHostAuthenticationTokenNewResponseToken] -type runnerConfigurationHostAuthenticationTokenNewResponseTokenJSON struct { + ExpiresAt time.Time `json:"expiresAt" format:"date-time"` + Host string `json:"host"` + RunnerID string `json:"runnerId"` + Source HostAuthenticationTokenSource `json:"source"` + UserID string `json:"userId"` + JSON hostAuthenticationTokenJSON `json:"-"` +} + +// hostAuthenticationTokenJSON contains the JSON metadata for the struct +// [HostAuthenticationToken] +type hostAuthenticationTokenJSON struct { ID apijson.Field ExpiresAt apijson.Field Host apijson.Field @@ -224,323 +202,73 @@ type runnerConfigurationHostAuthenticationTokenNewResponseTokenJSON struct { ExtraFields map[string]apijson.Field } -func (r *RunnerConfigurationHostAuthenticationTokenNewResponseToken) UnmarshalJSON(data []byte) (err error) { +func (r *HostAuthenticationToken) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerConfigurationHostAuthenticationTokenNewResponseTokenJSON) RawJSON() string { +func (r hostAuthenticationTokenJSON) RawJSON() string { return r.raw } -type RunnerConfigurationHostAuthenticationTokenNewResponseTokenSource string +type HostAuthenticationTokenSource string const ( - RunnerConfigurationHostAuthenticationTokenNewResponseTokenSourceHostAuthenticationTokenSourceUnspecified RunnerConfigurationHostAuthenticationTokenNewResponseTokenSource = "HOST_AUTHENTICATION_TOKEN_SOURCE_UNSPECIFIED" - RunnerConfigurationHostAuthenticationTokenNewResponseTokenSourceHostAuthenticationTokenSourceOAuth RunnerConfigurationHostAuthenticationTokenNewResponseTokenSource = "HOST_AUTHENTICATION_TOKEN_SOURCE_OAUTH" - RunnerConfigurationHostAuthenticationTokenNewResponseTokenSourceHostAuthenticationTokenSourcePat RunnerConfigurationHostAuthenticationTokenNewResponseTokenSource = "HOST_AUTHENTICATION_TOKEN_SOURCE_PAT" + HostAuthenticationTokenSourceHostAuthenticationTokenSourceUnspecified HostAuthenticationTokenSource = "HOST_AUTHENTICATION_TOKEN_SOURCE_UNSPECIFIED" + HostAuthenticationTokenSourceHostAuthenticationTokenSourceOAuth HostAuthenticationTokenSource = "HOST_AUTHENTICATION_TOKEN_SOURCE_OAUTH" + HostAuthenticationTokenSourceHostAuthenticationTokenSourcePat HostAuthenticationTokenSource = "HOST_AUTHENTICATION_TOKEN_SOURCE_PAT" ) -func (r RunnerConfigurationHostAuthenticationTokenNewResponseTokenSource) IsKnown() bool { +func (r HostAuthenticationTokenSource) IsKnown() bool { switch r { - case RunnerConfigurationHostAuthenticationTokenNewResponseTokenSourceHostAuthenticationTokenSourceUnspecified, RunnerConfigurationHostAuthenticationTokenNewResponseTokenSourceHostAuthenticationTokenSourceOAuth, RunnerConfigurationHostAuthenticationTokenNewResponseTokenSourceHostAuthenticationTokenSourcePat: + case HostAuthenticationTokenSourceHostAuthenticationTokenSourceUnspecified, HostAuthenticationTokenSourceHostAuthenticationTokenSourceOAuth, HostAuthenticationTokenSourceHostAuthenticationTokenSourcePat: return true } return false } -type RunnerConfigurationHostAuthenticationTokenGetResponse struct { - Token RunnerConfigurationHostAuthenticationTokenGetResponseToken `json:"token"` - JSON runnerConfigurationHostAuthenticationTokenGetResponseJSON `json:"-"` +type RunnerConfigurationHostAuthenticationTokenNewResponse struct { + Token HostAuthenticationToken `json:"token"` + JSON runnerConfigurationHostAuthenticationTokenNewResponseJSON `json:"-"` } -// runnerConfigurationHostAuthenticationTokenGetResponseJSON contains the JSON -// metadata for the struct [RunnerConfigurationHostAuthenticationTokenGetResponse] -type runnerConfigurationHostAuthenticationTokenGetResponseJSON struct { +// runnerConfigurationHostAuthenticationTokenNewResponseJSON contains the JSON +// metadata for the struct [RunnerConfigurationHostAuthenticationTokenNewResponse] +type runnerConfigurationHostAuthenticationTokenNewResponseJSON struct { Token apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RunnerConfigurationHostAuthenticationTokenGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerConfigurationHostAuthenticationTokenGetResponseJSON) RawJSON() string { - return r.raw -} - -type RunnerConfigurationHostAuthenticationTokenGetResponseToken struct { - ID string `json:"id"` - // 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. - ExpiresAt time.Time `json:"expiresAt" format:"date-time"` - Host string `json:"host"` - RunnerID string `json:"runnerId"` - Source RunnerConfigurationHostAuthenticationTokenGetResponseTokenSource `json:"source"` - UserID string `json:"userId"` - JSON runnerConfigurationHostAuthenticationTokenGetResponseTokenJSON `json:"-"` -} - -// runnerConfigurationHostAuthenticationTokenGetResponseTokenJSON contains the JSON -// metadata for the struct -// [RunnerConfigurationHostAuthenticationTokenGetResponseToken] -type runnerConfigurationHostAuthenticationTokenGetResponseTokenJSON struct { - ID apijson.Field - ExpiresAt apijson.Field - Host apijson.Field - RunnerID apijson.Field - Source apijson.Field - UserID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerConfigurationHostAuthenticationTokenGetResponseToken) UnmarshalJSON(data []byte) (err error) { +func (r *RunnerConfigurationHostAuthenticationTokenNewResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerConfigurationHostAuthenticationTokenGetResponseTokenJSON) RawJSON() string { +func (r runnerConfigurationHostAuthenticationTokenNewResponseJSON) RawJSON() string { return r.raw } -type RunnerConfigurationHostAuthenticationTokenGetResponseTokenSource string - -const ( - RunnerConfigurationHostAuthenticationTokenGetResponseTokenSourceHostAuthenticationTokenSourceUnspecified RunnerConfigurationHostAuthenticationTokenGetResponseTokenSource = "HOST_AUTHENTICATION_TOKEN_SOURCE_UNSPECIFIED" - RunnerConfigurationHostAuthenticationTokenGetResponseTokenSourceHostAuthenticationTokenSourceOAuth RunnerConfigurationHostAuthenticationTokenGetResponseTokenSource = "HOST_AUTHENTICATION_TOKEN_SOURCE_OAUTH" - RunnerConfigurationHostAuthenticationTokenGetResponseTokenSourceHostAuthenticationTokenSourcePat RunnerConfigurationHostAuthenticationTokenGetResponseTokenSource = "HOST_AUTHENTICATION_TOKEN_SOURCE_PAT" -) - -func (r RunnerConfigurationHostAuthenticationTokenGetResponseTokenSource) IsKnown() bool { - switch r { - case RunnerConfigurationHostAuthenticationTokenGetResponseTokenSourceHostAuthenticationTokenSourceUnspecified, RunnerConfigurationHostAuthenticationTokenGetResponseTokenSourceHostAuthenticationTokenSourceOAuth, RunnerConfigurationHostAuthenticationTokenGetResponseTokenSourceHostAuthenticationTokenSourcePat: - return true - } - return false -} - -type RunnerConfigurationHostAuthenticationTokenUpdateResponse = interface{} - -type RunnerConfigurationHostAuthenticationTokenListResponse struct { - ID string `json:"id"` - // 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. - ExpiresAt time.Time `json:"expiresAt" format:"date-time"` - Host string `json:"host"` - RunnerID string `json:"runnerId"` - Source RunnerConfigurationHostAuthenticationTokenListResponseSource `json:"source"` - UserID string `json:"userId"` - JSON runnerConfigurationHostAuthenticationTokenListResponseJSON `json:"-"` +type RunnerConfigurationHostAuthenticationTokenGetResponse struct { + Token HostAuthenticationToken `json:"token"` + JSON runnerConfigurationHostAuthenticationTokenGetResponseJSON `json:"-"` } -// runnerConfigurationHostAuthenticationTokenListResponseJSON contains the JSON -// metadata for the struct [RunnerConfigurationHostAuthenticationTokenListResponse] -type runnerConfigurationHostAuthenticationTokenListResponseJSON struct { - ID apijson.Field - ExpiresAt apijson.Field - Host apijson.Field - RunnerID apijson.Field - Source apijson.Field - UserID apijson.Field +// runnerConfigurationHostAuthenticationTokenGetResponseJSON contains the JSON +// metadata for the struct [RunnerConfigurationHostAuthenticationTokenGetResponse] +type runnerConfigurationHostAuthenticationTokenGetResponseJSON struct { + Token apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RunnerConfigurationHostAuthenticationTokenListResponse) UnmarshalJSON(data []byte) (err error) { +func (r *RunnerConfigurationHostAuthenticationTokenGetResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerConfigurationHostAuthenticationTokenListResponseJSON) RawJSON() string { +func (r runnerConfigurationHostAuthenticationTokenGetResponseJSON) RawJSON() string { return r.raw } -type RunnerConfigurationHostAuthenticationTokenListResponseSource string - -const ( - RunnerConfigurationHostAuthenticationTokenListResponseSourceHostAuthenticationTokenSourceUnspecified RunnerConfigurationHostAuthenticationTokenListResponseSource = "HOST_AUTHENTICATION_TOKEN_SOURCE_UNSPECIFIED" - RunnerConfigurationHostAuthenticationTokenListResponseSourceHostAuthenticationTokenSourceOAuth RunnerConfigurationHostAuthenticationTokenListResponseSource = "HOST_AUTHENTICATION_TOKEN_SOURCE_OAUTH" - RunnerConfigurationHostAuthenticationTokenListResponseSourceHostAuthenticationTokenSourcePat RunnerConfigurationHostAuthenticationTokenListResponseSource = "HOST_AUTHENTICATION_TOKEN_SOURCE_PAT" -) - -func (r RunnerConfigurationHostAuthenticationTokenListResponseSource) IsKnown() bool { - switch r { - case RunnerConfigurationHostAuthenticationTokenListResponseSourceHostAuthenticationTokenSourceUnspecified, RunnerConfigurationHostAuthenticationTokenListResponseSourceHostAuthenticationTokenSourceOAuth, RunnerConfigurationHostAuthenticationTokenListResponseSourceHostAuthenticationTokenSourcePat: - return true - } - return false -} +type RunnerConfigurationHostAuthenticationTokenUpdateResponse = interface{} type RunnerConfigurationHostAuthenticationTokenDeleteResponse = interface{} @@ -634,34 +362,18 @@ type RunnerConfigurationHostAuthenticationTokenNewParams struct { // Joda Time's // [`ISODateTimeFormat.dateTime()`]() // to obtain a formatter capable of generating timestamps in this format. - ExpiresAt param.Field[time.Time] `json:"expiresAt" format:"date-time"` - Host param.Field[string] `json:"host"` - RefreshToken param.Field[string] `json:"refreshToken"` - RunnerID param.Field[string] `json:"runnerId" format:"uuid"` - Source param.Field[RunnerConfigurationHostAuthenticationTokenNewParamsSource] `json:"source"` - UserID param.Field[string] `json:"userId" format:"uuid"` + ExpiresAt param.Field[time.Time] `json:"expiresAt" format:"date-time"` + Host param.Field[string] `json:"host"` + RefreshToken param.Field[string] `json:"refreshToken"` + RunnerID param.Field[string] `json:"runnerId" format:"uuid"` + Source param.Field[HostAuthenticationTokenSource] `json:"source"` + UserID param.Field[string] `json:"userId" format:"uuid"` } func (r RunnerConfigurationHostAuthenticationTokenNewParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type RunnerConfigurationHostAuthenticationTokenNewParamsSource string - -const ( - RunnerConfigurationHostAuthenticationTokenNewParamsSourceHostAuthenticationTokenSourceUnspecified RunnerConfigurationHostAuthenticationTokenNewParamsSource = "HOST_AUTHENTICATION_TOKEN_SOURCE_UNSPECIFIED" - RunnerConfigurationHostAuthenticationTokenNewParamsSourceHostAuthenticationTokenSourceOAuth RunnerConfigurationHostAuthenticationTokenNewParamsSource = "HOST_AUTHENTICATION_TOKEN_SOURCE_OAUTH" - RunnerConfigurationHostAuthenticationTokenNewParamsSourceHostAuthenticationTokenSourcePat RunnerConfigurationHostAuthenticationTokenNewParamsSource = "HOST_AUTHENTICATION_TOKEN_SOURCE_PAT" -) - -func (r RunnerConfigurationHostAuthenticationTokenNewParamsSource) IsKnown() bool { - switch r { - case RunnerConfigurationHostAuthenticationTokenNewParamsSourceHostAuthenticationTokenSourceUnspecified, RunnerConfigurationHostAuthenticationTokenNewParamsSourceHostAuthenticationTokenSourceOAuth, RunnerConfigurationHostAuthenticationTokenNewParamsSourceHostAuthenticationTokenSourcePat: - return true - } - return false -} - type RunnerConfigurationHostAuthenticationTokenGetParams struct { ID param.Field[string] `json:"id" format:"uuid"` } @@ -671,14 +383,7 @@ func (r RunnerConfigurationHostAuthenticationTokenGetParams) MarshalJSON() (data } type RunnerConfigurationHostAuthenticationTokenUpdateParams struct { - Body RunnerConfigurationHostAuthenticationTokenUpdateParamsBodyUnion `json:"body,required"` -} - -func (r RunnerConfigurationHostAuthenticationTokenUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - -type RunnerConfigurationHostAuthenticationTokenUpdateParamsBody struct { + ID param.Field[string] `json:"id" format:"uuid"` Token param.Field[string] `json:"token"` // A Timestamp represents a point in time independent of any time zone or local // calendar, encoded as a count of seconds and fractions of seconds at nanosecond @@ -772,148 +477,15 @@ type RunnerConfigurationHostAuthenticationTokenUpdateParamsBody struct { RefreshToken param.Field[string] `json:"refreshToken"` } -func (r RunnerConfigurationHostAuthenticationTokenUpdateParamsBody) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RunnerConfigurationHostAuthenticationTokenUpdateParamsBody) implementsRunnerConfigurationHostAuthenticationTokenUpdateParamsBodyUnion() { -} - -// Satisfied by -// [RunnerConfigurationHostAuthenticationTokenUpdateParamsBodyExpiresAt], -// [RunnerConfigurationHostAuthenticationTokenUpdateParamsBodyRefreshToken], -// [RunnerConfigurationHostAuthenticationTokenUpdateParamsBodyToken], -// [RunnerConfigurationHostAuthenticationTokenUpdateParamsBody]. -type RunnerConfigurationHostAuthenticationTokenUpdateParamsBodyUnion interface { - implementsRunnerConfigurationHostAuthenticationTokenUpdateParamsBodyUnion() -} - -type RunnerConfigurationHostAuthenticationTokenUpdateParamsBodyExpiresAt 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. - ExpiresAt param.Field[time.Time] `json:"expiresAt,required" format:"date-time"` -} - -func (r RunnerConfigurationHostAuthenticationTokenUpdateParamsBodyExpiresAt) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RunnerConfigurationHostAuthenticationTokenUpdateParamsBodyExpiresAt) implementsRunnerConfigurationHostAuthenticationTokenUpdateParamsBodyUnion() { -} - -type RunnerConfigurationHostAuthenticationTokenUpdateParamsBodyRefreshToken struct { - RefreshToken param.Field[string] `json:"refreshToken,required"` -} - -func (r RunnerConfigurationHostAuthenticationTokenUpdateParamsBodyRefreshToken) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RunnerConfigurationHostAuthenticationTokenUpdateParamsBodyRefreshToken) implementsRunnerConfigurationHostAuthenticationTokenUpdateParamsBodyUnion() { -} - -type RunnerConfigurationHostAuthenticationTokenUpdateParamsBodyToken struct { - Token param.Field[string] `json:"token,required"` -} - -func (r RunnerConfigurationHostAuthenticationTokenUpdateParamsBodyToken) MarshalJSON() (data []byte, err error) { +func (r RunnerConfigurationHostAuthenticationTokenUpdateParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r RunnerConfigurationHostAuthenticationTokenUpdateParamsBodyToken) implementsRunnerConfigurationHostAuthenticationTokenUpdateParamsBodyUnion() { -} - type RunnerConfigurationHostAuthenticationTokenListParams struct { - Token param.Field[string] `query:"token"` - PageSize param.Field[int64] `query:"pageSize"` - Filter param.Field[RunnerConfigurationHostAuthenticationTokenListParamsFilterUnion] `json:"filter"` - Pagination param.Field[RunnerConfigurationHostAuthenticationTokenListParamsPagination] `json:"pagination"` + Token param.Field[string] `query:"token"` + PageSize param.Field[int64] `query:"pageSize"` + Filter param.Field[RunnerConfigurationHostAuthenticationTokenListParamsFilter] `json:"filter"` + Pagination param.Field[RunnerConfigurationHostAuthenticationTokenListParamsPagination] `json:"pagination"` } func (r RunnerConfigurationHostAuthenticationTokenListParams) MarshalJSON() (data []byte, err error) { @@ -938,39 +510,6 @@ func (r RunnerConfigurationHostAuthenticationTokenListParamsFilter) MarshalJSON( return apijson.MarshalRoot(r) } -func (r RunnerConfigurationHostAuthenticationTokenListParamsFilter) implementsRunnerConfigurationHostAuthenticationTokenListParamsFilterUnion() { -} - -// Satisfied by -// [RunnerConfigurationHostAuthenticationTokenListParamsFilterRunnerID], -// [RunnerConfigurationHostAuthenticationTokenListParamsFilterUserID], -// [RunnerConfigurationHostAuthenticationTokenListParamsFilter]. -type RunnerConfigurationHostAuthenticationTokenListParamsFilterUnion interface { - implementsRunnerConfigurationHostAuthenticationTokenListParamsFilterUnion() -} - -type RunnerConfigurationHostAuthenticationTokenListParamsFilterRunnerID struct { - RunnerID param.Field[string] `json:"runnerId,required" format:"uuid"` -} - -func (r RunnerConfigurationHostAuthenticationTokenListParamsFilterRunnerID) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RunnerConfigurationHostAuthenticationTokenListParamsFilterRunnerID) implementsRunnerConfigurationHostAuthenticationTokenListParamsFilterUnion() { -} - -type RunnerConfigurationHostAuthenticationTokenListParamsFilterUserID struct { - UserID param.Field[string] `json:"userId,required" format:"uuid"` -} - -func (r RunnerConfigurationHostAuthenticationTokenListParamsFilterUserID) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RunnerConfigurationHostAuthenticationTokenListParamsFilterUserID) implementsRunnerConfigurationHostAuthenticationTokenListParamsFilterUnion() { -} - type RunnerConfigurationHostAuthenticationTokenListParamsPagination struct { // Token for the next set of results that was returned as next_token of a // PaginationResponse diff --git a/runnerconfigurationhostauthenticationtoken_test.go b/runnerconfigurationhostauthenticationtoken_test.go index 9731d52..eabffb4 100644 --- a/runnerconfigurationhostauthenticationtoken_test.go +++ b/runnerconfigurationhostauthenticationtoken_test.go @@ -33,7 +33,7 @@ func TestRunnerConfigurationHostAuthenticationTokenNewWithOptionalParams(t *test Host: gitpod.F("x"), RefreshToken: gitpod.F("refreshToken"), RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - Source: gitpod.F(gitpod.RunnerConfigurationHostAuthenticationTokenNewParamsSourceHostAuthenticationTokenSourceUnspecified), + Source: gitpod.F(gitpod.HostAuthenticationTokenSourceHostAuthenticationTokenSourceUnspecified), UserID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), }) if err != nil { @@ -70,7 +70,7 @@ func TestRunnerConfigurationHostAuthenticationTokenGetWithOptionalParams(t *test } } -func TestRunnerConfigurationHostAuthenticationTokenUpdate(t *testing.T) { +func TestRunnerConfigurationHostAuthenticationTokenUpdateWithOptionalParams(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 { @@ -84,9 +84,10 @@ func TestRunnerConfigurationHostAuthenticationTokenUpdate(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.Configurations.HostAuthenticationTokens.Update(context.TODO(), gitpod.RunnerConfigurationHostAuthenticationTokenUpdateParams{ - Body: gitpod.RunnerConfigurationHostAuthenticationTokenUpdateParamsBodyExpiresAt{ - ExpiresAt: gitpod.F(time.Now()), - }, + ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + Token: gitpod.F("x"), + ExpiresAt: gitpod.F(time.Now()), + RefreshToken: gitpod.F("refreshToken"), }) if err != nil { var apierr *gitpod.Error @@ -113,8 +114,9 @@ func TestRunnerConfigurationHostAuthenticationTokenListWithOptionalParams(t *tes _, err := client.Runners.Configurations.HostAuthenticationTokens.List(context.TODO(), gitpod.RunnerConfigurationHostAuthenticationTokenListParams{ Token: gitpod.F("token"), PageSize: gitpod.F(int64(0)), - Filter: gitpod.F[gitpod.RunnerConfigurationHostAuthenticationTokenListParamsFilterUnion](gitpod.RunnerConfigurationHostAuthenticationTokenListParamsFilterRunnerID{ + Filter: gitpod.F(gitpod.RunnerConfigurationHostAuthenticationTokenListParamsFilter{ RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + UserID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), }), Pagination: gitpod.F(gitpod.RunnerConfigurationHostAuthenticationTokenListParamsPagination{ Token: gitpod.F("token"), diff --git a/runnerconfigurationschema.go b/runnerconfigurationschema.go index 31a9692..c98e088 100644 --- a/runnerconfigurationschema.go +++ b/runnerconfigurationschema.go @@ -5,13 +5,11 @@ package gitpod import ( "context" "net/http" - "reflect" "github.com/gitpod-io/flex-sdk-go/internal/apijson" "github.com/gitpod-io/flex-sdk-go/internal/param" "github.com/gitpod-io/flex-sdk-go/internal/requestconfig" "github.com/gitpod-io/flex-sdk-go/option" - "github.com/tidwall/gjson" ) // RunnerConfigurationSchemaService contains methods and other services that help @@ -41,39 +39,18 @@ func (r *RunnerConfigurationSchemaService) Get(ctx context.Context, body RunnerC return } -type RunnerConfigurationSchemaGetResponse struct { - Schema RunnerConfigurationSchemaGetResponseSchema `json:"schema"` - JSON runnerConfigurationSchemaGetResponseJSON `json:"-"` -} - -// runnerConfigurationSchemaGetResponseJSON contains the JSON metadata for the -// struct [RunnerConfigurationSchemaGetResponse] -type runnerConfigurationSchemaGetResponseJSON struct { - Schema apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerConfigurationSchemaGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerConfigurationSchemaGetResponseJSON) RawJSON() string { - return r.raw -} - -type RunnerConfigurationSchemaGetResponseSchema struct { - EnvironmentClasses []RunnerConfigurationSchemaGetResponseSchemaEnvironmentClass `json:"environmentClasses"` - RunnerConfig []RunnerConfigurationSchemaGetResponseSchemaRunnerConfig `json:"runnerConfig"` - Scm []RunnerConfigurationSchemaGetResponseSchemaScm `json:"scm"` +type RunnerConfigurationSchema struct { + EnvironmentClasses []RunnerConfigurationSchemaEnvironmentClass `json:"environmentClasses"` + RunnerConfig []RunnerConfigurationSchemaRunnerConfig `json:"runnerConfig"` + Scm []RunnerConfigurationSchemaScm `json:"scm"` // The schema version - Version string `json:"version"` - JSON runnerConfigurationSchemaGetResponseSchemaJSON `json:"-"` + Version string `json:"version"` + JSON runnerConfigurationSchemaJSON `json:"-"` } -// runnerConfigurationSchemaGetResponseSchemaJSON contains the JSON metadata for -// the struct [RunnerConfigurationSchemaGetResponseSchema] -type runnerConfigurationSchemaGetResponseSchemaJSON struct { +// runnerConfigurationSchemaJSON contains the JSON metadata for the struct +// [RunnerConfigurationSchema] +type runnerConfigurationSchemaJSON struct { EnvironmentClasses apijson.Field RunnerConfig apijson.Field Scm apijson.Field @@ -82,43 +59,31 @@ type runnerConfigurationSchemaGetResponseSchemaJSON struct { ExtraFields map[string]apijson.Field } -func (r *RunnerConfigurationSchemaGetResponseSchema) UnmarshalJSON(data []byte) (err error) { +func (r *RunnerConfigurationSchema) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerConfigurationSchemaGetResponseSchemaJSON) RawJSON() string { +func (r runnerConfigurationSchemaJSON) RawJSON() string { return r.raw } -type RunnerConfigurationSchemaGetResponseSchemaEnvironmentClass struct { - ID string `json:"id"` - // This field can have the runtime type of - // [RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObjectBool]. - Bool interface{} `json:"bool"` - Description string `json:"description"` - // This field can have the runtime type of - // [RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObjectDisplay]. - Display interface{} `json:"display"` - // This field can have the runtime type of - // [RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObjectEnum]. - Enum interface{} `json:"enum"` - // This field can have the runtime type of - // [RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObjectInt]. - Int interface{} `json:"int"` - Name string `json:"name"` - Required bool `json:"required"` - Secret bool `json:"secret"` - // This field can have the runtime type of - // [RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObjectString]. - String interface{} `json:"string"` - JSON runnerConfigurationSchemaGetResponseSchemaEnvironmentClassJSON `json:"-"` - union RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesUnion -} - -// runnerConfigurationSchemaGetResponseSchemaEnvironmentClassJSON contains the JSON -// metadata for the struct -// [RunnerConfigurationSchemaGetResponseSchemaEnvironmentClass] -type runnerConfigurationSchemaGetResponseSchemaEnvironmentClassJSON struct { +type RunnerConfigurationSchemaEnvironmentClass struct { + ID string `json:"id"` + Bool RunnerConfigurationSchemaEnvironmentClassesBool `json:"bool"` + Description string `json:"description"` + Display RunnerConfigurationSchemaEnvironmentClassesDisplay `json:"display"` + Enum RunnerConfigurationSchemaEnvironmentClassesEnum `json:"enum"` + Int RunnerConfigurationSchemaEnvironmentClassesInt `json:"int"` + Name string `json:"name"` + Required bool `json:"required"` + Secret bool `json:"secret"` + String RunnerConfigurationSchemaEnvironmentClassesString `json:"string"` + JSON runnerConfigurationSchemaEnvironmentClassJSON `json:"-"` +} + +// runnerConfigurationSchemaEnvironmentClassJSON contains the JSON metadata for the +// struct [RunnerConfigurationSchemaEnvironmentClass] +type runnerConfigurationSchemaEnvironmentClassJSON struct { ID apijson.Field Bool apijson.Field Description apijson.Field @@ -133,155 +98,144 @@ type runnerConfigurationSchemaGetResponseSchemaEnvironmentClassJSON struct { ExtraFields map[string]apijson.Field } -func (r runnerConfigurationSchemaGetResponseSchemaEnvironmentClassJSON) RawJSON() string { +func (r *RunnerConfigurationSchemaEnvironmentClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r runnerConfigurationSchemaEnvironmentClassJSON) RawJSON() string { return r.raw } -func (r *RunnerConfigurationSchemaGetResponseSchemaEnvironmentClass) UnmarshalJSON(data []byte) (err error) { - *r = RunnerConfigurationSchemaGetResponseSchemaEnvironmentClass{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) +type RunnerConfigurationSchemaEnvironmentClassesBool struct { + Default bool `json:"default"` + JSON runnerConfigurationSchemaEnvironmentClassesBoolJSON `json:"-"` } -// AsUnion returns a -// [RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesUnion] interface -// which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObject], -// [RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObject], -// [RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObject], -// [RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObject], -// [RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObject]. -func (r RunnerConfigurationSchemaGetResponseSchemaEnvironmentClass) AsUnion() RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesUnion { - return r.union -} - -// Union satisfied by -// [RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObject], -// [RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObject], -// [RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObject], -// [RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObject] or -// [RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObject]. -type RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesUnion interface { - implementsRunnerConfigurationSchemaGetResponseSchemaEnvironmentClass() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObject{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObject{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObject{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObject{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObject{}), - }, - ) -} - -type RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObject struct { - Bool RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObjectBool `json:"bool,required"` - ID string `json:"id"` - Description string `json:"description"` - Name string `json:"name"` - Required bool `json:"required"` - Secret bool `json:"secret"` - JSON runnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObjectJSON `json:"-"` -} - -// runnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObjectJSON contains -// the JSON metadata for the struct -// [RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObject] -type runnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObjectJSON struct { - Bool apijson.Field - ID apijson.Field - Description apijson.Field - Name apijson.Field - Required apijson.Field - Secret apijson.Field +// runnerConfigurationSchemaEnvironmentClassesBoolJSON contains the JSON metadata +// for the struct [RunnerConfigurationSchemaEnvironmentClassesBool] +type runnerConfigurationSchemaEnvironmentClassesBoolJSON struct { + Default apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObject) UnmarshalJSON(data []byte) (err error) { +func (r *RunnerConfigurationSchemaEnvironmentClassesBool) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObjectJSON) RawJSON() string { +func (r runnerConfigurationSchemaEnvironmentClassesBoolJSON) RawJSON() string { return r.raw } -func (r RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObject) implementsRunnerConfigurationSchemaGetResponseSchemaEnvironmentClass() { +type RunnerConfigurationSchemaEnvironmentClassesDisplay struct { + Default string `json:"default"` + JSON runnerConfigurationSchemaEnvironmentClassesDisplayJSON `json:"-"` +} + +// runnerConfigurationSchemaEnvironmentClassesDisplayJSON contains the JSON +// metadata for the struct [RunnerConfigurationSchemaEnvironmentClassesDisplay] +type runnerConfigurationSchemaEnvironmentClassesDisplayJSON struct { + Default apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RunnerConfigurationSchemaEnvironmentClassesDisplay) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r runnerConfigurationSchemaEnvironmentClassesDisplayJSON) RawJSON() string { + return r.raw +} + +type RunnerConfigurationSchemaEnvironmentClassesEnum struct { + Default string `json:"default"` + Values []string `json:"values"` + JSON runnerConfigurationSchemaEnvironmentClassesEnumJSON `json:"-"` +} + +// runnerConfigurationSchemaEnvironmentClassesEnumJSON contains the JSON metadata +// for the struct [RunnerConfigurationSchemaEnvironmentClassesEnum] +type runnerConfigurationSchemaEnvironmentClassesEnumJSON struct { + Default apijson.Field + Values apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RunnerConfigurationSchemaEnvironmentClassesEnum) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r runnerConfigurationSchemaEnvironmentClassesEnumJSON) RawJSON() string { + return r.raw +} + +type RunnerConfigurationSchemaEnvironmentClassesInt struct { + Default int64 `json:"default"` + Max int64 `json:"max"` + Min int64 `json:"min"` + JSON runnerConfigurationSchemaEnvironmentClassesIntJSON `json:"-"` +} + +// runnerConfigurationSchemaEnvironmentClassesIntJSON contains the JSON metadata +// for the struct [RunnerConfigurationSchemaEnvironmentClassesInt] +type runnerConfigurationSchemaEnvironmentClassesIntJSON struct { + Default apijson.Field + Max apijson.Field + Min apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RunnerConfigurationSchemaEnvironmentClassesInt) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r runnerConfigurationSchemaEnvironmentClassesIntJSON) RawJSON() string { + return r.raw } -type RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObjectBool struct { - Default bool `json:"default"` - JSON runnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObjectBoolJSON `json:"-"` +type RunnerConfigurationSchemaEnvironmentClassesString struct { + Default string `json:"default"` + Pattern string `json:"pattern"` + JSON runnerConfigurationSchemaEnvironmentClassesStringJSON `json:"-"` } -// runnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObjectBoolJSON -// contains the JSON metadata for the struct -// [RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObjectBool] -type runnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObjectBoolJSON struct { +// runnerConfigurationSchemaEnvironmentClassesStringJSON contains the JSON metadata +// for the struct [RunnerConfigurationSchemaEnvironmentClassesString] +type runnerConfigurationSchemaEnvironmentClassesStringJSON struct { Default apijson.Field + Pattern apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RunnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObjectBool) UnmarshalJSON(data []byte) (err error) { +func (r *RunnerConfigurationSchemaEnvironmentClassesString) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerConfigurationSchemaGetResponseSchemaEnvironmentClassesObjectBoolJSON) RawJSON() string { +func (r runnerConfigurationSchemaEnvironmentClassesStringJSON) RawJSON() string { return r.raw } -type RunnerConfigurationSchemaGetResponseSchemaRunnerConfig struct { - ID string `json:"id"` - // This field can have the runtime type of - // [RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObjectBool]. - Bool interface{} `json:"bool"` - Description string `json:"description"` - // This field can have the runtime type of - // [RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObjectDisplay]. - Display interface{} `json:"display"` - // This field can have the runtime type of - // [RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObjectEnum]. - Enum interface{} `json:"enum"` - // This field can have the runtime type of - // [RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObjectInt]. - Int interface{} `json:"int"` - Name string `json:"name"` - Required bool `json:"required"` - Secret bool `json:"secret"` - // This field can have the runtime type of - // [RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObjectString]. - String interface{} `json:"string"` - JSON runnerConfigurationSchemaGetResponseSchemaRunnerConfigJSON `json:"-"` - union RunnerConfigurationSchemaGetResponseSchemaRunnerConfigUnion -} - -// runnerConfigurationSchemaGetResponseSchemaRunnerConfigJSON contains the JSON -// metadata for the struct [RunnerConfigurationSchemaGetResponseSchemaRunnerConfig] -type runnerConfigurationSchemaGetResponseSchemaRunnerConfigJSON struct { +type RunnerConfigurationSchemaRunnerConfig struct { + ID string `json:"id"` + Bool RunnerConfigurationSchemaRunnerConfigBool `json:"bool"` + Description string `json:"description"` + Display RunnerConfigurationSchemaRunnerConfigDisplay `json:"display"` + Enum RunnerConfigurationSchemaRunnerConfigEnum `json:"enum"` + Int RunnerConfigurationSchemaRunnerConfigInt `json:"int"` + Name string `json:"name"` + Required bool `json:"required"` + Secret bool `json:"secret"` + String RunnerConfigurationSchemaRunnerConfigString `json:"string"` + JSON runnerConfigurationSchemaRunnerConfigJSON `json:"-"` +} + +// runnerConfigurationSchemaRunnerConfigJSON contains the JSON metadata for the +// struct [RunnerConfigurationSchemaRunnerConfig] +type runnerConfigurationSchemaRunnerConfigJSON struct { ID apijson.Field Bool apijson.Field Description apijson.Field @@ -296,138 +250,139 @@ type runnerConfigurationSchemaGetResponseSchemaRunnerConfigJSON struct { ExtraFields map[string]apijson.Field } -func (r runnerConfigurationSchemaGetResponseSchemaRunnerConfigJSON) RawJSON() string { +func (r *RunnerConfigurationSchemaRunnerConfig) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r runnerConfigurationSchemaRunnerConfigJSON) RawJSON() string { return r.raw } -func (r *RunnerConfigurationSchemaGetResponseSchemaRunnerConfig) UnmarshalJSON(data []byte) (err error) { - *r = RunnerConfigurationSchemaGetResponseSchemaRunnerConfig{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) +type RunnerConfigurationSchemaRunnerConfigBool struct { + Default bool `json:"default"` + JSON runnerConfigurationSchemaRunnerConfigBoolJSON `json:"-"` } -// AsUnion returns a [RunnerConfigurationSchemaGetResponseSchemaRunnerConfigUnion] -// interface which you can cast to the specific types for more type safety. -// -// Possible runtime types of the union are -// [RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObject], -// [RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObject], -// [RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObject], -// [RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObject], -// [RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObject]. -func (r RunnerConfigurationSchemaGetResponseSchemaRunnerConfig) AsUnion() RunnerConfigurationSchemaGetResponseSchemaRunnerConfigUnion { - return r.union -} - -// Union satisfied by -// [RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObject], -// [RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObject], -// [RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObject], -// [RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObject] or -// [RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObject]. -type RunnerConfigurationSchemaGetResponseSchemaRunnerConfigUnion interface { - implementsRunnerConfigurationSchemaGetResponseSchemaRunnerConfig() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RunnerConfigurationSchemaGetResponseSchemaRunnerConfigUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObject{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObject{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObject{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObject{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObject{}), - }, - ) -} - -type RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObject struct { - Bool RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObjectBool `json:"bool,required"` - ID string `json:"id"` - Description string `json:"description"` - Name string `json:"name"` - Required bool `json:"required"` - Secret bool `json:"secret"` - JSON runnerConfigurationSchemaGetResponseSchemaRunnerConfigObjectJSON `json:"-"` -} - -// runnerConfigurationSchemaGetResponseSchemaRunnerConfigObjectJSON contains the -// JSON metadata for the struct -// [RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObject] -type runnerConfigurationSchemaGetResponseSchemaRunnerConfigObjectJSON struct { - Bool apijson.Field - ID apijson.Field - Description apijson.Field - Name apijson.Field - Required apijson.Field - Secret apijson.Field +// runnerConfigurationSchemaRunnerConfigBoolJSON contains the JSON metadata for the +// struct [RunnerConfigurationSchemaRunnerConfigBool] +type runnerConfigurationSchemaRunnerConfigBoolJSON struct { + Default apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObject) UnmarshalJSON(data []byte) (err error) { +func (r *RunnerConfigurationSchemaRunnerConfigBool) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerConfigurationSchemaGetResponseSchemaRunnerConfigObjectJSON) RawJSON() string { +func (r runnerConfigurationSchemaRunnerConfigBoolJSON) RawJSON() string { return r.raw } -func (r RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObject) implementsRunnerConfigurationSchemaGetResponseSchemaRunnerConfig() { +type RunnerConfigurationSchemaRunnerConfigDisplay struct { + Default string `json:"default"` + JSON runnerConfigurationSchemaRunnerConfigDisplayJSON `json:"-"` } -type RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObjectBool struct { - Default bool `json:"default"` - JSON runnerConfigurationSchemaGetResponseSchemaRunnerConfigObjectBoolJSON `json:"-"` +// runnerConfigurationSchemaRunnerConfigDisplayJSON contains the JSON metadata for +// the struct [RunnerConfigurationSchemaRunnerConfigDisplay] +type runnerConfigurationSchemaRunnerConfigDisplayJSON struct { + Default apijson.Field + raw string + ExtraFields map[string]apijson.Field } -// runnerConfigurationSchemaGetResponseSchemaRunnerConfigObjectBoolJSON contains -// the JSON metadata for the struct -// [RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObjectBool] -type runnerConfigurationSchemaGetResponseSchemaRunnerConfigObjectBoolJSON struct { +func (r *RunnerConfigurationSchemaRunnerConfigDisplay) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r runnerConfigurationSchemaRunnerConfigDisplayJSON) RawJSON() string { + return r.raw +} + +type RunnerConfigurationSchemaRunnerConfigEnum struct { + Default string `json:"default"` + Values []string `json:"values"` + JSON runnerConfigurationSchemaRunnerConfigEnumJSON `json:"-"` +} + +// runnerConfigurationSchemaRunnerConfigEnumJSON contains the JSON metadata for the +// struct [RunnerConfigurationSchemaRunnerConfigEnum] +type runnerConfigurationSchemaRunnerConfigEnumJSON struct { Default apijson.Field + Values apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RunnerConfigurationSchemaGetResponseSchemaRunnerConfigObjectBool) UnmarshalJSON(data []byte) (err error) { +func (r *RunnerConfigurationSchemaRunnerConfigEnum) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerConfigurationSchemaGetResponseSchemaRunnerConfigObjectBoolJSON) RawJSON() string { +func (r runnerConfigurationSchemaRunnerConfigEnumJSON) RawJSON() string { return r.raw } -type RunnerConfigurationSchemaGetResponseSchemaScm struct { - DefaultHosts []string `json:"defaultHosts"` - Name string `json:"name"` - OAuth RunnerConfigurationSchemaGetResponseSchemaScmOAuth `json:"oauth"` - Pat RunnerConfigurationSchemaGetResponseSchemaScmPat `json:"pat"` - ScmID string `json:"scmId"` - JSON runnerConfigurationSchemaGetResponseSchemaScmJSON `json:"-"` +type RunnerConfigurationSchemaRunnerConfigInt struct { + Default int64 `json:"default"` + Max int64 `json:"max"` + Min int64 `json:"min"` + JSON runnerConfigurationSchemaRunnerConfigIntJSON `json:"-"` +} + +// runnerConfigurationSchemaRunnerConfigIntJSON contains the JSON metadata for the +// struct [RunnerConfigurationSchemaRunnerConfigInt] +type runnerConfigurationSchemaRunnerConfigIntJSON struct { + Default apijson.Field + Max apijson.Field + Min apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RunnerConfigurationSchemaRunnerConfigInt) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r runnerConfigurationSchemaRunnerConfigIntJSON) RawJSON() string { + return r.raw } -// runnerConfigurationSchemaGetResponseSchemaScmJSON contains the JSON metadata for -// the struct [RunnerConfigurationSchemaGetResponseSchemaScm] -type runnerConfigurationSchemaGetResponseSchemaScmJSON struct { +type RunnerConfigurationSchemaRunnerConfigString struct { + Default string `json:"default"` + Pattern string `json:"pattern"` + JSON runnerConfigurationSchemaRunnerConfigStringJSON `json:"-"` +} + +// runnerConfigurationSchemaRunnerConfigStringJSON contains the JSON metadata for +// the struct [RunnerConfigurationSchemaRunnerConfigString] +type runnerConfigurationSchemaRunnerConfigStringJSON struct { + Default apijson.Field + Pattern apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RunnerConfigurationSchemaRunnerConfigString) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r runnerConfigurationSchemaRunnerConfigStringJSON) RawJSON() string { + return r.raw +} + +type RunnerConfigurationSchemaScm struct { + DefaultHosts []string `json:"defaultHosts"` + Name string `json:"name"` + OAuth RunnerConfigurationSchemaScmOAuth `json:"oauth"` + Pat RunnerConfigurationSchemaScmPat `json:"pat"` + ScmID string `json:"scmId"` + JSON runnerConfigurationSchemaScmJSON `json:"-"` +} + +// runnerConfigurationSchemaScmJSON contains the JSON metadata for the struct +// [RunnerConfigurationSchemaScm] +type runnerConfigurationSchemaScmJSON struct { DefaultHosts apijson.Field Name apijson.Field OAuth apijson.Field @@ -437,60 +392,81 @@ type runnerConfigurationSchemaGetResponseSchemaScmJSON struct { ExtraFields map[string]apijson.Field } -func (r *RunnerConfigurationSchemaGetResponseSchemaScm) UnmarshalJSON(data []byte) (err error) { +func (r *RunnerConfigurationSchemaScm) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerConfigurationSchemaGetResponseSchemaScmJSON) RawJSON() string { +func (r runnerConfigurationSchemaScmJSON) RawJSON() string { return r.raw } -type RunnerConfigurationSchemaGetResponseSchemaScmOAuth struct { +type RunnerConfigurationSchemaScmOAuth struct { // callback_url is the URL the OAuth app will redirect to after the user has // authenticated. - CallbackURL string `json:"callbackUrl"` - JSON runnerConfigurationSchemaGetResponseSchemaScmOAuthJSON `json:"-"` + CallbackURL string `json:"callbackUrl"` + JSON runnerConfigurationSchemaScmOAuthJSON `json:"-"` } -// runnerConfigurationSchemaGetResponseSchemaScmOAuthJSON contains the JSON -// metadata for the struct [RunnerConfigurationSchemaGetResponseSchemaScmOAuth] -type runnerConfigurationSchemaGetResponseSchemaScmOAuthJSON struct { +// runnerConfigurationSchemaScmOAuthJSON contains the JSON metadata for the struct +// [RunnerConfigurationSchemaScmOAuth] +type runnerConfigurationSchemaScmOAuthJSON struct { CallbackURL apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RunnerConfigurationSchemaGetResponseSchemaScmOAuth) UnmarshalJSON(data []byte) (err error) { +func (r *RunnerConfigurationSchemaScmOAuth) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerConfigurationSchemaGetResponseSchemaScmOAuthJSON) RawJSON() string { +func (r runnerConfigurationSchemaScmOAuthJSON) RawJSON() string { return r.raw } -type RunnerConfigurationSchemaGetResponseSchemaScmPat struct { +type RunnerConfigurationSchemaScmPat struct { // description is a human-readable description of the PAT. Description string `json:"description"` // docs_link is a link to the documentation on how to create a PAT for this SCM // system. - DocsLink string `json:"docsLink"` - JSON runnerConfigurationSchemaGetResponseSchemaScmPatJSON `json:"-"` + DocsLink string `json:"docsLink"` + JSON runnerConfigurationSchemaScmPatJSON `json:"-"` } -// runnerConfigurationSchemaGetResponseSchemaScmPatJSON contains the JSON metadata -// for the struct [RunnerConfigurationSchemaGetResponseSchemaScmPat] -type runnerConfigurationSchemaGetResponseSchemaScmPatJSON struct { +// runnerConfigurationSchemaScmPatJSON contains the JSON metadata for the struct +// [RunnerConfigurationSchemaScmPat] +type runnerConfigurationSchemaScmPatJSON struct { Description apijson.Field DocsLink apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RunnerConfigurationSchemaGetResponseSchemaScmPat) UnmarshalJSON(data []byte) (err error) { +func (r *RunnerConfigurationSchemaScmPat) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r runnerConfigurationSchemaScmPatJSON) RawJSON() string { + return r.raw +} + +type RunnerConfigurationSchemaGetResponse struct { + Schema RunnerConfigurationSchema `json:"schema"` + JSON runnerConfigurationSchemaGetResponseJSON `json:"-"` +} + +// runnerConfigurationSchemaGetResponseJSON contains the JSON metadata for the +// struct [RunnerConfigurationSchemaGetResponse] +type runnerConfigurationSchemaGetResponseJSON struct { + Schema apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RunnerConfigurationSchemaGetResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerConfigurationSchemaGetResponseSchemaScmPatJSON) RawJSON() string { +func (r runnerConfigurationSchemaGetResponseJSON) RawJSON() string { return r.raw } diff --git a/runnerconfigurationscmintegration.go b/runnerconfigurationscmintegration.go index 0a37302..70f3867 100644 --- a/runnerconfigurationscmintegration.go +++ b/runnerconfigurationscmintegration.go @@ -59,7 +59,7 @@ func (r *RunnerConfigurationScmIntegrationService) Update(ctx context.Context, b } // ListSCMIntegrations returns all SCM integrations configured for a runner. -func (r *RunnerConfigurationScmIntegrationService) List(ctx context.Context, params RunnerConfigurationScmIntegrationListParams, opts ...option.RequestOption) (res *pagination.IntegrationsPage[RunnerConfigurationScmIntegrationListResponse], err error) { +func (r *RunnerConfigurationScmIntegrationService) List(ctx context.Context, params RunnerConfigurationScmIntegrationListParams, opts ...option.RequestOption) (res *pagination.IntegrationsPage[ScmIntegration], err error) { var raw *http.Response opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -77,7 +77,7 @@ func (r *RunnerConfigurationScmIntegrationService) List(ctx context.Context, par } // ListSCMIntegrations returns all SCM integrations configured for a runner. -func (r *RunnerConfigurationScmIntegrationService) ListAutoPaging(ctx context.Context, params RunnerConfigurationScmIntegrationListParams, opts ...option.RequestOption) *pagination.IntegrationsPageAutoPager[RunnerConfigurationScmIntegrationListResponse] { +func (r *RunnerConfigurationScmIntegrationService) ListAutoPaging(ctx context.Context, params RunnerConfigurationScmIntegrationListParams, opts ...option.RequestOption) *pagination.IntegrationsPageAutoPager[ScmIntegration] { return pagination.NewIntegrationsPageAutoPager(r.List(ctx, params, opts...)) } @@ -89,220 +89,131 @@ func (r *RunnerConfigurationScmIntegrationService) Delete(ctx context.Context, b return } -type RunnerConfigurationScmIntegrationNewResponse struct { - // id is a uniquely generated identifier for the SCM integration - ID string `json:"id" format:"uuid"` - JSON runnerConfigurationScmIntegrationNewResponseJSON `json:"-"` +type ScmIntegration struct { + // id is the unique identifier of the SCM integration + ID string `json:"id"` + Host string `json:"host"` + OAuth ScmIntegrationOAuthConfig `json:"oauth,nullable"` + Pat bool `json:"pat"` + RunnerID string `json:"runnerId"` + // scm_id references the scm_id in the runner's configuration schema that this + // integration is for + ScmID string `json:"scmId"` + JSON scmIntegrationJSON `json:"-"` } -// runnerConfigurationScmIntegrationNewResponseJSON contains the JSON metadata for -// the struct [RunnerConfigurationScmIntegrationNewResponse] -type runnerConfigurationScmIntegrationNewResponseJSON struct { +// scmIntegrationJSON contains the JSON metadata for the struct [ScmIntegration] +type scmIntegrationJSON struct { ID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerConfigurationScmIntegrationNewResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerConfigurationScmIntegrationNewResponseJSON) RawJSON() string { - return r.raw -} - -type RunnerConfigurationScmIntegrationGetResponse struct { - Integration RunnerConfigurationScmIntegrationGetResponseIntegration `json:"integration"` - JSON runnerConfigurationScmIntegrationGetResponseJSON `json:"-"` -} - -// runnerConfigurationScmIntegrationGetResponseJSON contains the JSON metadata for -// the struct [RunnerConfigurationScmIntegrationGetResponse] -type runnerConfigurationScmIntegrationGetResponseJSON struct { - Integration apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerConfigurationScmIntegrationGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerConfigurationScmIntegrationGetResponseJSON) RawJSON() string { - return r.raw -} - -type RunnerConfigurationScmIntegrationGetResponseIntegration struct { - OAuth RunnerConfigurationScmIntegrationGetResponseIntegrationOAuth `json:"oauth,required"` - JSON runnerConfigurationScmIntegrationGetResponseIntegrationJSON `json:"-"` -} - -// runnerConfigurationScmIntegrationGetResponseIntegrationJSON contains the JSON -// metadata for the struct -// [RunnerConfigurationScmIntegrationGetResponseIntegration] -type runnerConfigurationScmIntegrationGetResponseIntegrationJSON struct { + Host apijson.Field OAuth apijson.Field + Pat apijson.Field + RunnerID apijson.Field + ScmID apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RunnerConfigurationScmIntegrationGetResponseIntegration) UnmarshalJSON(data []byte) (err error) { +func (r *ScmIntegration) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerConfigurationScmIntegrationGetResponseIntegrationJSON) RawJSON() string { +func (r scmIntegrationJSON) RawJSON() string { return r.raw } -type RunnerConfigurationScmIntegrationGetResponseIntegrationOAuth struct { +type ScmIntegrationOAuthConfig struct { // client_id is the OAuth app's client ID in clear text. ClientID string `json:"clientId"` // encrypted_client_secret is the OAuth app's secret encrypted with the runner's // public key. - EncryptedClientSecret string `json:"encryptedClientSecret" format:"byte"` - JSON runnerConfigurationScmIntegrationGetResponseIntegrationOAuthJSON `json:"-"` + EncryptedClientSecret string `json:"encryptedClientSecret" format:"byte"` + JSON scmIntegrationOAuthConfigJSON `json:"-"` } -// runnerConfigurationScmIntegrationGetResponseIntegrationOAuthJSON contains the -// JSON metadata for the struct -// [RunnerConfigurationScmIntegrationGetResponseIntegrationOAuth] -type runnerConfigurationScmIntegrationGetResponseIntegrationOAuthJSON struct { +// scmIntegrationOAuthConfigJSON contains the JSON metadata for the struct +// [ScmIntegrationOAuthConfig] +type scmIntegrationOAuthConfigJSON struct { ClientID apijson.Field EncryptedClientSecret apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RunnerConfigurationScmIntegrationGetResponseIntegrationOAuth) UnmarshalJSON(data []byte) (err error) { +func (r *ScmIntegrationOAuthConfig) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerConfigurationScmIntegrationGetResponseIntegrationOAuthJSON) RawJSON() string { +func (r scmIntegrationOAuthConfigJSON) RawJSON() string { return r.raw } -type RunnerConfigurationScmIntegrationUpdateResponse = interface{} - -type RunnerConfigurationScmIntegrationListResponse struct { - OAuth RunnerConfigurationScmIntegrationListResponseOAuth `json:"oauth,required"` - // id is the unique identifier of the SCM integration - ID string `json:"id"` - Host string `json:"host"` - Pat bool `json:"pat"` - RunnerID string `json:"runnerId"` - // scm_id references the scm_id in the runner's configuration schema that this - // integration is for - ScmID string `json:"scmId"` - JSON runnerConfigurationScmIntegrationListResponseJSON `json:"-"` +type RunnerConfigurationScmIntegrationNewResponse struct { + // id is a uniquely generated identifier for the SCM integration + ID string `json:"id" format:"uuid"` + JSON runnerConfigurationScmIntegrationNewResponseJSON `json:"-"` } -// runnerConfigurationScmIntegrationListResponseJSON contains the JSON metadata for -// the struct [RunnerConfigurationScmIntegrationListResponse] -type runnerConfigurationScmIntegrationListResponseJSON struct { - OAuth apijson.Field +// runnerConfigurationScmIntegrationNewResponseJSON contains the JSON metadata for +// the struct [RunnerConfigurationScmIntegrationNewResponse] +type runnerConfigurationScmIntegrationNewResponseJSON struct { ID apijson.Field - Host apijson.Field - Pat apijson.Field - RunnerID apijson.Field - ScmID apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RunnerConfigurationScmIntegrationListResponse) UnmarshalJSON(data []byte) (err error) { +func (r *RunnerConfigurationScmIntegrationNewResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerConfigurationScmIntegrationListResponseJSON) RawJSON() string { +func (r runnerConfigurationScmIntegrationNewResponseJSON) RawJSON() string { return r.raw } -type RunnerConfigurationScmIntegrationListResponseOAuth struct { - // client_id is the OAuth app's client ID in clear text. - ClientID string `json:"clientId"` - // encrypted_client_secret is the OAuth app's secret encrypted with the runner's - // public key. - EncryptedClientSecret string `json:"encryptedClientSecret" format:"byte"` - JSON runnerConfigurationScmIntegrationListResponseOAuthJSON `json:"-"` +type RunnerConfigurationScmIntegrationGetResponse struct { + Integration ScmIntegration `json:"integration"` + JSON runnerConfigurationScmIntegrationGetResponseJSON `json:"-"` } -// runnerConfigurationScmIntegrationListResponseOAuthJSON contains the JSON -// metadata for the struct [RunnerConfigurationScmIntegrationListResponseOAuth] -type runnerConfigurationScmIntegrationListResponseOAuthJSON struct { - ClientID apijson.Field - EncryptedClientSecret apijson.Field - raw string - ExtraFields map[string]apijson.Field +// runnerConfigurationScmIntegrationGetResponseJSON contains the JSON metadata for +// the struct [RunnerConfigurationScmIntegrationGetResponse] +type runnerConfigurationScmIntegrationGetResponseJSON struct { + Integration apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *RunnerConfigurationScmIntegrationListResponseOAuth) UnmarshalJSON(data []byte) (err error) { +func (r *RunnerConfigurationScmIntegrationGetResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerConfigurationScmIntegrationListResponseOAuthJSON) RawJSON() string { +func (r runnerConfigurationScmIntegrationGetResponseJSON) RawJSON() string { return r.raw } +type RunnerConfigurationScmIntegrationUpdateResponse = interface{} + type RunnerConfigurationScmIntegrationDeleteResponse = interface{} type RunnerConfigurationScmIntegrationNewParams struct { - Body RunnerConfigurationScmIntegrationNewParamsBodyUnion `json:"body,required"` -} - -func (r RunnerConfigurationScmIntegrationNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - -type RunnerConfigurationScmIntegrationNewParamsBody struct { + Host param.Field[string] `json:"host"` // oauth_client_id is the OAuth app's client ID, if OAuth is configured. If // configured, oauth_plaintext_client_secret must also be set. OAuthClientID param.Field[string] `json:"oauthClientId"` // oauth_plaintext_client_secret is the OAuth app's client secret in clear text. // This will first be encrypted with the runner's public key before being stored. OAuthPlaintextClientSecret param.Field[string] `json:"oauthPlaintextClientSecret"` + Pat param.Field[bool] `json:"pat"` + RunnerID param.Field[string] `json:"runnerId" format:"uuid"` + // scm_id references the scm_id in the runner's configuration schema that this + // integration is for + ScmID param.Field[string] `json:"scmId"` } -func (r RunnerConfigurationScmIntegrationNewParamsBody) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RunnerConfigurationScmIntegrationNewParamsBody) implementsRunnerConfigurationScmIntegrationNewParamsBodyUnion() { -} - -// Satisfied by -// [RunnerConfigurationScmIntegrationNewParamsBodyOAuthClientIDIsTheOAuthAppSClientIDIfOAuthIsConfiguredIfConfiguredOAuthPlaintextClientSecretMustAlsoBeSet], -// [RunnerConfigurationScmIntegrationNewParamsBodyOAuthPlaintextClientSecretIsTheOAuthAppSClientSecretInClearTextThisWillFirstBeEncryptedWithTheRunnerSPublicKeyBeforeBeingStored], -// [RunnerConfigurationScmIntegrationNewParamsBody]. -type RunnerConfigurationScmIntegrationNewParamsBodyUnion interface { - implementsRunnerConfigurationScmIntegrationNewParamsBodyUnion() -} - -type RunnerConfigurationScmIntegrationNewParamsBodyOAuthClientIDIsTheOAuthAppSClientIDIfOAuthIsConfiguredIfConfiguredOAuthPlaintextClientSecretMustAlsoBeSet struct { - // oauth_client_id is the OAuth app's client ID, if OAuth is configured. If - // configured, oauth_plaintext_client_secret must also be set. - OAuthClientID param.Field[string] `json:"oauthClientId,required"` -} - -func (r RunnerConfigurationScmIntegrationNewParamsBodyOAuthClientIDIsTheOAuthAppSClientIDIfOAuthIsConfiguredIfConfiguredOAuthPlaintextClientSecretMustAlsoBeSet) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RunnerConfigurationScmIntegrationNewParamsBodyOAuthClientIDIsTheOAuthAppSClientIDIfOAuthIsConfiguredIfConfiguredOAuthPlaintextClientSecretMustAlsoBeSet) implementsRunnerConfigurationScmIntegrationNewParamsBodyUnion() { -} - -type RunnerConfigurationScmIntegrationNewParamsBodyOAuthPlaintextClientSecretIsTheOAuthAppSClientSecretInClearTextThisWillFirstBeEncryptedWithTheRunnerSPublicKeyBeforeBeingStored struct { - // oauth_plaintext_client_secret is the OAuth app's client secret in clear text. - // This will first be encrypted with the runner's public key before being stored. - OAuthPlaintextClientSecret param.Field[string] `json:"oauthPlaintextClientSecret,required"` -} - -func (r RunnerConfigurationScmIntegrationNewParamsBodyOAuthPlaintextClientSecretIsTheOAuthAppSClientSecretInClearTextThisWillFirstBeEncryptedWithTheRunnerSPublicKeyBeforeBeingStored) MarshalJSON() (data []byte, err error) { +func (r RunnerConfigurationScmIntegrationNewParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r RunnerConfigurationScmIntegrationNewParamsBodyOAuthPlaintextClientSecretIsTheOAuthAppSClientSecretInClearTextThisWillFirstBeEncryptedWithTheRunnerSPublicKeyBeforeBeingStored) implementsRunnerConfigurationScmIntegrationNewParamsBodyUnion() { -} - type RunnerConfigurationScmIntegrationGetParams struct { ID param.Field[string] `json:"id" format:"uuid"` } @@ -312,14 +223,7 @@ func (r RunnerConfigurationScmIntegrationGetParams) MarshalJSON() (data []byte, } type RunnerConfigurationScmIntegrationUpdateParams struct { - Body RunnerConfigurationScmIntegrationUpdateParamsBodyUnion `json:"body,required"` -} - -func (r RunnerConfigurationScmIntegrationUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - -type RunnerConfigurationScmIntegrationUpdateParamsBody struct { + ID param.Field[string] `json:"id" format:"uuid"` // oauth_client_id can be set to update the OAuth app's client ID. If an empty // string is set, the OAuth configuration will be removed (regardless of whether a // client secret is set), and any existing Host Authentication Tokens for the SCM @@ -339,69 +243,10 @@ type RunnerConfigurationScmIntegrationUpdateParamsBody struct { Pat param.Field[bool] `json:"pat"` } -func (r RunnerConfigurationScmIntegrationUpdateParamsBody) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RunnerConfigurationScmIntegrationUpdateParamsBody) implementsRunnerConfigurationScmIntegrationUpdateParamsBodyUnion() { -} - -// Satisfied by -// [RunnerConfigurationScmIntegrationUpdateParamsBodyOAuthClientIDCanBeSetToUpdateTheOAuthAppSClientIDIfAnEmptyStringIsSetTheOAuthConfigurationWillBeRemovedRegardlessOfWhetherAClientSecretIsSetAndAnyExistingHostAuthenticationTokensForTheScmIntegrationSRunnerAndHostThatWereCreatedUsingTheOAuthAppWillBeDeletedThisMightLeadToUsersBeingUnableToAccessTheirRepositoriesUntilTheyReAuthenticate], -// [RunnerConfigurationScmIntegrationUpdateParamsBodyOAuthPlaintextClientSecretCanBeSetToUpdateTheOAuthAppSClientSecretTheCleartextSecretWillBeEncryptedWithTheRunnerSPublicKeyBeforeBeingStored], -// [RunnerConfigurationScmIntegrationUpdateParamsBodyPatCanBeSetToEnableOrDisablePersonalAccessTokensSupportWhenDisablingPaTsAnyExistingHostAuthenticationTokensForTheScmIntegrationSRunnerAndHostThatWereCreatedUsingAPatWillBeDeletedThisMightLeadToUsersBeingUnableToAccessTheirRepositoriesUntilTheyReAuthenticate], -// [RunnerConfigurationScmIntegrationUpdateParamsBody]. -type RunnerConfigurationScmIntegrationUpdateParamsBodyUnion interface { - implementsRunnerConfigurationScmIntegrationUpdateParamsBodyUnion() -} - -type RunnerConfigurationScmIntegrationUpdateParamsBodyOAuthClientIDCanBeSetToUpdateTheOAuthAppSClientIDIfAnEmptyStringIsSetTheOAuthConfigurationWillBeRemovedRegardlessOfWhetherAClientSecretIsSetAndAnyExistingHostAuthenticationTokensForTheScmIntegrationSRunnerAndHostThatWereCreatedUsingTheOAuthAppWillBeDeletedThisMightLeadToUsersBeingUnableToAccessTheirRepositoriesUntilTheyReAuthenticate struct { - // oauth_client_id can be set to update the OAuth app's client ID. If an empty - // string is set, the OAuth configuration will be removed (regardless of whether a - // client secret is set), and any existing Host Authentication Tokens for the SCM - // integration's runner and host that were created using the OAuth app will be - // deleted. This might lead to users being unable to access their repositories - // until they re-authenticate. - OAuthClientID param.Field[string] `json:"oauthClientId,required"` -} - -func (r RunnerConfigurationScmIntegrationUpdateParamsBodyOAuthClientIDCanBeSetToUpdateTheOAuthAppSClientIDIfAnEmptyStringIsSetTheOAuthConfigurationWillBeRemovedRegardlessOfWhetherAClientSecretIsSetAndAnyExistingHostAuthenticationTokensForTheScmIntegrationSRunnerAndHostThatWereCreatedUsingTheOAuthAppWillBeDeletedThisMightLeadToUsersBeingUnableToAccessTheirRepositoriesUntilTheyReAuthenticate) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RunnerConfigurationScmIntegrationUpdateParamsBodyOAuthClientIDCanBeSetToUpdateTheOAuthAppSClientIDIfAnEmptyStringIsSetTheOAuthConfigurationWillBeRemovedRegardlessOfWhetherAClientSecretIsSetAndAnyExistingHostAuthenticationTokensForTheScmIntegrationSRunnerAndHostThatWereCreatedUsingTheOAuthAppWillBeDeletedThisMightLeadToUsersBeingUnableToAccessTheirRepositoriesUntilTheyReAuthenticate) implementsRunnerConfigurationScmIntegrationUpdateParamsBodyUnion() { -} - -type RunnerConfigurationScmIntegrationUpdateParamsBodyOAuthPlaintextClientSecretCanBeSetToUpdateTheOAuthAppSClientSecretTheCleartextSecretWillBeEncryptedWithTheRunnerSPublicKeyBeforeBeingStored struct { - // oauth_plaintext_client_secret can be set to update the OAuth app's client - // secret. The cleartext secret will be encrypted with the runner's public key - // before being stored. - OAuthPlaintextClientSecret param.Field[string] `json:"oauthPlaintextClientSecret,required"` -} - -func (r RunnerConfigurationScmIntegrationUpdateParamsBodyOAuthPlaintextClientSecretCanBeSetToUpdateTheOAuthAppSClientSecretTheCleartextSecretWillBeEncryptedWithTheRunnerSPublicKeyBeforeBeingStored) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r RunnerConfigurationScmIntegrationUpdateParamsBodyOAuthPlaintextClientSecretCanBeSetToUpdateTheOAuthAppSClientSecretTheCleartextSecretWillBeEncryptedWithTheRunnerSPublicKeyBeforeBeingStored) implementsRunnerConfigurationScmIntegrationUpdateParamsBodyUnion() { -} - -type RunnerConfigurationScmIntegrationUpdateParamsBodyPatCanBeSetToEnableOrDisablePersonalAccessTokensSupportWhenDisablingPaTsAnyExistingHostAuthenticationTokensForTheScmIntegrationSRunnerAndHostThatWereCreatedUsingAPatWillBeDeletedThisMightLeadToUsersBeingUnableToAccessTheirRepositoriesUntilTheyReAuthenticate struct { - // pat can be set to enable or disable Personal Access Tokens support. When - // disabling PATs, any existing Host Authentication Tokens for the SCM - // integration's runner and host that were created using a PAT will be deleted. - // This might lead to users being unable to access their repositories until they - // re-authenticate. - Pat param.Field[bool] `json:"pat,required"` -} - -func (r RunnerConfigurationScmIntegrationUpdateParamsBodyPatCanBeSetToEnableOrDisablePersonalAccessTokensSupportWhenDisablingPaTsAnyExistingHostAuthenticationTokensForTheScmIntegrationSRunnerAndHostThatWereCreatedUsingAPatWillBeDeletedThisMightLeadToUsersBeingUnableToAccessTheirRepositoriesUntilTheyReAuthenticate) MarshalJSON() (data []byte, err error) { +func (r RunnerConfigurationScmIntegrationUpdateParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r RunnerConfigurationScmIntegrationUpdateParamsBodyPatCanBeSetToEnableOrDisablePersonalAccessTokensSupportWhenDisablingPaTsAnyExistingHostAuthenticationTokensForTheScmIntegrationSRunnerAndHostThatWereCreatedUsingAPatWillBeDeletedThisMightLeadToUsersBeingUnableToAccessTheirRepositoriesUntilTheyReAuthenticate) implementsRunnerConfigurationScmIntegrationUpdateParamsBodyUnion() { -} - type RunnerConfigurationScmIntegrationListParams struct { Token param.Field[string] `query:"token"` PageSize param.Field[int64] `query:"pageSize"` diff --git a/runnerconfigurationscmintegration_test.go b/runnerconfigurationscmintegration_test.go index ec4cb84..ab50830 100644 --- a/runnerconfigurationscmintegration_test.go +++ b/runnerconfigurationscmintegration_test.go @@ -13,7 +13,7 @@ import ( "github.com/gitpod-io/flex-sdk-go/option" ) -func TestRunnerConfigurationScmIntegrationNew(t *testing.T) { +func TestRunnerConfigurationScmIntegrationNewWithOptionalParams(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 { @@ -27,9 +27,12 @@ func TestRunnerConfigurationScmIntegrationNew(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.Configurations.ScmIntegrations.New(context.TODO(), gitpod.RunnerConfigurationScmIntegrationNewParams{ - Body: gitpod.RunnerConfigurationScmIntegrationNewParamsBodyOAuthClientIDIsTheOAuthAppSClientIDIfOAuthIsConfiguredIfConfiguredOAuthPlaintextClientSecretMustAlsoBeSet{ - OAuthClientID: gitpod.F("oauthClientId"), - }, + Host: gitpod.F("host"), + OAuthClientID: gitpod.F("oauthClientId"), + OAuthPlaintextClientSecret: gitpod.F("oauthPlaintextClientSecret"), + Pat: gitpod.F(true), + RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + ScmID: gitpod.F("scmId"), }) if err != nil { var apierr *gitpod.Error @@ -65,7 +68,7 @@ func TestRunnerConfigurationScmIntegrationGetWithOptionalParams(t *testing.T) { } } -func TestRunnerConfigurationScmIntegrationUpdate(t *testing.T) { +func TestRunnerConfigurationScmIntegrationUpdateWithOptionalParams(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 { @@ -79,9 +82,10 @@ func TestRunnerConfigurationScmIntegrationUpdate(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.Configurations.ScmIntegrations.Update(context.TODO(), gitpod.RunnerConfigurationScmIntegrationUpdateParams{ - Body: gitpod.RunnerConfigurationScmIntegrationUpdateParamsBodyOAuthClientIDCanBeSetToUpdateTheOAuthAppSClientIDIfAnEmptyStringIsSetTheOAuthConfigurationWillBeRemovedRegardlessOfWhetherAClientSecretIsSetAndAnyExistingHostAuthenticationTokensForTheScmIntegrationSRunnerAndHostThatWereCreatedUsingTheOAuthAppWillBeDeletedThisMightLeadToUsersBeingUnableToAccessTheirRepositoriesUntilTheyReAuthenticate{ - OAuthClientID: gitpod.F("oauthClientId"), - }, + ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + OAuthClientID: gitpod.F("oauthClientId"), + OAuthPlaintextClientSecret: gitpod.F("oauthPlaintextClientSecret"), + Pat: gitpod.F(true), }) if err != nil { var apierr *gitpod.Error diff --git a/runnerpolicy.go b/runnerpolicy.go index 944b3e2..0d8a529 100644 --- a/runnerpolicy.go +++ b/runnerpolicy.go @@ -51,7 +51,7 @@ func (r *RunnerPolicyService) Update(ctx context.Context, body RunnerPolicyUpdat } // ListRunnerPolicies lists runner policies. -func (r *RunnerPolicyService) List(ctx context.Context, params RunnerPolicyListParams, opts ...option.RequestOption) (res *pagination.PoliciesPage[RunnerPolicyListResponse], err error) { +func (r *RunnerPolicyService) List(ctx context.Context, params RunnerPolicyListParams, opts ...option.RequestOption) (res *pagination.PoliciesPage[RunnerPolicy], err error) { var raw *http.Response opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -69,7 +69,7 @@ func (r *RunnerPolicyService) List(ctx context.Context, params RunnerPolicyListP } // ListRunnerPolicies lists runner policies. -func (r *RunnerPolicyService) ListAutoPaging(ctx context.Context, params RunnerPolicyListParams, opts ...option.RequestOption) *pagination.PoliciesPageAutoPager[RunnerPolicyListResponse] { +func (r *RunnerPolicyService) ListAutoPaging(ctx context.Context, params RunnerPolicyListParams, opts ...option.RequestOption) *pagination.PoliciesPageAutoPager[RunnerPolicy] { return pagination.NewPoliciesPageAutoPager(r.List(ctx, params, opts...)) } @@ -81,177 +81,93 @@ func (r *RunnerPolicyService) Delete(ctx context.Context, body RunnerPolicyDelet return } -type RunnerPolicyNewResponse struct { - Policy RunnerPolicyNewResponsePolicy `json:"policy"` - JSON runnerPolicyNewResponseJSON `json:"-"` -} - -// runnerPolicyNewResponseJSON contains the JSON metadata for the struct -// [RunnerPolicyNewResponse] -type runnerPolicyNewResponseJSON struct { - Policy apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerPolicyNewResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerPolicyNewResponseJSON) RawJSON() string { - return r.raw -} - -type RunnerPolicyNewResponsePolicy struct { +type RunnerPolicy struct { GroupID string `json:"groupId" format:"uuid"` // role is the role assigned to the group - Role RunnerPolicyNewResponsePolicyRole `json:"role"` - JSON runnerPolicyNewResponsePolicyJSON `json:"-"` + Role RunnerRole `json:"role"` + JSON runnerPolicyJSON `json:"-"` } -// runnerPolicyNewResponsePolicyJSON contains the JSON metadata for the struct -// [RunnerPolicyNewResponsePolicy] -type runnerPolicyNewResponsePolicyJSON struct { +// runnerPolicyJSON contains the JSON metadata for the struct [RunnerPolicy] +type runnerPolicyJSON struct { GroupID apijson.Field Role apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RunnerPolicyNewResponsePolicy) UnmarshalJSON(data []byte) (err error) { +func (r *RunnerPolicy) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerPolicyNewResponsePolicyJSON) RawJSON() string { +func (r runnerPolicyJSON) RawJSON() string { return r.raw } -// role is the role assigned to the group -type RunnerPolicyNewResponsePolicyRole string +type RunnerRole string const ( - RunnerPolicyNewResponsePolicyRoleRunnerRoleUnspecified RunnerPolicyNewResponsePolicyRole = "RUNNER_ROLE_UNSPECIFIED" - RunnerPolicyNewResponsePolicyRoleRunnerRoleAdmin RunnerPolicyNewResponsePolicyRole = "RUNNER_ROLE_ADMIN" - RunnerPolicyNewResponsePolicyRoleRunnerRoleUser RunnerPolicyNewResponsePolicyRole = "RUNNER_ROLE_USER" + RunnerRoleRunnerRoleUnspecified RunnerRole = "RUNNER_ROLE_UNSPECIFIED" + RunnerRoleRunnerRoleAdmin RunnerRole = "RUNNER_ROLE_ADMIN" + RunnerRoleRunnerRoleUser RunnerRole = "RUNNER_ROLE_USER" ) -func (r RunnerPolicyNewResponsePolicyRole) IsKnown() bool { +func (r RunnerRole) IsKnown() bool { switch r { - case RunnerPolicyNewResponsePolicyRoleRunnerRoleUnspecified, RunnerPolicyNewResponsePolicyRoleRunnerRoleAdmin, RunnerPolicyNewResponsePolicyRoleRunnerRoleUser: + case RunnerRoleRunnerRoleUnspecified, RunnerRoleRunnerRoleAdmin, RunnerRoleRunnerRoleUser: return true } return false } -type RunnerPolicyUpdateResponse struct { - Policy RunnerPolicyUpdateResponsePolicy `json:"policy"` - JSON runnerPolicyUpdateResponseJSON `json:"-"` +type RunnerPolicyNewResponse struct { + Policy RunnerPolicy `json:"policy"` + JSON runnerPolicyNewResponseJSON `json:"-"` } -// runnerPolicyUpdateResponseJSON contains the JSON metadata for the struct -// [RunnerPolicyUpdateResponse] -type runnerPolicyUpdateResponseJSON struct { +// runnerPolicyNewResponseJSON contains the JSON metadata for the struct +// [RunnerPolicyNewResponse] +type runnerPolicyNewResponseJSON struct { Policy apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RunnerPolicyUpdateResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r runnerPolicyUpdateResponseJSON) RawJSON() string { - return r.raw -} - -type RunnerPolicyUpdateResponsePolicy struct { - GroupID string `json:"groupId" format:"uuid"` - // role is the role assigned to the group - Role RunnerPolicyUpdateResponsePolicyRole `json:"role"` - JSON runnerPolicyUpdateResponsePolicyJSON `json:"-"` -} - -// runnerPolicyUpdateResponsePolicyJSON contains the JSON metadata for the struct -// [RunnerPolicyUpdateResponsePolicy] -type runnerPolicyUpdateResponsePolicyJSON struct { - GroupID apijson.Field - Role apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RunnerPolicyUpdateResponsePolicy) UnmarshalJSON(data []byte) (err error) { +func (r *RunnerPolicyNewResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerPolicyUpdateResponsePolicyJSON) RawJSON() string { +func (r runnerPolicyNewResponseJSON) RawJSON() string { return r.raw } -// role is the role assigned to the group -type RunnerPolicyUpdateResponsePolicyRole string - -const ( - RunnerPolicyUpdateResponsePolicyRoleRunnerRoleUnspecified RunnerPolicyUpdateResponsePolicyRole = "RUNNER_ROLE_UNSPECIFIED" - RunnerPolicyUpdateResponsePolicyRoleRunnerRoleAdmin RunnerPolicyUpdateResponsePolicyRole = "RUNNER_ROLE_ADMIN" - RunnerPolicyUpdateResponsePolicyRoleRunnerRoleUser RunnerPolicyUpdateResponsePolicyRole = "RUNNER_ROLE_USER" -) - -func (r RunnerPolicyUpdateResponsePolicyRole) IsKnown() bool { - switch r { - case RunnerPolicyUpdateResponsePolicyRoleRunnerRoleUnspecified, RunnerPolicyUpdateResponsePolicyRoleRunnerRoleAdmin, RunnerPolicyUpdateResponsePolicyRoleRunnerRoleUser: - return true - } - return false -} - -type RunnerPolicyListResponse struct { - GroupID string `json:"groupId" format:"uuid"` - // role is the role assigned to the group - Role RunnerPolicyListResponseRole `json:"role"` - JSON runnerPolicyListResponseJSON `json:"-"` +type RunnerPolicyUpdateResponse struct { + Policy RunnerPolicy `json:"policy"` + JSON runnerPolicyUpdateResponseJSON `json:"-"` } -// runnerPolicyListResponseJSON contains the JSON metadata for the struct -// [RunnerPolicyListResponse] -type runnerPolicyListResponseJSON struct { - GroupID apijson.Field - Role apijson.Field +// runnerPolicyUpdateResponseJSON contains the JSON metadata for the struct +// [RunnerPolicyUpdateResponse] +type runnerPolicyUpdateResponseJSON struct { + Policy apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RunnerPolicyListResponse) UnmarshalJSON(data []byte) (err error) { +func (r *RunnerPolicyUpdateResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r runnerPolicyListResponseJSON) RawJSON() string { +func (r runnerPolicyUpdateResponseJSON) RawJSON() string { return r.raw } -// role is the role assigned to the group -type RunnerPolicyListResponseRole string - -const ( - RunnerPolicyListResponseRoleRunnerRoleUnspecified RunnerPolicyListResponseRole = "RUNNER_ROLE_UNSPECIFIED" - RunnerPolicyListResponseRoleRunnerRoleAdmin RunnerPolicyListResponseRole = "RUNNER_ROLE_ADMIN" - RunnerPolicyListResponseRoleRunnerRoleUser RunnerPolicyListResponseRole = "RUNNER_ROLE_USER" -) - -func (r RunnerPolicyListResponseRole) IsKnown() bool { - switch r { - case RunnerPolicyListResponseRoleRunnerRoleUnspecified, RunnerPolicyListResponseRoleRunnerRoleAdmin, RunnerPolicyListResponseRoleRunnerRoleUser: - return true - } - return false -} - type RunnerPolicyDeleteResponse = interface{} type RunnerPolicyNewParams struct { // group_id specifies the group_id identifier - GroupID param.Field[string] `json:"groupId" format:"uuid"` - Role param.Field[RunnerPolicyNewParamsRole] `json:"role"` + GroupID param.Field[string] `json:"groupId" format:"uuid"` + Role param.Field[RunnerRole] `json:"role"` // runner_id specifies the project identifier RunnerID param.Field[string] `json:"runnerId" format:"uuid"` } @@ -260,26 +176,10 @@ func (r RunnerPolicyNewParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type RunnerPolicyNewParamsRole string - -const ( - RunnerPolicyNewParamsRoleRunnerRoleUnspecified RunnerPolicyNewParamsRole = "RUNNER_ROLE_UNSPECIFIED" - RunnerPolicyNewParamsRoleRunnerRoleAdmin RunnerPolicyNewParamsRole = "RUNNER_ROLE_ADMIN" - RunnerPolicyNewParamsRoleRunnerRoleUser RunnerPolicyNewParamsRole = "RUNNER_ROLE_USER" -) - -func (r RunnerPolicyNewParamsRole) IsKnown() bool { - switch r { - case RunnerPolicyNewParamsRoleRunnerRoleUnspecified, RunnerPolicyNewParamsRoleRunnerRoleAdmin, RunnerPolicyNewParamsRoleRunnerRoleUser: - return true - } - return false -} - type RunnerPolicyUpdateParams struct { // group_id specifies the group_id identifier - GroupID param.Field[string] `json:"groupId" format:"uuid"` - Role param.Field[RunnerPolicyUpdateParamsRole] `json:"role"` + GroupID param.Field[string] `json:"groupId" format:"uuid"` + Role param.Field[RunnerRole] `json:"role"` // runner_id specifies the project identifier RunnerID param.Field[string] `json:"runnerId" format:"uuid"` } @@ -288,22 +188,6 @@ func (r RunnerPolicyUpdateParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type RunnerPolicyUpdateParamsRole string - -const ( - RunnerPolicyUpdateParamsRoleRunnerRoleUnspecified RunnerPolicyUpdateParamsRole = "RUNNER_ROLE_UNSPECIFIED" - RunnerPolicyUpdateParamsRoleRunnerRoleAdmin RunnerPolicyUpdateParamsRole = "RUNNER_ROLE_ADMIN" - RunnerPolicyUpdateParamsRoleRunnerRoleUser RunnerPolicyUpdateParamsRole = "RUNNER_ROLE_USER" -) - -func (r RunnerPolicyUpdateParamsRole) IsKnown() bool { - switch r { - case RunnerPolicyUpdateParamsRoleRunnerRoleUnspecified, RunnerPolicyUpdateParamsRoleRunnerRoleAdmin, RunnerPolicyUpdateParamsRoleRunnerRoleUser: - return true - } - return false -} - type RunnerPolicyListParams struct { Token param.Field[string] `query:"token"` PageSize param.Field[int64] `query:"pageSize"` diff --git a/runnerpolicy_test.go b/runnerpolicy_test.go index 620073b..c8ba9fc 100644 --- a/runnerpolicy_test.go +++ b/runnerpolicy_test.go @@ -28,7 +28,7 @@ func TestRunnerPolicyNewWithOptionalParams(t *testing.T) { ) _, err := client.Runners.Policies.New(context.TODO(), gitpod.RunnerPolicyNewParams{ GroupID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - Role: gitpod.F(gitpod.RunnerPolicyNewParamsRoleRunnerRoleUnspecified), + Role: gitpod.F(gitpod.RunnerRoleRunnerRoleUnspecified), RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), }) if err != nil { @@ -55,7 +55,7 @@ func TestRunnerPolicyUpdateWithOptionalParams(t *testing.T) { ) _, err := client.Runners.Policies.Update(context.TODO(), gitpod.RunnerPolicyUpdateParams{ GroupID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - Role: gitpod.F(gitpod.RunnerPolicyUpdateParamsRoleRunnerRoleUnspecified), + Role: gitpod.F(gitpod.RunnerRoleRunnerRoleUnspecified), RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), }) if err != nil { diff --git a/secret.go b/secret.go index b0eced8..0c147ec 100644 --- a/secret.go +++ b/secret.go @@ -6,7 +6,6 @@ import ( "context" "net/http" "net/url" - "reflect" "time" "github.com/gitpod-io/flex-sdk-go/internal/apijson" @@ -15,7 +14,7 @@ import ( "github.com/gitpod-io/flex-sdk-go/internal/requestconfig" "github.com/gitpod-io/flex-sdk-go/option" "github.com/gitpod-io/flex-sdk-go/packages/pagination" - "github.com/tidwall/gjson" + "github.com/gitpod-io/flex-sdk-go/shared" ) // SecretService contains methods and other services that help with interacting @@ -46,7 +45,7 @@ func (r *SecretService) New(ctx context.Context, body SecretNewParams, opts ...o } // ListSecrets lists secrets. -func (r *SecretService) List(ctx context.Context, params SecretListParams, opts ...option.RequestOption) (res *pagination.SecretsPage[SecretListResponse], err error) { +func (r *SecretService) List(ctx context.Context, params SecretListParams, opts ...option.RequestOption) (res *pagination.SecretsPage[Secret], err error) { var raw *http.Response opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -64,7 +63,7 @@ func (r *SecretService) List(ctx context.Context, params SecretListParams, opts } // ListSecrets lists secrets. -func (r *SecretService) ListAutoPaging(ctx context.Context, params SecretListParams, opts ...option.RequestOption) *pagination.SecretsPageAutoPager[SecretListResponse] { +func (r *SecretService) ListAutoPaging(ctx context.Context, params SecretListParams, opts ...option.RequestOption) *pagination.SecretsPageAutoPager[Secret] { return pagination.NewSecretsPageAutoPager(r.List(ctx, params, opts...)) } @@ -93,670 +92,8 @@ func (r *SecretService) UpdateValue(ctx context.Context, body SecretUpdateValueP return } -type SecretNewResponse struct { - Secret SecretNewResponseSecret `json:"secret"` - JSON secretNewResponseJSON `json:"-"` -} - -// secretNewResponseJSON contains the JSON metadata for the struct -// [SecretNewResponse] -type secretNewResponseJSON struct { - Secret apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SecretNewResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r secretNewResponseJSON) RawJSON() string { - return r.raw -} - -type SecretNewResponseSecret struct { - // secret will be created as an Environment Variable with the same name as the - // secret - EnvironmentVariable bool `json:"environmentVariable"` - // absolute path to the file where the secret is mounted - FilePath string `json:"filePath"` - JSON secretNewResponseSecretJSON `json:"-"` - union SecretNewResponseSecretUnion -} - -// secretNewResponseSecretJSON contains the JSON metadata for the struct -// [SecretNewResponseSecret] -type secretNewResponseSecretJSON struct { - EnvironmentVariable apijson.Field - FilePath apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r secretNewResponseSecretJSON) RawJSON() string { - return r.raw -} - -func (r *SecretNewResponseSecret) UnmarshalJSON(data []byte) (err error) { - *r = SecretNewResponseSecret{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a [SecretNewResponseSecretUnion] interface which you can cast to -// the specific types for more type safety. -// -// Possible runtime types of the union are -// [SecretNewResponseSecretSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret], -// [SecretNewResponseSecretAbsolutePathToTheFileWhereTheSecretIsMounted]. -func (r SecretNewResponseSecret) AsUnion() SecretNewResponseSecretUnion { - return r.union -} - -// Union satisfied by -// [SecretNewResponseSecretSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret] -// or [SecretNewResponseSecretAbsolutePathToTheFileWhereTheSecretIsMounted]. -type SecretNewResponseSecretUnion interface { - implementsSecretNewResponseSecret() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*SecretNewResponseSecretUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(SecretNewResponseSecretSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(SecretNewResponseSecretAbsolutePathToTheFileWhereTheSecretIsMounted{}), - }, - ) -} - -type SecretNewResponseSecretSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret struct { - // secret will be created as an Environment Variable with the same name as the - // secret - EnvironmentVariable bool `json:"environmentVariable,required"` - JSON secretNewResponseSecretSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretJSON `json:"-"` -} - -// secretNewResponseSecretSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretJSON -// contains the JSON metadata for the struct -// [SecretNewResponseSecretSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret] -type secretNewResponseSecretSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretJSON struct { - EnvironmentVariable apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SecretNewResponseSecretSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r secretNewResponseSecretSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretJSON) RawJSON() string { - return r.raw -} - -func (r SecretNewResponseSecretSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret) implementsSecretNewResponseSecret() { -} - -type SecretNewResponseSecretAbsolutePathToTheFileWhereTheSecretIsMounted struct { - // absolute path to the file where the secret is mounted - FilePath string `json:"filePath,required"` - JSON secretNewResponseSecretAbsolutePathToTheFileWhereTheSecretIsMountedJSON `json:"-"` -} - -// secretNewResponseSecretAbsolutePathToTheFileWhereTheSecretIsMountedJSON contains -// the JSON metadata for the struct -// [SecretNewResponseSecretAbsolutePathToTheFileWhereTheSecretIsMounted] -type secretNewResponseSecretAbsolutePathToTheFileWhereTheSecretIsMountedJSON struct { - FilePath apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SecretNewResponseSecretAbsolutePathToTheFileWhereTheSecretIsMounted) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r secretNewResponseSecretAbsolutePathToTheFileWhereTheSecretIsMountedJSON) RawJSON() string { - return r.raw -} - -func (r SecretNewResponseSecretAbsolutePathToTheFileWhereTheSecretIsMounted) implementsSecretNewResponseSecret() { -} - -type SecretListResponse struct { - ID string `json:"id" format:"uuid"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - CreatedAt time.Time `json:"createdAt" format:"date-time"` - // This field can have the runtime type of - // [SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreator], - // [SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreator]. - Creator interface{} `json:"creator"` - // secret will be created as an Environment Variable with the same name as the - // secret - EnvironmentVariable bool `json:"environmentVariable"` - // absolute path to the file where the secret is mounted - FilePath string `json:"filePath"` - // Name of the secret for humans. - Name string `json:"name"` - // The Project ID this Secret belongs to - ProjectID string `json:"projectId" format:"uuid"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - UpdatedAt time.Time `json:"updatedAt" format:"date-time"` - JSON secretListResponseJSON `json:"-"` - union SecretListResponseUnion -} - -// secretListResponseJSON contains the JSON metadata for the struct -// [SecretListResponse] -type secretListResponseJSON 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 -} - -func (r secretListResponseJSON) RawJSON() string { - return r.raw -} - -func (r *SecretListResponse) UnmarshalJSON(data []byte) (err error) { - *r = SecretListResponse{} - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) -} - -// AsUnion returns a [SecretListResponseUnion] interface which you can cast to the -// specific types for more type safety. -// -// Possible runtime types of the union are -// [SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret], -// [SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMounted]. -func (r SecretListResponse) AsUnion() SecretListResponseUnion { - return r.union -} - -// Union satisfied by -// [SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret] -// or [SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMounted]. -type SecretListResponseUnion interface { - implementsSecretListResponse() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*SecretListResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMounted{}), - }, - ) -} - -type SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret struct { - // secret will be created as an Environment Variable with the same name as the - // secret - EnvironmentVariable bool `json:"environmentVariable,required"` - ID string `json:"id" format:"uuid"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - CreatedAt time.Time `json:"createdAt" format:"date-time"` - // creator is the identity of the creator of the secret - Creator SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreator `json:"creator"` - // Name of the secret for humans. - Name string `json:"name"` - // The Project ID this Secret belongs to - ProjectID string `json:"projectId" format:"uuid"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - UpdatedAt time.Time `json:"updatedAt" format:"date-time"` - JSON secretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretJSON `json:"-"` -} - -// secretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretJSON -// contains the JSON metadata for the struct -// [SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret] -type secretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretJSON struct { - EnvironmentVariable apijson.Field - ID apijson.Field - CreatedAt apijson.Field - Creator apijson.Field - Name apijson.Field - ProjectID apijson.Field - UpdatedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r secretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretJSON) RawJSON() string { - return r.raw -} - -func (r SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret) implementsSecretListResponse() { -} - -// creator is the identity of the creator of the secret -type SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorPrincipal `json:"principal"` - JSON secretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorJSON `json:"-"` -} - -// secretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorJSON -// contains the JSON metadata for the struct -// [SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreator] -type secretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreator) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r secretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorJSON) RawJSON() string { - return r.raw -} - -// Principal is the principal of the subject -type SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorPrincipal string - -const ( - SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorPrincipalPrincipalUnspecified SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorPrincipalPrincipalAccount SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorPrincipal = "PRINCIPAL_ACCOUNT" - SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorPrincipalPrincipalUser SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorPrincipal = "PRINCIPAL_USER" - SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorPrincipalPrincipalRunner SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorPrincipal = "PRINCIPAL_RUNNER" - SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorPrincipalPrincipalEnvironment SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorPrincipalPrincipalServiceAccount SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorPrincipal) IsKnown() bool { - switch r { - case SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorPrincipalPrincipalUnspecified, SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorPrincipalPrincipalAccount, SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorPrincipalPrincipalUser, SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorPrincipalPrincipalRunner, SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorPrincipalPrincipalEnvironment, SecretListResponseSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - -type SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMounted struct { - // absolute path to the file where the secret is mounted - FilePath string `json:"filePath,required"` - ID string `json:"id" format:"uuid"` +type Secret struct { + ID string `json:"id" 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, @@ -847,7 +184,12 @@ type SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMounted struct { // to obtain a formatter capable of generating timestamps in this format. CreatedAt time.Time `json:"createdAt" format:"date-time"` // creator is the identity of the creator of the secret - Creator SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreator `json:"creator"` + Creator shared.Subject `json:"creator"` + // secret will be created as an Environment Variable with the same name as the + // secret + EnvironmentVariable bool `json:"environmentVariable"` + // absolute path to the file where the secret is mounted + FilePath string `json:"filePath"` // Name of the secret for humans. Name string `json:"name"` // The Project ID this Secret belongs to @@ -940,83 +282,53 @@ type SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMounted 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 secretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedJSON `json:"-"` + UpdatedAt time.Time `json:"updatedAt" format:"date-time"` + JSON secretJSON `json:"-"` } -// secretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedJSON contains the -// JSON metadata for the struct -// [SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMounted] -type secretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedJSON struct { - FilePath apijson.Field - ID apijson.Field - CreatedAt apijson.Field - Creator apijson.Field - Name apijson.Field - ProjectID apijson.Field - UpdatedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field +// 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 } -func (r *SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMounted) UnmarshalJSON(data []byte) (err error) { +func (r *Secret) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r secretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedJSON) RawJSON() string { +func (r secretJSON) RawJSON() string { return r.raw } -func (r SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMounted) implementsSecretListResponse() { -} - -// creator is the identity of the creator of the secret -type SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorPrincipal `json:"principal"` - JSON secretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorJSON `json:"-"` +type SecretNewResponse struct { + Secret Secret `json:"secret"` + JSON secretNewResponseJSON `json:"-"` } -// secretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorJSON -// contains the JSON metadata for the struct -// [SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreator] -type secretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorJSON struct { - ID apijson.Field - Principal apijson.Field +// secretNewResponseJSON contains the JSON metadata for the struct +// [SecretNewResponse] +type secretNewResponseJSON struct { + Secret apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreator) UnmarshalJSON(data []byte) (err error) { +func (r *SecretNewResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r secretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorJSON) RawJSON() string { +func (r secretNewResponseJSON) RawJSON() string { return r.raw } -// Principal is the principal of the subject -type SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorPrincipal string - -const ( - SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorPrincipalPrincipalUnspecified SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorPrincipalPrincipalAccount SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorPrincipal = "PRINCIPAL_ACCOUNT" - SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorPrincipalPrincipalUser SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorPrincipal = "PRINCIPAL_USER" - SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorPrincipalPrincipalRunner SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorPrincipal = "PRINCIPAL_RUNNER" - SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorPrincipalPrincipalEnvironment SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorPrincipalPrincipalServiceAccount SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorPrincipal) IsKnown() bool { - switch r { - case SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorPrincipalPrincipalUnspecified, SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorPrincipalPrincipalAccount, SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorPrincipalPrincipalUser, SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorPrincipalPrincipalRunner, SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorPrincipalPrincipalEnvironment, SecretListResponseAbsolutePathToTheFileWhereTheSecretIsMountedCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - type SecretDeleteResponse = interface{} type SecretGetValueResponse struct { @@ -1043,14 +355,6 @@ func (r secretGetValueResponseJSON) RawJSON() string { type SecretUpdateValueResponse = interface{} type SecretNewParams struct { - Body SecretNewParamsBodyUnion `json:"body,required"` -} - -func (r SecretNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - -type SecretNewParamsBody struct { // secret will be created as an Environment Variable with the same name as the // secret EnvironmentVariable param.Field[bool] `json:"environmentVariable"` @@ -1068,60 +372,10 @@ type SecretNewParamsBody struct { Value param.Field[string] `json:"value"` } -func (r SecretNewParamsBody) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SecretNewParamsBody) implementsSecretNewParamsBodyUnion() {} - -// Satisfied by -// [SecretNewParamsBodySecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret], -// [SecretNewParamsBodyAbsolutePathToTheFileWhereTheSecretIsMounted], -// [SecretNewParamsBody]. -type SecretNewParamsBodyUnion interface { - implementsSecretNewParamsBodyUnion() -} - -type SecretNewParamsBodySecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret struct { - // secret will be created as an Environment Variable with the same name as the - // secret - EnvironmentVariable param.Field[bool] `json:"environmentVariable,required"` - Name param.Field[string] `json:"name"` - // project_id is the ProjectID this Secret belongs to - ProjectID param.Field[string] `json:"projectId" format:"uuid"` - // value is the plaintext value of the secret - Value param.Field[string] `json:"value"` -} - -func (r SecretNewParamsBodySecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r SecretNewParamsBodySecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret) implementsSecretNewParamsBodyUnion() { -} - -type SecretNewParamsBodyAbsolutePathToTheFileWhereTheSecretIsMounted struct { - // absolute path to the file where the secret is mounted value must be an absolute - // path (start with a /): - // - // ``` - // this.matches('^/(?:[^/]*/)*.*$') - // ``` - FilePath param.Field[string] `json:"filePath,required"` - Name param.Field[string] `json:"name"` - // project_id is the ProjectID this Secret belongs to - ProjectID param.Field[string] `json:"projectId" format:"uuid"` - // value is the plaintext value of the secret - Value param.Field[string] `json:"value"` -} - -func (r SecretNewParamsBodyAbsolutePathToTheFileWhereTheSecretIsMounted) MarshalJSON() (data []byte, err error) { +func (r SecretNewParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -func (r SecretNewParamsBodyAbsolutePathToTheFileWhereTheSecretIsMounted) implementsSecretNewParamsBodyUnion() { -} - type SecretListParams struct { Token param.Field[string] `query:"token"` PageSize param.Field[int64] `query:"pageSize"` diff --git a/secret_test.go b/secret_test.go index 091943d..07f7f2a 100644 --- a/secret_test.go +++ b/secret_test.go @@ -27,12 +27,11 @@ func TestSecretNewWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Secrets.New(context.TODO(), gitpod.SecretNewParams{ - Body: gitpod.SecretNewParamsBodySecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret{ - EnvironmentVariable: gitpod.F(true), - Name: gitpod.F("name"), - ProjectID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - Value: gitpod.F("x"), - }, + 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 new file mode 100644 index 0000000..2c6474a --- /dev/null +++ b/shared/shared.go @@ -0,0 +1,810 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package shared + +import ( + "time" + + "github.com/gitpod-io/flex-sdk-go" + "github.com/gitpod-io/flex-sdk-go/internal/apijson" + "github.com/gitpod-io/flex-sdk-go/internal/param" +) + +// An AutomationTrigger represents a trigger for an automation action. The +// `post_environment_start` field indicates that the automation should be triggered +// after the environment has started. The `post_devcontainer_start` field indicates +// that the automation should be triggered after the dev container has started. +type AutomationTrigger struct { + Manual bool `json:"manual"` + PostDevcontainerStart bool `json:"postDevcontainerStart"` + PostEnvironmentStart bool `json:"postEnvironmentStart"` + JSON automationTriggerJSON `json:"-"` +} + +// automationTriggerJSON contains the JSON metadata for the struct +// [AutomationTrigger] +type automationTriggerJSON struct { + Manual apijson.Field + PostDevcontainerStart apijson.Field + PostEnvironmentStart apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AutomationTrigger) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r automationTriggerJSON) RawJSON() string { + return r.raw +} + +// An AutomationTrigger represents a trigger for an automation action. The +// `post_environment_start` field indicates that the automation should be triggered +// after the environment has started. The `post_devcontainer_start` field indicates +// that the automation should be triggered after the dev container has started. +type AutomationTriggerParam struct { + Manual param.Field[bool] `json:"manual"` + PostDevcontainerStart param.Field[bool] `json:"postDevcontainerStart"` + PostEnvironmentStart param.Field[bool] `json:"postEnvironmentStart"` +} + +func (r AutomationTriggerParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type EnvironmentClass struct { + // id is the unique identifier of the environment class + ID string `json:"id"` + // configuration describes the configuration of the environment class + Configuration []FieldValue `json:"configuration"` + // description is a human readable description of the environment class + Description string `json:"description"` + // display_name is the human readable name of the environment class + DisplayName string `json:"displayName"` + // enabled indicates whether the environment class can be used to create new + // environments. + Enabled bool `json:"enabled"` + // runner_id is the unique identifier of the runner the environment class belongs + // to + RunnerID string `json:"runnerId"` + JSON environmentClassJSON `json:"-"` +} + +// environmentClassJSON contains the JSON metadata for the struct +// [EnvironmentClass] +type environmentClassJSON struct { + ID apijson.Field + Configuration apijson.Field + Description apijson.Field + DisplayName apijson.Field + Enabled apijson.Field + RunnerID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *EnvironmentClass) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r environmentClassJSON) RawJSON() string { + return r.raw +} + +type EnvironmentClassParam struct { + // id is the unique identifier of the environment class + ID param.Field[string] `json:"id"` + // configuration describes the configuration of the environment class + Configuration param.Field[[]FieldValueParam] `json:"configuration"` + // description is a human readable description of the environment class + Description param.Field[string] `json:"description"` + // display_name is the human readable name of the environment class + DisplayName param.Field[string] `json:"displayName"` + // enabled indicates whether the environment class can be used to create new + // environments. + Enabled param.Field[bool] `json:"enabled"` + // runner_id is the unique identifier of the runner the environment class belongs + // to + RunnerID param.Field[string] `json:"runnerId"` +} + +func (r EnvironmentClassParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type FieldValue struct { + Key string `json:"key"` + Value string `json:"value"` + JSON fieldValueJSON `json:"-"` +} + +// fieldValueJSON contains the JSON metadata for the struct [FieldValue] +type fieldValueJSON struct { + Key apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *FieldValue) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r fieldValueJSON) RawJSON() string { + return r.raw +} + +type FieldValueParam struct { + Key param.Field[string] `json:"key"` + Value param.Field[string] `json:"value"` +} + +func (r FieldValueParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type OrganizationRole string + +const ( + OrganizationRoleOrganizationRoleUnspecified OrganizationRole = "ORGANIZATION_ROLE_UNSPECIFIED" + OrganizationRoleOrganizationRoleAdmin OrganizationRole = "ORGANIZATION_ROLE_ADMIN" + OrganizationRoleOrganizationRoleMember OrganizationRole = "ORGANIZATION_ROLE_MEMBER" +) + +func (r OrganizationRole) IsKnown() bool { + switch r { + case OrganizationRoleOrganizationRoleUnspecified, OrganizationRoleOrganizationRoleAdmin, OrganizationRoleOrganizationRoleMember: + return true + } + return false +} + +type Principal string + +const ( + PrincipalPrincipalUnspecified Principal = "PRINCIPAL_UNSPECIFIED" + PrincipalPrincipalAccount Principal = "PRINCIPAL_ACCOUNT" + PrincipalPrincipalUser Principal = "PRINCIPAL_USER" + PrincipalPrincipalRunner Principal = "PRINCIPAL_RUNNER" + PrincipalPrincipalEnvironment Principal = "PRINCIPAL_ENVIRONMENT" + PrincipalPrincipalServiceAccount Principal = "PRINCIPAL_SERVICE_ACCOUNT" +) + +func (r Principal) IsKnown() bool { + switch r { + case PrincipalPrincipalUnspecified, PrincipalPrincipalAccount, PrincipalPrincipalUser, PrincipalPrincipalRunner, PrincipalPrincipalEnvironment, PrincipalPrincipalServiceAccount: + return true + } + return false +} + +type RunsOn struct { + Docker RunsOnDocker `json:"docker,required"` + JSON runsOnJSON `json:"-"` +} + +// runsOnJSON contains the JSON metadata for the struct [RunsOn] +type runsOnJSON struct { + Docker apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RunsOn) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r runsOnJSON) RawJSON() string { + return r.raw +} + +type RunsOnDocker struct { + Environment []string `json:"environment"` + Image string `json:"image"` + JSON runsOnDockerJSON `json:"-"` +} + +// runsOnDockerJSON contains the JSON metadata for the struct [RunsOnDocker] +type runsOnDockerJSON struct { + Environment apijson.Field + Image apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RunsOnDocker) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r runsOnDockerJSON) RawJSON() string { + return r.raw +} + +type RunsOnParam struct { + Docker param.Field[RunsOnDockerParam] `json:"docker,required"` +} + +func (r RunsOnParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type RunsOnDockerParam struct { + Environment param.Field[[]string] `json:"environment"` + Image param.Field[string] `json:"image"` +} + +func (r RunsOnDockerParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type Subject struct { + // id is the UUID of the subject + ID string `json:"id"` + // Principal is the principal of the subject + Principal Principal `json:"principal"` + JSON subjectJSON `json:"-"` +} + +// subjectJSON contains the JSON metadata for the struct [Subject] +type subjectJSON struct { + ID apijson.Field + Principal apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *Subject) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r subjectJSON) RawJSON() string { + return r.raw +} + +type SubjectParam struct { + // id is the UUID of the subject + ID param.Field[string] `json:"id"` + // Principal is the principal of the subject + Principal param.Field[Principal] `json:"principal"` +} + +func (r SubjectParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type TaskExecution struct { + ID string `json:"id" format:"uuid"` + Metadata TaskExecutionMetadata `json:"metadata"` + Spec TaskExecutionSpec `json:"spec"` + Status TaskExecutionStatus `json:"status"` + JSON taskExecutionJSON `json:"-"` +} + +// taskExecutionJSON contains the JSON metadata for the struct [TaskExecution] +type taskExecutionJSON struct { + ID apijson.Field + Metadata apijson.Field + Spec apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *TaskExecution) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r taskExecutionJSON) RawJSON() string { + return r.raw +} + +type TaskExecutionMetadata 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. + CompletedAt time.Time `json:"completedAt" format:"date-time"` + // 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/started the task run. + Creator Subject `json:"creator"` + // environment_id is the ID of the environment in which the task run is executed. + EnvironmentID string `json:"environmentId" format:"uuid"` + // A Timestamp represents a point in time independent of any time zone or local + // calendar, encoded as a count of seconds and fractions of seconds at nanosecond + // resolution. The count is relative to an epoch at UTC midnight on January 1, + // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar + // backwards to year one. + // + // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + // second table is needed for interpretation, using a + // [24-hour linear smear](https://developers.google.com/time/smear). + // + // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + // restricting to that range, we ensure that we can convert to and from + // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + // + // # Examples + // + // Example 1: Compute Timestamp from POSIX `time()`. + // + // Timestamp timestamp; + // timestamp.set_seconds(time(NULL)); + // timestamp.set_nanos(0); + // + // Example 2: Compute Timestamp from POSIX `gettimeofday()`. + // + // struct timeval tv; + // gettimeofday(&tv, NULL); + // + // Timestamp timestamp; + // timestamp.set_seconds(tv.tv_sec); + // timestamp.set_nanos(tv.tv_usec * 1000); + // + // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + // + // FILETIME ft; + // GetSystemTimeAsFileTime(&ft); + // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + // + // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + // Timestamp timestamp; + // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + // + // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + // + // long millis = System.currentTimeMillis(); + // + // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + // .setNanos((int) ((millis % 1000) * 1000000)).build(); + // + // Example 5: Compute Timestamp from Java `Instant.now()`. + // + // Instant now = Instant.now(); + // + // Timestamp timestamp = + // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + // .setNanos(now.getNano()).build(); + // + // Example 6: Compute Timestamp from current time in Python. + // + // timestamp = Timestamp() + // timestamp.GetCurrentTime() + // + // # JSON Mapping + // + // In JSON format, the Timestamp type is encoded as a string in the + // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is + // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always + // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are + // zero-padded to two digits each. The fractional seconds, which can go up to 9 + // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix + // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON + // serializer should always use UTC (as indicated by "Z") when printing the + // Timestamp type and a proto3 JSON parser should be able to accept both UTC and + // other timezones (as indicated by an offset). + // + // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on + // January 15, 2017. + // + // In JavaScript, one can convert a Date object to this format using the standard + // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + // method. In Python, a standard `datetime.datetime` object can be converted to + // this format using + // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the + // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the + // Joda Time's + // [`ISODateTimeFormat.dateTime()`]() + // to obtain a formatter capable of generating timestamps in this format. + StartedAt time.Time `json:"startedAt" format:"date-time"` + // started_by describes the trigger that started the task execution. + StartedBy string `json:"startedBy"` + // task_id is the ID of the main task being executed. + TaskID string `json:"taskId" format:"uuid"` + JSON taskExecutionMetadataJSON `json:"-"` +} + +// taskExecutionMetadataJSON contains the JSON metadata for the struct +// [TaskExecutionMetadata] +type taskExecutionMetadataJSON struct { + CompletedAt apijson.Field + CreatedAt apijson.Field + Creator apijson.Field + EnvironmentID apijson.Field + StartedAt apijson.Field + StartedBy apijson.Field + TaskID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *TaskExecutionMetadata) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r taskExecutionMetadataJSON) RawJSON() string { + return r.raw +} + +type TaskExecutionPhase string + +const ( + TaskExecutionPhaseTaskExecutionPhaseUnspecified TaskExecutionPhase = "TASK_EXECUTION_PHASE_UNSPECIFIED" + TaskExecutionPhaseTaskExecutionPhasePending TaskExecutionPhase = "TASK_EXECUTION_PHASE_PENDING" + TaskExecutionPhaseTaskExecutionPhaseRunning TaskExecutionPhase = "TASK_EXECUTION_PHASE_RUNNING" + TaskExecutionPhaseTaskExecutionPhaseSucceeded TaskExecutionPhase = "TASK_EXECUTION_PHASE_SUCCEEDED" + TaskExecutionPhaseTaskExecutionPhaseFailed TaskExecutionPhase = "TASK_EXECUTION_PHASE_FAILED" + TaskExecutionPhaseTaskExecutionPhaseStopped TaskExecutionPhase = "TASK_EXECUTION_PHASE_STOPPED" +) + +func (r TaskExecutionPhase) IsKnown() bool { + switch r { + case TaskExecutionPhaseTaskExecutionPhaseUnspecified, TaskExecutionPhaseTaskExecutionPhasePending, TaskExecutionPhaseTaskExecutionPhaseRunning, TaskExecutionPhaseTaskExecutionPhaseSucceeded, TaskExecutionPhaseTaskExecutionPhaseFailed, TaskExecutionPhaseTaskExecutionPhaseStopped: + return true + } + return false +} + +type TaskExecutionSpec struct { + // desired_phase is the phase the task execution should be in. Used to stop a + // running task execution early. + DesiredPhase TaskExecutionPhase `json:"desiredPhase"` + // plan is a list of groups of steps. The steps in a group are executed + // concurrently, while the groups are executed sequentially. The order of the + // groups is the order in which they are executed. + Plan []TaskExecutionSpecPlan `json:"plan"` + JSON taskExecutionSpecJSON `json:"-"` +} + +// taskExecutionSpecJSON contains the JSON metadata for the struct +// [TaskExecutionSpec] +type taskExecutionSpecJSON struct { + DesiredPhase apijson.Field + Plan apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *TaskExecutionSpec) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r taskExecutionSpecJSON) RawJSON() string { + return r.raw +} + +type TaskExecutionSpecPlan struct { + Steps []TaskExecutionSpecPlanStep `json:"steps"` + JSON taskExecutionSpecPlanJSON `json:"-"` +} + +// taskExecutionSpecPlanJSON contains the JSON metadata for the struct +// [TaskExecutionSpecPlan] +type taskExecutionSpecPlanJSON struct { + Steps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *TaskExecutionSpecPlan) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r taskExecutionSpecPlanJSON) RawJSON() string { + return r.raw +} + +type TaskExecutionSpecPlanStep struct { + // ID is the ID of the execution step + ID string `json:"id" format:"uuid"` + DependsOn []string `json:"dependsOn"` + Label string `json:"label"` + ServiceID string `json:"serviceId" format:"uuid"` + Task TaskExecutionSpecPlanStepsTask `json:"task"` + JSON taskExecutionSpecPlanStepJSON `json:"-"` +} + +// taskExecutionSpecPlanStepJSON contains the JSON metadata for the struct +// [TaskExecutionSpecPlanStep] +type taskExecutionSpecPlanStepJSON struct { + ID apijson.Field + DependsOn apijson.Field + Label apijson.Field + ServiceID apijson.Field + Task apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *TaskExecutionSpecPlanStep) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r taskExecutionSpecPlanStepJSON) RawJSON() string { + return r.raw +} + +type TaskExecutionSpecPlanStepsTask struct { + ID string `json:"id" format:"uuid"` + Spec gitpod.TaskSpec `json:"spec"` + JSON taskExecutionSpecPlanStepsTaskJSON `json:"-"` +} + +// taskExecutionSpecPlanStepsTaskJSON contains the JSON metadata for the struct +// [TaskExecutionSpecPlanStepsTask] +type taskExecutionSpecPlanStepsTaskJSON struct { + ID apijson.Field + Spec apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *TaskExecutionSpecPlanStepsTask) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r taskExecutionSpecPlanStepsTaskJSON) RawJSON() string { + return r.raw +} + +type TaskExecutionStatus struct { + // failure_message summarises why the task execution failed to operate. If this is + // non-empty the task execution has failed to operate and will likely transition to + // a failed state. + FailureMessage string `json:"failureMessage"` + // log_url is the URL to the logs of the task's steps. If this is empty, the task + // either has no logs or has not yet started. + LogURL string `json:"logUrl"` + // the phase of a task execution represents the aggregated phase of all steps. + Phase TaskExecutionPhase `json:"phase"` + // version of the status update. Task executions themselves are unversioned, but + // their status has different versions. The value of this field has no semantic + // meaning (e.g. don't interpret it as as a timestamp), but it can be used to + // impose a partial order. If a.status_version < b.status_version then a was the + // status before b. + StatusVersion string `json:"statusVersion"` + // steps provides the status for each individual step of the task execution. If a + // step is missing it has not yet started. + Steps []TaskExecutionStatusStep `json:"steps"` + JSON taskExecutionStatusJSON `json:"-"` +} + +// taskExecutionStatusJSON contains the JSON metadata for the struct +// [TaskExecutionStatus] +type taskExecutionStatusJSON struct { + FailureMessage apijson.Field + LogURL apijson.Field + Phase apijson.Field + StatusVersion apijson.Field + Steps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *TaskExecutionStatus) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r taskExecutionStatusJSON) RawJSON() string { + return r.raw +} + +type TaskExecutionStatusStep struct { + // ID is the ID of the execution step + ID string `json:"id" format:"uuid"` + // failure_message summarises why the step failed to operate. If this is non-empty + // the step has failed to operate and will likely transition to a failed state. + FailureMessage string `json:"failureMessage"` + // phase is the current phase of the execution step + Phase TaskExecutionPhase `json:"phase"` + JSON taskExecutionStatusStepJSON `json:"-"` +} + +// taskExecutionStatusStepJSON contains the JSON metadata for the struct +// [TaskExecutionStatusStep] +type taskExecutionStatusStepJSON struct { + ID apijson.Field + FailureMessage apijson.Field + Phase apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *TaskExecutionStatusStep) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r taskExecutionStatusStepJSON) RawJSON() string { + return r.raw +} + +type UserStatus string + +const ( + UserStatusUserStatusUnspecified UserStatus = "USER_STATUS_UNSPECIFIED" + UserStatusUserStatusActive UserStatus = "USER_STATUS_ACTIVE" + UserStatusUserStatusSuspended UserStatus = "USER_STATUS_SUSPENDED" + UserStatusUserStatusLeft UserStatus = "USER_STATUS_LEFT" +) + +func (r UserStatus) IsKnown() bool { + switch r { + case UserStatusUserStatusUnspecified, UserStatusUserStatusActive, UserStatusUserStatusSuspended, UserStatusUserStatusLeft: + return true + } + return false +} diff --git a/user.go b/user.go index 325af98..9819038 100644 --- a/user.go +++ b/user.go @@ -11,6 +11,7 @@ import ( "github.com/gitpod-io/flex-sdk-go/internal/param" "github.com/gitpod-io/flex-sdk-go/internal/requestconfig" "github.com/gitpod-io/flex-sdk-go/option" + "github.com/gitpod-io/flex-sdk-go/shared" ) // UserService contains methods and other services that help with interacting with @@ -50,28 +51,7 @@ func (r *UserService) SetSuspended(ctx context.Context, body UserSetSuspendedPar return } -type UserGetAuthenticatedUserResponse struct { - User UserGetAuthenticatedUserResponseUser `json:"user"` - JSON userGetAuthenticatedUserResponseJSON `json:"-"` -} - -// userGetAuthenticatedUserResponseJSON contains the JSON metadata for the struct -// [UserGetAuthenticatedUserResponse] -type userGetAuthenticatedUserResponseJSON struct { - User apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserGetAuthenticatedUserResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r userGetAuthenticatedUserResponseJSON) RawJSON() string { - return r.raw -} - -type UserGetAuthenticatedUserResponseUser struct { +type User struct { // id is a UUID of the user ID string `json:"id" format:"uuid"` // avatar_url is a link to the user avatar @@ -172,13 +152,12 @@ type UserGetAuthenticatedUserResponseUser struct { // +optional if not set, this account is owned by the installation. OrganizationID string `json:"organizationId" format:"uuid"` // status is the status the user is in - Status UserGetAuthenticatedUserResponseUserStatus `json:"status"` - JSON userGetAuthenticatedUserResponseUserJSON `json:"-"` + Status shared.UserStatus `json:"status"` + JSON userJSON `json:"-"` } -// userGetAuthenticatedUserResponseUserJSON contains the JSON metadata for the -// struct [UserGetAuthenticatedUserResponseUser] -type userGetAuthenticatedUserResponseUserJSON struct { +// userJSON contains the JSON metadata for the struct [User] +type userJSON struct { ID apijson.Field AvatarURL apijson.Field CreatedAt apijson.Field @@ -189,30 +168,33 @@ type userGetAuthenticatedUserResponseUserJSON struct { ExtraFields map[string]apijson.Field } -func (r *UserGetAuthenticatedUserResponseUser) UnmarshalJSON(data []byte) (err error) { +func (r *User) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r userGetAuthenticatedUserResponseUserJSON) RawJSON() string { +func (r userJSON) RawJSON() string { return r.raw } -// status is the status the user is in -type UserGetAuthenticatedUserResponseUserStatus string +type UserGetAuthenticatedUserResponse struct { + User User `json:"user"` + JSON userGetAuthenticatedUserResponseJSON `json:"-"` +} -const ( - UserGetAuthenticatedUserResponseUserStatusUserStatusUnspecified UserGetAuthenticatedUserResponseUserStatus = "USER_STATUS_UNSPECIFIED" - UserGetAuthenticatedUserResponseUserStatusUserStatusActive UserGetAuthenticatedUserResponseUserStatus = "USER_STATUS_ACTIVE" - UserGetAuthenticatedUserResponseUserStatusUserStatusSuspended UserGetAuthenticatedUserResponseUserStatus = "USER_STATUS_SUSPENDED" - UserGetAuthenticatedUserResponseUserStatusUserStatusLeft UserGetAuthenticatedUserResponseUserStatus = "USER_STATUS_LEFT" -) +// userGetAuthenticatedUserResponseJSON contains the JSON metadata for the struct +// [UserGetAuthenticatedUserResponse] +type userGetAuthenticatedUserResponseJSON struct { + User apijson.Field + raw string + ExtraFields map[string]apijson.Field +} -func (r UserGetAuthenticatedUserResponseUserStatus) IsKnown() bool { - switch r { - case UserGetAuthenticatedUserResponseUserStatusUserStatusUnspecified, UserGetAuthenticatedUserResponseUserStatusUserStatusActive, UserGetAuthenticatedUserResponseUserStatusUserStatusSuspended, UserGetAuthenticatedUserResponseUserStatusUserStatusLeft: - return true - } - return false +func (r *UserGetAuthenticatedUserResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r userGetAuthenticatedUserResponseJSON) RawJSON() string { + return r.raw } type UserSetSuspendedResponse = interface{} diff --git a/userpat.go b/userpat.go index cbfae78..27dc5f6 100644 --- a/userpat.go +++ b/userpat.go @@ -14,6 +14,7 @@ import ( "github.com/gitpod-io/flex-sdk-go/internal/requestconfig" "github.com/gitpod-io/flex-sdk-go/option" "github.com/gitpod-io/flex-sdk-go/packages/pagination" + "github.com/gitpod-io/flex-sdk-go/shared" ) // UserPatService contains methods and other services that help with interacting @@ -36,7 +37,7 @@ func NewUserPatService(opts ...option.RequestOption) (r *UserPatService) { } // ListPersonalAccessTokens -func (r *UserPatService) List(ctx context.Context, params UserPatListParams, opts ...option.RequestOption) (res *pagination.PersonalAccessTokensPage[UserPatListResponse], err error) { +func (r *UserPatService) List(ctx context.Context, params UserPatListParams, opts ...option.RequestOption) (res *pagination.PersonalAccessTokensPage[PersonalAccessToken], err error) { var raw *http.Response opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -54,7 +55,7 @@ func (r *UserPatService) List(ctx context.Context, params UserPatListParams, opt } // ListPersonalAccessTokens -func (r *UserPatService) ListAutoPaging(ctx context.Context, params UserPatListParams, opts ...option.RequestOption) *pagination.PersonalAccessTokensPageAutoPager[UserPatListResponse] { +func (r *UserPatService) ListAutoPaging(ctx context.Context, params UserPatListParams, opts ...option.RequestOption) *pagination.PersonalAccessTokensPageAutoPager[PersonalAccessToken] { return pagination.NewPersonalAccessTokensPageAutoPager(r.List(ctx, params, opts...)) } @@ -74,7 +75,7 @@ func (r *UserPatService) Get(ctx context.Context, body UserPatGetParams, opts .. return } -type UserPatListResponse struct { +type PersonalAccessToken struct { ID string `json:"id" 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 @@ -164,9 +165,9 @@ type UserPatListResponse 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"` - Creator UserPatListResponseCreator `json:"creator"` - Description string `json:"description"` + CreatedAt time.Time `json:"createdAt" format:"date-time"` + Creator shared.Subject `json:"creator"` + Description string `json:"description"` // 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, @@ -346,12 +347,12 @@ type UserPatListResponse struct { // to obtain a formatter capable of generating timestamps in this format. LastUsed time.Time `json:"lastUsed" format:"date-time"` UserID string `json:"userId" format:"uuid"` - JSON userPatListResponseJSON `json:"-"` + JSON personalAccessTokenJSON `json:"-"` } -// userPatListResponseJSON contains the JSON metadata for the struct -// [UserPatListResponse] -type userPatListResponseJSON struct { +// personalAccessTokenJSON contains the JSON metadata for the struct +// [PersonalAccessToken] +type personalAccessTokenJSON struct { ID apijson.Field CreatedAt apijson.Field Creator apijson.Field @@ -363,63 +364,18 @@ type userPatListResponseJSON struct { ExtraFields map[string]apijson.Field } -func (r *UserPatListResponse) UnmarshalJSON(data []byte) (err error) { +func (r *PersonalAccessToken) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r userPatListResponseJSON) RawJSON() string { +func (r personalAccessTokenJSON) RawJSON() string { return r.raw } -type UserPatListResponseCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal UserPatListResponseCreatorPrincipal `json:"principal"` - JSON userPatListResponseCreatorJSON `json:"-"` -} - -// userPatListResponseCreatorJSON contains the JSON metadata for the struct -// [UserPatListResponseCreator] -type userPatListResponseCreatorJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserPatListResponseCreator) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r userPatListResponseCreatorJSON) RawJSON() string { - return r.raw -} - -// Principal is the principal of the subject -type UserPatListResponseCreatorPrincipal string - -const ( - UserPatListResponseCreatorPrincipalPrincipalUnspecified UserPatListResponseCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - UserPatListResponseCreatorPrincipalPrincipalAccount UserPatListResponseCreatorPrincipal = "PRINCIPAL_ACCOUNT" - UserPatListResponseCreatorPrincipalPrincipalUser UserPatListResponseCreatorPrincipal = "PRINCIPAL_USER" - UserPatListResponseCreatorPrincipalPrincipalRunner UserPatListResponseCreatorPrincipal = "PRINCIPAL_RUNNER" - UserPatListResponseCreatorPrincipalPrincipalEnvironment UserPatListResponseCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - UserPatListResponseCreatorPrincipalPrincipalServiceAccount UserPatListResponseCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r UserPatListResponseCreatorPrincipal) IsKnown() bool { - switch r { - case UserPatListResponseCreatorPrincipalPrincipalUnspecified, UserPatListResponseCreatorPrincipalPrincipalAccount, UserPatListResponseCreatorPrincipalPrincipalUser, UserPatListResponseCreatorPrincipalPrincipalRunner, UserPatListResponseCreatorPrincipalPrincipalEnvironment, UserPatListResponseCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - type UserPatDeleteResponse = interface{} type UserPatGetResponse struct { - Pat UserPatGetResponsePat `json:"pat"` + Pat PersonalAccessToken `json:"pat"` JSON userPatGetResponseJSON `json:"-"` } @@ -439,348 +395,6 @@ func (r userPatGetResponseJSON) RawJSON() string { return r.raw } -type UserPatGetResponsePat struct { - ID string `json:"id" format:"uuid"` - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. - CreatedAt time.Time `json:"createdAt" format:"date-time"` - Creator UserPatGetResponsePatCreator `json:"creator"` - Description string `json:"description"` - // 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. - ExpiresAt time.Time `json:"expiresAt" format:"date-time"` - // 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. - LastUsed time.Time `json:"lastUsed" format:"date-time"` - UserID string `json:"userId" format:"uuid"` - JSON userPatGetResponsePatJSON `json:"-"` -} - -// userPatGetResponsePatJSON contains the JSON metadata for the struct -// [UserPatGetResponsePat] -type userPatGetResponsePatJSON struct { - ID apijson.Field - CreatedAt apijson.Field - Creator apijson.Field - Description apijson.Field - ExpiresAt apijson.Field - LastUsed apijson.Field - UserID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserPatGetResponsePat) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r userPatGetResponsePatJSON) RawJSON() string { - return r.raw -} - -type UserPatGetResponsePatCreator struct { - // id is the UUID of the subject - ID string `json:"id"` - // Principal is the principal of the subject - Principal UserPatGetResponsePatCreatorPrincipal `json:"principal"` - JSON userPatGetResponsePatCreatorJSON `json:"-"` -} - -// userPatGetResponsePatCreatorJSON contains the JSON metadata for the struct -// [UserPatGetResponsePatCreator] -type userPatGetResponsePatCreatorJSON struct { - ID apijson.Field - Principal apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *UserPatGetResponsePatCreator) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r userPatGetResponsePatCreatorJSON) RawJSON() string { - return r.raw -} - -// Principal is the principal of the subject -type UserPatGetResponsePatCreatorPrincipal string - -const ( - UserPatGetResponsePatCreatorPrincipalPrincipalUnspecified UserPatGetResponsePatCreatorPrincipal = "PRINCIPAL_UNSPECIFIED" - UserPatGetResponsePatCreatorPrincipalPrincipalAccount UserPatGetResponsePatCreatorPrincipal = "PRINCIPAL_ACCOUNT" - UserPatGetResponsePatCreatorPrincipalPrincipalUser UserPatGetResponsePatCreatorPrincipal = "PRINCIPAL_USER" - UserPatGetResponsePatCreatorPrincipalPrincipalRunner UserPatGetResponsePatCreatorPrincipal = "PRINCIPAL_RUNNER" - UserPatGetResponsePatCreatorPrincipalPrincipalEnvironment UserPatGetResponsePatCreatorPrincipal = "PRINCIPAL_ENVIRONMENT" - UserPatGetResponsePatCreatorPrincipalPrincipalServiceAccount UserPatGetResponsePatCreatorPrincipal = "PRINCIPAL_SERVICE_ACCOUNT" -) - -func (r UserPatGetResponsePatCreatorPrincipal) IsKnown() bool { - switch r { - case UserPatGetResponsePatCreatorPrincipalPrincipalUnspecified, UserPatGetResponsePatCreatorPrincipalPrincipalAccount, UserPatGetResponsePatCreatorPrincipalPrincipalUser, UserPatGetResponsePatCreatorPrincipalPrincipalRunner, UserPatGetResponsePatCreatorPrincipalPrincipalEnvironment, UserPatGetResponsePatCreatorPrincipalPrincipalServiceAccount: - return true - } - return false -} - type UserPatListParams struct { Token param.Field[string] `query:"token"` PageSize param.Field[int64] `query:"pageSize"`