From f8a2a44972841b5799dddf39cefb1e75a29e67be 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:12 +0000 Subject: [PATCH 01/27] feat(api): manual updates (#61) --- .stats.yml | 2 +- src/gitpod/resources/events.py | 92 +++- src/gitpod/resources/groups.py | 60 ++- src/gitpod/resources/projects/policies.py | 158 ++++++- src/gitpod/resources/projects/projects.py | 290 +++++++++++- .../runners/configurations/configurations.py | 52 ++- .../configurations/environment_classes.py | 194 +++++++- .../host_authentication_tokens.py | 222 ++++++++- .../runners/configurations/schema.py | 36 +- .../configurations/scm_integrations.py | 198 +++++++- src/gitpod/resources/runners/policies.py | 158 ++++++- src/gitpod/resources/runners/runners.py | 422 +++++++++++++++--- tests/api_resources/projects/test_policies.py | 32 +- .../test_environment_classes.py | 52 ++- .../test_host_authentication_tokens.py | 56 +-- .../runners/configurations/test_schema.py | 4 +- .../configurations/test_scm_integrations.py | 48 +- .../runners/test_configurations.py | 24 +- tests/api_resources/runners/test_policies.py | 32 +- tests/api_resources/test_events.py | 8 +- tests/api_resources/test_groups.py | 4 +- tests/api_resources/test_projects.py | 40 +- tests/api_resources/test_runners.py | 40 +- 23 files changed, 1933 insertions(+), 291 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/src/gitpod/resources/events.py b/src/gitpod/resources/events.py index 8a7ebdd..f5de7cf 100644 --- a/src/gitpod/resources/events.py +++ b/src/gitpod/resources/events.py @@ -62,8 +62,32 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncEntriesPage[EventListResponse]: """ - 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 + ``` Args: pagination: pagination contains the pagination options for listing environments @@ -116,7 +140,23 @@ def watch( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> JSONLDecoder[EventWatchResponse]: """ - 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. Args: environment_id: Environment scope produces events for the environment itself, all tasks, task @@ -187,8 +227,32 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[EventListResponse, AsyncEntriesPage[EventListResponse]]: """ - 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 + ``` Args: pagination: pagination contains the pagination options for listing environments @@ -241,7 +305,23 @@ async def watch( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncJSONLDecoder[EventWatchResponse]: """ - 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. Args: environment_id: Environment scope produces events for the environment itself, all tasks, task diff --git a/src/gitpod/resources/groups.py b/src/gitpod/resources/groups.py index 233e4b0..56c681f 100644 --- a/src/gitpod/resources/groups.py +++ b/src/gitpod/resources/groups.py @@ -56,7 +56,35 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncGroupsPage[Group]: """ - 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" + ``` Args: pagination: pagination contains the pagination options for listing groups @@ -125,7 +153,35 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[Group, AsyncGroupsPage[Group]]: """ - 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" + ``` Args: pagination: pagination contains the pagination options for listing groups diff --git a/src/gitpod/resources/projects/policies.py b/src/gitpod/resources/projects/policies.py index ffac162..5ca918c 100644 --- a/src/gitpod/resources/projects/policies.py +++ b/src/gitpod/resources/projects/policies.py @@ -68,7 +68,25 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> PolicyCreateResponse: """ - 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 + ``` Args: group_id: group_id specifies the group_id identifier @@ -113,7 +131,25 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> PolicyUpdateResponse: """ - 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 + ``` Args: group_id: group_id specifies the group_id identifier @@ -159,7 +195,25 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncPoliciesPage[ProjectPolicy]: """ - 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 + ``` Args: pagination: pagination contains the pagination options for listing project policies @@ -214,7 +268,24 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - 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" + ``` Args: group_id: group_id specifies the group_id identifier @@ -279,7 +350,25 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> PolicyCreateResponse: """ - 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 + ``` Args: group_id: group_id specifies the group_id identifier @@ -324,7 +413,25 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> PolicyUpdateResponse: """ - 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 + ``` Args: group_id: group_id specifies the group_id identifier @@ -370,7 +477,25 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[ProjectPolicy, AsyncPoliciesPage[ProjectPolicy]]: """ - 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 + ``` Args: pagination: pagination contains the pagination options for listing project policies @@ -425,7 +550,24 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - 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" + ``` Args: group_id: group_id specifies the group_id identifier diff --git a/src/gitpod/resources/projects/projects.py b/src/gitpod/resources/projects/projects.py index b3cd146..47ddd96 100644 --- a/src/gitpod/resources/projects/projects.py +++ b/src/gitpod/resources/projects/projects.py @@ -88,7 +88,46 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ProjectCreateResponse: """ - 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" + ``` Args: initializer: EnvironmentInitializer specifies how an environment is to be initialized @@ -145,7 +184,23 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ProjectRetrieveResponse: """ - 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" + ``` Args: project_id: project_id specifies the project identifier @@ -184,7 +239,35 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ProjectUpdateResponse: """ - 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" + ``` Args: automations_file_path: automations_file_path is the path to the automations file relative to the repo @@ -246,7 +329,24 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncProjectsPage[Project]: """ - 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 + ``` Args: pagination: pagination contains the pagination options for listing organizations @@ -292,7 +392,23 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - 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" + ``` Args: project_id: project_id specifies the project identifier @@ -327,7 +443,24 @@ def create_from_environment( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ProjectCreateFromEnvironmentResponse: """ - 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" + ``` Args: environment_id: environment_id specifies the environment identifier @@ -396,7 +529,46 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ProjectCreateResponse: """ - 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" + ``` Args: initializer: EnvironmentInitializer specifies how an environment is to be initialized @@ -453,7 +625,23 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ProjectRetrieveResponse: """ - 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" + ``` Args: project_id: project_id specifies the project identifier @@ -492,7 +680,35 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ProjectUpdateResponse: """ - 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" + ``` Args: automations_file_path: automations_file_path is the path to the automations file relative to the repo @@ -554,7 +770,24 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[Project, AsyncProjectsPage[Project]]: """ - 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 + ``` Args: pagination: pagination contains the pagination options for listing organizations @@ -600,7 +833,23 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - 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" + ``` Args: project_id: project_id specifies the project identifier @@ -635,7 +884,24 @@ async def create_from_environment( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ProjectCreateFromEnvironmentResponse: """ - 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" + ``` Args: environment_id: environment_id specifies the environment identifier diff --git a/src/gitpod/resources/runners/configurations/configurations.py b/src/gitpod/resources/runners/configurations/configurations.py index 135c788..9745992 100644 --- a/src/gitpod/resources/runners/configurations/configurations.py +++ b/src/gitpod/resources/runners/configurations/configurations.py @@ -106,10 +106,30 @@ def validate( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ConfigurationValidateResponse: - """ValidateRunnerConfiguration validates a runner configuration (e.g. + """ + 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. - environment - class, SCM integration) with the runner. + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + scmIntegration: + id: "integration-id" + scmId: "github" + host: "github.com" + oauthClientId: "client_id" + oauthPlaintextClientSecret: "client_secret" + ``` Args: extra_headers: Send extra headers @@ -186,10 +206,30 @@ async def validate( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ConfigurationValidateResponse: - """ValidateRunnerConfiguration validates a runner configuration (e.g. + """ + 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. - environment - class, SCM integration) with the runner. + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + scmIntegration: + id: "integration-id" + scmId: "github" + host: "github.com" + oauthClientId: "client_id" + oauthPlaintextClientSecret: "client_secret" + ``` Args: extra_headers: Send extra headers diff --git a/src/gitpod/resources/runners/configurations/environment_classes.py b/src/gitpod/resources/runners/configurations/environment_classes.py index e790fe7..d9df2a5 100644 --- a/src/gitpod/resources/runners/configurations/environment_classes.py +++ b/src/gitpod/resources/runners/configurations/environment_classes.py @@ -70,7 +70,30 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> EnvironmentClassCreateResponse: """ - 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" + ``` Args: extra_headers: Send extra headers @@ -110,7 +133,23 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> EnvironmentClassRetrieveResponse: """ - 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" + ``` Args: extra_headers: Send extra headers @@ -148,7 +187,26 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - 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 + ``` Args: extra_headers: Send extra headers @@ -191,8 +249,37 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncEnvironmentClassesPage[EnvironmentClass]: """ - 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 Args: pagination: pagination contains the pagination options for listing environment classes @@ -268,7 +355,30 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> EnvironmentClassCreateResponse: """ - 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" + ``` Args: extra_headers: Send extra headers @@ -308,7 +418,23 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> EnvironmentClassRetrieveResponse: """ - 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" + ``` Args: extra_headers: Send extra headers @@ -346,7 +472,26 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - 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 + ``` Args: extra_headers: Send extra headers @@ -389,8 +534,37 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[EnvironmentClass, AsyncEnvironmentClassesPage[EnvironmentClass]]: """ - 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 Args: pagination: pagination contains the pagination options for listing environment classes diff --git a/src/gitpod/resources/runners/configurations/host_authentication_tokens.py b/src/gitpod/resources/runners/configurations/host_authentication_tokens.py index 4f49af8..0b8c585 100644 --- a/src/gitpod/resources/runners/configurations/host_authentication_tokens.py +++ b/src/gitpod/resources/runners/configurations/host_authentication_tokens.py @@ -80,7 +80,29 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> HostAuthenticationTokenCreateResponse: """ - 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" + ``` Args: expires_at: A Timestamp represents a point in time independent of any time zone or local @@ -212,7 +234,23 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> HostAuthenticationTokenRetrieveResponse: """ - 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" + ``` Args: extra_headers: Send extra headers @@ -249,7 +287,26 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - 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" + ``` Args: expires_at: A Timestamp represents a point in time independent of any time zone or local @@ -381,7 +438,35 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncTokensPage[HostAuthenticationToken]: """ - 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 + ``` Args: extra_headers: Send extra headers @@ -431,7 +516,23 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - 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" + ``` Args: extra_headers: Send extra headers @@ -492,7 +593,29 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> HostAuthenticationTokenCreateResponse: """ - 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" + ``` Args: expires_at: A Timestamp represents a point in time independent of any time zone or local @@ -624,7 +747,23 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> HostAuthenticationTokenRetrieveResponse: """ - 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" + ``` Args: extra_headers: Send extra headers @@ -661,7 +800,26 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - 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" + ``` Args: expires_at: A Timestamp represents a point in time independent of any time zone or local @@ -793,7 +951,35 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[HostAuthenticationToken, AsyncTokensPage[HostAuthenticationToken]]: """ - 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 + ``` Args: extra_headers: Send extra headers @@ -843,7 +1029,23 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - 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" + ``` Args: extra_headers: Send extra headers diff --git a/src/gitpod/resources/runners/configurations/schema.py b/src/gitpod/resources/runners/configurations/schema.py index 4d3f3e5..e15565a 100644 --- a/src/gitpod/resources/runners/configurations/schema.py +++ b/src/gitpod/resources/runners/configurations/schema.py @@ -56,7 +56,23 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SchemaRetrieveResponse: """ - 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" + ``` Args: extra_headers: Send extra headers @@ -109,7 +125,23 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SchemaRetrieveResponse: """ - 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" + ``` Args: extra_headers: Send extra headers diff --git a/src/gitpod/resources/runners/configurations/scm_integrations.py b/src/gitpod/resources/runners/configurations/scm_integrations.py index 97aa260..0ce580d 100644 --- a/src/gitpod/resources/runners/configurations/scm_integrations.py +++ b/src/gitpod/resources/runners/configurations/scm_integrations.py @@ -72,7 +72,27 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ScmIntegrationCreateResponse: """ - 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" + ``` Args: oauth_client_id: oauth_client_id is the OAuth app's client ID, if OAuth is configured. If @@ -123,7 +143,23 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ScmIntegrationRetrieveResponse: """ - 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" + ``` Args: extra_headers: Send extra headers @@ -158,7 +194,25 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - 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" + ``` Args: oauth_client_id: oauth_client_id can be set to update the OAuth app's client ID. If an empty @@ -218,7 +272,26 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncIntegrationsPage[ScmIntegration]: """ - 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 + ``` Args: pagination: pagination contains the pagination options for listing scm integrations @@ -270,7 +343,23 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - 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" + ``` Args: extra_headers: Send extra headers @@ -328,7 +417,27 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ScmIntegrationCreateResponse: """ - 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" + ``` Args: oauth_client_id: oauth_client_id is the OAuth app's client ID, if OAuth is configured. If @@ -379,7 +488,23 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ScmIntegrationRetrieveResponse: """ - 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" + ``` Args: extra_headers: Send extra headers @@ -414,7 +539,25 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - 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" + ``` Args: oauth_client_id: oauth_client_id can be set to update the OAuth app's client ID. If an empty @@ -474,7 +617,26 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[ScmIntegration, AsyncIntegrationsPage[ScmIntegration]]: """ - 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 + ``` Args: pagination: pagination contains the pagination options for listing scm integrations @@ -526,7 +688,23 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - 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" + ``` Args: extra_headers: Send extra headers diff --git a/src/gitpod/resources/runners/policies.py b/src/gitpod/resources/runners/policies.py index 09de7ed..5bc9d25 100644 --- a/src/gitpod/resources/runners/policies.py +++ b/src/gitpod/resources/runners/policies.py @@ -68,7 +68,25 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> PolicyCreateResponse: """ - 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 + ``` Args: group_id: group_id specifies the group_id identifier @@ -113,7 +131,25 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> PolicyUpdateResponse: """ - 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 + ``` Args: group_id: group_id specifies the group_id identifier @@ -159,7 +195,25 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncPoliciesPage[RunnerPolicy]: """ - 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 + ``` Args: pagination: pagination contains the pagination options for listing project policies @@ -214,7 +268,24 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - 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" + ``` Args: group_id: group_id specifies the group_id identifier @@ -279,7 +350,25 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> PolicyCreateResponse: """ - 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 + ``` Args: group_id: group_id specifies the group_id identifier @@ -324,7 +413,25 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> PolicyUpdateResponse: """ - 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 + ``` Args: group_id: group_id specifies the group_id identifier @@ -370,7 +477,25 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[RunnerPolicy, AsyncPoliciesPage[RunnerPolicy]]: """ - 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 + ``` Args: pagination: pagination contains the pagination options for listing project policies @@ -425,7 +550,24 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - 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" + ``` Args: group_id: group_id specifies the group_id identifier diff --git a/src/gitpod/resources/runners/runners.py b/src/gitpod/resources/runners/runners.py index 66fc4e7..2b4b221 100644 --- a/src/gitpod/resources/runners/runners.py +++ b/src/gitpod/resources/runners/runners.py @@ -104,11 +104,48 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RunnerCreateResponse: - """CreateRunner creates a new runner with the server. + """Creates a new runner registration 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. + 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 + ``` Args: kind: RunnerKind represents the kind of a runner @@ -156,7 +193,24 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RunnerRetrieveResponse: """ - 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" + ``` Args: extra_headers: Send extra headers @@ -190,7 +244,29 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - 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 + ``` Args: name: The runner's name which is shown to users @@ -238,7 +314,36 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncRunnersPage[Runner]: """ - 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 + ``` Args: pagination: pagination contains the pagination options for listing runners @@ -291,7 +396,23 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - 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" + ``` Args: force: force indicates whether the runner should be deleted forcefully. When force @@ -335,10 +456,23 @@ def check_authentication_for_host( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RunnerCheckAuthenticationForHostResponse: """ - 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" + ``` Args: extra_headers: Send extra headers @@ -375,11 +509,26 @@ def create_runner_token( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RunnerCreateRunnerTokenResponse: - """CreateRunnerToken returns a token that can be used to authenticate as the - runner. + """ + 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. - Use this call to renew an outdated token - this does not expire any - previously issued tokens. + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + ``` Args: extra_headers: Send extra headers @@ -414,18 +563,30 @@ def parse_context_url( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RunnerParseContextURLResponse: """ - 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" + ``` Args: extra_headers: Send extra headers @@ -494,11 +655,48 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RunnerCreateResponse: - """CreateRunner creates a new runner with the server. + """Creates a new runner registration 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. + 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 + ``` Args: kind: RunnerKind represents the kind of a runner @@ -546,7 +744,24 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RunnerRetrieveResponse: """ - 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" + ``` Args: extra_headers: Send extra headers @@ -580,7 +795,29 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - 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 + ``` Args: name: The runner's name which is shown to users @@ -628,7 +865,36 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[Runner, AsyncRunnersPage[Runner]]: """ - 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 + ``` Args: pagination: pagination contains the pagination options for listing runners @@ -681,7 +947,23 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - 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" + ``` Args: force: force indicates whether the runner should be deleted forcefully. When force @@ -725,10 +1007,23 @@ async def check_authentication_for_host( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RunnerCheckAuthenticationForHostResponse: """ - 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" + ``` Args: extra_headers: Send extra headers @@ -765,11 +1060,26 @@ async def create_runner_token( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RunnerCreateRunnerTokenResponse: - """CreateRunnerToken returns a token that can be used to authenticate as the - runner. + """ + 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. - Use this call to renew an outdated token - this does not expire any - previously issued tokens. + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + ``` Args: extra_headers: Send extra headers @@ -804,18 +1114,30 @@ async def parse_context_url( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RunnerParseContextURLResponse: """ - 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" + ``` Args: extra_headers: Send extra headers diff --git a/tests/api_resources/projects/test_policies.py b/tests/api_resources/projects/test_policies.py index cf0a4f4..fdd40b7 100644 --- a/tests/api_resources/projects/test_policies.py +++ b/tests/api_resources/projects/test_policies.py @@ -32,8 +32,8 @@ def test_method_create(self, client: Gitpod) -> None: @parametrize def test_method_create_with_all_params(self, client: Gitpod) -> None: policy = client.projects.policies.create( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", role="PROJECT_ROLE_UNSPECIFIED", ) assert_matches_type(PolicyCreateResponse, policy, path=["response"]) @@ -70,8 +70,8 @@ def test_method_update(self, client: Gitpod) -> None: @parametrize def test_method_update_with_all_params(self, client: Gitpod) -> None: policy = client.projects.policies.update( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", role="PROJECT_ROLE_UNSPECIFIED", ) assert_matches_type(PolicyUpdateResponse, policy, path=["response"]) @@ -112,9 +112,9 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: page_size=0, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", ) assert_matches_type(SyncPoliciesPage[ProjectPolicy], policy, path=["response"]) @@ -150,8 +150,8 @@ def test_method_delete(self, client: Gitpod) -> None: @parametrize def test_method_delete_with_all_params(self, client: Gitpod) -> None: policy = client.projects.policies.delete( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", ) assert_matches_type(object, policy, path=["response"]) @@ -191,8 +191,8 @@ async def test_method_create(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> None: policy = await async_client.projects.policies.create( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", role="PROJECT_ROLE_UNSPECIFIED", ) assert_matches_type(PolicyCreateResponse, policy, path=["response"]) @@ -229,8 +229,8 @@ async def test_method_update(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> None: policy = await async_client.projects.policies.update( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", role="PROJECT_ROLE_UNSPECIFIED", ) assert_matches_type(PolicyUpdateResponse, policy, path=["response"]) @@ -271,9 +271,9 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N page_size=0, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", ) assert_matches_type(AsyncPoliciesPage[ProjectPolicy], policy, path=["response"]) @@ -309,8 +309,8 @@ async def test_method_delete(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_delete_with_all_params(self, async_client: AsyncGitpod) -> None: policy = await async_client.projects.policies.delete( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", ) assert_matches_type(object, policy, path=["response"]) diff --git a/tests/api_resources/runners/configurations/test_environment_classes.py b/tests/api_resources/runners/configurations/test_environment_classes.py index 0c47b39..1668612 100644 --- a/tests/api_resources/runners/configurations/test_environment_classes.py +++ b/tests/api_resources/runners/configurations/test_environment_classes.py @@ -34,13 +34,17 @@ def test_method_create_with_all_params(self, client: Gitpod) -> None: environment_class = client.runners.configurations.environment_classes.create( configuration=[ { - "key": "key", - "value": "value", - } + "key": "cpu", + "value": "8", + }, + { + "key": "memory", + "value": "16384", + }, ], - description="xxx", - display_name="xxx", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + description="8 CPU, 16GB RAM", + display_name="Large Instance", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(EnvironmentClassCreateResponse, environment_class, path=["response"]) @@ -76,7 +80,7 @@ def test_method_retrieve(self, client: Gitpod) -> None: @parametrize def test_method_retrieve_with_all_params(self, client: Gitpod) -> None: environment_class = client.runners.configurations.environment_classes.retrieve( - environment_class_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + environment_class_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(EnvironmentClassRetrieveResponse, environment_class, path=["response"]) @@ -112,10 +116,10 @@ def test_method_update(self, client: Gitpod) -> None: @parametrize def test_method_update_with_all_params(self, client: Gitpod) -> None: environment_class = client.runners.configurations.environment_classes.update( - description="xxx", - display_name="xxx", + description="16 CPU, 32GB RAM", + display_name="Updated Large Instance", enabled=True, - environment_class_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + environment_class_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(object, environment_class, path=["response"]) @@ -162,7 +166,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: }, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(SyncEnvironmentClassesPage[EnvironmentClass], environment_class, path=["response"]) @@ -205,13 +209,17 @@ async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> environment_class = await async_client.runners.configurations.environment_classes.create( configuration=[ { - "key": "key", - "value": "value", - } + "key": "cpu", + "value": "8", + }, + { + "key": "memory", + "value": "16384", + }, ], - description="xxx", - display_name="xxx", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + description="8 CPU, 16GB RAM", + display_name="Large Instance", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(EnvironmentClassCreateResponse, environment_class, path=["response"]) @@ -247,7 +255,7 @@ async def test_method_retrieve(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncGitpod) -> None: environment_class = await async_client.runners.configurations.environment_classes.retrieve( - environment_class_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + environment_class_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(EnvironmentClassRetrieveResponse, environment_class, path=["response"]) @@ -285,10 +293,10 @@ async def test_method_update(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> None: environment_class = await async_client.runners.configurations.environment_classes.update( - description="xxx", - display_name="xxx", + description="16 CPU, 32GB RAM", + display_name="Updated Large Instance", enabled=True, - environment_class_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + environment_class_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(object, environment_class, path=["response"]) @@ -335,7 +343,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N }, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(AsyncEnvironmentClassesPage[EnvironmentClass], environment_class, path=["response"]) diff --git a/tests/api_resources/runners/configurations/test_host_authentication_tokens.py b/tests/api_resources/runners/configurations/test_host_authentication_tokens.py index 27694ae..684e0f4 100644 --- a/tests/api_resources/runners/configurations/test_host_authentication_tokens.py +++ b/tests/api_resources/runners/configurations/test_host_authentication_tokens.py @@ -33,13 +33,13 @@ def test_method_create(self, client: Gitpod) -> None: @parametrize def test_method_create_with_all_params(self, client: Gitpod) -> None: host_authentication_token = client.runners.configurations.host_authentication_tokens.create( - token="x", - expires_at=parse_datetime("2019-12-27T18:11:19.117Z"), - host="x", - refresh_token="refreshToken", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + token="gho_xxxxxxxxxxxx", + expires_at=parse_datetime("2024-12-31T23:59:59Z"), + host="github.com", + refresh_token="ghr_xxxxxxxxxxxx", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", source="HOST_AUTHENTICATION_TOKEN_SOURCE_UNSPECIFIED", - user_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + user_id="f53d2330-3795-4c5d-a1f3-453121af9c60", ) assert_matches_type(HostAuthenticationTokenCreateResponse, host_authentication_token, path=["response"]) @@ -75,7 +75,7 @@ def test_method_retrieve(self, client: Gitpod) -> None: @parametrize def test_method_retrieve_with_all_params(self, client: Gitpod) -> None: host_authentication_token = client.runners.configurations.host_authentication_tokens.retrieve( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(HostAuthenticationTokenRetrieveResponse, host_authentication_token, path=["response"]) @@ -111,10 +111,10 @@ def test_method_update(self, client: Gitpod) -> None: @parametrize def test_method_update_with_all_params(self, client: Gitpod) -> None: host_authentication_token = client.runners.configurations.host_authentication_tokens.update( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - token="x", - expires_at=parse_datetime("2019-12-27T18:11:19.117Z"), - refresh_token="refreshToken", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", + token="gho_xxxxxxxxxxxx", + expires_at=parse_datetime("2024-12-31T23:59:59Z"), + refresh_token="ghr_xxxxxxxxxxxx", ) assert_matches_type(object, host_authentication_token, path=["response"]) @@ -153,12 +153,12 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: token="token", page_size=0, filter={ - "runner_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "runner_id": "d2c94c27-3b76-4a42-b88c-95a85e392c68", "user_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", }, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(SyncTokensPage[HostAuthenticationToken], host_authentication_token, path=["response"]) @@ -195,7 +195,7 @@ def test_method_delete(self, client: Gitpod) -> None: @parametrize def test_method_delete_with_all_params(self, client: Gitpod) -> None: host_authentication_token = client.runners.configurations.host_authentication_tokens.delete( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(object, host_authentication_token, path=["response"]) @@ -235,13 +235,13 @@ async def test_method_create(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> None: host_authentication_token = await async_client.runners.configurations.host_authentication_tokens.create( - token="x", - expires_at=parse_datetime("2019-12-27T18:11:19.117Z"), - host="x", - refresh_token="refreshToken", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + token="gho_xxxxxxxxxxxx", + expires_at=parse_datetime("2024-12-31T23:59:59Z"), + host="github.com", + refresh_token="ghr_xxxxxxxxxxxx", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", source="HOST_AUTHENTICATION_TOKEN_SOURCE_UNSPECIFIED", - user_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + user_id="f53d2330-3795-4c5d-a1f3-453121af9c60", ) assert_matches_type(HostAuthenticationTokenCreateResponse, host_authentication_token, path=["response"]) @@ -279,7 +279,7 @@ async def test_method_retrieve(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncGitpod) -> None: host_authentication_token = await async_client.runners.configurations.host_authentication_tokens.retrieve( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(HostAuthenticationTokenRetrieveResponse, host_authentication_token, path=["response"]) @@ -317,10 +317,10 @@ async def test_method_update(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> None: host_authentication_token = await async_client.runners.configurations.host_authentication_tokens.update( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - token="x", - expires_at=parse_datetime("2019-12-27T18:11:19.117Z"), - refresh_token="refreshToken", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", + token="gho_xxxxxxxxxxxx", + expires_at=parse_datetime("2024-12-31T23:59:59Z"), + refresh_token="ghr_xxxxxxxxxxxx", ) assert_matches_type(object, host_authentication_token, path=["response"]) @@ -361,12 +361,12 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N token="token", page_size=0, filter={ - "runner_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "runner_id": "d2c94c27-3b76-4a42-b88c-95a85e392c68", "user_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", }, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(AsyncTokensPage[HostAuthenticationToken], host_authentication_token, path=["response"]) @@ -405,7 +405,7 @@ async def test_method_delete(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_delete_with_all_params(self, async_client: AsyncGitpod) -> None: host_authentication_token = await async_client.runners.configurations.host_authentication_tokens.delete( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(object, host_authentication_token, path=["response"]) diff --git a/tests/api_resources/runners/configurations/test_schema.py b/tests/api_resources/runners/configurations/test_schema.py index 3fce8e3..9d50725 100644 --- a/tests/api_resources/runners/configurations/test_schema.py +++ b/tests/api_resources/runners/configurations/test_schema.py @@ -27,7 +27,7 @@ def test_method_retrieve(self, client: Gitpod) -> None: @parametrize def test_method_retrieve_with_all_params(self, client: Gitpod) -> None: schema = client.runners.configurations.schema.retrieve( - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(SchemaRetrieveResponse, schema, path=["response"]) @@ -67,7 +67,7 @@ async def test_method_retrieve(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncGitpod) -> None: schema = await async_client.runners.configurations.schema.retrieve( - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(SchemaRetrieveResponse, schema, path=["response"]) diff --git a/tests/api_resources/runners/configurations/test_scm_integrations.py b/tests/api_resources/runners/configurations/test_scm_integrations.py index 41ee4a5..a3c76eb 100644 --- a/tests/api_resources/runners/configurations/test_scm_integrations.py +++ b/tests/api_resources/runners/configurations/test_scm_integrations.py @@ -32,12 +32,12 @@ def test_method_create(self, client: Gitpod) -> None: @parametrize def test_method_create_with_all_params(self, client: Gitpod) -> None: scm_integration = client.runners.configurations.scm_integrations.create( - host="host", - oauth_client_id="oauthClientId", - oauth_plaintext_client_secret="oauthPlaintextClientSecret", + host="github.com", + oauth_client_id="client_id", + oauth_plaintext_client_secret="client_secret", pat=True, - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - scm_id="scmId", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", + scm_id="github", ) assert_matches_type(ScmIntegrationCreateResponse, scm_integration, path=["response"]) @@ -73,7 +73,7 @@ def test_method_retrieve(self, client: Gitpod) -> None: @parametrize def test_method_retrieve_with_all_params(self, client: Gitpod) -> None: scm_integration = client.runners.configurations.scm_integrations.retrieve( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(ScmIntegrationRetrieveResponse, scm_integration, path=["response"]) @@ -109,9 +109,9 @@ def test_method_update(self, client: Gitpod) -> None: @parametrize def test_method_update_with_all_params(self, client: Gitpod) -> None: scm_integration = client.runners.configurations.scm_integrations.update( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - oauth_client_id="oauthClientId", - oauth_plaintext_client_secret="oauthPlaintextClientSecret", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", + oauth_client_id="new_client_id", + oauth_plaintext_client_secret="new_client_secret", pat=True, ) assert_matches_type(object, scm_integration, path=["response"]) @@ -150,10 +150,10 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: scm_integration = client.runners.configurations.scm_integrations.list( token="token", page_size=0, - filter={"runner_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"]}, + filter={"runner_ids": ["d2c94c27-3b76-4a42-b88c-95a85e392c68"]}, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(SyncIntegrationsPage[ScmIntegration], scm_integration, path=["response"]) @@ -190,7 +190,7 @@ def test_method_delete(self, client: Gitpod) -> None: @parametrize def test_method_delete_with_all_params(self, client: Gitpod) -> None: scm_integration = client.runners.configurations.scm_integrations.delete( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(object, scm_integration, path=["response"]) @@ -230,12 +230,12 @@ async def test_method_create(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> None: scm_integration = await async_client.runners.configurations.scm_integrations.create( - host="host", - oauth_client_id="oauthClientId", - oauth_plaintext_client_secret="oauthPlaintextClientSecret", + host="github.com", + oauth_client_id="client_id", + oauth_plaintext_client_secret="client_secret", pat=True, - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - scm_id="scmId", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", + scm_id="github", ) assert_matches_type(ScmIntegrationCreateResponse, scm_integration, path=["response"]) @@ -271,7 +271,7 @@ async def test_method_retrieve(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncGitpod) -> None: scm_integration = await async_client.runners.configurations.scm_integrations.retrieve( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(ScmIntegrationRetrieveResponse, scm_integration, path=["response"]) @@ -307,9 +307,9 @@ async def test_method_update(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> None: scm_integration = await async_client.runners.configurations.scm_integrations.update( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - oauth_client_id="oauthClientId", - oauth_plaintext_client_secret="oauthPlaintextClientSecret", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", + oauth_client_id="new_client_id", + oauth_plaintext_client_secret="new_client_secret", pat=True, ) assert_matches_type(object, scm_integration, path=["response"]) @@ -348,10 +348,10 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N scm_integration = await async_client.runners.configurations.scm_integrations.list( token="token", page_size=0, - filter={"runner_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"]}, + filter={"runner_ids": ["d2c94c27-3b76-4a42-b88c-95a85e392c68"]}, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(AsyncIntegrationsPage[ScmIntegration], scm_integration, path=["response"]) @@ -388,7 +388,7 @@ async def test_method_delete(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_delete_with_all_params(self, async_client: AsyncGitpod) -> None: scm_integration = await async_client.runners.configurations.scm_integrations.delete( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(object, scm_integration, path=["response"]) diff --git a/tests/api_resources/runners/test_configurations.py b/tests/api_resources/runners/test_configurations.py index 7184caf..8d88dc3 100644 --- a/tests/api_resources/runners/test_configurations.py +++ b/tests/api_resources/runners/test_configurations.py @@ -40,15 +40,15 @@ def test_method_validate_with_all_params(self, client: Gitpod) -> None: "display_name": "xxx", "enabled": True, }, - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", scm_integration={ - "id": "id", - "host": "host", - "oauth_client_id": "oauthClientId", + "id": "integration-id", + "host": "github.com", + "oauth_client_id": "client_id", "oauth_encrypted_client_secret": "U3RhaW5sZXNzIHJvY2tz", - "oauth_plaintext_client_secret": "oauthPlaintextClientSecret", + "oauth_plaintext_client_secret": "client_secret", "pat": True, - "scm_id": "scmId", + "scm_id": "github", }, ) assert_matches_type(ConfigurationValidateResponse, configuration, path=["response"]) @@ -102,15 +102,15 @@ async def test_method_validate_with_all_params(self, async_client: AsyncGitpod) "display_name": "xxx", "enabled": True, }, - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", scm_integration={ - "id": "id", - "host": "host", - "oauth_client_id": "oauthClientId", + "id": "integration-id", + "host": "github.com", + "oauth_client_id": "client_id", "oauth_encrypted_client_secret": "U3RhaW5sZXNzIHJvY2tz", - "oauth_plaintext_client_secret": "oauthPlaintextClientSecret", + "oauth_plaintext_client_secret": "client_secret", "pat": True, - "scm_id": "scmId", + "scm_id": "github", }, ) assert_matches_type(ConfigurationValidateResponse, configuration, path=["response"]) diff --git a/tests/api_resources/runners/test_policies.py b/tests/api_resources/runners/test_policies.py index f0bcafa..a5da4a8 100644 --- a/tests/api_resources/runners/test_policies.py +++ b/tests/api_resources/runners/test_policies.py @@ -32,9 +32,9 @@ def test_method_create(self, client: Gitpod) -> None: @parametrize def test_method_create_with_all_params(self, client: Gitpod) -> None: policy = client.runners.policies.create( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", role="RUNNER_ROLE_UNSPECIFIED", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(PolicyCreateResponse, policy, path=["response"]) @@ -70,9 +70,9 @@ def test_method_update(self, client: Gitpod) -> None: @parametrize def test_method_update_with_all_params(self, client: Gitpod) -> None: policy = client.runners.policies.update( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", role="RUNNER_ROLE_UNSPECIFIED", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(PolicyUpdateResponse, policy, path=["response"]) @@ -112,9 +112,9 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: page_size=0, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(SyncPoliciesPage[RunnerPolicy], policy, path=["response"]) @@ -150,8 +150,8 @@ def test_method_delete(self, client: Gitpod) -> None: @parametrize def test_method_delete_with_all_params(self, client: Gitpod) -> None: policy = client.runners.policies.delete( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(object, policy, path=["response"]) @@ -191,9 +191,9 @@ async def test_method_create(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> None: policy = await async_client.runners.policies.create( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", role="RUNNER_ROLE_UNSPECIFIED", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(PolicyCreateResponse, policy, path=["response"]) @@ -229,9 +229,9 @@ async def test_method_update(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> None: policy = await async_client.runners.policies.update( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", role="RUNNER_ROLE_UNSPECIFIED", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(PolicyUpdateResponse, policy, path=["response"]) @@ -271,9 +271,9 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N page_size=0, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(AsyncPoliciesPage[RunnerPolicy], policy, path=["response"]) @@ -309,8 +309,8 @@ async def test_method_delete(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_delete_with_all_params(self, async_client: AsyncGitpod) -> None: policy = await async_client.runners.policies.delete( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(object, policy, path=["response"]) diff --git a/tests/api_resources/test_events.py b/tests/api_resources/test_events.py index 11a2ab9..977730e 100644 --- a/tests/api_resources/test_events.py +++ b/tests/api_resources/test_events.py @@ -32,14 +32,14 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: token="token", page_size=0, filter={ - "actor_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + "actor_ids": ["d2c94c27-3b76-4a42-b88c-95a85e392c68"], "actor_principals": ["PRINCIPAL_UNSPECIFIED"], "subject_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], "subject_types": ["RESOURCE_TYPE_UNSPECIFIED"], }, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(SyncEntriesPage[EventListResponse], event, path=["response"]) @@ -120,14 +120,14 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N token="token", page_size=0, filter={ - "actor_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + "actor_ids": ["d2c94c27-3b76-4a42-b88c-95a85e392c68"], "actor_principals": ["PRINCIPAL_UNSPECIFIED"], "subject_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], "subject_types": ["RESOURCE_TYPE_UNSPECIFIED"], }, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(AsyncEntriesPage[EventListResponse], event, path=["response"]) diff --git a/tests/api_resources/test_groups.py b/tests/api_resources/test_groups.py index 00bfe68..ed1c038 100644 --- a/tests/api_resources/test_groups.py +++ b/tests/api_resources/test_groups.py @@ -32,7 +32,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: page_size=0, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(SyncGroupsPage[Group], group, path=["response"]) @@ -77,7 +77,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N page_size=0, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(AsyncGroupsPage[Group], group, path=["response"]) diff --git a/tests/api_resources/test_projects.py b/tests/api_resources/test_projects.py index 4a57297..3d47dbd 100644 --- a/tests/api_resources/test_projects.py +++ b/tests/api_resources/test_projects.py @@ -38,7 +38,7 @@ def test_method_create(self, client: Gitpod) -> None: def test_method_create_with_all_params(self, client: Gitpod) -> None: project = client.projects.create( environment_class={ - "environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "environment_class_id": "d2c94c27-3b76-4a42-b88c-95a85e392c68", "local_runner": True, }, initializer={ @@ -48,7 +48,7 @@ def test_method_create_with_all_params(self, client: Gitpod) -> None: "git": { "checkout_location": "checkoutLocation", "clone_target": "cloneTarget", - "remote_uri": "remoteUri", + "remote_uri": "https://github.com/org/repo", "target_mode": "CLONE_TARGET_MODE_UNSPECIFIED", "upstream_remote_uri": "upstreamRemoteUri", }, @@ -57,7 +57,7 @@ def test_method_create_with_all_params(self, client: Gitpod) -> None: }, automations_file_path="automationsFilePath", devcontainer_file_path="devcontainerFilePath", - name="x", + name="Web Application", ) assert_matches_type(ProjectCreateResponse, project, path=["response"]) @@ -99,7 +99,7 @@ def test_method_retrieve(self, client: Gitpod) -> None: @parametrize def test_method_retrieve_with_all_params(self, client: Gitpod) -> None: project = client.projects.retrieve( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", ) assert_matches_type(ProjectRetrieveResponse, project, path=["response"]) @@ -138,7 +138,7 @@ def test_method_update_with_all_params(self, client: Gitpod) -> None: automations_file_path="automationsFilePath", devcontainer_file_path="devcontainerFilePath", environment_class={ - "environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "environment_class_id": "d2c94c27-3b76-4a42-b88c-95a85e392c68", "local_runner": True, }, initializer={ @@ -156,7 +156,7 @@ def test_method_update_with_all_params(self, client: Gitpod) -> None: ] }, name="x", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", ) assert_matches_type(ProjectUpdateResponse, project, path=["response"]) @@ -196,7 +196,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: page_size=0, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(SyncProjectsPage[Project], project, path=["response"]) @@ -233,7 +233,7 @@ def test_method_delete(self, client: Gitpod) -> None: @parametrize def test_method_delete_with_all_params(self, client: Gitpod) -> None: project = client.projects.delete( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", ) assert_matches_type(object, project, path=["response"]) @@ -269,8 +269,8 @@ def test_method_create_from_environment(self, client: Gitpod) -> None: @parametrize def test_method_create_from_environment_with_all_params(self, client: Gitpod) -> None: project = client.projects.create_from_environment( - environment_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - name="x", + environment_id="07e03a28-65a5-4d98-b532-8ea67b188048", + name="Frontend Project", ) assert_matches_type(ProjectCreateFromEnvironmentResponse, project, path=["response"]) @@ -314,7 +314,7 @@ async def test_method_create(self, async_client: AsyncGitpod) -> None: async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> None: project = await async_client.projects.create( environment_class={ - "environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "environment_class_id": "d2c94c27-3b76-4a42-b88c-95a85e392c68", "local_runner": True, }, initializer={ @@ -324,7 +324,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> "git": { "checkout_location": "checkoutLocation", "clone_target": "cloneTarget", - "remote_uri": "remoteUri", + "remote_uri": "https://github.com/org/repo", "target_mode": "CLONE_TARGET_MODE_UNSPECIFIED", "upstream_remote_uri": "upstreamRemoteUri", }, @@ -333,7 +333,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> }, automations_file_path="automationsFilePath", devcontainer_file_path="devcontainerFilePath", - name="x", + name="Web Application", ) assert_matches_type(ProjectCreateResponse, project, path=["response"]) @@ -375,7 +375,7 @@ async def test_method_retrieve(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncGitpod) -> None: project = await async_client.projects.retrieve( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", ) assert_matches_type(ProjectRetrieveResponse, project, path=["response"]) @@ -414,7 +414,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> automations_file_path="automationsFilePath", devcontainer_file_path="devcontainerFilePath", environment_class={ - "environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "environment_class_id": "d2c94c27-3b76-4a42-b88c-95a85e392c68", "local_runner": True, }, initializer={ @@ -432,7 +432,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> ] }, name="x", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", ) assert_matches_type(ProjectUpdateResponse, project, path=["response"]) @@ -472,7 +472,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N page_size=0, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(AsyncProjectsPage[Project], project, path=["response"]) @@ -509,7 +509,7 @@ async def test_method_delete(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_delete_with_all_params(self, async_client: AsyncGitpod) -> None: project = await async_client.projects.delete( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", ) assert_matches_type(object, project, path=["response"]) @@ -545,8 +545,8 @@ async def test_method_create_from_environment(self, async_client: AsyncGitpod) - @parametrize async def test_method_create_from_environment_with_all_params(self, async_client: AsyncGitpod) -> None: project = await async_client.projects.create_from_environment( - environment_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - name="x", + environment_id="07e03a28-65a5-4d98-b532-8ea67b188048", + name="Frontend Project", ) assert_matches_type(ProjectCreateFromEnvironmentResponse, project, path=["response"]) diff --git a/tests/api_resources/test_runners.py b/tests/api_resources/test_runners.py index 3829f7d..8968127 100644 --- a/tests/api_resources/test_runners.py +++ b/tests/api_resources/test_runners.py @@ -36,12 +36,12 @@ def test_method_create(self, client: Gitpod) -> None: def test_method_create_with_all_params(self, client: Gitpod) -> None: runner = client.runners.create( kind="RUNNER_KIND_UNSPECIFIED", - name="xxx", + name="Production Runner", provider="RUNNER_PROVIDER_UNSPECIFIED", spec={ "configuration": { "auto_update": True, - "region": "region", + "region": "us-west", "release_channel": "RUNNER_RELEASE_CHANNEL_UNSPECIFIED", }, "desired_phase": "RUNNER_PHASE_UNSPECIFIED", @@ -81,7 +81,7 @@ def test_method_retrieve(self, client: Gitpod) -> None: @parametrize def test_method_retrieve_with_all_params(self, client: Gitpod) -> None: runner = client.runners.retrieve( - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(RunnerRetrieveResponse, runner, path=["response"]) @@ -117,8 +117,8 @@ def test_method_update(self, client: Gitpod) -> None: @parametrize def test_method_update_with_all_params(self, client: Gitpod) -> None: runner = client.runners.update( - name="xxx", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + name="Updated Runner Name", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", spec={ "configuration": { "auto_update": True, @@ -170,7 +170,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: }, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(SyncRunnersPage[Runner], runner, path=["response"]) @@ -208,7 +208,7 @@ def test_method_delete(self, client: Gitpod) -> None: def test_method_delete_with_all_params(self, client: Gitpod) -> None: runner = client.runners.delete( force=True, - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(object, runner, path=["response"]) @@ -244,7 +244,7 @@ def test_method_check_authentication_for_host(self, client: Gitpod) -> None: @parametrize def test_method_check_authentication_for_host_with_all_params(self, client: Gitpod) -> None: runner = client.runners.check_authentication_for_host( - host="host", + host="github.com", runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) assert_matches_type(RunnerCheckAuthenticationForHostResponse, runner, path=["response"]) @@ -281,7 +281,7 @@ def test_method_create_runner_token(self, client: Gitpod) -> None: @parametrize def test_method_create_runner_token_with_all_params(self, client: Gitpod) -> None: runner = client.runners.create_runner_token( - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(RunnerCreateRunnerTokenResponse, runner, path=["response"]) @@ -317,7 +317,7 @@ def test_method_parse_context_url(self, client: Gitpod) -> None: @parametrize def test_method_parse_context_url_with_all_params(self, client: Gitpod) -> None: runner = client.runners.parse_context_url( - context_url="https://example.com", + context_url="https://github.com/org/repo/tree/main", runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) assert_matches_type(RunnerParseContextURLResponse, runner, path=["response"]) @@ -359,12 +359,12 @@ async def test_method_create(self, async_client: AsyncGitpod) -> None: async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> None: runner = await async_client.runners.create( kind="RUNNER_KIND_UNSPECIFIED", - name="xxx", + name="Production Runner", provider="RUNNER_PROVIDER_UNSPECIFIED", spec={ "configuration": { "auto_update": True, - "region": "region", + "region": "us-west", "release_channel": "RUNNER_RELEASE_CHANNEL_UNSPECIFIED", }, "desired_phase": "RUNNER_PHASE_UNSPECIFIED", @@ -404,7 +404,7 @@ async def test_method_retrieve(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncGitpod) -> None: runner = await async_client.runners.retrieve( - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(RunnerRetrieveResponse, runner, path=["response"]) @@ -440,8 +440,8 @@ async def test_method_update(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> None: runner = await async_client.runners.update( - name="xxx", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + name="Updated Runner Name", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", spec={ "configuration": { "auto_update": True, @@ -493,7 +493,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N }, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(AsyncRunnersPage[Runner], runner, path=["response"]) @@ -531,7 +531,7 @@ async def test_method_delete(self, async_client: AsyncGitpod) -> None: async def test_method_delete_with_all_params(self, async_client: AsyncGitpod) -> None: runner = await async_client.runners.delete( force=True, - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(object, runner, path=["response"]) @@ -567,7 +567,7 @@ async def test_method_check_authentication_for_host(self, async_client: AsyncGit @parametrize async def test_method_check_authentication_for_host_with_all_params(self, async_client: AsyncGitpod) -> None: runner = await async_client.runners.check_authentication_for_host( - host="host", + host="github.com", runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) assert_matches_type(RunnerCheckAuthenticationForHostResponse, runner, path=["response"]) @@ -604,7 +604,7 @@ async def test_method_create_runner_token(self, async_client: AsyncGitpod) -> No @parametrize async def test_method_create_runner_token_with_all_params(self, async_client: AsyncGitpod) -> None: runner = await async_client.runners.create_runner_token( - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(RunnerCreateRunnerTokenResponse, runner, path=["response"]) @@ -640,7 +640,7 @@ async def test_method_parse_context_url(self, async_client: AsyncGitpod) -> None @parametrize async def test_method_parse_context_url_with_all_params(self, async_client: AsyncGitpod) -> None: runner = await async_client.runners.parse_context_url( - context_url="https://example.com", + context_url="https://github.com/org/repo/tree/main", runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) assert_matches_type(RunnerParseContextURLResponse, runner, path=["response"]) From a4226682b5abc7644fe22c4a2de34df59356d80a 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:10:04 +0000 Subject: [PATCH 02/27] 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 a62be8a6e5ce5af0aeaec008db7f0a214222515d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 21 Feb 2025 05:20:32 +0000 Subject: [PATCH 03/27] feat(client): allow passing `NotGiven` for body (#63) fix(client): mark some request bodies as optional --- src/gitpod/_base_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gitpod/_base_client.py b/src/gitpod/_base_client.py index eb601ba..1772072 100644 --- a/src/gitpod/_base_client.py +++ b/src/gitpod/_base_client.py @@ -518,7 +518,7 @@ def _build_request( # so that passing a `TypedDict` doesn't cause an error. # https://github.com/microsoft/pyright/issues/3526#event-6715453066 params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None, - json=json_data, + json=json_data if is_given(json_data) else None, files=files, **kwargs, ) From f29b9ba65db6e3c1737c2d781e82ac3bcd457e3a 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:49 +0000 Subject: [PATCH 04/27] feat(api): manual updates (#64) --- .stats.yml | 2 +- .../resources/environments/environments.py | 22 +- src/gitpod/resources/projects/projects.py | 8 +- src/gitpod/resources/runners/runners.py | 20 +- src/gitpod/resources/secrets.py | 14 +- src/gitpod/types/environment.py | 10 +- .../types/environment_activity_signal.py | 90 +----- .../environment_activity_signal_param.py | 90 +----- .../environment_create_from_project_params.py | 5 +- src/gitpod/types/environment_create_params.py | 4 +- src/gitpod/types/environment_initializer.py | 2 +- .../types/environment_initializer_param.py | 2 +- .../types/environment_mark_active_params.py | 2 +- src/gitpod/types/environment_metadata.py | 181 +----------- src/gitpod/types/environment_spec.py | 79 +---- src/gitpod/types/environment_spec_param.py | 79 +---- src/gitpod/types/environment_status.py | 4 +- src/gitpod/types/environment_update_params.py | 63 +--- .../automations/service_metadata.py | 91 +----- .../automations/service_metadata_param.py | 91 +----- .../organizations/domain_verification.py | 94 ++++++ src/gitpod/types/project.py | 2 +- src/gitpod/types/project_create_params.py | 2 +- src/gitpod/types/project_update_params.py | 2 +- src/gitpod/types/runner.py | 192 +----------- src/gitpod/types/runner_create_params.py | 12 +- src/gitpod/types/runner_status.py | 93 +----- src/gitpod/types/runner_update_params.py | 12 +- src/gitpod/types/secret_create_params.py | 7 +- .../types/shared/task_execution_metadata.py | 273 +----------------- src/gitpod/types/shared/task_metadata.py | 91 +----- .../types/shared_params/task_metadata.py | 91 +----- src/gitpod/types/user.py | 91 +----- tests/api_resources/test_environments.py | 24 +- tests/api_resources/test_secrets.py | 4 +- 35 files changed, 220 insertions(+), 1629 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/src/gitpod/resources/environments/environments.py b/src/gitpod/resources/environments/environments.py index c5e250f..a7ced1a 100644 --- a/src/gitpod/resources/environments/environments.py +++ b/src/gitpod/resources/environments/environments.py @@ -164,8 +164,8 @@ def create( ``` Args: - spec: EnvironmentSpec specifies the configuration of an environment for an environment - start + spec: spec is the configuration of the environment that's required for the to start + the environment extra_headers: Send extra headers @@ -540,8 +540,9 @@ def create_from_project( ``` Args: - spec: EnvironmentSpec specifies the configuration of an environment for an environment - start + spec: 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 extra_headers: Send extra headers @@ -651,7 +652,7 @@ def mark_active( ``` Args: - activity_signal: EnvironmentActivitySignal used to signal activity for an environment. + activity_signal: activity_signal specifies the activity. environment_id: The ID of the environment to update activity for. @@ -880,8 +881,8 @@ async def create( ``` Args: - spec: EnvironmentSpec specifies the configuration of an environment for an environment - start + spec: spec is the configuration of the environment that's required for the to start + the environment extra_headers: Send extra headers @@ -1256,8 +1257,9 @@ async def create_from_project( ``` Args: - spec: EnvironmentSpec specifies the configuration of an environment for an environment - start + spec: 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 extra_headers: Send extra headers @@ -1367,7 +1369,7 @@ async def mark_active( ``` Args: - activity_signal: EnvironmentActivitySignal used to signal activity for an environment. + activity_signal: activity_signal specifies the activity. environment_id: The ID of the environment to update activity for. diff --git a/src/gitpod/resources/projects/projects.py b/src/gitpod/resources/projects/projects.py index 47ddd96..6b2e5ae 100644 --- a/src/gitpod/resources/projects/projects.py +++ b/src/gitpod/resources/projects/projects.py @@ -130,7 +130,7 @@ def create( ``` Args: - initializer: EnvironmentInitializer specifies how an environment is to be initialized + initializer: initializer is the content initializer automations_file_path: automations_file_path is the path to the automations file relative to the repo root path must not be absolute (start with a /): @@ -284,7 +284,7 @@ def update( this.matches("^$|^[^/].*") ``` - initializer: EnvironmentInitializer specifies how an environment is to be initialized + initializer: initializer is the content initializer project_id: project_id specifies the project identifier @@ -571,7 +571,7 @@ async def create( ``` Args: - initializer: EnvironmentInitializer specifies how an environment is to be initialized + initializer: initializer is the content initializer automations_file_path: automations_file_path is the path to the automations file relative to the repo root path must not be absolute (start with a /): @@ -725,7 +725,7 @@ async def update( this.matches("^$|^[^/].*") ``` - initializer: EnvironmentInitializer specifies how an environment is to be initialized + initializer: initializer is the content initializer project_id: project_id specifies the project identifier diff --git a/src/gitpod/resources/runners/runners.py b/src/gitpod/resources/runners/runners.py index 2b4b221..20da73b 100644 --- a/src/gitpod/resources/runners/runners.py +++ b/src/gitpod/resources/runners/runners.py @@ -148,13 +148,15 @@ def create( ``` Args: - kind: RunnerKind represents the kind of a runner + kind: 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. name: The runner name for humans - provider: RunnerProvider identifies the specific implementation type of a runner. Each - provider maps to a specific kind of runner (local or remote), as specified below - for each provider. + provider: 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) extra_headers: Send extra headers @@ -699,13 +701,15 @@ async def create( ``` Args: - kind: RunnerKind represents the kind of a runner + kind: 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. name: The runner name for humans - provider: RunnerProvider identifies the specific implementation type of a runner. Each - provider maps to a specific kind of runner (local or remote), as specified below - for each provider. + provider: 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) extra_headers: Send extra headers diff --git a/src/gitpod/resources/secrets.py b/src/gitpod/resources/secrets.py index 53c051b..b6c7a0e 100644 --- a/src/gitpod/resources/secrets.py +++ b/src/gitpod/resources/secrets.py @@ -116,7 +116,12 @@ def create( Args: container_registry_basic_auth_host: secret will be mounted as a docker config in the environment VM, mount will have - the docker registry host + 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]+)?$") + ``` environment_variable: secret will be created as an Environment Variable with the same name as the secret @@ -469,7 +474,12 @@ async def create( Args: container_registry_basic_auth_host: secret will be mounted as a docker config in the environment VM, mount will have - the docker registry host + 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]+)?$") + ``` environment_variable: secret will be created as an Environment Variable with the same name as the secret diff --git a/src/gitpod/types/environment.py b/src/gitpod/types/environment.py index 5dd6728..560cf25 100644 --- a/src/gitpod/types/environment.py +++ b/src/gitpod/types/environment.py @@ -20,15 +20,15 @@ class Environment(BaseModel): metadata: Optional[EnvironmentMetadata] = None """ - 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 """ spec: Optional[EnvironmentSpec] = None """ - 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 """ status: Optional[EnvironmentStatus] = None - """EnvironmentStatus describes an environment status""" + """Status is the current status of the environment""" diff --git a/src/gitpod/types/environment_activity_signal.py b/src/gitpod/types/environment_activity_signal.py index ea825be..afedc99 100644 --- a/src/gitpod/types/environment_activity_signal.py +++ b/src/gitpod/types/environment_activity_signal.py @@ -18,92 +18,6 @@ class EnvironmentActivitySignal(BaseModel): timestamp: Optional[datetime] = None """ - 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()`](<http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#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. """ diff --git a/src/gitpod/types/environment_activity_signal_param.py b/src/gitpod/types/environment_activity_signal_param.py index d097493..a9cb0c1 100644 --- a/src/gitpod/types/environment_activity_signal_param.py +++ b/src/gitpod/types/environment_activity_signal_param.py @@ -21,92 +21,6 @@ class EnvironmentActivitySignalParam(TypedDict, total=False): timestamp: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] """ - 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()`](<http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#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. """ diff --git a/src/gitpod/types/environment_create_from_project_params.py b/src/gitpod/types/environment_create_from_project_params.py index d8d6092..2c9806f 100644 --- a/src/gitpod/types/environment_create_from_project_params.py +++ b/src/gitpod/types/environment_create_from_project_params.py @@ -15,6 +15,7 @@ class EnvironmentCreateFromProjectParams(TypedDict, total=False): spec: EnvironmentSpecParam """ - 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 """ diff --git a/src/gitpod/types/environment_create_params.py b/src/gitpod/types/environment_create_params.py index 33e65d8..e49a7d2 100644 --- a/src/gitpod/types/environment_create_params.py +++ b/src/gitpod/types/environment_create_params.py @@ -12,6 +12,6 @@ class EnvironmentCreateParams(TypedDict, total=False): spec: EnvironmentSpecParam """ - 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 """ diff --git a/src/gitpod/types/environment_initializer.py b/src/gitpod/types/environment_initializer.py index 8630b15..2a2866a 100644 --- a/src/gitpod/types/environment_initializer.py +++ b/src/gitpod/types/environment_initializer.py @@ -36,7 +36,7 @@ class SpecGit(BaseModel): "CLONE_TARGET_MODE_LOCAL_BRANCH", ] ] = FieldInfo(alias="targetMode", default=None) - """CloneTargetMode is the target state in which we want to leave a GitEnvironment""" + """the target mode determines what gets checked out""" upstream_remote_uri: Optional[str] = FieldInfo(alias="upstreamRemoteUri", default=None) """upstream_Remote_uri is the fork upstream of a repository""" diff --git a/src/gitpod/types/environment_initializer_param.py b/src/gitpod/types/environment_initializer_param.py index 32b0a64..695d836 100644 --- a/src/gitpod/types/environment_initializer_param.py +++ b/src/gitpod/types/environment_initializer_param.py @@ -37,7 +37,7 @@ class SpecGit(TypedDict, total=False): ], PropertyInfo(alias="targetMode"), ] - """CloneTargetMode is the target state in which we want to leave a GitEnvironment""" + """the target mode determines what gets checked out""" upstream_remote_uri: Annotated[str, PropertyInfo(alias="upstreamRemoteUri")] """upstream_Remote_uri is the fork upstream of a repository""" diff --git a/src/gitpod/types/environment_mark_active_params.py b/src/gitpod/types/environment_mark_active_params.py index 8e2cbce..0e10971 100644 --- a/src/gitpod/types/environment_mark_active_params.py +++ b/src/gitpod/types/environment_mark_active_params.py @@ -12,7 +12,7 @@ class EnvironmentMarkActiveParams(TypedDict, total=False): activity_signal: Annotated[EnvironmentActivitySignalParam, PropertyInfo(alias="activitySignal")] - """EnvironmentActivitySignal used to signal activity for an environment.""" + """activity_signal specifies the activity.""" environment_id: Annotated[str, PropertyInfo(alias="environmentId")] """The ID of the environment to update activity for.""" diff --git a/src/gitpod/types/environment_metadata.py b/src/gitpod/types/environment_metadata.py index 412b7ae..5d6e380 100644 --- a/src/gitpod/types/environment_metadata.py +++ b/src/gitpod/types/environment_metadata.py @@ -19,190 +19,15 @@ class EnvironmentMetadata(BaseModel): """ created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) - """ - 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()`](<http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()>) - to obtain a formatter capable of generating timestamps in this format. - """ + """Time when the Environment was created.""" creator: Optional[Subject] = None """creator is the identity of the creator of the environment""" last_started_at: Optional[datetime] = FieldInfo(alias="lastStartedAt", default=None) - """ - 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. + """Time when the Environment was last started (i.e. - 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()`](<http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()>) - to obtain a formatter capable of generating timestamps in this format. + CreateEnvironment or StartEnvironment were called). """ name: Optional[str] = None diff --git a/src/gitpod/types/environment_spec.py b/src/gitpod/types/environment_spec.py index b001bdc..0dd9d9d 100644 --- a/src/gitpod/types/environment_spec.py +++ b/src/gitpod/types/environment_spec.py @@ -46,7 +46,7 @@ class Content(BaseModel): """The Git username""" initializer: Optional[EnvironmentInitializer] = None - """EnvironmentInitializer specifies how an environment is to be initialized""" + """initializer configures how the environment is to be initialized""" session: Optional[str] = None @@ -55,20 +55,6 @@ class DevcontainerDotfiles(BaseModel): repository: str """URL of a dotfiles Git repository (e.g. https://github.com/owner/repository)""" - install_command: Optional[str] = FieldInfo(alias="installCommand", default=None) - """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. - """ - - target_path: Optional[str] = FieldInfo(alias="targetPath", default=None) - """target_path is the path to clone the dotfiles repository to. - - Defaults to `~/dotfiles`. - """ - class Devcontainer(BaseModel): devcontainer_file_path: Optional[str] = FieldInfo(alias="devcontainerFilePath", default=None) @@ -96,7 +82,7 @@ class Machine(BaseModel): class Port(BaseModel): admission: Optional[AdmissionLevel] = None - """Admission level describes who can access an environment instance and its ports.""" + """policy of this port""" name: Optional[str] = None """name of this port""" @@ -146,69 +132,14 @@ class SSHPublicKey(BaseModel): class Timeout(BaseModel): disconnected: Optional[str] = None """ - 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. """ class EnvironmentSpec(BaseModel): admission: Optional[AdmissionLevel] = None - """Admission level describes who can access an environment instance and its ports.""" + """admission controlls who can access the environment and its ports.""" automations_file: Optional[AutomationsFile] = FieldInfo(alias="automationsFile", default=None) """automations_file is the automations file spec of the environment""" diff --git a/src/gitpod/types/environment_spec_param.py b/src/gitpod/types/environment_spec_param.py index 4853ee8..d30a793 100644 --- a/src/gitpod/types/environment_spec_param.py +++ b/src/gitpod/types/environment_spec_param.py @@ -47,7 +47,7 @@ class Content(TypedDict, total=False): """The Git username""" initializer: EnvironmentInitializerParam - """EnvironmentInitializer specifies how an environment is to be initialized""" + """initializer configures how the environment is to be initialized""" session: str @@ -56,20 +56,6 @@ class DevcontainerDotfiles(TypedDict, total=False): repository: Required[str] """URL of a dotfiles Git repository (e.g. https://github.com/owner/repository)""" - install_command: Annotated[str, PropertyInfo(alias="installCommand")] - """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. - """ - - target_path: Annotated[str, PropertyInfo(alias="targetPath")] - """target_path is the path to clone the dotfiles repository to. - - Defaults to `~/dotfiles`. - """ - class Devcontainer(TypedDict, total=False): devcontainer_file_path: Annotated[str, PropertyInfo(alias="devcontainerFilePath")] @@ -103,7 +89,7 @@ class Machine(_MachineReservedKeywords, total=False): class Port(TypedDict, total=False): admission: AdmissionLevel - """Admission level describes who can access an environment instance and its ports.""" + """policy of this port""" name: str """name of this port""" @@ -153,69 +139,14 @@ class SSHPublicKey(TypedDict, total=False): class Timeout(TypedDict, total=False): disconnected: str """ - 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. """ class EnvironmentSpecParam(TypedDict, total=False): admission: AdmissionLevel - """Admission level describes who can access an environment instance and its ports.""" + """admission controlls who can access the environment and its ports.""" automations_file: Annotated[AutomationsFile, PropertyInfo(alias="automationsFile")] """automations_file is the automations file spec of the environment""" diff --git a/src/gitpod/types/environment_status.py b/src/gitpod/types/environment_status.py index 6fd1a83..3539b28 100644 --- a/src/gitpod/types/environment_status.py +++ b/src/gitpod/types/environment_status.py @@ -342,7 +342,7 @@ class SSHPublicKey(BaseModel): class EnvironmentStatus(BaseModel): activity_signal: Optional[EnvironmentActivitySignal] = FieldInfo(alias="activitySignal", default=None) - """EnvironmentActivitySignal used to signal activity for an environment.""" + """activity_signal is the last activity signal for the environment.""" automations_file: Optional[AutomationsFile] = FieldInfo(alias="automationsFile", default=None) """automations_file contains the status of the automations file.""" @@ -377,7 +377,7 @@ class EnvironmentStatus(BaseModel): runner_ack: Optional[RunnerAck] = FieldInfo(alias="runnerAck", default=None) """ - 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. """ diff --git a/src/gitpod/types/environment_update_params.py b/src/gitpod/types/environment_update_params.py index 9768d6b..dba8d01 100644 --- a/src/gitpod/types/environment_update_params.py +++ b/src/gitpod/types/environment_update_params.py @@ -56,7 +56,7 @@ class SpecContent(TypedDict, total=False): """The Git username""" initializer: Optional[EnvironmentInitializerParam] - """EnvironmentInitializer specifies how an environment is to be initialized""" + """initializer configures how the environment is to be initialized""" session: Optional[str] """session should be changed to trigger a content reinitialization""" @@ -79,7 +79,7 @@ class SpecDevcontainer(TypedDict, total=False): class SpecPort(TypedDict, total=False): admission: AdmissionLevel - """Admission level describes who can access an environment instance and its ports.""" + """policy of this port""" name: str """name of this port""" @@ -102,63 +102,8 @@ class SpecSSHPublicKey(TypedDict, total=False): class SpecTimeout(TypedDict, total=False): disconnected: Optional[str] """ - 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. """ diff --git a/src/gitpod/types/environments/automations/service_metadata.py b/src/gitpod/types/environments/automations/service_metadata.py index b21e2c6..4555022 100644 --- a/src/gitpod/types/environments/automations/service_metadata.py +++ b/src/gitpod/types/environments/automations/service_metadata.py @@ -14,96 +14,7 @@ class ServiceMetadata(BaseModel): created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) - """ - 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()`](<http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()>) - to obtain a formatter capable of generating timestamps in this format. - """ + """created_at is the time the service was created.""" creator: Optional[Subject] = None """creator describes the principal who created the service.""" diff --git a/src/gitpod/types/environments/automations/service_metadata_param.py b/src/gitpod/types/environments/automations/service_metadata_param.py index 8599c69..669b250 100644 --- a/src/gitpod/types/environments/automations/service_metadata_param.py +++ b/src/gitpod/types/environments/automations/service_metadata_param.py @@ -15,96 +15,7 @@ class ServiceMetadataParam(TypedDict, total=False): created_at: Annotated[Union[str, datetime], PropertyInfo(alias="createdAt", format="iso8601")] - """ - 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()`](<http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()>) - to obtain a formatter capable of generating timestamps in this format. - """ + """created_at is the time the service was created.""" creator: Subject """creator describes the principal who created the service.""" diff --git a/src/gitpod/types/organizations/domain_verification.py b/src/gitpod/types/organizations/domain_verification.py index abb3605..3d2e32a 100644 --- a/src/gitpod/types/organizations/domain_verification.py +++ b/src/gitpod/types/organizations/domain_verification.py @@ -20,6 +20,100 @@ class DomainVerification(BaseModel): state: DomainVerificationState + created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) + """ + 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()`](<http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()>) + to obtain a formatter capable of generating timestamps in this format. + """ + + verification_token: Optional[str] = FieldInfo(alias="verificationToken", default=None) + verified_at: Optional[datetime] = FieldInfo(alias="verifiedAt", default=None) """ A Timestamp represents a point in time independent of any time zone or local diff --git a/src/gitpod/types/project.py b/src/gitpod/types/project.py index 9fc31a9..72037bc 100644 --- a/src/gitpod/types/project.py +++ b/src/gitpod/types/project.py @@ -43,7 +43,7 @@ class Project(BaseModel): """ initializer: Optional[EnvironmentInitializer] = None - """EnvironmentInitializer specifies how an environment is to be initialized""" + """initializer is the content initializer""" metadata: Optional[ProjectMetadata] = None diff --git a/src/gitpod/types/project_create_params.py b/src/gitpod/types/project_create_params.py index cb04ea5..db0326d 100644 --- a/src/gitpod/types/project_create_params.py +++ b/src/gitpod/types/project_create_params.py @@ -15,7 +15,7 @@ class ProjectCreateParams(TypedDict, total=False): environment_class: Required[Annotated[ProjectEnvironmentClassParam, PropertyInfo(alias="environmentClass")]] initializer: Required[EnvironmentInitializerParam] - """EnvironmentInitializer specifies how an environment is to be initialized""" + """initializer is the content initializer""" automations_file_path: Annotated[str, PropertyInfo(alias="automationsFilePath")] """ diff --git a/src/gitpod/types/project_update_params.py b/src/gitpod/types/project_update_params.py index c22d35e..04dbed9 100644 --- a/src/gitpod/types/project_update_params.py +++ b/src/gitpod/types/project_update_params.py @@ -36,7 +36,7 @@ class ProjectUpdateParams(TypedDict, total=False): environment_class: Annotated[Optional[ProjectEnvironmentClassParam], PropertyInfo(alias="environmentClass")] initializer: Optional[EnvironmentInitializerParam] - """EnvironmentInitializer specifies how an environment is to be initialized""" + """initializer is the content initializer""" name: Optional[str] diff --git a/src/gitpod/types/runner.py b/src/gitpod/types/runner.py index 505ab36..ec169a3 100644 --- a/src/gitpod/types/runner.py +++ b/src/gitpod/types/runner.py @@ -17,112 +17,19 @@ class Runner(BaseModel): created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) - """ - 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()`](<http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()>) - to obtain a formatter capable of generating timestamps in this format. - """ + """Time when the Runner was created.""" creator: Optional[Subject] = None """creator is the identity of the creator of the environment""" kind: Optional[RunnerKind] = None - """RunnerKind represents the kind of a runner""" + """The runner's kind""" name: Optional[str] = None """The runner's name which is shown to users""" provider: Optional[RunnerProvider] = None - """ - 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""" runner_id: Optional[str] = FieldInfo(alias="runnerId", default=None) @@ -130,96 +37,7 @@ class Runner(BaseModel): """The runner's specification""" status: Optional[RunnerStatus] = None - """RunnerStatus represents the status of a runner""" + """The runner's status""" updated_at: Optional[datetime] = FieldInfo(alias="updatedAt", default=None) - """ - 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()`](<http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()>) - to obtain a formatter capable of generating timestamps in this format. - """ + """Time when the Runner was last udpated.""" diff --git a/src/gitpod/types/runner_create_params.py b/src/gitpod/types/runner_create_params.py index fc5580f..6509b95 100644 --- a/src/gitpod/types/runner_create_params.py +++ b/src/gitpod/types/runner_create_params.py @@ -13,16 +13,20 @@ class RunnerCreateParams(TypedDict, total=False): kind: RunnerKind - """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. + """ name: str """The runner name for humans""" provider: RunnerProvider """ - 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) """ spec: RunnerSpecParam diff --git a/src/gitpod/types/runner_status.py b/src/gitpod/types/runner_status.py index e516dcb..53a0dd5 100644 --- a/src/gitpod/types/runner_status.py +++ b/src/gitpod/types/runner_status.py @@ -32,7 +32,7 @@ class RunnerStatus(BaseModel): """ phase: Optional[RunnerPhase] = None - """RunnerPhase represents the phase a runner is in""" + """The runner's reported phase""" region: Optional[str] = None """region is the region the runner is running in, if applicable.""" @@ -40,95 +40,6 @@ class RunnerStatus(BaseModel): system_details: Optional[str] = FieldInfo(alias="systemDetails", default=None) updated_at: Optional[datetime] = FieldInfo(alias="updatedAt", default=None) - """ - 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()`](<http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()>) - to obtain a formatter capable of generating timestamps in this format. - """ + """Time when the status was last udpated.""" version: Optional[str] = None diff --git a/src/gitpod/types/runner_update_params.py b/src/gitpod/types/runner_update_params.py index 975f069..677a245 100644 --- a/src/gitpod/types/runner_update_params.py +++ b/src/gitpod/types/runner_update_params.py @@ -37,4 +37,14 @@ class Spec(TypedDict, total=False): configuration: Optional[SpecConfiguration] desired_phase: Annotated[Optional[RunnerPhase], PropertyInfo(alias="desiredPhase")] - """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. + """ diff --git a/src/gitpod/types/secret_create_params.py b/src/gitpod/types/secret_create_params.py index e59b270..aa01b60 100644 --- a/src/gitpod/types/secret_create_params.py +++ b/src/gitpod/types/secret_create_params.py @@ -13,7 +13,12 @@ class SecretCreateParams(TypedDict, total=False): container_registry_basic_auth_host: Annotated[str, PropertyInfo(alias="containerRegistryBasicAuthHost")] """ secret will be mounted as a docker config in the environment VM, mount will have - the docker registry host + 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]+)?$') + ``` """ environment_variable: Annotated[bool, PropertyInfo(alias="environmentVariable")] diff --git a/src/gitpod/types/shared/task_execution_metadata.py b/src/gitpod/types/shared/task_execution_metadata.py index b0e28c9..8e72321 100644 --- a/src/gitpod/types/shared/task_execution_metadata.py +++ b/src/gitpod/types/shared/task_execution_metadata.py @@ -13,188 +13,10 @@ class TaskExecutionMetadata(BaseModel): completed_at: Optional[datetime] = FieldInfo(alias="completedAt", default=None) - """ - 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()`](<http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()>) - to obtain a formatter capable of generating timestamps in this format. - """ + """completed_at is the time the task execution was done.""" created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) - """ - 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()`](<http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()>) - to obtain a formatter capable of generating timestamps in this format. - """ + """created_at is the time the task was created.""" creator: Optional[Subject] = None """creator describes the principal who created/started the task run.""" @@ -203,96 +25,7 @@ class TaskExecutionMetadata(BaseModel): """environment_id is the ID of the environment in which the task run is executed.""" started_at: Optional[datetime] = FieldInfo(alias="startedAt", default=None) - """ - 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()`](<http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()>) - to obtain a formatter capable of generating timestamps in this format. - """ + """started_at is the time the task execution actually started to run.""" started_by: Optional[str] = FieldInfo(alias="startedBy", default=None) """started_by describes the trigger that started the task execution.""" diff --git a/src/gitpod/types/shared/task_metadata.py b/src/gitpod/types/shared/task_metadata.py index 23e6c2c..6a34633 100644 --- a/src/gitpod/types/shared/task_metadata.py +++ b/src/gitpod/types/shared/task_metadata.py @@ -14,96 +14,7 @@ class TaskMetadata(BaseModel): created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) - """ - 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()`](<http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()>) - to obtain a formatter capable of generating timestamps in this format. - """ + """created_at is the time the task was created.""" creator: Optional[Subject] = None """creator describes the principal who created the task.""" diff --git a/src/gitpod/types/shared_params/task_metadata.py b/src/gitpod/types/shared_params/task_metadata.py index 50ffda7..2523ba6 100644 --- a/src/gitpod/types/shared_params/task_metadata.py +++ b/src/gitpod/types/shared_params/task_metadata.py @@ -15,96 +15,7 @@ class TaskMetadata(TypedDict, total=False): created_at: Annotated[Union[str, datetime], PropertyInfo(alias="createdAt", format="iso8601")] - """ - 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()`](<http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()>) - to obtain a formatter capable of generating timestamps in this format. - """ + """created_at is the time the task was created.""" creator: Subject """creator describes the principal who created the task.""" diff --git a/src/gitpod/types/user.py b/src/gitpod/types/user.py index f6c16cb..a8ce63f 100644 --- a/src/gitpod/types/user.py +++ b/src/gitpod/types/user.py @@ -19,96 +19,7 @@ class User(BaseModel): """avatar_url is a link to the user avatar""" created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) - """ - 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()`](<http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()>) - to obtain a formatter capable of generating timestamps in this format. - """ + """created_at is the creation time""" name: Optional[str] = None """name is the full name of the user""" diff --git a/tests/api_resources/test_environments.py b/tests/api_resources/test_environments.py index 9733680..3784290 100644 --- a/tests/api_resources/test_environments.py +++ b/tests/api_resources/test_environments.py @@ -63,11 +63,7 @@ def test_method_create_with_all_params(self, client: Gitpod) -> None: "desired_phase": "ENVIRONMENT_PHASE_UNSPECIFIED", "devcontainer": { "devcontainer_file_path": "devcontainerFilePath", - "dotfiles": { - "repository": "https://example.com", - "install_command": "installCommand", - "target_path": "targetPath", - }, + "dotfiles": {"repository": "https://example.com"}, "session": "session", }, "machine": { @@ -365,11 +361,7 @@ def test_method_create_from_project_with_all_params(self, client: Gitpod) -> Non "desired_phase": "ENVIRONMENT_PHASE_UNSPECIFIED", "devcontainer": { "devcontainer_file_path": "devcontainerFilePath", - "dotfiles": { - "repository": "https://example.com", - "install_command": "installCommand", - "target_path": "targetPath", - }, + "dotfiles": {"repository": "https://example.com"}, "session": "session", }, "machine": { @@ -619,11 +611,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> "desired_phase": "ENVIRONMENT_PHASE_UNSPECIFIED", "devcontainer": { "devcontainer_file_path": "devcontainerFilePath", - "dotfiles": { - "repository": "https://example.com", - "install_command": "installCommand", - "target_path": "targetPath", - }, + "dotfiles": {"repository": "https://example.com"}, "session": "session", }, "machine": { @@ -921,11 +909,7 @@ async def test_method_create_from_project_with_all_params(self, async_client: As "desired_phase": "ENVIRONMENT_PHASE_UNSPECIFIED", "devcontainer": { "devcontainer_file_path": "devcontainerFilePath", - "dotfiles": { - "repository": "https://example.com", - "install_command": "installCommand", - "target_path": "targetPath", - }, + "dotfiles": {"repository": "https://example.com"}, "session": "session", }, "machine": { diff --git a/tests/api_resources/test_secrets.py b/tests/api_resources/test_secrets.py index 414aab0..84caf8b 100644 --- a/tests/api_resources/test_secrets.py +++ b/tests/api_resources/test_secrets.py @@ -32,7 +32,7 @@ def test_method_create(self, client: Gitpod) -> None: @parametrize def test_method_create_with_all_params(self, client: Gitpod) -> None: secret = client.secrets.create( - container_registry_basic_auth_host="https://example.com", + container_registry_basic_auth_host="containerRegistryBasicAuthHost", environment_variable=True, file_path="filePath", name="DATABASE_URL", @@ -228,7 +228,7 @@ async def test_method_create(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> None: secret = await async_client.secrets.create( - container_registry_basic_auth_host="https://example.com", + container_registry_basic_auth_host="containerRegistryBasicAuthHost", environment_variable=True, file_path="filePath", name="DATABASE_URL", From ce1db49b85a64443a5a2143a5b00224d0e3192d1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 26 Feb 2025 03:30:53 +0000 Subject: [PATCH 05/27] chore(internal): properly set __pydantic_private__ (#66) --- src/gitpod/_base_client.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gitpod/_base_client.py b/src/gitpod/_base_client.py index 1772072..dabdb6e 100644 --- a/src/gitpod/_base_client.py +++ b/src/gitpod/_base_client.py @@ -63,7 +63,7 @@ ModelBuilderProtocol, ) from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping -from ._compat import model_copy, model_dump +from ._compat import PYDANTIC_V2, model_copy, model_dump from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type from ._response import ( APIResponse, @@ -207,6 +207,9 @@ def _set_private_attributes( model: Type[_T], options: FinalRequestOptions, ) -> None: + if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + self.__pydantic_private__ = {} + self._model = model self._client = client self._options = options @@ -292,6 +295,9 @@ def _set_private_attributes( client: AsyncAPIClient, options: FinalRequestOptions, ) -> None: + if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + self.__pydantic_private__ = {} + self._model = model self._client = client self._options = options From cfce51963c3e840969f7395d1fd448d3fe33871e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 28 Feb 2025 03:07:55 +0000 Subject: [PATCH 06/27] docs: update URLs from stainlessapi.com to stainless.com (#67) More details at https://www.stainless.com/changelog/stainless-com --- README.md | 2 +- SECURITY.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 468f536..3abc067 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ The Gitpod Python library provides convenient access to the Gitpod REST API from application. The library includes type definitions for all request params and response fields, and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx). -It is generated with [Stainless](https://www.stainlessapi.com/). +It is generated with [Stainless](https://www.stainless.com/). ## Documentation diff --git a/SECURITY.md b/SECURITY.md index 0985c82..2b0ed90 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,9 +2,9 @@ ## Reporting Security Issues -This SDK is generated by [Stainless Software Inc](http://stainlessapi.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. +This SDK is generated by [Stainless Software Inc](http://stainless.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. -To report a security issue, please contact the Stainless team at security@stainlessapi.com. +To report a security issue, please contact the Stainless team at security@stainless.com. ## Responsible Disclosure From 65a92c5c0cb39bf290d24567450a30eda21a7e5b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 28 Feb 2025 03:08:49 +0000 Subject: [PATCH 07/27] chore(docs): update client docstring (#68) --- src/gitpod/_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gitpod/_client.py b/src/gitpod/_client.py index 3fad133..4b844ac 100644 --- a/src/gitpod/_client.py +++ b/src/gitpod/_client.py @@ -82,7 +82,7 @@ def __init__( # part of our public interface in the future. _strict_response_validation: bool = False, ) -> None: - """Construct a new synchronous gitpod client instance. + """Construct a new synchronous Gitpod client instance. This automatically infers the `bearer_token` argument from the `GITPOD_API_KEY` environment variable if it is not provided. """ @@ -270,7 +270,7 @@ def __init__( # part of our public interface in the future. _strict_response_validation: bool = False, ) -> None: - """Construct a new async gitpod client instance. + """Construct a new async AsyncGitpod client instance. This automatically infers the `bearer_token` argument from the `GITPOD_API_KEY` environment variable if it is not provided. """ From 69a6bde0c2630357e6bcbb26d3848a1679e62bfe Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Mar 2025 04:02:47 +0000 Subject: [PATCH 08/27] chore(internal): remove unused http client options forwarding (#69) --- src/gitpod/_base_client.py | 97 +------------------------------------- 1 file changed, 1 insertion(+), 96 deletions(-) diff --git a/src/gitpod/_base_client.py b/src/gitpod/_base_client.py index dabdb6e..0a82a2c 100644 --- a/src/gitpod/_base_client.py +++ b/src/gitpod/_base_client.py @@ -9,7 +9,6 @@ import inspect import logging import platform -import warnings import email.utils from types import TracebackType from random import random @@ -36,7 +35,7 @@ import httpx import distro import pydantic -from httpx import URL, Limits +from httpx import URL from pydantic import PrivateAttr from . import _exceptions @@ -51,13 +50,10 @@ Timeout, NotGiven, ResponseT, - Transport, AnyMapping, PostParser, - ProxiesTypes, RequestFiles, HttpxSendArgs, - AsyncTransport, RequestOptions, HttpxRequestFiles, ModelBuilderProtocol, @@ -337,9 +333,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]): _base_url: URL max_retries: int timeout: Union[float, Timeout, None] - _limits: httpx.Limits - _proxies: ProxiesTypes | None - _transport: Transport | AsyncTransport | None _strict_response_validation: bool _idempotency_header: str | None _default_stream_cls: type[_DefaultStreamT] | None = None @@ -352,9 +345,6 @@ def __init__( _strict_response_validation: bool, max_retries: int = DEFAULT_MAX_RETRIES, timeout: float | Timeout | None = DEFAULT_TIMEOUT, - limits: httpx.Limits, - transport: Transport | AsyncTransport | None, - proxies: ProxiesTypes | None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, ) -> None: @@ -362,9 +352,6 @@ def __init__( self._base_url = self._enforce_trailing_slash(URL(base_url)) self.max_retries = max_retries self.timeout = timeout - self._limits = limits - self._proxies = proxies - self._transport = transport self._custom_headers = custom_headers or {} self._custom_query = custom_query or {} self._strict_response_validation = _strict_response_validation @@ -800,46 +787,11 @@ def __init__( base_url: str | URL, max_retries: int = DEFAULT_MAX_RETRIES, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, - transport: Transport | None = None, - proxies: ProxiesTypes | None = None, - limits: Limits | None = None, http_client: httpx.Client | None = None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, _strict_response_validation: bool, ) -> None: - kwargs: dict[str, Any] = {} - if limits is not None: - warnings.warn( - "The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`") - else: - limits = DEFAULT_CONNECTION_LIMITS - - if transport is not None: - kwargs["transport"] = transport - warnings.warn( - "The `transport` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `transport`") - - if proxies is not None: - kwargs["proxies"] = proxies - warnings.warn( - "The `proxies` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `proxies`") - if not is_given(timeout): # if the user passed in a custom http client with a non-default # timeout set then we use that timeout. @@ -860,12 +812,9 @@ def __init__( super().__init__( version=version, - limits=limits, # cast to a valid type because mypy doesn't understand our type narrowing timeout=cast(Timeout, timeout), - proxies=proxies, base_url=base_url, - transport=transport, max_retries=max_retries, custom_query=custom_query, custom_headers=custom_headers, @@ -875,9 +824,6 @@ def __init__( base_url=base_url, # cast to a valid type because mypy doesn't understand our type narrowing timeout=cast(Timeout, timeout), - limits=limits, - follow_redirects=True, - **kwargs, # type: ignore ) def is_closed(self) -> bool: @@ -1372,45 +1318,10 @@ def __init__( _strict_response_validation: bool, max_retries: int = DEFAULT_MAX_RETRIES, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, - transport: AsyncTransport | None = None, - proxies: ProxiesTypes | None = None, - limits: Limits | None = None, http_client: httpx.AsyncClient | None = None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, ) -> None: - kwargs: dict[str, Any] = {} - if limits is not None: - warnings.warn( - "The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`") - else: - limits = DEFAULT_CONNECTION_LIMITS - - if transport is not None: - kwargs["transport"] = transport - warnings.warn( - "The `transport` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `transport`") - - if proxies is not None: - kwargs["proxies"] = proxies - warnings.warn( - "The `proxies` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `proxies`") - if not is_given(timeout): # if the user passed in a custom http client with a non-default # timeout set then we use that timeout. @@ -1432,11 +1343,8 @@ def __init__( super().__init__( version=version, base_url=base_url, - limits=limits, # cast to a valid type because mypy doesn't understand our type narrowing timeout=cast(Timeout, timeout), - proxies=proxies, - transport=transport, max_retries=max_retries, custom_query=custom_query, custom_headers=custom_headers, @@ -1446,9 +1354,6 @@ def __init__( base_url=base_url, # cast to a valid type because mypy doesn't understand our type narrowing timeout=cast(Timeout, timeout), - limits=limits, - follow_redirects=True, - **kwargs, # type: ignore ) def is_closed(self) -> bool: From 317e72c74e544cb15945bd610a2ddadebd76be1a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 06:44:35 +0000 Subject: [PATCH 09/27] chore(internal): codegen related update (#70) --- README.md | 15 +++++++++++++++ scripts/test | 2 ++ 2 files changed, 17 insertions(+) diff --git a/README.md b/README.md index 3abc067..cc5daa2 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,21 @@ for environment in first_page.environments: # Remove `await` for non-async usage. ``` +## Nested params + +Nested parameters are dictionaries, typed using `TypedDict`, for example: + +```python +from gitpod import Gitpod + +client = Gitpod() + +page = client.accounts.list_login_providers( + filter={"invite_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}, +) +print(page.login_providers) +``` + ## Handling errors When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `gitpod.APIConnectionError` is raised. diff --git a/scripts/test b/scripts/test index 4fa5698..2b87845 100755 --- a/scripts/test +++ b/scripts/test @@ -52,6 +52,8 @@ else echo fi +export DEFER_PYDANTIC_BUILD=false + echo "==> Running tests" rye run pytest "$@" From 5166c0c48aaa8e59c90d1c23c1dd1bd3d93ba6d9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 14 Mar 2025 04:40:12 +0000 Subject: [PATCH 10/27] chore(internal): remove extra empty newlines (#71) --- pyproject.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 217748a..9b21231 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,6 @@ Homepage = "https://github.com/gitpod-io/gitpod-sdk-python" Repository = "https://github.com/gitpod-io/gitpod-sdk-python" - [tool.rye] managed = true # version pins are in requirements-dev.lock @@ -155,7 +154,6 @@ reportImplicitOverride = true reportImportCycles = false reportPrivateUsage = false - [tool.ruff] line-length = 120 output-format = "grouped" From a8f27ccf962b45cc626331ee5ead0a0560235ee6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 15 Mar 2025 03:58:53 +0000 Subject: [PATCH 11/27] chore(internal): codegen related update (#72) --- requirements-dev.lock | 1 + requirements.lock | 1 + 2 files changed, 2 insertions(+) diff --git a/requirements-dev.lock b/requirements-dev.lock index b22f43c..6e93bdc 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -7,6 +7,7 @@ # all-features: true # with-sources: false # generate-hashes: false +# universal: false -e file:. annotated-types==0.6.0 diff --git a/requirements.lock b/requirements.lock index 65e7618..b542a71 100644 --- a/requirements.lock +++ b/requirements.lock @@ -7,6 +7,7 @@ # all-features: true # with-sources: false # generate-hashes: false +# universal: false -e file:. annotated-types==0.6.0 From 64be85212587bec1388214453bd4d7f0ddff57a4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 15 Mar 2025 04:04:47 +0000 Subject: [PATCH 12/27] chore(internal): bump rye to 0.44.0 (#73) --- .devcontainer/Dockerfile | 2 +- .github/workflows/ci.yml | 4 ++-- .github/workflows/publish-pypi.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 14aa9d4..f54c600 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -2,7 +2,7 @@ FROM mcr.microsoft.com/devcontainers/python:3.12 USER vscode -RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.35.0" RYE_INSTALL_OPTION="--yes" bash +RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.44.0" RYE_INSTALL_OPTION="--yes" bash ENV PATH=/home/vscode/.rye/shims:$PATH RUN echo "[[ -d .venv ]] && source .venv/bin/activate || export PATH=\$PATH" >> /home/vscode/.bashrc diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8a8a4f..3b286e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: curl -sSf https://rye.astral.sh/get | bash echo "$HOME/.rye/shims" >> $GITHUB_PATH env: - RYE_VERSION: '0.35.0' + RYE_VERSION: '0.44.0' RYE_INSTALL_OPTION: '--yes' - name: Install dependencies @@ -42,7 +42,7 @@ jobs: curl -sSf https://rye.astral.sh/get | bash echo "$HOME/.rye/shims" >> $GITHUB_PATH env: - RYE_VERSION: '0.35.0' + RYE_VERSION: '0.44.0' RYE_INSTALL_OPTION: '--yes' - name: Bootstrap diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index df62ae1..6cd33a6 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -21,7 +21,7 @@ jobs: curl -sSf https://rye.astral.sh/get | bash echo "$HOME/.rye/shims" >> $GITHUB_PATH env: - RYE_VERSION: '0.35.0' + RYE_VERSION: '0.44.0' RYE_INSTALL_OPTION: '--yes' - name: Publish to PyPI From e2efe2bf0a2547b937f8d459172c9b3fd172fd32 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 15 Mar 2025 04:11:42 +0000 Subject: [PATCH 13/27] fix(types): handle more discriminated union shapes (#74) --- src/gitpod/_models.py | 7 +++++-- tests/test_models.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/gitpod/_models.py b/src/gitpod/_models.py index c4401ff..b51a1bf 100644 --- a/src/gitpod/_models.py +++ b/src/gitpod/_models.py @@ -65,7 +65,7 @@ from ._constants import RAW_RESPONSE_HEADER if TYPE_CHECKING: - from pydantic_core.core_schema import ModelField, LiteralSchema, ModelFieldsSchema + from pydantic_core.core_schema import ModelField, ModelSchema, LiteralSchema, ModelFieldsSchema __all__ = ["BaseModel", "GenericModel"] @@ -646,15 +646,18 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, def _extract_field_schema_pv2(model: type[BaseModel], field_name: str) -> ModelField | None: schema = model.__pydantic_core_schema__ + if schema["type"] == "definitions": + schema = schema["schema"] + if schema["type"] != "model": return None + schema = cast("ModelSchema", schema) fields_schema = schema["schema"] if fields_schema["type"] != "model-fields": return None fields_schema = cast("ModelFieldsSchema", fields_schema) - field = fields_schema["fields"].get(field_name) if not field: return None diff --git a/tests/test_models.py b/tests/test_models.py index c581777..8c0e169 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -854,3 +854,35 @@ class Model(BaseModel): m = construct_type(value={"cls": "foo"}, type_=Model) assert isinstance(m, Model) assert isinstance(m.cls, str) + + +def test_discriminated_union_case() -> None: + class A(BaseModel): + type: Literal["a"] + + data: bool + + class B(BaseModel): + type: Literal["b"] + + data: List[Union[A, object]] + + class ModelA(BaseModel): + type: Literal["modelA"] + + data: int + + class ModelB(BaseModel): + type: Literal["modelB"] + + required: str + + data: Union[A, B] + + # when constructing ModelA | ModelB, value data doesn't match ModelB exactly - missing `required` + m = construct_type( + value={"type": "modelB", "data": {"type": "a", "data": True}}, + type_=cast(Any, Annotated[Union[ModelA, ModelB], PropertyInfo(discriminator="type")]), + ) + + assert isinstance(m, ModelB) From 2a3ae1d9237518fbdc267f64dcca813ed6251192 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 17 Mar 2025 17:55:58 +0000 Subject: [PATCH 14/27] fix(ci): ensure pip is always available (#75) --- bin/publish-pypi | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/publish-pypi b/bin/publish-pypi index 05bfccb..ebebf91 100644 --- a/bin/publish-pypi +++ b/bin/publish-pypi @@ -5,5 +5,6 @@ mkdir -p dist rye build --clean # Patching importlib-metadata version until upstream library version is updated # https://github.com/pypa/twine/issues/977#issuecomment-2189800841 +"$HOME/.rye/self/bin/python3" -m ensurepip "$HOME/.rye/self/bin/python3" -m pip install 'importlib-metadata==7.2.1' rye publish --yes --token=$PYPI_TOKEN From fc6ffe9aa684e00af4a44001a2617452df84f106 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 17 Mar 2025 18:03:55 +0000 Subject: [PATCH 15/27] fix(ci): remove publishing patch (#76) --- bin/publish-pypi | 4 ---- pyproject.toml | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/bin/publish-pypi b/bin/publish-pypi index ebebf91..826054e 100644 --- a/bin/publish-pypi +++ b/bin/publish-pypi @@ -3,8 +3,4 @@ set -eux mkdir -p dist rye build --clean -# Patching importlib-metadata version until upstream library version is updated -# https://github.com/pypa/twine/issues/977#issuecomment-2189800841 -"$HOME/.rye/self/bin/python3" -m ensurepip -"$HOME/.rye/self/bin/python3" -m pip install 'importlib-metadata==7.2.1' rye publish --yes --token=$PYPI_TOKEN diff --git a/pyproject.toml b/pyproject.toml index 9b21231..d141566 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -89,7 +89,7 @@ typecheck = { chain = [ "typecheck:mypy" = "mypy ." [build-system] -requires = ["hatchling", "hatch-fancy-pypi-readme"] +requires = ["hatchling==1.26.3", "hatch-fancy-pypi-readme"] build-backend = "hatchling.build" [tool.hatch.build] From ad69954af16f51fb4f89a932d0bbc50501b40119 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Mar 2025 03:34:08 +0000 Subject: [PATCH 16/27] chore: fix typos (#77) --- src/gitpod/_models.py | 2 +- src/gitpod/_utils/_transform.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gitpod/_models.py b/src/gitpod/_models.py index b51a1bf..3493571 100644 --- a/src/gitpod/_models.py +++ b/src/gitpod/_models.py @@ -681,7 +681,7 @@ def set_pydantic_config(typ: Any, config: pydantic.ConfigDict) -> None: setattr(typ, "__pydantic_config__", config) # noqa: B010 -# our use of subclasssing here causes weirdness for type checkers, +# our use of subclassing here causes weirdness for type checkers, # so we just pretend that we don't subclass if TYPE_CHECKING: GenericModel = BaseModel diff --git a/src/gitpod/_utils/_transform.py b/src/gitpod/_utils/_transform.py index 18afd9d..7ac2e17 100644 --- a/src/gitpod/_utils/_transform.py +++ b/src/gitpod/_utils/_transform.py @@ -126,7 +126,7 @@ def _get_annotated_type(type_: type) -> type | None: def _maybe_transform_key(key: str, type_: type) -> str: """Transform the given `data` based on the annotations provided in `type_`. - Note: this function only looks at `Annotated` types that contain `PropertInfo` metadata. + Note: this function only looks at `Annotated` types that contain `PropertyInfo` metadata. """ annotated_type = _get_annotated_type(type_) if annotated_type is None: From 124074690f59168e4a8554a2bba2266d413d8b75 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Mar 2025 03:35:16 +0000 Subject: [PATCH 17/27] codegen metadata --- .stats.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.stats.yml b/.stats.yml index 2c4d8ac..e8f1d28 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,4 @@ configured_endpoints: 111 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-3655d5ad0ac3e228c1519af70dbf3d0bfa3c47a2d06d4cac92a650da051b49a6.yml +openapi_spec_hash: 5dbb5577e6a7cae7db615b1b06c9d23e +config_hash: 719ad411c0ec7402a7a4c1f95515280c From 140ac8b28ddda23e63830cf6049d13498efd015d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 4 Apr 2025 08:08:21 +0000 Subject: [PATCH 18/27] chore(internal): remove trailing character (#78) --- tests/test_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_client.py b/tests/test_client.py index c3fd3ca..2dfdeca 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1662,7 +1662,7 @@ def test_get_platform(self) -> None: import threading from gitpod._utils import asyncify - from gitpod._base_client import get_platform + from gitpod._base_client import get_platform async def test_main() -> None: result = await asyncify(get_platform)() From 7de371cb2912224280342f8793b181feaed8129a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 4 Apr 2025 08:18:09 +0000 Subject: [PATCH 19/27] chore(internal): variable name and test updates (#79) --- tests/api_resources/test_events.py | 34 ++++++++++++++---------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/tests/api_resources/test_events.py b/tests/api_resources/test_events.py index 977730e..77b33af 100644 --- a/tests/api_resources/test_events.py +++ b/tests/api_resources/test_events.py @@ -69,27 +69,26 @@ def test_streaming_response_list(self, client: Gitpod) -> None: @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize def test_method_watch(self, client: Gitpod) -> None: - event = client.events.watch() - assert_matches_type(JSONLDecoder[EventWatchResponse], event, path=["response"]) + event_stream = client.events.watch() + assert_matches_type(JSONLDecoder[EventWatchResponse], event_stream, path=["response"]) @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize def test_method_watch_with_all_params(self, client: Gitpod) -> None: - event = client.events.watch( + event_stream = client.events.watch( environment_id="environmentId", organization=True, ) - assert_matches_type(JSONLDecoder[EventWatchResponse], event, path=["response"]) + assert_matches_type(JSONLDecoder[EventWatchResponse], event_stream, path=["response"]) @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize def test_raw_response_watch(self, client: Gitpod) -> None: response = client.events.with_raw_response.watch() - assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = response.parse() - assert_matches_type(JSONLDecoder[EventWatchResponse], event, path=["response"]) + stream = response.parse() + stream.close() @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize @@ -98,8 +97,8 @@ def test_streaming_response_watch(self, client: Gitpod) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = response.parse() - assert_matches_type(JSONLDecoder[EventWatchResponse], event, path=["response"]) + stream = response.parse() + stream.close() assert cast(Any, response.is_closed) is True @@ -157,27 +156,26 @@ async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None: @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize async def test_method_watch(self, async_client: AsyncGitpod) -> None: - event = await async_client.events.watch() - assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event, path=["response"]) + event_stream = await async_client.events.watch() + assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event_stream, path=["response"]) @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize async def test_method_watch_with_all_params(self, async_client: AsyncGitpod) -> None: - event = await async_client.events.watch( + event_stream = await async_client.events.watch( environment_id="environmentId", organization=True, ) - assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event, path=["response"]) + assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event_stream, path=["response"]) @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize async def test_raw_response_watch(self, async_client: AsyncGitpod) -> None: response = await async_client.events.with_raw_response.watch() - assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = await response.parse() - assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event, path=["response"]) + stream = await response.parse() + await stream.close() @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize @@ -186,7 +184,7 @@ async def test_streaming_response_watch(self, async_client: AsyncGitpod) -> None assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = await response.parse() - assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event, path=["response"]) + stream = await response.parse() + await stream.close() assert cast(Any, response.is_closed) is True From 62166e9543adfd3ab32fb403c9ab3a26b767f618 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 02:29:32 +0000 Subject: [PATCH 20/27] chore(internal): slight transform perf improvement (#80) --- src/gitpod/_utils/_transform.py | 22 ++++++++++++++++++++++ tests/test_transform.py | 12 ++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/gitpod/_utils/_transform.py b/src/gitpod/_utils/_transform.py index 7ac2e17..3ec6208 100644 --- a/src/gitpod/_utils/_transform.py +++ b/src/gitpod/_utils/_transform.py @@ -142,6 +142,10 @@ def _maybe_transform_key(key: str, type_: type) -> str: return key +def _no_transform_needed(annotation: type) -> bool: + return annotation == float or annotation == int + + def _transform_recursive( data: object, *, @@ -184,6 +188,15 @@ def _transform_recursive( return cast(object, data) inner_type = extract_type_arg(stripped_type, 0) + if _no_transform_needed(inner_type): + # for some types there is no need to transform anything, so we can get a small + # perf boost from skipping that work. + # + # but we still need to convert to a list to ensure the data is json-serializable + if is_list(data): + return data + return list(data) + return [_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data] if is_union_type(stripped_type): @@ -332,6 +345,15 @@ async def _async_transform_recursive( return cast(object, data) inner_type = extract_type_arg(stripped_type, 0) + if _no_transform_needed(inner_type): + # for some types there is no need to transform anything, so we can get a small + # perf boost from skipping that work. + # + # but we still need to convert to a list to ensure the data is json-serializable + if is_list(data): + return data + return list(data) + return [await _async_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data] if is_union_type(stripped_type): diff --git a/tests/test_transform.py b/tests/test_transform.py index 816139f..d4df30c 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -432,3 +432,15 @@ async def test_base64_file_input(use_async: bool) -> None: assert await transform({"foo": io.BytesIO(b"Hello, world!")}, TypedDictBase64Input, use_async) == { "foo": "SGVsbG8sIHdvcmxkIQ==" } # type: ignore[comparison-overlap] + + +@parametrize +@pytest.mark.asyncio +async def test_transform_skipping(use_async: bool) -> None: + # lists of ints are left as-is + data = [1, 2, 3] + assert await transform(data, List[int], use_async) is data + + # iterables of ints are converted to a list + data = iter([1, 2, 3]) + assert await transform(data, Iterable[int], use_async) == [1, 2, 3] From 7b5fc94fa15074885fde8cea674bd5ad0bbfb2a8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 02:30:10 +0000 Subject: [PATCH 21/27] chore(tests): improve enum examples (#81) --- .../automations/tasks/test_executions.py | 4 ++-- .../environments/test_automations.py | 8 ++++---- tests/api_resources/projects/test_policies.py | 8 ++++---- .../test_host_authentication_tokens.py | 4 ++-- tests/api_resources/runners/test_policies.py | 8 ++++---- tests/api_resources/test_events.py | 4 ++-- tests/api_resources/test_organizations.py | 8 ++++---- tests/api_resources/test_runners.py | 20 +++++++++---------- 8 files changed, 32 insertions(+), 32 deletions(-) diff --git a/tests/api_resources/environments/automations/tasks/test_executions.py b/tests/api_resources/environments/automations/tasks/test_executions.py index 722a618..1adffcc 100644 --- a/tests/api_resources/environments/automations/tasks/test_executions.py +++ b/tests/api_resources/environments/automations/tasks/test_executions.py @@ -71,7 +71,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: page_size=0, filter={ "environment_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - "phases": ["TASK_EXECUTION_PHASE_UNSPECIFIED", "TASK_EXECUTION_PHASE_PENDING"], + "phases": ["TASK_EXECUTION_PHASE_RUNNING", "TASK_EXECUTION_PHASE_FAILED"], "task_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], "task_references": ["string"], }, @@ -196,7 +196,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N page_size=0, filter={ "environment_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - "phases": ["TASK_EXECUTION_PHASE_UNSPECIFIED", "TASK_EXECUTION_PHASE_PENDING"], + "phases": ["TASK_EXECUTION_PHASE_RUNNING", "TASK_EXECUTION_PHASE_FAILED"], "task_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], "task_references": ["string"], }, diff --git a/tests/api_resources/environments/test_automations.py b/tests/api_resources/environments/test_automations.py index 52ebff8..5d9cff1 100644 --- a/tests/api_resources/environments/test_automations.py +++ b/tests/api_resources/environments/test_automations.py @@ -43,7 +43,7 @@ def test_method_upsert_with_all_params(self, client: Gitpod) -> None: "image": "x", } }, - "triggered_by": ["manual"], + "triggered_by": ["postDevcontainerStart"], } }, "tasks": { @@ -58,7 +58,7 @@ def test_method_upsert_with_all_params(self, client: Gitpod) -> None: "image": "x", } }, - "triggered_by": ["manual"], + "triggered_by": ["postEnvironmentStart"], } }, }, @@ -118,7 +118,7 @@ async def test_method_upsert_with_all_params(self, async_client: AsyncGitpod) -> "image": "x", } }, - "triggered_by": ["manual"], + "triggered_by": ["postDevcontainerStart"], } }, "tasks": { @@ -133,7 +133,7 @@ async def test_method_upsert_with_all_params(self, async_client: AsyncGitpod) -> "image": "x", } }, - "triggered_by": ["manual"], + "triggered_by": ["postEnvironmentStart"], } }, }, diff --git a/tests/api_resources/projects/test_policies.py b/tests/api_resources/projects/test_policies.py index fdd40b7..ff81a48 100644 --- a/tests/api_resources/projects/test_policies.py +++ b/tests/api_resources/projects/test_policies.py @@ -34,7 +34,7 @@ def test_method_create_with_all_params(self, client: Gitpod) -> None: policy = client.projects.policies.create( group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", - role="PROJECT_ROLE_UNSPECIFIED", + role="PROJECT_ROLE_ADMIN", ) assert_matches_type(PolicyCreateResponse, policy, path=["response"]) @@ -72,7 +72,7 @@ def test_method_update_with_all_params(self, client: Gitpod) -> None: policy = client.projects.policies.update( group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", - role="PROJECT_ROLE_UNSPECIFIED", + role="PROJECT_ROLE_EDITOR", ) assert_matches_type(PolicyUpdateResponse, policy, path=["response"]) @@ -193,7 +193,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> policy = await async_client.projects.policies.create( group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", - role="PROJECT_ROLE_UNSPECIFIED", + role="PROJECT_ROLE_ADMIN", ) assert_matches_type(PolicyCreateResponse, policy, path=["response"]) @@ -231,7 +231,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> policy = await async_client.projects.policies.update( group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", - role="PROJECT_ROLE_UNSPECIFIED", + role="PROJECT_ROLE_EDITOR", ) assert_matches_type(PolicyUpdateResponse, policy, path=["response"]) diff --git a/tests/api_resources/runners/configurations/test_host_authentication_tokens.py b/tests/api_resources/runners/configurations/test_host_authentication_tokens.py index 684e0f4..7667d3c 100644 --- a/tests/api_resources/runners/configurations/test_host_authentication_tokens.py +++ b/tests/api_resources/runners/configurations/test_host_authentication_tokens.py @@ -38,7 +38,7 @@ def test_method_create_with_all_params(self, client: Gitpod) -> None: host="github.com", refresh_token="ghr_xxxxxxxxxxxx", runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", - source="HOST_AUTHENTICATION_TOKEN_SOURCE_UNSPECIFIED", + source="HOST_AUTHENTICATION_TOKEN_SOURCE_OAUTH", user_id="f53d2330-3795-4c5d-a1f3-453121af9c60", ) assert_matches_type(HostAuthenticationTokenCreateResponse, host_authentication_token, path=["response"]) @@ -240,7 +240,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> host="github.com", refresh_token="ghr_xxxxxxxxxxxx", runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", - source="HOST_AUTHENTICATION_TOKEN_SOURCE_UNSPECIFIED", + source="HOST_AUTHENTICATION_TOKEN_SOURCE_OAUTH", user_id="f53d2330-3795-4c5d-a1f3-453121af9c60", ) assert_matches_type(HostAuthenticationTokenCreateResponse, host_authentication_token, path=["response"]) diff --git a/tests/api_resources/runners/test_policies.py b/tests/api_resources/runners/test_policies.py index a5da4a8..b94c9ff 100644 --- a/tests/api_resources/runners/test_policies.py +++ b/tests/api_resources/runners/test_policies.py @@ -33,7 +33,7 @@ def test_method_create(self, client: Gitpod) -> None: def test_method_create_with_all_params(self, client: Gitpod) -> None: policy = client.runners.policies.create( group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", - role="RUNNER_ROLE_UNSPECIFIED", + role="RUNNER_ROLE_ADMIN", runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(PolicyCreateResponse, policy, path=["response"]) @@ -71,7 +71,7 @@ def test_method_update(self, client: Gitpod) -> None: def test_method_update_with_all_params(self, client: Gitpod) -> None: policy = client.runners.policies.update( group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", - role="RUNNER_ROLE_UNSPECIFIED", + role="RUNNER_ROLE_USER", runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(PolicyUpdateResponse, policy, path=["response"]) @@ -192,7 +192,7 @@ async def test_method_create(self, async_client: AsyncGitpod) -> None: async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> None: policy = await async_client.runners.policies.create( group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", - role="RUNNER_ROLE_UNSPECIFIED", + role="RUNNER_ROLE_ADMIN", runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(PolicyCreateResponse, policy, path=["response"]) @@ -230,7 +230,7 @@ async def test_method_update(self, async_client: AsyncGitpod) -> None: async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> None: policy = await async_client.runners.policies.update( group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", - role="RUNNER_ROLE_UNSPECIFIED", + role="RUNNER_ROLE_USER", runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(PolicyUpdateResponse, policy, path=["response"]) diff --git a/tests/api_resources/test_events.py b/tests/api_resources/test_events.py index 77b33af..fa926d8 100644 --- a/tests/api_resources/test_events.py +++ b/tests/api_resources/test_events.py @@ -33,7 +33,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: page_size=0, filter={ "actor_ids": ["d2c94c27-3b76-4a42-b88c-95a85e392c68"], - "actor_principals": ["PRINCIPAL_UNSPECIFIED"], + "actor_principals": ["PRINCIPAL_USER"], "subject_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], "subject_types": ["RESOURCE_TYPE_UNSPECIFIED"], }, @@ -120,7 +120,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N page_size=0, filter={ "actor_ids": ["d2c94c27-3b76-4a42-b88c-95a85e392c68"], - "actor_principals": ["PRINCIPAL_UNSPECIFIED"], + "actor_principals": ["PRINCIPAL_USER"], "subject_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], "subject_types": ["RESOURCE_TYPE_UNSPECIFIED"], }, diff --git a/tests/api_resources/test_organizations.py b/tests/api_resources/test_organizations.py index 62a5503..7d24c5c 100644 --- a/tests/api_resources/test_organizations.py +++ b/tests/api_resources/test_organizations.py @@ -163,7 +163,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: "token": "token", "page_size": 50, }, - scope="SCOPE_UNSPECIFIED", + scope="SCOPE_ALL", ) assert_matches_type(SyncOrganizationsPage[Organization], organization, path=["response"]) @@ -357,7 +357,7 @@ def test_method_set_role_with_all_params(self, client: Gitpod) -> None: organization = client.organizations.set_role( organization_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", user_id="f53d2330-3795-4c5d-a1f3-453121af9c60", - role="ORGANIZATION_ROLE_UNSPECIFIED", + role="ORGANIZATION_ROLE_MEMBER", ) assert_matches_type(object, organization, path=["response"]) @@ -531,7 +531,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N "token": "token", "page_size": 50, }, - scope="SCOPE_UNSPECIFIED", + scope="SCOPE_ALL", ) assert_matches_type(AsyncOrganizationsPage[Organization], organization, path=["response"]) @@ -725,7 +725,7 @@ async def test_method_set_role_with_all_params(self, async_client: AsyncGitpod) organization = await async_client.organizations.set_role( organization_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", user_id="f53d2330-3795-4c5d-a1f3-453121af9c60", - role="ORGANIZATION_ROLE_UNSPECIFIED", + role="ORGANIZATION_ROLE_MEMBER", ) assert_matches_type(object, organization, path=["response"]) diff --git a/tests/api_resources/test_runners.py b/tests/api_resources/test_runners.py index 8968127..45caf1c 100644 --- a/tests/api_resources/test_runners.py +++ b/tests/api_resources/test_runners.py @@ -37,14 +37,14 @@ def test_method_create_with_all_params(self, client: Gitpod) -> None: runner = client.runners.create( kind="RUNNER_KIND_UNSPECIFIED", name="Production Runner", - provider="RUNNER_PROVIDER_UNSPECIFIED", + provider="RUNNER_PROVIDER_AWS_EC2", spec={ "configuration": { "auto_update": True, "region": "us-west", - "release_channel": "RUNNER_RELEASE_CHANNEL_UNSPECIFIED", + "release_channel": "RUNNER_RELEASE_CHANNEL_STABLE", }, - "desired_phase": "RUNNER_PHASE_UNSPECIFIED", + "desired_phase": "RUNNER_PHASE_ACTIVE", }, ) assert_matches_type(RunnerCreateResponse, runner, path=["response"]) @@ -122,7 +122,7 @@ def test_method_update_with_all_params(self, client: Gitpod) -> None: spec={ "configuration": { "auto_update": True, - "release_channel": "RUNNER_RELEASE_CHANNEL_UNSPECIFIED", + "release_channel": "RUNNER_RELEASE_CHANNEL_LATEST", }, "desired_phase": "RUNNER_PHASE_UNSPECIFIED", }, @@ -166,7 +166,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: filter={ "creator_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], "kinds": ["RUNNER_KIND_UNSPECIFIED"], - "providers": ["RUNNER_PROVIDER_UNSPECIFIED"], + "providers": ["RUNNER_PROVIDER_AWS_EC2"], }, pagination={ "token": "token", @@ -360,14 +360,14 @@ async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> runner = await async_client.runners.create( kind="RUNNER_KIND_UNSPECIFIED", name="Production Runner", - provider="RUNNER_PROVIDER_UNSPECIFIED", + provider="RUNNER_PROVIDER_AWS_EC2", spec={ "configuration": { "auto_update": True, "region": "us-west", - "release_channel": "RUNNER_RELEASE_CHANNEL_UNSPECIFIED", + "release_channel": "RUNNER_RELEASE_CHANNEL_STABLE", }, - "desired_phase": "RUNNER_PHASE_UNSPECIFIED", + "desired_phase": "RUNNER_PHASE_ACTIVE", }, ) assert_matches_type(RunnerCreateResponse, runner, path=["response"]) @@ -445,7 +445,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> spec={ "configuration": { "auto_update": True, - "release_channel": "RUNNER_RELEASE_CHANNEL_UNSPECIFIED", + "release_channel": "RUNNER_RELEASE_CHANNEL_LATEST", }, "desired_phase": "RUNNER_PHASE_UNSPECIFIED", }, @@ -489,7 +489,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N filter={ "creator_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], "kinds": ["RUNNER_KIND_UNSPECIFIED"], - "providers": ["RUNNER_PROVIDER_UNSPECIFIED"], + "providers": ["RUNNER_PROVIDER_AWS_EC2"], }, pagination={ "token": "token", From c99fbf1293bfae482b24cfcdfdcff9508bea73f3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 10 Apr 2025 02:49:33 +0000 Subject: [PATCH 22/27] chore(internal): expand CI branch coverage --- .github/workflows/ci.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3b286e5..53a3a09 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,18 +1,18 @@ name: CI on: push: - branches: - - main - pull_request: - branches: - - main - - next + branches-ignore: + - 'generated' + - 'codegen/**' + - 'integrated/**' + - 'preview-head/**' + - 'preview-base/**' + - 'preview/**' jobs: lint: name: lint runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 @@ -33,7 +33,6 @@ jobs: test: name: test runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 From f9fb625d504b60d4374078e2be8320c2a9a3018a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 10 Apr 2025 02:54:04 +0000 Subject: [PATCH 23/27] chore(internal): reduce CI branch coverage --- .github/workflows/ci.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53a3a09..81f6dc2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,13 +1,12 @@ name: CI on: push: - branches-ignore: - - 'generated' - - 'codegen/**' - - 'integrated/**' - - 'preview-head/**' - - 'preview-base/**' - - 'preview/**' + branches: + - main + pull_request: + branches: + - main + - next jobs: lint: From 655645b8376a92c4a15e985fdeb862a0837cdda2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 12 Apr 2025 02:35:32 +0000 Subject: [PATCH 24/27] fix(perf): skip traversing types for NotGiven values --- src/gitpod/_utils/_transform.py | 11 +++++++++++ tests/test_transform.py | 9 ++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/gitpod/_utils/_transform.py b/src/gitpod/_utils/_transform.py index 3ec6208..3b2b8e0 100644 --- a/src/gitpod/_utils/_transform.py +++ b/src/gitpod/_utils/_transform.py @@ -12,6 +12,7 @@ from ._utils import ( is_list, + is_given, is_mapping, is_iterable, ) @@ -258,6 +259,11 @@ def _transform_typeddict( result: dict[str, object] = {} annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): + if not is_given(value): + # we don't need to include `NotGiven` values here as they'll + # be stripped out before the request is sent anyway + continue + type_ = annotations.get(key) if type_ is None: # we do not have a type annotation for this field, leave it as is @@ -415,6 +421,11 @@ async def _async_transform_typeddict( result: dict[str, object] = {} annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): + if not is_given(value): + # we don't need to include `NotGiven` values here as they'll + # be stripped out before the request is sent anyway + continue + type_ = annotations.get(key) if type_ is None: # we do not have a type annotation for this field, leave it as is diff --git a/tests/test_transform.py b/tests/test_transform.py index d4df30c..2a74ad4 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -8,7 +8,7 @@ import pytest -from gitpod._types import Base64FileInput +from gitpod._types import NOT_GIVEN, Base64FileInput from gitpod._utils import ( PropertyInfo, transform as _transform, @@ -444,3 +444,10 @@ async def test_transform_skipping(use_async: bool) -> None: # iterables of ints are converted to a list data = iter([1, 2, 3]) assert await transform(data, Iterable[int], use_async) == [1, 2, 3] + + +@parametrize +@pytest.mark.asyncio +async def test_strips_notgiven(use_async: bool) -> None: + assert await transform({"foo_bar": "bar"}, Foo1, use_async) == {"fooBar": "bar"} + assert await transform({"foo_bar": NOT_GIVEN}, Foo1, use_async) == {} From 4a251160e74c27a9826fd9146ee630981423994f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 12 Apr 2025 02:36:38 +0000 Subject: [PATCH 25/27] fix(perf): optimize some hot paths --- src/gitpod/_utils/_transform.py | 14 +++++++++++++- src/gitpod/_utils/_typing.py | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gitpod/_utils/_transform.py b/src/gitpod/_utils/_transform.py index 3b2b8e0..b0cc20a 100644 --- a/src/gitpod/_utils/_transform.py +++ b/src/gitpod/_utils/_transform.py @@ -5,7 +5,7 @@ import pathlib from typing import Any, Mapping, TypeVar, cast from datetime import date, datetime -from typing_extensions import Literal, get_args, override, get_type_hints +from typing_extensions import Literal, get_args, override, get_type_hints as _get_type_hints import anyio import pydantic @@ -13,6 +13,7 @@ from ._utils import ( is_list, is_given, + lru_cache, is_mapping, is_iterable, ) @@ -109,6 +110,7 @@ class Params(TypedDict, total=False): return cast(_T, transformed) +@lru_cache(maxsize=8096) def _get_annotated_type(type_: type) -> type | None: """If the given type is an `Annotated` type then it is returned, if not `None` is returned. @@ -433,3 +435,13 @@ async def _async_transform_typeddict( else: result[_maybe_transform_key(key, type_)] = await _async_transform_recursive(value, annotation=type_) return result + + +@lru_cache(maxsize=8096) +def get_type_hints( + obj: Any, + globalns: dict[str, Any] | None = None, + localns: Mapping[str, Any] | None = None, + include_extras: bool = False, +) -> dict[str, Any]: + return _get_type_hints(obj, globalns=globalns, localns=localns, include_extras=include_extras) diff --git a/src/gitpod/_utils/_typing.py b/src/gitpod/_utils/_typing.py index 278749b..1958820 100644 --- a/src/gitpod/_utils/_typing.py +++ b/src/gitpod/_utils/_typing.py @@ -13,6 +13,7 @@ get_origin, ) +from ._utils import lru_cache from .._types import InheritsGeneric from .._compat import is_union as _is_union @@ -66,6 +67,7 @@ def is_type_alias_type(tp: Any, /) -> TypeIs[typing_extensions.TypeAliasType]: # Extracts T from Annotated[T, ...] or from Required[Annotated[T, ...]] +@lru_cache(maxsize=8096) def strip_annotated_type(typ: type) -> type: if is_required_type(typ) or is_annotated_type(typ): return strip_annotated_type(cast(type, get_args(typ)[0])) From d924d395581530e38250a0e1c906ce72939b9837 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 15 Apr 2025 02:49:10 +0000 Subject: [PATCH 26/27] chore(internal): update pyright settings --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index d141566..e7fdb23 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -150,6 +150,7 @@ exclude = [ ] reportImplicitOverride = true +reportOverlappingOverload = false reportImportCycles = false reportPrivateUsage = false From 48341b1e44daa967e37e6a9b85429d8231177c81 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 15 Apr 2025 02:50:35 +0000 Subject: [PATCH 27/27] chore(client): minor internal fixes --- src/gitpod/_base_client.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gitpod/_base_client.py b/src/gitpod/_base_client.py index 0a82a2c..2f0cf3b 100644 --- a/src/gitpod/_base_client.py +++ b/src/gitpod/_base_client.py @@ -409,7 +409,8 @@ def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0 idempotency_header = self._idempotency_header if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers: - headers[idempotency_header] = options.idempotency_key or self._idempotency_key() + options.idempotency_key = options.idempotency_key or self._idempotency_key() + headers[idempotency_header] = options.idempotency_key # Don't set these headers if they were already set or removed by the caller. We check # `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case. @@ -943,6 +944,10 @@ def _request( request = self._build_request(options, retries_taken=retries_taken) self._prepare_request(request) + if options.idempotency_key: + # ensure the idempotency key is reused between requests + input_options.idempotency_key = options.idempotency_key + kwargs: HttpxSendArgs = {} if self.custom_auth is not None: kwargs["auth"] = self.custom_auth @@ -1475,6 +1480,10 @@ async def _request( request = self._build_request(options, retries_taken=retries_taken) await self._prepare_request(request) + if options.idempotency_key: + # ensure the idempotency key is reused between requests + input_options.idempotency_key = options.idempotency_key + kwargs: HttpxSendArgs = {} if self.custom_auth is not None: kwargs["auth"] = self.custom_auth