From 78b2504189e98dcfaef1427444378752ccede6cc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 19 Feb 2025 09:33:01 +0000 Subject: [PATCH 1/4] feat(api): manual updates (#48) --- .stats.yml | 2 +- event.go | 74 +++++- event_test.go | 4 +- group.go | 60 ++++- group_test.go | 2 +- project.go | 164 +++++++++++- project_test.go | 20 +- projectpolicy.go | 99 ++++++- projectpolicy_test.go | 16 +- runner.go | 241 ++++++++++++++++-- runner_test.go | 20 +- runnerconfiguration.go | 25 +- runnerconfiguration_test.go | 12 +- runnerconfigurationenvironmentclass.go | 130 +++++++++- runnerconfigurationenvironmentclass_test.go | 23 +- runnerconfigurationhostauthenticationtoken.go | 141 +++++++++- ...nfigurationhostauthenticationtoken_test.go | 24 +- runnerconfigurationschema.go | 18 +- runnerconfigurationschema_test.go | 2 +- runnerconfigurationscmintegration.go | 120 ++++++++- runnerconfigurationscmintegration_test.go | 24 +- runnerpolicy.go | 99 ++++++- runnerpolicy_test.go | 16 +- 23 files changed, 1184 insertions(+), 152 deletions(-) diff --git a/.stats.yml b/.stats.yml index f08fd6b..27a7d82 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 111 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-cd6a05ae99d2a050577fa0e729e6ae89b4eacd78f61366a77269398368f8a877.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-d6a243325df36817d495ce6dd54f80766b77a97e1ca2f6d371c0a68b7d070e0f.yml diff --git a/event.go b/event.go index 382100e..7987a2a 100644 --- a/event.go +++ b/event.go @@ -37,8 +37,32 @@ func NewEventService(opts ...option.RequestOption) (r *EventService) { return } -// ListAuditLogs retrieves a paginated list of audit logs for the specified -// organization +// Lists audit logs with filtering and pagination options. +// +// Use this method to: +// +// - View audit history +// - Track user actions +// - Monitor system changes +// +// ### Examples +// +// - List all logs: +// +// ```yaml +// pagination: +// pageSize: 20 +// ``` +// +// - Filter by actor: +// +// ```yaml +// filter: +// actorIds: ["d2c94c27-3b76-4a42-b88c-95a85e392c68"] +// actorPrincipals: ["PRINCIPAL_USER"] +// pagination: +// pageSize: 20 +// ``` func (r *EventService) List(ctx context.Context, params EventListParams, opts ...option.RequestOption) (res *pagination.EntriesPage[EventListResponse], err error) { var raw *http.Response opts = append(r.Options[:], opts...) @@ -56,13 +80,53 @@ func (r *EventService) List(ctx context.Context, params EventListParams, opts .. return res, nil } -// ListAuditLogs retrieves a paginated list of audit logs for the specified -// organization +// Lists audit logs with filtering and pagination options. +// +// Use this method to: +// +// - View audit history +// - Track user actions +// - Monitor system changes +// +// ### Examples +// +// - List all logs: +// +// ```yaml +// pagination: +// pageSize: 20 +// ``` +// +// - Filter by actor: +// +// ```yaml +// filter: +// actorIds: ["d2c94c27-3b76-4a42-b88c-95a85e392c68"] +// actorPrincipals: ["PRINCIPAL_USER"] +// pagination: +// pageSize: 20 +// ``` func (r *EventService) ListAutoPaging(ctx context.Context, params EventListParams, opts ...option.RequestOption) *pagination.EntriesPageAutoPager[EventListResponse] { return pagination.NewEntriesPageAutoPager(r.List(ctx, params, opts...)) } -// WatchEvents streams all requests events to the client +// Streams events for all projects, runners, environments, tasks, and services +// based on the specified scope. +// +// Use this method to: +// +// - Monitor resource changes in real-time +// - Track system events +// - Receive notifications +// +// The scope parameter determines which events to watch: +// +// - Organization scope (default): Watch all organization-wide events including +// projects, runners and environments. Task and service events are not included. +// Use by setting organization=true or omitting the scope. +// - Environment scope: Watch events for a specific environment, including its +// tasks, task executions, and services. Use by setting environment_id to the +// UUID of the environment to watch. func (r *EventService) WatchStreaming(ctx context.Context, body EventWatchParams, opts ...option.RequestOption) (stream *jsonl.Stream[EventWatchResponse]) { var ( raw *http.Response diff --git a/event_test.go b/event_test.go index ce86619..7157557 100644 --- a/event_test.go +++ b/event_test.go @@ -31,14 +31,14 @@ func TestEventListWithOptionalParams(t *testing.T) { Token: gitpod.F("token"), PageSize: gitpod.F(int64(0)), Filter: gitpod.F(gitpod.EventListParamsFilter{ - ActorIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), + ActorIDs: gitpod.F([]string{"d2c94c27-3b76-4a42-b88c-95a85e392c68"}), ActorPrincipals: gitpod.F([]shared.Principal{shared.PrincipalUnspecified}), SubjectIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), SubjectTypes: gitpod.F([]gitpod.ResourceType{gitpod.ResourceTypeUnspecified}), }), Pagination: gitpod.F(gitpod.EventListParamsPagination{ Token: gitpod.F("token"), - PageSize: gitpod.F(int64(100)), + PageSize: gitpod.F(int64(20)), }), }) if err != nil { diff --git a/group.go b/group.go index 8591610..3605d69 100644 --- a/group.go +++ b/group.go @@ -35,7 +35,35 @@ func NewGroupService(opts ...option.RequestOption) (r *GroupService) { return } -// ListGroups lists groups +// Lists groups with optional pagination. +// +// Use this method to: +// +// - View all groups +// - Check group memberships +// - Monitor group configurations +// - Audit group access +// +// ### Examples +// +// - List all groups: +// +// Shows all groups with pagination. +// +// ```yaml +// pagination: +// pageSize: 20 +// ``` +// +// - List with custom page size: +// +// Shows groups with specified page size. +// +// ```yaml +// pagination: +// pageSize: 50 +// token: "next-page-token-from-previous-response" +// ``` 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...) @@ -53,7 +81,35 @@ func (r *GroupService) List(ctx context.Context, params GroupListParams, opts .. return res, nil } -// ListGroups lists groups +// Lists groups with optional pagination. +// +// Use this method to: +// +// - View all groups +// - Check group memberships +// - Monitor group configurations +// - Audit group access +// +// ### Examples +// +// - List all groups: +// +// Shows all groups with pagination. +// +// ```yaml +// pagination: +// pageSize: 20 +// ``` +// +// - List with custom page size: +// +// Shows groups with specified page size. +// +// ```yaml +// pagination: +// pageSize: 50 +// token: "next-page-token-from-previous-response" +// ``` func (r *GroupService) ListAutoPaging(ctx context.Context, params GroupListParams, opts ...option.RequestOption) *pagination.GroupsPageAutoPager[Group] { return pagination.NewGroupsPageAutoPager(r.List(ctx, params, opts...)) } diff --git a/group_test.go b/group_test.go index 95bd144..c36c71a 100644 --- a/group_test.go +++ b/group_test.go @@ -31,7 +31,7 @@ func TestGroupListWithOptionalParams(t *testing.T) { PageSize: gitpod.F(int64(0)), Pagination: gitpod.F(gitpod.GroupListParamsPagination{ Token: gitpod.F("token"), - PageSize: gitpod.F(int64(100)), + PageSize: gitpod.F(int64(20)), }), }) if err != nil { diff --git a/project.go b/project.go index 25975a9..c5ca467 100644 --- a/project.go +++ b/project.go @@ -38,7 +38,46 @@ func NewProjectService(opts ...option.RequestOption) (r *ProjectService) { return } -// CreateProject creates a new Project. +// Creates a new project with specified configuration. +// +// Use this method to: +// +// - Set up development projects +// - Configure project environments +// - Define project settings +// - Initialize project content +// +// ### Examples +// +// - Create basic project: +// +// Creates a project with minimal configuration. +// +// ```yaml +// name: "Web Application" +// environmentClass: +// environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// initializer: +// specs: +// - git: +// remoteUri: "https://github.com/org/repo" +// ``` +// +// - Create project with devcontainer: +// +// Creates a project with custom development container. +// +// ```yaml +// name: "Backend Service" +// environmentClass: +// environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// initializer: +// specs: +// - git: +// remoteUri: "https://github.com/org/backend" +// devcontainerFilePath: ".devcontainer/devcontainer.json" +// automationsFilePath: ".gitpod/automations.yaml" +// ``` func (r *ProjectService) New(ctx context.Context, body ProjectNewParams, opts ...option.RequestOption) (res *ProjectNewResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.ProjectService/CreateProject" @@ -46,7 +85,23 @@ func (r *ProjectService) New(ctx context.Context, body ProjectNewParams, opts .. return } -// GetProject retrieves a single Project. +// Gets details about a specific project. +// +// Use this method to: +// +// - View project configuration +// - Check project status +// - Get project metadata +// +// ### Examples +// +// - Get project details: +// +// Retrieves information about a specific project. +// +// ```yaml +// projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// ``` func (r *ProjectService) Get(ctx context.Context, body ProjectGetParams, opts ...option.RequestOption) (res *ProjectGetResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.ProjectService/GetProject" @@ -54,7 +109,35 @@ func (r *ProjectService) Get(ctx context.Context, body ProjectGetParams, opts .. return } -// UpdateProject updates the properties of a Project. +// Updates a project's configuration. +// +// Use this method to: +// +// - Modify project settings +// - Update environment class +// - Change project name +// - Configure initializers +// +// ### Examples +// +// - Update project name: +// +// Changes the project's display name. +// +// ```yaml +// projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// name: "New Project Name" +// ``` +// +// - Update environment class: +// +// Changes the project's environment class. +// +// ```yaml +// projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// environmentClass: +// environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *ProjectService) Update(ctx context.Context, body ProjectUpdateParams, opts ...option.RequestOption) (res *ProjectUpdateResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.ProjectService/UpdateProject" @@ -62,7 +145,24 @@ func (r *ProjectService) Update(ctx context.Context, body ProjectUpdateParams, o return } -// ListProjects lists all projects the caller has access to. +// Lists projects with optional filtering. +// +// Use this method to: +// +// - View all accessible projects +// - Browse project configurations +// - Monitor project status +// +// ### Examples +// +// - List projects: +// +// Shows all projects with pagination. +// +// ```yaml +// pagination: +// pageSize: 20 +// ``` 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...) @@ -80,12 +180,45 @@ func (r *ProjectService) List(ctx context.Context, params ProjectListParams, opt return res, nil } -// ListProjects lists all projects the caller has access to. +// Lists projects with optional filtering. +// +// Use this method to: +// +// - View all accessible projects +// - Browse project configurations +// - Monitor project status +// +// ### Examples +// +// - List projects: +// +// Shows all projects with pagination. +// +// ```yaml +// pagination: +// pageSize: 20 +// ``` func (r *ProjectService) ListAutoPaging(ctx context.Context, params ProjectListParams, opts ...option.RequestOption) *pagination.ProjectsPageAutoPager[Project] { return pagination.NewProjectsPageAutoPager(r.List(ctx, params, opts...)) } -// DeleteProject deletes the specified project. +// Deletes a project permanently. +// +// Use this method to: +// +// - Remove unused projects +// - Clean up test projects +// - Delete obsolete configurations +// +// ### Examples +// +// - Delete project: +// +// Permanently removes a project. +// +// ```yaml +// projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// ``` func (r *ProjectService) Delete(ctx context.Context, body ProjectDeleteParams, opts ...option.RequestOption) (res *ProjectDeleteResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.ProjectService/DeleteProject" @@ -93,7 +226,24 @@ func (r *ProjectService) Delete(ctx context.Context, body ProjectDeleteParams, o return } -// CreateProject creates a new Project using an environment as template. +// Creates a new project using an existing environment as a template. +// +// Use this method to: +// +// - Clone environment configurations +// - Create projects from templates +// - Share environment setups +// +// ### Examples +// +// - Create from environment: +// +// Creates a project based on existing environment. +// +// ```yaml +// name: "Frontend Project" +// environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" +// ``` func (r *ProjectService) NewFromEnvironment(ctx context.Context, body ProjectNewFromEnvironmentParams, opts ...option.RequestOption) (res *ProjectNewFromEnvironmentResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.ProjectService/CreateProjectFromEnvironment" diff --git a/project_test.go b/project_test.go index f831ca7..9440846 100644 --- a/project_test.go +++ b/project_test.go @@ -28,7 +28,7 @@ func TestProjectNewWithOptionalParams(t *testing.T) { ) _, err := client.Projects.New(context.TODO(), gitpod.ProjectNewParams{ EnvironmentClass: gitpod.F(gitpod.ProjectEnvironmentClassParam{ - EnvironmentClassID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + EnvironmentClassID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), LocalRunner: gitpod.F(true), }), Initializer: gitpod.F(gitpod.EnvironmentInitializerParam{ @@ -39,7 +39,7 @@ func TestProjectNewWithOptionalParams(t *testing.T) { Git: gitpod.F(gitpod.EnvironmentInitializerSpecsGitParam{ CheckoutLocation: gitpod.F("checkoutLocation"), CloneTarget: gitpod.F("cloneTarget"), - RemoteUri: gitpod.F("remoteUri"), + RemoteUri: gitpod.F("https://github.com/org/repo"), TargetMode: gitpod.F(gitpod.EnvironmentInitializerSpecsGitTargetModeCloneTargetModeUnspecified), UpstreamRemoteUri: gitpod.F("upstreamRemoteUri"), }), @@ -47,7 +47,7 @@ func TestProjectNewWithOptionalParams(t *testing.T) { }), AutomationsFilePath: gitpod.F("automationsFilePath"), DevcontainerFilePath: gitpod.F("devcontainerFilePath"), - Name: gitpod.F("x"), + Name: gitpod.F("Web Application"), }) if err != nil { var apierr *gitpod.Error @@ -72,7 +72,7 @@ func TestProjectGetWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Projects.Get(context.TODO(), gitpod.ProjectGetParams{ - ProjectID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + ProjectID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"), }) if err != nil { var apierr *gitpod.Error @@ -100,7 +100,7 @@ func TestProjectUpdateWithOptionalParams(t *testing.T) { AutomationsFilePath: gitpod.F("automationsFilePath"), DevcontainerFilePath: gitpod.F("devcontainerFilePath"), EnvironmentClass: gitpod.F(gitpod.ProjectEnvironmentClassParam{ - EnvironmentClassID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + EnvironmentClassID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), LocalRunner: gitpod.F(true), }), Initializer: gitpod.F(gitpod.EnvironmentInitializerParam{ @@ -118,7 +118,7 @@ func TestProjectUpdateWithOptionalParams(t *testing.T) { }}), }), Name: gitpod.F("x"), - ProjectID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + ProjectID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"), }) if err != nil { var apierr *gitpod.Error @@ -147,7 +147,7 @@ func TestProjectListWithOptionalParams(t *testing.T) { PageSize: gitpod.F(int64(0)), Pagination: gitpod.F(gitpod.ProjectListParamsPagination{ Token: gitpod.F("token"), - PageSize: gitpod.F(int64(100)), + PageSize: gitpod.F(int64(20)), }), }) if err != nil { @@ -173,7 +173,7 @@ func TestProjectDeleteWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Projects.Delete(context.TODO(), gitpod.ProjectDeleteParams{ - ProjectID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + ProjectID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"), }) if err != nil { var apierr *gitpod.Error @@ -198,8 +198,8 @@ func TestProjectNewFromEnvironmentWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Projects.NewFromEnvironment(context.TODO(), gitpod.ProjectNewFromEnvironmentParams{ - EnvironmentID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - Name: gitpod.F("x"), + EnvironmentID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"), + Name: gitpod.F("Frontend Project"), }) if err != nil { var apierr *gitpod.Error diff --git a/projectpolicy.go b/projectpolicy.go index a9a2861..e2d01bb 100644 --- a/projectpolicy.go +++ b/projectpolicy.go @@ -34,7 +34,25 @@ func NewProjectPolicyService(opts ...option.RequestOption) (r *ProjectPolicyServ return } -// CreateProjectPolicy creates a Project Policy. +// Creates a new policy for a project. +// +// Use this method to: +// +// - Set up access controls +// - Define group permissions +// - Configure role-based access +// +// ### Examples +// +// - Create admin policy: +// +// Grants admin access to a group. +// +// ```yaml +// projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// groupId: "f53d2330-3795-4c5d-a1f3-453121af9c60" +// role: PROJECT_ROLE_ADMIN +// ``` func (r *ProjectPolicyService) New(ctx context.Context, body ProjectPolicyNewParams, opts ...option.RequestOption) (res *ProjectPolicyNewResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.ProjectService/CreateProjectPolicy" @@ -42,7 +60,25 @@ func (r *ProjectPolicyService) New(ctx context.Context, body ProjectPolicyNewPar return } -// UpdateProjectPolicy updates a Project Policy. +// Updates an existing project policy. +// +// Use this method to: +// +// - Modify access levels +// - Change group roles +// - Update permissions +// +// ### Examples +// +// - Update policy role: +// +// Changes a group's access level. +// +// ```yaml +// projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// groupId: "f53d2330-3795-4c5d-a1f3-453121af9c60" +// role: PROJECT_ROLE_EDITOR +// ``` func (r *ProjectPolicyService) Update(ctx context.Context, body ProjectPolicyUpdateParams, opts ...option.RequestOption) (res *ProjectPolicyUpdateResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.ProjectService/UpdateProjectPolicy" @@ -50,7 +86,25 @@ func (r *ProjectPolicyService) Update(ctx context.Context, body ProjectPolicyUpd return } -// ListProjectPolicies lists policies for a project. +// Lists policies for a project. +// +// Use this method to: +// +// - View access controls +// - Check policy configurations +// - Audit permissions +// +// ### Examples +// +// - List policies: +// +// Shows all policies for a project. +// +// ```yaml +// projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// pagination: +// pageSize: 20 +// ``` 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...) @@ -68,12 +122,47 @@ func (r *ProjectPolicyService) List(ctx context.Context, params ProjectPolicyLis return res, nil } -// ListProjectPolicies lists policies for a project. +// Lists policies for a project. +// +// Use this method to: +// +// - View access controls +// - Check policy configurations +// - Audit permissions +// +// ### Examples +// +// - List policies: +// +// Shows all policies for a project. +// +// ```yaml +// projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// pagination: +// pageSize: 20 +// ``` func (r *ProjectPolicyService) ListAutoPaging(ctx context.Context, params ProjectPolicyListParams, opts ...option.RequestOption) *pagination.PoliciesPageAutoPager[ProjectPolicy] { return pagination.NewPoliciesPageAutoPager(r.List(ctx, params, opts...)) } -// DeleteProjectPolicy deletes a Project Policy. +// Deletes a project policy. +// +// Use this method to: +// +// - Remove access controls +// - Revoke permissions +// - Clean up policies +// +// ### Examples +// +// - Delete policy: +// +// Removes a group's access policy. +// +// ```yaml +// projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// groupId: "f53d2330-3795-4c5d-a1f3-453121af9c60" +// ``` func (r *ProjectPolicyService) Delete(ctx context.Context, body ProjectPolicyDeleteParams, opts ...option.RequestOption) (res *ProjectPolicyDeleteResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.ProjectService/DeleteProjectPolicy" diff --git a/projectpolicy_test.go b/projectpolicy_test.go index 46a164b..bb805d6 100644 --- a/projectpolicy_test.go +++ b/projectpolicy_test.go @@ -27,8 +27,8 @@ func TestProjectPolicyNewWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, 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"), + GroupID: gitpod.F("f53d2330-3795-4c5d-a1f3-453121af9c60"), + ProjectID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"), Role: gitpod.F(gitpod.ProjectRoleUnspecified), }) if err != nil { @@ -54,8 +54,8 @@ func TestProjectPolicyUpdateWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, 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"), + GroupID: gitpod.F("f53d2330-3795-4c5d-a1f3-453121af9c60"), + ProjectID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"), Role: gitpod.F(gitpod.ProjectRoleUnspecified), }) if err != nil { @@ -85,9 +85,9 @@ func TestProjectPolicyListWithOptionalParams(t *testing.T) { PageSize: gitpod.F(int64(0)), Pagination: gitpod.F(gitpod.ProjectPolicyListParamsPagination{ Token: gitpod.F("token"), - PageSize: gitpod.F(int64(100)), + PageSize: gitpod.F(int64(20)), }), - ProjectID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + ProjectID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"), }) if err != nil { var apierr *gitpod.Error @@ -112,8 +112,8 @@ func TestProjectPolicyDeleteWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Projects.Policies.Delete(context.TODO(), gitpod.ProjectPolicyDeleteParams{ - GroupID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - ProjectID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + GroupID: gitpod.F("f53d2330-3795-4c5d-a1f3-453121af9c60"), + ProjectID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"), }) if err != nil { var apierr *gitpod.Error diff --git a/runner.go b/runner.go index ff92591..61d5802 100644 --- a/runner.go +++ b/runner.go @@ -40,9 +40,46 @@ func NewRunnerService(opts ...option.RequestOption) (r *RunnerService) { return } -// CreateRunner creates a new runner with the server. Registrations are very -// short-lived and must be renewed every 30 seconds. Runners can be registered for -// an entire organisation or a single user. +// Creates a new runner registration with the server. Registrations are very +// short-lived and must be renewed every 30 seconds. +// +// Use this method to: +// +// - Register organization runners +// - Set up runner configurations +// - Initialize runner credentials +// - Configure auto-updates +// +// ### Examples +// +// - Create cloud runner: +// +// Creates a new runner in AWS EC2. +// +// ```yaml +// name: "Production Runner" +// provider: RUNNER_PROVIDER_AWS_EC2 +// spec: +// desiredPhase: RUNNER_PHASE_ACTIVE +// configuration: +// region: "us-west" +// releaseChannel: RUNNER_RELEASE_CHANNEL_STABLE +// autoUpdate: true +// ``` +// +// - Create local runner: +// +// Creates a new local runner on Linux. +// +// ```yaml +// name: "Local Development Runner" +// provider: RUNNER_PROVIDER_LINUX_HOST +// spec: +// desiredPhase: RUNNER_PHASE_ACTIVE +// configuration: +// releaseChannel: RUNNER_RELEASE_CHANNEL_LATEST +// autoUpdate: true +// ``` func (r *RunnerService) New(ctx context.Context, body RunnerNewParams, opts ...option.RequestOption) (res *RunnerNewResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.RunnerService/CreateRunner" @@ -50,7 +87,24 @@ func (r *RunnerService) New(ctx context.Context, body RunnerNewParams, opts ...o return } -// GetRunner returns a single runner. +// Gets details about a specific runner. +// +// Use this method to: +// +// - Check runner status +// - View runner configuration +// - Monitor runner health +// - Verify runner capabilities +// +// ### Examples +// +// - Get runner details: +// +// Retrieves information about a specific runner. +// +// ```yaml +// runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *RunnerService) Get(ctx context.Context, body RunnerGetParams, opts ...option.RequestOption) (res *RunnerGetResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.RunnerService/GetRunner" @@ -58,7 +112,29 @@ func (r *RunnerService) Get(ctx context.Context, body RunnerGetParams, opts ...o return } -// UpdateRunner updates an environment runner. +// Updates a runner's configuration. +// +// Use this method to: +// +// - Modify runner settings +// - Update release channels +// - Change runner status +// - Configure auto-update settings +// +// ### Examples +// +// - Update configuration: +// +// Changes runner settings. +// +// ```yaml +// runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// name: "Updated Runner Name" +// spec: +// configuration: +// releaseChannel: RUNNER_RELEASE_CHANNEL_LATEST +// autoUpdate: true +// ``` func (r *RunnerService) Update(ctx context.Context, body RunnerUpdateParams, opts ...option.RequestOption) (res *RunnerUpdateResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.RunnerService/UpdateRunner" @@ -66,7 +142,36 @@ func (r *RunnerService) Update(ctx context.Context, body RunnerUpdateParams, opt return } -// ListRunners returns all runners registered in the scope. +// Lists all registered runners with optional filtering. +// +// Use this method to: +// +// - View all available runners +// - Filter by runner type +// - Monitor runner status +// - Check runner availability +// +// ### Examples +// +// - List all runners: +// +// Shows all runners with pagination. +// +// ```yaml +// pagination: +// pageSize: 20 +// ``` +// +// - Filter by provider: +// +// Lists only AWS EC2 runners. +// +// ```yaml +// filter: +// providers: ["RUNNER_PROVIDER_AWS_EC2"] +// pagination: +// pageSize: 20 +// ``` 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...) @@ -84,12 +189,57 @@ func (r *RunnerService) List(ctx context.Context, params RunnerListParams, opts return res, nil } -// ListRunners returns all runners registered in the scope. +// Lists all registered runners with optional filtering. +// +// Use this method to: +// +// - View all available runners +// - Filter by runner type +// - Monitor runner status +// - Check runner availability +// +// ### Examples +// +// - List all runners: +// +// Shows all runners with pagination. +// +// ```yaml +// pagination: +// pageSize: 20 +// ``` +// +// - Filter by provider: +// +// Lists only AWS EC2 runners. +// +// ```yaml +// filter: +// providers: ["RUNNER_PROVIDER_AWS_EC2"] +// pagination: +// pageSize: 20 +// ``` func (r *RunnerService) ListAutoPaging(ctx context.Context, params RunnerListParams, opts ...option.RequestOption) *pagination.RunnersPageAutoPager[Runner] { return pagination.NewRunnersPageAutoPager(r.List(ctx, params, opts...)) } -// DeleteRunner deletes an environment runner. +// Deletes a runner permanently. +// +// Use this method to: +// +// - Remove unused runners +// - Clean up runner registrations +// - Delete obsolete runners +// +// ### Examples +// +// - Delete runner: +// +// Permanently removes a runner. +// +// ```yaml +// runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *RunnerService) Delete(ctx context.Context, body RunnerDeleteParams, opts ...option.RequestOption) (res *RunnerDeleteResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.RunnerService/DeleteRunner" @@ -97,10 +247,23 @@ func (r *RunnerService) Delete(ctx context.Context, body RunnerDeleteParams, opt return } -// CheckAuthenticationForHost asks a runner if the user is authenticated against a -// particular host, e.g. an SCM system. If not, this function will return a URL -// that the user should visit to authenticate, or indicate that Personal Access -// Tokens are supported. +// Checks if a user is authenticated for a specific host. +// +// Use this method to: +// +// - Verify authentication status +// - Get authentication URLs +// - Check PAT support +// +// ### Examples +// +// - Check authentication: +// +// Verifies authentication for a host. +// +// ```yaml +// host: "github.com" +// ``` func (r *RunnerService) CheckAuthenticationForHost(ctx context.Context, body RunnerCheckAuthenticationForHostParams, opts ...option.RequestOption) (res *RunnerCheckAuthenticationForHostResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.RunnerService/CheckAuthenticationForHost" @@ -108,9 +271,25 @@ func (r *RunnerService) CheckAuthenticationForHost(ctx context.Context, body Run return } -// 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 -// previously issued tokens. +// Creates a new authentication token for a runner. +// +// Use this method to: +// +// - Generate runner credentials +// - Renew expired tokens +// - Set up runner authentication +// +// Note: This does not expire previously issued tokens. +// +// ### Examples +// +// - Create token: +// +// Creates a new token for runner authentication. +// +// ```yaml +// runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` 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" @@ -118,18 +297,30 @@ func (r *RunnerService) NewRunnerToken(ctx context.Context, body RunnerNewRunner return } -// ParseContextURL asks a runner to parse a context URL, and return the parsed -// result. +// Parses a context URL and returns the parsed result. +// +// Use this method to: +// +// - Validate context URLs +// - Check repository access +// - Verify branch existence +// +// Returns: +// +// - FAILED_PRECONDITION if authentication is required +// - PERMISSION_DENIED if access is not allowed +// - INVALID_ARGUMENT if URL is invalid +// - NOT_FOUND if repository/branch doesn't exist +// +// ### Examples +// +// - Parse URL: // -// # This call returns +// Parses and validates a context URL. // -// - FAILED_PRECONDITION if the user requires authentication on the runner to -// access the context URL -// - PERMISSION_DENIED if the user is not allowed to access the context URL using -// the credentials they have -// - INVALID_ARGUMENT if the context URL is invalid -// - NOT_FOUND if the repository or branch indicated by the context URL does not -// exist +// ```yaml +// contextUrl: "https://github.com/org/repo/tree/main" +// ``` func (r *RunnerService) ParseContextURL(ctx context.Context, body RunnerParseContextURLParams, opts ...option.RequestOption) (res *RunnerParseContextURLResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.RunnerService/ParseContextURL" diff --git a/runner_test.go b/runner_test.go index fef4920..14edad8 100644 --- a/runner_test.go +++ b/runner_test.go @@ -28,12 +28,12 @@ func TestRunnerNewWithOptionalParams(t *testing.T) { ) _, err := client.Runners.New(context.TODO(), gitpod.RunnerNewParams{ Kind: gitpod.F(gitpod.RunnerKindUnspecified), - Name: gitpod.F("xxx"), + Name: gitpod.F("Production Runner"), Provider: gitpod.F(gitpod.RunnerProviderUnspecified), Spec: gitpod.F(gitpod.RunnerSpecParam{ Configuration: gitpod.F(gitpod.RunnerConfigurationParam{ AutoUpdate: gitpod.F(true), - Region: gitpod.F("region"), + Region: gitpod.F("us-west"), ReleaseChannel: gitpod.F(gitpod.RunnerReleaseChannelUnspecified), }), DesiredPhase: gitpod.F(gitpod.RunnerPhaseUnspecified), @@ -62,7 +62,7 @@ func TestRunnerGetWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.Get(context.TODO(), gitpod.RunnerGetParams{ - RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error @@ -87,8 +87,8 @@ func TestRunnerUpdateWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.Update(context.TODO(), gitpod.RunnerUpdateParams{ - Name: gitpod.F("xxx"), - RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + Name: gitpod.F("Updated Runner Name"), + RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), Spec: gitpod.F(gitpod.RunnerUpdateParamsSpec{ Configuration: gitpod.F(gitpod.RunnerUpdateParamsSpecConfiguration{ AutoUpdate: gitpod.F(true), @@ -129,7 +129,7 @@ func TestRunnerListWithOptionalParams(t *testing.T) { }), Pagination: gitpod.F(gitpod.RunnerListParamsPagination{ Token: gitpod.F("token"), - PageSize: gitpod.F(int64(100)), + PageSize: gitpod.F(int64(20)), }), }) if err != nil { @@ -156,7 +156,7 @@ func TestRunnerDeleteWithOptionalParams(t *testing.T) { ) _, err := client.Runners.Delete(context.TODO(), gitpod.RunnerDeleteParams{ Force: gitpod.F(true), - RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error @@ -181,7 +181,7 @@ func TestRunnerCheckAuthenticationForHostWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.CheckAuthenticationForHost(context.TODO(), gitpod.RunnerCheckAuthenticationForHostParams{ - Host: gitpod.F("host"), + Host: gitpod.F("github.com"), RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), }) if err != nil { @@ -207,7 +207,7 @@ func TestRunnerNewRunnerTokenWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.NewRunnerToken(context.TODO(), gitpod.RunnerNewRunnerTokenParams{ - RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error @@ -232,7 +232,7 @@ func TestRunnerParseContextURLWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.ParseContextURL(context.TODO(), gitpod.RunnerParseContextURLParams{ - ContextURL: gitpod.F("https://example.com"), + ContextURL: gitpod.F("https://github.com/org/repo/tree/main"), RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), }) if err != nil { diff --git a/runnerconfiguration.go b/runnerconfiguration.go index a26909a..46a83e4 100644 --- a/runnerconfiguration.go +++ b/runnerconfiguration.go @@ -40,8 +40,29 @@ func NewRunnerConfigurationService(opts ...option.RequestOption) (r *RunnerConfi return } -// ValidateRunnerConfiguration validates a runner configuration (e.g. environment -// class, SCM integration) with the runner. +// Validates a runner configuration. +// +// Use this method to: +// +// - Check configuration validity +// - Verify integration settings +// - Validate environment classes +// +// ### Examples +// +// - Validate SCM integration: +// +// Checks if an SCM integration is valid. +// +// ```yaml +// runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// scmIntegration: +// id: "integration-id" +// scmId: "github" +// host: "github.com" +// oauthClientId: "client_id" +// oauthPlaintextClientSecret: "client_secret" +// ``` func (r *RunnerConfigurationService) Validate(ctx context.Context, body RunnerConfigurationValidateParams, opts ...option.RequestOption) (res *RunnerConfigurationValidateResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.RunnerConfigurationService/ValidateRunnerConfiguration" diff --git a/runnerconfiguration_test.go b/runnerconfiguration_test.go index aa0f342..36eb1f5 100644 --- a/runnerconfiguration_test.go +++ b/runnerconfiguration_test.go @@ -39,15 +39,15 @@ func TestRunnerConfigurationValidateWithOptionalParams(t *testing.T) { DisplayName: gitpod.F("xxx"), Enabled: gitpod.F(true), }), - RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), ScmIntegration: gitpod.F(gitpod.RunnerConfigurationValidateParamsScmIntegration{ - ID: gitpod.F("id"), - Host: gitpod.F("host"), - OAuthClientID: gitpod.F("oauthClientId"), + ID: gitpod.F("integration-id"), + Host: gitpod.F("github.com"), + OAuthClientID: gitpod.F("client_id"), OAuthEncryptedClientSecret: gitpod.F("U3RhaW5sZXNzIHJvY2tz"), - OAuthPlaintextClientSecret: gitpod.F("oauthPlaintextClientSecret"), + OAuthPlaintextClientSecret: gitpod.F("client_secret"), Pat: gitpod.F(true), - ScmID: gitpod.F("scmId"), + ScmID: gitpod.F("github"), }), }) if err != nil { diff --git a/runnerconfigurationenvironmentclass.go b/runnerconfigurationenvironmentclass.go index affc504..e90b615 100644 --- a/runnerconfigurationenvironmentclass.go +++ b/runnerconfigurationenvironmentclass.go @@ -36,7 +36,30 @@ func NewRunnerConfigurationEnvironmentClassService(opts ...option.RequestOption) return } -// CreateEnvironmentClass creates a new environment class on a runner. +// Creates a new environment class for a runner. +// +// Use this method to: +// +// - Define compute resources +// - Configure environment settings +// - Set up runtime options +// +// ### Examples +// +// - Create environment class: +// +// Creates a new environment configuration. +// +// ```yaml +// runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// displayName: "Large Instance" +// description: "8 CPU, 16GB RAM" +// configuration: +// - key: "cpu" +// value: "8" +// - key: "memory" +// value: "16384" +// ``` func (r *RunnerConfigurationEnvironmentClassService) New(ctx context.Context, body RunnerConfigurationEnvironmentClassNewParams, opts ...option.RequestOption) (res *RunnerConfigurationEnvironmentClassNewResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.RunnerConfigurationService/CreateEnvironmentClass" @@ -44,7 +67,23 @@ func (r *RunnerConfigurationEnvironmentClassService) New(ctx context.Context, bo return } -// GetEnvironmentClass returns a single environment class configured for a runner. +// Gets details about a specific environment class. +// +// Use this method to: +// +// - View class configuration +// - Check resource settings +// - Verify availability +// +// ### Examples +// +// - Get class details: +// +// Retrieves information about a specific class. +// +// ```yaml +// environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *RunnerConfigurationEnvironmentClassService) Get(ctx context.Context, body RunnerConfigurationEnvironmentClassGetParams, opts ...option.RequestOption) (res *RunnerConfigurationEnvironmentClassGetResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.RunnerConfigurationService/GetEnvironmentClass" @@ -52,7 +91,26 @@ func (r *RunnerConfigurationEnvironmentClassService) Get(ctx context.Context, bo return } -// UpdateEnvironmentClass updates an existing environment class on a runner. +// Updates an environment class. +// +// Use this method to: +// +// - Modify class settings +// - Update resource limits +// - Change availability +// +// ### Examples +// +// - Update class: +// +// Changes class configuration. +// +// ```yaml +// environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// displayName: "Updated Large Instance" +// description: "16 CPU, 32GB RAM" +// enabled: true +// ``` func (r *RunnerConfigurationEnvironmentClassService) Update(ctx context.Context, body RunnerConfigurationEnvironmentClassUpdateParams, opts ...option.RequestOption) (res *RunnerConfigurationEnvironmentClassUpdateResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.RunnerConfigurationService/UpdateEnvironmentClass" @@ -60,8 +118,37 @@ func (r *RunnerConfigurationEnvironmentClassService) Update(ctx context.Context, return } -// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE ListEnvironmentClasses returns all -// environment classes configured for a runner. +// Lists environment classes with optional filtering. +// +// Use this method to: +// +// - View available classes +// - Filter by capability +// - Check enabled status +// +// ### Examples +// +// - List all classes: +// +// Shows all environment classes. +// +// ```yaml +// pagination: +// pageSize: 20 +// ``` +// +// - Filter enabled classes: +// +// Lists only enabled environment classes. +// +// ```yaml +// filter: +// enabled: true +// pagination: +// pageSize: 20 +// ``` +// +// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE func (r *RunnerConfigurationEnvironmentClassService) List(ctx context.Context, params RunnerConfigurationEnvironmentClassListParams, opts ...option.RequestOption) (res *pagination.EnvironmentClassesPage[shared.EnvironmentClass], err error) { var raw *http.Response opts = append(r.Options[:], opts...) @@ -79,8 +166,37 @@ func (r *RunnerConfigurationEnvironmentClassService) List(ctx context.Context, p return res, nil } -// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE ListEnvironmentClasses returns all -// environment classes configured for a runner. +// Lists environment classes with optional filtering. +// +// Use this method to: +// +// - View available classes +// - Filter by capability +// - Check enabled status +// +// ### Examples +// +// - List all classes: +// +// Shows all environment classes. +// +// ```yaml +// pagination: +// pageSize: 20 +// ``` +// +// - Filter enabled classes: +// +// Lists only enabled environment classes. +// +// ```yaml +// filter: +// enabled: true +// pagination: +// pageSize: 20 +// ``` +// +// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE func (r *RunnerConfigurationEnvironmentClassService) ListAutoPaging(ctx context.Context, params RunnerConfigurationEnvironmentClassListParams, opts ...option.RequestOption) *pagination.EnvironmentClassesPageAutoPager[shared.EnvironmentClass] { return pagination.NewEnvironmentClassesPageAutoPager(r.List(ctx, params, opts...)) } diff --git a/runnerconfigurationenvironmentclass_test.go b/runnerconfigurationenvironmentclass_test.go index 1f89366..ef35f4b 100644 --- a/runnerconfigurationenvironmentclass_test.go +++ b/runnerconfigurationenvironmentclass_test.go @@ -29,12 +29,15 @@ func TestRunnerConfigurationEnvironmentClassNewWithOptionalParams(t *testing.T) ) _, err := client.Runners.Configurations.EnvironmentClasses.New(context.TODO(), gitpod.RunnerConfigurationEnvironmentClassNewParams{ Configuration: gitpod.F([]shared.FieldValueParam{{ - Key: gitpod.F("key"), - Value: gitpod.F("value"), + Key: gitpod.F("cpu"), + Value: gitpod.F("8"), + }, { + Key: gitpod.F("memory"), + Value: gitpod.F("16384"), }}), - Description: gitpod.F("xxx"), - DisplayName: gitpod.F("xxx"), - RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + Description: gitpod.F("8 CPU, 16GB RAM"), + DisplayName: gitpod.F("Large Instance"), + RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error @@ -59,7 +62,7 @@ func TestRunnerConfigurationEnvironmentClassGetWithOptionalParams(t *testing.T) option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.Configurations.EnvironmentClasses.Get(context.TODO(), gitpod.RunnerConfigurationEnvironmentClassGetParams{ - EnvironmentClassID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + EnvironmentClassID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error @@ -84,10 +87,10 @@ func TestRunnerConfigurationEnvironmentClassUpdateWithOptionalParams(t *testing. option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.Configurations.EnvironmentClasses.Update(context.TODO(), gitpod.RunnerConfigurationEnvironmentClassUpdateParams{ - Description: gitpod.F("xxx"), - DisplayName: gitpod.F("xxx"), + Description: gitpod.F("16 CPU, 32GB RAM"), + DisplayName: gitpod.F("Updated Large Instance"), Enabled: gitpod.F(true), - EnvironmentClassID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + EnvironmentClassID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error @@ -123,7 +126,7 @@ func TestRunnerConfigurationEnvironmentClassListWithOptionalParams(t *testing.T) }), Pagination: gitpod.F(gitpod.RunnerConfigurationEnvironmentClassListParamsPagination{ Token: gitpod.F("token"), - PageSize: gitpod.F(int64(100)), + PageSize: gitpod.F(int64(20)), }), }) if err != nil { diff --git a/runnerconfigurationhostauthenticationtoken.go b/runnerconfigurationhostauthenticationtoken.go index d9a646d..e61e6b5 100644 --- a/runnerconfigurationhostauthenticationtoken.go +++ b/runnerconfigurationhostauthenticationtoken.go @@ -36,7 +36,29 @@ func NewRunnerConfigurationHostAuthenticationTokenService(opts ...option.Request return } -// CreateHostAuthenticationToken +// Creates a new authentication token for accessing remote hosts. +// +// Use this method to: +// +// - Set up SCM authentication +// - Configure OAuth credentials +// - Manage PAT tokens +// +// ### Examples +// +// - Create OAuth token: +// +// Creates a new OAuth-based authentication token. +// +// ```yaml +// runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// userId: "f53d2330-3795-4c5d-a1f3-453121af9c60" +// host: "github.com" +// token: "gho_xxxxxxxxxxxx" +// source: HOST_AUTHENTICATION_TOKEN_SOURCE_OAUTH +// expiresAt: "2024-12-31T23:59:59Z" +// refreshToken: "ghr_xxxxxxxxxxxx" +// ``` func (r *RunnerConfigurationHostAuthenticationTokenService) New(ctx context.Context, body RunnerConfigurationHostAuthenticationTokenNewParams, opts ...option.RequestOption) (res *RunnerConfigurationHostAuthenticationTokenNewResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.RunnerConfigurationService/CreateHostAuthenticationToken" @@ -44,7 +66,23 @@ func (r *RunnerConfigurationHostAuthenticationTokenService) New(ctx context.Cont return } -// GetHostAuthenticationToken +// Gets details about a specific host authentication token. +// +// Use this method to: +// +// - View token information +// - Check token expiration +// - Verify token validity +// +// ### Examples +// +// - Get token details: +// +// Retrieves information about a specific token. +// +// ```yaml +// id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *RunnerConfigurationHostAuthenticationTokenService) Get(ctx context.Context, body RunnerConfigurationHostAuthenticationTokenGetParams, opts ...option.RequestOption) (res *RunnerConfigurationHostAuthenticationTokenGetResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.RunnerConfigurationService/GetHostAuthenticationToken" @@ -52,7 +90,26 @@ func (r *RunnerConfigurationHostAuthenticationTokenService) Get(ctx context.Cont return } -// UpdateHostAuthenticationToken +// Updates an existing host authentication token. +// +// Use this method to: +// +// - Refresh token values +// - Update expiration +// - Modify token settings +// +// ### Examples +// +// - Update token: +// +// Updates token value and expiration. +// +// ```yaml +// id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// token: "gho_xxxxxxxxxxxx" +// expiresAt: "2024-12-31T23:59:59Z" +// refreshToken: "ghr_xxxxxxxxxxxx" +// ``` func (r *RunnerConfigurationHostAuthenticationTokenService) Update(ctx context.Context, body RunnerConfigurationHostAuthenticationTokenUpdateParams, opts ...option.RequestOption) (res *RunnerConfigurationHostAuthenticationTokenUpdateResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.RunnerConfigurationService/UpdateHostAuthenticationToken" @@ -60,7 +117,35 @@ func (r *RunnerConfigurationHostAuthenticationTokenService) Update(ctx context.C return } -// ListHostAuthenticationTokens +// Lists host authentication tokens with optional filtering. +// +// Use this method to: +// +// - View all tokens +// - Filter by runner or user +// - Monitor token status +// +// ### Examples +// +// - List all tokens: +// +// Shows all tokens with pagination. +// +// ```yaml +// pagination: +// pageSize: 20 +// ``` +// +// - Filter by runner: +// +// Lists tokens for a specific runner. +// +// ```yaml +// filter: +// runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// pagination: +// pageSize: 20 +// ``` 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...) @@ -78,12 +163,56 @@ func (r *RunnerConfigurationHostAuthenticationTokenService) List(ctx context.Con return res, nil } -// ListHostAuthenticationTokens +// Lists host authentication tokens with optional filtering. +// +// Use this method to: +// +// - View all tokens +// - Filter by runner or user +// - Monitor token status +// +// ### Examples +// +// - List all tokens: +// +// Shows all tokens with pagination. +// +// ```yaml +// pagination: +// pageSize: 20 +// ``` +// +// - Filter by runner: +// +// Lists tokens for a specific runner. +// +// ```yaml +// filter: +// runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// pagination: +// pageSize: 20 +// ``` func (r *RunnerConfigurationHostAuthenticationTokenService) ListAutoPaging(ctx context.Context, params RunnerConfigurationHostAuthenticationTokenListParams, opts ...option.RequestOption) *pagination.TokensPageAutoPager[HostAuthenticationToken] { return pagination.NewTokensPageAutoPager(r.List(ctx, params, opts...)) } -// DeleteHostAuthenticationToken +// Deletes a host authentication token. +// +// Use this method to: +// +// - Remove unused tokens +// - Revoke access +// - Clean up expired tokens +// +// ### Examples +// +// - Delete token: +// +// Permanently removes a token. +// +// ```yaml +// id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *RunnerConfigurationHostAuthenticationTokenService) Delete(ctx context.Context, body RunnerConfigurationHostAuthenticationTokenDeleteParams, opts ...option.RequestOption) (res *RunnerConfigurationHostAuthenticationTokenDeleteResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.RunnerConfigurationService/DeleteHostAuthenticationToken" diff --git a/runnerconfigurationhostauthenticationtoken_test.go b/runnerconfigurationhostauthenticationtoken_test.go index fcebd6f..e553890 100644 --- a/runnerconfigurationhostauthenticationtoken_test.go +++ b/runnerconfigurationhostauthenticationtoken_test.go @@ -28,13 +28,13 @@ func TestRunnerConfigurationHostAuthenticationTokenNewWithOptionalParams(t *test option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.Configurations.HostAuthenticationTokens.New(context.TODO(), gitpod.RunnerConfigurationHostAuthenticationTokenNewParams{ - Token: gitpod.F("x"), + Token: gitpod.F("gho_xxxxxxxxxxxx"), ExpiresAt: gitpod.F(time.Now()), - Host: gitpod.F("x"), - RefreshToken: gitpod.F("refreshToken"), - RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + Host: gitpod.F("github.com"), + RefreshToken: gitpod.F("ghr_xxxxxxxxxxxx"), + RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), Source: gitpod.F(gitpod.HostAuthenticationTokenSourceUnspecified), - UserID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + UserID: gitpod.F("f53d2330-3795-4c5d-a1f3-453121af9c60"), }) if err != nil { var apierr *gitpod.Error @@ -59,7 +59,7 @@ func TestRunnerConfigurationHostAuthenticationTokenGetWithOptionalParams(t *test option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.Configurations.HostAuthenticationTokens.Get(context.TODO(), gitpod.RunnerConfigurationHostAuthenticationTokenGetParams{ - ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error @@ -84,10 +84,10 @@ func TestRunnerConfigurationHostAuthenticationTokenUpdateWithOptionalParams(t *t option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.Configurations.HostAuthenticationTokens.Update(context.TODO(), gitpod.RunnerConfigurationHostAuthenticationTokenUpdateParams{ - ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - Token: gitpod.F("x"), + ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), + Token: gitpod.F("gho_xxxxxxxxxxxx"), ExpiresAt: gitpod.F(time.Now()), - RefreshToken: gitpod.F("refreshToken"), + RefreshToken: gitpod.F("ghr_xxxxxxxxxxxx"), }) if err != nil { var apierr *gitpod.Error @@ -115,12 +115,12 @@ func TestRunnerConfigurationHostAuthenticationTokenListWithOptionalParams(t *tes Token: gitpod.F("token"), PageSize: gitpod.F(int64(0)), Filter: gitpod.F(gitpod.RunnerConfigurationHostAuthenticationTokenListParamsFilter{ - RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), UserID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), }), Pagination: gitpod.F(gitpod.RunnerConfigurationHostAuthenticationTokenListParamsPagination{ Token: gitpod.F("token"), - PageSize: gitpod.F(int64(100)), + PageSize: gitpod.F(int64(20)), }), }) if err != nil { @@ -146,7 +146,7 @@ func TestRunnerConfigurationHostAuthenticationTokenDeleteWithOptionalParams(t *t option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.Configurations.HostAuthenticationTokens.Delete(context.TODO(), gitpod.RunnerConfigurationHostAuthenticationTokenDeleteParams{ - ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error diff --git a/runnerconfigurationschema.go b/runnerconfigurationschema.go index 9f64145..22f1ea1 100644 --- a/runnerconfigurationschema.go +++ b/runnerconfigurationschema.go @@ -31,7 +31,23 @@ func NewRunnerConfigurationSchemaService(opts ...option.RequestOption) (r *Runne return } -// GetRunnerConfigurationSchema retrieves the latest Runner configuration schema +// Gets the latest runner configuration schema. +// +// Use this method to: +// +// - View available settings +// - Check configuration options +// - Validate configurations +// +// ### Examples +// +// - Get schema: +// +// Retrieves configuration schema for a runner. +// +// ```yaml +// runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *RunnerConfigurationSchemaService) Get(ctx context.Context, body RunnerConfigurationSchemaGetParams, opts ...option.RequestOption) (res *RunnerConfigurationSchemaGetResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.RunnerConfigurationService/GetRunnerConfigurationSchema" diff --git a/runnerconfigurationschema_test.go b/runnerconfigurationschema_test.go index 99d544b..7a61d0a 100644 --- a/runnerconfigurationschema_test.go +++ b/runnerconfigurationschema_test.go @@ -27,7 +27,7 @@ func TestRunnerConfigurationSchemaGetWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.Configurations.Schema.Get(context.TODO(), gitpod.RunnerConfigurationSchemaGetParams{ - RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error diff --git a/runnerconfigurationscmintegration.go b/runnerconfigurationscmintegration.go index f9e635e..9617bee 100644 --- a/runnerconfigurationscmintegration.go +++ b/runnerconfigurationscmintegration.go @@ -34,7 +34,27 @@ func NewRunnerConfigurationScmIntegrationService(opts ...option.RequestOption) ( return } -// CreateSCMIntegration creates a new SCM integration on a runner. +// Creates a new SCM integration for a runner. +// +// Use this method to: +// +// - Configure source control access +// - Set up repository integrations +// - Enable code synchronization +// +// ### Examples +// +// - Create GitHub integration: +// +// Sets up GitHub SCM integration. +// +// ```yaml +// runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// scmId: "github" +// host: "github.com" +// oauthClientId: "client_id" +// oauthPlaintextClientSecret: "client_secret" +// ``` func (r *RunnerConfigurationScmIntegrationService) New(ctx context.Context, body RunnerConfigurationScmIntegrationNewParams, opts ...option.RequestOption) (res *RunnerConfigurationScmIntegrationNewResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.RunnerConfigurationService/CreateSCMIntegration" @@ -42,7 +62,23 @@ func (r *RunnerConfigurationScmIntegrationService) New(ctx context.Context, body return } -// GetSCMIntegration returns a single SCM integration configured for a runner. +// Gets details about a specific SCM integration. +// +// Use this method to: +// +// - View integration settings +// - Check integration status +// - Verify configuration +// +// ### Examples +// +// - Get integration details: +// +// Retrieves information about a specific integration. +// +// ```yaml +// id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *RunnerConfigurationScmIntegrationService) Get(ctx context.Context, body RunnerConfigurationScmIntegrationGetParams, opts ...option.RequestOption) (res *RunnerConfigurationScmIntegrationGetResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.RunnerConfigurationService/GetSCMIntegration" @@ -50,7 +86,25 @@ func (r *RunnerConfigurationScmIntegrationService) Get(ctx context.Context, body return } -// UpdateSCMIntegration updates an existing SCM integration on a runner. +// Updates an existing SCM integration. +// +// Use this method to: +// +// - Modify integration settings +// - Update credentials +// - Change configuration +// +// ### Examples +// +// - Update integration: +// +// Updates OAuth credentials. +// +// ```yaml +// id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// oauthClientId: "new_client_id" +// oauthPlaintextClientSecret: "new_client_secret" +// ``` func (r *RunnerConfigurationScmIntegrationService) Update(ctx context.Context, body RunnerConfigurationScmIntegrationUpdateParams, opts ...option.RequestOption) (res *RunnerConfigurationScmIntegrationUpdateResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.RunnerConfigurationService/UpdateSCMIntegration" @@ -58,7 +112,26 @@ func (r *RunnerConfigurationScmIntegrationService) Update(ctx context.Context, b return } -// ListSCMIntegrations returns all SCM integrations configured for a runner. +// Lists SCM integrations for a runner. +// +// Use this method to: +// +// - View all integrations +// - Monitor integration status +// - Check available SCMs +// +// ### Examples +// +// - List integrations: +// +// Shows all SCM integrations. +// +// ```yaml +// filter: +// runnerIds: ["d2c94c27-3b76-4a42-b88c-95a85e392c68"] +// pagination: +// pageSize: 20 +// ``` 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...) @@ -76,12 +149,47 @@ func (r *RunnerConfigurationScmIntegrationService) List(ctx context.Context, par return res, nil } -// ListSCMIntegrations returns all SCM integrations configured for a runner. +// Lists SCM integrations for a runner. +// +// Use this method to: +// +// - View all integrations +// - Monitor integration status +// - Check available SCMs +// +// ### Examples +// +// - List integrations: +// +// Shows all SCM integrations. +// +// ```yaml +// filter: +// runnerIds: ["d2c94c27-3b76-4a42-b88c-95a85e392c68"] +// pagination: +// pageSize: 20 +// ``` func (r *RunnerConfigurationScmIntegrationService) ListAutoPaging(ctx context.Context, params RunnerConfigurationScmIntegrationListParams, opts ...option.RequestOption) *pagination.IntegrationsPageAutoPager[ScmIntegration] { return pagination.NewIntegrationsPageAutoPager(r.List(ctx, params, opts...)) } -// DeleteSCMIntegration deletes an existing SCM integration on a runner. +// Deletes an SCM integration. +// +// Use this method to: +// +// - Remove unused integrations +// - Clean up configurations +// - Revoke SCM access +// +// ### Examples +// +// - Delete integration: +// +// Removes an SCM integration. +// +// ```yaml +// id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *RunnerConfigurationScmIntegrationService) Delete(ctx context.Context, body RunnerConfigurationScmIntegrationDeleteParams, opts ...option.RequestOption) (res *RunnerConfigurationScmIntegrationDeleteResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.RunnerConfigurationService/DeleteSCMIntegration" diff --git a/runnerconfigurationscmintegration_test.go b/runnerconfigurationscmintegration_test.go index 2c315ec..8753bdf 100644 --- a/runnerconfigurationscmintegration_test.go +++ b/runnerconfigurationscmintegration_test.go @@ -27,12 +27,12 @@ func TestRunnerConfigurationScmIntegrationNewWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.Configurations.ScmIntegrations.New(context.TODO(), gitpod.RunnerConfigurationScmIntegrationNewParams{ - Host: gitpod.F("host"), - OAuthClientID: gitpod.F("oauthClientId"), - OAuthPlaintextClientSecret: gitpod.F("oauthPlaintextClientSecret"), + Host: gitpod.F("github.com"), + OAuthClientID: gitpod.F("client_id"), + OAuthPlaintextClientSecret: gitpod.F("client_secret"), Pat: gitpod.F(true), - RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - ScmID: gitpod.F("scmId"), + RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), + ScmID: gitpod.F("github"), }) if err != nil { var apierr *gitpod.Error @@ -57,7 +57,7 @@ func TestRunnerConfigurationScmIntegrationGetWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.Configurations.ScmIntegrations.Get(context.TODO(), gitpod.RunnerConfigurationScmIntegrationGetParams{ - ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error @@ -82,9 +82,9 @@ func TestRunnerConfigurationScmIntegrationUpdateWithOptionalParams(t *testing.T) option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.Configurations.ScmIntegrations.Update(context.TODO(), gitpod.RunnerConfigurationScmIntegrationUpdateParams{ - ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - OAuthClientID: gitpod.F("oauthClientId"), - OAuthPlaintextClientSecret: gitpod.F("oauthPlaintextClientSecret"), + ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), + OAuthClientID: gitpod.F("new_client_id"), + OAuthPlaintextClientSecret: gitpod.F("new_client_secret"), Pat: gitpod.F(true), }) if err != nil { @@ -113,11 +113,11 @@ func TestRunnerConfigurationScmIntegrationListWithOptionalParams(t *testing.T) { Token: gitpod.F("token"), PageSize: gitpod.F(int64(0)), Filter: gitpod.F(gitpod.RunnerConfigurationScmIntegrationListParamsFilter{ - RunnerIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), + RunnerIDs: gitpod.F([]string{"d2c94c27-3b76-4a42-b88c-95a85e392c68"}), }), Pagination: gitpod.F(gitpod.RunnerConfigurationScmIntegrationListParamsPagination{ Token: gitpod.F("token"), - PageSize: gitpod.F(int64(100)), + PageSize: gitpod.F(int64(20)), }), }) if err != nil { @@ -143,7 +143,7 @@ func TestRunnerConfigurationScmIntegrationDeleteWithOptionalParams(t *testing.T) option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.Configurations.ScmIntegrations.Delete(context.TODO(), gitpod.RunnerConfigurationScmIntegrationDeleteParams{ - ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error diff --git a/runnerpolicy.go b/runnerpolicy.go index 0b59777..2e443eb 100644 --- a/runnerpolicy.go +++ b/runnerpolicy.go @@ -34,7 +34,25 @@ func NewRunnerPolicyService(opts ...option.RequestOption) (r *RunnerPolicyServic return } -// CreateRunnerPolicy creates a new runner policy. +// Creates a new policy for a runner. +// +// Use this method to: +// +// - Set up access controls +// - Define group permissions +// - Configure role-based access +// +// ### Examples +// +// - Create admin policy: +// +// Grants admin access to a group. +// +// ```yaml +// runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// groupId: "f53d2330-3795-4c5d-a1f3-453121af9c60" +// role: RUNNER_ROLE_ADMIN +// ``` func (r *RunnerPolicyService) New(ctx context.Context, body RunnerPolicyNewParams, opts ...option.RequestOption) (res *RunnerPolicyNewResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.RunnerService/CreateRunnerPolicy" @@ -42,7 +60,25 @@ func (r *RunnerPolicyService) New(ctx context.Context, body RunnerPolicyNewParam return } -// UpdateRunnerPolicy an existing runner policy. +// Updates an existing runner policy. +// +// Use this method to: +// +// - Modify access levels +// - Change group roles +// - Update permissions +// +// ### Examples +// +// - Update policy role: +// +// Changes a group's access level. +// +// ```yaml +// runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// groupId: "f53d2330-3795-4c5d-a1f3-453121af9c60" +// role: RUNNER_ROLE_USER +// ``` func (r *RunnerPolicyService) Update(ctx context.Context, body RunnerPolicyUpdateParams, opts ...option.RequestOption) (res *RunnerPolicyUpdateResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.RunnerService/UpdateRunnerPolicy" @@ -50,7 +86,25 @@ func (r *RunnerPolicyService) Update(ctx context.Context, body RunnerPolicyUpdat return } -// ListRunnerPolicies lists runner policies. +// Lists policies for a runner. +// +// Use this method to: +// +// - View access controls +// - Check policy configurations +// - Audit permissions +// +// ### Examples +// +// - List policies: +// +// Shows all policies for a runner. +// +// ```yaml +// runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// pagination: +// pageSize: 20 +// ``` 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...) @@ -68,12 +122,47 @@ func (r *RunnerPolicyService) List(ctx context.Context, params RunnerPolicyListP return res, nil } -// ListRunnerPolicies lists runner policies. +// Lists policies for a runner. +// +// Use this method to: +// +// - View access controls +// - Check policy configurations +// - Audit permissions +// +// ### Examples +// +// - List policies: +// +// Shows all policies for a runner. +// +// ```yaml +// runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// pagination: +// pageSize: 20 +// ``` func (r *RunnerPolicyService) ListAutoPaging(ctx context.Context, params RunnerPolicyListParams, opts ...option.RequestOption) *pagination.PoliciesPageAutoPager[RunnerPolicy] { return pagination.NewPoliciesPageAutoPager(r.List(ctx, params, opts...)) } -// DeleteRunnerPolicy deletes a runner policy. +// Deletes a runner policy. +// +// Use this method to: +// +// - Remove access controls +// - Revoke permissions +// - Clean up policies +// +// ### Examples +// +// - Delete policy: +// +// Removes a group's access policy. +// +// ```yaml +// runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// groupId: "f53d2330-3795-4c5d-a1f3-453121af9c60" +// ``` func (r *RunnerPolicyService) Delete(ctx context.Context, body RunnerPolicyDeleteParams, opts ...option.RequestOption) (res *RunnerPolicyDeleteResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.RunnerService/DeleteRunnerPolicy" diff --git a/runnerpolicy_test.go b/runnerpolicy_test.go index 37ba475..9b93124 100644 --- a/runnerpolicy_test.go +++ b/runnerpolicy_test.go @@ -27,9 +27,9 @@ func TestRunnerPolicyNewWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.Policies.New(context.TODO(), gitpod.RunnerPolicyNewParams{ - GroupID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + GroupID: gitpod.F("f53d2330-3795-4c5d-a1f3-453121af9c60"), Role: gitpod.F(gitpod.RunnerRoleUnspecified), - RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error @@ -54,9 +54,9 @@ func TestRunnerPolicyUpdateWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.Policies.Update(context.TODO(), gitpod.RunnerPolicyUpdateParams{ - GroupID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + GroupID: gitpod.F("f53d2330-3795-4c5d-a1f3-453121af9c60"), Role: gitpod.F(gitpod.RunnerRoleUnspecified), - RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error @@ -85,9 +85,9 @@ func TestRunnerPolicyListWithOptionalParams(t *testing.T) { PageSize: gitpod.F(int64(0)), Pagination: gitpod.F(gitpod.RunnerPolicyListParamsPagination{ Token: gitpod.F("token"), - PageSize: gitpod.F(int64(100)), + PageSize: gitpod.F(int64(20)), }), - RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error @@ -112,8 +112,8 @@ func TestRunnerPolicyDeleteWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Runners.Policies.Delete(context.TODO(), gitpod.RunnerPolicyDeleteParams{ - GroupID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - RunnerID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + GroupID: gitpod.F("f53d2330-3795-4c5d-a1f3-453121af9c60"), + RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error From 3a1e2d8fd6c74fa0030ce56d8b9726375462ef29 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 20 Feb 2025 12:09:51 +0000 Subject: [PATCH 2/4] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 27a7d82..d0c635d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 111 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-d6a243325df36817d495ce6dd54f80766b77a97e1ca2f6d371c0a68b7d070e0f.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-064a191bc556bcab46bb5d612c844437e1a4aef5981a4a99ab7f825a96ede4fa.yml From 19015d3d486ef7569342f1f08bcadebc9e5f89e3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 21 Feb 2025 11:57:38 +0000 Subject: [PATCH 3/4] feat(api): manual updates (#50) --- .stats.yml | 2 +- environment.go | 605 ++---------------------------- environment_test.go | 8 +- environmentautomationservice.go | 178 +-------- organizationdomainverification.go | 106 +++++- project.go | 12 +- runner.go | 307 ++------------- secret.go | 9 +- secret_test.go | 2 +- shared/shared.go | 445 +--------------------- user.go | 89 +---- 11 files changed, 193 insertions(+), 1570 deletions(-) diff --git a/.stats.yml b/.stats.yml index d0c635d..2c4d8ac 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 111 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-064a191bc556bcab46bb5d612c844437e1a4aef5981a4a99ab7f825a96ede4fa.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-3655d5ad0ac3e228c1519af70dbf3d0bfa3c47a2d06d4cac92a650da051b49a6.yml diff --git a/environment.go b/environment.go index 972b8d9..c5a19ee 100644 --- a/environment.go +++ b/environment.go @@ -465,13 +465,13 @@ 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,required"` - // EnvironmentMetadata is data associated with an environment that's required for - // other parts of the system to function + // Metadata is data associated with this environment that's required for other + // parts of Gitpod to function Metadata EnvironmentMetadata `json:"metadata"` - // EnvironmentSpec specifies the configuration of an environment for an environment - // start + // Spec is the configuration of the environment that's required for the runner to + // start the environment Spec EnvironmentSpec `json:"spec"` - // EnvironmentStatus describes an environment status + // Status is the current status of the environment Status EnvironmentStatus `json:"status"` JSON environmentJSON `json:"-"` } @@ -500,94 +500,8 @@ type EnvironmentActivitySignal struct { // 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 of when the activity was observed by the source. Only reported every 5 + // minutes. Zero value means no activity was observed. Timestamp time.Time `json:"timestamp" format:"date-time"` JSON environmentActivitySignalJSON `json:"-"` } @@ -615,94 +529,8 @@ type EnvironmentActivitySignalParam struct { // 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 of when the activity was observed by the source. Only reported every 5 + // minutes. Zero value means no activity was observed. Timestamp param.Field[time.Time] `json:"timestamp" format:"date-time"` } @@ -716,185 +544,12 @@ type EnvironmentMetadata 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. + // Time when the Environment was created. CreatedAt time.Time `json:"createdAt" format:"date-time"` // creator is the identity of the creator of the environment 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, - // 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. + // Time when the Environment was last started (i.e. CreateEnvironment or + // StartEnvironment were called). LastStartedAt time.Time `json:"lastStartedAt" format:"date-time"` // name is the name of the environment as specified by the user Name string `json:"name"` @@ -960,7 +615,7 @@ func (r EnvironmentPhase) IsKnown() bool { // EnvironmentSpec specifies the configuration of an environment for an environment // start type EnvironmentSpec struct { - // Admission level describes who can access an environment instance and its ports. + // admission controlls who can access the environment and its ports. Admission AdmissionLevel `json:"admission"` // automations_file is the automations file spec of the environment AutomationsFile EnvironmentSpecAutomationsFile `json:"automationsFile"` @@ -1049,7 +704,7 @@ type EnvironmentSpecContent struct { GitEmail string `json:"gitEmail"` // The Git username GitUsername string `json:"gitUsername"` - // EnvironmentInitializer specifies how an environment is to be initialized + // initializer configures how the environment is to be initialized Initializer EnvironmentInitializer `json:"initializer"` Session string `json:"session"` JSON environmentSpecContentJSON `json:"-"` @@ -1110,26 +765,16 @@ func (r environmentSpecDevcontainerJSON) RawJSON() string { // Experimental: dotfiles is the dotfiles configuration of the devcontainer type EnvironmentSpecDevcontainerDotfiles struct { // URL of a dotfiles Git repository (e.g. https://github.com/owner/repository) - Repository string `json:"repository,required" format:"uri"` - // install_command is the command to run after cloning the dotfiles repository. - // Defaults to run the first file of `install.sh`, `install`, `bootstrap.sh`, - // `bootstrap`, `setup.sh` and `setup` found in the dotfiles repository's root - // folder. - InstallCommand string `json:"installCommand"` - // target_path is the path to clone the dotfiles repository to. Defaults to - // `~/dotfiles`. - TargetPath string `json:"targetPath"` + Repository string `json:"repository,required" format:"uri"` JSON environmentSpecDevcontainerDotfilesJSON `json:"-"` } // environmentSpecDevcontainerDotfilesJSON contains the JSON metadata for the // struct [EnvironmentSpecDevcontainerDotfiles] type environmentSpecDevcontainerDotfilesJSON struct { - Repository apijson.Field - InstallCommand apijson.Field - TargetPath apijson.Field - raw string - ExtraFields map[string]apijson.Field + Repository apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *EnvironmentSpecDevcontainerDotfiles) UnmarshalJSON(data []byte) (err error) { @@ -1166,7 +811,7 @@ func (r environmentSpecMachineJSON) RawJSON() string { } type EnvironmentSpecPort struct { - // Admission level describes who can access an environment instance and its ports. + // policy of this port Admission AdmissionLevel `json:"admission"` // name of this port Name string `json:"name"` @@ -1263,63 +908,8 @@ func (r environmentSpecSSHPublicKeyJSON) RawJSON() string { // Timeout configures the environment timeout 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 - // 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". + // inacitivity is the maximum time of disconnection before the environment is + // stopped or paused. Minimum duration is 30 minutes. Set to 0 to disable. Disconnected string `json:"disconnected" format:"regex"` JSON environmentSpecTimeoutJSON `json:"-"` } @@ -1343,7 +933,7 @@ func (r environmentSpecTimeoutJSON) RawJSON() string { // 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 controlls who can access the environment 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"` @@ -1396,7 +986,7 @@ type EnvironmentSpecContentParam struct { 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 configures how the environment is to be initialized Initializer param.Field[EnvironmentInitializerParam] `json:"initializer"` Session param.Field[string] `json:"session"` } @@ -1427,14 +1017,6 @@ func (r EnvironmentSpecDevcontainerParam) MarshalJSON() (data []byte, err error) type EnvironmentSpecDevcontainerDotfilesParam struct { // URL of a dotfiles Git repository (e.g. https://github.com/owner/repository) Repository param.Field[string] `json:"repository,required" format:"uri"` - // install_command is the command to run after cloning the dotfiles repository. - // Defaults to run the first file of `install.sh`, `install`, `bootstrap.sh`, - // `bootstrap`, `setup.sh` and `setup` found in the dotfiles repository's root - // folder. - InstallCommand param.Field[string] `json:"installCommand"` - // target_path is the path to clone the dotfiles repository to. Defaults to - // `~/dotfiles`. - TargetPath param.Field[string] `json:"targetPath"` } func (r EnvironmentSpecDevcontainerDotfilesParam) MarshalJSON() (data []byte, err error) { @@ -1453,7 +1035,7 @@ func (r EnvironmentSpecMachineParam) MarshalJSON() (data []byte, err error) { } type EnvironmentSpecPortParam struct { - // Admission level describes who can access an environment instance and its ports. + // policy of this port Admission param.Field[AdmissionLevel] `json:"admission"` // name of this port Name param.Field[string] `json:"name"` @@ -1501,63 +1083,8 @@ func (r EnvironmentSpecSSHPublicKeyParam) MarshalJSON() (data []byte, err error) // 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. - // - // # 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". + // inacitivity is the maximum time of disconnection before the environment is + // stopped or paused. Minimum duration is 30 minutes. Set to 0 to disable. Disconnected param.Field[string] `json:"disconnected" format:"regex"` } @@ -1567,7 +1094,7 @@ func (r EnvironmentSpecTimeoutParam) MarshalJSON() (data []byte, err error) { // EnvironmentStatus describes an environment status type EnvironmentStatus struct { - // EnvironmentActivitySignal used to signal activity for an environment. + // activity_signal is the last activity signal for the environment. ActivitySignal EnvironmentActivitySignal `json:"activitySignal"` // automations_file contains the status of the automations file. AutomationsFile EnvironmentStatusAutomationsFile `json:"automationsFile"` @@ -1587,7 +1114,7 @@ type EnvironmentStatus struct { // 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 + // runner_ack contains the acknowledgement from the runner that is has received the // environment spec. RunnerAck EnvironmentStatusRunnerAck `json:"runnerAck"` // secrets contains the status of the environment secrets @@ -2128,7 +1655,7 @@ func (r environmentStatusMachineVersionsJSON) RawJSON() string { return r.raw } -// RunnerACK is the acknowledgement from the runner that is has received the +// runner_ack contains the acknowledgement from the runner that is has received the // environment spec. type EnvironmentStatusRunnerAck struct { Message string `json:"message"` @@ -2368,8 +1895,8 @@ type EnvironmentStartResponse = interface{} type EnvironmentStopResponse = interface{} type EnvironmentNewParams struct { - // EnvironmentSpec specifies the configuration of an environment for an environment - // start + // spec is the configuration of the environment that's required for the to start + // the environment Spec param.Field[EnvironmentSpecParam] `json:"spec"` } @@ -2439,7 +1966,7 @@ type EnvironmentUpdateParamsSpecContent struct { 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 configures how the 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"` @@ -2466,7 +1993,7 @@ func (r EnvironmentUpdateParamsSpecDevcontainer) MarshalJSON() (data []byte, err } type EnvironmentUpdateParamsSpecPort struct { - // Admission level describes who can access an environment instance and its ports. + // policy of this port Admission param.Field[AdmissionLevel] `json:"admission"` // name of this port Name param.Field[string] `json:"name"` @@ -2492,63 +2019,8 @@ func (r EnvironmentUpdateParamsSpecSSHPublicKey) MarshalJSON() (data []byte, err // Timeout configures the environment timeout 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 - // 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". + // inacitivity is the maximum time of disconnection before the environment is + // stopped or paused. Minimum duration is 30 minutes. Set to 0 to disable. Disconnected param.Field[string] `json:"disconnected" format:"regex"` } @@ -2629,8 +2101,9 @@ func (r EnvironmentDeleteParams) MarshalJSON() (data []byte, err error) { type EnvironmentNewFromProjectParams struct { ProjectID param.Field[string] `json:"projectId" format:"uuid"` - // EnvironmentSpec specifies the configuration of an environment for an environment - // start + // Spec is the configuration of the environment that's required for the runner to + // start the environment Configuration already defined in the Project will override + // parts of the spec, if set Spec param.Field[EnvironmentSpecParam] `json:"spec"` } @@ -2651,7 +2124,7 @@ func (r EnvironmentNewLogsTokenParams) MarshalJSON() (data []byte, err error) { } type EnvironmentMarkActiveParams struct { - // EnvironmentActivitySignal used to signal activity for an environment. + // activity_signal specifies the activity. ActivitySignal param.Field[EnvironmentActivitySignalParam] `json:"activitySignal"` // The ID of the environment to update activity for. EnvironmentID param.Field[string] `json:"environmentId" format:"uuid"` diff --git a/environment_test.go b/environment_test.go index bd47a1f..528434d 100644 --- a/environment_test.go +++ b/environment_test.go @@ -57,9 +57,7 @@ func TestEnvironmentNewWithOptionalParams(t *testing.T) { Devcontainer: gitpod.F(gitpod.EnvironmentSpecDevcontainerParam{ DevcontainerFilePath: gitpod.F("devcontainerFilePath"), Dotfiles: gitpod.F(gitpod.EnvironmentSpecDevcontainerDotfilesParam{ - Repository: gitpod.F("https://example.com"), - InstallCommand: gitpod.F("installCommand"), - TargetPath: gitpod.F("targetPath"), + Repository: gitpod.F("https://example.com"), }), Session: gitpod.F("session"), }), @@ -300,9 +298,7 @@ func TestEnvironmentNewFromProjectWithOptionalParams(t *testing.T) { Devcontainer: gitpod.F(gitpod.EnvironmentSpecDevcontainerParam{ DevcontainerFilePath: gitpod.F("devcontainerFilePath"), Dotfiles: gitpod.F(gitpod.EnvironmentSpecDevcontainerDotfilesParam{ - Repository: gitpod.F("https://example.com"), - InstallCommand: gitpod.F("installCommand"), - TargetPath: gitpod.F("targetPath"), + Repository: gitpod.F("https://example.com"), }), Session: gitpod.F("session"), }), diff --git a/environmentautomationservice.go b/environmentautomationservice.go index b6e3e84..e5873d1 100644 --- a/environmentautomationservice.go +++ b/environmentautomationservice.go @@ -355,94 +355,7 @@ func (r serviceJSON) RawJSON() string { } 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, - // 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. + // created_at is the time the service was created. CreatedAt time.Time `json:"createdAt" format:"date-time"` // creator describes the principal who created the service. Creator shared.Subject `json:"creator"` @@ -483,94 +396,7 @@ func (r serviceMetadataJSON) RawJSON() string { } 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. + // created_at is the time the service was created. 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"` diff --git a/organizationdomainverification.go b/organizationdomainverification.go index 5d24bb6..54d2b8d 100644 --- a/organizationdomainverification.go +++ b/organizationdomainverification.go @@ -318,6 +318,96 @@ type DomainVerification 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"` + VerificationToken string `json:"verificationToken"` + // A Timestamp represents a point in time independent of any time zone or local + // calendar, encoded as a count of seconds and fractions of seconds at nanosecond + // resolution. The count is relative to an epoch at UTC midnight on January 1, + // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar + // backwards to year one. + // + // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + // second table is needed for interpretation, using a + // [24-hour linear smear](https://developers.google.com/time/smear). + // + // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + // restricting to that range, we ensure that we can convert to and from + // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + // + // # Examples + // + // Example 1: Compute Timestamp from POSIX `time()`. + // + // Timestamp timestamp; + // timestamp.set_seconds(time(NULL)); + // timestamp.set_nanos(0); + // + // Example 2: Compute Timestamp from POSIX `gettimeofday()`. + // + // struct timeval tv; + // gettimeofday(&tv, NULL); + // + // Timestamp timestamp; + // timestamp.set_seconds(tv.tv_sec); + // timestamp.set_nanos(tv.tv_usec * 1000); + // + // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + // + // FILETIME ft; + // GetSystemTimeAsFileTime(&ft); + // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + // + // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + // Timestamp timestamp; + // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + // + // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + // + // long millis = System.currentTimeMillis(); + // + // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + // .setNanos((int) ((millis % 1000) * 1000000)).build(); + // + // Example 5: Compute Timestamp from Java `Instant.now()`. + // + // Instant now = Instant.now(); + // + // Timestamp timestamp = + // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + // .setNanos(now.getNano()).build(); + // + // Example 6: Compute Timestamp from current time in Python. + // + // timestamp = Timestamp() + // timestamp.GetCurrentTime() + // + // # JSON Mapping + // + // In JSON format, the Timestamp type is encoded as a string in the + // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is + // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always + // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are + // zero-padded to two digits each. The fractional seconds, which can go up to 9 + // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix + // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON + // serializer should always use UTC (as indicated by "Z") when printing the + // Timestamp type and a proto3 JSON parser should be able to accept both UTC and + // other timezones (as indicated by an offset). + // + // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on + // January 15, 2017. + // + // In JavaScript, one can convert a Date object to this format using the standard + // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + // method. In Python, a standard `datetime.datetime` object can be converted to + // this format using + // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the + // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the + // Joda Time's + // [`ISODateTimeFormat.dateTime()`]() + // to obtain a formatter capable of generating timestamps in this format. VerifiedAt time.Time `json:"verifiedAt" format:"date-time"` JSON domainVerificationJSON `json:"-"` } @@ -325,13 +415,15 @@ type DomainVerification struct { // domainVerificationJSON contains the JSON metadata for the struct // [DomainVerification] type domainVerificationJSON struct { - ID apijson.Field - Domain apijson.Field - OrganizationID apijson.Field - State apijson.Field - VerifiedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field + ID apijson.Field + Domain apijson.Field + OrganizationID apijson.Field + State apijson.Field + CreatedAt apijson.Field + VerificationToken apijson.Field + VerifiedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *DomainVerification) UnmarshalJSON(data []byte) (err error) { diff --git a/project.go b/project.go index c5ca467..f3055fa 100644 --- a/project.go +++ b/project.go @@ -325,7 +325,7 @@ type EnvironmentInitializerSpecsGit struct { 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 + // the target mode determines what gets checked out TargetMode EnvironmentInitializerSpecsGitTargetMode `json:"targetMode"` // upstream_Remote_uri is the fork upstream of a repository UpstreamRemoteUri string `json:"upstreamRemoteUri"` @@ -352,7 +352,7 @@ func (r environmentInitializerSpecsGitJSON) RawJSON() string { return r.raw } -// CloneTargetMode is the target state in which we want to leave a GitEnvironment +// the target mode determines what gets checked out type EnvironmentInitializerSpecsGitTargetMode string const ( @@ -405,7 +405,7 @@ type EnvironmentInitializerSpecsGitParam struct { 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 + // the target mode determines what gets checked out TargetMode param.Field[EnvironmentInitializerSpecsGitTargetMode] `json:"targetMode"` // upstream_Remote_uri is the fork upstream of a repository UpstreamRemoteUri param.Field[string] `json:"upstreamRemoteUri"` @@ -425,7 +425,7 @@ type Project struct { // 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 is the content initializer Initializer EnvironmentInitializer `json:"initializer"` Metadata ProjectMetadata `json:"metadata"` UsedBy ProjectUsedBy `json:"usedBy"` @@ -811,7 +811,7 @@ func (r projectNewFromEnvironmentResponseJSON) RawJSON() string { type ProjectNewParams struct { EnvironmentClass param.Field[ProjectEnvironmentClassParam] `json:"environmentClass,required"` - // EnvironmentInitializer specifies how an environment is to be initialized + // initializer is the content initializer Initializer param.Field[EnvironmentInitializerParam] `json:"initializer,required"` // automations_file_path is the path to the automations file relative to the repo // root path must not be absolute (start with a /): @@ -859,7 +859,7 @@ type ProjectUpdateParams struct { // ``` DevcontainerFilePath param.Field[string] `json:"devcontainerFilePath"` EnvironmentClass param.Field[ProjectEnvironmentClassParam] `json:"environmentClass"` - // EnvironmentInitializer specifies how an environment is to be initialized + // initializer is the content initializer Initializer param.Field[EnvironmentInitializerParam] `json:"initializer"` Name param.Field[string] `json:"name"` // project_id specifies the project identifier diff --git a/runner.go b/runner.go index 61d5802..6967628 100644 --- a/runner.go +++ b/runner.go @@ -329,198 +329,22 @@ func (r *RunnerService) ParseContextURL(ctx context.Context, body RunnerParseCon } 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, - // 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. + // Time when the Runner was created. CreatedAt time.Time `json:"createdAt" format:"date-time"` // creator is the identity of the creator of the environment Creator shared.Subject `json:"creator"` - // RunnerKind represents the kind of a runner + // The runner's 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. + // The runner's provider Provider RunnerProvider `json:"provider"` RunnerID string `json:"runnerId"` // The runner's specification Spec RunnerSpec `json:"spec"` - // RunnerStatus represents the status of a runner + // The runner's 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, - // 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. + // Time when the Runner was last udpated. UpdatedAt time.Time `json:"updatedAt" format:"date-time"` JSON runnerJSON `json:"-"` } @@ -730,99 +554,12 @@ type RunnerStatus struct { // 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 + // The runner's reported phase Phase RunnerPhase `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. + // Time when the status was last udpated. UpdatedAt time.Time `json:"updatedAt" format:"date-time"` Version string `json:"version"` JSON runnerStatusJSON `json:"-"` @@ -854,6 +591,8 @@ func (r runnerStatusJSON) RawJSON() string { type RunnerNewResponse struct { Runner Runner `json:"runner,required"` // deprecated, will be removed. Use exchange_token instead. + // + // Deprecated: deprecated 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 @@ -906,9 +645,11 @@ type RunnerUpdateResponse = interface{} type RunnerDeleteResponse = interface{} type RunnerCheckAuthenticationForHostResponse struct { - Authenticated bool `json:"authenticated"` + Authenticated bool `json:"authenticated"` + // Deprecated: deprecated AuthenticationURL string `json:"authenticationUrl"` - PatSupported bool `json:"patSupported"` + // Deprecated: deprecated + PatSupported bool `json:"patSupported"` // scm_id is the unique identifier of the SCM provider ScmID string `json:"scmId"` // scm_name is the human-readable name of the SCM provider (e.g., "GitHub", @@ -1006,6 +747,8 @@ func (r runnerCheckAuthenticationForHostResponseSupportsPatJSON) RawJSON() strin type RunnerNewRunnerTokenResponse struct { // deprecated, will be removed. Use exchange_token instead. + // + // Deprecated: deprecated 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 @@ -1088,13 +831,15 @@ func (r runnerParseContextURLResponseGitJSON) RawJSON() string { } type RunnerNewParams struct { - // RunnerKind represents the kind of a runner + // The runner's kind This field is optional and here for backwards-compatibility. + // Use the provider field instead. If provider is set, the runner's kind will be + // deduced from the provider. Only one of kind and provider must be set. 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. + // The specific implementation type of the runner This field is optional for + // backwards compatibility but will be required in the future. When specified, kind + // must not be specified (will be deduced from provider) Provider param.Field[RunnerProvider] `json:"provider"` Spec param.Field[RunnerSpecParam] `json:"spec"` } @@ -1127,7 +872,15 @@ func (r RunnerUpdateParams) MarshalJSON() (data []byte, err error) { type RunnerUpdateParamsSpec struct { Configuration param.Field[RunnerUpdateParamsSpecConfiguration] `json:"configuration"` - // RunnerPhase represents the phase a runner is in + // desired_phase can currently only be updated on local-configuration runners, to + // toggle whether local runners are allowed for running environments in the + // organization. Set to: + // + // - ACTIVE to enable local runners. + // - INACTIVE to disable all local runners. Existing local runners and their + // environments will stop, and cannot be started again until the desired_phase is + // set to ACTIVE. Use this carefully, as it will affect all users in the + // organization who use local runners. DesiredPhase param.Field[RunnerPhase] `json:"desiredPhase"` } diff --git a/secret.go b/secret.go index 4809af0..d9ff134 100644 --- a/secret.go +++ b/secret.go @@ -483,8 +483,13 @@ type SecretUpdateValueResponse = interface{} type SecretNewParams struct { // secret will be mounted as a docker config in the environment VM, mount will have - // the docker registry host - ContainerRegistryBasicAuthHost param.Field[string] `json:"containerRegistryBasicAuthHost" format:"uri"` + // the docker registry host value must be a valid registry host (e.g. + // registry.docker.com, https://registry.docker.com, ghcr.io:5050): + // + // ``` + // this.matches('^[a-zA-Z0-9.-/:]+(:[0-9]+)?$') + // ``` + ContainerRegistryBasicAuthHost param.Field[string] `json:"containerRegistryBasicAuthHost"` // secret will be created as an Environment Variable with the same name as the // secret EnvironmentVariable param.Field[bool] `json:"environmentVariable"` diff --git a/secret_test.go b/secret_test.go index 4d09a07..c6bf30b 100644 --- a/secret_test.go +++ b/secret_test.go @@ -27,7 +27,7 @@ func TestSecretNewWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Secrets.New(context.TODO(), gitpod.SecretNewParams{ - ContainerRegistryBasicAuthHost: gitpod.F("https://example.com"), + ContainerRegistryBasicAuthHost: gitpod.F("containerRegistryBasicAuthHost"), EnvironmentVariable: gitpod.F(true), FilePath: gitpod.F("filePath"), Name: gitpod.F("DATABASE_URL"), diff --git a/shared/shared.go b/shared/shared.go index fbafa36..d44e3cc 100644 --- a/shared/shared.go +++ b/shared/shared.go @@ -328,276 +328,15 @@ func (r taskExecutionJSON) RawJSON() string { } 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. + // completed_at is the time the task execution was done. 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. + // created_at is the time the task was created. 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. + // started_at is the time the task execution actually started to run. StartedAt time.Time `json:"startedAt" format:"date-time"` // started_by describes the trigger that started the task execution. StartedBy string `json:"startedBy"` @@ -821,94 +560,7 @@ func (r taskExecutionStatusStepJSON) RawJSON() string { } type TaskMetadata struct { - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. + // created_at is the time the task was created. CreatedAt time.Time `json:"createdAt" format:"date-time"` // creator describes the principal who created the task. Creator Subject `json:"creator"` @@ -949,94 +601,7 @@ func (r taskMetadataJSON) RawJSON() string { } type TaskMetadataParam struct { - // A Timestamp represents a point in time independent of any time zone or local - // calendar, encoded as a count of seconds and fractions of seconds at nanosecond - // resolution. The count is relative to an epoch at UTC midnight on January 1, - // 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - // backwards to year one. - // - // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - // second table is needed for interpretation, using a - // [24-hour linear smear](https://developers.google.com/time/smear). - // - // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - // restricting to that range, we ensure that we can convert to and from - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - // - // # Examples - // - // Example 1: Compute Timestamp from POSIX `time()`. - // - // Timestamp timestamp; - // timestamp.set_seconds(time(NULL)); - // timestamp.set_nanos(0); - // - // Example 2: Compute Timestamp from POSIX `gettimeofday()`. - // - // struct timeval tv; - // gettimeofday(&tv, NULL); - // - // Timestamp timestamp; - // timestamp.set_seconds(tv.tv_sec); - // timestamp.set_nanos(tv.tv_usec * 1000); - // - // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - // - // FILETIME ft; - // GetSystemTimeAsFileTime(&ft); - // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - // - // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - // Timestamp timestamp; - // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - // - // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - // - // long millis = System.currentTimeMillis(); - // - // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - // .setNanos((int) ((millis % 1000) * 1000000)).build(); - // - // Example 5: Compute Timestamp from Java `Instant.now()`. - // - // Instant now = Instant.now(); - // - // Timestamp timestamp = - // Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - // .setNanos(now.getNano()).build(); - // - // Example 6: Compute Timestamp from current time in Python. - // - // timestamp = Timestamp() - // timestamp.GetCurrentTime() - // - // # JSON Mapping - // - // In JSON format, the Timestamp type is encoded as a string in the - // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - // "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - // expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - // zero-padded to two digits each. The fractional seconds, which can go up to 9 - // digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - // indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - // serializer should always use UTC (as indicated by "Z") when printing the - // Timestamp type and a proto3 JSON parser should be able to accept both UTC and - // other timezones (as indicated by an offset). - // - // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - // January 15, 2017. - // - // In JavaScript, one can convert a Date object to this format using the standard - // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - // method. In Python, a standard `datetime.datetime` object can be converted to - // this format using - // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - // time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - // Joda Time's - // [`ISODateTimeFormat.dateTime()`]() - // to obtain a formatter capable of generating timestamps in this format. + // created_at is the time the task was created. CreatedAt param.Field[time.Time] `json:"createdAt" format:"date-time"` // creator describes the principal who created the task. Creator param.Field[SubjectParam] `json:"creator"` diff --git a/user.go b/user.go index 7512097..5e2f4ef 100644 --- a/user.go +++ b/user.go @@ -99,94 +99,7 @@ type User struct { ID string `json:"id,required" format:"uuid"` // avatar_url is a link to the user avatar 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. + // created_at is the creation time CreatedAt time.Time `json:"createdAt" format:"date-time"` // name is the full name of the user Name string `json:"name"` From 04b2fe3532c03a191cf62c402f4fdb445fa21168 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 21 Feb 2025 11:57:57 +0000 Subject: [PATCH 4/4] release: 0.4.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ README.md | 2 +- internal/version.go | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index dbe5ddf..da59f99 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.3.2" + ".": "0.4.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 931167c..44d39ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 0.4.0 (2025-02-21) + +Full Changelog: [v0.3.2...v0.4.0](https://github.com/gitpod-io/gitpod-sdk-go/compare/v0.3.2...v0.4.0) + +### Features + +* **api:** manual updates ([#48](https://github.com/gitpod-io/gitpod-sdk-go/issues/48)) ([78b2504](https://github.com/gitpod-io/gitpod-sdk-go/commit/78b2504189e98dcfaef1427444378752ccede6cc)) +* **api:** manual updates ([#50](https://github.com/gitpod-io/gitpod-sdk-go/issues/50)) ([19015d3](https://github.com/gitpod-io/gitpod-sdk-go/commit/19015d3d486ef7569342f1f08bcadebc9e5f89e3)) + ## 0.3.2 (2025-02-18) Full Changelog: [v0.3.1...v0.3.2](https://github.com/gitpod-io/gitpod-sdk-go/compare/v0.3.1...v0.3.2) diff --git a/README.md b/README.md index 4456f9a..2f1cbb6 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Or to pin the version: ```sh -go get -u 'github.com/gitpod-io/gitpod-sdk-go@v0.3.2' +go get -u 'github.com/gitpod-io/gitpod-sdk-go@v0.4.0' ``` diff --git a/internal/version.go b/internal/version.go index 6fb829f..5c62cac 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "0.3.2" // x-release-please-version +const PackageVersion = "0.4.0" // x-release-please-version