diff --git a/.stats.yml b/.stats.yml index d135c04..1b7c986 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 106 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-2410f189970eeb715e79976f13eeca7259b602809e27a84820da8c794dcf00cb.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-da4c36c6b1d973f481abb8eefdeb085d88eaf37eeaba30d276cb3daa405b6f0c.yml diff --git a/api.md b/api.md index b630551..40b1aea 100644 --- a/api.md +++ b/api.md @@ -1,13 +1,36 @@ +# Shared Types + +```python +from gitpod.types import ( + AutomationTrigger, + EnvironmentClass, + FieldValue, + OrganizationRole, + Principal, + RunsOn, + Subject, + TaskExecution, + TaskExecutionMetadata, + TaskExecutionPhase, + TaskExecutionSpec, + TaskExecutionStatus, + UserStatus, +) +``` + # Accounts Types: ```python from gitpod.types import ( + Account, + AccountMembership, + JoinableOrganization, + LoginProvider, AccountRetrieveResponse, AccountDeleteResponse, AccountGetSSOLoginURLResponse, - AccountListLoginProvidersResponse, ) ``` @@ -16,20 +39,20 @@ Methods: - client.accounts.retrieve(\*\*params) -> AccountRetrieveResponse - client.accounts.delete(\*\*params) -> object - client.accounts.get_sso_login_url(\*\*params) -> AccountGetSSOLoginURLResponse -- client.accounts.list_login_providers(\*\*params) -> SyncLoginProvidersPage[AccountListLoginProvidersResponse] +- client.accounts.list_login_providers(\*\*params) -> SyncLoginProvidersPage[LoginProvider] # Editors Types: ```python -from gitpod.types import EditorRetrieveResponse, EditorListResponse, EditorResolveURLResponse +from gitpod.types import Editor, EditorRetrieveResponse, EditorResolveURLResponse ``` Methods: - client.editors.retrieve(\*\*params) -> EditorRetrieveResponse -- client.editors.list(\*\*params) -> SyncEditorsPage[EditorListResponse] +- client.editors.list(\*\*params) -> SyncEditorsPage[Editor] - client.editors.resolve_url(\*\*params) -> EditorResolveURLResponse # Environments @@ -38,10 +61,16 @@ Types: ```python from gitpod.types import ( + AdmissionLevel, + Environment, + EnvironmentActivitySignal, + EnvironmentMetadata, + EnvironmentPhase, + EnvironmentSpec, + EnvironmentStatus, EnvironmentCreateResponse, EnvironmentRetrieveResponse, EnvironmentUpdateResponse, - EnvironmentListResponse, EnvironmentDeleteResponse, EnvironmentCreateFromProjectResponse, EnvironmentCreateLogsTokenResponse, @@ -56,7 +85,7 @@ Methods: - client.environments.create(\*\*params) -> EnvironmentCreateResponse - client.environments.retrieve(\*\*params) -> EnvironmentRetrieveResponse - client.environments.update(\*\*params) -> object -- client.environments.list(\*\*params) -> SyncEnvironmentsPage[EnvironmentListResponse] +- client.environments.list(\*\*params) -> SyncEnvironmentsPage[Environment] - client.environments.delete(\*\*params) -> object - client.environments.create_from_project(\*\*params) -> EnvironmentCreateFromProjectResponse - client.environments.create_logs_token(\*\*params) -> EnvironmentCreateLogsTokenResponse @@ -69,7 +98,7 @@ Methods: Types: ```python -from gitpod.types.environments import AutomationUpsertResponse +from gitpod.types.environments import AutomationsFile, AutomationUpsertResponse ``` Methods: @@ -82,10 +111,14 @@ Types: ```python from gitpod.types.environments.automations import ( + Service, + ServiceMetadata, + ServicePhase, + ServiceSpec, + ServiceStatus, ServiceCreateResponse, ServiceRetrieveResponse, ServiceUpdateResponse, - ServiceListResponse, ServiceDeleteResponse, ServiceStartResponse, ServiceStopResponse, @@ -97,7 +130,7 @@ Methods: - client.environments.automations.services.create(\*\*params) -> ServiceCreateResponse - client.environments.automations.services.retrieve(\*\*params) -> ServiceRetrieveResponse - client.environments.automations.services.update(\*\*params) -> object -- client.environments.automations.services.list(\*\*params) -> SyncServicesPage[ServiceListResponse] +- client.environments.automations.services.list(\*\*params) -> SyncServicesPage[Service] - client.environments.automations.services.delete(\*\*params) -> object - client.environments.automations.services.start(\*\*params) -> object - client.environments.automations.services.stop(\*\*params) -> object @@ -108,10 +141,12 @@ Types: ```python from gitpod.types.environments.automations import ( + Task, + TaskMetadata, + TaskSpec, TaskCreateResponse, TaskRetrieveResponse, TaskUpdateResponse, - TaskListResponse, TaskDeleteResponse, TaskStartResponse, ) @@ -122,7 +157,7 @@ Methods: - client.environments.automations.tasks.create(\*\*params) -> TaskCreateResponse - client.environments.automations.tasks.retrieve(\*\*params) -> TaskRetrieveResponse - client.environments.automations.tasks.update(\*\*params) -> object -- client.environments.automations.tasks.list(\*\*params) -> SyncTasksPage[TaskListResponse] +- client.environments.automations.tasks.list(\*\*params) -> SyncTasksPage[Task] - client.environments.automations.tasks.delete(\*\*params) -> object - client.environments.automations.tasks.start(\*\*params) -> TaskStartResponse @@ -133,7 +168,6 @@ Types: ```python from gitpod.types.environments.automations.tasks import ( ExecutionRetrieveResponse, - ExecutionListResponse, ExecutionStopResponse, ) ``` @@ -141,27 +175,21 @@ from gitpod.types.environments.automations.tasks import ( Methods: - client.environments.automations.tasks.executions.retrieve(\*\*params) -> ExecutionRetrieveResponse -- client.environments.automations.tasks.executions.list(\*\*params) -> SyncTaskExecutionsPage[ExecutionListResponse] +- client.environments.automations.tasks.executions.list(\*\*params) -> SyncTaskExecutionsPage[TaskExecution] - client.environments.automations.tasks.executions.stop(\*\*params) -> object ## Classes -Types: - -```python -from gitpod.types.environments import ClassListResponse -``` - Methods: -- client.environments.classes.list(\*\*params) -> SyncEnvironmentClassesPage[ClassListResponse] +- client.environments.classes.list(\*\*params) -> SyncEnvironmentClassesPage[EnvironmentClass] # Events Types: ```python -from gitpod.types import EventListResponse, EventWatchResponse +from gitpod.types import ResourceOperation, ResourceType, EventListResponse, EventWatchResponse ``` Methods: @@ -174,12 +202,12 @@ Methods: Types: ```python -from gitpod.types import GroupListResponse +from gitpod.types import Group ``` Methods: -- client.groups.list(\*\*params) -> SyncGroupsPage[GroupListResponse] +- client.groups.list(\*\*params) -> SyncGroupsPage[Group] # Identity @@ -205,14 +233,16 @@ Types: ```python from gitpod.types import ( + InviteDomains, + Organization, + OrganizationMember, + Scope, OrganizationCreateResponse, OrganizationRetrieveResponse, OrganizationUpdateResponse, - OrganizationListResponse, OrganizationDeleteResponse, OrganizationJoinResponse, OrganizationLeaveResponse, - OrganizationListMembersResponse, OrganizationSetRoleResponse, ) ``` @@ -222,11 +252,11 @@ Methods: - client.organizations.create(\*\*params) -> OrganizationCreateResponse - client.organizations.retrieve(\*\*params) -> OrganizationRetrieveResponse - client.organizations.update(\*\*params) -> OrganizationUpdateResponse -- client.organizations.list(\*\*params) -> SyncOrganizationsPage[OrganizationListResponse] +- client.organizations.list(\*\*params) -> SyncOrganizationsPage[Organization] - client.organizations.delete(\*\*params) -> object - client.organizations.join(\*\*params) -> OrganizationJoinResponse - client.organizations.leave(\*\*params) -> object -- client.organizations.list_members(\*\*params) -> SyncMembersPage[OrganizationListMembersResponse] +- client.organizations.list_members(\*\*params) -> SyncMembersPage[OrganizationMember] - client.organizations.set_role(\*\*params) -> object ## Invites @@ -235,6 +265,7 @@ Types: ```python from gitpod.types.organizations import ( + OrganizationInvite, InviteCreateResponse, InviteRetrieveResponse, InviteGetSummaryResponse, @@ -253,10 +284,12 @@ Types: ```python from gitpod.types.organizations import ( + ProviderType, + SSOConfiguration, + SSOConfigurationState, SSOConfigurationCreateResponse, SSOConfigurationRetrieveResponse, SSOConfigurationUpdateResponse, - SSOConfigurationListResponse, SSOConfigurationDeleteResponse, ) ``` @@ -266,7 +299,7 @@ Methods: - client.organizations.sso_configurations.create(\*\*params) -> SSOConfigurationCreateResponse - client.organizations.sso_configurations.retrieve(\*\*params) -> SSOConfigurationRetrieveResponse - client.organizations.sso_configurations.update(\*\*params) -> object -- client.organizations.sso_configurations.list(\*\*params) -> SyncSSOConfigurationsPage[SSOConfigurationListResponse] +- client.organizations.sso_configurations.list(\*\*params) -> SyncSSOConfigurationsPage[SSOConfiguration] - client.organizations.sso_configurations.delete(\*\*params) -> object # Projects @@ -275,10 +308,13 @@ Types: ```python from gitpod.types import ( + EnvironmentInitializer, + Project, + ProjectEnvironmentClass, + ProjectMetadata, ProjectCreateResponse, ProjectRetrieveResponse, ProjectUpdateResponse, - ProjectListResponse, ProjectDeleteResponse, ProjectCreateFromEnvironmentResponse, ) @@ -289,7 +325,7 @@ Methods: - client.projects.create(\*\*params) -> ProjectCreateResponse - client.projects.retrieve(\*\*params) -> ProjectRetrieveResponse - client.projects.update(\*\*params) -> ProjectUpdateResponse -- client.projects.list(\*\*params) -> SyncProjectsPage[ProjectListResponse] +- client.projects.list(\*\*params) -> SyncProjectsPage[Project] - client.projects.delete(\*\*params) -> object - client.projects.create_from_environment(\*\*params) -> ProjectCreateFromEnvironmentResponse @@ -299,9 +335,10 @@ Types: ```python from gitpod.types.projects import ( + ProjectPolicy, + ProjectRole, PolicyCreateResponse, PolicyUpdateResponse, - PolicyListResponse, PolicyDeleteResponse, ) ``` @@ -310,7 +347,7 @@ Methods: - client.projects.policies.create(\*\*params) -> PolicyCreateResponse - client.projects.policies.update(\*\*params) -> PolicyUpdateResponse -- client.projects.policies.list(\*\*params) -> SyncPoliciesPage[PolicyListResponse] +- client.projects.policies.list(\*\*params) -> SyncPoliciesPage[ProjectPolicy] - client.projects.policies.delete(\*\*params) -> object # Runners @@ -319,10 +356,18 @@ Types: ```python from gitpod.types import ( + Runner, + RunnerCapability, + RunnerConfiguration, + RunnerKind, + RunnerPhase, + RunnerProvider, + RunnerReleaseChannel, + RunnerSpec, + RunnerStatus, RunnerCreateResponse, RunnerRetrieveResponse, RunnerUpdateResponse, - RunnerListResponse, RunnerDeleteResponse, RunnerCheckAuthenticationForHostResponse, RunnerCreateRunnerTokenResponse, @@ -335,7 +380,7 @@ Methods: - client.runners.create(\*\*params) -> RunnerCreateResponse - client.runners.retrieve(\*\*params) -> RunnerRetrieveResponse - client.runners.update(\*\*params) -> object -- client.runners.list(\*\*params) -> SyncRunnersPage[RunnerListResponse] +- client.runners.list(\*\*params) -> SyncRunnersPage[Runner] - client.runners.delete(\*\*params) -> object - client.runners.check_authentication_for_host(\*\*params) -> RunnerCheckAuthenticationForHostResponse - client.runners.create_runner_token(\*\*params) -> RunnerCreateRunnerTokenResponse @@ -346,7 +391,12 @@ Methods: Types: ```python -from gitpod.types.runners import ConfigurationValidateResponse +from gitpod.types.runners import ( + EnvironmentClassValidationResult, + FieldValidationError, + ScmIntegrationValidationResult, + ConfigurationValidateResponse, +) ``` Methods: @@ -362,7 +412,6 @@ from gitpod.types.runners.configurations import ( EnvironmentClassCreateResponse, EnvironmentClassRetrieveResponse, EnvironmentClassUpdateResponse, - EnvironmentClassListResponse, ) ``` @@ -371,7 +420,7 @@ Methods: - client.runners.configurations.environment_classes.create(\*\*params) -> EnvironmentClassCreateResponse - client.runners.configurations.environment_classes.retrieve(\*\*params) -> EnvironmentClassRetrieveResponse - client.runners.configurations.environment_classes.update(\*\*params) -> object -- client.runners.configurations.environment_classes.list(\*\*params) -> SyncEnvironmentClassesPage[EnvironmentClassListResponse] +- client.runners.configurations.environment_classes.list(\*\*params) -> SyncEnvironmentClassesPage[EnvironmentClass] ### HostAuthenticationTokens @@ -379,10 +428,11 @@ Types: ```python from gitpod.types.runners.configurations import ( + HostAuthenticationToken, + HostAuthenticationTokenSource, HostAuthenticationTokenCreateResponse, HostAuthenticationTokenRetrieveResponse, HostAuthenticationTokenUpdateResponse, - HostAuthenticationTokenListResponse, HostAuthenticationTokenDeleteResponse, ) ``` @@ -392,7 +442,7 @@ Methods: - client.runners.configurations.host_authentication_tokens.create(\*\*params) -> HostAuthenticationTokenCreateResponse - client.runners.configurations.host_authentication_tokens.retrieve(\*\*params) -> HostAuthenticationTokenRetrieveResponse - client.runners.configurations.host_authentication_tokens.update(\*\*params) -> object -- client.runners.configurations.host_authentication_tokens.list(\*\*params) -> SyncTokensPage[HostAuthenticationTokenListResponse] +- client.runners.configurations.host_authentication_tokens.list(\*\*params) -> SyncTokensPage[HostAuthenticationToken] - client.runners.configurations.host_authentication_tokens.delete(\*\*params) -> object ### Schema @@ -400,7 +450,7 @@ Methods: Types: ```python -from gitpod.types.runners.configurations import SchemaRetrieveResponse +from gitpod.types.runners.configurations import RunnerConfigurationSchema, SchemaRetrieveResponse ``` Methods: @@ -413,10 +463,11 @@ Types: ```python from gitpod.types.runners.configurations import ( + ScmIntegration, + ScmIntegrationOAuthConfig, ScmIntegrationCreateResponse, ScmIntegrationRetrieveResponse, ScmIntegrationUpdateResponse, - ScmIntegrationListResponse, ScmIntegrationDeleteResponse, ) ``` @@ -426,7 +477,7 @@ Methods: - client.runners.configurations.scm_integrations.create(\*\*params) -> ScmIntegrationCreateResponse - client.runners.configurations.scm_integrations.retrieve(\*\*params) -> ScmIntegrationRetrieveResponse - client.runners.configurations.scm_integrations.update(\*\*params) -> object -- client.runners.configurations.scm_integrations.list(\*\*params) -> SyncIntegrationsPage[ScmIntegrationListResponse] +- client.runners.configurations.scm_integrations.list(\*\*params) -> SyncIntegrationsPage[ScmIntegration] - client.runners.configurations.scm_integrations.delete(\*\*params) -> object ## Policies @@ -435,9 +486,10 @@ Types: ```python from gitpod.types.runners import ( + RunnerPolicy, + RunnerRole, PolicyCreateResponse, PolicyUpdateResponse, - PolicyListResponse, PolicyDeleteResponse, ) ``` @@ -446,7 +498,7 @@ Methods: - client.runners.policies.create(\*\*params) -> PolicyCreateResponse - client.runners.policies.update(\*\*params) -> PolicyUpdateResponse -- client.runners.policies.list(\*\*params) -> SyncPoliciesPage[PolicyListResponse] +- client.runners.policies.list(\*\*params) -> SyncPoliciesPage[RunnerPolicy] - client.runners.policies.delete(\*\*params) -> object # Secrets @@ -455,8 +507,8 @@ Types: ```python from gitpod.types import ( + Secret, SecretCreateResponse, - SecretListResponse, SecretDeleteResponse, SecretGetValueResponse, SecretUpdateValueResponse, @@ -466,7 +518,7 @@ from gitpod.types import ( Methods: - client.secrets.create(\*\*params) -> SecretCreateResponse -- client.secrets.list(\*\*params) -> SyncSecretsPage[SecretListResponse] +- client.secrets.list(\*\*params) -> SyncSecretsPage[Secret] - client.secrets.delete(\*\*params) -> object - client.secrets.get_value(\*\*params) -> SecretGetValueResponse - client.secrets.update_value(\*\*params) -> object @@ -476,7 +528,7 @@ Methods: Types: ```python -from gitpod.types import UserGetAuthenticatedUserResponse, UserSetSuspendedResponse +from gitpod.types import User, UserGetAuthenticatedUserResponse, UserSetSuspendedResponse ``` Methods: @@ -489,11 +541,11 @@ Methods: Types: ```python -from gitpod.types.users import PatListResponse, PatDeleteResponse, PatGetResponse +from gitpod.types.users import PersonalAccessToken, PatDeleteResponse, PatGetResponse ``` Methods: -- client.users.pats.list(\*\*params) -> SyncPersonalAccessTokensPage[PatListResponse] +- client.users.pats.list(\*\*params) -> SyncPersonalAccessTokensPage[PersonalAccessToken] - client.users.pats.delete(\*\*params) -> object - client.users.pats.get(\*\*params) -> PatGetResponse diff --git a/src/gitpod/resources/accounts.py b/src/gitpod/resources/accounts.py index 71a9da1..e344dc9 100644 --- a/src/gitpod/resources/accounts.py +++ b/src/gitpod/resources/accounts.py @@ -2,6 +2,8 @@ from __future__ import annotations +from typing import Optional + import httpx from ..types import ( @@ -25,9 +27,9 @@ ) from ..pagination import SyncLoginProvidersPage, AsyncLoginProvidersPage from .._base_client import AsyncPaginator, make_request_options +from ..types.login_provider import LoginProvider from ..types.account_retrieve_response import AccountRetrieveResponse from ..types.account_get_sso_login_url_response import AccountGetSSOLoginURLResponse -from ..types.account_list_login_providers_response import AccountListLoginProvidersResponse __all__ = ["AccountsResource", "AsyncAccountsResource"] @@ -121,8 +123,8 @@ def delete( def get_sso_login_url( self, *, - return_to: str, email: str | NotGiven = NOT_GIVEN, + return_to: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -134,10 +136,10 @@ def get_sso_login_url( GetSSOLoginURL returns the URL to redirect the user to for SSO login. Args: - return_to: return_to is the URL the user will be redirected to after login - email: email is the email the user wants to login with + return_to: return_to is the URL the user will be redirected to after login + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -150,8 +152,8 @@ def get_sso_login_url( "/gitpod.v1.AccountService/GetSSOLoginURL", body=maybe_transform( { - "return_to": return_to, "email": email, + "return_to": return_to, }, account_get_sso_login_url_params.AccountGetSSOLoginURLParams, ), @@ -174,7 +176,7 @@ def list_login_providers( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncLoginProvidersPage[AccountListLoginProvidersResponse]: + ) -> SyncLoginProvidersPage[LoginProvider]: """ ListLoginProviders returns the list of login providers matching the provided filters. @@ -194,7 +196,7 @@ def list_login_providers( """ return self._get_api_list( "/gitpod.v1.AccountService/ListLoginProviders", - page=SyncLoginProvidersPage[AccountListLoginProvidersResponse], + page=SyncLoginProvidersPage[LoginProvider], body=maybe_transform( { "filter": filter, @@ -215,7 +217,7 @@ def list_login_providers( account_list_login_providers_params.AccountListLoginProvidersParams, ), ), - model=AccountListLoginProvidersResponse, + model=LoginProvider, method="post", ) @@ -309,8 +311,8 @@ async def delete( async def get_sso_login_url( self, *, - return_to: str, email: str | NotGiven = NOT_GIVEN, + return_to: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -322,10 +324,10 @@ async def get_sso_login_url( GetSSOLoginURL returns the URL to redirect the user to for SSO login. Args: - return_to: return_to is the URL the user will be redirected to after login - email: email is the email the user wants to login with + return_to: return_to is the URL the user will be redirected to after login + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -338,8 +340,8 @@ async def get_sso_login_url( "/gitpod.v1.AccountService/GetSSOLoginURL", body=await async_maybe_transform( { - "return_to": return_to, "email": email, + "return_to": return_to, }, account_get_sso_login_url_params.AccountGetSSOLoginURLParams, ), @@ -362,7 +364,7 @@ def list_login_providers( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[AccountListLoginProvidersResponse, AsyncLoginProvidersPage[AccountListLoginProvidersResponse]]: + ) -> AsyncPaginator[LoginProvider, AsyncLoginProvidersPage[LoginProvider]]: """ ListLoginProviders returns the list of login providers matching the provided filters. @@ -382,7 +384,7 @@ def list_login_providers( """ return self._get_api_list( "/gitpod.v1.AccountService/ListLoginProviders", - page=AsyncLoginProvidersPage[AccountListLoginProvidersResponse], + page=AsyncLoginProvidersPage[LoginProvider], body=maybe_transform( { "filter": filter, @@ -403,7 +405,7 @@ def list_login_providers( account_list_login_providers_params.AccountListLoginProvidersParams, ), ), - model=AccountListLoginProvidersResponse, + model=LoginProvider, method="post", ) diff --git a/src/gitpod/resources/editors.py b/src/gitpod/resources/editors.py index 19cfc8a..17733f6 100644 --- a/src/gitpod/resources/editors.py +++ b/src/gitpod/resources/editors.py @@ -20,7 +20,7 @@ ) from ..pagination import SyncEditorsPage, AsyncEditorsPage from .._base_client import AsyncPaginator, make_request_options -from ..types.editor_list_response import EditorListResponse +from ..types.editor import Editor from ..types.editor_retrieve_response import EditorRetrieveResponse from ..types.editor_resolve_url_response import EditorResolveURLResponse @@ -93,7 +93,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncEditorsPage[EditorListResponse]: + ) -> SyncEditorsPage[Editor]: """ ListEditors lists all editors available to the caller @@ -110,7 +110,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.EditorService/ListEditors", - page=SyncEditorsPage[EditorListResponse], + page=SyncEditorsPage[Editor], body=maybe_transform({"pagination": pagination}, editor_list_params.EditorListParams), options=make_request_options( extra_headers=extra_headers, @@ -125,7 +125,7 @@ def list( editor_list_params.EditorListParams, ), ), - model=EditorListResponse, + model=Editor, method="post", ) @@ -243,7 +243,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[EditorListResponse, AsyncEditorsPage[EditorListResponse]]: + ) -> AsyncPaginator[Editor, AsyncEditorsPage[Editor]]: """ ListEditors lists all editors available to the caller @@ -260,7 +260,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.EditorService/ListEditors", - page=AsyncEditorsPage[EditorListResponse], + page=AsyncEditorsPage[Editor], body=maybe_transform({"pagination": pagination}, editor_list_params.EditorListParams), options=make_request_options( extra_headers=extra_headers, @@ -275,7 +275,7 @@ def list( editor_list_params.EditorListParams, ), ), - model=EditorListResponse, + model=Editor, method="post", ) diff --git a/src/gitpod/resources/environments/automations/automations.py b/src/gitpod/resources/environments/automations/automations.py index ea521a1..f9c6d9b 100644 --- a/src/gitpod/resources/environments/automations/automations.py +++ b/src/gitpod/resources/environments/automations/automations.py @@ -35,6 +35,7 @@ ) from ...._base_client import make_request_options from ....types.environments import automation_upsert_params +from ....types.environments.automations_file_param import AutomationsFileParam from ....types.environments.automation_upsert_response import AutomationUpsertResponse __all__ = ["AutomationsResource", "AsyncAutomationsResource"] @@ -71,7 +72,7 @@ def with_streaming_response(self) -> AutomationsResourceWithStreamingResponse: def upsert( self, *, - automations_file: automation_upsert_params.AutomationsFile | NotGiven = NOT_GIVEN, + automations_file: AutomationsFileParam | NotGiven = NOT_GIVEN, environment_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -144,7 +145,7 @@ def with_streaming_response(self) -> AsyncAutomationsResourceWithStreamingRespon async def upsert( self, *, - automations_file: automation_upsert_params.AutomationsFile | NotGiven = NOT_GIVEN, + automations_file: AutomationsFileParam | NotGiven = NOT_GIVEN, environment_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/gitpod/resources/environments/automations/services.py b/src/gitpod/resources/environments/automations/services.py index f958352..adea3c2 100644 --- a/src/gitpod/resources/environments/automations/services.py +++ b/src/gitpod/resources/environments/automations/services.py @@ -28,7 +28,9 @@ service_update_params, service_retrieve_params, ) -from ....types.environments.automations.service_list_response import ServiceListResponse +from ....types.environments.automations.service import Service +from ....types.environments.automations.service_spec_param import ServiceSpecParam +from ....types.environments.automations.service_metadata_param import ServiceMetadataParam from ....types.environments.automations.service_create_response import ServiceCreateResponse from ....types.environments.automations.service_retrieve_response import ServiceRetrieveResponse @@ -59,8 +61,8 @@ def create( self, *, environment_id: str | NotGiven = NOT_GIVEN, - metadata: service_create_params.Metadata | NotGiven = NOT_GIVEN, - spec: service_create_params.Spec | NotGiven = NOT_GIVEN, + metadata: ServiceMetadataParam | NotGiven = NOT_GIVEN, + spec: ServiceSpecParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -192,7 +194,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncServicesPage[ServiceListResponse]: + ) -> SyncServicesPage[Service]: """ ListServices @@ -211,7 +213,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.EnvironmentAutomationService/ListServices", - page=SyncServicesPage[ServiceListResponse], + page=SyncServicesPage[Service], body=maybe_transform( { "filter": filter, @@ -232,7 +234,7 @@ def list( service_list_params.ServiceListParams, ), ), - model=ServiceListResponse, + model=Service, method="post", ) @@ -372,8 +374,8 @@ async def create( self, *, environment_id: str | NotGiven = NOT_GIVEN, - metadata: service_create_params.Metadata | NotGiven = NOT_GIVEN, - spec: service_create_params.Spec | NotGiven = NOT_GIVEN, + metadata: ServiceMetadataParam | NotGiven = NOT_GIVEN, + spec: ServiceSpecParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -505,7 +507,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ServiceListResponse, AsyncServicesPage[ServiceListResponse]]: + ) -> AsyncPaginator[Service, AsyncServicesPage[Service]]: """ ListServices @@ -524,7 +526,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.EnvironmentAutomationService/ListServices", - page=AsyncServicesPage[ServiceListResponse], + page=AsyncServicesPage[Service], body=maybe_transform( { "filter": filter, @@ -545,7 +547,7 @@ def list( service_list_params.ServiceListParams, ), ), - model=ServiceListResponse, + model=Service, method="post", ) diff --git a/src/gitpod/resources/environments/automations/tasks/executions.py b/src/gitpod/resources/environments/automations/tasks/executions.py index d34f9ec..7b831a7 100644 --- a/src/gitpod/resources/environments/automations/tasks/executions.py +++ b/src/gitpod/resources/environments/automations/tasks/executions.py @@ -19,12 +19,12 @@ ) from .....pagination import SyncTaskExecutionsPage, AsyncTaskExecutionsPage from ....._base_client import AsyncPaginator, make_request_options +from .....types.shared.task_execution import TaskExecution from .....types.environments.automations.tasks import ( execution_list_params, execution_stop_params, execution_retrieve_params, ) -from .....types.environments.automations.tasks.execution_list_response import ExecutionListResponse from .....types.environments.automations.tasks.execution_retrieve_response import ExecutionRetrieveResponse __all__ = ["ExecutionsResource", "AsyncExecutionsResource"] @@ -95,7 +95,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncTaskExecutionsPage[ExecutionListResponse]: + ) -> SyncTaskExecutionsPage[TaskExecution]: """ ListTaskExecutions @@ -114,7 +114,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.EnvironmentAutomationService/ListTaskExecutions", - page=SyncTaskExecutionsPage[ExecutionListResponse], + page=SyncTaskExecutionsPage[TaskExecution], body=maybe_transform( { "filter": filter, @@ -135,7 +135,7 @@ def list( execution_list_params.ExecutionListParams, ), ), - model=ExecutionListResponse, + model=TaskExecution, method="post", ) @@ -237,7 +237,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ExecutionListResponse, AsyncTaskExecutionsPage[ExecutionListResponse]]: + ) -> AsyncPaginator[TaskExecution, AsyncTaskExecutionsPage[TaskExecution]]: """ ListTaskExecutions @@ -256,7 +256,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.EnvironmentAutomationService/ListTaskExecutions", - page=AsyncTaskExecutionsPage[ExecutionListResponse], + page=AsyncTaskExecutionsPage[TaskExecution], body=maybe_transform( { "filter": filter, @@ -277,7 +277,7 @@ def list( execution_list_params.ExecutionListParams, ), ), - model=ExecutionListResponse, + model=TaskExecution, method="post", ) diff --git a/src/gitpod/resources/environments/automations/tasks/tasks.py b/src/gitpod/resources/environments/automations/tasks/tasks.py index f3e00a6..2687f1b 100644 --- a/src/gitpod/resources/environments/automations/tasks/tasks.py +++ b/src/gitpod/resources/environments/automations/tasks/tasks.py @@ -37,7 +37,9 @@ task_update_params, task_retrieve_params, ) -from .....types.environments.automations.task_list_response import TaskListResponse +from .....types.environments.automations.task import Task +from .....types.environments.automations.task_spec_param import TaskSpecParam +from .....types.environments.automations.task_metadata_param import TaskMetadataParam from .....types.environments.automations.task_start_response import TaskStartResponse from .....types.environments.automations.task_create_response import TaskCreateResponse from .....types.environments.automations.task_retrieve_response import TaskRetrieveResponse @@ -74,8 +76,8 @@ def create( *, depends_on: List[str] | NotGiven = NOT_GIVEN, environment_id: str | NotGiven = NOT_GIVEN, - metadata: task_create_params.Metadata | NotGiven = NOT_GIVEN, - spec: task_create_params.Spec | NotGiven = NOT_GIVEN, + metadata: TaskMetadataParam | NotGiven = NOT_GIVEN, + spec: TaskSpecParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -202,7 +204,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncTasksPage[TaskListResponse]: + ) -> SyncTasksPage[Task]: """ ListTasks @@ -221,7 +223,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.EnvironmentAutomationService/ListTasks", - page=SyncTasksPage[TaskListResponse], + page=SyncTasksPage[Task], body=maybe_transform( { "filter": filter, @@ -242,7 +244,7 @@ def list( task_list_params.TaskListParams, ), ), - model=TaskListResponse, + model=Task, method="post", ) @@ -342,8 +344,8 @@ async def create( *, depends_on: List[str] | NotGiven = NOT_GIVEN, environment_id: str | NotGiven = NOT_GIVEN, - metadata: task_create_params.Metadata | NotGiven = NOT_GIVEN, - spec: task_create_params.Spec | NotGiven = NOT_GIVEN, + metadata: TaskMetadataParam | NotGiven = NOT_GIVEN, + spec: TaskSpecParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -470,7 +472,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[TaskListResponse, AsyncTasksPage[TaskListResponse]]: + ) -> AsyncPaginator[Task, AsyncTasksPage[Task]]: """ ListTasks @@ -489,7 +491,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.EnvironmentAutomationService/ListTasks", - page=AsyncTasksPage[TaskListResponse], + page=AsyncTasksPage[Task], body=maybe_transform( { "filter": filter, @@ -510,7 +512,7 @@ def list( task_list_params.TaskListParams, ), ), - model=TaskListResponse, + model=Task, method="post", ) diff --git a/src/gitpod/resources/environments/classes.py b/src/gitpod/resources/environments/classes.py index c4289d4..a68c661 100644 --- a/src/gitpod/resources/environments/classes.py +++ b/src/gitpod/resources/environments/classes.py @@ -17,7 +17,7 @@ from ...pagination import SyncEnvironmentClassesPage, AsyncEnvironmentClassesPage from ..._base_client import AsyncPaginator, make_request_options from ...types.environments import class_list_params -from ...types.environments.class_list_response import ClassListResponse +from ...types.shared.environment_class import EnvironmentClass __all__ = ["ClassesResource", "AsyncClassesResource"] @@ -55,7 +55,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncEnvironmentClassesPage[ClassListResponse]: + ) -> SyncEnvironmentClassesPage[EnvironmentClass]: """ ListEnvironmentClasses returns the list of environment classes with runner details a user is able to use based on the query buf:lint:ignore @@ -74,7 +74,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.EnvironmentService/ListEnvironmentClasses", - page=SyncEnvironmentClassesPage[ClassListResponse], + page=SyncEnvironmentClassesPage[EnvironmentClass], body=maybe_transform( { "filter": filter, @@ -95,7 +95,7 @@ def list( class_list_params.ClassListParams, ), ), - model=ClassListResponse, + model=EnvironmentClass, method="post", ) @@ -133,7 +133,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ClassListResponse, AsyncEnvironmentClassesPage[ClassListResponse]]: + ) -> AsyncPaginator[EnvironmentClass, AsyncEnvironmentClassesPage[EnvironmentClass]]: """ ListEnvironmentClasses returns the list of environment classes with runner details a user is able to use based on the query buf:lint:ignore @@ -152,7 +152,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.EnvironmentService/ListEnvironmentClasses", - page=AsyncEnvironmentClassesPage[ClassListResponse], + page=AsyncEnvironmentClassesPage[EnvironmentClass], body=maybe_transform( { "filter": filter, @@ -173,7 +173,7 @@ def list( class_list_params.ClassListParams, ), ), - model=ClassListResponse, + model=EnvironmentClass, method="post", ) diff --git a/src/gitpod/resources/environments/environments.py b/src/gitpod/resources/environments/environments.py index c63cbbf..13c6fec 100644 --- a/src/gitpod/resources/environments/environments.py +++ b/src/gitpod/resources/environments/environments.py @@ -41,6 +41,7 @@ ) from ...pagination import SyncEnvironmentsPage, AsyncEnvironmentsPage from ..._base_client import AsyncPaginator, make_request_options +from ...types.environment import Environment from .automations.automations import ( AutomationsResource, AsyncAutomationsResource, @@ -49,9 +50,10 @@ AutomationsResourceWithStreamingResponse, AsyncAutomationsResourceWithStreamingResponse, ) -from ...types.environment_list_response import EnvironmentListResponse +from ...types.environment_spec_param import EnvironmentSpecParam from ...types.environment_create_response import EnvironmentCreateResponse from ...types.environment_retrieve_response import EnvironmentRetrieveResponse +from ...types.environment_activity_signal_param import EnvironmentActivitySignalParam from ...types.environment_create_logs_token_response import EnvironmentCreateLogsTokenResponse from ...types.environment_create_from_project_response import EnvironmentCreateFromProjectResponse @@ -89,7 +91,7 @@ def with_streaming_response(self) -> EnvironmentsResourceWithStreamingResponse: def create( self, *, - spec: environment_create_params.Spec | NotGiven = NOT_GIVEN, + spec: EnvironmentSpecParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -100,6 +102,44 @@ def create( """ CreateEnvironment creates a new environment and starts it. + The `class` field must be a valid environment class ID. You can find a list of + available environment classes with the `ListEnvironmentClasses` method. + + ### Examples + + - from context URL: + + Creates an environment from a context URL, e.g. a GitHub repository. + + ```yaml + spec: + machine: + class: "61000000-0000-0000-0000-000000000000" + content: + initializer: + specs: + - contextUrl: + url: "https://github.com/gitpod-io/gitpod" + ``` + + - from Git repository: + + Creates an environment from a Git repository directly. While less convenient, + this is useful if you want to specify a specific branch, commit, etc. + + ```yaml + spec: + machine: + class: "61000000-0000-0000-0000-000000000000" + content: + initializer: + specs: + - git: + remoteUri: "https://github.com/gitpod-io/gitpod" + cloneTarget: "main" + targetMode: "CLONE_TARGET_MODE_REMOTE_BRANCH" + ``` + Args: spec: EnvironmentSpec specifies the configuration of an environment for an environment start @@ -135,9 +175,6 @@ def retrieve( """ GetEnvironment returns a single environment. - +return NOT_FOUND User does not have access to an environment with the given ID - +return NOT_FOUND Environment does not exist - Args: environment_id: environment_id specifies the environment to get @@ -219,7 +256,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncEnvironmentsPage[EnvironmentListResponse]: + ) -> SyncEnvironmentsPage[Environment]: """ ListEnvironments returns a list of environments that match the query. @@ -238,7 +275,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.EnvironmentService/ListEnvironments", - page=SyncEnvironmentsPage[EnvironmentListResponse], + page=SyncEnvironmentsPage[Environment], body=maybe_transform( { "filter": filter, @@ -260,7 +297,7 @@ def list( environment_list_params.EnvironmentListParams, ), ), - model=EnvironmentListResponse, + model=Environment, method="post", ) @@ -318,7 +355,7 @@ def create_from_project( self, *, project_id: str | NotGiven = NOT_GIVEN, - spec: environment_create_from_project_params.Spec | NotGiven = NOT_GIVEN, + spec: EnvironmentSpecParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -401,7 +438,7 @@ def create_logs_token( def mark_active( self, *, - activity_signal: environment_mark_active_params.ActivitySignal | NotGiven = NOT_GIVEN, + activity_signal: EnvironmentActivitySignalParam | NotGiven = NOT_GIVEN, environment_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -545,7 +582,7 @@ def with_streaming_response(self) -> AsyncEnvironmentsResourceWithStreamingRespo async def create( self, *, - spec: environment_create_params.Spec | NotGiven = NOT_GIVEN, + spec: EnvironmentSpecParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -556,6 +593,44 @@ async def create( """ CreateEnvironment creates a new environment and starts it. + The `class` field must be a valid environment class ID. You can find a list of + available environment classes with the `ListEnvironmentClasses` method. + + ### Examples + + - from context URL: + + Creates an environment from a context URL, e.g. a GitHub repository. + + ```yaml + spec: + machine: + class: "61000000-0000-0000-0000-000000000000" + content: + initializer: + specs: + - contextUrl: + url: "https://github.com/gitpod-io/gitpod" + ``` + + - from Git repository: + + Creates an environment from a Git repository directly. While less convenient, + this is useful if you want to specify a specific branch, commit, etc. + + ```yaml + spec: + machine: + class: "61000000-0000-0000-0000-000000000000" + content: + initializer: + specs: + - git: + remoteUri: "https://github.com/gitpod-io/gitpod" + cloneTarget: "main" + targetMode: "CLONE_TARGET_MODE_REMOTE_BRANCH" + ``` + Args: spec: EnvironmentSpec specifies the configuration of an environment for an environment start @@ -591,9 +666,6 @@ async def retrieve( """ GetEnvironment returns a single environment. - +return NOT_FOUND User does not have access to an environment with the given ID - +return NOT_FOUND Environment does not exist - Args: environment_id: environment_id specifies the environment to get @@ -675,7 +747,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[EnvironmentListResponse, AsyncEnvironmentsPage[EnvironmentListResponse]]: + ) -> AsyncPaginator[Environment, AsyncEnvironmentsPage[Environment]]: """ ListEnvironments returns a list of environments that match the query. @@ -694,7 +766,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.EnvironmentService/ListEnvironments", - page=AsyncEnvironmentsPage[EnvironmentListResponse], + page=AsyncEnvironmentsPage[Environment], body=maybe_transform( { "filter": filter, @@ -716,7 +788,7 @@ def list( environment_list_params.EnvironmentListParams, ), ), - model=EnvironmentListResponse, + model=Environment, method="post", ) @@ -774,7 +846,7 @@ async def create_from_project( self, *, project_id: str | NotGiven = NOT_GIVEN, - spec: environment_create_from_project_params.Spec | NotGiven = NOT_GIVEN, + spec: EnvironmentSpecParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -857,7 +929,7 @@ async def create_logs_token( async def mark_active( self, *, - activity_signal: environment_mark_active_params.ActivitySignal | NotGiven = NOT_GIVEN, + activity_signal: EnvironmentActivitySignalParam | NotGiven = NOT_GIVEN, environment_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/gitpod/resources/events.py b/src/gitpod/resources/events.py index df67d31..b1539f7 100644 --- a/src/gitpod/resources/events.py +++ b/src/gitpod/resources/events.py @@ -2,14 +2,11 @@ from __future__ import annotations -from typing_extensions import overload - import httpx from ..types import event_list_params, event_watch_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( - required_args, maybe_transform, async_maybe_transform, ) @@ -106,11 +103,11 @@ def list( method="post", ) - @overload def watch( self, *, - environment_id: str, + environment_id: str | NotGiven = NOT_GIVEN, + organization: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -125,32 +122,6 @@ def watch( environment_id: Environment scope produces events for the environment itself, all tasks, task executions, and services associated with that environment. - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def watch( - self, - *, - organization: bool, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> JSONLDecoder[EventWatchResponse]: - """ - WatchEvents streams all requests events to the client - - Args: organization: Organization scope produces events for all projects, runners and environments the caller can see within their organization. No task, task execution or service events are produed. @@ -163,21 +134,6 @@ def watch( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @required_args(["environment_id"], ["organization"]) - def watch( - self, - *, - environment_id: str | NotGiven = NOT_GIVEN, - organization: bool | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> JSONLDecoder[EventWatchResponse]: extra_headers = {"Accept": "application/jsonl", **(extra_headers or {})} return self._post( "/gitpod.v1.EventService/WatchEvents", @@ -272,11 +228,11 @@ def list( method="post", ) - @overload async def watch( self, *, - environment_id: str, + environment_id: str | NotGiven = NOT_GIVEN, + organization: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -291,32 +247,6 @@ async def watch( environment_id: Environment scope produces events for the environment itself, all tasks, task executions, and services associated with that environment. - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def watch( - self, - *, - organization: bool, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncJSONLDecoder[EventWatchResponse]: - """ - WatchEvents streams all requests events to the client - - Args: organization: Organization scope produces events for all projects, runners and environments the caller can see within their organization. No task, task execution or service events are produed. @@ -329,21 +259,6 @@ async def watch( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @required_args(["environment_id"], ["organization"]) - async def watch( - self, - *, - environment_id: str | NotGiven = NOT_GIVEN, - organization: bool | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncJSONLDecoder[EventWatchResponse]: extra_headers = {"Accept": "application/jsonl", **(extra_headers or {})} return await self._post( "/gitpod.v1.EventService/WatchEvents", diff --git a/src/gitpod/resources/groups.py b/src/gitpod/resources/groups.py index bf614f1..9b6f47b 100644 --- a/src/gitpod/resources/groups.py +++ b/src/gitpod/resources/groups.py @@ -16,8 +16,8 @@ async_to_streamed_response_wrapper, ) from ..pagination import SyncGroupsPage, AsyncGroupsPage +from ..types.group import Group from .._base_client import AsyncPaginator, make_request_options -from ..types.group_list_response import GroupListResponse __all__ = ["GroupsResource", "AsyncGroupsResource"] @@ -54,7 +54,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncGroupsPage[GroupListResponse]: + ) -> SyncGroupsPage[Group]: """ ListGroups lists groups @@ -71,7 +71,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.GroupService/ListGroups", - page=SyncGroupsPage[GroupListResponse], + page=SyncGroupsPage[Group], body=maybe_transform({"pagination": pagination}, group_list_params.GroupListParams), options=make_request_options( extra_headers=extra_headers, @@ -86,7 +86,7 @@ def list( group_list_params.GroupListParams, ), ), - model=GroupListResponse, + model=Group, method="post", ) @@ -123,7 +123,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[GroupListResponse, AsyncGroupsPage[GroupListResponse]]: + ) -> AsyncPaginator[Group, AsyncGroupsPage[Group]]: """ ListGroups lists groups @@ -140,7 +140,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.GroupService/ListGroups", - page=AsyncGroupsPage[GroupListResponse], + page=AsyncGroupsPage[Group], body=maybe_transform({"pagination": pagination}, group_list_params.GroupListParams), options=make_request_options( extra_headers=extra_headers, @@ -155,7 +155,7 @@ def list( group_list_params.GroupListParams, ), ), - model=GroupListResponse, + model=Group, method="post", ) diff --git a/src/gitpod/resources/organizations/organizations.py b/src/gitpod/resources/organizations/organizations.py index afd94cb..6532613 100644 --- a/src/gitpod/resources/organizations/organizations.py +++ b/src/gitpod/resources/organizations/organizations.py @@ -2,11 +2,12 @@ from __future__ import annotations -from typing_extensions import Literal, overload +from typing import Optional import httpx from ...types import ( + Scope, organization_join_params, organization_list_params, organization_leave_params, @@ -27,7 +28,6 @@ ) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( - required_args, maybe_transform, async_maybe_transform, ) @@ -40,6 +40,7 @@ async_to_streamed_response_wrapper, ) from ...pagination import SyncMembersPage, AsyncMembersPage, SyncOrganizationsPage, AsyncOrganizationsPage +from ...types.scope import Scope from ..._base_client import AsyncPaginator, make_request_options from .sso_configurations import ( SSOConfigurationsResource, @@ -49,12 +50,14 @@ SSOConfigurationsResourceWithStreamingResponse, AsyncSSOConfigurationsResourceWithStreamingResponse, ) +from ...types.organization import Organization +from ...types.organization_member import OrganizationMember +from ...types.invite_domains_param import InviteDomainsParam +from ...types.shared.organization_role import OrganizationRole from ...types.organization_join_response import OrganizationJoinResponse -from ...types.organization_list_response import OrganizationListResponse from ...types.organization_create_response import OrganizationCreateResponse from ...types.organization_update_response import OrganizationUpdateResponse from ...types.organization_retrieve_response import OrganizationRetrieveResponse -from ...types.organization_list_members_response import OrganizationListMembersResponse __all__ = ["OrganizationsResource", "AsyncOrganizationsResource"] @@ -172,11 +175,12 @@ def retrieve( cast_to=OrganizationRetrieveResponse, ) - @overload def update( self, *, - invite_domains: organization_update_params.InviteDomainsIsTheDomainAllowlistOfTheOrganizationInviteDomains, + invite_domains: Optional[InviteDomainsParam] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, + organization_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -190,34 +194,10 @@ def update( Args: invite_domains: invite_domains is the domain allowlist of the organization - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def update( - self, - *, - name: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OrganizationUpdateResponse: - """ - UpdateOrganization updates the properties of an Organization. - - Args: name: name is the new name of the organization + organization_id: organization_id is the ID of the organization to update the settings for. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -226,28 +206,13 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @required_args(["invite_domains"], ["name"]) - def update( - self, - *, - invite_domains: organization_update_params.InviteDomainsIsTheDomainAllowlistOfTheOrganizationInviteDomains - | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OrganizationUpdateResponse: return self._post( "/gitpod.v1.OrganizationService/UpdateOrganization", body=maybe_transform( { "invite_domains": invite_domains, "name": name, + "organization_id": organization_id, }, organization_update_params.OrganizationUpdateParams, ), @@ -263,14 +228,14 @@ def list( token: str | NotGiven = NOT_GIVEN, page_size: int | NotGiven = NOT_GIVEN, pagination: organization_list_params.Pagination | NotGiven = NOT_GIVEN, - scope: Literal["SCOPE_UNSPECIFIED", "SCOPE_MEMBER", "SCOPE_ALL"] | NotGiven = NOT_GIVEN, + scope: Scope | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncOrganizationsPage[OrganizationListResponse]: + ) -> SyncOrganizationsPage[Organization]: """ ListOrganizations lists all organization the caller has access to. @@ -289,7 +254,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.OrganizationService/ListOrganizations", - page=SyncOrganizationsPage[OrganizationListResponse], + page=SyncOrganizationsPage[Organization], body=maybe_transform( { "pagination": pagination, @@ -310,7 +275,7 @@ def list( organization_list_params.OrganizationListParams, ), ), - model=OrganizationListResponse, + model=Organization, method="post", ) @@ -350,11 +315,11 @@ def delete( cast_to=object, ) - @overload def join( self, *, - invite_id: str, + invite_id: str | NotGiven = NOT_GIVEN, + organization_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -368,32 +333,6 @@ def join( Args: invite_id: invite_id is the unique identifier of the invite to join the organization. - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def join( - self, - *, - organization_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OrganizationJoinResponse: - """ - JoinOrganization lets accounts join an Organization. - - Args: organization_id: organization_id is the unique identifier of the Organization to join. extra_headers: Send extra headers @@ -404,21 +343,6 @@ def join( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @required_args(["invite_id"], ["organization_id"]) - def join( - self, - *, - invite_id: str | NotGiven = NOT_GIVEN, - organization_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OrganizationJoinResponse: return self._post( "/gitpod.v1.OrganizationService/JoinOrganization", body=maybe_transform( @@ -479,7 +403,7 @@ def list_members( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncMembersPage[OrganizationListMembersResponse]: + ) -> SyncMembersPage[OrganizationMember]: """ ListMembers lists all members of the specified organization. @@ -498,7 +422,7 @@ def list_members( """ return self._get_api_list( "/gitpod.v1.OrganizationService/ListMembers", - page=SyncMembersPage[OrganizationListMembersResponse], + page=SyncMembersPage[OrganizationMember], body=maybe_transform( { "organization_id": organization_id, @@ -519,7 +443,7 @@ def list_members( organization_list_members_params.OrganizationListMembersParams, ), ), - model=OrganizationListMembersResponse, + model=OrganizationMember, method="post", ) @@ -527,8 +451,7 @@ def set_role( self, *, organization_id: str | NotGiven = NOT_GIVEN, - role: Literal["ORGANIZATION_ROLE_UNSPECIFIED", "ORGANIZATION_ROLE_ADMIN", "ORGANIZATION_ROLE_MEMBER"] - | NotGiven = NOT_GIVEN, + role: OrganizationRole | NotGiven = NOT_GIVEN, user_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -679,11 +602,12 @@ async def retrieve( cast_to=OrganizationRetrieveResponse, ) - @overload async def update( self, *, - invite_domains: organization_update_params.InviteDomainsIsTheDomainAllowlistOfTheOrganizationInviteDomains, + invite_domains: Optional[InviteDomainsParam] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, + organization_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -697,34 +621,10 @@ async def update( Args: invite_domains: invite_domains is the domain allowlist of the organization - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - *, - name: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OrganizationUpdateResponse: - """ - UpdateOrganization updates the properties of an Organization. - - Args: name: name is the new name of the organization + organization_id: organization_id is the ID of the organization to update the settings for. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -733,28 +633,13 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @required_args(["invite_domains"], ["name"]) - async def update( - self, - *, - invite_domains: organization_update_params.InviteDomainsIsTheDomainAllowlistOfTheOrganizationInviteDomains - | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OrganizationUpdateResponse: return await self._post( "/gitpod.v1.OrganizationService/UpdateOrganization", body=await async_maybe_transform( { "invite_domains": invite_domains, "name": name, + "organization_id": organization_id, }, organization_update_params.OrganizationUpdateParams, ), @@ -770,14 +655,14 @@ def list( token: str | NotGiven = NOT_GIVEN, page_size: int | NotGiven = NOT_GIVEN, pagination: organization_list_params.Pagination | NotGiven = NOT_GIVEN, - scope: Literal["SCOPE_UNSPECIFIED", "SCOPE_MEMBER", "SCOPE_ALL"] | NotGiven = NOT_GIVEN, + scope: Scope | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[OrganizationListResponse, AsyncOrganizationsPage[OrganizationListResponse]]: + ) -> AsyncPaginator[Organization, AsyncOrganizationsPage[Organization]]: """ ListOrganizations lists all organization the caller has access to. @@ -796,7 +681,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.OrganizationService/ListOrganizations", - page=AsyncOrganizationsPage[OrganizationListResponse], + page=AsyncOrganizationsPage[Organization], body=maybe_transform( { "pagination": pagination, @@ -817,7 +702,7 @@ def list( organization_list_params.OrganizationListParams, ), ), - model=OrganizationListResponse, + model=Organization, method="post", ) @@ -857,11 +742,11 @@ async def delete( cast_to=object, ) - @overload async def join( self, *, - invite_id: str, + invite_id: str | NotGiven = NOT_GIVEN, + organization_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -875,32 +760,6 @@ async def join( Args: invite_id: invite_id is the unique identifier of the invite to join the organization. - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def join( - self, - *, - organization_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OrganizationJoinResponse: - """ - JoinOrganization lets accounts join an Organization. - - Args: organization_id: organization_id is the unique identifier of the Organization to join. extra_headers: Send extra headers @@ -911,21 +770,6 @@ async def join( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @required_args(["invite_id"], ["organization_id"]) - async def join( - self, - *, - invite_id: str | NotGiven = NOT_GIVEN, - organization_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OrganizationJoinResponse: return await self._post( "/gitpod.v1.OrganizationService/JoinOrganization", body=await async_maybe_transform( @@ -986,7 +830,7 @@ def list_members( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[OrganizationListMembersResponse, AsyncMembersPage[OrganizationListMembersResponse]]: + ) -> AsyncPaginator[OrganizationMember, AsyncMembersPage[OrganizationMember]]: """ ListMembers lists all members of the specified organization. @@ -1005,7 +849,7 @@ def list_members( """ return self._get_api_list( "/gitpod.v1.OrganizationService/ListMembers", - page=AsyncMembersPage[OrganizationListMembersResponse], + page=AsyncMembersPage[OrganizationMember], body=maybe_transform( { "organization_id": organization_id, @@ -1026,7 +870,7 @@ def list_members( organization_list_members_params.OrganizationListMembersParams, ), ), - model=OrganizationListMembersResponse, + model=OrganizationMember, method="post", ) @@ -1034,8 +878,7 @@ async def set_role( self, *, organization_id: str | NotGiven = NOT_GIVEN, - role: Literal["ORGANIZATION_ROLE_UNSPECIFIED", "ORGANIZATION_ROLE_ADMIN", "ORGANIZATION_ROLE_MEMBER"] - | NotGiven = NOT_GIVEN, + role: OrganizationRole | NotGiven = NOT_GIVEN, user_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/gitpod/resources/organizations/sso_configurations.py b/src/gitpod/resources/organizations/sso_configurations.py index cb3b97c..62a4197 100644 --- a/src/gitpod/resources/organizations/sso_configurations.py +++ b/src/gitpod/resources/organizations/sso_configurations.py @@ -2,13 +2,12 @@ from __future__ import annotations -from typing_extensions import Literal, overload +from typing import Dict, Optional import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( - required_args, maybe_transform, async_maybe_transform, ) @@ -23,13 +22,15 @@ from ...pagination import SyncSSOConfigurationsPage, AsyncSSOConfigurationsPage from ..._base_client import AsyncPaginator, make_request_options from ...types.organizations import ( + SSOConfigurationState, sso_configuration_list_params, sso_configuration_create_params, sso_configuration_delete_params, sso_configuration_update_params, sso_configuration_retrieve_params, ) -from ...types.organizations.sso_configuration_list_response import SSOConfigurationListResponse +from ...types.organizations.sso_configuration import SSOConfiguration +from ...types.organizations.sso_configuration_state import SSOConfigurationState from ...types.organizations.sso_configuration_create_response import SSOConfigurationCreateResponse from ...types.organizations.sso_configuration_retrieve_response import SSOConfigurationRetrieveResponse @@ -146,11 +147,16 @@ def retrieve( cast_to=SSOConfigurationRetrieveResponse, ) - @overload def update( self, *, - client_id: str, + claims: Dict[str, str] | NotGiven = NOT_GIVEN, + client_id: Optional[str] | NotGiven = NOT_GIVEN, + client_secret: Optional[str] | NotGiven = NOT_GIVEN, + email_domain: Optional[str] | NotGiven = NOT_GIVEN, + issuer_url: Optional[str] | NotGiven = NOT_GIVEN, + sso_configuration_id: str | NotGiven = NOT_GIVEN, + state: Optional[SSOConfigurationState] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -162,118 +168,16 @@ def update( UpdateSSOConfiguration updates the SSO configuration for the organization. Args: - client_id: client_id is the client ID of the SSO provider - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... + claims: claims are key/value pairs that defines a mapping of claims issued by the IdP. - @overload - def update( - self, - *, - client_secret: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - UpdateSSOConfiguration updates the SSO configuration for the organization. + client_id: client_id is the client ID of the SSO provider - Args: client_secret: client_secret is the client secret of the SSO provider - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def update( - self, - *, - email_domain: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - UpdateSSOConfiguration updates the SSO configuration for the organization. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def update( - self, - *, - issuer_url: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - UpdateSSOConfiguration updates the SSO configuration for the organization. - - Args: issuer_url: issuer_url is the URL of the IdP issuer - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def update( - self, - *, - state: Literal[ - "SSO_CONFIGURATION_STATE_UNSPECIFIED", "SSO_CONFIGURATION_STATE_INACTIVE", "SSO_CONFIGURATION_STATE_ACTIVE" - ], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - UpdateSSOConfiguration updates the SSO configuration for the organization. + sso_configuration_id: sso_configuration_id is the ID of the SSO configuration to update - Args: state: state is the state of the SSO configuration extra_headers: Send extra headers @@ -284,35 +188,16 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @required_args(["client_id"], ["client_secret"], ["email_domain"], ["issuer_url"], ["state"]) - def update( - self, - *, - client_id: str | NotGiven = NOT_GIVEN, - client_secret: str | NotGiven = NOT_GIVEN, - email_domain: str | NotGiven = NOT_GIVEN, - issuer_url: str | NotGiven = NOT_GIVEN, - state: Literal[ - "SSO_CONFIGURATION_STATE_UNSPECIFIED", "SSO_CONFIGURATION_STATE_INACTIVE", "SSO_CONFIGURATION_STATE_ACTIVE" - ] - | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: return self._post( "/gitpod.v1.OrganizationService/UpdateSSOConfiguration", body=maybe_transform( { + "claims": claims, "client_id": client_id, "client_secret": client_secret, "email_domain": email_domain, "issuer_url": issuer_url, + "sso_configuration_id": sso_configuration_id, "state": state, }, sso_configuration_update_params.SSOConfigurationUpdateParams, @@ -336,7 +221,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSSOConfigurationsPage[SSOConfigurationListResponse]: + ) -> SyncSSOConfigurationsPage[SSOConfiguration]: """ ListSSOConfigurations lists all SSO configurations matching provided filters. @@ -353,7 +238,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.OrganizationService/ListSSOConfigurations", - page=SyncSSOConfigurationsPage[SSOConfigurationListResponse], + page=SyncSSOConfigurationsPage[SSOConfiguration], body=maybe_transform( { "organization_id": organization_id, @@ -374,7 +259,7 @@ def list( sso_configuration_list_params.SSOConfigurationListParams, ), ), - model=SSOConfigurationListResponse, + model=SSOConfiguration, method="post", ) @@ -524,11 +409,16 @@ async def retrieve( cast_to=SSOConfigurationRetrieveResponse, ) - @overload async def update( self, *, - client_id: str, + claims: Dict[str, str] | NotGiven = NOT_GIVEN, + client_id: Optional[str] | NotGiven = NOT_GIVEN, + client_secret: Optional[str] | NotGiven = NOT_GIVEN, + email_domain: Optional[str] | NotGiven = NOT_GIVEN, + issuer_url: Optional[str] | NotGiven = NOT_GIVEN, + sso_configuration_id: str | NotGiven = NOT_GIVEN, + state: Optional[SSOConfigurationState] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -540,118 +430,16 @@ async def update( UpdateSSOConfiguration updates the SSO configuration for the organization. Args: - client_id: client_id is the client ID of the SSO provider - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... + claims: claims are key/value pairs that defines a mapping of claims issued by the IdP. - @overload - async def update( - self, - *, - client_secret: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - UpdateSSOConfiguration updates the SSO configuration for the organization. + client_id: client_id is the client ID of the SSO provider - Args: client_secret: client_secret is the client secret of the SSO provider - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - *, - email_domain: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - UpdateSSOConfiguration updates the SSO configuration for the organization. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - *, - issuer_url: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - UpdateSSOConfiguration updates the SSO configuration for the organization. - - Args: issuer_url: issuer_url is the URL of the IdP issuer - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - *, - state: Literal[ - "SSO_CONFIGURATION_STATE_UNSPECIFIED", "SSO_CONFIGURATION_STATE_INACTIVE", "SSO_CONFIGURATION_STATE_ACTIVE" - ], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - UpdateSSOConfiguration updates the SSO configuration for the organization. + sso_configuration_id: sso_configuration_id is the ID of the SSO configuration to update - Args: state: state is the state of the SSO configuration extra_headers: Send extra headers @@ -662,35 +450,16 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @required_args(["client_id"], ["client_secret"], ["email_domain"], ["issuer_url"], ["state"]) - async def update( - self, - *, - client_id: str | NotGiven = NOT_GIVEN, - client_secret: str | NotGiven = NOT_GIVEN, - email_domain: str | NotGiven = NOT_GIVEN, - issuer_url: str | NotGiven = NOT_GIVEN, - state: Literal[ - "SSO_CONFIGURATION_STATE_UNSPECIFIED", "SSO_CONFIGURATION_STATE_INACTIVE", "SSO_CONFIGURATION_STATE_ACTIVE" - ] - | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: return await self._post( "/gitpod.v1.OrganizationService/UpdateSSOConfiguration", body=await async_maybe_transform( { + "claims": claims, "client_id": client_id, "client_secret": client_secret, "email_domain": email_domain, "issuer_url": issuer_url, + "sso_configuration_id": sso_configuration_id, "state": state, }, sso_configuration_update_params.SSOConfigurationUpdateParams, @@ -714,7 +483,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[SSOConfigurationListResponse, AsyncSSOConfigurationsPage[SSOConfigurationListResponse]]: + ) -> AsyncPaginator[SSOConfiguration, AsyncSSOConfigurationsPage[SSOConfiguration]]: """ ListSSOConfigurations lists all SSO configurations matching provided filters. @@ -731,7 +500,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.OrganizationService/ListSSOConfigurations", - page=AsyncSSOConfigurationsPage[SSOConfigurationListResponse], + page=AsyncSSOConfigurationsPage[SSOConfiguration], body=maybe_transform( { "organization_id": organization_id, @@ -752,7 +521,7 @@ def list( sso_configuration_list_params.SSOConfigurationListParams, ), ), - model=SSOConfigurationListResponse, + model=SSOConfiguration, method="post", ) diff --git a/src/gitpod/resources/projects/policies.py b/src/gitpod/resources/projects/policies.py index 5c51df7..b856a2d 100644 --- a/src/gitpod/resources/projects/policies.py +++ b/src/gitpod/resources/projects/policies.py @@ -2,8 +2,6 @@ from __future__ import annotations -from typing_extensions import Literal - import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven @@ -21,8 +19,15 @@ ) from ...pagination import SyncPoliciesPage, AsyncPoliciesPage from ..._base_client import AsyncPaginator, make_request_options -from ...types.projects import policy_list_params, policy_create_params, policy_delete_params, policy_update_params -from ...types.projects.policy_list_response import PolicyListResponse +from ...types.projects import ( + ProjectRole, + policy_list_params, + policy_create_params, + policy_delete_params, + policy_update_params, +) +from ...types.projects.project_role import ProjectRole +from ...types.projects.project_policy import ProjectPolicy from ...types.projects.policy_create_response import PolicyCreateResponse from ...types.projects.policy_update_response import PolicyUpdateResponse @@ -54,7 +59,7 @@ def create( *, group_id: str | NotGiven = NOT_GIVEN, project_id: str | NotGiven = NOT_GIVEN, - role: Literal["PROJECT_ROLE_UNSPECIFIED", "PROJECT_ROLE_ADMIN", "PROJECT_ROLE_USER"] | NotGiven = NOT_GIVEN, + role: ProjectRole | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -99,7 +104,7 @@ def update( *, group_id: str | NotGiven = NOT_GIVEN, project_id: str | NotGiven = NOT_GIVEN, - role: Literal["PROJECT_ROLE_UNSPECIFIED", "PROJECT_ROLE_ADMIN", "PROJECT_ROLE_USER"] | NotGiven = NOT_GIVEN, + role: ProjectRole | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -152,7 +157,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncPoliciesPage[PolicyListResponse]: + ) -> SyncPoliciesPage[ProjectPolicy]: """ ListProjectPolicies lists policies for a project. @@ -171,7 +176,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.ProjectService/ListProjectPolicies", - page=SyncPoliciesPage[PolicyListResponse], + page=SyncPoliciesPage[ProjectPolicy], body=maybe_transform( { "pagination": pagination, @@ -192,7 +197,7 @@ def list( policy_list_params.PolicyListParams, ), ), - model=PolicyListResponse, + model=ProjectPolicy, method="post", ) @@ -265,7 +270,7 @@ async def create( *, group_id: str | NotGiven = NOT_GIVEN, project_id: str | NotGiven = NOT_GIVEN, - role: Literal["PROJECT_ROLE_UNSPECIFIED", "PROJECT_ROLE_ADMIN", "PROJECT_ROLE_USER"] | NotGiven = NOT_GIVEN, + role: ProjectRole | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -310,7 +315,7 @@ async def update( *, group_id: str | NotGiven = NOT_GIVEN, project_id: str | NotGiven = NOT_GIVEN, - role: Literal["PROJECT_ROLE_UNSPECIFIED", "PROJECT_ROLE_ADMIN", "PROJECT_ROLE_USER"] | NotGiven = NOT_GIVEN, + role: ProjectRole | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -363,7 +368,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[PolicyListResponse, AsyncPoliciesPage[PolicyListResponse]]: + ) -> AsyncPaginator[ProjectPolicy, AsyncPoliciesPage[ProjectPolicy]]: """ ListProjectPolicies lists policies for a project. @@ -382,7 +387,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.ProjectService/ListProjectPolicies", - page=AsyncPoliciesPage[PolicyListResponse], + page=AsyncPoliciesPage[ProjectPolicy], body=maybe_transform( { "pagination": pagination, @@ -403,7 +408,7 @@ def list( policy_list_params.PolicyListParams, ), ), - model=PolicyListResponse, + model=ProjectPolicy, method="post", ) diff --git a/src/gitpod/resources/projects/projects.py b/src/gitpod/resources/projects/projects.py index a87ec1a..0857162 100644 --- a/src/gitpod/resources/projects/projects.py +++ b/src/gitpod/resources/projects/projects.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing_extensions import overload +from typing import Optional import httpx @@ -16,7 +16,6 @@ ) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( - required_args, maybe_transform, async_maybe_transform, ) @@ -38,10 +37,12 @@ ) from ...pagination import SyncProjectsPage, AsyncProjectsPage from ..._base_client import AsyncPaginator, make_request_options -from ...types.project_list_response import ProjectListResponse +from ...types.project import Project from ...types.project_create_response import ProjectCreateResponse from ...types.project_update_response import ProjectUpdateResponse from ...types.project_retrieve_response import ProjectRetrieveResponse +from ...types.environment_initializer_param import EnvironmentInitializerParam +from ...types.project_environment_class_param import ProjectEnvironmentClassParam from ...types.project_create_from_environment_response import ProjectCreateFromEnvironmentResponse __all__ = ["ProjectsResource", "AsyncProjectsResource"] @@ -74,8 +75,8 @@ def with_streaming_response(self) -> ProjectsResourceWithStreamingResponse: def create( self, *, - environment_class: project_create_params.EnvironmentClass, - initializer: project_create_params.Initializer, + environment_class: ProjectEnvironmentClassParam, + initializer: EnvironmentInitializerParam, automations_file_path: str | NotGiven = NOT_GIVEN, devcontainer_file_path: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, @@ -166,11 +167,15 @@ def retrieve( cast_to=ProjectRetrieveResponse, ) - @overload def update( self, *, - automations_file_path: str, + automations_file_path: Optional[str] | NotGiven = NOT_GIVEN, + devcontainer_file_path: Optional[str] | NotGiven = NOT_GIVEN, + environment_class: Optional[ProjectEnvironmentClassParam] | NotGiven = NOT_GIVEN, + initializer: Optional[EnvironmentInitializerParam] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, + project_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -189,32 +194,6 @@ def update( this.matches("^$|^[^/].*") ``` - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def update( - self, - *, - devcontainer_file_path: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectUpdateResponse: - """ - UpdateProject updates the properties of a Project. - - Args: devcontainer_file_path: devcontainer_file_path is the path to the devcontainer file relative to the repo root path must not be absolute (start with a /): @@ -222,86 +201,10 @@ def update( this.matches("^$|^[^/].*") ``` - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def update( - self, - *, - environment_class: project_update_params.Variant2EnvironmentClass, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectUpdateResponse: - """ - UpdateProject updates the properties of a Project. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def update( - self, - *, - initializer: project_update_params.InitializerIsTheContentInitializerInitializer, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectUpdateResponse: - """ - UpdateProject updates the properties of a Project. - - Args: initializer: EnvironmentInitializer specifies how an environment is to be initialized - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def update( - self, - *, - name: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectUpdateResponse: - """ - UpdateProject updates the properties of a Project. + project_id: project_id specifies the project identifier - Args: extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -310,26 +213,6 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @required_args( - ["automations_file_path"], ["devcontainer_file_path"], ["environment_class"], ["initializer"], ["name"] - ) - def update( - self, - *, - automations_file_path: str | NotGiven = NOT_GIVEN, - devcontainer_file_path: str | NotGiven = NOT_GIVEN, - environment_class: project_update_params.Variant2EnvironmentClass | NotGiven = NOT_GIVEN, - initializer: project_update_params.InitializerIsTheContentInitializerInitializer | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectUpdateResponse: return self._post( "/gitpod.v1.ProjectService/UpdateProject", body=maybe_transform( @@ -339,6 +222,7 @@ def update( "environment_class": environment_class, "initializer": initializer, "name": name, + "project_id": project_id, }, project_update_params.ProjectUpdateParams, ), @@ -360,7 +244,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncProjectsPage[ProjectListResponse]: + ) -> SyncProjectsPage[Project]: """ ListProjects lists all projects the caller has access to. @@ -377,7 +261,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.ProjectService/ListProjects", - page=SyncProjectsPage[ProjectListResponse], + page=SyncProjectsPage[Project], body=maybe_transform({"pagination": pagination}, project_list_params.ProjectListParams), options=make_request_options( extra_headers=extra_headers, @@ -392,7 +276,7 @@ def list( project_list_params.ProjectListParams, ), ), - model=ProjectListResponse, + model=Project, method="post", ) @@ -499,8 +383,8 @@ def with_streaming_response(self) -> AsyncProjectsResourceWithStreamingResponse: async def create( self, *, - environment_class: project_create_params.EnvironmentClass, - initializer: project_create_params.Initializer, + environment_class: ProjectEnvironmentClassParam, + initializer: EnvironmentInitializerParam, automations_file_path: str | NotGiven = NOT_GIVEN, devcontainer_file_path: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, @@ -591,11 +475,15 @@ async def retrieve( cast_to=ProjectRetrieveResponse, ) - @overload async def update( self, *, - automations_file_path: str, + automations_file_path: Optional[str] | NotGiven = NOT_GIVEN, + devcontainer_file_path: Optional[str] | NotGiven = NOT_GIVEN, + environment_class: Optional[ProjectEnvironmentClassParam] | NotGiven = NOT_GIVEN, + initializer: Optional[EnvironmentInitializerParam] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, + project_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -614,32 +502,6 @@ async def update( this.matches("^$|^[^/].*") ``` - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - *, - devcontainer_file_path: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectUpdateResponse: - """ - UpdateProject updates the properties of a Project. - - Args: devcontainer_file_path: devcontainer_file_path is the path to the devcontainer file relative to the repo root path must not be absolute (start with a /): @@ -647,86 +509,10 @@ async def update( this.matches("^$|^[^/].*") ``` - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - *, - environment_class: project_update_params.Variant2EnvironmentClass, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectUpdateResponse: - """ - UpdateProject updates the properties of a Project. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - *, - initializer: project_update_params.InitializerIsTheContentInitializerInitializer, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectUpdateResponse: - """ - UpdateProject updates the properties of a Project. - - Args: initializer: EnvironmentInitializer specifies how an environment is to be initialized - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - *, - name: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectUpdateResponse: - """ - UpdateProject updates the properties of a Project. + project_id: project_id specifies the project identifier - Args: extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -735,26 +521,6 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @required_args( - ["automations_file_path"], ["devcontainer_file_path"], ["environment_class"], ["initializer"], ["name"] - ) - async def update( - self, - *, - automations_file_path: str | NotGiven = NOT_GIVEN, - devcontainer_file_path: str | NotGiven = NOT_GIVEN, - environment_class: project_update_params.Variant2EnvironmentClass | NotGiven = NOT_GIVEN, - initializer: project_update_params.InitializerIsTheContentInitializerInitializer | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectUpdateResponse: return await self._post( "/gitpod.v1.ProjectService/UpdateProject", body=await async_maybe_transform( @@ -764,6 +530,7 @@ async def update( "environment_class": environment_class, "initializer": initializer, "name": name, + "project_id": project_id, }, project_update_params.ProjectUpdateParams, ), @@ -785,7 +552,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ProjectListResponse, AsyncProjectsPage[ProjectListResponse]]: + ) -> AsyncPaginator[Project, AsyncProjectsPage[Project]]: """ ListProjects lists all projects the caller has access to. @@ -802,7 +569,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.ProjectService/ListProjects", - page=AsyncProjectsPage[ProjectListResponse], + page=AsyncProjectsPage[Project], body=maybe_transform({"pagination": pagination}, project_list_params.ProjectListParams), options=make_request_options( extra_headers=extra_headers, @@ -817,7 +584,7 @@ def list( project_list_params.ProjectListParams, ), ), - model=ProjectListResponse, + model=Project, method="post", ) diff --git a/src/gitpod/resources/runners/configurations/configurations.py b/src/gitpod/resources/runners/configurations/configurations.py index a9a8500..68b2e38 100644 --- a/src/gitpod/resources/runners/configurations/configurations.py +++ b/src/gitpod/resources/runners/configurations/configurations.py @@ -2,9 +2,6 @@ from __future__ import annotations -from typing import Any, cast -from typing_extensions import overload - import httpx from .schema import ( @@ -17,7 +14,6 @@ ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( - required_args, maybe_transform, async_maybe_transform, ) @@ -55,6 +51,7 @@ HostAuthenticationTokensResourceWithStreamingResponse, AsyncHostAuthenticationTokensResourceWithStreamingResponse, ) +from ....types.shared_params.environment_class import EnvironmentClass from ....types.runners.configuration_validate_response import ConfigurationValidateResponse __all__ = ["ConfigurationsResource", "AsyncConfigurationsResource"] @@ -96,41 +93,12 @@ def with_streaming_response(self) -> ConfigurationsResourceWithStreamingResponse """ return ConfigurationsResourceWithStreamingResponse(self) - @overload - def validate( - self, - *, - environment_class: configuration_validate_params.Variant0EnvironmentClass, - runner_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ConfigurationValidateResponse: - """ValidateRunnerConfiguration validates a runner configuration (e.g. - - environment - class, SCM integration) with the runner. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload def validate( self, *, - scm_integration: configuration_validate_params.Variant1ScmIntegration, + environment_class: EnvironmentClass | NotGiven = NOT_GIVEN, runner_id: str | NotGiven = NOT_GIVEN, + scm_integration: configuration_validate_params.ScmIntegration | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -152,41 +120,20 @@ def validate( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @required_args(["environment_class"], ["scm_integration"]) - def validate( - self, - *, - environment_class: configuration_validate_params.Variant0EnvironmentClass | NotGiven = NOT_GIVEN, - runner_id: str | NotGiven = NOT_GIVEN, - scm_integration: configuration_validate_params.Variant1ScmIntegration | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ConfigurationValidateResponse: - return cast( - ConfigurationValidateResponse, - self._post( - "/gitpod.v1.RunnerConfigurationService/ValidateRunnerConfiguration", - body=maybe_transform( - { - "environment_class": environment_class, - "runner_id": runner_id, - "scm_integration": scm_integration, - }, - configuration_validate_params.ConfigurationValidateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=cast( - Any, ConfigurationValidateResponse - ), # Union types cannot be passed in as arguments in the type system + return self._post( + "/gitpod.v1.RunnerConfigurationService/ValidateRunnerConfiguration", + body=maybe_transform( + { + "environment_class": environment_class, + "runner_id": runner_id, + "scm_integration": scm_integration, + }, + configuration_validate_params.ConfigurationValidateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=ConfigurationValidateResponse, ) @@ -226,12 +173,12 @@ def with_streaming_response(self) -> AsyncConfigurationsResourceWithStreamingRes """ return AsyncConfigurationsResourceWithStreamingResponse(self) - @overload async def validate( self, *, - environment_class: configuration_validate_params.Variant0EnvironmentClass, + environment_class: EnvironmentClass | NotGiven = NOT_GIVEN, runner_id: str | NotGiven = NOT_GIVEN, + scm_integration: configuration_validate_params.ScmIntegration | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -253,70 +200,20 @@ async def validate( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @overload - async def validate( - self, - *, - scm_integration: configuration_validate_params.Variant1ScmIntegration, - runner_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ConfigurationValidateResponse: - """ValidateRunnerConfiguration validates a runner configuration (e.g. - - environment - class, SCM integration) with the runner. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @required_args(["environment_class"], ["scm_integration"]) - async def validate( - self, - *, - environment_class: configuration_validate_params.Variant0EnvironmentClass | NotGiven = NOT_GIVEN, - runner_id: str | NotGiven = NOT_GIVEN, - scm_integration: configuration_validate_params.Variant1ScmIntegration | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ConfigurationValidateResponse: - return cast( - ConfigurationValidateResponse, - await self._post( - "/gitpod.v1.RunnerConfigurationService/ValidateRunnerConfiguration", - body=await async_maybe_transform( - { - "environment_class": environment_class, - "runner_id": runner_id, - "scm_integration": scm_integration, - }, - configuration_validate_params.ConfigurationValidateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=cast( - Any, ConfigurationValidateResponse - ), # Union types cannot be passed in as arguments in the type system + return await self._post( + "/gitpod.v1.RunnerConfigurationService/ValidateRunnerConfiguration", + body=await async_maybe_transform( + { + "environment_class": environment_class, + "runner_id": runner_id, + "scm_integration": scm_integration, + }, + configuration_validate_params.ConfigurationValidateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=ConfigurationValidateResponse, ) diff --git a/src/gitpod/resources/runners/configurations/environment_classes.py b/src/gitpod/resources/runners/configurations/environment_classes.py index 8594abc..5c41695 100644 --- a/src/gitpod/resources/runners/configurations/environment_classes.py +++ b/src/gitpod/resources/runners/configurations/environment_classes.py @@ -2,14 +2,12 @@ from __future__ import annotations -from typing import Iterable -from typing_extensions import overload +from typing import Iterable, Optional import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( - required_args, maybe_transform, async_maybe_transform, ) @@ -29,7 +27,8 @@ environment_class_update_params, environment_class_retrieve_params, ) -from ....types.runners.configurations.environment_class_list_response import EnvironmentClassListResponse +from ....types.shared.environment_class import EnvironmentClass +from ....types.shared_params.field_value import FieldValue from ....types.runners.configurations.environment_class_create_response import EnvironmentClassCreateResponse from ....types.runners.configurations.environment_class_retrieve_response import EnvironmentClassRetrieveResponse @@ -59,7 +58,7 @@ def with_streaming_response(self) -> EnvironmentClassesResourceWithStreamingResp def create( self, *, - configuration: Iterable[environment_class_create_params.Configuration] | NotGiven = NOT_GIVEN, + configuration: Iterable[FieldValue] | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, display_name: str | NotGiven = NOT_GIVEN, runner_id: str | NotGiven = NOT_GIVEN, @@ -134,63 +133,13 @@ def retrieve( cast_to=EnvironmentClassRetrieveResponse, ) - @overload def update( self, *, - description: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - UpdateEnvironmentClass updates an existing environment class on a runner. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def update( - self, - *, - display_name: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - UpdateEnvironmentClass updates an existing environment class on a runner. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def update( - self, - *, - enabled: bool, + description: Optional[str] | NotGiven = NOT_GIVEN, + display_name: Optional[str] | NotGiven = NOT_GIVEN, + enabled: Optional[bool] | NotGiven = NOT_GIVEN, + environment_class_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -210,22 +159,6 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @required_args(["description"], ["display_name"], ["enabled"]) - def update( - self, - *, - description: str | NotGiven = NOT_GIVEN, - display_name: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: return self._post( "/gitpod.v1.RunnerConfigurationService/UpdateEnvironmentClass", body=maybe_transform( @@ -233,6 +166,7 @@ def update( "description": description, "display_name": display_name, "enabled": enabled, + "environment_class_id": environment_class_id, }, environment_class_update_params.EnvironmentClassUpdateParams, ), @@ -255,7 +189,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncEnvironmentClassesPage[EnvironmentClassListResponse]: + ) -> SyncEnvironmentClassesPage[EnvironmentClass]: """ ListEnvironmentClasses returns all environment classes configured for a runner. buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE @@ -273,7 +207,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.RunnerConfigurationService/ListEnvironmentClasses", - page=SyncEnvironmentClassesPage[EnvironmentClassListResponse], + page=SyncEnvironmentClassesPage[EnvironmentClass], body=maybe_transform( { "filter": filter, @@ -294,7 +228,7 @@ def list( environment_class_list_params.EnvironmentClassListParams, ), ), - model=EnvironmentClassListResponse, + model=EnvironmentClass, method="post", ) @@ -322,7 +256,7 @@ def with_streaming_response(self) -> AsyncEnvironmentClassesResourceWithStreamin async def create( self, *, - configuration: Iterable[environment_class_create_params.Configuration] | NotGiven = NOT_GIVEN, + configuration: Iterable[FieldValue] | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, display_name: str | NotGiven = NOT_GIVEN, runner_id: str | NotGiven = NOT_GIVEN, @@ -397,63 +331,13 @@ async def retrieve( cast_to=EnvironmentClassRetrieveResponse, ) - @overload async def update( self, *, - description: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - UpdateEnvironmentClass updates an existing environment class on a runner. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - *, - display_name: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - UpdateEnvironmentClass updates an existing environment class on a runner. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - *, - enabled: bool, + description: Optional[str] | NotGiven = NOT_GIVEN, + display_name: Optional[str] | NotGiven = NOT_GIVEN, + enabled: Optional[bool] | NotGiven = NOT_GIVEN, + environment_class_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -473,22 +357,6 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @required_args(["description"], ["display_name"], ["enabled"]) - async def update( - self, - *, - description: str | NotGiven = NOT_GIVEN, - display_name: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: return await self._post( "/gitpod.v1.RunnerConfigurationService/UpdateEnvironmentClass", body=await async_maybe_transform( @@ -496,6 +364,7 @@ async def update( "description": description, "display_name": display_name, "enabled": enabled, + "environment_class_id": environment_class_id, }, environment_class_update_params.EnvironmentClassUpdateParams, ), @@ -518,7 +387,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[EnvironmentClassListResponse, AsyncEnvironmentClassesPage[EnvironmentClassListResponse]]: + ) -> AsyncPaginator[EnvironmentClass, AsyncEnvironmentClassesPage[EnvironmentClass]]: """ ListEnvironmentClasses returns all environment classes configured for a runner. buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE @@ -536,7 +405,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.RunnerConfigurationService/ListEnvironmentClasses", - page=AsyncEnvironmentClassesPage[EnvironmentClassListResponse], + page=AsyncEnvironmentClassesPage[EnvironmentClass], body=maybe_transform( { "filter": filter, @@ -557,7 +426,7 @@ def list( environment_class_list_params.EnvironmentClassListParams, ), ), - model=EnvironmentClassListResponse, + model=EnvironmentClass, method="post", ) diff --git a/src/gitpod/resources/runners/configurations/host_authentication_tokens.py b/src/gitpod/resources/runners/configurations/host_authentication_tokens.py index b12a760..74bb251 100644 --- a/src/gitpod/resources/runners/configurations/host_authentication_tokens.py +++ b/src/gitpod/resources/runners/configurations/host_authentication_tokens.py @@ -2,15 +2,13 @@ from __future__ import annotations -from typing import Union +from typing import Union, Optional from datetime import datetime -from typing_extensions import Literal, overload import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( - required_args, maybe_transform, async_maybe_transform, ) @@ -25,13 +23,15 @@ from ....pagination import SyncTokensPage, AsyncTokensPage from ...._base_client import AsyncPaginator, make_request_options from ....types.runners.configurations import ( + HostAuthenticationTokenSource, host_authentication_token_list_params, host_authentication_token_create_params, host_authentication_token_delete_params, host_authentication_token_update_params, host_authentication_token_retrieve_params, ) -from ....types.runners.configurations.host_authentication_token_list_response import HostAuthenticationTokenListResponse +from ....types.runners.configurations.host_authentication_token import HostAuthenticationToken +from ....types.runners.configurations.host_authentication_token_source import HostAuthenticationTokenSource from ....types.runners.configurations.host_authentication_token_create_response import ( HostAuthenticationTokenCreateResponse, ) @@ -70,12 +70,7 @@ def create( host: str | NotGiven = NOT_GIVEN, refresh_token: str | NotGiven = NOT_GIVEN, runner_id: str | NotGiven = NOT_GIVEN, - source: Literal[ - "HOST_AUTHENTICATION_TOKEN_SOURCE_UNSPECIFIED", - "HOST_AUTHENTICATION_TOKEN_SOURCE_OAUTH", - "HOST_AUTHENTICATION_TOKEN_SOURCE_PAT", - ] - | NotGiven = NOT_GIVEN, + source: HostAuthenticationTokenSource | NotGiven = NOT_GIVEN, user_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -239,11 +234,13 @@ def retrieve( cast_to=HostAuthenticationTokenRetrieveResponse, ) - @overload def update( self, *, - expires_at: Union[str, datetime], + id: str | NotGiven = NOT_GIVEN, + token: Optional[str] | NotGiven = NOT_GIVEN, + expires_at: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + refresh_token: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -352,81 +349,14 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @overload - def update( - self, - *, - refresh_token: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - UpdateHostAuthenticationToken - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def update( - self, - *, - token: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - UpdateHostAuthenticationToken - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @required_args(["expires_at"], ["refresh_token"], ["token"]) - def update( - self, - *, - expires_at: Union[str, datetime] | NotGiven = NOT_GIVEN, - refresh_token: str | NotGiven = NOT_GIVEN, - token: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: return self._post( "/gitpod.v1.RunnerConfigurationService/UpdateHostAuthenticationToken", body=maybe_transform( { + "id": id, + "token": token, "expires_at": expires_at, "refresh_token": refresh_token, - "token": token, }, host_authentication_token_update_params.HostAuthenticationTokenUpdateParams, ), @@ -449,7 +379,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncTokensPage[HostAuthenticationTokenListResponse]: + ) -> SyncTokensPage[HostAuthenticationToken]: """ ListHostAuthenticationTokens @@ -464,7 +394,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.RunnerConfigurationService/ListHostAuthenticationTokens", - page=SyncTokensPage[HostAuthenticationTokenListResponse], + page=SyncTokensPage[HostAuthenticationToken], body=maybe_transform( { "filter": filter, @@ -485,7 +415,7 @@ def list( host_authentication_token_list_params.HostAuthenticationTokenListParams, ), ), - model=HostAuthenticationTokenListResponse, + model=HostAuthenticationToken, method="post", ) @@ -552,12 +482,7 @@ async def create( host: str | NotGiven = NOT_GIVEN, refresh_token: str | NotGiven = NOT_GIVEN, runner_id: str | NotGiven = NOT_GIVEN, - source: Literal[ - "HOST_AUTHENTICATION_TOKEN_SOURCE_UNSPECIFIED", - "HOST_AUTHENTICATION_TOKEN_SOURCE_OAUTH", - "HOST_AUTHENTICATION_TOKEN_SOURCE_PAT", - ] - | NotGiven = NOT_GIVEN, + source: HostAuthenticationTokenSource | NotGiven = NOT_GIVEN, user_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -721,11 +646,13 @@ async def retrieve( cast_to=HostAuthenticationTokenRetrieveResponse, ) - @overload async def update( self, *, - expires_at: Union[str, datetime], + id: str | NotGiven = NOT_GIVEN, + token: Optional[str] | NotGiven = NOT_GIVEN, + expires_at: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + refresh_token: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -834,81 +761,14 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @overload - async def update( - self, - *, - refresh_token: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - UpdateHostAuthenticationToken - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - *, - token: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - UpdateHostAuthenticationToken - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @required_args(["expires_at"], ["refresh_token"], ["token"]) - async def update( - self, - *, - expires_at: Union[str, datetime] | NotGiven = NOT_GIVEN, - refresh_token: str | NotGiven = NOT_GIVEN, - token: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: return await self._post( "/gitpod.v1.RunnerConfigurationService/UpdateHostAuthenticationToken", body=await async_maybe_transform( { + "id": id, + "token": token, "expires_at": expires_at, "refresh_token": refresh_token, - "token": token, }, host_authentication_token_update_params.HostAuthenticationTokenUpdateParams, ), @@ -931,7 +791,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[HostAuthenticationTokenListResponse, AsyncTokensPage[HostAuthenticationTokenListResponse]]: + ) -> AsyncPaginator[HostAuthenticationToken, AsyncTokensPage[HostAuthenticationToken]]: """ ListHostAuthenticationTokens @@ -946,7 +806,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.RunnerConfigurationService/ListHostAuthenticationTokens", - page=AsyncTokensPage[HostAuthenticationTokenListResponse], + page=AsyncTokensPage[HostAuthenticationToken], body=maybe_transform( { "filter": filter, @@ -967,7 +827,7 @@ def list( host_authentication_token_list_params.HostAuthenticationTokenListParams, ), ), - model=HostAuthenticationTokenListResponse, + model=HostAuthenticationToken, method="post", ) diff --git a/src/gitpod/resources/runners/configurations/scm_integrations.py b/src/gitpod/resources/runners/configurations/scm_integrations.py index a7be1d2..36a4bbc 100644 --- a/src/gitpod/resources/runners/configurations/scm_integrations.py +++ b/src/gitpod/resources/runners/configurations/scm_integrations.py @@ -2,13 +2,12 @@ from __future__ import annotations -from typing_extensions import overload +from typing import Optional import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( - required_args, maybe_transform, async_maybe_transform, ) @@ -29,7 +28,7 @@ scm_integration_update_params, scm_integration_retrieve_params, ) -from ....types.runners.configurations.scm_integration_list_response import ScmIntegrationListResponse +from ....types.runners.configurations.scm_integration import ScmIntegration from ....types.runners.configurations.scm_integration_create_response import ScmIntegrationCreateResponse from ....types.runners.configurations.scm_integration_retrieve_response import ScmIntegrationRetrieveResponse @@ -56,11 +55,15 @@ def with_streaming_response(self) -> ScmIntegrationsResourceWithStreamingRespons """ return ScmIntegrationsResourceWithStreamingResponse(self) - @overload def create( self, *, - oauth_client_id: str, + host: str | NotGiven = NOT_GIVEN, + oauth_client_id: Optional[str] | NotGiven = NOT_GIVEN, + oauth_plaintext_client_secret: Optional[str] | NotGiven = NOT_GIVEN, + pat: bool | NotGiven = NOT_GIVEN, + runner_id: str | NotGiven = NOT_GIVEN, + scm_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -75,35 +78,12 @@ def create( oauth_client_id: oauth_client_id is the OAuth app's client ID, if OAuth is configured. If configured, oauth_plaintext_client_secret must also be set. - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def create( - self, - *, - oauth_plaintext_client_secret: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScmIntegrationCreateResponse: - """ - CreateSCMIntegration creates a new SCM integration on a runner. - - Args: oauth_plaintext_client_secret: oauth_plaintext_client_secret is the OAuth app's client secret in clear text. This will first be encrypted with the runner's public key before being stored. + scm_id: scm_id references the scm_id in the runner's configuration schema that this + integration is for + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -112,27 +92,16 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @required_args(["oauth_client_id"], ["oauth_plaintext_client_secret"]) - def create( - self, - *, - oauth_client_id: str | NotGiven = NOT_GIVEN, - oauth_plaintext_client_secret: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScmIntegrationCreateResponse: return self._post( "/gitpod.v1.RunnerConfigurationService/CreateSCMIntegration", body=maybe_transform( { + "host": host, "oauth_client_id": oauth_client_id, "oauth_plaintext_client_secret": oauth_plaintext_client_secret, + "pat": pat, + "runner_id": runner_id, + "scm_id": scm_id, }, scm_integration_create_params.ScmIntegrationCreateParams, ), @@ -174,11 +143,13 @@ def retrieve( cast_to=ScmIntegrationRetrieveResponse, ) - @overload def update( self, *, - oauth_client_id: str, + id: str | NotGiven = NOT_GIVEN, + oauth_client_id: Optional[str] | NotGiven = NOT_GIVEN, + oauth_plaintext_client_secret: Optional[str] | NotGiven = NOT_GIVEN, + pat: Optional[bool] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -197,62 +168,10 @@ def update( deleted. This might lead to users being unable to access their repositories until they re-authenticate. - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def update( - self, - *, - oauth_plaintext_client_secret: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - UpdateSCMIntegration updates an existing SCM integration on a runner. - - Args: oauth_plaintext_client_secret: oauth_plaintext_client_secret can be set to update the OAuth app's client secret. The cleartext secret will be encrypted with the runner's public key before being stored. - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def update( - self, - *, - pat: bool, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - UpdateSCMIntegration updates an existing SCM integration on a runner. - - Args: pat: pat can be set to enable or disable Personal Access Tokens support. When disabling PATs, any existing Host Authentication Tokens for the SCM integration's runner and host that were created using a PAT will be deleted. @@ -267,26 +186,11 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @required_args(["oauth_client_id"], ["oauth_plaintext_client_secret"], ["pat"]) - def update( - self, - *, - oauth_client_id: str | NotGiven = NOT_GIVEN, - oauth_plaintext_client_secret: str | NotGiven = NOT_GIVEN, - pat: bool | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: return self._post( "/gitpod.v1.RunnerConfigurationService/UpdateSCMIntegration", body=maybe_transform( { + "id": id, "oauth_client_id": oauth_client_id, "oauth_plaintext_client_secret": oauth_plaintext_client_secret, "pat": pat, @@ -312,7 +216,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncIntegrationsPage[ScmIntegrationListResponse]: + ) -> SyncIntegrationsPage[ScmIntegration]: """ ListSCMIntegrations returns all SCM integrations configured for a runner. @@ -329,7 +233,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.RunnerConfigurationService/ListSCMIntegrations", - page=SyncIntegrationsPage[ScmIntegrationListResponse], + page=SyncIntegrationsPage[ScmIntegration], body=maybe_transform( { "filter": filter, @@ -350,7 +254,7 @@ def list( scm_integration_list_params.ScmIntegrationListParams, ), ), - model=ScmIntegrationListResponse, + model=ScmIntegration, method="post", ) @@ -407,11 +311,15 @@ def with_streaming_response(self) -> AsyncScmIntegrationsResourceWithStreamingRe """ return AsyncScmIntegrationsResourceWithStreamingResponse(self) - @overload async def create( self, *, - oauth_client_id: str, + host: str | NotGiven = NOT_GIVEN, + oauth_client_id: Optional[str] | NotGiven = NOT_GIVEN, + oauth_plaintext_client_secret: Optional[str] | NotGiven = NOT_GIVEN, + pat: bool | NotGiven = NOT_GIVEN, + runner_id: str | NotGiven = NOT_GIVEN, + scm_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -426,35 +334,12 @@ async def create( oauth_client_id: oauth_client_id is the OAuth app's client ID, if OAuth is configured. If configured, oauth_plaintext_client_secret must also be set. - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def create( - self, - *, - oauth_plaintext_client_secret: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScmIntegrationCreateResponse: - """ - CreateSCMIntegration creates a new SCM integration on a runner. - - Args: oauth_plaintext_client_secret: oauth_plaintext_client_secret is the OAuth app's client secret in clear text. This will first be encrypted with the runner's public key before being stored. + scm_id: scm_id references the scm_id in the runner's configuration schema that this + integration is for + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -463,27 +348,16 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @required_args(["oauth_client_id"], ["oauth_plaintext_client_secret"]) - async def create( - self, - *, - oauth_client_id: str | NotGiven = NOT_GIVEN, - oauth_plaintext_client_secret: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScmIntegrationCreateResponse: return await self._post( "/gitpod.v1.RunnerConfigurationService/CreateSCMIntegration", body=await async_maybe_transform( { + "host": host, "oauth_client_id": oauth_client_id, "oauth_plaintext_client_secret": oauth_plaintext_client_secret, + "pat": pat, + "runner_id": runner_id, + "scm_id": scm_id, }, scm_integration_create_params.ScmIntegrationCreateParams, ), @@ -525,11 +399,13 @@ async def retrieve( cast_to=ScmIntegrationRetrieveResponse, ) - @overload async def update( self, *, - oauth_client_id: str, + id: str | NotGiven = NOT_GIVEN, + oauth_client_id: Optional[str] | NotGiven = NOT_GIVEN, + oauth_plaintext_client_secret: Optional[str] | NotGiven = NOT_GIVEN, + pat: Optional[bool] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -548,62 +424,10 @@ async def update( deleted. This might lead to users being unable to access their repositories until they re-authenticate. - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - *, - oauth_plaintext_client_secret: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - UpdateSCMIntegration updates an existing SCM integration on a runner. - - Args: oauth_plaintext_client_secret: oauth_plaintext_client_secret can be set to update the OAuth app's client secret. The cleartext secret will be encrypted with the runner's public key before being stored. - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - *, - pat: bool, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - UpdateSCMIntegration updates an existing SCM integration on a runner. - - Args: pat: pat can be set to enable or disable Personal Access Tokens support. When disabling PATs, any existing Host Authentication Tokens for the SCM integration's runner and host that were created using a PAT will be deleted. @@ -618,26 +442,11 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @required_args(["oauth_client_id"], ["oauth_plaintext_client_secret"], ["pat"]) - async def update( - self, - *, - oauth_client_id: str | NotGiven = NOT_GIVEN, - oauth_plaintext_client_secret: str | NotGiven = NOT_GIVEN, - pat: bool | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: return await self._post( "/gitpod.v1.RunnerConfigurationService/UpdateSCMIntegration", body=await async_maybe_transform( { + "id": id, "oauth_client_id": oauth_client_id, "oauth_plaintext_client_secret": oauth_plaintext_client_secret, "pat": pat, @@ -663,7 +472,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ScmIntegrationListResponse, AsyncIntegrationsPage[ScmIntegrationListResponse]]: + ) -> AsyncPaginator[ScmIntegration, AsyncIntegrationsPage[ScmIntegration]]: """ ListSCMIntegrations returns all SCM integrations configured for a runner. @@ -680,7 +489,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.RunnerConfigurationService/ListSCMIntegrations", - page=AsyncIntegrationsPage[ScmIntegrationListResponse], + page=AsyncIntegrationsPage[ScmIntegration], body=maybe_transform( { "filter": filter, @@ -701,7 +510,7 @@ def list( scm_integration_list_params.ScmIntegrationListParams, ), ), - model=ScmIntegrationListResponse, + model=ScmIntegration, method="post", ) diff --git a/src/gitpod/resources/runners/policies.py b/src/gitpod/resources/runners/policies.py index c303ce4..28bd078 100644 --- a/src/gitpod/resources/runners/policies.py +++ b/src/gitpod/resources/runners/policies.py @@ -2,8 +2,6 @@ from __future__ import annotations -from typing_extensions import Literal - import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven @@ -21,8 +19,15 @@ ) from ...pagination import SyncPoliciesPage, AsyncPoliciesPage from ..._base_client import AsyncPaginator, make_request_options -from ...types.runners import policy_list_params, policy_create_params, policy_delete_params, policy_update_params -from ...types.runners.policy_list_response import PolicyListResponse +from ...types.runners import ( + RunnerRole, + policy_list_params, + policy_create_params, + policy_delete_params, + policy_update_params, +) +from ...types.runners.runner_role import RunnerRole +from ...types.runners.runner_policy import RunnerPolicy from ...types.runners.policy_create_response import PolicyCreateResponse from ...types.runners.policy_update_response import PolicyUpdateResponse @@ -53,7 +58,7 @@ def create( self, *, group_id: str | NotGiven = NOT_GIVEN, - role: Literal["RUNNER_ROLE_UNSPECIFIED", "RUNNER_ROLE_ADMIN", "RUNNER_ROLE_USER"] | NotGiven = NOT_GIVEN, + role: RunnerRole | NotGiven = NOT_GIVEN, runner_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -98,7 +103,7 @@ def update( self, *, group_id: str | NotGiven = NOT_GIVEN, - role: Literal["RUNNER_ROLE_UNSPECIFIED", "RUNNER_ROLE_ADMIN", "RUNNER_ROLE_USER"] | NotGiven = NOT_GIVEN, + role: RunnerRole | NotGiven = NOT_GIVEN, runner_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -152,7 +157,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncPoliciesPage[PolicyListResponse]: + ) -> SyncPoliciesPage[RunnerPolicy]: """ ListRunnerPolicies lists runner policies. @@ -171,7 +176,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.RunnerService/ListRunnerPolicies", - page=SyncPoliciesPage[PolicyListResponse], + page=SyncPoliciesPage[RunnerPolicy], body=maybe_transform( { "pagination": pagination, @@ -192,7 +197,7 @@ def list( policy_list_params.PolicyListParams, ), ), - model=PolicyListResponse, + model=RunnerPolicy, method="post", ) @@ -264,7 +269,7 @@ async def create( self, *, group_id: str | NotGiven = NOT_GIVEN, - role: Literal["RUNNER_ROLE_UNSPECIFIED", "RUNNER_ROLE_ADMIN", "RUNNER_ROLE_USER"] | NotGiven = NOT_GIVEN, + role: RunnerRole | NotGiven = NOT_GIVEN, runner_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -309,7 +314,7 @@ async def update( self, *, group_id: str | NotGiven = NOT_GIVEN, - role: Literal["RUNNER_ROLE_UNSPECIFIED", "RUNNER_ROLE_ADMIN", "RUNNER_ROLE_USER"] | NotGiven = NOT_GIVEN, + role: RunnerRole | NotGiven = NOT_GIVEN, runner_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -363,7 +368,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[PolicyListResponse, AsyncPoliciesPage[PolicyListResponse]]: + ) -> AsyncPaginator[RunnerPolicy, AsyncPoliciesPage[RunnerPolicy]]: """ ListRunnerPolicies lists runner policies. @@ -382,7 +387,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.RunnerService/ListRunnerPolicies", - page=AsyncPoliciesPage[PolicyListResponse], + page=AsyncPoliciesPage[RunnerPolicy], body=maybe_transform( { "pagination": pagination, @@ -403,7 +408,7 @@ def list( policy_list_params.PolicyListParams, ), ), - model=PolicyListResponse, + model=RunnerPolicy, method="post", ) diff --git a/src/gitpod/resources/runners/runners.py b/src/gitpod/resources/runners/runners.py index e41444a..1757c10 100644 --- a/src/gitpod/resources/runners/runners.py +++ b/src/gitpod/resources/runners/runners.py @@ -2,11 +2,13 @@ from __future__ import annotations -from typing_extensions import Literal, overload +from typing import Optional import httpx from ...types import ( + RunnerKind, + RunnerProvider, runner_list_params, runner_create_params, runner_delete_params, @@ -18,7 +20,6 @@ ) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( - required_args, maybe_transform, async_maybe_transform, ) @@ -40,7 +41,10 @@ ) from ...pagination import SyncRunnersPage, AsyncRunnersPage from ..._base_client import AsyncPaginator, make_request_options -from ...types.runner_list_response import RunnerListResponse +from ...types.runner import Runner +from ...types.runner_kind import RunnerKind +from ...types.runner_provider import RunnerProvider +from ...types.runner_spec_param import RunnerSpecParam from .configurations.configurations import ( ConfigurationsResource, AsyncConfigurationsResource, @@ -89,19 +93,10 @@ def with_streaming_response(self) -> RunnersResourceWithStreamingResponse: def create( self, *, - kind: Literal[ - "RUNNER_KIND_UNSPECIFIED", "RUNNER_KIND_LOCAL", "RUNNER_KIND_REMOTE", "RUNNER_KIND_LOCAL_CONFIGURATION" - ] - | NotGiven = NOT_GIVEN, + kind: RunnerKind | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, - provider: Literal[ - "RUNNER_PROVIDER_UNSPECIFIED", - "RUNNER_PROVIDER_AWS_EC2", - "RUNNER_PROVIDER_LINUX_HOST", - "RUNNER_PROVIDER_DESKTOP_MAC", - ] - | NotGiven = NOT_GIVEN, - spec: runner_create_params.Spec | NotGiven = NOT_GIVEN, + provider: RunnerProvider | NotGiven = NOT_GIVEN, + spec: RunnerSpecParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -181,11 +176,12 @@ def retrieve( cast_to=RunnerRetrieveResponse, ) - @overload def update( self, *, - name: str, + name: Optional[str] | NotGiven = NOT_GIVEN, + runner_id: str | NotGiven = NOT_GIVEN, + spec: Optional[runner_update_params.Spec] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -199,32 +195,10 @@ def update( Args: name: The runner's name which is shown to users - extra_headers: Send extra headers + runner_id: runner_id specifies which runner to be updated. - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request + +required - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def update( - self, - *, - spec: runner_update_params.Variant1Spec, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - UpdateRunner updates an environment runner. - - Args: extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -233,26 +207,12 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @required_args(["name"], ["spec"]) - def update( - self, - *, - name: str | NotGiven = NOT_GIVEN, - spec: runner_update_params.Variant1Spec | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: return self._post( "/gitpod.v1.RunnerService/UpdateRunner", body=maybe_transform( { "name": name, + "runner_id": runner_id, "spec": spec, }, runner_update_params.RunnerUpdateParams, @@ -276,7 +236,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncRunnersPage[RunnerListResponse]: + ) -> SyncRunnersPage[Runner]: """ ListRunners returns all runners registered in the scope. @@ -293,7 +253,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.RunnerService/ListRunners", - page=SyncRunnersPage[RunnerListResponse], + page=SyncRunnersPage[Runner], body=maybe_transform( { "filter": filter, @@ -314,7 +274,7 @@ def list( runner_list_params.RunnerListParams, ), ), - model=RunnerListResponse, + model=Runner, method="post", ) @@ -419,7 +379,7 @@ def create_runner_token( runner. Use this call to renew an outdated token - this does not expire any - previouly issued tokens. + previously issued tokens. Args: extra_headers: Send extra headers @@ -523,19 +483,10 @@ def with_streaming_response(self) -> AsyncRunnersResourceWithStreamingResponse: async def create( self, *, - kind: Literal[ - "RUNNER_KIND_UNSPECIFIED", "RUNNER_KIND_LOCAL", "RUNNER_KIND_REMOTE", "RUNNER_KIND_LOCAL_CONFIGURATION" - ] - | NotGiven = NOT_GIVEN, + kind: RunnerKind | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, - provider: Literal[ - "RUNNER_PROVIDER_UNSPECIFIED", - "RUNNER_PROVIDER_AWS_EC2", - "RUNNER_PROVIDER_LINUX_HOST", - "RUNNER_PROVIDER_DESKTOP_MAC", - ] - | NotGiven = NOT_GIVEN, - spec: runner_create_params.Spec | NotGiven = NOT_GIVEN, + provider: RunnerProvider | NotGiven = NOT_GIVEN, + spec: RunnerSpecParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -615,11 +566,12 @@ async def retrieve( cast_to=RunnerRetrieveResponse, ) - @overload async def update( self, *, - name: str, + name: Optional[str] | NotGiven = NOT_GIVEN, + runner_id: str | NotGiven = NOT_GIVEN, + spec: Optional[runner_update_params.Spec] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -633,32 +585,10 @@ async def update( Args: name: The runner's name which is shown to users - extra_headers: Send extra headers + runner_id: runner_id specifies which runner to be updated. - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request + +required - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def update( - self, - *, - spec: runner_update_params.Variant1Spec, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - UpdateRunner updates an environment runner. - - Args: extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -667,26 +597,12 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @required_args(["name"], ["spec"]) - async def update( - self, - *, - name: str | NotGiven = NOT_GIVEN, - spec: runner_update_params.Variant1Spec | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: return await self._post( "/gitpod.v1.RunnerService/UpdateRunner", body=await async_maybe_transform( { "name": name, + "runner_id": runner_id, "spec": spec, }, runner_update_params.RunnerUpdateParams, @@ -710,7 +626,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[RunnerListResponse, AsyncRunnersPage[RunnerListResponse]]: + ) -> AsyncPaginator[Runner, AsyncRunnersPage[Runner]]: """ ListRunners returns all runners registered in the scope. @@ -727,7 +643,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.RunnerService/ListRunners", - page=AsyncRunnersPage[RunnerListResponse], + page=AsyncRunnersPage[Runner], body=maybe_transform( { "filter": filter, @@ -748,7 +664,7 @@ def list( runner_list_params.RunnerListParams, ), ), - model=RunnerListResponse, + model=Runner, method="post", ) @@ -853,7 +769,7 @@ async def create_runner_token( runner. Use this call to renew an outdated token - this does not expire any - previouly issued tokens. + previously issued tokens. Args: extra_headers: Send extra headers diff --git a/src/gitpod/resources/secrets.py b/src/gitpod/resources/secrets.py index bc2b858..c335a99 100644 --- a/src/gitpod/resources/secrets.py +++ b/src/gitpod/resources/secrets.py @@ -2,9 +2,6 @@ from __future__ import annotations -from typing import Any, cast -from typing_extensions import overload - import httpx from ..types import ( @@ -16,7 +13,6 @@ ) from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( - required_args, maybe_transform, async_maybe_transform, ) @@ -30,7 +26,7 @@ ) from ..pagination import SyncSecretsPage, AsyncSecretsPage from .._base_client import AsyncPaginator, make_request_options -from ..types.secret_list_response import SecretListResponse +from ..types.secret import Secret from ..types.secret_create_response import SecretCreateResponse from ..types.secret_get_value_response import SecretGetValueResponse @@ -57,11 +53,11 @@ def with_streaming_response(self) -> SecretsResourceWithStreamingResponse: """ return SecretsResourceWithStreamingResponse(self) - @overload def create( self, *, - environment_variable: bool, + environment_variable: bool | NotGiven = NOT_GIVEN, + file_path: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, project_id: str | NotGiven = NOT_GIVEN, value: str | NotGiven = NOT_GIVEN, @@ -79,39 +75,6 @@ def create( environment_variable: secret will be created as an Environment Variable with the same name as the secret - project_id: project_id is the ProjectID this Secret belongs to - - value: value is the plaintext value of the secret - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def create( - self, - *, - file_path: str, - name: str | NotGiven = NOT_GIVEN, - project_id: str | NotGiven = NOT_GIVEN, - value: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecretCreateResponse: - """ - CreateSecret creates a new secret. - - Args: file_path: absolute path to the file where the secret is mounted value must be an absolute path (start with a /): @@ -131,33 +94,15 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @required_args(["environment_variable"], ["file_path"]) - def create( - self, - *, - environment_variable: bool | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - project_id: str | NotGiven = NOT_GIVEN, - value: str | NotGiven = NOT_GIVEN, - file_path: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecretCreateResponse: return self._post( "/gitpod.v1.SecretService/CreateSecret", body=maybe_transform( { "environment_variable": environment_variable, + "file_path": file_path, "name": name, "project_id": project_id, "value": value, - "file_path": file_path, }, secret_create_params.SecretCreateParams, ), @@ -180,7 +125,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSecretsPage[SecretListResponse]: + ) -> SyncSecretsPage[Secret]: """ ListSecrets lists secrets. @@ -197,7 +142,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.SecretService/ListSecrets", - page=SyncSecretsPage[SecretListResponse], + page=SyncSecretsPage[Secret], body=maybe_transform( { "filter": filter, @@ -218,7 +163,7 @@ def list( secret_list_params.SecretListParams, ), ), - model=cast(Any, SecretListResponse), # Union types cannot be passed in as arguments in the type system + model=Secret, method="post", ) @@ -349,11 +294,11 @@ def with_streaming_response(self) -> AsyncSecretsResourceWithStreamingResponse: """ return AsyncSecretsResourceWithStreamingResponse(self) - @overload async def create( self, *, - environment_variable: bool, + environment_variable: bool | NotGiven = NOT_GIVEN, + file_path: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, project_id: str | NotGiven = NOT_GIVEN, value: str | NotGiven = NOT_GIVEN, @@ -371,39 +316,6 @@ async def create( environment_variable: secret will be created as an Environment Variable with the same name as the secret - project_id: project_id is the ProjectID this Secret belongs to - - value: value is the plaintext value of the secret - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def create( - self, - *, - file_path: str, - name: str | NotGiven = NOT_GIVEN, - project_id: str | NotGiven = NOT_GIVEN, - value: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecretCreateResponse: - """ - CreateSecret creates a new secret. - - Args: file_path: absolute path to the file where the secret is mounted value must be an absolute path (start with a /): @@ -423,33 +335,15 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ - ... - - @required_args(["environment_variable"], ["file_path"]) - async def create( - self, - *, - environment_variable: bool | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - project_id: str | NotGiven = NOT_GIVEN, - value: str | NotGiven = NOT_GIVEN, - file_path: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecretCreateResponse: return await self._post( "/gitpod.v1.SecretService/CreateSecret", body=await async_maybe_transform( { "environment_variable": environment_variable, + "file_path": file_path, "name": name, "project_id": project_id, "value": value, - "file_path": file_path, }, secret_create_params.SecretCreateParams, ), @@ -472,7 +366,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[SecretListResponse, AsyncSecretsPage[SecretListResponse]]: + ) -> AsyncPaginator[Secret, AsyncSecretsPage[Secret]]: """ ListSecrets lists secrets. @@ -489,7 +383,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.SecretService/ListSecrets", - page=AsyncSecretsPage[SecretListResponse], + page=AsyncSecretsPage[Secret], body=maybe_transform( { "filter": filter, @@ -510,7 +404,7 @@ def list( secret_list_params.SecretListParams, ), ), - model=cast(Any, SecretListResponse), # Union types cannot be passed in as arguments in the type system + model=Secret, method="post", ) diff --git a/src/gitpod/resources/users/pats.py b/src/gitpod/resources/users/pats.py index 3165c3b..1632e33 100644 --- a/src/gitpod/resources/users/pats.py +++ b/src/gitpod/resources/users/pats.py @@ -21,7 +21,7 @@ from ...types.users import pat_get_params, pat_list_params, pat_delete_params from ..._base_client import AsyncPaginator, make_request_options from ...types.users.pat_get_response import PatGetResponse -from ...types.users.pat_list_response import PatListResponse +from ...types.users.personal_access_token import PersonalAccessToken __all__ = ["PatsResource", "AsyncPatsResource"] @@ -59,7 +59,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncPersonalAccessTokensPage[PatListResponse]: + ) -> SyncPersonalAccessTokensPage[PersonalAccessToken]: """ ListPersonalAccessTokens @@ -74,7 +74,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.UserService/ListPersonalAccessTokens", - page=SyncPersonalAccessTokensPage[PatListResponse], + page=SyncPersonalAccessTokensPage[PersonalAccessToken], body=maybe_transform( { "filter": filter, @@ -95,7 +95,7 @@ def list( pat_list_params.PatListParams, ), ), - model=PatListResponse, + model=PersonalAccessToken, method="post", ) @@ -199,7 +199,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[PatListResponse, AsyncPersonalAccessTokensPage[PatListResponse]]: + ) -> AsyncPaginator[PersonalAccessToken, AsyncPersonalAccessTokensPage[PersonalAccessToken]]: """ ListPersonalAccessTokens @@ -214,7 +214,7 @@ def list( """ return self._get_api_list( "/gitpod.v1.UserService/ListPersonalAccessTokens", - page=AsyncPersonalAccessTokensPage[PatListResponse], + page=AsyncPersonalAccessTokensPage[PersonalAccessToken], body=maybe_transform( { "filter": filter, @@ -235,7 +235,7 @@ def list( pat_list_params.PatListParams, ), ), - model=PatListResponse, + model=PersonalAccessToken, method="post", ) diff --git a/src/gitpod/types/__init__.py b/src/gitpod/types/__init__.py index 9644e1c..1ff00e1 100644 --- a/src/gitpod/types/__init__.py +++ b/src/gitpod/types/__init__.py @@ -2,34 +2,79 @@ from __future__ import annotations +from .user import User as User +from .group import Group as Group +from .scope import Scope as Scope +from .editor import Editor as Editor +from .runner import Runner as Runner +from .secret import Secret as Secret +from .shared import ( + RunsOn as RunsOn, + Subject as Subject, + Principal as Principal, + FieldValue as FieldValue, + UserStatus as UserStatus, + TaskExecution as TaskExecution, + EnvironmentClass as EnvironmentClass, + OrganizationRole as OrganizationRole, + AutomationTrigger as AutomationTrigger, + TaskExecutionSpec as TaskExecutionSpec, + TaskExecutionPhase as TaskExecutionPhase, + TaskExecutionStatus as TaskExecutionStatus, + TaskExecutionMetadata as TaskExecutionMetadata, +) +from .account import Account as Account +from .project import Project as Project +from .environment import Environment as Environment +from .runner_kind import RunnerKind as RunnerKind +from .runner_spec import RunnerSpec as RunnerSpec +from .organization import Organization as Organization +from .runner_phase import RunnerPhase as RunnerPhase +from .resource_type import ResourceType as ResourceType +from .runner_status import RunnerStatus as RunnerStatus +from .invite_domains import InviteDomains as InviteDomains +from .login_provider import LoginProvider as LoginProvider +from .admission_level import AdmissionLevel as AdmissionLevel +from .runner_provider import RunnerProvider as RunnerProvider +from .environment_spec import EnvironmentSpec as EnvironmentSpec +from .project_metadata import ProjectMetadata as ProjectMetadata +from .environment_phase import EnvironmentPhase as EnvironmentPhase from .event_list_params import EventListParams as EventListParams from .group_list_params import GroupListParams as GroupListParams +from .runner_capability import RunnerCapability as RunnerCapability +from .runner_spec_param import RunnerSpecParam as RunnerSpecParam +from .account_membership import AccountMembership as AccountMembership from .editor_list_params import EditorListParams as EditorListParams +from .environment_status import EnvironmentStatus as EnvironmentStatus from .event_watch_params import EventWatchParams as EventWatchParams +from .resource_operation import ResourceOperation as ResourceOperation from .runner_list_params import RunnerListParams as RunnerListParams from .secret_list_params import SecretListParams as SecretListParams from .event_list_response import EventListResponse as EventListResponse -from .group_list_response import GroupListResponse as GroupListResponse +from .organization_member import OrganizationMember as OrganizationMember from .project_list_params import ProjectListParams as ProjectListParams -from .editor_list_response import EditorListResponse as EditorListResponse +from .environment_metadata import EnvironmentMetadata as EnvironmentMetadata from .event_watch_response import EventWatchResponse as EventWatchResponse +from .invite_domains_param import InviteDomainsParam as InviteDomainsParam +from .runner_configuration import RunnerConfiguration as RunnerConfiguration from .runner_create_params import RunnerCreateParams as RunnerCreateParams from .runner_delete_params import RunnerDeleteParams as RunnerDeleteParams -from .runner_list_response import RunnerListResponse as RunnerListResponse from .runner_update_params import RunnerUpdateParams as RunnerUpdateParams from .secret_create_params import SecretCreateParams as SecretCreateParams from .secret_delete_params import SecretDeleteParams as SecretDeleteParams -from .secret_list_response import SecretListResponse as SecretListResponse from .account_delete_params import AccountDeleteParams as AccountDeleteParams +from .joinable_organization import JoinableOrganization as JoinableOrganization from .project_create_params import ProjectCreateParams as ProjectCreateParams from .project_delete_params import ProjectDeleteParams as ProjectDeleteParams -from .project_list_response import ProjectListResponse as ProjectListResponse from .project_update_params import ProjectUpdateParams as ProjectUpdateParams from .editor_retrieve_params import EditorRetrieveParams as EditorRetrieveParams +from .environment_spec_param import EnvironmentSpecParam as EnvironmentSpecParam from .runner_create_response import RunnerCreateResponse as RunnerCreateResponse +from .runner_release_channel import RunnerReleaseChannel as RunnerReleaseChannel from .runner_retrieve_params import RunnerRetrieveParams as RunnerRetrieveParams from .secret_create_response import SecretCreateResponse as SecretCreateResponse from .account_retrieve_params import AccountRetrieveParams as AccountRetrieveParams +from .environment_initializer import EnvironmentInitializer as EnvironmentInitializer from .environment_list_params import EnvironmentListParams as EnvironmentListParams from .environment_stop_params import EnvironmentStopParams as EnvironmentStopParams from .project_create_response import ProjectCreateResponse as ProjectCreateResponse @@ -45,19 +90,20 @@ from .editor_resolve_url_params import EditorResolveURLParams as EditorResolveURLParams from .environment_create_params import EnvironmentCreateParams as EnvironmentCreateParams from .environment_delete_params import EnvironmentDeleteParams as EnvironmentDeleteParams -from .environment_list_response import EnvironmentListResponse as EnvironmentListResponse from .environment_update_params import EnvironmentUpdateParams as EnvironmentUpdateParams from .organization_leave_params import OrganizationLeaveParams as OrganizationLeaveParams +from .project_environment_class import ProjectEnvironmentClass as ProjectEnvironmentClass from .project_retrieve_response import ProjectRetrieveResponse as ProjectRetrieveResponse from .secret_get_value_response import SecretGetValueResponse as SecretGetValueResponse from .user_set_suspended_params import UserSetSuspendedParams as UserSetSuspendedParams from .organization_create_params import OrganizationCreateParams as OrganizationCreateParams from .organization_delete_params import OrganizationDeleteParams as OrganizationDeleteParams from .organization_join_response import OrganizationJoinResponse as OrganizationJoinResponse -from .organization_list_response import OrganizationListResponse as OrganizationListResponse from .organization_update_params import OrganizationUpdateParams as OrganizationUpdateParams +from .runner_configuration_param import RunnerConfigurationParam as RunnerConfigurationParam from .secret_update_value_params import SecretUpdateValueParams as SecretUpdateValueParams from .editor_resolve_url_response import EditorResolveURLResponse as EditorResolveURLResponse +from .environment_activity_signal import EnvironmentActivitySignal as EnvironmentActivitySignal from .environment_create_response import EnvironmentCreateResponse as EnvironmentCreateResponse from .environment_retrieve_params import EnvironmentRetrieveParams as EnvironmentRetrieveParams from .identity_get_id_token_params import IdentityGetIDTokenParams as IdentityGetIDTokenParams @@ -65,27 +111,26 @@ from .organization_retrieve_params import OrganizationRetrieveParams as OrganizationRetrieveParams from .organization_set_role_params import OrganizationSetRoleParams as OrganizationSetRoleParams from .organization_update_response import OrganizationUpdateResponse as OrganizationUpdateResponse +from .environment_initializer_param import EnvironmentInitializerParam as EnvironmentInitializerParam from .environment_retrieve_response import EnvironmentRetrieveResponse as EnvironmentRetrieveResponse from .environment_mark_active_params import EnvironmentMarkActiveParams as EnvironmentMarkActiveParams from .identity_exchange_token_params import IdentityExchangeTokenParams as IdentityExchangeTokenParams from .identity_get_id_token_response import IdentityGetIDTokenResponse as IdentityGetIDTokenResponse from .organization_retrieve_response import OrganizationRetrieveResponse as OrganizationRetrieveResponse +from .project_environment_class_param import ProjectEnvironmentClassParam as ProjectEnvironmentClassParam from .runner_parse_context_url_params import RunnerParseContextURLParams as RunnerParseContextURLParams from .account_get_sso_login_url_params import AccountGetSSOLoginURLParams as AccountGetSSOLoginURLParams from .identity_exchange_token_response import IdentityExchangeTokenResponse as IdentityExchangeTokenResponse from .organization_list_members_params import OrganizationListMembersParams as OrganizationListMembersParams +from .environment_activity_signal_param import EnvironmentActivitySignalParam as EnvironmentActivitySignalParam from .runner_create_runner_token_params import RunnerCreateRunnerTokenParams as RunnerCreateRunnerTokenParams from .runner_parse_context_url_response import RunnerParseContextURLResponse as RunnerParseContextURLResponse from .account_get_sso_login_url_response import AccountGetSSOLoginURLResponse as AccountGetSSOLoginURLResponse -from .organization_list_members_response import OrganizationListMembersResponse as OrganizationListMembersResponse from .user_get_authenticated_user_params import UserGetAuthenticatedUserParams as UserGetAuthenticatedUserParams from .account_list_login_providers_params import AccountListLoginProvidersParams as AccountListLoginProvidersParams from .runner_create_runner_token_response import RunnerCreateRunnerTokenResponse as RunnerCreateRunnerTokenResponse from .environment_create_logs_token_params import EnvironmentCreateLogsTokenParams as EnvironmentCreateLogsTokenParams from .user_get_authenticated_user_response import UserGetAuthenticatedUserResponse as UserGetAuthenticatedUserResponse -from .account_list_login_providers_response import ( - AccountListLoginProvidersResponse as AccountListLoginProvidersResponse, -) from .environment_create_from_project_params import ( EnvironmentCreateFromProjectParams as EnvironmentCreateFromProjectParams, ) diff --git a/src/gitpod/types/account.py b/src/gitpod/types/account.py new file mode 100644 index 0000000..417f6c8 --- /dev/null +++ b/src/gitpod/types/account.py @@ -0,0 +1,222 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .account_membership import AccountMembership +from .joinable_organization import JoinableOrganization + +__all__ = ["Account"] + + +class Account(BaseModel): + id: Optional[str] = None + + avatar_url: Optional[str] = FieldInfo(alias="avatarUrl", default=None) + + 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()`]() + to obtain a formatter capable of generating timestamps in this format. + """ + + email: Optional[str] = None + + joinables: Optional[List[JoinableOrganization]] = None + + memberships: Optional[List[AccountMembership]] = None + + name: Optional[str] = None + + organization_id: Optional[str] = FieldInfo(alias="organizationId", default=None) + """ + organization_id is the ID of the organization the account is owned by if it's + created through custom SSO + """ + + public_email_provider: Optional[bool] = FieldInfo(alias="publicEmailProvider", default=None) + """ + public_email_provider is true if the email for the Account matches a known + public email provider + """ + + 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()`]() + to obtain a formatter capable of generating timestamps in this format. + """ diff --git a/src/gitpod/types/account_get_sso_login_url_params.py b/src/gitpod/types/account_get_sso_login_url_params.py index 5c5f85d..7689a8d 100644 --- a/src/gitpod/types/account_get_sso_login_url_params.py +++ b/src/gitpod/types/account_get_sso_login_url_params.py @@ -2,7 +2,8 @@ from __future__ import annotations -from typing_extensions import Required, Annotated, TypedDict +from typing import Optional +from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo @@ -10,8 +11,8 @@ class AccountGetSSOLoginURLParams(TypedDict, total=False): - return_to: Required[Annotated[str, PropertyInfo(alias="returnTo")]] - """return_to is the URL the user will be redirected to after login""" - email: str """email is the email the user wants to login with""" + + return_to: Annotated[Optional[str], PropertyInfo(alias="returnTo")] + """return_to is the URL the user will be redirected to after login""" diff --git a/src/gitpod/types/account_membership.py b/src/gitpod/types/account_membership.py new file mode 100644 index 0000000..c0e606d --- /dev/null +++ b/src/gitpod/types/account_membership.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.organization_role import OrganizationRole + +__all__ = ["AccountMembership"] + + +class AccountMembership(BaseModel): + organization_id: Optional[str] = FieldInfo(alias="organizationId", default=None) + """organization_id is the id of the organization the user is a member of""" + + organization_member_count: Optional[int] = FieldInfo(alias="organizationMemberCount", default=None) + """ + organization_name is the member count of the organization the user is a member + of + """ + + organization_name: Optional[str] = FieldInfo(alias="organizationName", default=None) + """organization_name is the name of the organization the user is a member of""" + + user_id: Optional[str] = FieldInfo(alias="userId", default=None) + """user_id is the ID the user has in the organization""" + + user_role: Optional[OrganizationRole] = FieldInfo(alias="userRole", default=None) + """user_role is the role the user has in the organization""" diff --git a/src/gitpod/types/account_retrieve_response.py b/src/gitpod/types/account_retrieve_response.py index d0dffe2..529e42b 100644 --- a/src/gitpod/types/account_retrieve_response.py +++ b/src/gitpod/types/account_retrieve_response.py @@ -2,19 +2,10 @@ from typing import Optional -from pydantic import Field as FieldInfo - +from .account import Account from .._models import BaseModel -__all__ = ["AccountRetrieveResponse", "Account"] - - -class Account(BaseModel): - organization_id: str = FieldInfo(alias="organizationId") - """ - organization_id is the ID of the organization the account is owned by if it's - created through custom SSO - """ +__all__ = ["AccountRetrieveResponse"] class AccountRetrieveResponse(BaseModel): diff --git a/src/gitpod/types/admission_level.py b/src/gitpod/types/admission_level.py new file mode 100644 index 0000000..40ee48d --- /dev/null +++ b/src/gitpod/types/admission_level.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["AdmissionLevel"] + +AdmissionLevel: TypeAlias = Literal[ + "ADMISSION_LEVEL_UNSPECIFIED", "ADMISSION_LEVEL_OWNER_ONLY", "ADMISSION_LEVEL_EVERYONE" +] diff --git a/src/gitpod/types/editor_list_response.py b/src/gitpod/types/editor.py similarity index 90% rename from src/gitpod/types/editor_list_response.py rename to src/gitpod/types/editor.py index d9482a8..b5ea9d0 100644 --- a/src/gitpod/types/editor_list_response.py +++ b/src/gitpod/types/editor.py @@ -6,10 +6,10 @@ from .._models import BaseModel -__all__ = ["EditorListResponse"] +__all__ = ["Editor"] -class EditorListResponse(BaseModel): +class Editor(BaseModel): id: Optional[str] = None alias: Optional[str] = None diff --git a/src/gitpod/types/editor_retrieve_response.py b/src/gitpod/types/editor_retrieve_response.py index a6896ce..4f962cd 100644 --- a/src/gitpod/types/editor_retrieve_response.py +++ b/src/gitpod/types/editor_retrieve_response.py @@ -2,27 +2,10 @@ from typing import Optional -from pydantic import Field as FieldInfo - +from .editor import Editor from .._models import BaseModel -__all__ = ["EditorRetrieveResponse", "Editor"] - - -class Editor(BaseModel): - id: Optional[str] = None - - alias: Optional[str] = None - - icon_url: Optional[str] = FieldInfo(alias="iconUrl", default=None) - - installation_instructions: Optional[str] = FieldInfo(alias="installationInstructions", default=None) - - name: Optional[str] = None - - short_description: Optional[str] = FieldInfo(alias="shortDescription", default=None) - - url_template: Optional[str] = FieldInfo(alias="urlTemplate", default=None) +__all__ = ["EditorRetrieveResponse"] class EditorRetrieveResponse(BaseModel): diff --git a/src/gitpod/types/environment.py b/src/gitpod/types/environment.py new file mode 100644 index 0000000..0be34ff --- /dev/null +++ b/src/gitpod/types/environment.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from .._models import BaseModel +from .environment_spec import EnvironmentSpec +from .environment_status import EnvironmentStatus +from .environment_metadata import EnvironmentMetadata + +__all__ = ["Environment"] + + +class Environment(BaseModel): + id: Optional[str] = None + """ID is a unique identifier of this environment. + + No other environment with the same name must be managed by this environment + manager + """ + + metadata: Optional[EnvironmentMetadata] = None + """ + EnvironmentMetadata is data associated with an environment that's required for + other parts of the system to function + """ + + spec: Optional[EnvironmentSpec] = None + """ + EnvironmentSpec specifies the configuration of an environment for an environment + start + """ + + status: Optional[EnvironmentStatus] = None + """EnvironmentStatus describes an environment status""" diff --git a/src/gitpod/types/environment_activity_signal.py b/src/gitpod/types/environment_activity_signal.py new file mode 100644 index 0000000..ea825be --- /dev/null +++ b/src/gitpod/types/environment_activity_signal.py @@ -0,0 +1,109 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from .._models import BaseModel + +__all__ = ["EnvironmentActivitySignal"] + + +class EnvironmentActivitySignal(BaseModel): + source: Optional[str] = None + """ + source of the activity signal, such as "VS Code", "SSH", or "Automations". It + should be a human-readable string that describes the source of the activity + signal. + """ + + 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()`]() + to obtain a formatter capable of generating timestamps in this format. + """ diff --git a/src/gitpod/types/environment_activity_signal_param.py b/src/gitpod/types/environment_activity_signal_param.py new file mode 100644 index 0000000..d097493 --- /dev/null +++ b/src/gitpod/types/environment_activity_signal_param.py @@ -0,0 +1,112 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["EnvironmentActivitySignalParam"] + + +class EnvironmentActivitySignalParam(TypedDict, total=False): + source: str + """ + source of the activity signal, such as "VS Code", "SSH", or "Automations". It + should be a human-readable string that describes the source of the activity + signal. + """ + + 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()`]() + to obtain a formatter capable of generating timestamps in this format. + """ diff --git a/src/gitpod/types/environment_create_from_project_params.py b/src/gitpod/types/environment_create_from_project_params.py index 819fea6..d8d6092 100644 --- a/src/gitpod/types/environment_create_from_project_params.py +++ b/src/gitpod/types/environment_create_from_project_params.py @@ -2,342 +2,19 @@ from __future__ import annotations -from typing import Union, Iterable -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo +from .environment_spec_param import EnvironmentSpecParam -__all__ = [ - "EnvironmentCreateFromProjectParams", - "Spec", - "SpecAutomationsFile", - "SpecContent", - "SpecContentInitializer", - "SpecContentInitializerSpec", - "SpecContentInitializerSpecContextURL", - "SpecContentInitializerSpecContextURLContextURL", - "SpecContentInitializerSpecGit", - "SpecContentInitializerSpecGitGit", - "SpecDevcontainer", - "SpecMachine", - "SpecPort", - "SpecSecret", - "SpecSecretUnionMember0", - "SpecSecretFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted", - "SpecSecretUnionMember2", - "SpecSSHPublicKey", - "SpecTimeout", -] +__all__ = ["EnvironmentCreateFromProjectParams"] class EnvironmentCreateFromProjectParams(TypedDict, total=False): project_id: Annotated[str, PropertyInfo(alias="projectId")] - spec: Spec + spec: EnvironmentSpecParam """ EnvironmentSpec specifies the configuration of an environment for an environment start """ - - -class SpecAutomationsFile(TypedDict, total=False): - automations_file_path: Annotated[str, PropertyInfo(alias="automationsFilePath")] - """ - automations_file_path is the path to the automations file that is applied in the - environment, relative to the repo root. path must not be absolute (start with a - /): - - ``` - this.matches('^$|^[^/].*') - ``` - """ - - session: str - - -class SpecContentInitializerSpecContextURLContextURL(TypedDict, total=False): - url: str - """url is the URL from which the environment is created""" - - -class SpecContentInitializerSpecContextURL(TypedDict, total=False): - context_url: Required[Annotated[SpecContentInitializerSpecContextURLContextURL, PropertyInfo(alias="contextUrl")]] - - -class SpecContentInitializerSpecGitGit(TypedDict, total=False): - checkout_location: Annotated[str, PropertyInfo(alias="checkoutLocation")] - """ - a path relative to the environment root in which the code will be checked out to - """ - - clone_target: Annotated[str, PropertyInfo(alias="cloneTarget")] - """the value for the clone target mode - use depends on the target mode""" - - remote_uri: Annotated[str, PropertyInfo(alias="remoteUri")] - """remote_uri is the Git remote origin""" - - target_mode: Annotated[ - Literal[ - "CLONE_TARGET_MODE_UNSPECIFIED", - "CLONE_TARGET_MODE_REMOTE_HEAD", - "CLONE_TARGET_MODE_REMOTE_COMMIT", - "CLONE_TARGET_MODE_REMOTE_BRANCH", - "CLONE_TARGET_MODE_LOCAL_BRANCH", - ], - PropertyInfo(alias="targetMode"), - ] - """CloneTargetMode is the target state in which we want to leave a GitEnvironment""" - - upstream_remote_uri: Annotated[str, PropertyInfo(alias="upstreamRemoteUri")] - """upstream_Remote_uri is the fork upstream of a repository""" - - -class SpecContentInitializerSpecGit(TypedDict, total=False): - git: Required[SpecContentInitializerSpecGitGit] - - -SpecContentInitializerSpec: TypeAlias = Union[SpecContentInitializerSpecContextURL, SpecContentInitializerSpecGit] - - -class SpecContentInitializer(TypedDict, total=False): - specs: Iterable[SpecContentInitializerSpec] - - -class SpecContent(TypedDict, total=False): - git_email: Annotated[str, PropertyInfo(alias="gitEmail")] - """The Git email address""" - - git_username: Annotated[str, PropertyInfo(alias="gitUsername")] - """The Git username""" - - initializer: SpecContentInitializer - """EnvironmentInitializer specifies how an environment is to be initialized""" - - session: str - - -class SpecDevcontainer(TypedDict, total=False): - devcontainer_file_path: Annotated[str, PropertyInfo(alias="devcontainerFilePath")] - """ - devcontainer_file_path is the path to the devcontainer file relative to the repo - root path must not be absolute (start with a /): - - ``` - this.matches('^$|^[^/].*') - ``` - """ - - session: str - - -_SpecMachineReservedKeywords = TypedDict( - "_SpecMachineReservedKeywords", - { - "class": str, - }, - total=False, -) - - -class SpecMachine(_SpecMachineReservedKeywords, total=False): - session: str - - -class SpecPort(TypedDict, total=False): - admission: Literal["ADMISSION_LEVEL_UNSPECIFIED", "ADMISSION_LEVEL_OWNER_ONLY", "ADMISSION_LEVEL_EVERYONE"] - """Admission level describes who can access an environment instance and its ports.""" - - name: str - """name of this port""" - - port: int - """port number""" - - -class SpecSecretUnionMember0(TypedDict, total=False): - environment_variable: Required[Annotated[str, PropertyInfo(alias="environmentVariable")]] - - name: str - """name is the human readable description of the secret""" - - session: str - """ - session indicated the current session of the secret. When the session does not - change, secrets are not reloaded in the environment. - """ - - source: str - """source is the source of the secret, for now control-plane or runner""" - - source_ref: Annotated[str, PropertyInfo(alias="sourceRef")] - """source_ref into the source, in case of control-plane this is uuid of the secret""" - - -class SpecSecretFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted(TypedDict, total=False): - file_path: Required[Annotated[str, PropertyInfo(alias="filePath")]] - """file_path is the path inside the devcontainer where the secret is mounted""" - - name: str - """name is the human readable description of the secret""" - - session: str - """ - session indicated the current session of the secret. When the session does not - change, secrets are not reloaded in the environment. - """ - - source: str - """source is the source of the secret, for now control-plane or runner""" - - source_ref: Annotated[str, PropertyInfo(alias="sourceRef")] - """source_ref into the source, in case of control-plane this is uuid of the secret""" - - -class SpecSecretUnionMember2(TypedDict, total=False): - git_credential_host: Required[Annotated[str, PropertyInfo(alias="gitCredentialHost")]] - - name: str - """name is the human readable description of the secret""" - - session: str - """ - session indicated the current session of the secret. When the session does not - change, secrets are not reloaded in the environment. - """ - - source: str - """source is the source of the secret, for now control-plane or runner""" - - source_ref: Annotated[str, PropertyInfo(alias="sourceRef")] - """source_ref into the source, in case of control-plane this is uuid of the secret""" - - -SpecSecret: TypeAlias = Union[ - SpecSecretUnionMember0, - SpecSecretFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted, - SpecSecretUnionMember2, -] - - -class SpecSSHPublicKey(TypedDict, total=False): - id: str - """id is the unique identifier of the public key""" - - value: str - """value is the actual public key in the public key file format""" - - -class SpecTimeout(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". - """ - - -class Spec(TypedDict, total=False): - admission: Literal["ADMISSION_LEVEL_UNSPECIFIED", "ADMISSION_LEVEL_OWNER_ONLY", "ADMISSION_LEVEL_EVERYONE"] - """Admission level describes who can access an environment instance and its ports.""" - - automations_file: Annotated[SpecAutomationsFile, PropertyInfo(alias="automationsFile")] - """automations_file is the automations file spec of the environment""" - - content: SpecContent - """content is the content spec of the environment""" - - desired_phase: Annotated[ - Literal[ - "ENVIRONMENT_PHASE_UNSPECIFIED", - "ENVIRONMENT_PHASE_CREATING", - "ENVIRONMENT_PHASE_STARTING", - "ENVIRONMENT_PHASE_RUNNING", - "ENVIRONMENT_PHASE_UPDATING", - "ENVIRONMENT_PHASE_STOPPING", - "ENVIRONMENT_PHASE_STOPPED", - "ENVIRONMENT_PHASE_DELETING", - "ENVIRONMENT_PHASE_DELETED", - ], - PropertyInfo(alias="desiredPhase"), - ] - """Phase is the desired phase of the environment""" - - devcontainer: SpecDevcontainer - """devcontainer is the devcontainer spec of the environment""" - - machine: SpecMachine - """machine is the machine spec of the environment""" - - ports: Iterable[SpecPort] - """ports is the set of ports which ought to be exposed to the internet""" - - secrets: Iterable[SpecSecret] - """secrets are confidential data that is mounted into the environment""" - - spec_version: Annotated[str, PropertyInfo(alias="specVersion")] - """version of the spec. - - The value of this field has no semantic meaning (e.g. don't interpret it as as a - timestamp), but it can be used to impose a partial order. If a.spec_version < - b.spec_version then a was the spec before b. - """ - - ssh_public_keys: Annotated[Iterable[SpecSSHPublicKey], PropertyInfo(alias="sshPublicKeys")] - """ssh_public_keys are the public keys used to ssh into the environment""" - - timeout: SpecTimeout - """Timeout configures the environment timeout""" diff --git a/src/gitpod/types/environment_create_from_project_response.py b/src/gitpod/types/environment_create_from_project_response.py index b4ab8c6..55275c1 100644 --- a/src/gitpod/types/environment_create_from_project_response.py +++ b/src/gitpod/types/environment_create_from_project_response.py @@ -1,1101 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias - -from pydantic import Field as FieldInfo +from typing import Optional from .._models import BaseModel +from .environment import Environment -__all__ = [ - "EnvironmentCreateFromProjectResponse", - "Environment", - "EnvironmentMetadata", - "EnvironmentMetadataCreator", - "EnvironmentSpec", - "EnvironmentSpecAutomationsFile", - "EnvironmentSpecContent", - "EnvironmentSpecContentInitializer", - "EnvironmentSpecContentInitializerSpec", - "EnvironmentSpecContentInitializerSpecContextURL", - "EnvironmentSpecContentInitializerSpecContextURLContextURL", - "EnvironmentSpecContentInitializerSpecGit", - "EnvironmentSpecContentInitializerSpecGitGit", - "EnvironmentSpecDevcontainer", - "EnvironmentSpecMachine", - "EnvironmentSpecPort", - "EnvironmentSpecSecret", - "EnvironmentSpecSecretUnionMember0", - "EnvironmentSpecSecretFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted", - "EnvironmentSpecSecretUnionMember2", - "EnvironmentSpecSSHPublicKey", - "EnvironmentSpecTimeout", - "EnvironmentStatus", - "EnvironmentStatusActivitySignal", - "EnvironmentStatusAutomationsFile", - "EnvironmentStatusContent", - "EnvironmentStatusContentGit", - "EnvironmentStatusContentGitChangedFile", - "EnvironmentStatusDevcontainer", - "EnvironmentStatusEnvironmentURLs", - "EnvironmentStatusEnvironmentURLsPort", - "EnvironmentStatusEnvironmentURLsSSH", - "EnvironmentStatusMachine", - "EnvironmentStatusMachineVersions", - "EnvironmentStatusRunnerAck", - "EnvironmentStatusSecret", - "EnvironmentStatusSSHPublicKey", -] - - -class EnvironmentMetadataCreator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class EnvironmentMetadata(BaseModel): - annotations: Optional[Dict[str, str]] = None - """ - annotations are key/value pairs that gets attached to the environment. - +internal - not yet implemented - """ - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - creator: Optional[EnvironmentMetadataCreator] = 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. - - In JavaScript, one can convert a Date object to this format using the standard - [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - method. In Python, a standard `datetime.datetime` object can be converted to - this format using - [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - Joda Time's - [`ISODateTimeFormat.dateTime()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - name: Optional[str] = None - """name is the name of the environment as specified by the user""" - - organization_id: Optional[str] = FieldInfo(alias="organizationId", default=None) - """organization_id is the ID of the organization that contains the environment""" - - original_context_url: Optional[str] = FieldInfo(alias="originalContextUrl", default=None) - """ - original_context_url is the normalized URL from which the environment was - created - """ - - project_id: Optional[str] = FieldInfo(alias="projectId", default=None) - """ - If the Environment was started from a project, the project_id will reference the - project. - """ - - runner_id: Optional[str] = FieldInfo(alias="runnerId", default=None) - """Runner is the ID of the runner that runs this environment.""" - - -class EnvironmentSpecAutomationsFile(BaseModel): - automations_file_path: Optional[str] = FieldInfo(alias="automationsFilePath", default=None) - """ - automations_file_path is the path to the automations file that is applied in the - environment, relative to the repo root. path must not be absolute (start with a - /): - - ``` - this.matches('^$|^[^/].*') - ``` - """ - - session: Optional[str] = None - - -class EnvironmentSpecContentInitializerSpecContextURLContextURL(BaseModel): - url: Optional[str] = None - """url is the URL from which the environment is created""" - - -class EnvironmentSpecContentInitializerSpecContextURL(BaseModel): - context_url: EnvironmentSpecContentInitializerSpecContextURLContextURL = FieldInfo(alias="contextUrl") - - -class EnvironmentSpecContentInitializerSpecGitGit(BaseModel): - checkout_location: Optional[str] = FieldInfo(alias="checkoutLocation", default=None) - """ - a path relative to the environment root in which the code will be checked out to - """ - - clone_target: Optional[str] = FieldInfo(alias="cloneTarget", default=None) - """the value for the clone target mode - use depends on the target mode""" - - remote_uri: Optional[str] = FieldInfo(alias="remoteUri", default=None) - """remote_uri is the Git remote origin""" - - target_mode: Optional[ - Literal[ - "CLONE_TARGET_MODE_UNSPECIFIED", - "CLONE_TARGET_MODE_REMOTE_HEAD", - "CLONE_TARGET_MODE_REMOTE_COMMIT", - "CLONE_TARGET_MODE_REMOTE_BRANCH", - "CLONE_TARGET_MODE_LOCAL_BRANCH", - ] - ] = FieldInfo(alias="targetMode", default=None) - """CloneTargetMode is the target state in which we want to leave a GitEnvironment""" - - upstream_remote_uri: Optional[str] = FieldInfo(alias="upstreamRemoteUri", default=None) - """upstream_Remote_uri is the fork upstream of a repository""" - - -class EnvironmentSpecContentInitializerSpecGit(BaseModel): - git: EnvironmentSpecContentInitializerSpecGitGit - - -EnvironmentSpecContentInitializerSpec: TypeAlias = Union[ - EnvironmentSpecContentInitializerSpecContextURL, EnvironmentSpecContentInitializerSpecGit -] - - -class EnvironmentSpecContentInitializer(BaseModel): - specs: Optional[List[EnvironmentSpecContentInitializerSpec]] = None - - -class EnvironmentSpecContent(BaseModel): - git_email: Optional[str] = FieldInfo(alias="gitEmail", default=None) - """The Git email address""" - - git_username: Optional[str] = FieldInfo(alias="gitUsername", default=None) - """The Git username""" - - initializer: Optional[EnvironmentSpecContentInitializer] = None - """EnvironmentInitializer specifies how an environment is to be initialized""" - - session: Optional[str] = None - - -class EnvironmentSpecDevcontainer(BaseModel): - devcontainer_file_path: Optional[str] = FieldInfo(alias="devcontainerFilePath", default=None) - """ - devcontainer_file_path is the path to the devcontainer file relative to the repo - root path must not be absolute (start with a /): - - ``` - this.matches('^$|^[^/].*') - ``` - """ - - session: Optional[str] = None - - -class EnvironmentSpecMachine(BaseModel): - class_: Optional[str] = FieldInfo(alias="class", default=None) - """Class denotes the class of the environment we ought to start""" - - session: Optional[str] = None - - -class EnvironmentSpecPort(BaseModel): - admission: Optional[ - Literal["ADMISSION_LEVEL_UNSPECIFIED", "ADMISSION_LEVEL_OWNER_ONLY", "ADMISSION_LEVEL_EVERYONE"] - ] = None - """Admission level describes who can access an environment instance and its ports.""" - - name: Optional[str] = None - """name of this port""" - - port: Optional[int] = None - """port number""" - - -class EnvironmentSpecSecretUnionMember0(BaseModel): - environment_variable: str = FieldInfo(alias="environmentVariable") - - name: Optional[str] = None - """name is the human readable description of the secret""" - - session: Optional[str] = None - """ - session indicated the current session of the secret. When the session does not - change, secrets are not reloaded in the environment. - """ - - source: Optional[str] = None - """source is the source of the secret, for now control-plane or runner""" - - source_ref: Optional[str] = FieldInfo(alias="sourceRef", default=None) - """source_ref into the source, in case of control-plane this is uuid of the secret""" - - -class EnvironmentSpecSecretFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted(BaseModel): - file_path: str = FieldInfo(alias="filePath") - """file_path is the path inside the devcontainer where the secret is mounted""" - - name: Optional[str] = None - """name is the human readable description of the secret""" - - session: Optional[str] = None - """ - session indicated the current session of the secret. When the session does not - change, secrets are not reloaded in the environment. - """ - - source: Optional[str] = None - """source is the source of the secret, for now control-plane or runner""" - - source_ref: Optional[str] = FieldInfo(alias="sourceRef", default=None) - """source_ref into the source, in case of control-plane this is uuid of the secret""" - - -class EnvironmentSpecSecretUnionMember2(BaseModel): - git_credential_host: str = FieldInfo(alias="gitCredentialHost") - - name: Optional[str] = None - """name is the human readable description of the secret""" - - session: Optional[str] = None - """ - session indicated the current session of the secret. When the session does not - change, secrets are not reloaded in the environment. - """ - - source: Optional[str] = None - """source is the source of the secret, for now control-plane or runner""" - - source_ref: Optional[str] = FieldInfo(alias="sourceRef", default=None) - """source_ref into the source, in case of control-plane this is uuid of the secret""" - - -EnvironmentSpecSecret: TypeAlias = Union[ - EnvironmentSpecSecretUnionMember0, - EnvironmentSpecSecretFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted, - EnvironmentSpecSecretUnionMember2, -] - - -class EnvironmentSpecSSHPublicKey(BaseModel): - id: Optional[str] = None - """id is the unique identifier of the public key""" - - value: Optional[str] = None - """value is the actual public key in the public key file format""" - - -class EnvironmentSpecTimeout(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". - """ - - -class EnvironmentSpec(BaseModel): - admission: Optional[ - Literal["ADMISSION_LEVEL_UNSPECIFIED", "ADMISSION_LEVEL_OWNER_ONLY", "ADMISSION_LEVEL_EVERYONE"] - ] = None - """Admission level describes who can access an environment instance and its ports.""" - - automations_file: Optional[EnvironmentSpecAutomationsFile] = FieldInfo(alias="automationsFile", default=None) - """automations_file is the automations file spec of the environment""" - - content: Optional[EnvironmentSpecContent] = None - """content is the content spec of the environment""" - - desired_phase: Optional[ - Literal[ - "ENVIRONMENT_PHASE_UNSPECIFIED", - "ENVIRONMENT_PHASE_CREATING", - "ENVIRONMENT_PHASE_STARTING", - "ENVIRONMENT_PHASE_RUNNING", - "ENVIRONMENT_PHASE_UPDATING", - "ENVIRONMENT_PHASE_STOPPING", - "ENVIRONMENT_PHASE_STOPPED", - "ENVIRONMENT_PHASE_DELETING", - "ENVIRONMENT_PHASE_DELETED", - ] - ] = FieldInfo(alias="desiredPhase", default=None) - """Phase is the desired phase of the environment""" - - devcontainer: Optional[EnvironmentSpecDevcontainer] = None - """devcontainer is the devcontainer spec of the environment""" - - machine: Optional[EnvironmentSpecMachine] = None - """machine is the machine spec of the environment""" - - ports: Optional[List[EnvironmentSpecPort]] = None - """ports is the set of ports which ought to be exposed to the internet""" - - secrets: Optional[List[EnvironmentSpecSecret]] = None - """secrets are confidential data that is mounted into the environment""" - - spec_version: Optional[str] = FieldInfo(alias="specVersion", default=None) - """version of the spec. - - The value of this field has no semantic meaning (e.g. don't interpret it as as a - timestamp), but it can be used to impose a partial order. If a.spec_version < - b.spec_version then a was the spec before b. - """ - - ssh_public_keys: Optional[List[EnvironmentSpecSSHPublicKey]] = FieldInfo(alias="sshPublicKeys", default=None) - """ssh_public_keys are the public keys used to ssh into the environment""" - - timeout: Optional[EnvironmentSpecTimeout] = None - """Timeout configures the environment timeout""" - - -class EnvironmentStatusActivitySignal(BaseModel): - source: Optional[str] = None - """ - source of the activity signal, such as "VS Code", "SSH", or "Automations". It - should be a human-readable string that describes the source of the activity - signal. - """ - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - -class EnvironmentStatusAutomationsFile(BaseModel): - automations_file_path: Optional[str] = FieldInfo(alias="automationsFilePath", default=None) - """ - automations_file_path is the path to the automations file relative to the repo - root. - """ - - automations_file_presence: Optional[ - Literal["PRESENCE_UNSPECIFIED", "PRESENCE_ABSENT", "PRESENCE_DISCOVERED", "PRESENCE_SPECIFIED"] - ] = FieldInfo(alias="automationsFilePresence", default=None) - """ - automations_file_presence indicates how an automations file is present in the - environment. - """ - - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """ - failure_message contains the reason the automations file failed to be applied. - This is only set if the phase is FAILED. - """ - - phase: Optional[ - Literal[ - "CONTENT_PHASE_UNSPECIFIED", - "CONTENT_PHASE_CREATING", - "CONTENT_PHASE_INITIALIZING", - "CONTENT_PHASE_READY", - "CONTENT_PHASE_UPDATING", - "CONTENT_PHASE_FAILED", - ] - ] = None - """phase is the current phase of the automations file.""" - - session: Optional[str] = None - """ - session is the automations file session that is currently applied in the - environment. - """ - - -class EnvironmentStatusContentGitChangedFile(BaseModel): - change_type: Optional[ - Literal[ - "CHANGE_TYPE_UNSPECIFIED", - "CHANGE_TYPE_ADDED", - "CHANGE_TYPE_MODIFIED", - "CHANGE_TYPE_DELETED", - "CHANGE_TYPE_RENAMED", - "CHANGE_TYPE_COPIED", - "CHANGE_TYPE_UPDATED_BUT_UNMERGED", - "CHANGE_TYPE_UNTRACKED", - ] - ] = FieldInfo(alias="changeType", default=None) - """ChangeType is the type of change that happened to the file""" - - path: Optional[str] = None - """path is the path of the file""" - - -class EnvironmentStatusContentGit(BaseModel): - branch: Optional[str] = None - """branch is branch we're currently on""" - - changed_files: Optional[List[EnvironmentStatusContentGitChangedFile]] = FieldInfo( - alias="changedFiles", default=None - ) - """ - changed_files is an array of changed files in the environment, possibly - truncated - """ - - clone_url: Optional[str] = FieldInfo(alias="cloneUrl", default=None) - """ - clone_url is the repository url as you would pass it to "git clone". Only HTTPS - clone URLs are supported. - """ - - latest_commit: Optional[str] = FieldInfo(alias="latestCommit", default=None) - """latest_commit is the most recent commit on the current branch""" - - total_changed_files: Optional[int] = FieldInfo(alias="totalChangedFiles", default=None) - - total_unpushed_commits: Optional[int] = FieldInfo(alias="totalUnpushedCommits", default=None) - """the total number of unpushed changes""" - - unpushed_commits: Optional[List[str]] = FieldInfo(alias="unpushedCommits", default=None) - """ - unpushed_commits is an array of unpushed changes in the environment, possibly - truncated - """ - - -class EnvironmentStatusContent(BaseModel): - content_location_in_machine: Optional[str] = FieldInfo(alias="contentLocationInMachine", default=None) - """content_location_in_machine is the location of the content in the machine""" - - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message contains the reason the content initialization failed.""" - - git: Optional[EnvironmentStatusContentGit] = None - """ - git is the Git working copy status of the environment. Note: this is a - best-effort field and more often than not will not be present. Its absence does - not indicate the absence of a working copy. - """ - - phase: Optional[ - Literal[ - "CONTENT_PHASE_UNSPECIFIED", - "CONTENT_PHASE_CREATING", - "CONTENT_PHASE_INITIALIZING", - "CONTENT_PHASE_READY", - "CONTENT_PHASE_UPDATING", - "CONTENT_PHASE_FAILED", - ] - ] = None - """phase is the current phase of the environment content""" - - session: Optional[str] = None - """session is the session that is currently active in the environment.""" - - warning_message: Optional[str] = FieldInfo(alias="warningMessage", default=None) - """warning_message contains warnings, e.g. - - when the content is present but not in the expected state. - """ - - -class EnvironmentStatusDevcontainer(BaseModel): - container_id: Optional[str] = FieldInfo(alias="containerId", default=None) - """container_id is the ID of the container.""" - - container_name: Optional[str] = FieldInfo(alias="containerName", default=None) - """ - container_name is the name of the container that is used to connect to the - devcontainer - """ - - devcontainerconfig_in_sync: Optional[bool] = FieldInfo(alias="devcontainerconfigInSync", default=None) - """devcontainerconfig_in_sync indicates if the devcontainer is up to date w.r.t. - - the devcontainer config file. - """ - - devcontainer_file_path: Optional[str] = FieldInfo(alias="devcontainerFilePath", default=None) - """ - devcontainer_file_path is the path to the devcontainer file relative to the repo - root - """ - - devcontainer_file_presence: Optional[ - Literal["PRESENCE_UNSPECIFIED", "PRESENCE_GENERATED", "PRESENCE_DISCOVERED", "PRESENCE_SPECIFIED"] - ] = FieldInfo(alias="devcontainerFilePresence", default=None) - """ - devcontainer_file_presence indicates how the devcontainer file is present in the - repo. - """ - - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message contains the reason the devcontainer failed to operate.""" - - phase: Optional[ - Literal["PHASE_UNSPECIFIED", "PHASE_CREATING", "PHASE_RUNNING", "PHASE_STOPPED", "PHASE_FAILED"] - ] = None - """phase is the current phase of the devcontainer""" - - remote_user: Optional[str] = FieldInfo(alias="remoteUser", default=None) - """remote_user is the user that is used to connect to the devcontainer""" - - remote_workspace_folder: Optional[str] = FieldInfo(alias="remoteWorkspaceFolder", default=None) - """ - remote_workspace_folder is the folder that is used to connect to the - devcontainer - """ - - secrets_in_sync: Optional[bool] = FieldInfo(alias="secretsInSync", default=None) - """secrets_in_sync indicates if the secrets are up to date w.r.t. - - the running devcontainer. - """ - - session: Optional[str] = None - """session is the session that is currently active in the devcontainer.""" - - warning_message: Optional[str] = FieldInfo(alias="warningMessage", default=None) - """warning_message contains warnings, e.g. - - when the devcontainer is present but not in the expected state. - """ - - -class EnvironmentStatusEnvironmentURLsPort(BaseModel): - port: Optional[int] = None - """port is the port number of the environment port""" - - url: Optional[str] = None - """url is the URL at which the environment port can be accessed""" - - -class EnvironmentStatusEnvironmentURLsSSH(BaseModel): - url: Optional[str] = None - - -class EnvironmentStatusEnvironmentURLs(BaseModel): - logs: Optional[str] = None - """logs is the URL at which the environment logs can be accessed.""" - - ports: Optional[List[EnvironmentStatusEnvironmentURLsPort]] = None - - ssh: Optional[EnvironmentStatusEnvironmentURLsSSH] = None - """SSH is the URL at which the environment can be accessed via SSH.""" - - -class EnvironmentStatusMachineVersions(BaseModel): - supervisor_commit: Optional[str] = FieldInfo(alias="supervisorCommit", default=None) - - supervisor_version: Optional[str] = FieldInfo(alias="supervisorVersion", default=None) - - -class EnvironmentStatusMachine(BaseModel): - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message contains the reason the machine failed to operate.""" - - phase: Optional[ - Literal[ - "PHASE_UNSPECIFIED", - "PHASE_CREATING", - "PHASE_STARTING", - "PHASE_RUNNING", - "PHASE_STOPPING", - "PHASE_STOPPED", - "PHASE_DELETING", - "PHASE_DELETED", - ] - ] = None - """phase is the current phase of the environment machine""" - - session: Optional[str] = None - """session is the session that is currently active in the machine.""" - - timeout: Optional[str] = None - """timeout contains the reason the environment has timed out. - - If this field is empty, the environment has not timed out. - """ - - versions: Optional[EnvironmentStatusMachineVersions] = None - """versions contains the versions of components in the machine.""" - - warning_message: Optional[str] = FieldInfo(alias="warningMessage", default=None) - """warning_message contains warnings, e.g. - - when the machine is present but not in the expected state. - """ - - -class EnvironmentStatusRunnerAck(BaseModel): - message: Optional[str] = None - - spec_version: Optional[str] = FieldInfo(alias="specVersion", default=None) - - status_code: Optional[ - Literal[ - "STATUS_CODE_UNSPECIFIED", - "STATUS_CODE_OK", - "STATUS_CODE_INVALID_RESOURCE", - "STATUS_CODE_FAILED_PRECONDITION", - ] - ] = FieldInfo(alias="statusCode", default=None) - - -class EnvironmentStatusSecret(BaseModel): - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message contains the reason the secret failed to be materialize.""" - - phase: Optional[ - Literal[ - "CONTENT_PHASE_UNSPECIFIED", - "CONTENT_PHASE_CREATING", - "CONTENT_PHASE_INITIALIZING", - "CONTENT_PHASE_READY", - "CONTENT_PHASE_UPDATING", - "CONTENT_PHASE_FAILED", - ] - ] = None - - secret_name: Optional[str] = FieldInfo(alias="secretName", default=None) - - session: Optional[str] = None - """session is the session that is currently active in the environment.""" - - warning_message: Optional[str] = FieldInfo(alias="warningMessage", default=None) - """warning_message contains warnings, e.g. - - when the secret is present but not in the expected state. - """ - - -class EnvironmentStatusSSHPublicKey(BaseModel): - id: Optional[str] = None - """id is the unique identifier of the public key""" - - phase: Optional[ - Literal[ - "CONTENT_PHASE_UNSPECIFIED", - "CONTENT_PHASE_CREATING", - "CONTENT_PHASE_INITIALIZING", - "CONTENT_PHASE_READY", - "CONTENT_PHASE_UPDATING", - "CONTENT_PHASE_FAILED", - ] - ] = None - """phase is the current phase of the public key""" - - -class EnvironmentStatus(BaseModel): - activity_signal: Optional[EnvironmentStatusActivitySignal] = FieldInfo(alias="activitySignal", default=None) - """EnvironmentActivitySignal used to signal activity for an environment.""" - - automations_file: Optional[EnvironmentStatusAutomationsFile] = FieldInfo(alias="automationsFile", default=None) - """automations_file contains the status of the automations file.""" - - content: Optional[EnvironmentStatusContent] = None - """content contains the status of the environment content.""" - - devcontainer: Optional[EnvironmentStatusDevcontainer] = None - """devcontainer contains the status of the devcontainer.""" - - environment_urls: Optional[EnvironmentStatusEnvironmentURLs] = FieldInfo(alias="environmentUrls", default=None) - """ - environment_url contains the URL at which the environment can be accessed. This - field is only set if the environment is running. - """ - - failure_message: Optional[List[str]] = FieldInfo(alias="failureMessage", default=None) - """failure_message summarises why the environment failed to operate. - - If this is non-empty the environment has failed to operate and will likely - transition to a stopped state. - """ - - machine: Optional[EnvironmentStatusMachine] = None - """machine contains the status of the environment machine""" - - phase: Optional[ - Literal[ - "ENVIRONMENT_PHASE_UNSPECIFIED", - "ENVIRONMENT_PHASE_CREATING", - "ENVIRONMENT_PHASE_STARTING", - "ENVIRONMENT_PHASE_RUNNING", - "ENVIRONMENT_PHASE_UPDATING", - "ENVIRONMENT_PHASE_STOPPING", - "ENVIRONMENT_PHASE_STOPPED", - "ENVIRONMENT_PHASE_DELETING", - "ENVIRONMENT_PHASE_DELETED", - ] - ] = None - """ - the phase of an environment is a simple, high-level summary of where the - environment is in its lifecycle - """ - - runner_ack: Optional[EnvironmentStatusRunnerAck] = FieldInfo(alias="runnerAck", default=None) - """ - RunnerACK is the acknowledgement from the runner that is has received the - environment spec. - """ - - secrets: Optional[List[EnvironmentStatusSecret]] = None - """secrets contains the status of the environment secrets""" - - ssh_public_keys: Optional[List[EnvironmentStatusSSHPublicKey]] = FieldInfo(alias="sshPublicKeys", default=None) - """ssh_public_keys contains the status of the environment ssh public keys""" - - status_version: Optional[str] = FieldInfo(alias="statusVersion", default=None) - """version of the status update. - - Environment instances themselves are unversioned, but their status has different - versions. The value of this field has no semantic meaning (e.g. don't interpret - it as as a timestamp), but it can be used to impose a partial order. If - a.status_version < b.status_version then a was the status before b. - """ - - warning_message: Optional[List[str]] = FieldInfo(alias="warningMessage", default=None) - """warning_message contains warnings, e.g. - - when the environment is present but not in the expected state. - """ - - -class Environment(BaseModel): - id: Optional[str] = None - """ID is a unique identifier of this environment. - - No other environment with the same name must be managed by this environment - manager - """ - - metadata: Optional[EnvironmentMetadata] = None - """ - EnvironmentMetadata is data associated with an environment that's required for - other parts of the system to function - """ - - spec: Optional[EnvironmentSpec] = None - """ - EnvironmentSpec specifies the configuration of an environment for an environment - start - """ - - status: Optional[EnvironmentStatus] = None - """EnvironmentStatus describes an environment status""" +__all__ = ["EnvironmentCreateFromProjectResponse"] class EnvironmentCreateFromProjectResponse(BaseModel): diff --git a/src/gitpod/types/environment_create_params.py b/src/gitpod/types/environment_create_params.py index ee192d9..33e65d8 100644 --- a/src/gitpod/types/environment_create_params.py +++ b/src/gitpod/types/environment_create_params.py @@ -2,340 +2,16 @@ from __future__ import annotations -from typing import Union, Iterable -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing_extensions import TypedDict -from .._utils import PropertyInfo +from .environment_spec_param import EnvironmentSpecParam -__all__ = [ - "EnvironmentCreateParams", - "Spec", - "SpecAutomationsFile", - "SpecContent", - "SpecContentInitializer", - "SpecContentInitializerSpec", - "SpecContentInitializerSpecContextURL", - "SpecContentInitializerSpecContextURLContextURL", - "SpecContentInitializerSpecGit", - "SpecContentInitializerSpecGitGit", - "SpecDevcontainer", - "SpecMachine", - "SpecPort", - "SpecSecret", - "SpecSecretUnionMember0", - "SpecSecretFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted", - "SpecSecretUnionMember2", - "SpecSSHPublicKey", - "SpecTimeout", -] +__all__ = ["EnvironmentCreateParams"] class EnvironmentCreateParams(TypedDict, total=False): - spec: Spec + spec: EnvironmentSpecParam """ EnvironmentSpec specifies the configuration of an environment for an environment start """ - - -class SpecAutomationsFile(TypedDict, total=False): - automations_file_path: Annotated[str, PropertyInfo(alias="automationsFilePath")] - """ - automations_file_path is the path to the automations file that is applied in the - environment, relative to the repo root. path must not be absolute (start with a - /): - - ``` - this.matches('^$|^[^/].*') - ``` - """ - - session: str - - -class SpecContentInitializerSpecContextURLContextURL(TypedDict, total=False): - url: str - """url is the URL from which the environment is created""" - - -class SpecContentInitializerSpecContextURL(TypedDict, total=False): - context_url: Required[Annotated[SpecContentInitializerSpecContextURLContextURL, PropertyInfo(alias="contextUrl")]] - - -class SpecContentInitializerSpecGitGit(TypedDict, total=False): - checkout_location: Annotated[str, PropertyInfo(alias="checkoutLocation")] - """ - a path relative to the environment root in which the code will be checked out to - """ - - clone_target: Annotated[str, PropertyInfo(alias="cloneTarget")] - """the value for the clone target mode - use depends on the target mode""" - - remote_uri: Annotated[str, PropertyInfo(alias="remoteUri")] - """remote_uri is the Git remote origin""" - - target_mode: Annotated[ - Literal[ - "CLONE_TARGET_MODE_UNSPECIFIED", - "CLONE_TARGET_MODE_REMOTE_HEAD", - "CLONE_TARGET_MODE_REMOTE_COMMIT", - "CLONE_TARGET_MODE_REMOTE_BRANCH", - "CLONE_TARGET_MODE_LOCAL_BRANCH", - ], - PropertyInfo(alias="targetMode"), - ] - """CloneTargetMode is the target state in which we want to leave a GitEnvironment""" - - upstream_remote_uri: Annotated[str, PropertyInfo(alias="upstreamRemoteUri")] - """upstream_Remote_uri is the fork upstream of a repository""" - - -class SpecContentInitializerSpecGit(TypedDict, total=False): - git: Required[SpecContentInitializerSpecGitGit] - - -SpecContentInitializerSpec: TypeAlias = Union[SpecContentInitializerSpecContextURL, SpecContentInitializerSpecGit] - - -class SpecContentInitializer(TypedDict, total=False): - specs: Iterable[SpecContentInitializerSpec] - - -class SpecContent(TypedDict, total=False): - git_email: Annotated[str, PropertyInfo(alias="gitEmail")] - """The Git email address""" - - git_username: Annotated[str, PropertyInfo(alias="gitUsername")] - """The Git username""" - - initializer: SpecContentInitializer - """EnvironmentInitializer specifies how an environment is to be initialized""" - - session: str - - -class SpecDevcontainer(TypedDict, total=False): - devcontainer_file_path: Annotated[str, PropertyInfo(alias="devcontainerFilePath")] - """ - devcontainer_file_path is the path to the devcontainer file relative to the repo - root path must not be absolute (start with a /): - - ``` - this.matches('^$|^[^/].*') - ``` - """ - - session: str - - -_SpecMachineReservedKeywords = TypedDict( - "_SpecMachineReservedKeywords", - { - "class": str, - }, - total=False, -) - - -class SpecMachine(_SpecMachineReservedKeywords, total=False): - session: str - - -class SpecPort(TypedDict, total=False): - admission: Literal["ADMISSION_LEVEL_UNSPECIFIED", "ADMISSION_LEVEL_OWNER_ONLY", "ADMISSION_LEVEL_EVERYONE"] - """Admission level describes who can access an environment instance and its ports.""" - - name: str - """name of this port""" - - port: int - """port number""" - - -class SpecSecretUnionMember0(TypedDict, total=False): - environment_variable: Required[Annotated[str, PropertyInfo(alias="environmentVariable")]] - - name: str - """name is the human readable description of the secret""" - - session: str - """ - session indicated the current session of the secret. When the session does not - change, secrets are not reloaded in the environment. - """ - - source: str - """source is the source of the secret, for now control-plane or runner""" - - source_ref: Annotated[str, PropertyInfo(alias="sourceRef")] - """source_ref into the source, in case of control-plane this is uuid of the secret""" - - -class SpecSecretFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted(TypedDict, total=False): - file_path: Required[Annotated[str, PropertyInfo(alias="filePath")]] - """file_path is the path inside the devcontainer where the secret is mounted""" - - name: str - """name is the human readable description of the secret""" - - session: str - """ - session indicated the current session of the secret. When the session does not - change, secrets are not reloaded in the environment. - """ - - source: str - """source is the source of the secret, for now control-plane or runner""" - - source_ref: Annotated[str, PropertyInfo(alias="sourceRef")] - """source_ref into the source, in case of control-plane this is uuid of the secret""" - - -class SpecSecretUnionMember2(TypedDict, total=False): - git_credential_host: Required[Annotated[str, PropertyInfo(alias="gitCredentialHost")]] - - name: str - """name is the human readable description of the secret""" - - session: str - """ - session indicated the current session of the secret. When the session does not - change, secrets are not reloaded in the environment. - """ - - source: str - """source is the source of the secret, for now control-plane or runner""" - - source_ref: Annotated[str, PropertyInfo(alias="sourceRef")] - """source_ref into the source, in case of control-plane this is uuid of the secret""" - - -SpecSecret: TypeAlias = Union[ - SpecSecretUnionMember0, - SpecSecretFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted, - SpecSecretUnionMember2, -] - - -class SpecSSHPublicKey(TypedDict, total=False): - id: str - """id is the unique identifier of the public key""" - - value: str - """value is the actual public key in the public key file format""" - - -class SpecTimeout(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". - """ - - -class Spec(TypedDict, total=False): - admission: Literal["ADMISSION_LEVEL_UNSPECIFIED", "ADMISSION_LEVEL_OWNER_ONLY", "ADMISSION_LEVEL_EVERYONE"] - """Admission level describes who can access an environment instance and its ports.""" - - automations_file: Annotated[SpecAutomationsFile, PropertyInfo(alias="automationsFile")] - """automations_file is the automations file spec of the environment""" - - content: SpecContent - """content is the content spec of the environment""" - - desired_phase: Annotated[ - Literal[ - "ENVIRONMENT_PHASE_UNSPECIFIED", - "ENVIRONMENT_PHASE_CREATING", - "ENVIRONMENT_PHASE_STARTING", - "ENVIRONMENT_PHASE_RUNNING", - "ENVIRONMENT_PHASE_UPDATING", - "ENVIRONMENT_PHASE_STOPPING", - "ENVIRONMENT_PHASE_STOPPED", - "ENVIRONMENT_PHASE_DELETING", - "ENVIRONMENT_PHASE_DELETED", - ], - PropertyInfo(alias="desiredPhase"), - ] - """Phase is the desired phase of the environment""" - - devcontainer: SpecDevcontainer - """devcontainer is the devcontainer spec of the environment""" - - machine: SpecMachine - """machine is the machine spec of the environment""" - - ports: Iterable[SpecPort] - """ports is the set of ports which ought to be exposed to the internet""" - - secrets: Iterable[SpecSecret] - """secrets are confidential data that is mounted into the environment""" - - spec_version: Annotated[str, PropertyInfo(alias="specVersion")] - """version of the spec. - - The value of this field has no semantic meaning (e.g. don't interpret it as as a - timestamp), but it can be used to impose a partial order. If a.spec_version < - b.spec_version then a was the spec before b. - """ - - ssh_public_keys: Annotated[Iterable[SpecSSHPublicKey], PropertyInfo(alias="sshPublicKeys")] - """ssh_public_keys are the public keys used to ssh into the environment""" - - timeout: SpecTimeout - """Timeout configures the environment timeout""" diff --git a/src/gitpod/types/environment_create_response.py b/src/gitpod/types/environment_create_response.py index 22377c6..3fb02bb 100644 --- a/src/gitpod/types/environment_create_response.py +++ b/src/gitpod/types/environment_create_response.py @@ -1,1101 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias - -from pydantic import Field as FieldInfo +from typing import Optional from .._models import BaseModel +from .environment import Environment -__all__ = [ - "EnvironmentCreateResponse", - "Environment", - "EnvironmentMetadata", - "EnvironmentMetadataCreator", - "EnvironmentSpec", - "EnvironmentSpecAutomationsFile", - "EnvironmentSpecContent", - "EnvironmentSpecContentInitializer", - "EnvironmentSpecContentInitializerSpec", - "EnvironmentSpecContentInitializerSpecContextURL", - "EnvironmentSpecContentInitializerSpecContextURLContextURL", - "EnvironmentSpecContentInitializerSpecGit", - "EnvironmentSpecContentInitializerSpecGitGit", - "EnvironmentSpecDevcontainer", - "EnvironmentSpecMachine", - "EnvironmentSpecPort", - "EnvironmentSpecSecret", - "EnvironmentSpecSecretUnionMember0", - "EnvironmentSpecSecretFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted", - "EnvironmentSpecSecretUnionMember2", - "EnvironmentSpecSSHPublicKey", - "EnvironmentSpecTimeout", - "EnvironmentStatus", - "EnvironmentStatusActivitySignal", - "EnvironmentStatusAutomationsFile", - "EnvironmentStatusContent", - "EnvironmentStatusContentGit", - "EnvironmentStatusContentGitChangedFile", - "EnvironmentStatusDevcontainer", - "EnvironmentStatusEnvironmentURLs", - "EnvironmentStatusEnvironmentURLsPort", - "EnvironmentStatusEnvironmentURLsSSH", - "EnvironmentStatusMachine", - "EnvironmentStatusMachineVersions", - "EnvironmentStatusRunnerAck", - "EnvironmentStatusSecret", - "EnvironmentStatusSSHPublicKey", -] - - -class EnvironmentMetadataCreator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class EnvironmentMetadata(BaseModel): - annotations: Optional[Dict[str, str]] = None - """ - annotations are key/value pairs that gets attached to the environment. - +internal - not yet implemented - """ - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - creator: Optional[EnvironmentMetadataCreator] = 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. - - In JavaScript, one can convert a Date object to this format using the standard - [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - method. In Python, a standard `datetime.datetime` object can be converted to - this format using - [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - Joda Time's - [`ISODateTimeFormat.dateTime()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - name: Optional[str] = None - """name is the name of the environment as specified by the user""" - - organization_id: Optional[str] = FieldInfo(alias="organizationId", default=None) - """organization_id is the ID of the organization that contains the environment""" - - original_context_url: Optional[str] = FieldInfo(alias="originalContextUrl", default=None) - """ - original_context_url is the normalized URL from which the environment was - created - """ - - project_id: Optional[str] = FieldInfo(alias="projectId", default=None) - """ - If the Environment was started from a project, the project_id will reference the - project. - """ - - runner_id: Optional[str] = FieldInfo(alias="runnerId", default=None) - """Runner is the ID of the runner that runs this environment.""" - - -class EnvironmentSpecAutomationsFile(BaseModel): - automations_file_path: Optional[str] = FieldInfo(alias="automationsFilePath", default=None) - """ - automations_file_path is the path to the automations file that is applied in the - environment, relative to the repo root. path must not be absolute (start with a - /): - - ``` - this.matches('^$|^[^/].*') - ``` - """ - - session: Optional[str] = None - - -class EnvironmentSpecContentInitializerSpecContextURLContextURL(BaseModel): - url: Optional[str] = None - """url is the URL from which the environment is created""" - - -class EnvironmentSpecContentInitializerSpecContextURL(BaseModel): - context_url: EnvironmentSpecContentInitializerSpecContextURLContextURL = FieldInfo(alias="contextUrl") - - -class EnvironmentSpecContentInitializerSpecGitGit(BaseModel): - checkout_location: Optional[str] = FieldInfo(alias="checkoutLocation", default=None) - """ - a path relative to the environment root in which the code will be checked out to - """ - - clone_target: Optional[str] = FieldInfo(alias="cloneTarget", default=None) - """the value for the clone target mode - use depends on the target mode""" - - remote_uri: Optional[str] = FieldInfo(alias="remoteUri", default=None) - """remote_uri is the Git remote origin""" - - target_mode: Optional[ - Literal[ - "CLONE_TARGET_MODE_UNSPECIFIED", - "CLONE_TARGET_MODE_REMOTE_HEAD", - "CLONE_TARGET_MODE_REMOTE_COMMIT", - "CLONE_TARGET_MODE_REMOTE_BRANCH", - "CLONE_TARGET_MODE_LOCAL_BRANCH", - ] - ] = FieldInfo(alias="targetMode", default=None) - """CloneTargetMode is the target state in which we want to leave a GitEnvironment""" - - upstream_remote_uri: Optional[str] = FieldInfo(alias="upstreamRemoteUri", default=None) - """upstream_Remote_uri is the fork upstream of a repository""" - - -class EnvironmentSpecContentInitializerSpecGit(BaseModel): - git: EnvironmentSpecContentInitializerSpecGitGit - - -EnvironmentSpecContentInitializerSpec: TypeAlias = Union[ - EnvironmentSpecContentInitializerSpecContextURL, EnvironmentSpecContentInitializerSpecGit -] - - -class EnvironmentSpecContentInitializer(BaseModel): - specs: Optional[List[EnvironmentSpecContentInitializerSpec]] = None - - -class EnvironmentSpecContent(BaseModel): - git_email: Optional[str] = FieldInfo(alias="gitEmail", default=None) - """The Git email address""" - - git_username: Optional[str] = FieldInfo(alias="gitUsername", default=None) - """The Git username""" - - initializer: Optional[EnvironmentSpecContentInitializer] = None - """EnvironmentInitializer specifies how an environment is to be initialized""" - - session: Optional[str] = None - - -class EnvironmentSpecDevcontainer(BaseModel): - devcontainer_file_path: Optional[str] = FieldInfo(alias="devcontainerFilePath", default=None) - """ - devcontainer_file_path is the path to the devcontainer file relative to the repo - root path must not be absolute (start with a /): - - ``` - this.matches('^$|^[^/].*') - ``` - """ - - session: Optional[str] = None - - -class EnvironmentSpecMachine(BaseModel): - class_: Optional[str] = FieldInfo(alias="class", default=None) - """Class denotes the class of the environment we ought to start""" - - session: Optional[str] = None - - -class EnvironmentSpecPort(BaseModel): - admission: Optional[ - Literal["ADMISSION_LEVEL_UNSPECIFIED", "ADMISSION_LEVEL_OWNER_ONLY", "ADMISSION_LEVEL_EVERYONE"] - ] = None - """Admission level describes who can access an environment instance and its ports.""" - - name: Optional[str] = None - """name of this port""" - - port: Optional[int] = None - """port number""" - - -class EnvironmentSpecSecretUnionMember0(BaseModel): - environment_variable: str = FieldInfo(alias="environmentVariable") - - name: Optional[str] = None - """name is the human readable description of the secret""" - - session: Optional[str] = None - """ - session indicated the current session of the secret. When the session does not - change, secrets are not reloaded in the environment. - """ - - source: Optional[str] = None - """source is the source of the secret, for now control-plane or runner""" - - source_ref: Optional[str] = FieldInfo(alias="sourceRef", default=None) - """source_ref into the source, in case of control-plane this is uuid of the secret""" - - -class EnvironmentSpecSecretFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted(BaseModel): - file_path: str = FieldInfo(alias="filePath") - """file_path is the path inside the devcontainer where the secret is mounted""" - - name: Optional[str] = None - """name is the human readable description of the secret""" - - session: Optional[str] = None - """ - session indicated the current session of the secret. When the session does not - change, secrets are not reloaded in the environment. - """ - - source: Optional[str] = None - """source is the source of the secret, for now control-plane or runner""" - - source_ref: Optional[str] = FieldInfo(alias="sourceRef", default=None) - """source_ref into the source, in case of control-plane this is uuid of the secret""" - - -class EnvironmentSpecSecretUnionMember2(BaseModel): - git_credential_host: str = FieldInfo(alias="gitCredentialHost") - - name: Optional[str] = None - """name is the human readable description of the secret""" - - session: Optional[str] = None - """ - session indicated the current session of the secret. When the session does not - change, secrets are not reloaded in the environment. - """ - - source: Optional[str] = None - """source is the source of the secret, for now control-plane or runner""" - - source_ref: Optional[str] = FieldInfo(alias="sourceRef", default=None) - """source_ref into the source, in case of control-plane this is uuid of the secret""" - - -EnvironmentSpecSecret: TypeAlias = Union[ - EnvironmentSpecSecretUnionMember0, - EnvironmentSpecSecretFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted, - EnvironmentSpecSecretUnionMember2, -] - - -class EnvironmentSpecSSHPublicKey(BaseModel): - id: Optional[str] = None - """id is the unique identifier of the public key""" - - value: Optional[str] = None - """value is the actual public key in the public key file format""" - - -class EnvironmentSpecTimeout(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". - """ - - -class EnvironmentSpec(BaseModel): - admission: Optional[ - Literal["ADMISSION_LEVEL_UNSPECIFIED", "ADMISSION_LEVEL_OWNER_ONLY", "ADMISSION_LEVEL_EVERYONE"] - ] = None - """Admission level describes who can access an environment instance and its ports.""" - - automations_file: Optional[EnvironmentSpecAutomationsFile] = FieldInfo(alias="automationsFile", default=None) - """automations_file is the automations file spec of the environment""" - - content: Optional[EnvironmentSpecContent] = None - """content is the content spec of the environment""" - - desired_phase: Optional[ - Literal[ - "ENVIRONMENT_PHASE_UNSPECIFIED", - "ENVIRONMENT_PHASE_CREATING", - "ENVIRONMENT_PHASE_STARTING", - "ENVIRONMENT_PHASE_RUNNING", - "ENVIRONMENT_PHASE_UPDATING", - "ENVIRONMENT_PHASE_STOPPING", - "ENVIRONMENT_PHASE_STOPPED", - "ENVIRONMENT_PHASE_DELETING", - "ENVIRONMENT_PHASE_DELETED", - ] - ] = FieldInfo(alias="desiredPhase", default=None) - """Phase is the desired phase of the environment""" - - devcontainer: Optional[EnvironmentSpecDevcontainer] = None - """devcontainer is the devcontainer spec of the environment""" - - machine: Optional[EnvironmentSpecMachine] = None - """machine is the machine spec of the environment""" - - ports: Optional[List[EnvironmentSpecPort]] = None - """ports is the set of ports which ought to be exposed to the internet""" - - secrets: Optional[List[EnvironmentSpecSecret]] = None - """secrets are confidential data that is mounted into the environment""" - - spec_version: Optional[str] = FieldInfo(alias="specVersion", default=None) - """version of the spec. - - The value of this field has no semantic meaning (e.g. don't interpret it as as a - timestamp), but it can be used to impose a partial order. If a.spec_version < - b.spec_version then a was the spec before b. - """ - - ssh_public_keys: Optional[List[EnvironmentSpecSSHPublicKey]] = FieldInfo(alias="sshPublicKeys", default=None) - """ssh_public_keys are the public keys used to ssh into the environment""" - - timeout: Optional[EnvironmentSpecTimeout] = None - """Timeout configures the environment timeout""" - - -class EnvironmentStatusActivitySignal(BaseModel): - source: Optional[str] = None - """ - source of the activity signal, such as "VS Code", "SSH", or "Automations". It - should be a human-readable string that describes the source of the activity - signal. - """ - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - -class EnvironmentStatusAutomationsFile(BaseModel): - automations_file_path: Optional[str] = FieldInfo(alias="automationsFilePath", default=None) - """ - automations_file_path is the path to the automations file relative to the repo - root. - """ - - automations_file_presence: Optional[ - Literal["PRESENCE_UNSPECIFIED", "PRESENCE_ABSENT", "PRESENCE_DISCOVERED", "PRESENCE_SPECIFIED"] - ] = FieldInfo(alias="automationsFilePresence", default=None) - """ - automations_file_presence indicates how an automations file is present in the - environment. - """ - - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """ - failure_message contains the reason the automations file failed to be applied. - This is only set if the phase is FAILED. - """ - - phase: Optional[ - Literal[ - "CONTENT_PHASE_UNSPECIFIED", - "CONTENT_PHASE_CREATING", - "CONTENT_PHASE_INITIALIZING", - "CONTENT_PHASE_READY", - "CONTENT_PHASE_UPDATING", - "CONTENT_PHASE_FAILED", - ] - ] = None - """phase is the current phase of the automations file.""" - - session: Optional[str] = None - """ - session is the automations file session that is currently applied in the - environment. - """ - - -class EnvironmentStatusContentGitChangedFile(BaseModel): - change_type: Optional[ - Literal[ - "CHANGE_TYPE_UNSPECIFIED", - "CHANGE_TYPE_ADDED", - "CHANGE_TYPE_MODIFIED", - "CHANGE_TYPE_DELETED", - "CHANGE_TYPE_RENAMED", - "CHANGE_TYPE_COPIED", - "CHANGE_TYPE_UPDATED_BUT_UNMERGED", - "CHANGE_TYPE_UNTRACKED", - ] - ] = FieldInfo(alias="changeType", default=None) - """ChangeType is the type of change that happened to the file""" - - path: Optional[str] = None - """path is the path of the file""" - - -class EnvironmentStatusContentGit(BaseModel): - branch: Optional[str] = None - """branch is branch we're currently on""" - - changed_files: Optional[List[EnvironmentStatusContentGitChangedFile]] = FieldInfo( - alias="changedFiles", default=None - ) - """ - changed_files is an array of changed files in the environment, possibly - truncated - """ - - clone_url: Optional[str] = FieldInfo(alias="cloneUrl", default=None) - """ - clone_url is the repository url as you would pass it to "git clone". Only HTTPS - clone URLs are supported. - """ - - latest_commit: Optional[str] = FieldInfo(alias="latestCommit", default=None) - """latest_commit is the most recent commit on the current branch""" - - total_changed_files: Optional[int] = FieldInfo(alias="totalChangedFiles", default=None) - - total_unpushed_commits: Optional[int] = FieldInfo(alias="totalUnpushedCommits", default=None) - """the total number of unpushed changes""" - - unpushed_commits: Optional[List[str]] = FieldInfo(alias="unpushedCommits", default=None) - """ - unpushed_commits is an array of unpushed changes in the environment, possibly - truncated - """ - - -class EnvironmentStatusContent(BaseModel): - content_location_in_machine: Optional[str] = FieldInfo(alias="contentLocationInMachine", default=None) - """content_location_in_machine is the location of the content in the machine""" - - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message contains the reason the content initialization failed.""" - - git: Optional[EnvironmentStatusContentGit] = None - """ - git is the Git working copy status of the environment. Note: this is a - best-effort field and more often than not will not be present. Its absence does - not indicate the absence of a working copy. - """ - - phase: Optional[ - Literal[ - "CONTENT_PHASE_UNSPECIFIED", - "CONTENT_PHASE_CREATING", - "CONTENT_PHASE_INITIALIZING", - "CONTENT_PHASE_READY", - "CONTENT_PHASE_UPDATING", - "CONTENT_PHASE_FAILED", - ] - ] = None - """phase is the current phase of the environment content""" - - session: Optional[str] = None - """session is the session that is currently active in the environment.""" - - warning_message: Optional[str] = FieldInfo(alias="warningMessage", default=None) - """warning_message contains warnings, e.g. - - when the content is present but not in the expected state. - """ - - -class EnvironmentStatusDevcontainer(BaseModel): - container_id: Optional[str] = FieldInfo(alias="containerId", default=None) - """container_id is the ID of the container.""" - - container_name: Optional[str] = FieldInfo(alias="containerName", default=None) - """ - container_name is the name of the container that is used to connect to the - devcontainer - """ - - devcontainerconfig_in_sync: Optional[bool] = FieldInfo(alias="devcontainerconfigInSync", default=None) - """devcontainerconfig_in_sync indicates if the devcontainer is up to date w.r.t. - - the devcontainer config file. - """ - - devcontainer_file_path: Optional[str] = FieldInfo(alias="devcontainerFilePath", default=None) - """ - devcontainer_file_path is the path to the devcontainer file relative to the repo - root - """ - - devcontainer_file_presence: Optional[ - Literal["PRESENCE_UNSPECIFIED", "PRESENCE_GENERATED", "PRESENCE_DISCOVERED", "PRESENCE_SPECIFIED"] - ] = FieldInfo(alias="devcontainerFilePresence", default=None) - """ - devcontainer_file_presence indicates how the devcontainer file is present in the - repo. - """ - - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message contains the reason the devcontainer failed to operate.""" - - phase: Optional[ - Literal["PHASE_UNSPECIFIED", "PHASE_CREATING", "PHASE_RUNNING", "PHASE_STOPPED", "PHASE_FAILED"] - ] = None - """phase is the current phase of the devcontainer""" - - remote_user: Optional[str] = FieldInfo(alias="remoteUser", default=None) - """remote_user is the user that is used to connect to the devcontainer""" - - remote_workspace_folder: Optional[str] = FieldInfo(alias="remoteWorkspaceFolder", default=None) - """ - remote_workspace_folder is the folder that is used to connect to the - devcontainer - """ - - secrets_in_sync: Optional[bool] = FieldInfo(alias="secretsInSync", default=None) - """secrets_in_sync indicates if the secrets are up to date w.r.t. - - the running devcontainer. - """ - - session: Optional[str] = None - """session is the session that is currently active in the devcontainer.""" - - warning_message: Optional[str] = FieldInfo(alias="warningMessage", default=None) - """warning_message contains warnings, e.g. - - when the devcontainer is present but not in the expected state. - """ - - -class EnvironmentStatusEnvironmentURLsPort(BaseModel): - port: Optional[int] = None - """port is the port number of the environment port""" - - url: Optional[str] = None - """url is the URL at which the environment port can be accessed""" - - -class EnvironmentStatusEnvironmentURLsSSH(BaseModel): - url: Optional[str] = None - - -class EnvironmentStatusEnvironmentURLs(BaseModel): - logs: Optional[str] = None - """logs is the URL at which the environment logs can be accessed.""" - - ports: Optional[List[EnvironmentStatusEnvironmentURLsPort]] = None - - ssh: Optional[EnvironmentStatusEnvironmentURLsSSH] = None - """SSH is the URL at which the environment can be accessed via SSH.""" - - -class EnvironmentStatusMachineVersions(BaseModel): - supervisor_commit: Optional[str] = FieldInfo(alias="supervisorCommit", default=None) - - supervisor_version: Optional[str] = FieldInfo(alias="supervisorVersion", default=None) - - -class EnvironmentStatusMachine(BaseModel): - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message contains the reason the machine failed to operate.""" - - phase: Optional[ - Literal[ - "PHASE_UNSPECIFIED", - "PHASE_CREATING", - "PHASE_STARTING", - "PHASE_RUNNING", - "PHASE_STOPPING", - "PHASE_STOPPED", - "PHASE_DELETING", - "PHASE_DELETED", - ] - ] = None - """phase is the current phase of the environment machine""" - - session: Optional[str] = None - """session is the session that is currently active in the machine.""" - - timeout: Optional[str] = None - """timeout contains the reason the environment has timed out. - - If this field is empty, the environment has not timed out. - """ - - versions: Optional[EnvironmentStatusMachineVersions] = None - """versions contains the versions of components in the machine.""" - - warning_message: Optional[str] = FieldInfo(alias="warningMessage", default=None) - """warning_message contains warnings, e.g. - - when the machine is present but not in the expected state. - """ - - -class EnvironmentStatusRunnerAck(BaseModel): - message: Optional[str] = None - - spec_version: Optional[str] = FieldInfo(alias="specVersion", default=None) - - status_code: Optional[ - Literal[ - "STATUS_CODE_UNSPECIFIED", - "STATUS_CODE_OK", - "STATUS_CODE_INVALID_RESOURCE", - "STATUS_CODE_FAILED_PRECONDITION", - ] - ] = FieldInfo(alias="statusCode", default=None) - - -class EnvironmentStatusSecret(BaseModel): - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message contains the reason the secret failed to be materialize.""" - - phase: Optional[ - Literal[ - "CONTENT_PHASE_UNSPECIFIED", - "CONTENT_PHASE_CREATING", - "CONTENT_PHASE_INITIALIZING", - "CONTENT_PHASE_READY", - "CONTENT_PHASE_UPDATING", - "CONTENT_PHASE_FAILED", - ] - ] = None - - secret_name: Optional[str] = FieldInfo(alias="secretName", default=None) - - session: Optional[str] = None - """session is the session that is currently active in the environment.""" - - warning_message: Optional[str] = FieldInfo(alias="warningMessage", default=None) - """warning_message contains warnings, e.g. - - when the secret is present but not in the expected state. - """ - - -class EnvironmentStatusSSHPublicKey(BaseModel): - id: Optional[str] = None - """id is the unique identifier of the public key""" - - phase: Optional[ - Literal[ - "CONTENT_PHASE_UNSPECIFIED", - "CONTENT_PHASE_CREATING", - "CONTENT_PHASE_INITIALIZING", - "CONTENT_PHASE_READY", - "CONTENT_PHASE_UPDATING", - "CONTENT_PHASE_FAILED", - ] - ] = None - """phase is the current phase of the public key""" - - -class EnvironmentStatus(BaseModel): - activity_signal: Optional[EnvironmentStatusActivitySignal] = FieldInfo(alias="activitySignal", default=None) - """EnvironmentActivitySignal used to signal activity for an environment.""" - - automations_file: Optional[EnvironmentStatusAutomationsFile] = FieldInfo(alias="automationsFile", default=None) - """automations_file contains the status of the automations file.""" - - content: Optional[EnvironmentStatusContent] = None - """content contains the status of the environment content.""" - - devcontainer: Optional[EnvironmentStatusDevcontainer] = None - """devcontainer contains the status of the devcontainer.""" - - environment_urls: Optional[EnvironmentStatusEnvironmentURLs] = FieldInfo(alias="environmentUrls", default=None) - """ - environment_url contains the URL at which the environment can be accessed. This - field is only set if the environment is running. - """ - - failure_message: Optional[List[str]] = FieldInfo(alias="failureMessage", default=None) - """failure_message summarises why the environment failed to operate. - - If this is non-empty the environment has failed to operate and will likely - transition to a stopped state. - """ - - machine: Optional[EnvironmentStatusMachine] = None - """machine contains the status of the environment machine""" - - phase: Optional[ - Literal[ - "ENVIRONMENT_PHASE_UNSPECIFIED", - "ENVIRONMENT_PHASE_CREATING", - "ENVIRONMENT_PHASE_STARTING", - "ENVIRONMENT_PHASE_RUNNING", - "ENVIRONMENT_PHASE_UPDATING", - "ENVIRONMENT_PHASE_STOPPING", - "ENVIRONMENT_PHASE_STOPPED", - "ENVIRONMENT_PHASE_DELETING", - "ENVIRONMENT_PHASE_DELETED", - ] - ] = None - """ - the phase of an environment is a simple, high-level summary of where the - environment is in its lifecycle - """ - - runner_ack: Optional[EnvironmentStatusRunnerAck] = FieldInfo(alias="runnerAck", default=None) - """ - RunnerACK is the acknowledgement from the runner that is has received the - environment spec. - """ - - secrets: Optional[List[EnvironmentStatusSecret]] = None - """secrets contains the status of the environment secrets""" - - ssh_public_keys: Optional[List[EnvironmentStatusSSHPublicKey]] = FieldInfo(alias="sshPublicKeys", default=None) - """ssh_public_keys contains the status of the environment ssh public keys""" - - status_version: Optional[str] = FieldInfo(alias="statusVersion", default=None) - """version of the status update. - - Environment instances themselves are unversioned, but their status has different - versions. The value of this field has no semantic meaning (e.g. don't interpret - it as as a timestamp), but it can be used to impose a partial order. If - a.status_version < b.status_version then a was the status before b. - """ - - warning_message: Optional[List[str]] = FieldInfo(alias="warningMessage", default=None) - """warning_message contains warnings, e.g. - - when the environment is present but not in the expected state. - """ - - -class Environment(BaseModel): - id: Optional[str] = None - """ID is a unique identifier of this environment. - - No other environment with the same name must be managed by this environment - manager - """ - - metadata: Optional[EnvironmentMetadata] = None - """ - EnvironmentMetadata is data associated with an environment that's required for - other parts of the system to function - """ - - spec: Optional[EnvironmentSpec] = None - """ - EnvironmentSpec specifies the configuration of an environment for an environment - start - """ - - status: Optional[EnvironmentStatus] = None - """EnvironmentStatus describes an environment status""" +__all__ = ["EnvironmentCreateResponse"] class EnvironmentCreateResponse(BaseModel): diff --git a/src/gitpod/types/environment_initializer.py b/src/gitpod/types/environment_initializer.py new file mode 100644 index 0000000..8630b15 --- /dev/null +++ b/src/gitpod/types/environment_initializer.py @@ -0,0 +1,52 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["EnvironmentInitializer", "Spec", "SpecContextURL", "SpecGit"] + + +class SpecContextURL(BaseModel): + url: Optional[str] = None + """url is the URL from which the environment is created""" + + +class SpecGit(BaseModel): + checkout_location: Optional[str] = FieldInfo(alias="checkoutLocation", default=None) + """ + a path relative to the environment root in which the code will be checked out to + """ + + clone_target: Optional[str] = FieldInfo(alias="cloneTarget", default=None) + """the value for the clone target mode - use depends on the target mode""" + + remote_uri: Optional[str] = FieldInfo(alias="remoteUri", default=None) + """remote_uri is the Git remote origin""" + + target_mode: Optional[ + Literal[ + "CLONE_TARGET_MODE_UNSPECIFIED", + "CLONE_TARGET_MODE_REMOTE_HEAD", + "CLONE_TARGET_MODE_REMOTE_COMMIT", + "CLONE_TARGET_MODE_REMOTE_BRANCH", + "CLONE_TARGET_MODE_LOCAL_BRANCH", + ] + ] = FieldInfo(alias="targetMode", default=None) + """CloneTargetMode is the target state in which we want to leave a GitEnvironment""" + + upstream_remote_uri: Optional[str] = FieldInfo(alias="upstreamRemoteUri", default=None) + """upstream_Remote_uri is the fork upstream of a repository""" + + +class Spec(BaseModel): + context_url: Optional[SpecContextURL] = FieldInfo(alias="contextUrl", default=None) + + git: Optional[SpecGit] = None + + +class EnvironmentInitializer(BaseModel): + specs: Optional[List[Spec]] = None diff --git a/src/gitpod/types/environment_initializer_param.py b/src/gitpod/types/environment_initializer_param.py new file mode 100644 index 0000000..32b0a64 --- /dev/null +++ b/src/gitpod/types/environment_initializer_param.py @@ -0,0 +1,53 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Literal, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["EnvironmentInitializerParam", "Spec", "SpecContextURL", "SpecGit"] + + +class SpecContextURL(TypedDict, total=False): + url: str + """url is the URL from which the environment is created""" + + +class SpecGit(TypedDict, total=False): + checkout_location: Annotated[str, PropertyInfo(alias="checkoutLocation")] + """ + a path relative to the environment root in which the code will be checked out to + """ + + clone_target: Annotated[str, PropertyInfo(alias="cloneTarget")] + """the value for the clone target mode - use depends on the target mode""" + + remote_uri: Annotated[str, PropertyInfo(alias="remoteUri")] + """remote_uri is the Git remote origin""" + + target_mode: Annotated[ + Literal[ + "CLONE_TARGET_MODE_UNSPECIFIED", + "CLONE_TARGET_MODE_REMOTE_HEAD", + "CLONE_TARGET_MODE_REMOTE_COMMIT", + "CLONE_TARGET_MODE_REMOTE_BRANCH", + "CLONE_TARGET_MODE_LOCAL_BRANCH", + ], + PropertyInfo(alias="targetMode"), + ] + """CloneTargetMode is the target state in which we want to leave a GitEnvironment""" + + upstream_remote_uri: Annotated[str, PropertyInfo(alias="upstreamRemoteUri")] + """upstream_Remote_uri is the fork upstream of a repository""" + + +class Spec(TypedDict, total=False): + context_url: Annotated[SpecContextURL, PropertyInfo(alias="contextUrl")] + + git: SpecGit + + +class EnvironmentInitializerParam(TypedDict, total=False): + specs: Iterable[Spec] diff --git a/src/gitpod/types/environment_list_params.py b/src/gitpod/types/environment_list_params.py index 29a2601..90bd40b 100644 --- a/src/gitpod/types/environment_list_params.py +++ b/src/gitpod/types/environment_list_params.py @@ -3,9 +3,11 @@ from __future__ import annotations from typing import List -from typing_extensions import Literal, Annotated, TypedDict +from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo +from .runner_kind import RunnerKind +from .environment_phase import EnvironmentPhase __all__ = ["EnvironmentListParams", "Filter", "Pagination"] @@ -42,35 +44,13 @@ class Filter(TypedDict, total=False): runner_ids filters the response to only Environments running on these Runner IDs """ - runner_kinds: Annotated[ - List[ - Literal[ - "RUNNER_KIND_UNSPECIFIED", "RUNNER_KIND_LOCAL", "RUNNER_KIND_REMOTE", "RUNNER_KIND_LOCAL_CONFIGURATION" - ] - ], - PropertyInfo(alias="runnerKinds"), - ] + runner_kinds: Annotated[List[RunnerKind], PropertyInfo(alias="runnerKinds")] """ runner_kinds filters the response to only Environments running on these Runner Kinds """ - status_phases: Annotated[ - List[ - Literal[ - "ENVIRONMENT_PHASE_UNSPECIFIED", - "ENVIRONMENT_PHASE_CREATING", - "ENVIRONMENT_PHASE_STARTING", - "ENVIRONMENT_PHASE_RUNNING", - "ENVIRONMENT_PHASE_UPDATING", - "ENVIRONMENT_PHASE_STOPPING", - "ENVIRONMENT_PHASE_STOPPED", - "ENVIRONMENT_PHASE_DELETING", - "ENVIRONMENT_PHASE_DELETED", - ] - ], - PropertyInfo(alias="statusPhases"), - ] + status_phases: Annotated[List[EnvironmentPhase], PropertyInfo(alias="statusPhases")] """ actual_phases is a list of phases the environment must be in for it to be returned in the API call diff --git a/src/gitpod/types/environment_list_response.py b/src/gitpod/types/environment_list_response.py deleted file mode 100644 index 02c45aa..0000000 --- a/src/gitpod/types/environment_list_response.py +++ /dev/null @@ -1,1093 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = [ - "EnvironmentListResponse", - "Metadata", - "MetadataCreator", - "Spec", - "SpecAutomationsFile", - "SpecContent", - "SpecContentInitializer", - "SpecContentInitializerSpec", - "SpecContentInitializerSpecContextURL", - "SpecContentInitializerSpecContextURLContextURL", - "SpecContentInitializerSpecGit", - "SpecContentInitializerSpecGitGit", - "SpecDevcontainer", - "SpecMachine", - "SpecPort", - "SpecSecret", - "SpecSecretUnionMember0", - "SpecSecretFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted", - "SpecSecretUnionMember2", - "SpecSSHPublicKey", - "SpecTimeout", - "Status", - "StatusActivitySignal", - "StatusAutomationsFile", - "StatusContent", - "StatusContentGit", - "StatusContentGitChangedFile", - "StatusDevcontainer", - "StatusEnvironmentURLs", - "StatusEnvironmentURLsPort", - "StatusEnvironmentURLsSSH", - "StatusMachine", - "StatusMachineVersions", - "StatusRunnerAck", - "StatusSecret", - "StatusSSHPublicKey", -] - - -class MetadataCreator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class Metadata(BaseModel): - annotations: Optional[Dict[str, str]] = None - """ - annotations are key/value pairs that gets attached to the environment. - +internal - not yet implemented - """ - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - creator: Optional[MetadataCreator] = 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. - - In JavaScript, one can convert a Date object to this format using the standard - [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - method. In Python, a standard `datetime.datetime` object can be converted to - this format using - [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - Joda Time's - [`ISODateTimeFormat.dateTime()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - name: Optional[str] = None - """name is the name of the environment as specified by the user""" - - organization_id: Optional[str] = FieldInfo(alias="organizationId", default=None) - """organization_id is the ID of the organization that contains the environment""" - - original_context_url: Optional[str] = FieldInfo(alias="originalContextUrl", default=None) - """ - original_context_url is the normalized URL from which the environment was - created - """ - - project_id: Optional[str] = FieldInfo(alias="projectId", default=None) - """ - If the Environment was started from a project, the project_id will reference the - project. - """ - - runner_id: Optional[str] = FieldInfo(alias="runnerId", default=None) - """Runner is the ID of the runner that runs this environment.""" - - -class SpecAutomationsFile(BaseModel): - automations_file_path: Optional[str] = FieldInfo(alias="automationsFilePath", default=None) - """ - automations_file_path is the path to the automations file that is applied in the - environment, relative to the repo root. path must not be absolute (start with a - /): - - ``` - this.matches('^$|^[^/].*') - ``` - """ - - session: Optional[str] = None - - -class SpecContentInitializerSpecContextURLContextURL(BaseModel): - url: Optional[str] = None - """url is the URL from which the environment is created""" - - -class SpecContentInitializerSpecContextURL(BaseModel): - context_url: SpecContentInitializerSpecContextURLContextURL = FieldInfo(alias="contextUrl") - - -class SpecContentInitializerSpecGitGit(BaseModel): - checkout_location: Optional[str] = FieldInfo(alias="checkoutLocation", default=None) - """ - a path relative to the environment root in which the code will be checked out to - """ - - clone_target: Optional[str] = FieldInfo(alias="cloneTarget", default=None) - """the value for the clone target mode - use depends on the target mode""" - - remote_uri: Optional[str] = FieldInfo(alias="remoteUri", default=None) - """remote_uri is the Git remote origin""" - - target_mode: Optional[ - Literal[ - "CLONE_TARGET_MODE_UNSPECIFIED", - "CLONE_TARGET_MODE_REMOTE_HEAD", - "CLONE_TARGET_MODE_REMOTE_COMMIT", - "CLONE_TARGET_MODE_REMOTE_BRANCH", - "CLONE_TARGET_MODE_LOCAL_BRANCH", - ] - ] = FieldInfo(alias="targetMode", default=None) - """CloneTargetMode is the target state in which we want to leave a GitEnvironment""" - - upstream_remote_uri: Optional[str] = FieldInfo(alias="upstreamRemoteUri", default=None) - """upstream_Remote_uri is the fork upstream of a repository""" - - -class SpecContentInitializerSpecGit(BaseModel): - git: SpecContentInitializerSpecGitGit - - -SpecContentInitializerSpec: TypeAlias = Union[SpecContentInitializerSpecContextURL, SpecContentInitializerSpecGit] - - -class SpecContentInitializer(BaseModel): - specs: Optional[List[SpecContentInitializerSpec]] = None - - -class SpecContent(BaseModel): - git_email: Optional[str] = FieldInfo(alias="gitEmail", default=None) - """The Git email address""" - - git_username: Optional[str] = FieldInfo(alias="gitUsername", default=None) - """The Git username""" - - initializer: Optional[SpecContentInitializer] = None - """EnvironmentInitializer specifies how an environment is to be initialized""" - - session: Optional[str] = None - - -class SpecDevcontainer(BaseModel): - devcontainer_file_path: Optional[str] = FieldInfo(alias="devcontainerFilePath", default=None) - """ - devcontainer_file_path is the path to the devcontainer file relative to the repo - root path must not be absolute (start with a /): - - ``` - this.matches('^$|^[^/].*') - ``` - """ - - session: Optional[str] = None - - -class SpecMachine(BaseModel): - class_: Optional[str] = FieldInfo(alias="class", default=None) - """Class denotes the class of the environment we ought to start""" - - session: Optional[str] = None - - -class SpecPort(BaseModel): - admission: Optional[ - Literal["ADMISSION_LEVEL_UNSPECIFIED", "ADMISSION_LEVEL_OWNER_ONLY", "ADMISSION_LEVEL_EVERYONE"] - ] = None - """Admission level describes who can access an environment instance and its ports.""" - - name: Optional[str] = None - """name of this port""" - - port: Optional[int] = None - """port number""" - - -class SpecSecretUnionMember0(BaseModel): - environment_variable: str = FieldInfo(alias="environmentVariable") - - name: Optional[str] = None - """name is the human readable description of the secret""" - - session: Optional[str] = None - """ - session indicated the current session of the secret. When the session does not - change, secrets are not reloaded in the environment. - """ - - source: Optional[str] = None - """source is the source of the secret, for now control-plane or runner""" - - source_ref: Optional[str] = FieldInfo(alias="sourceRef", default=None) - """source_ref into the source, in case of control-plane this is uuid of the secret""" - - -class SpecSecretFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted(BaseModel): - file_path: str = FieldInfo(alias="filePath") - """file_path is the path inside the devcontainer where the secret is mounted""" - - name: Optional[str] = None - """name is the human readable description of the secret""" - - session: Optional[str] = None - """ - session indicated the current session of the secret. When the session does not - change, secrets are not reloaded in the environment. - """ - - source: Optional[str] = None - """source is the source of the secret, for now control-plane or runner""" - - source_ref: Optional[str] = FieldInfo(alias="sourceRef", default=None) - """source_ref into the source, in case of control-plane this is uuid of the secret""" - - -class SpecSecretUnionMember2(BaseModel): - git_credential_host: str = FieldInfo(alias="gitCredentialHost") - - name: Optional[str] = None - """name is the human readable description of the secret""" - - session: Optional[str] = None - """ - session indicated the current session of the secret. When the session does not - change, secrets are not reloaded in the environment. - """ - - source: Optional[str] = None - """source is the source of the secret, for now control-plane or runner""" - - source_ref: Optional[str] = FieldInfo(alias="sourceRef", default=None) - """source_ref into the source, in case of control-plane this is uuid of the secret""" - - -SpecSecret: TypeAlias = Union[ - SpecSecretUnionMember0, - SpecSecretFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted, - SpecSecretUnionMember2, -] - - -class SpecSSHPublicKey(BaseModel): - id: Optional[str] = None - """id is the unique identifier of the public key""" - - value: Optional[str] = None - """value is the actual public key in the public key file format""" - - -class SpecTimeout(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". - """ - - -class Spec(BaseModel): - admission: Optional[ - Literal["ADMISSION_LEVEL_UNSPECIFIED", "ADMISSION_LEVEL_OWNER_ONLY", "ADMISSION_LEVEL_EVERYONE"] - ] = None - """Admission level describes who can access an environment instance and its ports.""" - - automations_file: Optional[SpecAutomationsFile] = FieldInfo(alias="automationsFile", default=None) - """automations_file is the automations file spec of the environment""" - - content: Optional[SpecContent] = None - """content is the content spec of the environment""" - - desired_phase: Optional[ - Literal[ - "ENVIRONMENT_PHASE_UNSPECIFIED", - "ENVIRONMENT_PHASE_CREATING", - "ENVIRONMENT_PHASE_STARTING", - "ENVIRONMENT_PHASE_RUNNING", - "ENVIRONMENT_PHASE_UPDATING", - "ENVIRONMENT_PHASE_STOPPING", - "ENVIRONMENT_PHASE_STOPPED", - "ENVIRONMENT_PHASE_DELETING", - "ENVIRONMENT_PHASE_DELETED", - ] - ] = FieldInfo(alias="desiredPhase", default=None) - """Phase is the desired phase of the environment""" - - devcontainer: Optional[SpecDevcontainer] = None - """devcontainer is the devcontainer spec of the environment""" - - machine: Optional[SpecMachine] = None - """machine is the machine spec of the environment""" - - ports: Optional[List[SpecPort]] = None - """ports is the set of ports which ought to be exposed to the internet""" - - secrets: Optional[List[SpecSecret]] = None - """secrets are confidential data that is mounted into the environment""" - - spec_version: Optional[str] = FieldInfo(alias="specVersion", default=None) - """version of the spec. - - The value of this field has no semantic meaning (e.g. don't interpret it as as a - timestamp), but it can be used to impose a partial order. If a.spec_version < - b.spec_version then a was the spec before b. - """ - - ssh_public_keys: Optional[List[SpecSSHPublicKey]] = FieldInfo(alias="sshPublicKeys", default=None) - """ssh_public_keys are the public keys used to ssh into the environment""" - - timeout: Optional[SpecTimeout] = None - """Timeout configures the environment timeout""" - - -class StatusActivitySignal(BaseModel): - source: Optional[str] = None - """ - source of the activity signal, such as "VS Code", "SSH", or "Automations". It - should be a human-readable string that describes the source of the activity - signal. - """ - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - -class StatusAutomationsFile(BaseModel): - automations_file_path: Optional[str] = FieldInfo(alias="automationsFilePath", default=None) - """ - automations_file_path is the path to the automations file relative to the repo - root. - """ - - automations_file_presence: Optional[ - Literal["PRESENCE_UNSPECIFIED", "PRESENCE_ABSENT", "PRESENCE_DISCOVERED", "PRESENCE_SPECIFIED"] - ] = FieldInfo(alias="automationsFilePresence", default=None) - """ - automations_file_presence indicates how an automations file is present in the - environment. - """ - - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """ - failure_message contains the reason the automations file failed to be applied. - This is only set if the phase is FAILED. - """ - - phase: Optional[ - Literal[ - "CONTENT_PHASE_UNSPECIFIED", - "CONTENT_PHASE_CREATING", - "CONTENT_PHASE_INITIALIZING", - "CONTENT_PHASE_READY", - "CONTENT_PHASE_UPDATING", - "CONTENT_PHASE_FAILED", - ] - ] = None - """phase is the current phase of the automations file.""" - - session: Optional[str] = None - """ - session is the automations file session that is currently applied in the - environment. - """ - - -class StatusContentGitChangedFile(BaseModel): - change_type: Optional[ - Literal[ - "CHANGE_TYPE_UNSPECIFIED", - "CHANGE_TYPE_ADDED", - "CHANGE_TYPE_MODIFIED", - "CHANGE_TYPE_DELETED", - "CHANGE_TYPE_RENAMED", - "CHANGE_TYPE_COPIED", - "CHANGE_TYPE_UPDATED_BUT_UNMERGED", - "CHANGE_TYPE_UNTRACKED", - ] - ] = FieldInfo(alias="changeType", default=None) - """ChangeType is the type of change that happened to the file""" - - path: Optional[str] = None - """path is the path of the file""" - - -class StatusContentGit(BaseModel): - branch: Optional[str] = None - """branch is branch we're currently on""" - - changed_files: Optional[List[StatusContentGitChangedFile]] = FieldInfo(alias="changedFiles", default=None) - """ - changed_files is an array of changed files in the environment, possibly - truncated - """ - - clone_url: Optional[str] = FieldInfo(alias="cloneUrl", default=None) - """ - clone_url is the repository url as you would pass it to "git clone". Only HTTPS - clone URLs are supported. - """ - - latest_commit: Optional[str] = FieldInfo(alias="latestCommit", default=None) - """latest_commit is the most recent commit on the current branch""" - - total_changed_files: Optional[int] = FieldInfo(alias="totalChangedFiles", default=None) - - total_unpushed_commits: Optional[int] = FieldInfo(alias="totalUnpushedCommits", default=None) - """the total number of unpushed changes""" - - unpushed_commits: Optional[List[str]] = FieldInfo(alias="unpushedCommits", default=None) - """ - unpushed_commits is an array of unpushed changes in the environment, possibly - truncated - """ - - -class StatusContent(BaseModel): - content_location_in_machine: Optional[str] = FieldInfo(alias="contentLocationInMachine", default=None) - """content_location_in_machine is the location of the content in the machine""" - - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message contains the reason the content initialization failed.""" - - git: Optional[StatusContentGit] = None - """ - git is the Git working copy status of the environment. Note: this is a - best-effort field and more often than not will not be present. Its absence does - not indicate the absence of a working copy. - """ - - phase: Optional[ - Literal[ - "CONTENT_PHASE_UNSPECIFIED", - "CONTENT_PHASE_CREATING", - "CONTENT_PHASE_INITIALIZING", - "CONTENT_PHASE_READY", - "CONTENT_PHASE_UPDATING", - "CONTENT_PHASE_FAILED", - ] - ] = None - """phase is the current phase of the environment content""" - - session: Optional[str] = None - """session is the session that is currently active in the environment.""" - - warning_message: Optional[str] = FieldInfo(alias="warningMessage", default=None) - """warning_message contains warnings, e.g. - - when the content is present but not in the expected state. - """ - - -class StatusDevcontainer(BaseModel): - container_id: Optional[str] = FieldInfo(alias="containerId", default=None) - """container_id is the ID of the container.""" - - container_name: Optional[str] = FieldInfo(alias="containerName", default=None) - """ - container_name is the name of the container that is used to connect to the - devcontainer - """ - - devcontainerconfig_in_sync: Optional[bool] = FieldInfo(alias="devcontainerconfigInSync", default=None) - """devcontainerconfig_in_sync indicates if the devcontainer is up to date w.r.t. - - the devcontainer config file. - """ - - devcontainer_file_path: Optional[str] = FieldInfo(alias="devcontainerFilePath", default=None) - """ - devcontainer_file_path is the path to the devcontainer file relative to the repo - root - """ - - devcontainer_file_presence: Optional[ - Literal["PRESENCE_UNSPECIFIED", "PRESENCE_GENERATED", "PRESENCE_DISCOVERED", "PRESENCE_SPECIFIED"] - ] = FieldInfo(alias="devcontainerFilePresence", default=None) - """ - devcontainer_file_presence indicates how the devcontainer file is present in the - repo. - """ - - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message contains the reason the devcontainer failed to operate.""" - - phase: Optional[ - Literal["PHASE_UNSPECIFIED", "PHASE_CREATING", "PHASE_RUNNING", "PHASE_STOPPED", "PHASE_FAILED"] - ] = None - """phase is the current phase of the devcontainer""" - - remote_user: Optional[str] = FieldInfo(alias="remoteUser", default=None) - """remote_user is the user that is used to connect to the devcontainer""" - - remote_workspace_folder: Optional[str] = FieldInfo(alias="remoteWorkspaceFolder", default=None) - """ - remote_workspace_folder is the folder that is used to connect to the - devcontainer - """ - - secrets_in_sync: Optional[bool] = FieldInfo(alias="secretsInSync", default=None) - """secrets_in_sync indicates if the secrets are up to date w.r.t. - - the running devcontainer. - """ - - session: Optional[str] = None - """session is the session that is currently active in the devcontainer.""" - - warning_message: Optional[str] = FieldInfo(alias="warningMessage", default=None) - """warning_message contains warnings, e.g. - - when the devcontainer is present but not in the expected state. - """ - - -class StatusEnvironmentURLsPort(BaseModel): - port: Optional[int] = None - """port is the port number of the environment port""" - - url: Optional[str] = None - """url is the URL at which the environment port can be accessed""" - - -class StatusEnvironmentURLsSSH(BaseModel): - url: Optional[str] = None - - -class StatusEnvironmentURLs(BaseModel): - logs: Optional[str] = None - """logs is the URL at which the environment logs can be accessed.""" - - ports: Optional[List[StatusEnvironmentURLsPort]] = None - - ssh: Optional[StatusEnvironmentURLsSSH] = None - """SSH is the URL at which the environment can be accessed via SSH.""" - - -class StatusMachineVersions(BaseModel): - supervisor_commit: Optional[str] = FieldInfo(alias="supervisorCommit", default=None) - - supervisor_version: Optional[str] = FieldInfo(alias="supervisorVersion", default=None) - - -class StatusMachine(BaseModel): - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message contains the reason the machine failed to operate.""" - - phase: Optional[ - Literal[ - "PHASE_UNSPECIFIED", - "PHASE_CREATING", - "PHASE_STARTING", - "PHASE_RUNNING", - "PHASE_STOPPING", - "PHASE_STOPPED", - "PHASE_DELETING", - "PHASE_DELETED", - ] - ] = None - """phase is the current phase of the environment machine""" - - session: Optional[str] = None - """session is the session that is currently active in the machine.""" - - timeout: Optional[str] = None - """timeout contains the reason the environment has timed out. - - If this field is empty, the environment has not timed out. - """ - - versions: Optional[StatusMachineVersions] = None - """versions contains the versions of components in the machine.""" - - warning_message: Optional[str] = FieldInfo(alias="warningMessage", default=None) - """warning_message contains warnings, e.g. - - when the machine is present but not in the expected state. - """ - - -class StatusRunnerAck(BaseModel): - message: Optional[str] = None - - spec_version: Optional[str] = FieldInfo(alias="specVersion", default=None) - - status_code: Optional[ - Literal[ - "STATUS_CODE_UNSPECIFIED", - "STATUS_CODE_OK", - "STATUS_CODE_INVALID_RESOURCE", - "STATUS_CODE_FAILED_PRECONDITION", - ] - ] = FieldInfo(alias="statusCode", default=None) - - -class StatusSecret(BaseModel): - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message contains the reason the secret failed to be materialize.""" - - phase: Optional[ - Literal[ - "CONTENT_PHASE_UNSPECIFIED", - "CONTENT_PHASE_CREATING", - "CONTENT_PHASE_INITIALIZING", - "CONTENT_PHASE_READY", - "CONTENT_PHASE_UPDATING", - "CONTENT_PHASE_FAILED", - ] - ] = None - - secret_name: Optional[str] = FieldInfo(alias="secretName", default=None) - - session: Optional[str] = None - """session is the session that is currently active in the environment.""" - - warning_message: Optional[str] = FieldInfo(alias="warningMessage", default=None) - """warning_message contains warnings, e.g. - - when the secret is present but not in the expected state. - """ - - -class StatusSSHPublicKey(BaseModel): - id: Optional[str] = None - """id is the unique identifier of the public key""" - - phase: Optional[ - Literal[ - "CONTENT_PHASE_UNSPECIFIED", - "CONTENT_PHASE_CREATING", - "CONTENT_PHASE_INITIALIZING", - "CONTENT_PHASE_READY", - "CONTENT_PHASE_UPDATING", - "CONTENT_PHASE_FAILED", - ] - ] = None - """phase is the current phase of the public key""" - - -class Status(BaseModel): - activity_signal: Optional[StatusActivitySignal] = FieldInfo(alias="activitySignal", default=None) - """EnvironmentActivitySignal used to signal activity for an environment.""" - - automations_file: Optional[StatusAutomationsFile] = FieldInfo(alias="automationsFile", default=None) - """automations_file contains the status of the automations file.""" - - content: Optional[StatusContent] = None - """content contains the status of the environment content.""" - - devcontainer: Optional[StatusDevcontainer] = None - """devcontainer contains the status of the devcontainer.""" - - environment_urls: Optional[StatusEnvironmentURLs] = FieldInfo(alias="environmentUrls", default=None) - """ - environment_url contains the URL at which the environment can be accessed. This - field is only set if the environment is running. - """ - - failure_message: Optional[List[str]] = FieldInfo(alias="failureMessage", default=None) - """failure_message summarises why the environment failed to operate. - - If this is non-empty the environment has failed to operate and will likely - transition to a stopped state. - """ - - machine: Optional[StatusMachine] = None - """machine contains the status of the environment machine""" - - phase: Optional[ - Literal[ - "ENVIRONMENT_PHASE_UNSPECIFIED", - "ENVIRONMENT_PHASE_CREATING", - "ENVIRONMENT_PHASE_STARTING", - "ENVIRONMENT_PHASE_RUNNING", - "ENVIRONMENT_PHASE_UPDATING", - "ENVIRONMENT_PHASE_STOPPING", - "ENVIRONMENT_PHASE_STOPPED", - "ENVIRONMENT_PHASE_DELETING", - "ENVIRONMENT_PHASE_DELETED", - ] - ] = None - """ - the phase of an environment is a simple, high-level summary of where the - environment is in its lifecycle - """ - - runner_ack: Optional[StatusRunnerAck] = FieldInfo(alias="runnerAck", default=None) - """ - RunnerACK is the acknowledgement from the runner that is has received the - environment spec. - """ - - secrets: Optional[List[StatusSecret]] = None - """secrets contains the status of the environment secrets""" - - ssh_public_keys: Optional[List[StatusSSHPublicKey]] = FieldInfo(alias="sshPublicKeys", default=None) - """ssh_public_keys contains the status of the environment ssh public keys""" - - status_version: Optional[str] = FieldInfo(alias="statusVersion", default=None) - """version of the status update. - - Environment instances themselves are unversioned, but their status has different - versions. The value of this field has no semantic meaning (e.g. don't interpret - it as as a timestamp), but it can be used to impose a partial order. If - a.status_version < b.status_version then a was the status before b. - """ - - warning_message: Optional[List[str]] = FieldInfo(alias="warningMessage", default=None) - """warning_message contains warnings, e.g. - - when the environment is present but not in the expected state. - """ - - -class EnvironmentListResponse(BaseModel): - id: Optional[str] = None - """ID is a unique identifier of this environment. - - No other environment with the same name must be managed by this environment - manager - """ - - metadata: Optional[Metadata] = None - """ - EnvironmentMetadata is data associated with an environment that's required for - other parts of the system to function - """ - - spec: Optional[Spec] = None - """ - EnvironmentSpec specifies the configuration of an environment for an environment - start - """ - - status: Optional[Status] = None - """EnvironmentStatus describes an environment status""" diff --git a/src/gitpod/types/environment_mark_active_params.py b/src/gitpod/types/environment_mark_active_params.py index c88cd10..8e2cbce 100644 --- a/src/gitpod/types/environment_mark_active_params.py +++ b/src/gitpod/types/environment_mark_active_params.py @@ -2,119 +2,17 @@ from __future__ import annotations -from typing import Union -from datetime import datetime from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo +from .environment_activity_signal_param import EnvironmentActivitySignalParam -__all__ = ["EnvironmentMarkActiveParams", "ActivitySignal"] +__all__ = ["EnvironmentMarkActiveParams"] class EnvironmentMarkActiveParams(TypedDict, total=False): - activity_signal: Annotated[ActivitySignal, PropertyInfo(alias="activitySignal")] + activity_signal: Annotated[EnvironmentActivitySignalParam, PropertyInfo(alias="activitySignal")] """EnvironmentActivitySignal used to signal activity for an environment.""" environment_id: Annotated[str, PropertyInfo(alias="environmentId")] """The ID of the environment to update activity for.""" - - -class ActivitySignal(TypedDict, total=False): - source: str - """ - source of the activity signal, such as "VS Code", "SSH", or "Automations". It - should be a human-readable string that describes the source of the activity - signal. - """ - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ diff --git a/src/gitpod/types/environment_metadata.py b/src/gitpod/types/environment_metadata.py new file mode 100644 index 0000000..412b7ae --- /dev/null +++ b/src/gitpod/types/environment_metadata.py @@ -0,0 +1,227 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional +from datetime import datetime + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.subject import Subject + +__all__ = ["EnvironmentMetadata"] + + +class EnvironmentMetadata(BaseModel): + annotations: Optional[Dict[str, str]] = None + """ + annotations are key/value pairs that gets attached to the environment. + +internal - not yet implemented + """ + + 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()`]() + to obtain a formatter capable of generating timestamps in this format. + """ + + 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. + + In JavaScript, one can convert a Date object to this format using the standard + [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + method. In Python, a standard `datetime.datetime` object can be converted to + this format using + [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the + time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the + Joda Time's + [`ISODateTimeFormat.dateTime()`]() + to obtain a formatter capable of generating timestamps in this format. + """ + + name: Optional[str] = None + """name is the name of the environment as specified by the user""" + + organization_id: Optional[str] = FieldInfo(alias="organizationId", default=None) + """organization_id is the ID of the organization that contains the environment""" + + original_context_url: Optional[str] = FieldInfo(alias="originalContextUrl", default=None) + """ + original_context_url is the normalized URL from which the environment was + created + """ + + project_id: Optional[str] = FieldInfo(alias="projectId", default=None) + """ + If the Environment was started from a project, the project_id will reference the + project. + """ + + runner_id: Optional[str] = FieldInfo(alias="runnerId", default=None) + """Runner is the ID of the runner that runs this environment.""" diff --git a/src/gitpod/types/environment_phase.py b/src/gitpod/types/environment_phase.py new file mode 100644 index 0000000..817644d --- /dev/null +++ b/src/gitpod/types/environment_phase.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["EnvironmentPhase"] + +EnvironmentPhase: TypeAlias = Literal[ + "ENVIRONMENT_PHASE_UNSPECIFIED", + "ENVIRONMENT_PHASE_CREATING", + "ENVIRONMENT_PHASE_STARTING", + "ENVIRONMENT_PHASE_RUNNING", + "ENVIRONMENT_PHASE_UPDATING", + "ENVIRONMENT_PHASE_STOPPING", + "ENVIRONMENT_PHASE_STOPPED", + "ENVIRONMENT_PHASE_DELETING", + "ENVIRONMENT_PHASE_DELETED", +] diff --git a/src/gitpod/types/environment_retrieve_response.py b/src/gitpod/types/environment_retrieve_response.py index 5c40bae..1c55b33 100644 --- a/src/gitpod/types/environment_retrieve_response.py +++ b/src/gitpod/types/environment_retrieve_response.py @@ -1,1101 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias - -from pydantic import Field as FieldInfo +from typing import Optional from .._models import BaseModel +from .environment import Environment -__all__ = [ - "EnvironmentRetrieveResponse", - "Environment", - "EnvironmentMetadata", - "EnvironmentMetadataCreator", - "EnvironmentSpec", - "EnvironmentSpecAutomationsFile", - "EnvironmentSpecContent", - "EnvironmentSpecContentInitializer", - "EnvironmentSpecContentInitializerSpec", - "EnvironmentSpecContentInitializerSpecContextURL", - "EnvironmentSpecContentInitializerSpecContextURLContextURL", - "EnvironmentSpecContentInitializerSpecGit", - "EnvironmentSpecContentInitializerSpecGitGit", - "EnvironmentSpecDevcontainer", - "EnvironmentSpecMachine", - "EnvironmentSpecPort", - "EnvironmentSpecSecret", - "EnvironmentSpecSecretUnionMember0", - "EnvironmentSpecSecretFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted", - "EnvironmentSpecSecretUnionMember2", - "EnvironmentSpecSSHPublicKey", - "EnvironmentSpecTimeout", - "EnvironmentStatus", - "EnvironmentStatusActivitySignal", - "EnvironmentStatusAutomationsFile", - "EnvironmentStatusContent", - "EnvironmentStatusContentGit", - "EnvironmentStatusContentGitChangedFile", - "EnvironmentStatusDevcontainer", - "EnvironmentStatusEnvironmentURLs", - "EnvironmentStatusEnvironmentURLsPort", - "EnvironmentStatusEnvironmentURLsSSH", - "EnvironmentStatusMachine", - "EnvironmentStatusMachineVersions", - "EnvironmentStatusRunnerAck", - "EnvironmentStatusSecret", - "EnvironmentStatusSSHPublicKey", -] - - -class EnvironmentMetadataCreator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class EnvironmentMetadata(BaseModel): - annotations: Optional[Dict[str, str]] = None - """ - annotations are key/value pairs that gets attached to the environment. - +internal - not yet implemented - """ - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - creator: Optional[EnvironmentMetadataCreator] = 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. - - In JavaScript, one can convert a Date object to this format using the standard - [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - method. In Python, a standard `datetime.datetime` object can be converted to - this format using - [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - Joda Time's - [`ISODateTimeFormat.dateTime()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - name: Optional[str] = None - """name is the name of the environment as specified by the user""" - - organization_id: Optional[str] = FieldInfo(alias="organizationId", default=None) - """organization_id is the ID of the organization that contains the environment""" - - original_context_url: Optional[str] = FieldInfo(alias="originalContextUrl", default=None) - """ - original_context_url is the normalized URL from which the environment was - created - """ - - project_id: Optional[str] = FieldInfo(alias="projectId", default=None) - """ - If the Environment was started from a project, the project_id will reference the - project. - """ - - runner_id: Optional[str] = FieldInfo(alias="runnerId", default=None) - """Runner is the ID of the runner that runs this environment.""" - - -class EnvironmentSpecAutomationsFile(BaseModel): - automations_file_path: Optional[str] = FieldInfo(alias="automationsFilePath", default=None) - """ - automations_file_path is the path to the automations file that is applied in the - environment, relative to the repo root. path must not be absolute (start with a - /): - - ``` - this.matches('^$|^[^/].*') - ``` - """ - - session: Optional[str] = None - - -class EnvironmentSpecContentInitializerSpecContextURLContextURL(BaseModel): - url: Optional[str] = None - """url is the URL from which the environment is created""" - - -class EnvironmentSpecContentInitializerSpecContextURL(BaseModel): - context_url: EnvironmentSpecContentInitializerSpecContextURLContextURL = FieldInfo(alias="contextUrl") - - -class EnvironmentSpecContentInitializerSpecGitGit(BaseModel): - checkout_location: Optional[str] = FieldInfo(alias="checkoutLocation", default=None) - """ - a path relative to the environment root in which the code will be checked out to - """ - - clone_target: Optional[str] = FieldInfo(alias="cloneTarget", default=None) - """the value for the clone target mode - use depends on the target mode""" - - remote_uri: Optional[str] = FieldInfo(alias="remoteUri", default=None) - """remote_uri is the Git remote origin""" - - target_mode: Optional[ - Literal[ - "CLONE_TARGET_MODE_UNSPECIFIED", - "CLONE_TARGET_MODE_REMOTE_HEAD", - "CLONE_TARGET_MODE_REMOTE_COMMIT", - "CLONE_TARGET_MODE_REMOTE_BRANCH", - "CLONE_TARGET_MODE_LOCAL_BRANCH", - ] - ] = FieldInfo(alias="targetMode", default=None) - """CloneTargetMode is the target state in which we want to leave a GitEnvironment""" - - upstream_remote_uri: Optional[str] = FieldInfo(alias="upstreamRemoteUri", default=None) - """upstream_Remote_uri is the fork upstream of a repository""" - - -class EnvironmentSpecContentInitializerSpecGit(BaseModel): - git: EnvironmentSpecContentInitializerSpecGitGit - - -EnvironmentSpecContentInitializerSpec: TypeAlias = Union[ - EnvironmentSpecContentInitializerSpecContextURL, EnvironmentSpecContentInitializerSpecGit -] - - -class EnvironmentSpecContentInitializer(BaseModel): - specs: Optional[List[EnvironmentSpecContentInitializerSpec]] = None - - -class EnvironmentSpecContent(BaseModel): - git_email: Optional[str] = FieldInfo(alias="gitEmail", default=None) - """The Git email address""" - - git_username: Optional[str] = FieldInfo(alias="gitUsername", default=None) - """The Git username""" - - initializer: Optional[EnvironmentSpecContentInitializer] = None - """EnvironmentInitializer specifies how an environment is to be initialized""" - - session: Optional[str] = None - - -class EnvironmentSpecDevcontainer(BaseModel): - devcontainer_file_path: Optional[str] = FieldInfo(alias="devcontainerFilePath", default=None) - """ - devcontainer_file_path is the path to the devcontainer file relative to the repo - root path must not be absolute (start with a /): - - ``` - this.matches('^$|^[^/].*') - ``` - """ - - session: Optional[str] = None - - -class EnvironmentSpecMachine(BaseModel): - class_: Optional[str] = FieldInfo(alias="class", default=None) - """Class denotes the class of the environment we ought to start""" - - session: Optional[str] = None - - -class EnvironmentSpecPort(BaseModel): - admission: Optional[ - Literal["ADMISSION_LEVEL_UNSPECIFIED", "ADMISSION_LEVEL_OWNER_ONLY", "ADMISSION_LEVEL_EVERYONE"] - ] = None - """Admission level describes who can access an environment instance and its ports.""" - - name: Optional[str] = None - """name of this port""" - - port: Optional[int] = None - """port number""" - - -class EnvironmentSpecSecretUnionMember0(BaseModel): - environment_variable: str = FieldInfo(alias="environmentVariable") - - name: Optional[str] = None - """name is the human readable description of the secret""" - - session: Optional[str] = None - """ - session indicated the current session of the secret. When the session does not - change, secrets are not reloaded in the environment. - """ - - source: Optional[str] = None - """source is the source of the secret, for now control-plane or runner""" - - source_ref: Optional[str] = FieldInfo(alias="sourceRef", default=None) - """source_ref into the source, in case of control-plane this is uuid of the secret""" - - -class EnvironmentSpecSecretFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted(BaseModel): - file_path: str = FieldInfo(alias="filePath") - """file_path is the path inside the devcontainer where the secret is mounted""" - - name: Optional[str] = None - """name is the human readable description of the secret""" - - session: Optional[str] = None - """ - session indicated the current session of the secret. When the session does not - change, secrets are not reloaded in the environment. - """ - - source: Optional[str] = None - """source is the source of the secret, for now control-plane or runner""" - - source_ref: Optional[str] = FieldInfo(alias="sourceRef", default=None) - """source_ref into the source, in case of control-plane this is uuid of the secret""" - - -class EnvironmentSpecSecretUnionMember2(BaseModel): - git_credential_host: str = FieldInfo(alias="gitCredentialHost") - - name: Optional[str] = None - """name is the human readable description of the secret""" - - session: Optional[str] = None - """ - session indicated the current session of the secret. When the session does not - change, secrets are not reloaded in the environment. - """ - - source: Optional[str] = None - """source is the source of the secret, for now control-plane or runner""" - - source_ref: Optional[str] = FieldInfo(alias="sourceRef", default=None) - """source_ref into the source, in case of control-plane this is uuid of the secret""" - - -EnvironmentSpecSecret: TypeAlias = Union[ - EnvironmentSpecSecretUnionMember0, - EnvironmentSpecSecretFilePathIsThePathInsideTheDevcontainerWhereTheSecretIsMounted, - EnvironmentSpecSecretUnionMember2, -] - - -class EnvironmentSpecSSHPublicKey(BaseModel): - id: Optional[str] = None - """id is the unique identifier of the public key""" - - value: Optional[str] = None - """value is the actual public key in the public key file format""" - - -class EnvironmentSpecTimeout(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". - """ - - -class EnvironmentSpec(BaseModel): - admission: Optional[ - Literal["ADMISSION_LEVEL_UNSPECIFIED", "ADMISSION_LEVEL_OWNER_ONLY", "ADMISSION_LEVEL_EVERYONE"] - ] = None - """Admission level describes who can access an environment instance and its ports.""" - - automations_file: Optional[EnvironmentSpecAutomationsFile] = FieldInfo(alias="automationsFile", default=None) - """automations_file is the automations file spec of the environment""" - - content: Optional[EnvironmentSpecContent] = None - """content is the content spec of the environment""" - - desired_phase: Optional[ - Literal[ - "ENVIRONMENT_PHASE_UNSPECIFIED", - "ENVIRONMENT_PHASE_CREATING", - "ENVIRONMENT_PHASE_STARTING", - "ENVIRONMENT_PHASE_RUNNING", - "ENVIRONMENT_PHASE_UPDATING", - "ENVIRONMENT_PHASE_STOPPING", - "ENVIRONMENT_PHASE_STOPPED", - "ENVIRONMENT_PHASE_DELETING", - "ENVIRONMENT_PHASE_DELETED", - ] - ] = FieldInfo(alias="desiredPhase", default=None) - """Phase is the desired phase of the environment""" - - devcontainer: Optional[EnvironmentSpecDevcontainer] = None - """devcontainer is the devcontainer spec of the environment""" - - machine: Optional[EnvironmentSpecMachine] = None - """machine is the machine spec of the environment""" - - ports: Optional[List[EnvironmentSpecPort]] = None - """ports is the set of ports which ought to be exposed to the internet""" - - secrets: Optional[List[EnvironmentSpecSecret]] = None - """secrets are confidential data that is mounted into the environment""" - - spec_version: Optional[str] = FieldInfo(alias="specVersion", default=None) - """version of the spec. - - The value of this field has no semantic meaning (e.g. don't interpret it as as a - timestamp), but it can be used to impose a partial order. If a.spec_version < - b.spec_version then a was the spec before b. - """ - - ssh_public_keys: Optional[List[EnvironmentSpecSSHPublicKey]] = FieldInfo(alias="sshPublicKeys", default=None) - """ssh_public_keys are the public keys used to ssh into the environment""" - - timeout: Optional[EnvironmentSpecTimeout] = None - """Timeout configures the environment timeout""" - - -class EnvironmentStatusActivitySignal(BaseModel): - source: Optional[str] = None - """ - source of the activity signal, such as "VS Code", "SSH", or "Automations". It - should be a human-readable string that describes the source of the activity - signal. - """ - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - -class EnvironmentStatusAutomationsFile(BaseModel): - automations_file_path: Optional[str] = FieldInfo(alias="automationsFilePath", default=None) - """ - automations_file_path is the path to the automations file relative to the repo - root. - """ - - automations_file_presence: Optional[ - Literal["PRESENCE_UNSPECIFIED", "PRESENCE_ABSENT", "PRESENCE_DISCOVERED", "PRESENCE_SPECIFIED"] - ] = FieldInfo(alias="automationsFilePresence", default=None) - """ - automations_file_presence indicates how an automations file is present in the - environment. - """ - - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """ - failure_message contains the reason the automations file failed to be applied. - This is only set if the phase is FAILED. - """ - - phase: Optional[ - Literal[ - "CONTENT_PHASE_UNSPECIFIED", - "CONTENT_PHASE_CREATING", - "CONTENT_PHASE_INITIALIZING", - "CONTENT_PHASE_READY", - "CONTENT_PHASE_UPDATING", - "CONTENT_PHASE_FAILED", - ] - ] = None - """phase is the current phase of the automations file.""" - - session: Optional[str] = None - """ - session is the automations file session that is currently applied in the - environment. - """ - - -class EnvironmentStatusContentGitChangedFile(BaseModel): - change_type: Optional[ - Literal[ - "CHANGE_TYPE_UNSPECIFIED", - "CHANGE_TYPE_ADDED", - "CHANGE_TYPE_MODIFIED", - "CHANGE_TYPE_DELETED", - "CHANGE_TYPE_RENAMED", - "CHANGE_TYPE_COPIED", - "CHANGE_TYPE_UPDATED_BUT_UNMERGED", - "CHANGE_TYPE_UNTRACKED", - ] - ] = FieldInfo(alias="changeType", default=None) - """ChangeType is the type of change that happened to the file""" - - path: Optional[str] = None - """path is the path of the file""" - - -class EnvironmentStatusContentGit(BaseModel): - branch: Optional[str] = None - """branch is branch we're currently on""" - - changed_files: Optional[List[EnvironmentStatusContentGitChangedFile]] = FieldInfo( - alias="changedFiles", default=None - ) - """ - changed_files is an array of changed files in the environment, possibly - truncated - """ - - clone_url: Optional[str] = FieldInfo(alias="cloneUrl", default=None) - """ - clone_url is the repository url as you would pass it to "git clone". Only HTTPS - clone URLs are supported. - """ - - latest_commit: Optional[str] = FieldInfo(alias="latestCommit", default=None) - """latest_commit is the most recent commit on the current branch""" - - total_changed_files: Optional[int] = FieldInfo(alias="totalChangedFiles", default=None) - - total_unpushed_commits: Optional[int] = FieldInfo(alias="totalUnpushedCommits", default=None) - """the total number of unpushed changes""" - - unpushed_commits: Optional[List[str]] = FieldInfo(alias="unpushedCommits", default=None) - """ - unpushed_commits is an array of unpushed changes in the environment, possibly - truncated - """ - - -class EnvironmentStatusContent(BaseModel): - content_location_in_machine: Optional[str] = FieldInfo(alias="contentLocationInMachine", default=None) - """content_location_in_machine is the location of the content in the machine""" - - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message contains the reason the content initialization failed.""" - - git: Optional[EnvironmentStatusContentGit] = None - """ - git is the Git working copy status of the environment. Note: this is a - best-effort field and more often than not will not be present. Its absence does - not indicate the absence of a working copy. - """ - - phase: Optional[ - Literal[ - "CONTENT_PHASE_UNSPECIFIED", - "CONTENT_PHASE_CREATING", - "CONTENT_PHASE_INITIALIZING", - "CONTENT_PHASE_READY", - "CONTENT_PHASE_UPDATING", - "CONTENT_PHASE_FAILED", - ] - ] = None - """phase is the current phase of the environment content""" - - session: Optional[str] = None - """session is the session that is currently active in the environment.""" - - warning_message: Optional[str] = FieldInfo(alias="warningMessage", default=None) - """warning_message contains warnings, e.g. - - when the content is present but not in the expected state. - """ - - -class EnvironmentStatusDevcontainer(BaseModel): - container_id: Optional[str] = FieldInfo(alias="containerId", default=None) - """container_id is the ID of the container.""" - - container_name: Optional[str] = FieldInfo(alias="containerName", default=None) - """ - container_name is the name of the container that is used to connect to the - devcontainer - """ - - devcontainerconfig_in_sync: Optional[bool] = FieldInfo(alias="devcontainerconfigInSync", default=None) - """devcontainerconfig_in_sync indicates if the devcontainer is up to date w.r.t. - - the devcontainer config file. - """ - - devcontainer_file_path: Optional[str] = FieldInfo(alias="devcontainerFilePath", default=None) - """ - devcontainer_file_path is the path to the devcontainer file relative to the repo - root - """ - - devcontainer_file_presence: Optional[ - Literal["PRESENCE_UNSPECIFIED", "PRESENCE_GENERATED", "PRESENCE_DISCOVERED", "PRESENCE_SPECIFIED"] - ] = FieldInfo(alias="devcontainerFilePresence", default=None) - """ - devcontainer_file_presence indicates how the devcontainer file is present in the - repo. - """ - - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message contains the reason the devcontainer failed to operate.""" - - phase: Optional[ - Literal["PHASE_UNSPECIFIED", "PHASE_CREATING", "PHASE_RUNNING", "PHASE_STOPPED", "PHASE_FAILED"] - ] = None - """phase is the current phase of the devcontainer""" - - remote_user: Optional[str] = FieldInfo(alias="remoteUser", default=None) - """remote_user is the user that is used to connect to the devcontainer""" - - remote_workspace_folder: Optional[str] = FieldInfo(alias="remoteWorkspaceFolder", default=None) - """ - remote_workspace_folder is the folder that is used to connect to the - devcontainer - """ - - secrets_in_sync: Optional[bool] = FieldInfo(alias="secretsInSync", default=None) - """secrets_in_sync indicates if the secrets are up to date w.r.t. - - the running devcontainer. - """ - - session: Optional[str] = None - """session is the session that is currently active in the devcontainer.""" - - warning_message: Optional[str] = FieldInfo(alias="warningMessage", default=None) - """warning_message contains warnings, e.g. - - when the devcontainer is present but not in the expected state. - """ - - -class EnvironmentStatusEnvironmentURLsPort(BaseModel): - port: Optional[int] = None - """port is the port number of the environment port""" - - url: Optional[str] = None - """url is the URL at which the environment port can be accessed""" - - -class EnvironmentStatusEnvironmentURLsSSH(BaseModel): - url: Optional[str] = None - - -class EnvironmentStatusEnvironmentURLs(BaseModel): - logs: Optional[str] = None - """logs is the URL at which the environment logs can be accessed.""" - - ports: Optional[List[EnvironmentStatusEnvironmentURLsPort]] = None - - ssh: Optional[EnvironmentStatusEnvironmentURLsSSH] = None - """SSH is the URL at which the environment can be accessed via SSH.""" - - -class EnvironmentStatusMachineVersions(BaseModel): - supervisor_commit: Optional[str] = FieldInfo(alias="supervisorCommit", default=None) - - supervisor_version: Optional[str] = FieldInfo(alias="supervisorVersion", default=None) - - -class EnvironmentStatusMachine(BaseModel): - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message contains the reason the machine failed to operate.""" - - phase: Optional[ - Literal[ - "PHASE_UNSPECIFIED", - "PHASE_CREATING", - "PHASE_STARTING", - "PHASE_RUNNING", - "PHASE_STOPPING", - "PHASE_STOPPED", - "PHASE_DELETING", - "PHASE_DELETED", - ] - ] = None - """phase is the current phase of the environment machine""" - - session: Optional[str] = None - """session is the session that is currently active in the machine.""" - - timeout: Optional[str] = None - """timeout contains the reason the environment has timed out. - - If this field is empty, the environment has not timed out. - """ - - versions: Optional[EnvironmentStatusMachineVersions] = None - """versions contains the versions of components in the machine.""" - - warning_message: Optional[str] = FieldInfo(alias="warningMessage", default=None) - """warning_message contains warnings, e.g. - - when the machine is present but not in the expected state. - """ - - -class EnvironmentStatusRunnerAck(BaseModel): - message: Optional[str] = None - - spec_version: Optional[str] = FieldInfo(alias="specVersion", default=None) - - status_code: Optional[ - Literal[ - "STATUS_CODE_UNSPECIFIED", - "STATUS_CODE_OK", - "STATUS_CODE_INVALID_RESOURCE", - "STATUS_CODE_FAILED_PRECONDITION", - ] - ] = FieldInfo(alias="statusCode", default=None) - - -class EnvironmentStatusSecret(BaseModel): - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message contains the reason the secret failed to be materialize.""" - - phase: Optional[ - Literal[ - "CONTENT_PHASE_UNSPECIFIED", - "CONTENT_PHASE_CREATING", - "CONTENT_PHASE_INITIALIZING", - "CONTENT_PHASE_READY", - "CONTENT_PHASE_UPDATING", - "CONTENT_PHASE_FAILED", - ] - ] = None - - secret_name: Optional[str] = FieldInfo(alias="secretName", default=None) - - session: Optional[str] = None - """session is the session that is currently active in the environment.""" - - warning_message: Optional[str] = FieldInfo(alias="warningMessage", default=None) - """warning_message contains warnings, e.g. - - when the secret is present but not in the expected state. - """ - - -class EnvironmentStatusSSHPublicKey(BaseModel): - id: Optional[str] = None - """id is the unique identifier of the public key""" - - phase: Optional[ - Literal[ - "CONTENT_PHASE_UNSPECIFIED", - "CONTENT_PHASE_CREATING", - "CONTENT_PHASE_INITIALIZING", - "CONTENT_PHASE_READY", - "CONTENT_PHASE_UPDATING", - "CONTENT_PHASE_FAILED", - ] - ] = None - """phase is the current phase of the public key""" - - -class EnvironmentStatus(BaseModel): - activity_signal: Optional[EnvironmentStatusActivitySignal] = FieldInfo(alias="activitySignal", default=None) - """EnvironmentActivitySignal used to signal activity for an environment.""" - - automations_file: Optional[EnvironmentStatusAutomationsFile] = FieldInfo(alias="automationsFile", default=None) - """automations_file contains the status of the automations file.""" - - content: Optional[EnvironmentStatusContent] = None - """content contains the status of the environment content.""" - - devcontainer: Optional[EnvironmentStatusDevcontainer] = None - """devcontainer contains the status of the devcontainer.""" - - environment_urls: Optional[EnvironmentStatusEnvironmentURLs] = FieldInfo(alias="environmentUrls", default=None) - """ - environment_url contains the URL at which the environment can be accessed. This - field is only set if the environment is running. - """ - - failure_message: Optional[List[str]] = FieldInfo(alias="failureMessage", default=None) - """failure_message summarises why the environment failed to operate. - - If this is non-empty the environment has failed to operate and will likely - transition to a stopped state. - """ - - machine: Optional[EnvironmentStatusMachine] = None - """machine contains the status of the environment machine""" - - phase: Optional[ - Literal[ - "ENVIRONMENT_PHASE_UNSPECIFIED", - "ENVIRONMENT_PHASE_CREATING", - "ENVIRONMENT_PHASE_STARTING", - "ENVIRONMENT_PHASE_RUNNING", - "ENVIRONMENT_PHASE_UPDATING", - "ENVIRONMENT_PHASE_STOPPING", - "ENVIRONMENT_PHASE_STOPPED", - "ENVIRONMENT_PHASE_DELETING", - "ENVIRONMENT_PHASE_DELETED", - ] - ] = None - """ - the phase of an environment is a simple, high-level summary of where the - environment is in its lifecycle - """ - - runner_ack: Optional[EnvironmentStatusRunnerAck] = FieldInfo(alias="runnerAck", default=None) - """ - RunnerACK is the acknowledgement from the runner that is has received the - environment spec. - """ - - secrets: Optional[List[EnvironmentStatusSecret]] = None - """secrets contains the status of the environment secrets""" - - ssh_public_keys: Optional[List[EnvironmentStatusSSHPublicKey]] = FieldInfo(alias="sshPublicKeys", default=None) - """ssh_public_keys contains the status of the environment ssh public keys""" - - status_version: Optional[str] = FieldInfo(alias="statusVersion", default=None) - """version of the status update. - - Environment instances themselves are unversioned, but their status has different - versions. The value of this field has no semantic meaning (e.g. don't interpret - it as as a timestamp), but it can be used to impose a partial order. If - a.status_version < b.status_version then a was the status before b. - """ - - warning_message: Optional[List[str]] = FieldInfo(alias="warningMessage", default=None) - """warning_message contains warnings, e.g. - - when the environment is present but not in the expected state. - """ - - -class Environment(BaseModel): - id: Optional[str] = None - """ID is a unique identifier of this environment. - - No other environment with the same name must be managed by this environment - manager - """ - - metadata: Optional[EnvironmentMetadata] = None - """ - EnvironmentMetadata is data associated with an environment that's required for - other parts of the system to function - """ - - spec: Optional[EnvironmentSpec] = None - """ - EnvironmentSpec specifies the configuration of an environment for an environment - start - """ - - status: Optional[EnvironmentStatus] = None - """EnvironmentStatus describes an environment status""" +__all__ = ["EnvironmentRetrieveResponse"] class EnvironmentRetrieveResponse(BaseModel): diff --git a/src/gitpod/types/environment_spec.py b/src/gitpod/types/environment_spec.py new file mode 100644 index 0000000..96ea049 --- /dev/null +++ b/src/gitpod/types/environment_spec.py @@ -0,0 +1,217 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .admission_level import AdmissionLevel +from .environment_phase import EnvironmentPhase +from .environment_initializer import EnvironmentInitializer + +__all__ = [ + "EnvironmentSpec", + "AutomationsFile", + "Content", + "Devcontainer", + "Machine", + "Port", + "Secret", + "SSHPublicKey", + "Timeout", +] + + +class AutomationsFile(BaseModel): + automations_file_path: Optional[str] = FieldInfo(alias="automationsFilePath", default=None) + """ + automations_file_path is the path to the automations file that is applied in the + environment, relative to the repo root. path must not be absolute (start with a + /): + + ``` + this.matches('^$|^[^/].*') + ``` + """ + + session: Optional[str] = None + + +class Content(BaseModel): + git_email: Optional[str] = FieldInfo(alias="gitEmail", default=None) + """The Git email address""" + + git_username: Optional[str] = FieldInfo(alias="gitUsername", default=None) + """The Git username""" + + initializer: Optional[EnvironmentInitializer] = None + """EnvironmentInitializer specifies how an environment is to be initialized""" + + session: Optional[str] = None + + +class Devcontainer(BaseModel): + devcontainer_file_path: Optional[str] = FieldInfo(alias="devcontainerFilePath", default=None) + """ + devcontainer_file_path is the path to the devcontainer file relative to the repo + root path must not be absolute (start with a /): + + ``` + this.matches('^$|^[^/].*') + ``` + """ + + session: Optional[str] = None + + +class Machine(BaseModel): + class_: Optional[str] = FieldInfo(alias="class", default=None) + """Class denotes the class of the environment we ought to start""" + + session: Optional[str] = None + + +class Port(BaseModel): + admission: Optional[AdmissionLevel] = None + """Admission level describes who can access an environment instance and its ports.""" + + name: Optional[str] = None + """name of this port""" + + port: Optional[int] = None + """port number""" + + +class Secret(BaseModel): + environment_variable: Optional[str] = FieldInfo(alias="environmentVariable", default=None) + + file_path: Optional[str] = FieldInfo(alias="filePath", default=None) + """file_path is the path inside the devcontainer where the secret is mounted""" + + git_credential_host: Optional[str] = FieldInfo(alias="gitCredentialHost", default=None) + + name: Optional[str] = None + """name is the human readable description of the secret""" + + session: Optional[str] = None + """ + session indicated the current session of the secret. When the session does not + change, secrets are not reloaded in the environment. + """ + + source: Optional[str] = None + """source is the source of the secret, for now control-plane or runner""" + + source_ref: Optional[str] = FieldInfo(alias="sourceRef", default=None) + """source_ref into the source, in case of control-plane this is uuid of the secret""" + + +class SSHPublicKey(BaseModel): + id: Optional[str] = None + """id is the unique identifier of the public key""" + + value: Optional[str] = None + """value is the actual public key in the public key file format""" + + +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". + """ + + +class EnvironmentSpec(BaseModel): + admission: Optional[AdmissionLevel] = None + """Admission level describes who can access an environment instance and its ports.""" + + automations_file: Optional[AutomationsFile] = FieldInfo(alias="automationsFile", default=None) + """automations_file is the automations file spec of the environment""" + + content: Optional[Content] = None + """content is the content spec of the environment""" + + desired_phase: Optional[EnvironmentPhase] = FieldInfo(alias="desiredPhase", default=None) + """Phase is the desired phase of the environment""" + + devcontainer: Optional[Devcontainer] = None + """devcontainer is the devcontainer spec of the environment""" + + machine: Optional[Machine] = None + """machine is the machine spec of the environment""" + + ports: Optional[List[Port]] = None + """ports is the set of ports which ought to be exposed to the internet""" + + secrets: Optional[List[Secret]] = None + """secrets are confidential data that is mounted into the environment""" + + spec_version: Optional[str] = FieldInfo(alias="specVersion", default=None) + """version of the spec. + + The value of this field has no semantic meaning (e.g. don't interpret it as as a + timestamp), but it can be used to impose a partial order. If a.spec_version < + b.spec_version then a was the spec before b. + """ + + ssh_public_keys: Optional[List[SSHPublicKey]] = FieldInfo(alias="sshPublicKeys", default=None) + """ssh_public_keys are the public keys used to ssh into the environment""" + + timeout: Optional[Timeout] = None + """Timeout configures the environment timeout""" diff --git a/src/gitpod/types/environment_spec_param.py b/src/gitpod/types/environment_spec_param.py new file mode 100644 index 0000000..2c1d714 --- /dev/null +++ b/src/gitpod/types/environment_spec_param.py @@ -0,0 +1,224 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Annotated, TypedDict + +from .._utils import PropertyInfo +from .admission_level import AdmissionLevel +from .environment_phase import EnvironmentPhase +from .environment_initializer_param import EnvironmentInitializerParam + +__all__ = [ + "EnvironmentSpecParam", + "AutomationsFile", + "Content", + "Devcontainer", + "Machine", + "Port", + "Secret", + "SSHPublicKey", + "Timeout", +] + + +class AutomationsFile(TypedDict, total=False): + automations_file_path: Annotated[str, PropertyInfo(alias="automationsFilePath")] + """ + automations_file_path is the path to the automations file that is applied in the + environment, relative to the repo root. path must not be absolute (start with a + /): + + ``` + this.matches('^$|^[^/].*') + ``` + """ + + session: str + + +class Content(TypedDict, total=False): + git_email: Annotated[str, PropertyInfo(alias="gitEmail")] + """The Git email address""" + + git_username: Annotated[str, PropertyInfo(alias="gitUsername")] + """The Git username""" + + initializer: EnvironmentInitializerParam + """EnvironmentInitializer specifies how an environment is to be initialized""" + + session: str + + +class Devcontainer(TypedDict, total=False): + devcontainer_file_path: Annotated[str, PropertyInfo(alias="devcontainerFilePath")] + """ + devcontainer_file_path is the path to the devcontainer file relative to the repo + root path must not be absolute (start with a /): + + ``` + this.matches('^$|^[^/].*') + ``` + """ + + session: str + + +_MachineReservedKeywords = TypedDict( + "_MachineReservedKeywords", + { + "class": str, + }, + total=False, +) + + +class Machine(_MachineReservedKeywords, total=False): + session: str + + +class Port(TypedDict, total=False): + admission: AdmissionLevel + """Admission level describes who can access an environment instance and its ports.""" + + name: str + """name of this port""" + + port: int + """port number""" + + +class Secret(TypedDict, total=False): + environment_variable: Annotated[str, PropertyInfo(alias="environmentVariable")] + + file_path: Annotated[str, PropertyInfo(alias="filePath")] + """file_path is the path inside the devcontainer where the secret is mounted""" + + git_credential_host: Annotated[str, PropertyInfo(alias="gitCredentialHost")] + + name: str + """name is the human readable description of the secret""" + + session: str + """ + session indicated the current session of the secret. When the session does not + change, secrets are not reloaded in the environment. + """ + + source: str + """source is the source of the secret, for now control-plane or runner""" + + source_ref: Annotated[str, PropertyInfo(alias="sourceRef")] + """source_ref into the source, in case of control-plane this is uuid of the secret""" + + +class SSHPublicKey(TypedDict, total=False): + id: str + """id is the unique identifier of the public key""" + + value: str + """value is the actual public key in the public key file format""" + + +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". + """ + + +class EnvironmentSpecParam(TypedDict, total=False): + admission: AdmissionLevel + """Admission level describes who can access an environment instance and its ports.""" + + automations_file: Annotated[AutomationsFile, PropertyInfo(alias="automationsFile")] + """automations_file is the automations file spec of the environment""" + + content: Content + """content is the content spec of the environment""" + + desired_phase: Annotated[EnvironmentPhase, PropertyInfo(alias="desiredPhase")] + """Phase is the desired phase of the environment""" + + devcontainer: Devcontainer + """devcontainer is the devcontainer spec of the environment""" + + machine: Machine + """machine is the machine spec of the environment""" + + ports: Iterable[Port] + """ports is the set of ports which ought to be exposed to the internet""" + + secrets: Iterable[Secret] + """secrets are confidential data that is mounted into the environment""" + + spec_version: Annotated[str, PropertyInfo(alias="specVersion")] + """version of the spec. + + The value of this field has no semantic meaning (e.g. don't interpret it as as a + timestamp), but it can be used to impose a partial order. If a.spec_version < + b.spec_version then a was the spec before b. + """ + + ssh_public_keys: Annotated[Iterable[SSHPublicKey], PropertyInfo(alias="sshPublicKeys")] + """ssh_public_keys are the public keys used to ssh into the environment""" + + timeout: Timeout + """Timeout configures the environment timeout""" diff --git a/src/gitpod/types/environment_status.py b/src/gitpod/types/environment_status.py new file mode 100644 index 0000000..6fd1a83 --- /dev/null +++ b/src/gitpod/types/environment_status.py @@ -0,0 +1,403 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .environment_phase import EnvironmentPhase +from .environment_activity_signal import EnvironmentActivitySignal + +__all__ = [ + "EnvironmentStatus", + "AutomationsFile", + "Content", + "ContentGit", + "ContentGitChangedFile", + "Devcontainer", + "EnvironmentURLs", + "EnvironmentURLsPort", + "EnvironmentURLsSSH", + "Machine", + "MachineVersions", + "RunnerAck", + "Secret", + "SSHPublicKey", +] + + +class AutomationsFile(BaseModel): + automations_file_path: Optional[str] = FieldInfo(alias="automationsFilePath", default=None) + """ + automations_file_path is the path to the automations file relative to the repo + root. + """ + + automations_file_presence: Optional[ + Literal["PRESENCE_UNSPECIFIED", "PRESENCE_ABSENT", "PRESENCE_DISCOVERED", "PRESENCE_SPECIFIED"] + ] = FieldInfo(alias="automationsFilePresence", default=None) + """ + automations_file_presence indicates how an automations file is present in the + environment. + """ + + failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) + """ + failure_message contains the reason the automations file failed to be applied. + This is only set if the phase is FAILED. + """ + + phase: Optional[ + Literal[ + "CONTENT_PHASE_UNSPECIFIED", + "CONTENT_PHASE_CREATING", + "CONTENT_PHASE_INITIALIZING", + "CONTENT_PHASE_READY", + "CONTENT_PHASE_UPDATING", + "CONTENT_PHASE_FAILED", + ] + ] = None + """phase is the current phase of the automations file.""" + + session: Optional[str] = None + """ + session is the automations file session that is currently applied in the + environment. + """ + + +class ContentGitChangedFile(BaseModel): + change_type: Optional[ + Literal[ + "CHANGE_TYPE_UNSPECIFIED", + "CHANGE_TYPE_ADDED", + "CHANGE_TYPE_MODIFIED", + "CHANGE_TYPE_DELETED", + "CHANGE_TYPE_RENAMED", + "CHANGE_TYPE_COPIED", + "CHANGE_TYPE_UPDATED_BUT_UNMERGED", + "CHANGE_TYPE_UNTRACKED", + ] + ] = FieldInfo(alias="changeType", default=None) + """ChangeType is the type of change that happened to the file""" + + path: Optional[str] = None + """path is the path of the file""" + + +class ContentGit(BaseModel): + branch: Optional[str] = None + """branch is branch we're currently on""" + + changed_files: Optional[List[ContentGitChangedFile]] = FieldInfo(alias="changedFiles", default=None) + """ + changed_files is an array of changed files in the environment, possibly + truncated + """ + + clone_url: Optional[str] = FieldInfo(alias="cloneUrl", default=None) + """ + clone_url is the repository url as you would pass it to "git clone". Only HTTPS + clone URLs are supported. + """ + + latest_commit: Optional[str] = FieldInfo(alias="latestCommit", default=None) + """latest_commit is the most recent commit on the current branch""" + + total_changed_files: Optional[int] = FieldInfo(alias="totalChangedFiles", default=None) + + total_unpushed_commits: Optional[int] = FieldInfo(alias="totalUnpushedCommits", default=None) + """the total number of unpushed changes""" + + unpushed_commits: Optional[List[str]] = FieldInfo(alias="unpushedCommits", default=None) + """ + unpushed_commits is an array of unpushed changes in the environment, possibly + truncated + """ + + +class Content(BaseModel): + content_location_in_machine: Optional[str] = FieldInfo(alias="contentLocationInMachine", default=None) + """content_location_in_machine is the location of the content in the machine""" + + failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) + """failure_message contains the reason the content initialization failed.""" + + git: Optional[ContentGit] = None + """ + git is the Git working copy status of the environment. Note: this is a + best-effort field and more often than not will not be present. Its absence does + not indicate the absence of a working copy. + """ + + phase: Optional[ + Literal[ + "CONTENT_PHASE_UNSPECIFIED", + "CONTENT_PHASE_CREATING", + "CONTENT_PHASE_INITIALIZING", + "CONTENT_PHASE_READY", + "CONTENT_PHASE_UPDATING", + "CONTENT_PHASE_FAILED", + ] + ] = None + """phase is the current phase of the environment content""" + + session: Optional[str] = None + """session is the session that is currently active in the environment.""" + + warning_message: Optional[str] = FieldInfo(alias="warningMessage", default=None) + """warning_message contains warnings, e.g. + + when the content is present but not in the expected state. + """ + + +class Devcontainer(BaseModel): + container_id: Optional[str] = FieldInfo(alias="containerId", default=None) + """container_id is the ID of the container.""" + + container_name: Optional[str] = FieldInfo(alias="containerName", default=None) + """ + container_name is the name of the container that is used to connect to the + devcontainer + """ + + devcontainerconfig_in_sync: Optional[bool] = FieldInfo(alias="devcontainerconfigInSync", default=None) + """devcontainerconfig_in_sync indicates if the devcontainer is up to date w.r.t. + + the devcontainer config file. + """ + + devcontainer_file_path: Optional[str] = FieldInfo(alias="devcontainerFilePath", default=None) + """ + devcontainer_file_path is the path to the devcontainer file relative to the repo + root + """ + + devcontainer_file_presence: Optional[ + Literal["PRESENCE_UNSPECIFIED", "PRESENCE_GENERATED", "PRESENCE_DISCOVERED", "PRESENCE_SPECIFIED"] + ] = FieldInfo(alias="devcontainerFilePresence", default=None) + """ + devcontainer_file_presence indicates how the devcontainer file is present in the + repo. + """ + + failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) + """failure_message contains the reason the devcontainer failed to operate.""" + + phase: Optional[ + Literal["PHASE_UNSPECIFIED", "PHASE_CREATING", "PHASE_RUNNING", "PHASE_STOPPED", "PHASE_FAILED"] + ] = None + """phase is the current phase of the devcontainer""" + + remote_user: Optional[str] = FieldInfo(alias="remoteUser", default=None) + """remote_user is the user that is used to connect to the devcontainer""" + + remote_workspace_folder: Optional[str] = FieldInfo(alias="remoteWorkspaceFolder", default=None) + """ + remote_workspace_folder is the folder that is used to connect to the + devcontainer + """ + + secrets_in_sync: Optional[bool] = FieldInfo(alias="secretsInSync", default=None) + """secrets_in_sync indicates if the secrets are up to date w.r.t. + + the running devcontainer. + """ + + session: Optional[str] = None + """session is the session that is currently active in the devcontainer.""" + + warning_message: Optional[str] = FieldInfo(alias="warningMessage", default=None) + """warning_message contains warnings, e.g. + + when the devcontainer is present but not in the expected state. + """ + + +class EnvironmentURLsPort(BaseModel): + port: Optional[int] = None + """port is the port number of the environment port""" + + url: Optional[str] = None + """url is the URL at which the environment port can be accessed""" + + +class EnvironmentURLsSSH(BaseModel): + url: Optional[str] = None + + +class EnvironmentURLs(BaseModel): + logs: Optional[str] = None + """logs is the URL at which the environment logs can be accessed.""" + + ports: Optional[List[EnvironmentURLsPort]] = None + + ssh: Optional[EnvironmentURLsSSH] = None + """SSH is the URL at which the environment can be accessed via SSH.""" + + +class MachineVersions(BaseModel): + supervisor_commit: Optional[str] = FieldInfo(alias="supervisorCommit", default=None) + + supervisor_version: Optional[str] = FieldInfo(alias="supervisorVersion", default=None) + + +class Machine(BaseModel): + failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) + """failure_message contains the reason the machine failed to operate.""" + + phase: Optional[ + Literal[ + "PHASE_UNSPECIFIED", + "PHASE_CREATING", + "PHASE_STARTING", + "PHASE_RUNNING", + "PHASE_STOPPING", + "PHASE_STOPPED", + "PHASE_DELETING", + "PHASE_DELETED", + ] + ] = None + """phase is the current phase of the environment machine""" + + session: Optional[str] = None + """session is the session that is currently active in the machine.""" + + timeout: Optional[str] = None + """timeout contains the reason the environment has timed out. + + If this field is empty, the environment has not timed out. + """ + + versions: Optional[MachineVersions] = None + """versions contains the versions of components in the machine.""" + + warning_message: Optional[str] = FieldInfo(alias="warningMessage", default=None) + """warning_message contains warnings, e.g. + + when the machine is present but not in the expected state. + """ + + +class RunnerAck(BaseModel): + message: Optional[str] = None + + spec_version: Optional[str] = FieldInfo(alias="specVersion", default=None) + + status_code: Optional[ + Literal[ + "STATUS_CODE_UNSPECIFIED", + "STATUS_CODE_OK", + "STATUS_CODE_INVALID_RESOURCE", + "STATUS_CODE_FAILED_PRECONDITION", + ] + ] = FieldInfo(alias="statusCode", default=None) + + +class Secret(BaseModel): + failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) + """failure_message contains the reason the secret failed to be materialize.""" + + phase: Optional[ + Literal[ + "CONTENT_PHASE_UNSPECIFIED", + "CONTENT_PHASE_CREATING", + "CONTENT_PHASE_INITIALIZING", + "CONTENT_PHASE_READY", + "CONTENT_PHASE_UPDATING", + "CONTENT_PHASE_FAILED", + ] + ] = None + + secret_name: Optional[str] = FieldInfo(alias="secretName", default=None) + + session: Optional[str] = None + """session is the session that is currently active in the environment.""" + + warning_message: Optional[str] = FieldInfo(alias="warningMessage", default=None) + """warning_message contains warnings, e.g. + + when the secret is present but not in the expected state. + """ + + +class SSHPublicKey(BaseModel): + id: Optional[str] = None + """id is the unique identifier of the public key""" + + phase: Optional[ + Literal[ + "CONTENT_PHASE_UNSPECIFIED", + "CONTENT_PHASE_CREATING", + "CONTENT_PHASE_INITIALIZING", + "CONTENT_PHASE_READY", + "CONTENT_PHASE_UPDATING", + "CONTENT_PHASE_FAILED", + ] + ] = None + """phase is the current phase of the public key""" + + +class EnvironmentStatus(BaseModel): + activity_signal: Optional[EnvironmentActivitySignal] = FieldInfo(alias="activitySignal", default=None) + """EnvironmentActivitySignal used to signal activity for an environment.""" + + automations_file: Optional[AutomationsFile] = FieldInfo(alias="automationsFile", default=None) + """automations_file contains the status of the automations file.""" + + content: Optional[Content] = None + """content contains the status of the environment content.""" + + devcontainer: Optional[Devcontainer] = None + """devcontainer contains the status of the devcontainer.""" + + environment_urls: Optional[EnvironmentURLs] = FieldInfo(alias="environmentUrls", default=None) + """ + environment_url contains the URL at which the environment can be accessed. This + field is only set if the environment is running. + """ + + failure_message: Optional[List[str]] = FieldInfo(alias="failureMessage", default=None) + """failure_message summarises why the environment failed to operate. + + If this is non-empty the environment has failed to operate and will likely + transition to a stopped state. + """ + + machine: Optional[Machine] = None + """machine contains the status of the environment machine""" + + phase: Optional[EnvironmentPhase] = None + """ + the phase of an environment is a simple, high-level summary of where the + environment is in its lifecycle + """ + + runner_ack: Optional[RunnerAck] = FieldInfo(alias="runnerAck", default=None) + """ + RunnerACK is the acknowledgement from the runner that is has received the + environment spec. + """ + + secrets: Optional[List[Secret]] = None + """secrets contains the status of the environment secrets""" + + ssh_public_keys: Optional[List[SSHPublicKey]] = FieldInfo(alias="sshPublicKeys", default=None) + """ssh_public_keys contains the status of the environment ssh public keys""" + + status_version: Optional[str] = FieldInfo(alias="statusVersion", default=None) + """version of the status update. + + Environment instances themselves are unversioned, but their status has different + versions. The value of this field has no semantic meaning (e.g. don't interpret + it as as a timestamp), but it can be used to impose a partial order. If + a.status_version < b.status_version then a was the status before b. + """ + + warning_message: Optional[List[str]] = FieldInfo(alias="warningMessage", default=None) + """warning_message contains warnings, e.g. + + when the environment is present but not in the expected state. + """ diff --git a/src/gitpod/types/environment_update_params.py b/src/gitpod/types/environment_update_params.py index 7d93627..9768d6b 100644 --- a/src/gitpod/types/environment_update_params.py +++ b/src/gitpod/types/environment_update_params.py @@ -2,36 +2,22 @@ from __future__ import annotations -from typing import Union, Iterable, Optional -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing import Iterable, Optional +from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo +from .admission_level import AdmissionLevel +from .environment_initializer_param import EnvironmentInitializerParam __all__ = [ "EnvironmentUpdateParams", "Spec", - "SpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironment", - "SpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFile", - "SpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFileAutomationsFilePathIsThePathToTheAutomationsFileThatIsAppliedInTheEnvironmentRelativeToTheRepoRoot", - "SpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFileSession", + "SpecAutomationsFile", "SpecContent", - "SpecContentContent", - "SpecContentContentTheGitEmailAddress", - "SpecContentContentTheGitUsername", - "SpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitialized", - "SpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializer", - "SpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpec", - "SpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecContextURL", - "SpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecContextURLContextURL", - "SpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecGit", - "SpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecGitGit", - "SpecContentContentSessionShouldBeChangedToTriggerAContentReinitialization", "SpecDevcontainer", - "SpecDevcontainerDevcontainer", - "SpecDevcontainerDevcontainerDevcontainerFilePathIsThePathToTheDevcontainerFileRelativeToTheRepoRoot", - "SpecDevcontainerDevcontainerSessionShouldBeChangedToTriggerADevcontainerRebuild", - "SpecTimeoutConfiguresTheEnvironmentTimeout", - "SpecTimeoutConfiguresTheEnvironmentTimeoutTimeout", + "SpecPort", + "SpecSSHPublicKey", + "SpecTimeout", ] @@ -47,10 +33,8 @@ class EnvironmentUpdateParams(TypedDict, total=False): spec: Optional[Spec] -class SpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFileAutomationsFilePathIsThePathToTheAutomationsFileThatIsAppliedInTheEnvironmentRelativeToTheRepoRoot( - TypedDict, total=False -): - automations_file_path: Required[Annotated[str, PropertyInfo(alias="automationsFilePath")]] +class SpecAutomationsFile(TypedDict, total=False): + automations_file_path: Annotated[Optional[str], PropertyInfo(alias="automationsFilePath")] """ automations_file_path is the path to the automations file that is applied in the environment, relative to the repo root. path must not be absolute (start with a @@ -61,127 +45,25 @@ class SpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFile ``` """ + session: Optional[str] -class SpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFileSession(TypedDict, total=False): - session: Required[str] - -SpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFile: TypeAlias = Union[ - SpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFileAutomationsFilePathIsThePathToTheAutomationsFileThatIsAppliedInTheEnvironmentRelativeToTheRepoRoot, - SpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFileSession, -] - - -class SpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironment(TypedDict, total=False): - automations_file: Required[ - Annotated[ - SpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironmentAutomationsFile, - PropertyInfo(alias="automationsFile"), - ] - ] - """automations_file is the automations file spec of the environment""" - - -class SpecContentContentTheGitEmailAddress(TypedDict, total=False): - git_email: Required[Annotated[str, PropertyInfo(alias="gitEmail")]] +class SpecContent(TypedDict, total=False): + git_email: Annotated[Optional[str], PropertyInfo(alias="gitEmail")] """The Git email address""" - -class SpecContentContentTheGitUsername(TypedDict, total=False): - git_username: Required[Annotated[str, PropertyInfo(alias="gitUsername")]] + git_username: Annotated[Optional[str], PropertyInfo(alias="gitUsername")] """The Git username""" - -class SpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecContextURLContextURL( - TypedDict, total=False -): - url: str - """url is the URL from which the environment is created""" - - -class SpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecContextURL( - TypedDict, total=False -): - context_url: Required[ - Annotated[ - SpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecContextURLContextURL, - PropertyInfo(alias="contextUrl"), - ] - ] - - -class SpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecGitGit( - TypedDict, total=False -): - checkout_location: Annotated[str, PropertyInfo(alias="checkoutLocation")] - """ - a path relative to the environment root in which the code will be checked out to - """ - - clone_target: Annotated[str, PropertyInfo(alias="cloneTarget")] - """the value for the clone target mode - use depends on the target mode""" - - remote_uri: Annotated[str, PropertyInfo(alias="remoteUri")] - """remote_uri is the Git remote origin""" - - target_mode: Annotated[ - Literal[ - "CLONE_TARGET_MODE_UNSPECIFIED", - "CLONE_TARGET_MODE_REMOTE_HEAD", - "CLONE_TARGET_MODE_REMOTE_COMMIT", - "CLONE_TARGET_MODE_REMOTE_BRANCH", - "CLONE_TARGET_MODE_LOCAL_BRANCH", - ], - PropertyInfo(alias="targetMode"), - ] - """CloneTargetMode is the target state in which we want to leave a GitEnvironment""" - - upstream_remote_uri: Annotated[str, PropertyInfo(alias="upstreamRemoteUri")] - """upstream_Remote_uri is the fork upstream of a repository""" - - -class SpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecGit( - TypedDict, total=False -): - git: Required[SpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecGitGit] - - -SpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpec: TypeAlias = Union[ - SpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecContextURL, - SpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpecGit, -] - - -class SpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializer(TypedDict, total=False): - specs: Iterable[SpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializerSpec] - - -class SpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitialized(TypedDict, total=False): - initializer: Required[SpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitializedInitializer] + initializer: Optional[EnvironmentInitializerParam] """EnvironmentInitializer specifies how an environment is to be initialized""" - -class SpecContentContentSessionShouldBeChangedToTriggerAContentReinitialization(TypedDict, total=False): - session: Required[str] + session: Optional[str] """session should be changed to trigger a content reinitialization""" -SpecContentContent: TypeAlias = Union[ - SpecContentContentTheGitEmailAddress, - SpecContentContentTheGitUsername, - SpecContentContentInitializerConfiguresHowTheEnvironmentIsToBeInitialized, - SpecContentContentSessionShouldBeChangedToTriggerAContentReinitialization, -] - - -class SpecContent(TypedDict, total=False): - content: Required[SpecContentContent] - - -class SpecDevcontainerDevcontainerDevcontainerFilePathIsThePathToTheDevcontainerFileRelativeToTheRepoRoot( - TypedDict, total=False -): - devcontainer_file_path: Required[Annotated[str, PropertyInfo(alias="devcontainerFilePath")]] +class SpecDevcontainer(TypedDict, total=False): + devcontainer_file_path: Annotated[Optional[str], PropertyInfo(alias="devcontainerFilePath")] """ devcontainer_file_path is the path to the devcontainer file relative to the repo root path must not be absolute (start with a /): @@ -191,24 +73,34 @@ class SpecDevcontainerDevcontainerDevcontainerFilePathIsThePathToTheDevcontainer ``` """ - -class SpecDevcontainerDevcontainerSessionShouldBeChangedToTriggerADevcontainerRebuild(TypedDict, total=False): - session: Required[str] + session: Optional[str] """session should be changed to trigger a devcontainer rebuild""" -SpecDevcontainerDevcontainer: TypeAlias = Union[ - SpecDevcontainerDevcontainerDevcontainerFilePathIsThePathToTheDevcontainerFileRelativeToTheRepoRoot, - SpecDevcontainerDevcontainerSessionShouldBeChangedToTriggerADevcontainerRebuild, -] +class SpecPort(TypedDict, total=False): + admission: AdmissionLevel + """Admission level describes who can access an environment instance and its ports.""" + name: str + """name of this port""" + + port: int + """port number""" -class SpecDevcontainer(TypedDict, total=False): - devcontainer: Required[SpecDevcontainerDevcontainer] +class SpecSSHPublicKey(TypedDict, total=False): + id: str + """id is the unique identifier of the public key""" -class SpecTimeoutConfiguresTheEnvironmentTimeoutTimeout(TypedDict, total=False): - disconnected: Required[str] + value: Optional[str] + """ + value is the actual public key in the public key file format if not provided, + the public key will be removed + """ + + +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 @@ -270,14 +162,22 @@ class SpecTimeoutConfiguresTheEnvironmentTimeoutTimeout(TypedDict, total=False): """ -class SpecTimeoutConfiguresTheEnvironmentTimeout(TypedDict, total=False): - timeout: Required[SpecTimeoutConfiguresTheEnvironmentTimeoutTimeout] - """Timeout configures the environment timeout""" +class Spec(TypedDict, total=False): + automations_file: Annotated[Optional[SpecAutomationsFile], PropertyInfo(alias="automationsFile")] + """automations_file is the automations file spec of the environment""" + content: Optional[SpecContent] -Spec: TypeAlias = Union[ - SpecAutomationsFileIsTheAutomationsFileSpecOfTheEnvironment, - SpecContent, - SpecDevcontainer, - SpecTimeoutConfiguresTheEnvironmentTimeout, -] + devcontainer: Optional[SpecDevcontainer] + + ports: Iterable[SpecPort] + """ports controls port sharing""" + + ssh_public_keys: Annotated[Iterable[SpecSSHPublicKey], PropertyInfo(alias="sshPublicKeys")] + """ + ssh_public_keys are the public keys to update empty array means nothing to + update + """ + + timeout: Optional[SpecTimeout] + """Timeout configures the environment timeout""" diff --git a/src/gitpod/types/environments/__init__.py b/src/gitpod/types/environments/__init__.py index 240da5e..2a0fe22 100644 --- a/src/gitpod/types/environments/__init__.py +++ b/src/gitpod/types/environments/__init__.py @@ -3,6 +3,6 @@ from __future__ import annotations from .class_list_params import ClassListParams as ClassListParams -from .class_list_response import ClassListResponse as ClassListResponse +from .automations_file_param import AutomationsFileParam as AutomationsFileParam from .automation_upsert_params import AutomationUpsertParams as AutomationUpsertParams from .automation_upsert_response import AutomationUpsertResponse as AutomationUpsertResponse diff --git a/src/gitpod/types/environments/automation_upsert_params.py b/src/gitpod/types/environments/automation_upsert_params.py index 6c32b86..754ae89 100644 --- a/src/gitpod/types/environments/automation_upsert_params.py +++ b/src/gitpod/types/environments/automation_upsert_params.py @@ -2,26 +2,16 @@ from __future__ import annotations -from typing import Dict, List -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing_extensions import Annotated, TypedDict from ..._utils import PropertyInfo +from .automations_file_param import AutomationsFileParam -__all__ = [ - "AutomationUpsertParams", - "AutomationsFile", - "AutomationsFileServices", - "AutomationsFileServicesCommands", - "AutomationsFileServicesRunsOn", - "AutomationsFileServicesRunsOnDocker", - "AutomationsFileTasks", - "AutomationsFileTasksRunsOn", - "AutomationsFileTasksRunsOnDocker", -] +__all__ = ["AutomationUpsertParams"] class AutomationUpsertParams(TypedDict, total=False): - automations_file: Annotated[AutomationsFile, PropertyInfo(alias="automationsFile")] + automations_file: Annotated[AutomationsFileParam, PropertyInfo(alias="automationsFile")] """ WARN: Do not remove any field here, as it will break reading automation yaml files. We error if there are any unknown fields in the yaml (to ensure the yaml @@ -30,89 +20,3 @@ class AutomationUpsertParams(TypedDict, total=False): """ environment_id: Annotated[str, PropertyInfo(alias="environmentId")] - - -class AutomationsFileServicesCommands(TypedDict, total=False): - ready: str - """ - ready is an optional command that is run repeatedly until it exits with a zero - exit code. If set, the service will first go into a Starting phase, and then - into a Running phase once the ready command exits with a zero exit code. - """ - - start: str - """ - start is the command to start and run the service. If start exits, the service - will transition to the following phase: - - - Stopped: if the exit code is 0 - - Failed: if the exit code is not 0 If the stop command is not set, the start - command will receive a SIGTERM signal when the service is requested to stop. - If it does not exit within 2 minutes, it will receive a SIGKILL signal. - """ - - stop: str - """ - stop is an optional command that runs when the service is requested to stop. If - set, instead of sending a SIGTERM signal to the start command, the stop command - will be run. Once the stop command exits, the start command will receive a - SIGKILL signal. If the stop command exits with a non-zero exit code, the service - will transition to the Failed phase. If the stop command does not exit within 2 - minutes, a SIGKILL signal will be sent to both the start and stop commands. - """ - - -class AutomationsFileServicesRunsOnDocker(TypedDict, total=False): - environment: List[str] - - image: str - - -class AutomationsFileServicesRunsOn(TypedDict, total=False): - docker: Required[AutomationsFileServicesRunsOnDocker] - - -class AutomationsFileServices(TypedDict, total=False): - commands: AutomationsFileServicesCommands - - description: str - - name: str - - runs_on: Annotated[AutomationsFileServicesRunsOn, PropertyInfo(alias="runsOn")] - - triggered_by: Annotated[ - List[Literal["manual", "postEnvironmentStart", "postDevcontainerStart"]], PropertyInfo(alias="triggeredBy") - ] - - -class AutomationsFileTasksRunsOnDocker(TypedDict, total=False): - environment: List[str] - - image: str - - -class AutomationsFileTasksRunsOn(TypedDict, total=False): - docker: Required[AutomationsFileTasksRunsOnDocker] - - -class AutomationsFileTasks(TypedDict, total=False): - command: str - - depends_on: Annotated[List[str], PropertyInfo(alias="dependsOn")] - - description: str - - name: str - - runs_on: Annotated[AutomationsFileTasksRunsOn, PropertyInfo(alias="runsOn")] - - triggered_by: Annotated[ - List[Literal["manual", "postEnvironmentStart", "postDevcontainerStart"]], PropertyInfo(alias="triggeredBy") - ] - - -class AutomationsFile(TypedDict, total=False): - services: Dict[str, AutomationsFileServices] - - tasks: Dict[str, AutomationsFileTasks] diff --git a/src/gitpod/types/environments/automations/__init__.py b/src/gitpod/types/environments/automations/__init__.py index 58ee02d..11a40e6 100644 --- a/src/gitpod/types/environments/automations/__init__.py +++ b/src/gitpod/types/environments/automations/__init__.py @@ -2,22 +2,32 @@ from __future__ import annotations +from .task import Task as Task +from .service import Service as Service +from .task_spec import TaskSpec as TaskSpec +from .service_spec import ServiceSpec as ServiceSpec +from .service_phase import ServicePhase as ServicePhase +from .task_metadata import TaskMetadata as TaskMetadata +from .service_status import ServiceStatus as ServiceStatus +from .task_spec_param import TaskSpecParam as TaskSpecParam +from .service_metadata import ServiceMetadata as ServiceMetadata from .task_list_params import TaskListParams as TaskListParams from .task_start_params import TaskStartParams as TaskStartParams +from .service_spec_param import ServiceSpecParam as ServiceSpecParam from .task_create_params import TaskCreateParams as TaskCreateParams from .task_delete_params import TaskDeleteParams as TaskDeleteParams -from .task_list_response import TaskListResponse as TaskListResponse from .task_update_params import TaskUpdateParams as TaskUpdateParams from .service_list_params import ServiceListParams as ServiceListParams from .service_stop_params import ServiceStopParams as ServiceStopParams +from .task_metadata_param import TaskMetadataParam as TaskMetadataParam from .task_start_response import TaskStartResponse as TaskStartResponse from .service_start_params import ServiceStartParams as ServiceStartParams from .task_create_response import TaskCreateResponse as TaskCreateResponse from .task_retrieve_params import TaskRetrieveParams as TaskRetrieveParams from .service_create_params import ServiceCreateParams as ServiceCreateParams from .service_delete_params import ServiceDeleteParams as ServiceDeleteParams -from .service_list_response import ServiceListResponse as ServiceListResponse from .service_update_params import ServiceUpdateParams as ServiceUpdateParams +from .service_metadata_param import ServiceMetadataParam as ServiceMetadataParam from .task_retrieve_response import TaskRetrieveResponse as TaskRetrieveResponse from .service_create_response import ServiceCreateResponse as ServiceCreateResponse from .service_retrieve_params import ServiceRetrieveParams as ServiceRetrieveParams diff --git a/src/gitpod/types/environments/automations/service.py b/src/gitpod/types/environments/automations/service.py new file mode 100644 index 0000000..337562b --- /dev/null +++ b/src/gitpod/types/environments/automations/service.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel +from .service_spec import ServiceSpec +from .service_status import ServiceStatus +from .service_metadata import ServiceMetadata + +__all__ = ["Service"] + + +class Service(BaseModel): + id: Optional[str] = None + + environment_id: Optional[str] = FieldInfo(alias="environmentId", default=None) + + metadata: Optional[ServiceMetadata] = None + + spec: Optional[ServiceSpec] = None + + status: Optional[ServiceStatus] = None diff --git a/src/gitpod/types/environments/automations/service_create_params.py b/src/gitpod/types/environments/automations/service_create_params.py index 5b50327..248cd55 100644 --- a/src/gitpod/types/environments/automations/service_create_params.py +++ b/src/gitpod/types/environments/automations/service_create_params.py @@ -2,264 +2,18 @@ from __future__ import annotations -from typing import List, Union, Iterable -from datetime import datetime -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing_extensions import Annotated, TypedDict from ...._utils import PropertyInfo +from .service_spec_param import ServiceSpecParam +from .service_metadata_param import ServiceMetadataParam -__all__ = [ - "ServiceCreateParams", - "Metadata", - "MetadataCreator", - "MetadataTriggeredBy", - "MetadataTriggeredByManual", - "MetadataTriggeredByPostDevcontainerStart", - "MetadataTriggeredByPostEnvironmentStart", - "Spec", - "SpecCommands", - "SpecRunsOn", - "SpecRunsOnDocker", -] +__all__ = ["ServiceCreateParams"] class ServiceCreateParams(TypedDict, total=False): environment_id: Annotated[str, PropertyInfo(alias="environmentId")] - metadata: Metadata + metadata: ServiceMetadataParam - spec: Spec - - -class MetadataCreator(TypedDict, total=False): - id: str - """id is the UUID of the subject""" - - principal: Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - """Principal is the principal of the subject""" - - -class MetadataTriggeredByManual(TypedDict, total=False): - manual: Required[bool] - - -class MetadataTriggeredByPostDevcontainerStart(TypedDict, total=False): - post_devcontainer_start: Required[Annotated[bool, PropertyInfo(alias="postDevcontainerStart")]] - - -class MetadataTriggeredByPostEnvironmentStart(TypedDict, total=False): - post_environment_start: Required[Annotated[bool, PropertyInfo(alias="postEnvironmentStart")]] - - -MetadataTriggeredBy: TypeAlias = Union[ - MetadataTriggeredByManual, MetadataTriggeredByPostDevcontainerStart, MetadataTriggeredByPostEnvironmentStart -] - - -class Metadata(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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - creator: MetadataCreator - """creator describes the principal who created the service.""" - - description: str - """description is a user-facing description for the service. - - It can be used to provide context and documentation for the service. - """ - - name: str - """name is a user-facing name for the service. - - Unlike the reference, this field is not unique, and not referenced by the - system. This is a short descriptive name for the service. - """ - - reference: str - """ - reference is a user-facing identifier for the service which must be unique on - the environment. It is used to express dependencies between services, and to - identify the service in user interactions (e.g. the CLI). - """ - - triggered_by: Annotated[Iterable[MetadataTriggeredBy], PropertyInfo(alias="triggeredBy")] - """triggered_by is a list of trigger that start the service.""" - - -class SpecCommands(TypedDict, total=False): - ready: str - """ - ready is an optional command that is run repeatedly until it exits with a zero - exit code. If set, the service will first go into a Starting phase, and then - into a Running phase once the ready command exits with a zero exit code. - """ - - start: str - """ - start is the command to start and run the service. If start exits, the service - will transition to the following phase: - - - Stopped: if the exit code is 0 - - Failed: if the exit code is not 0 If the stop command is not set, the start - command will receive a SIGTERM signal when the service is requested to stop. - If it does not exit within 2 minutes, it will receive a SIGKILL signal. - """ - - stop: str - """ - stop is an optional command that runs when the service is requested to stop. If - set, instead of sending a SIGTERM signal to the start command, the stop command - will be run. Once the stop command exits, the start command will receive a - SIGKILL signal. If the stop command exits with a non-zero exit code, the service - will transition to the Failed phase. If the stop command does not exit within 2 - minutes, a SIGKILL signal will be sent to both the start and stop commands. - """ - - -class SpecRunsOnDocker(TypedDict, total=False): - environment: List[str] - - image: str - - -class SpecRunsOn(TypedDict, total=False): - docker: Required[SpecRunsOnDocker] - - -class Spec(TypedDict, total=False): - commands: SpecCommands - """ - commands contains the commands to start, stop and check the readiness of the - service - """ - - desired_phase: Annotated[ - Literal[ - "SERVICE_PHASE_UNSPECIFIED", - "SERVICE_PHASE_STARTING", - "SERVICE_PHASE_RUNNING", - "SERVICE_PHASE_STOPPING", - "SERVICE_PHASE_STOPPED", - "SERVICE_PHASE_FAILED", - "SERVICE_PHASE_DELETED", - ], - PropertyInfo(alias="desiredPhase"), - ] - """desired_phase is the phase the service should be in. - - Used to start or stop the service. - """ - - runs_on: Annotated[SpecRunsOn, PropertyInfo(alias="runsOn")] - """runs_on specifies the environment the service should run on.""" - - session: str - """session should be changed to trigger a restart of the service. - - If a service exits it will not be restarted until the session is changed. - """ - - spec_version: Annotated[str, PropertyInfo(alias="specVersion")] - """version of the spec. - - The value of this field has no semantic meaning (e.g. don't interpret it as as a - timestamp), but it can be used to impose a partial order. If a.spec_version < - b.spec_version then a was the spec before b. - """ + spec: ServiceSpecParam diff --git a/src/gitpod/types/environments/automations/service_create_response.py b/src/gitpod/types/environments/automations/service_create_response.py index 5e01ca6..1242a11 100644 --- a/src/gitpod/types/environments/automations/service_create_response.py +++ b/src/gitpod/types/environments/automations/service_create_response.py @@ -1,314 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias - -from pydantic import Field as FieldInfo +from typing import Optional +from .service import Service from ...._models import BaseModel -__all__ = [ - "ServiceCreateResponse", - "Service", - "ServiceMetadata", - "ServiceMetadataCreator", - "ServiceMetadataTriggeredBy", - "ServiceMetadataTriggeredByManual", - "ServiceMetadataTriggeredByPostDevcontainerStart", - "ServiceMetadataTriggeredByPostEnvironmentStart", - "ServiceSpec", - "ServiceSpecCommands", - "ServiceSpecRunsOn", - "ServiceSpecRunsOnDocker", - "ServiceStatus", -] - - -class ServiceMetadataCreator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class ServiceMetadataTriggeredByManual(BaseModel): - manual: bool - - -class ServiceMetadataTriggeredByPostDevcontainerStart(BaseModel): - post_devcontainer_start: bool = FieldInfo(alias="postDevcontainerStart") - - -class ServiceMetadataTriggeredByPostEnvironmentStart(BaseModel): - post_environment_start: bool = FieldInfo(alias="postEnvironmentStart") - - -ServiceMetadataTriggeredBy: TypeAlias = Union[ - ServiceMetadataTriggeredByManual, - ServiceMetadataTriggeredByPostDevcontainerStart, - ServiceMetadataTriggeredByPostEnvironmentStart, -] - - -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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - creator: Optional[ServiceMetadataCreator] = None - """creator describes the principal who created the service.""" - - description: Optional[str] = None - """description is a user-facing description for the service. - - It can be used to provide context and documentation for the service. - """ - - name: Optional[str] = None - """name is a user-facing name for the service. - - Unlike the reference, this field is not unique, and not referenced by the - system. This is a short descriptive name for the service. - """ - - reference: Optional[str] = None - """ - reference is a user-facing identifier for the service which must be unique on - the environment. It is used to express dependencies between services, and to - identify the service in user interactions (e.g. the CLI). - """ - - triggered_by: Optional[List[ServiceMetadataTriggeredBy]] = FieldInfo(alias="triggeredBy", default=None) - """triggered_by is a list of trigger that start the service.""" - - -class ServiceSpecCommands(BaseModel): - ready: Optional[str] = None - """ - ready is an optional command that is run repeatedly until it exits with a zero - exit code. If set, the service will first go into a Starting phase, and then - into a Running phase once the ready command exits with a zero exit code. - """ - - start: Optional[str] = None - """ - start is the command to start and run the service. If start exits, the service - will transition to the following phase: - - - Stopped: if the exit code is 0 - - Failed: if the exit code is not 0 If the stop command is not set, the start - command will receive a SIGTERM signal when the service is requested to stop. - If it does not exit within 2 minutes, it will receive a SIGKILL signal. - """ - - stop: Optional[str] = None - """ - stop is an optional command that runs when the service is requested to stop. If - set, instead of sending a SIGTERM signal to the start command, the stop command - will be run. Once the stop command exits, the start command will receive a - SIGKILL signal. If the stop command exits with a non-zero exit code, the service - will transition to the Failed phase. If the stop command does not exit within 2 - minutes, a SIGKILL signal will be sent to both the start and stop commands. - """ - - -class ServiceSpecRunsOnDocker(BaseModel): - environment: Optional[List[str]] = None - - image: Optional[str] = None - - -class ServiceSpecRunsOn(BaseModel): - docker: ServiceSpecRunsOnDocker - - -class ServiceSpec(BaseModel): - commands: Optional[ServiceSpecCommands] = None - """ - commands contains the commands to start, stop and check the readiness of the - service - """ - - desired_phase: Optional[ - Literal[ - "SERVICE_PHASE_UNSPECIFIED", - "SERVICE_PHASE_STARTING", - "SERVICE_PHASE_RUNNING", - "SERVICE_PHASE_STOPPING", - "SERVICE_PHASE_STOPPED", - "SERVICE_PHASE_FAILED", - "SERVICE_PHASE_DELETED", - ] - ] = FieldInfo(alias="desiredPhase", default=None) - """desired_phase is the phase the service should be in. - - Used to start or stop the service. - """ - - runs_on: Optional[ServiceSpecRunsOn] = FieldInfo(alias="runsOn", default=None) - """runs_on specifies the environment the service should run on.""" - - session: Optional[str] = None - """session should be changed to trigger a restart of the service. - - If a service exits it will not be restarted until the session is changed. - """ - - spec_version: Optional[str] = FieldInfo(alias="specVersion", default=None) - """version of the spec. - - The value of this field has no semantic meaning (e.g. don't interpret it as as a - timestamp), but it can be used to impose a partial order. If a.spec_version < - b.spec_version then a was the spec before b. - """ - - -class ServiceStatus(BaseModel): - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message summarises why the service failed to operate. - - If this is non-empty the service has failed to operate and will likely - transition to a failed state. - """ - - log_url: Optional[str] = FieldInfo(alias="logUrl", default=None) - """log_url contains the URL at which the service logs can be accessed.""" - - phase: Optional[ - Literal[ - "SERVICE_PHASE_UNSPECIFIED", - "SERVICE_PHASE_STARTING", - "SERVICE_PHASE_RUNNING", - "SERVICE_PHASE_STOPPING", - "SERVICE_PHASE_STOPPED", - "SERVICE_PHASE_FAILED", - "SERVICE_PHASE_DELETED", - ] - ] = None - """phase is the current phase of the service.""" - - session: Optional[str] = None - """session is the current session of the service.""" - - status_version: Optional[str] = FieldInfo(alias="statusVersion", default=None) - """version of the status update. - - Service instances themselves are unversioned, but their status has different - versions. The value of this field has no semantic meaning (e.g. don't interpret - it as as a timestamp), but it can be used to impose a partial order. If - a.status_version < b.status_version then a was the status before b. - """ - - -class Service(BaseModel): - id: Optional[str] = None - - environment_id: Optional[str] = FieldInfo(alias="environmentId", default=None) - - metadata: Optional[ServiceMetadata] = None - - spec: Optional[ServiceSpec] = None - - status: Optional[ServiceStatus] = None +__all__ = ["ServiceCreateResponse"] class ServiceCreateResponse(BaseModel): diff --git a/src/gitpod/types/environments/automations/service_list_response.py b/src/gitpod/types/environments/automations/service_list_response.py deleted file mode 100644 index e436698..0000000 --- a/src/gitpod/types/environments/automations/service_list_response.py +++ /dev/null @@ -1,308 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias - -from pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = [ - "ServiceListResponse", - "Metadata", - "MetadataCreator", - "MetadataTriggeredBy", - "MetadataTriggeredByManual", - "MetadataTriggeredByPostDevcontainerStart", - "MetadataTriggeredByPostEnvironmentStart", - "Spec", - "SpecCommands", - "SpecRunsOn", - "SpecRunsOnDocker", - "Status", -] - - -class MetadataCreator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class MetadataTriggeredByManual(BaseModel): - manual: bool - - -class MetadataTriggeredByPostDevcontainerStart(BaseModel): - post_devcontainer_start: bool = FieldInfo(alias="postDevcontainerStart") - - -class MetadataTriggeredByPostEnvironmentStart(BaseModel): - post_environment_start: bool = FieldInfo(alias="postEnvironmentStart") - - -MetadataTriggeredBy: TypeAlias = Union[ - MetadataTriggeredByManual, MetadataTriggeredByPostDevcontainerStart, MetadataTriggeredByPostEnvironmentStart -] - - -class Metadata(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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - creator: Optional[MetadataCreator] = None - """creator describes the principal who created the service.""" - - description: Optional[str] = None - """description is a user-facing description for the service. - - It can be used to provide context and documentation for the service. - """ - - name: Optional[str] = None - """name is a user-facing name for the service. - - Unlike the reference, this field is not unique, and not referenced by the - system. This is a short descriptive name for the service. - """ - - reference: Optional[str] = None - """ - reference is a user-facing identifier for the service which must be unique on - the environment. It is used to express dependencies between services, and to - identify the service in user interactions (e.g. the CLI). - """ - - triggered_by: Optional[List[MetadataTriggeredBy]] = FieldInfo(alias="triggeredBy", default=None) - """triggered_by is a list of trigger that start the service.""" - - -class SpecCommands(BaseModel): - ready: Optional[str] = None - """ - ready is an optional command that is run repeatedly until it exits with a zero - exit code. If set, the service will first go into a Starting phase, and then - into a Running phase once the ready command exits with a zero exit code. - """ - - start: Optional[str] = None - """ - start is the command to start and run the service. If start exits, the service - will transition to the following phase: - - - Stopped: if the exit code is 0 - - Failed: if the exit code is not 0 If the stop command is not set, the start - command will receive a SIGTERM signal when the service is requested to stop. - If it does not exit within 2 minutes, it will receive a SIGKILL signal. - """ - - stop: Optional[str] = None - """ - stop is an optional command that runs when the service is requested to stop. If - set, instead of sending a SIGTERM signal to the start command, the stop command - will be run. Once the stop command exits, the start command will receive a - SIGKILL signal. If the stop command exits with a non-zero exit code, the service - will transition to the Failed phase. If the stop command does not exit within 2 - minutes, a SIGKILL signal will be sent to both the start and stop commands. - """ - - -class SpecRunsOnDocker(BaseModel): - environment: Optional[List[str]] = None - - image: Optional[str] = None - - -class SpecRunsOn(BaseModel): - docker: SpecRunsOnDocker - - -class Spec(BaseModel): - commands: Optional[SpecCommands] = None - """ - commands contains the commands to start, stop and check the readiness of the - service - """ - - desired_phase: Optional[ - Literal[ - "SERVICE_PHASE_UNSPECIFIED", - "SERVICE_PHASE_STARTING", - "SERVICE_PHASE_RUNNING", - "SERVICE_PHASE_STOPPING", - "SERVICE_PHASE_STOPPED", - "SERVICE_PHASE_FAILED", - "SERVICE_PHASE_DELETED", - ] - ] = FieldInfo(alias="desiredPhase", default=None) - """desired_phase is the phase the service should be in. - - Used to start or stop the service. - """ - - runs_on: Optional[SpecRunsOn] = FieldInfo(alias="runsOn", default=None) - """runs_on specifies the environment the service should run on.""" - - session: Optional[str] = None - """session should be changed to trigger a restart of the service. - - If a service exits it will not be restarted until the session is changed. - """ - - spec_version: Optional[str] = FieldInfo(alias="specVersion", default=None) - """version of the spec. - - The value of this field has no semantic meaning (e.g. don't interpret it as as a - timestamp), but it can be used to impose a partial order. If a.spec_version < - b.spec_version then a was the spec before b. - """ - - -class Status(BaseModel): - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message summarises why the service failed to operate. - - If this is non-empty the service has failed to operate and will likely - transition to a failed state. - """ - - log_url: Optional[str] = FieldInfo(alias="logUrl", default=None) - """log_url contains the URL at which the service logs can be accessed.""" - - phase: Optional[ - Literal[ - "SERVICE_PHASE_UNSPECIFIED", - "SERVICE_PHASE_STARTING", - "SERVICE_PHASE_RUNNING", - "SERVICE_PHASE_STOPPING", - "SERVICE_PHASE_STOPPED", - "SERVICE_PHASE_FAILED", - "SERVICE_PHASE_DELETED", - ] - ] = None - """phase is the current phase of the service.""" - - session: Optional[str] = None - """session is the current session of the service.""" - - status_version: Optional[str] = FieldInfo(alias="statusVersion", default=None) - """version of the status update. - - Service instances themselves are unversioned, but their status has different - versions. The value of this field has no semantic meaning (e.g. don't interpret - it as as a timestamp), but it can be used to impose a partial order. If - a.status_version < b.status_version then a was the status before b. - """ - - -class ServiceListResponse(BaseModel): - id: Optional[str] = None - - environment_id: Optional[str] = FieldInfo(alias="environmentId", default=None) - - metadata: Optional[Metadata] = None - - spec: Optional[Spec] = None - - status: Optional[Status] = None diff --git a/src/gitpod/types/environments/automations/service_metadata.py b/src/gitpod/types/environments/automations/service_metadata.py new file mode 100644 index 0000000..b21e2c6 --- /dev/null +++ b/src/gitpod/types/environments/automations/service_metadata.py @@ -0,0 +1,132 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel +from ...shared.subject import Subject +from ...shared.automation_trigger import AutomationTrigger + +__all__ = ["ServiceMetadata"] + + +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()`]() + to obtain a formatter capable of generating timestamps in this format. + """ + + creator: Optional[Subject] = None + """creator describes the principal who created the service.""" + + description: Optional[str] = None + """description is a user-facing description for the service. + + It can be used to provide context and documentation for the service. + """ + + name: Optional[str] = None + """name is a user-facing name for the service. + + Unlike the reference, this field is not unique, and not referenced by the + system. This is a short descriptive name for the service. + """ + + reference: Optional[str] = None + """ + reference is a user-facing identifier for the service which must be unique on + the environment. It is used to express dependencies between services, and to + identify the service in user interactions (e.g. the CLI). + """ + + triggered_by: Optional[List[AutomationTrigger]] = FieldInfo(alias="triggeredBy", default=None) + """triggered_by is a list of trigger that start the service.""" diff --git a/src/gitpod/types/environments/automations/service_metadata_param.py b/src/gitpod/types/environments/automations/service_metadata_param.py new file mode 100644 index 0000000..8599c69 --- /dev/null +++ b/src/gitpod/types/environments/automations/service_metadata_param.py @@ -0,0 +1,133 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from datetime import datetime +from typing_extensions import Annotated, TypedDict + +from ...._utils import PropertyInfo +from ...shared_params.subject import Subject +from ...shared_params.automation_trigger import AutomationTrigger + +__all__ = ["ServiceMetadataParam"] + + +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()`]() + to obtain a formatter capable of generating timestamps in this format. + """ + + creator: Subject + """creator describes the principal who created the service.""" + + description: str + """description is a user-facing description for the service. + + It can be used to provide context and documentation for the service. + """ + + name: str + """name is a user-facing name for the service. + + Unlike the reference, this field is not unique, and not referenced by the + system. This is a short descriptive name for the service. + """ + + reference: str + """ + reference is a user-facing identifier for the service which must be unique on + the environment. It is used to express dependencies between services, and to + identify the service in user interactions (e.g. the CLI). + """ + + triggered_by: Annotated[Iterable[AutomationTrigger], PropertyInfo(alias="triggeredBy")] + """triggered_by is a list of trigger that start the service.""" diff --git a/src/gitpod/types/environments/automations/service_phase.py b/src/gitpod/types/environments/automations/service_phase.py new file mode 100644 index 0000000..df4c820 --- /dev/null +++ b/src/gitpod/types/environments/automations/service_phase.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["ServicePhase"] + +ServicePhase: TypeAlias = Literal[ + "SERVICE_PHASE_UNSPECIFIED", + "SERVICE_PHASE_STARTING", + "SERVICE_PHASE_RUNNING", + "SERVICE_PHASE_STOPPING", + "SERVICE_PHASE_STOPPED", + "SERVICE_PHASE_FAILED", + "SERVICE_PHASE_DELETED", +] diff --git a/src/gitpod/types/environments/automations/service_retrieve_response.py b/src/gitpod/types/environments/automations/service_retrieve_response.py index 6a83eb9..e916c00 100644 --- a/src/gitpod/types/environments/automations/service_retrieve_response.py +++ b/src/gitpod/types/environments/automations/service_retrieve_response.py @@ -1,314 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias - -from pydantic import Field as FieldInfo +from typing import Optional +from .service import Service from ...._models import BaseModel -__all__ = [ - "ServiceRetrieveResponse", - "Service", - "ServiceMetadata", - "ServiceMetadataCreator", - "ServiceMetadataTriggeredBy", - "ServiceMetadataTriggeredByManual", - "ServiceMetadataTriggeredByPostDevcontainerStart", - "ServiceMetadataTriggeredByPostEnvironmentStart", - "ServiceSpec", - "ServiceSpecCommands", - "ServiceSpecRunsOn", - "ServiceSpecRunsOnDocker", - "ServiceStatus", -] - - -class ServiceMetadataCreator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class ServiceMetadataTriggeredByManual(BaseModel): - manual: bool - - -class ServiceMetadataTriggeredByPostDevcontainerStart(BaseModel): - post_devcontainer_start: bool = FieldInfo(alias="postDevcontainerStart") - - -class ServiceMetadataTriggeredByPostEnvironmentStart(BaseModel): - post_environment_start: bool = FieldInfo(alias="postEnvironmentStart") - - -ServiceMetadataTriggeredBy: TypeAlias = Union[ - ServiceMetadataTriggeredByManual, - ServiceMetadataTriggeredByPostDevcontainerStart, - ServiceMetadataTriggeredByPostEnvironmentStart, -] - - -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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - creator: Optional[ServiceMetadataCreator] = None - """creator describes the principal who created the service.""" - - description: Optional[str] = None - """description is a user-facing description for the service. - - It can be used to provide context and documentation for the service. - """ - - name: Optional[str] = None - """name is a user-facing name for the service. - - Unlike the reference, this field is not unique, and not referenced by the - system. This is a short descriptive name for the service. - """ - - reference: Optional[str] = None - """ - reference is a user-facing identifier for the service which must be unique on - the environment. It is used to express dependencies between services, and to - identify the service in user interactions (e.g. the CLI). - """ - - triggered_by: Optional[List[ServiceMetadataTriggeredBy]] = FieldInfo(alias="triggeredBy", default=None) - """triggered_by is a list of trigger that start the service.""" - - -class ServiceSpecCommands(BaseModel): - ready: Optional[str] = None - """ - ready is an optional command that is run repeatedly until it exits with a zero - exit code. If set, the service will first go into a Starting phase, and then - into a Running phase once the ready command exits with a zero exit code. - """ - - start: Optional[str] = None - """ - start is the command to start and run the service. If start exits, the service - will transition to the following phase: - - - Stopped: if the exit code is 0 - - Failed: if the exit code is not 0 If the stop command is not set, the start - command will receive a SIGTERM signal when the service is requested to stop. - If it does not exit within 2 minutes, it will receive a SIGKILL signal. - """ - - stop: Optional[str] = None - """ - stop is an optional command that runs when the service is requested to stop. If - set, instead of sending a SIGTERM signal to the start command, the stop command - will be run. Once the stop command exits, the start command will receive a - SIGKILL signal. If the stop command exits with a non-zero exit code, the service - will transition to the Failed phase. If the stop command does not exit within 2 - minutes, a SIGKILL signal will be sent to both the start and stop commands. - """ - - -class ServiceSpecRunsOnDocker(BaseModel): - environment: Optional[List[str]] = None - - image: Optional[str] = None - - -class ServiceSpecRunsOn(BaseModel): - docker: ServiceSpecRunsOnDocker - - -class ServiceSpec(BaseModel): - commands: Optional[ServiceSpecCommands] = None - """ - commands contains the commands to start, stop and check the readiness of the - service - """ - - desired_phase: Optional[ - Literal[ - "SERVICE_PHASE_UNSPECIFIED", - "SERVICE_PHASE_STARTING", - "SERVICE_PHASE_RUNNING", - "SERVICE_PHASE_STOPPING", - "SERVICE_PHASE_STOPPED", - "SERVICE_PHASE_FAILED", - "SERVICE_PHASE_DELETED", - ] - ] = FieldInfo(alias="desiredPhase", default=None) - """desired_phase is the phase the service should be in. - - Used to start or stop the service. - """ - - runs_on: Optional[ServiceSpecRunsOn] = FieldInfo(alias="runsOn", default=None) - """runs_on specifies the environment the service should run on.""" - - session: Optional[str] = None - """session should be changed to trigger a restart of the service. - - If a service exits it will not be restarted until the session is changed. - """ - - spec_version: Optional[str] = FieldInfo(alias="specVersion", default=None) - """version of the spec. - - The value of this field has no semantic meaning (e.g. don't interpret it as as a - timestamp), but it can be used to impose a partial order. If a.spec_version < - b.spec_version then a was the spec before b. - """ - - -class ServiceStatus(BaseModel): - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message summarises why the service failed to operate. - - If this is non-empty the service has failed to operate and will likely - transition to a failed state. - """ - - log_url: Optional[str] = FieldInfo(alias="logUrl", default=None) - """log_url contains the URL at which the service logs can be accessed.""" - - phase: Optional[ - Literal[ - "SERVICE_PHASE_UNSPECIFIED", - "SERVICE_PHASE_STARTING", - "SERVICE_PHASE_RUNNING", - "SERVICE_PHASE_STOPPING", - "SERVICE_PHASE_STOPPED", - "SERVICE_PHASE_FAILED", - "SERVICE_PHASE_DELETED", - ] - ] = None - """phase is the current phase of the service.""" - - session: Optional[str] = None - """session is the current session of the service.""" - - status_version: Optional[str] = FieldInfo(alias="statusVersion", default=None) - """version of the status update. - - Service instances themselves are unversioned, but their status has different - versions. The value of this field has no semantic meaning (e.g. don't interpret - it as as a timestamp), but it can be used to impose a partial order. If - a.status_version < b.status_version then a was the status before b. - """ - - -class Service(BaseModel): - id: Optional[str] = None - - environment_id: Optional[str] = FieldInfo(alias="environmentId", default=None) - - metadata: Optional[ServiceMetadata] = None - - spec: Optional[ServiceSpec] = None - - status: Optional[ServiceStatus] = None +__all__ = ["ServiceRetrieveResponse"] class ServiceRetrieveResponse(BaseModel): diff --git a/src/gitpod/types/environments/automations/service_spec.py b/src/gitpod/types/environments/automations/service_spec.py new file mode 100644 index 0000000..7e160fe --- /dev/null +++ b/src/gitpod/types/environments/automations/service_spec.py @@ -0,0 +1,72 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel +from .service_phase import ServicePhase +from ...shared.runs_on import RunsOn + +__all__ = ["ServiceSpec", "Commands"] + + +class Commands(BaseModel): + ready: Optional[str] = None + """ + ready is an optional command that is run repeatedly until it exits with a zero + exit code. If set, the service will first go into a Starting phase, and then + into a Running phase once the ready command exits with a zero exit code. + """ + + start: Optional[str] = None + """ + start is the command to start and run the service. If start exits, the service + will transition to the following phase: + + - Stopped: if the exit code is 0 + - Failed: if the exit code is not 0 If the stop command is not set, the start + command will receive a SIGTERM signal when the service is requested to stop. + If it does not exit within 2 minutes, it will receive a SIGKILL signal. + """ + + stop: Optional[str] = None + """ + stop is an optional command that runs when the service is requested to stop. If + set, instead of sending a SIGTERM signal to the start command, the stop command + will be run. Once the stop command exits, the start command will receive a + SIGKILL signal. If the stop command exits with a non-zero exit code, the service + will transition to the Failed phase. If the stop command does not exit within 2 + minutes, a SIGKILL signal will be sent to both the start and stop commands. + """ + + +class ServiceSpec(BaseModel): + commands: Optional[Commands] = None + """ + commands contains the commands to start, stop and check the readiness of the + service + """ + + desired_phase: Optional[ServicePhase] = FieldInfo(alias="desiredPhase", default=None) + """desired_phase is the phase the service should be in. + + Used to start or stop the service. + """ + + runs_on: Optional[RunsOn] = FieldInfo(alias="runsOn", default=None) + """runs_on specifies the environment the service should run on.""" + + session: Optional[str] = None + """session should be changed to trigger a restart of the service. + + If a service exits it will not be restarted until the session is changed. + """ + + spec_version: Optional[str] = FieldInfo(alias="specVersion", default=None) + """version of the spec. + + The value of this field has no semantic meaning (e.g. don't interpret it as as a + timestamp), but it can be used to impose a partial order. If a.spec_version < + b.spec_version then a was the spec before b. + """ diff --git a/src/gitpod/types/environments/automations/service_spec_param.py b/src/gitpod/types/environments/automations/service_spec_param.py new file mode 100644 index 0000000..469be0e --- /dev/null +++ b/src/gitpod/types/environments/automations/service_spec_param.py @@ -0,0 +1,72 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Annotated, TypedDict + +from ...._utils import PropertyInfo +from .service_phase import ServicePhase +from ...shared_params.runs_on import RunsOn + +__all__ = ["ServiceSpecParam", "Commands"] + + +class Commands(TypedDict, total=False): + ready: str + """ + ready is an optional command that is run repeatedly until it exits with a zero + exit code. If set, the service will first go into a Starting phase, and then + into a Running phase once the ready command exits with a zero exit code. + """ + + start: str + """ + start is the command to start and run the service. If start exits, the service + will transition to the following phase: + + - Stopped: if the exit code is 0 + - Failed: if the exit code is not 0 If the stop command is not set, the start + command will receive a SIGTERM signal when the service is requested to stop. + If it does not exit within 2 minutes, it will receive a SIGKILL signal. + """ + + stop: str + """ + stop is an optional command that runs when the service is requested to stop. If + set, instead of sending a SIGTERM signal to the start command, the stop command + will be run. Once the stop command exits, the start command will receive a + SIGKILL signal. If the stop command exits with a non-zero exit code, the service + will transition to the Failed phase. If the stop command does not exit within 2 + minutes, a SIGKILL signal will be sent to both the start and stop commands. + """ + + +class ServiceSpecParam(TypedDict, total=False): + commands: Commands + """ + commands contains the commands to start, stop and check the readiness of the + service + """ + + desired_phase: Annotated[ServicePhase, PropertyInfo(alias="desiredPhase")] + """desired_phase is the phase the service should be in. + + Used to start or stop the service. + """ + + runs_on: Annotated[RunsOn, PropertyInfo(alias="runsOn")] + """runs_on specifies the environment the service should run on.""" + + session: str + """session should be changed to trigger a restart of the service. + + If a service exits it will not be restarted until the session is changed. + """ + + spec_version: Annotated[str, PropertyInfo(alias="specVersion")] + """version of the spec. + + The value of this field has no semantic meaning (e.g. don't interpret it as as a + timestamp), but it can be used to impose a partial order. If a.spec_version < + b.spec_version then a was the spec before b. + """ diff --git a/src/gitpod/types/environments/automations/service_status.py b/src/gitpod/types/environments/automations/service_status.py new file mode 100644 index 0000000..cfda3ec --- /dev/null +++ b/src/gitpod/types/environments/automations/service_status.py @@ -0,0 +1,37 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel +from .service_phase import ServicePhase + +__all__ = ["ServiceStatus"] + + +class ServiceStatus(BaseModel): + failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) + """failure_message summarises why the service failed to operate. + + If this is non-empty the service has failed to operate and will likely + transition to a failed state. + """ + + log_url: Optional[str] = FieldInfo(alias="logUrl", default=None) + """log_url contains the URL at which the service logs can be accessed.""" + + phase: Optional[ServicePhase] = None + """phase is the current phase of the service.""" + + session: Optional[str] = None + """session is the current session of the service.""" + + status_version: Optional[str] = FieldInfo(alias="statusVersion", default=None) + """version of the status update. + + Service instances themselves are unversioned, but their status has different + versions. The value of this field has no semantic meaning (e.g. don't interpret + it as as a timestamp), but it can be used to impose a partial order. If + a.status_version < b.status_version then a was the status before b. + """ diff --git a/src/gitpod/types/environments/automations/service_update_params.py b/src/gitpod/types/environments/automations/service_update_params.py index d45d4ce..80a22fb 100644 --- a/src/gitpod/types/environments/automations/service_update_params.py +++ b/src/gitpod/types/environments/automations/service_update_params.py @@ -2,37 +2,15 @@ from __future__ import annotations -from typing import List, Union, Iterable -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing import Iterable, Optional +from typing_extensions import Annotated, TypedDict from ...._utils import PropertyInfo +from .service_phase import ServicePhase +from ...shared_params.runs_on import RunsOn +from ...shared_params.automation_trigger import AutomationTrigger -__all__ = [ - "ServiceUpdateParams", - "Metadata", - "MetadataDescription", - "MetadataName", - "MetadataTriggeredBy", - "MetadataTriggeredByTriggeredBy", - "MetadataTriggeredByTriggeredByTrigger", - "MetadataTriggeredByTriggeredByTriggerManual", - "MetadataTriggeredByTriggeredByTriggerPostDevcontainerStart", - "MetadataTriggeredByTriggeredByTriggerPostEnvironmentStart", - "Spec", - "SpecCommands", - "SpecCommandsCommands", - "SpecCommandsCommandsReady", - "SpecCommandsCommandsStart", - "SpecCommandsCommandsStop", - "SpecRunsOn", - "SpecRunsOnRunsOn", - "SpecRunsOnRunsOnDocker", - "Status", - "StatusFailureMessage", - "StatusLogURL", - "StatusPhase", - "StatusSession", -] +__all__ = ["ServiceUpdateParams", "Metadata", "MetadataTriggeredBy", "Spec", "SpecCommands", "Status"] class ServiceUpdateParams(TypedDict, total=False): @@ -55,104 +33,37 @@ class ServiceUpdateParams(TypedDict, total=False): """ -class MetadataDescription(TypedDict, total=False): - description: Required[str] - - -class MetadataName(TypedDict, total=False): - name: Required[str] - - -class MetadataTriggeredByTriggeredByTriggerManual(TypedDict, total=False): - manual: Required[bool] - - -class MetadataTriggeredByTriggeredByTriggerPostDevcontainerStart(TypedDict, total=False): - post_devcontainer_start: Required[Annotated[bool, PropertyInfo(alias="postDevcontainerStart")]] - - -class MetadataTriggeredByTriggeredByTriggerPostEnvironmentStart(TypedDict, total=False): - post_environment_start: Required[Annotated[bool, PropertyInfo(alias="postEnvironmentStart")]] - - -MetadataTriggeredByTriggeredByTrigger: TypeAlias = Union[ - MetadataTriggeredByTriggeredByTriggerManual, - MetadataTriggeredByTriggeredByTriggerPostDevcontainerStart, - MetadataTriggeredByTriggeredByTriggerPostEnvironmentStart, -] - - -class MetadataTriggeredByTriggeredBy(TypedDict, total=False): - trigger: Iterable[MetadataTriggeredByTriggeredByTrigger] - - class MetadataTriggeredBy(TypedDict, total=False): - triggered_by: Required[Annotated[MetadataTriggeredByTriggeredBy, PropertyInfo(alias="triggeredBy")]] - + trigger: Iterable[AutomationTrigger] -Metadata: TypeAlias = Union[MetadataDescription, MetadataName, MetadataTriggeredBy] +class Metadata(TypedDict, total=False): + description: Optional[str] -class SpecCommandsCommandsReady(TypedDict, total=False): - ready: Required[str] + name: Optional[str] - -class SpecCommandsCommandsStart(TypedDict, total=False): - start: Required[str] - - -class SpecCommandsCommandsStop(TypedDict, total=False): - stop: Required[str] - - -SpecCommandsCommands: TypeAlias = Union[SpecCommandsCommandsReady, SpecCommandsCommandsStart, SpecCommandsCommandsStop] + triggered_by: Annotated[Optional[MetadataTriggeredBy], PropertyInfo(alias="triggeredBy")] class SpecCommands(TypedDict, total=False): - commands: Required[SpecCommandsCommands] - - -class SpecRunsOnRunsOnDocker(TypedDict, total=False): - environment: List[str] - - image: str - - -class SpecRunsOnRunsOn(TypedDict, total=False): - docker: Required[SpecRunsOnRunsOnDocker] - - -class SpecRunsOn(TypedDict, total=False): - runs_on: Required[Annotated[SpecRunsOnRunsOn, PropertyInfo(alias="runsOn")]] - - -Spec: TypeAlias = Union[SpecCommands, SpecRunsOn] + ready: Optional[str] + start: Optional[str] -class StatusFailureMessage(TypedDict, total=False): - failure_message: Required[Annotated[str, PropertyInfo(alias="failureMessage")]] + stop: Optional[str] -class StatusLogURL(TypedDict, total=False): - log_url: Required[Annotated[str, PropertyInfo(alias="logUrl")]] +class Spec(TypedDict, total=False): + commands: Optional[SpecCommands] + runs_on: Annotated[Optional[RunsOn], PropertyInfo(alias="runsOn")] -class StatusPhase(TypedDict, total=False): - phase: Required[ - Literal[ - "SERVICE_PHASE_UNSPECIFIED", - "SERVICE_PHASE_STARTING", - "SERVICE_PHASE_RUNNING", - "SERVICE_PHASE_STOPPING", - "SERVICE_PHASE_STOPPED", - "SERVICE_PHASE_FAILED", - "SERVICE_PHASE_DELETED", - ] - ] +class Status(TypedDict, total=False): + failure_message: Annotated[Optional[str], PropertyInfo(alias="failureMessage")] -class StatusSession(TypedDict, total=False): - session: Required[str] + log_url: Annotated[Optional[str], PropertyInfo(alias="logUrl")] + phase: Optional[ServicePhase] -Status: TypeAlias = Union[StatusFailureMessage, StatusLogURL, StatusPhase, StatusSession] + session: Optional[str] diff --git a/src/gitpod/types/environments/automations/task.py b/src/gitpod/types/environments/automations/task.py new file mode 100644 index 0000000..01d91d1 --- /dev/null +++ b/src/gitpod/types/environments/automations/task.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from .task_spec import TaskSpec +from ...._models import BaseModel +from .task_metadata import TaskMetadata + +__all__ = ["Task"] + + +class Task(BaseModel): + id: Optional[str] = None + + depends_on: Optional[List[str]] = FieldInfo(alias="dependsOn", default=None) + """dependencies specifies the IDs of the automations this task depends on.""" + + environment_id: Optional[str] = FieldInfo(alias="environmentId", default=None) + + metadata: Optional[TaskMetadata] = None + + spec: Optional[TaskSpec] = None diff --git a/src/gitpod/types/environments/automations/task_create_params.py b/src/gitpod/types/environments/automations/task_create_params.py index f745490..331519b 100644 --- a/src/gitpod/types/environments/automations/task_create_params.py +++ b/src/gitpod/types/environments/automations/task_create_params.py @@ -2,24 +2,14 @@ from __future__ import annotations -from typing import List, Union, Iterable -from datetime import datetime -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing import List +from typing_extensions import Annotated, TypedDict from ...._utils import PropertyInfo +from .task_spec_param import TaskSpecParam +from .task_metadata_param import TaskMetadataParam -__all__ = [ - "TaskCreateParams", - "Metadata", - "MetadataCreator", - "MetadataTriggeredBy", - "MetadataTriggeredByManual", - "MetadataTriggeredByPostDevcontainerStart", - "MetadataTriggeredByPostEnvironmentStart", - "Spec", - "SpecRunsOn", - "SpecRunsOnDocker", -] +__all__ = ["TaskCreateParams"] class TaskCreateParams(TypedDict, total=False): @@ -27,176 +17,6 @@ class TaskCreateParams(TypedDict, total=False): environment_id: Annotated[str, PropertyInfo(alias="environmentId")] - metadata: Metadata + metadata: TaskMetadataParam - spec: Spec - - -class MetadataCreator(TypedDict, total=False): - id: str - """id is the UUID of the subject""" - - principal: Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - """Principal is the principal of the subject""" - - -class MetadataTriggeredByManual(TypedDict, total=False): - manual: Required[bool] - - -class MetadataTriggeredByPostDevcontainerStart(TypedDict, total=False): - post_devcontainer_start: Required[Annotated[bool, PropertyInfo(alias="postDevcontainerStart")]] - - -class MetadataTriggeredByPostEnvironmentStart(TypedDict, total=False): - post_environment_start: Required[Annotated[bool, PropertyInfo(alias="postEnvironmentStart")]] - - -MetadataTriggeredBy: TypeAlias = Union[ - MetadataTriggeredByManual, MetadataTriggeredByPostDevcontainerStart, MetadataTriggeredByPostEnvironmentStart -] - - -class Metadata(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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - creator: MetadataCreator - """creator describes the principal who created the task.""" - - description: str - """description is a user-facing description for the task. - - It can be used to provide context and documentation for the task. - """ - - name: str - """name is a user-facing name for the task. - - Unlike the reference, this field is not unique, and not referenced by the - system. This is a short descriptive name for the task. - """ - - reference: str - """ - reference is a user-facing identifier for the task which must be unique on the - environment. It is used to express dependencies between tasks, and to identify - the task in user interactions (e.g. the CLI). - """ - - triggered_by: Annotated[Iterable[MetadataTriggeredBy], PropertyInfo(alias="triggeredBy")] - """triggered_by is a list of trigger that start the task.""" - - -class SpecRunsOnDocker(TypedDict, total=False): - environment: List[str] - - image: str - - -class SpecRunsOn(TypedDict, total=False): - docker: Required[SpecRunsOnDocker] - - -class Spec(TypedDict, total=False): - command: str - """command contains the command the task should execute""" - - runs_on: Annotated[SpecRunsOn, PropertyInfo(alias="runsOn")] - """runs_on specifies the environment the task should run on.""" + spec: TaskSpecParam diff --git a/src/gitpod/types/environments/automations/task_create_response.py b/src/gitpod/types/environments/automations/task_create_response.py index 22c1db5..511677b 100644 --- a/src/gitpod/types/environments/automations/task_create_response.py +++ b/src/gitpod/types/environments/automations/task_create_response.py @@ -1,213 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias - -from pydantic import Field as FieldInfo +from typing import Optional +from .task import Task from ...._models import BaseModel -__all__ = [ - "TaskCreateResponse", - "Task", - "TaskMetadata", - "TaskMetadataCreator", - "TaskMetadataTriggeredBy", - "TaskMetadataTriggeredByManual", - "TaskMetadataTriggeredByPostDevcontainerStart", - "TaskMetadataTriggeredByPostEnvironmentStart", - "TaskSpec", - "TaskSpecRunsOn", - "TaskSpecRunsOnDocker", -] - - -class TaskMetadataCreator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class TaskMetadataTriggeredByManual(BaseModel): - manual: bool - - -class TaskMetadataTriggeredByPostDevcontainerStart(BaseModel): - post_devcontainer_start: bool = FieldInfo(alias="postDevcontainerStart") - - -class TaskMetadataTriggeredByPostEnvironmentStart(BaseModel): - post_environment_start: bool = FieldInfo(alias="postEnvironmentStart") - - -TaskMetadataTriggeredBy: TypeAlias = Union[ - TaskMetadataTriggeredByManual, - TaskMetadataTriggeredByPostDevcontainerStart, - TaskMetadataTriggeredByPostEnvironmentStart, -] - - -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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - creator: Optional[TaskMetadataCreator] = None - """creator describes the principal who created the task.""" - - description: Optional[str] = None - """description is a user-facing description for the task. - - It can be used to provide context and documentation for the task. - """ - - name: Optional[str] = None - """name is a user-facing name for the task. - - Unlike the reference, this field is not unique, and not referenced by the - system. This is a short descriptive name for the task. - """ - - reference: Optional[str] = None - """ - reference is a user-facing identifier for the task which must be unique on the - environment. It is used to express dependencies between tasks, and to identify - the task in user interactions (e.g. the CLI). - """ - - triggered_by: Optional[List[TaskMetadataTriggeredBy]] = FieldInfo(alias="triggeredBy", default=None) - """triggered_by is a list of trigger that start the task.""" - - -class TaskSpecRunsOnDocker(BaseModel): - environment: Optional[List[str]] = None - - image: Optional[str] = None - - -class TaskSpecRunsOn(BaseModel): - docker: TaskSpecRunsOnDocker - - -class TaskSpec(BaseModel): - command: Optional[str] = None - """command contains the command the task should execute""" - - runs_on: Optional[TaskSpecRunsOn] = FieldInfo(alias="runsOn", default=None) - """runs_on specifies the environment the task should run on.""" - - -class Task(BaseModel): - id: Optional[str] = None - - depends_on: Optional[List[str]] = FieldInfo(alias="dependsOn", default=None) - """dependencies specifies the IDs of the automations this task depends on.""" - - environment_id: Optional[str] = FieldInfo(alias="environmentId", default=None) - - metadata: Optional[TaskMetadata] = None - - spec: Optional[TaskSpec] = None +__all__ = ["TaskCreateResponse"] class TaskCreateResponse(BaseModel): diff --git a/src/gitpod/types/environments/automations/task_list_response.py b/src/gitpod/types/environments/automations/task_metadata.py similarity index 68% rename from src/gitpod/types/environments/automations/task_list_response.py rename to src/gitpod/types/environments/automations/task_metadata.py index cd4131a..f99f98e 100644 --- a/src/gitpod/types/environments/automations/task_list_response.py +++ b/src/gitpod/types/environments/automations/task_metadata.py @@ -1,62 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import List, Optional from datetime import datetime -from typing_extensions import Literal, TypeAlias from pydantic import Field as FieldInfo from ...._models import BaseModel +from ...shared.subject import Subject +from ...shared.automation_trigger import AutomationTrigger -__all__ = [ - "TaskListResponse", - "Metadata", - "MetadataCreator", - "MetadataTriggeredBy", - "MetadataTriggeredByManual", - "MetadataTriggeredByPostDevcontainerStart", - "MetadataTriggeredByPostEnvironmentStart", - "Spec", - "SpecRunsOn", - "SpecRunsOnDocker", -] +__all__ = ["TaskMetadata"] -class MetadataCreator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class MetadataTriggeredByManual(BaseModel): - manual: bool - - -class MetadataTriggeredByPostDevcontainerStart(BaseModel): - post_devcontainer_start: bool = FieldInfo(alias="postDevcontainerStart") - - -class MetadataTriggeredByPostEnvironmentStart(BaseModel): - post_environment_start: bool = FieldInfo(alias="postEnvironmentStart") - - -MetadataTriggeredBy: TypeAlias = Union[ - MetadataTriggeredByManual, MetadataTriggeredByPostDevcontainerStart, MetadataTriggeredByPostEnvironmentStart -] - - -class Metadata(BaseModel): +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 @@ -149,7 +105,7 @@ class Metadata(BaseModel): to obtain a formatter capable of generating timestamps in this format. """ - creator: Optional[MetadataCreator] = None + creator: Optional[Subject] = None """creator describes the principal who created the task.""" description: Optional[str] = None @@ -172,36 +128,5 @@ class Metadata(BaseModel): the task in user interactions (e.g. the CLI). """ - triggered_by: Optional[List[MetadataTriggeredBy]] = FieldInfo(alias="triggeredBy", default=None) + triggered_by: Optional[List[AutomationTrigger]] = FieldInfo(alias="triggeredBy", default=None) """triggered_by is a list of trigger that start the task.""" - - -class SpecRunsOnDocker(BaseModel): - environment: Optional[List[str]] = None - - image: Optional[str] = None - - -class SpecRunsOn(BaseModel): - docker: SpecRunsOnDocker - - -class Spec(BaseModel): - command: Optional[str] = None - """command contains the command the task should execute""" - - runs_on: Optional[SpecRunsOn] = FieldInfo(alias="runsOn", default=None) - """runs_on specifies the environment the task should run on.""" - - -class TaskListResponse(BaseModel): - id: Optional[str] = None - - depends_on: Optional[List[str]] = FieldInfo(alias="dependsOn", default=None) - """dependencies specifies the IDs of the automations this task depends on.""" - - environment_id: Optional[str] = FieldInfo(alias="environmentId", default=None) - - metadata: Optional[Metadata] = None - - spec: Optional[Spec] = None diff --git a/src/gitpod/types/environments/automations/task_metadata_param.py b/src/gitpod/types/environments/automations/task_metadata_param.py new file mode 100644 index 0000000..9331c97 --- /dev/null +++ b/src/gitpod/types/environments/automations/task_metadata_param.py @@ -0,0 +1,133 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from datetime import datetime +from typing_extensions import Annotated, TypedDict + +from ...._utils import PropertyInfo +from ...shared_params.subject import Subject +from ...shared_params.automation_trigger import AutomationTrigger + +__all__ = ["TaskMetadataParam"] + + +class TaskMetadataParam(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()`]() + to obtain a formatter capable of generating timestamps in this format. + """ + + creator: Subject + """creator describes the principal who created the task.""" + + description: str + """description is a user-facing description for the task. + + It can be used to provide context and documentation for the task. + """ + + name: str + """name is a user-facing name for the task. + + Unlike the reference, this field is not unique, and not referenced by the + system. This is a short descriptive name for the task. + """ + + reference: str + """ + reference is a user-facing identifier for the task which must be unique on the + environment. It is used to express dependencies between tasks, and to identify + the task in user interactions (e.g. the CLI). + """ + + triggered_by: Annotated[Iterable[AutomationTrigger], PropertyInfo(alias="triggeredBy")] + """triggered_by is a list of trigger that start the task.""" diff --git a/src/gitpod/types/environments/automations/task_retrieve_response.py b/src/gitpod/types/environments/automations/task_retrieve_response.py index cd0c4d6..557ccce 100644 --- a/src/gitpod/types/environments/automations/task_retrieve_response.py +++ b/src/gitpod/types/environments/automations/task_retrieve_response.py @@ -1,213 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias - -from pydantic import Field as FieldInfo +from typing import Optional +from .task import Task from ...._models import BaseModel -__all__ = [ - "TaskRetrieveResponse", - "Task", - "TaskMetadata", - "TaskMetadataCreator", - "TaskMetadataTriggeredBy", - "TaskMetadataTriggeredByManual", - "TaskMetadataTriggeredByPostDevcontainerStart", - "TaskMetadataTriggeredByPostEnvironmentStart", - "TaskSpec", - "TaskSpecRunsOn", - "TaskSpecRunsOnDocker", -] - - -class TaskMetadataCreator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class TaskMetadataTriggeredByManual(BaseModel): - manual: bool - - -class TaskMetadataTriggeredByPostDevcontainerStart(BaseModel): - post_devcontainer_start: bool = FieldInfo(alias="postDevcontainerStart") - - -class TaskMetadataTriggeredByPostEnvironmentStart(BaseModel): - post_environment_start: bool = FieldInfo(alias="postEnvironmentStart") - - -TaskMetadataTriggeredBy: TypeAlias = Union[ - TaskMetadataTriggeredByManual, - TaskMetadataTriggeredByPostDevcontainerStart, - TaskMetadataTriggeredByPostEnvironmentStart, -] - - -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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - creator: Optional[TaskMetadataCreator] = None - """creator describes the principal who created the task.""" - - description: Optional[str] = None - """description is a user-facing description for the task. - - It can be used to provide context and documentation for the task. - """ - - name: Optional[str] = None - """name is a user-facing name for the task. - - Unlike the reference, this field is not unique, and not referenced by the - system. This is a short descriptive name for the task. - """ - - reference: Optional[str] = None - """ - reference is a user-facing identifier for the task which must be unique on the - environment. It is used to express dependencies between tasks, and to identify - the task in user interactions (e.g. the CLI). - """ - - triggered_by: Optional[List[TaskMetadataTriggeredBy]] = FieldInfo(alias="triggeredBy", default=None) - """triggered_by is a list of trigger that start the task.""" - - -class TaskSpecRunsOnDocker(BaseModel): - environment: Optional[List[str]] = None - - image: Optional[str] = None - - -class TaskSpecRunsOn(BaseModel): - docker: TaskSpecRunsOnDocker - - -class TaskSpec(BaseModel): - command: Optional[str] = None - """command contains the command the task should execute""" - - runs_on: Optional[TaskSpecRunsOn] = FieldInfo(alias="runsOn", default=None) - """runs_on specifies the environment the task should run on.""" - - -class Task(BaseModel): - id: Optional[str] = None - - depends_on: Optional[List[str]] = FieldInfo(alias="dependsOn", default=None) - """dependencies specifies the IDs of the automations this task depends on.""" - - environment_id: Optional[str] = FieldInfo(alias="environmentId", default=None) - - metadata: Optional[TaskMetadata] = None - - spec: Optional[TaskSpec] = None +__all__ = ["TaskRetrieveResponse"] class TaskRetrieveResponse(BaseModel): diff --git a/src/gitpod/types/environments/automations/task_spec.py b/src/gitpod/types/environments/automations/task_spec.py new file mode 100644 index 0000000..3d1d0f1 --- /dev/null +++ b/src/gitpod/types/environments/automations/task_spec.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel +from ...shared.runs_on import RunsOn + +__all__ = ["TaskSpec"] + + +class TaskSpec(BaseModel): + command: Optional[str] = None + """command contains the command the task should execute""" + + runs_on: Optional[RunsOn] = FieldInfo(alias="runsOn", default=None) + """runs_on specifies the environment the task should run on.""" diff --git a/src/gitpod/types/environments/automations/task_spec_param.py b/src/gitpod/types/environments/automations/task_spec_param.py new file mode 100644 index 0000000..bf0c629 --- /dev/null +++ b/src/gitpod/types/environments/automations/task_spec_param.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Annotated, TypedDict + +from ...._utils import PropertyInfo +from ...shared_params.runs_on import RunsOn + +__all__ = ["TaskSpecParam"] + + +class TaskSpecParam(TypedDict, total=False): + command: str + """command contains the command the task should execute""" + + runs_on: Annotated[RunsOn, PropertyInfo(alias="runsOn")] + """runs_on specifies the environment the task should run on.""" diff --git a/src/gitpod/types/environments/automations/task_start_response.py b/src/gitpod/types/environments/automations/task_start_response.py index 9aee77c..3b7caf2 100644 --- a/src/gitpod/types/environments/automations/task_start_response.py +++ b/src/gitpod/types/environments/automations/task_start_response.py @@ -1,492 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias +from typing import Optional from pydantic import Field as FieldInfo from ...._models import BaseModel +from ...shared.task_execution import TaskExecution -__all__ = [ - "TaskStartResponse", - "TaskExecution", - "TaskExecutionMetadata", - "TaskExecutionMetadataCreator", - "TaskExecutionSpec", - "TaskExecutionSpecPlan", - "TaskExecutionSpecPlanStep", - "TaskExecutionSpecPlanStepUnionMember0", - "TaskExecutionSpecPlanStepUnionMember1", - "TaskExecutionSpecPlanStepUnionMember1Task", - "TaskExecutionSpecPlanStepUnionMember1TaskSpec", - "TaskExecutionSpecPlanStepUnionMember1TaskSpecRunsOn", - "TaskExecutionSpecPlanStepUnionMember1TaskSpecRunsOnDocker", - "TaskExecutionStatus", - "TaskExecutionStatusStep", -] - - -class TaskExecutionMetadataCreator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - creator: Optional[TaskExecutionMetadataCreator] = None - """creator describes the principal who created/started the task run.""" - - environment_id: Optional[str] = FieldInfo(alias="environmentId", default=None) - """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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - started_by: Optional[str] = FieldInfo(alias="startedBy", default=None) - """started_by describes the trigger that started the task execution.""" - - task_id: Optional[str] = FieldInfo(alias="taskId", default=None) - """task_id is the ID of the main task being executed.""" - - -class TaskExecutionSpecPlanStepUnionMember0(BaseModel): - service_id: str = FieldInfo(alias="serviceId") - - id: Optional[str] = None - """ID is the ID of the execution step""" - - depends_on: Optional[List[str]] = FieldInfo(alias="dependsOn", default=None) - - label: Optional[str] = None - - -class TaskExecutionSpecPlanStepUnionMember1TaskSpecRunsOnDocker(BaseModel): - environment: Optional[List[str]] = None - - image: Optional[str] = None - - -class TaskExecutionSpecPlanStepUnionMember1TaskSpecRunsOn(BaseModel): - docker: TaskExecutionSpecPlanStepUnionMember1TaskSpecRunsOnDocker - - -class TaskExecutionSpecPlanStepUnionMember1TaskSpec(BaseModel): - command: Optional[str] = None - """command contains the command the task should execute""" - - runs_on: Optional[TaskExecutionSpecPlanStepUnionMember1TaskSpecRunsOn] = FieldInfo(alias="runsOn", default=None) - """runs_on specifies the environment the task should run on.""" - - -class TaskExecutionSpecPlanStepUnionMember1Task(BaseModel): - id: Optional[str] = None - - spec: Optional[TaskExecutionSpecPlanStepUnionMember1TaskSpec] = None - - -class TaskExecutionSpecPlanStepUnionMember1(BaseModel): - task: TaskExecutionSpecPlanStepUnionMember1Task - - id: Optional[str] = None - """ID is the ID of the execution step""" - - depends_on: Optional[List[str]] = FieldInfo(alias="dependsOn", default=None) - - label: Optional[str] = None - - -TaskExecutionSpecPlanStep: TypeAlias = Union[ - TaskExecutionSpecPlanStepUnionMember0, TaskExecutionSpecPlanStepUnionMember1 -] - - -class TaskExecutionSpecPlan(BaseModel): - steps: Optional[List[TaskExecutionSpecPlanStep]] = None - - -class TaskExecutionSpec(BaseModel): - desired_phase: Optional[ - Literal[ - "TASK_EXECUTION_PHASE_UNSPECIFIED", - "TASK_EXECUTION_PHASE_PENDING", - "TASK_EXECUTION_PHASE_RUNNING", - "TASK_EXECUTION_PHASE_SUCCEEDED", - "TASK_EXECUTION_PHASE_FAILED", - "TASK_EXECUTION_PHASE_STOPPED", - ] - ] = FieldInfo(alias="desiredPhase", default=None) - """desired_phase is the phase the task execution should be in. - - Used to stop a running task execution early. - """ - - plan: Optional[List[TaskExecutionSpecPlan]] = None - """plan is a list of groups of steps. - - The steps in a group are executed concurrently, while the groups are executed - sequentially. The order of the groups is the order in which they are executed. - """ - - -class TaskExecutionStatusStep(BaseModel): - id: Optional[str] = None - """ID is the ID of the execution step""" - - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message summarises why the step failed to operate. - - If this is non-empty the step has failed to operate and will likely transition - to a failed state. - """ - - phase: Optional[ - Literal[ - "TASK_EXECUTION_PHASE_UNSPECIFIED", - "TASK_EXECUTION_PHASE_PENDING", - "TASK_EXECUTION_PHASE_RUNNING", - "TASK_EXECUTION_PHASE_SUCCEEDED", - "TASK_EXECUTION_PHASE_FAILED", - "TASK_EXECUTION_PHASE_STOPPED", - ] - ] = None - """phase is the current phase of the execution step""" - - -class TaskExecutionStatus(BaseModel): - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message summarises why the task execution failed to operate. - - If this is non-empty the task execution has failed to operate and will likely - transition to a failed state. - """ - - log_url: Optional[str] = FieldInfo(alias="logUrl", default=None) - """log_url is the URL to the logs of the task's steps. - - If this is empty, the task either has no logs or has not yet started. - """ - - phase: Optional[ - Literal[ - "TASK_EXECUTION_PHASE_UNSPECIFIED", - "TASK_EXECUTION_PHASE_PENDING", - "TASK_EXECUTION_PHASE_RUNNING", - "TASK_EXECUTION_PHASE_SUCCEEDED", - "TASK_EXECUTION_PHASE_FAILED", - "TASK_EXECUTION_PHASE_STOPPED", - ] - ] = None - """the phase of a task execution represents the aggregated phase of all steps.""" - - status_version: Optional[str] = FieldInfo(alias="statusVersion", default=None) - """version of the status update. - - Task executions themselves are unversioned, but their status has different - versions. The value of this field has no semantic meaning (e.g. don't interpret - it as as a timestamp), but it can be used to impose a partial order. If - a.status_version < b.status_version then a was the status before b. - """ - - steps: Optional[List[TaskExecutionStatusStep]] = None - """steps provides the status for each individual step of the task execution. - - If a step is missing it has not yet started. - """ - - -class TaskExecution(BaseModel): - id: Optional[str] = None - - metadata: Optional[TaskExecutionMetadata] = None - - spec: Optional[TaskExecutionSpec] = None - - status: Optional[TaskExecutionStatus] = None +__all__ = ["TaskStartResponse"] class TaskStartResponse(BaseModel): diff --git a/src/gitpod/types/environments/automations/task_update_params.py b/src/gitpod/types/environments/automations/task_update_params.py index 8ac5aae..4b0d59a 100644 --- a/src/gitpod/types/environments/automations/task_update_params.py +++ b/src/gitpod/types/environments/automations/task_update_params.py @@ -2,28 +2,14 @@ from __future__ import annotations -from typing import List, Union, Iterable -from typing_extensions import Required, Annotated, TypeAlias, TypedDict +from typing import List, Iterable, Optional +from typing_extensions import Annotated, TypedDict from ...._utils import PropertyInfo +from ...shared_params.runs_on import RunsOn +from ...shared_params.automation_trigger import AutomationTrigger -__all__ = [ - "TaskUpdateParams", - "Metadata", - "MetadataDescription", - "MetadataName", - "MetadataTriggeredBy", - "MetadataTriggeredByTriggeredBy", - "MetadataTriggeredByTriggeredByTrigger", - "MetadataTriggeredByTriggeredByTriggerManual", - "MetadataTriggeredByTriggeredByTriggerPostDevcontainerStart", - "MetadataTriggeredByTriggeredByTriggerPostEnvironmentStart", - "Spec", - "SpecCommand", - "SpecRunsOn", - "SpecRunsOnRunsOn", - "SpecRunsOnRunsOnDocker", -] +__all__ = ["TaskUpdateParams", "Metadata", "MetadataTriggeredBy", "Spec"] class TaskUpdateParams(TypedDict, total=False): @@ -37,60 +23,19 @@ class TaskUpdateParams(TypedDict, total=False): spec: Spec -class MetadataDescription(TypedDict, total=False): - description: Required[str] - - -class MetadataName(TypedDict, total=False): - name: Required[str] - - -class MetadataTriggeredByTriggeredByTriggerManual(TypedDict, total=False): - manual: Required[bool] - - -class MetadataTriggeredByTriggeredByTriggerPostDevcontainerStart(TypedDict, total=False): - post_devcontainer_start: Required[Annotated[bool, PropertyInfo(alias="postDevcontainerStart")]] - - -class MetadataTriggeredByTriggeredByTriggerPostEnvironmentStart(TypedDict, total=False): - post_environment_start: Required[Annotated[bool, PropertyInfo(alias="postEnvironmentStart")]] - - -MetadataTriggeredByTriggeredByTrigger: TypeAlias = Union[ - MetadataTriggeredByTriggeredByTriggerManual, - MetadataTriggeredByTriggeredByTriggerPostDevcontainerStart, - MetadataTriggeredByTriggeredByTriggerPostEnvironmentStart, -] - - -class MetadataTriggeredByTriggeredBy(TypedDict, total=False): - trigger: Iterable[MetadataTriggeredByTriggeredByTrigger] - - class MetadataTriggeredBy(TypedDict, total=False): - triggered_by: Required[Annotated[MetadataTriggeredByTriggeredBy, PropertyInfo(alias="triggeredBy")]] - - -Metadata: TypeAlias = Union[MetadataDescription, MetadataName, MetadataTriggeredBy] - - -class SpecCommand(TypedDict, total=False): - command: Required[str] - - -class SpecRunsOnRunsOnDocker(TypedDict, total=False): - environment: List[str] + trigger: Iterable[AutomationTrigger] - image: str +class Metadata(TypedDict, total=False): + description: Optional[str] -class SpecRunsOnRunsOn(TypedDict, total=False): - docker: Required[SpecRunsOnRunsOnDocker] + name: Optional[str] + triggered_by: Annotated[Optional[MetadataTriggeredBy], PropertyInfo(alias="triggeredBy")] -class SpecRunsOn(TypedDict, total=False): - runs_on: Required[Annotated[SpecRunsOnRunsOn, PropertyInfo(alias="runsOn")]] +class Spec(TypedDict, total=False): + command: Optional[str] -Spec: TypeAlias = Union[SpecCommand, SpecRunsOn] + runs_on: Annotated[Optional[RunsOn], PropertyInfo(alias="runsOn")] diff --git a/src/gitpod/types/environments/automations/tasks/__init__.py b/src/gitpod/types/environments/automations/tasks/__init__.py index fd37332..f6dd9ac 100644 --- a/src/gitpod/types/environments/automations/tasks/__init__.py +++ b/src/gitpod/types/environments/automations/tasks/__init__.py @@ -4,6 +4,5 @@ from .execution_list_params import ExecutionListParams as ExecutionListParams from .execution_stop_params import ExecutionStopParams as ExecutionStopParams -from .execution_list_response import ExecutionListResponse as ExecutionListResponse from .execution_retrieve_params import ExecutionRetrieveParams as ExecutionRetrieveParams from .execution_retrieve_response import ExecutionRetrieveResponse as ExecutionRetrieveResponse diff --git a/src/gitpod/types/environments/automations/tasks/execution_list_params.py b/src/gitpod/types/environments/automations/tasks/execution_list_params.py index 37ad255..0441fb5 100644 --- a/src/gitpod/types/environments/automations/tasks/execution_list_params.py +++ b/src/gitpod/types/environments/automations/tasks/execution_list_params.py @@ -3,9 +3,10 @@ from __future__ import annotations from typing import List -from typing_extensions import Literal, Annotated, TypedDict +from typing_extensions import Annotated, TypedDict from ....._utils import PropertyInfo +from ....shared.task_execution_phase import TaskExecutionPhase __all__ = ["ExecutionListParams", "Filter", "Pagination"] @@ -26,16 +27,7 @@ class Filter(TypedDict, total=False): environment_ids: Annotated[List[str], PropertyInfo(alias="environmentIds")] """environment_ids filters the response to only task runs of these environments""" - phases: List[ - Literal[ - "TASK_EXECUTION_PHASE_UNSPECIFIED", - "TASK_EXECUTION_PHASE_PENDING", - "TASK_EXECUTION_PHASE_RUNNING", - "TASK_EXECUTION_PHASE_SUCCEEDED", - "TASK_EXECUTION_PHASE_FAILED", - "TASK_EXECUTION_PHASE_STOPPED", - ] - ] + phases: List[TaskExecutionPhase] """phases filters the response to only task runs in these phases""" task_ids: Annotated[List[str], PropertyInfo(alias="taskIds")] diff --git a/src/gitpod/types/environments/automations/tasks/execution_list_response.py b/src/gitpod/types/environments/automations/tasks/execution_list_response.py deleted file mode 100644 index cc11074..0000000 --- a/src/gitpod/types/environments/automations/tasks/execution_list_response.py +++ /dev/null @@ -1,486 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias - -from pydantic import Field as FieldInfo - -from ....._models import BaseModel - -__all__ = [ - "ExecutionListResponse", - "Metadata", - "MetadataCreator", - "Spec", - "SpecPlan", - "SpecPlanStep", - "SpecPlanStepUnionMember0", - "SpecPlanStepUnionMember1", - "SpecPlanStepUnionMember1Task", - "SpecPlanStepUnionMember1TaskSpec", - "SpecPlanStepUnionMember1TaskSpecRunsOn", - "SpecPlanStepUnionMember1TaskSpecRunsOnDocker", - "Status", - "StatusStep", -] - - -class MetadataCreator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class Metadata(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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - creator: Optional[MetadataCreator] = None - """creator describes the principal who created/started the task run.""" - - environment_id: Optional[str] = FieldInfo(alias="environmentId", default=None) - """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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - started_by: Optional[str] = FieldInfo(alias="startedBy", default=None) - """started_by describes the trigger that started the task execution.""" - - task_id: Optional[str] = FieldInfo(alias="taskId", default=None) - """task_id is the ID of the main task being executed.""" - - -class SpecPlanStepUnionMember0(BaseModel): - service_id: str = FieldInfo(alias="serviceId") - - id: Optional[str] = None - """ID is the ID of the execution step""" - - depends_on: Optional[List[str]] = FieldInfo(alias="dependsOn", default=None) - - label: Optional[str] = None - - -class SpecPlanStepUnionMember1TaskSpecRunsOnDocker(BaseModel): - environment: Optional[List[str]] = None - - image: Optional[str] = None - - -class SpecPlanStepUnionMember1TaskSpecRunsOn(BaseModel): - docker: SpecPlanStepUnionMember1TaskSpecRunsOnDocker - - -class SpecPlanStepUnionMember1TaskSpec(BaseModel): - command: Optional[str] = None - """command contains the command the task should execute""" - - runs_on: Optional[SpecPlanStepUnionMember1TaskSpecRunsOn] = FieldInfo(alias="runsOn", default=None) - """runs_on specifies the environment the task should run on.""" - - -class SpecPlanStepUnionMember1Task(BaseModel): - id: Optional[str] = None - - spec: Optional[SpecPlanStepUnionMember1TaskSpec] = None - - -class SpecPlanStepUnionMember1(BaseModel): - task: SpecPlanStepUnionMember1Task - - id: Optional[str] = None - """ID is the ID of the execution step""" - - depends_on: Optional[List[str]] = FieldInfo(alias="dependsOn", default=None) - - label: Optional[str] = None - - -SpecPlanStep: TypeAlias = Union[SpecPlanStepUnionMember0, SpecPlanStepUnionMember1] - - -class SpecPlan(BaseModel): - steps: Optional[List[SpecPlanStep]] = None - - -class Spec(BaseModel): - desired_phase: Optional[ - Literal[ - "TASK_EXECUTION_PHASE_UNSPECIFIED", - "TASK_EXECUTION_PHASE_PENDING", - "TASK_EXECUTION_PHASE_RUNNING", - "TASK_EXECUTION_PHASE_SUCCEEDED", - "TASK_EXECUTION_PHASE_FAILED", - "TASK_EXECUTION_PHASE_STOPPED", - ] - ] = FieldInfo(alias="desiredPhase", default=None) - """desired_phase is the phase the task execution should be in. - - Used to stop a running task execution early. - """ - - plan: Optional[List[SpecPlan]] = None - """plan is a list of groups of steps. - - The steps in a group are executed concurrently, while the groups are executed - sequentially. The order of the groups is the order in which they are executed. - """ - - -class StatusStep(BaseModel): - id: Optional[str] = None - """ID is the ID of the execution step""" - - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message summarises why the step failed to operate. - - If this is non-empty the step has failed to operate and will likely transition - to a failed state. - """ - - phase: Optional[ - Literal[ - "TASK_EXECUTION_PHASE_UNSPECIFIED", - "TASK_EXECUTION_PHASE_PENDING", - "TASK_EXECUTION_PHASE_RUNNING", - "TASK_EXECUTION_PHASE_SUCCEEDED", - "TASK_EXECUTION_PHASE_FAILED", - "TASK_EXECUTION_PHASE_STOPPED", - ] - ] = None - """phase is the current phase of the execution step""" - - -class Status(BaseModel): - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message summarises why the task execution failed to operate. - - If this is non-empty the task execution has failed to operate and will likely - transition to a failed state. - """ - - log_url: Optional[str] = FieldInfo(alias="logUrl", default=None) - """log_url is the URL to the logs of the task's steps. - - If this is empty, the task either has no logs or has not yet started. - """ - - phase: Optional[ - Literal[ - "TASK_EXECUTION_PHASE_UNSPECIFIED", - "TASK_EXECUTION_PHASE_PENDING", - "TASK_EXECUTION_PHASE_RUNNING", - "TASK_EXECUTION_PHASE_SUCCEEDED", - "TASK_EXECUTION_PHASE_FAILED", - "TASK_EXECUTION_PHASE_STOPPED", - ] - ] = None - """the phase of a task execution represents the aggregated phase of all steps.""" - - status_version: Optional[str] = FieldInfo(alias="statusVersion", default=None) - """version of the status update. - - Task executions themselves are unversioned, but their status has different - versions. The value of this field has no semantic meaning (e.g. don't interpret - it as as a timestamp), but it can be used to impose a partial order. If - a.status_version < b.status_version then a was the status before b. - """ - - steps: Optional[List[StatusStep]] = None - """steps provides the status for each individual step of the task execution. - - If a step is missing it has not yet started. - """ - - -class ExecutionListResponse(BaseModel): - id: Optional[str] = None - - metadata: Optional[Metadata] = None - - spec: Optional[Spec] = None - - status: Optional[Status] = None diff --git a/src/gitpod/types/environments/automations/tasks/execution_retrieve_response.py b/src/gitpod/types/environments/automations/tasks/execution_retrieve_response.py index 99ff029..40f3dc4 100644 --- a/src/gitpod/types/environments/automations/tasks/execution_retrieve_response.py +++ b/src/gitpod/types/environments/automations/tasks/execution_retrieve_response.py @@ -1,492 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias +from typing import Optional from pydantic import Field as FieldInfo from ....._models import BaseModel +from ....shared.task_execution import TaskExecution -__all__ = [ - "ExecutionRetrieveResponse", - "TaskExecution", - "TaskExecutionMetadata", - "TaskExecutionMetadataCreator", - "TaskExecutionSpec", - "TaskExecutionSpecPlan", - "TaskExecutionSpecPlanStep", - "TaskExecutionSpecPlanStepUnionMember0", - "TaskExecutionSpecPlanStepUnionMember1", - "TaskExecutionSpecPlanStepUnionMember1Task", - "TaskExecutionSpecPlanStepUnionMember1TaskSpec", - "TaskExecutionSpecPlanStepUnionMember1TaskSpecRunsOn", - "TaskExecutionSpecPlanStepUnionMember1TaskSpecRunsOnDocker", - "TaskExecutionStatus", - "TaskExecutionStatusStep", -] - - -class TaskExecutionMetadataCreator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - creator: Optional[TaskExecutionMetadataCreator] = None - """creator describes the principal who created/started the task run.""" - - environment_id: Optional[str] = FieldInfo(alias="environmentId", default=None) - """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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - started_by: Optional[str] = FieldInfo(alias="startedBy", default=None) - """started_by describes the trigger that started the task execution.""" - - task_id: Optional[str] = FieldInfo(alias="taskId", default=None) - """task_id is the ID of the main task being executed.""" - - -class TaskExecutionSpecPlanStepUnionMember0(BaseModel): - service_id: str = FieldInfo(alias="serviceId") - - id: Optional[str] = None - """ID is the ID of the execution step""" - - depends_on: Optional[List[str]] = FieldInfo(alias="dependsOn", default=None) - - label: Optional[str] = None - - -class TaskExecutionSpecPlanStepUnionMember1TaskSpecRunsOnDocker(BaseModel): - environment: Optional[List[str]] = None - - image: Optional[str] = None - - -class TaskExecutionSpecPlanStepUnionMember1TaskSpecRunsOn(BaseModel): - docker: TaskExecutionSpecPlanStepUnionMember1TaskSpecRunsOnDocker - - -class TaskExecutionSpecPlanStepUnionMember1TaskSpec(BaseModel): - command: Optional[str] = None - """command contains the command the task should execute""" - - runs_on: Optional[TaskExecutionSpecPlanStepUnionMember1TaskSpecRunsOn] = FieldInfo(alias="runsOn", default=None) - """runs_on specifies the environment the task should run on.""" - - -class TaskExecutionSpecPlanStepUnionMember1Task(BaseModel): - id: Optional[str] = None - - spec: Optional[TaskExecutionSpecPlanStepUnionMember1TaskSpec] = None - - -class TaskExecutionSpecPlanStepUnionMember1(BaseModel): - task: TaskExecutionSpecPlanStepUnionMember1Task - - id: Optional[str] = None - """ID is the ID of the execution step""" - - depends_on: Optional[List[str]] = FieldInfo(alias="dependsOn", default=None) - - label: Optional[str] = None - - -TaskExecutionSpecPlanStep: TypeAlias = Union[ - TaskExecutionSpecPlanStepUnionMember0, TaskExecutionSpecPlanStepUnionMember1 -] - - -class TaskExecutionSpecPlan(BaseModel): - steps: Optional[List[TaskExecutionSpecPlanStep]] = None - - -class TaskExecutionSpec(BaseModel): - desired_phase: Optional[ - Literal[ - "TASK_EXECUTION_PHASE_UNSPECIFIED", - "TASK_EXECUTION_PHASE_PENDING", - "TASK_EXECUTION_PHASE_RUNNING", - "TASK_EXECUTION_PHASE_SUCCEEDED", - "TASK_EXECUTION_PHASE_FAILED", - "TASK_EXECUTION_PHASE_STOPPED", - ] - ] = FieldInfo(alias="desiredPhase", default=None) - """desired_phase is the phase the task execution should be in. - - Used to stop a running task execution early. - """ - - plan: Optional[List[TaskExecutionSpecPlan]] = None - """plan is a list of groups of steps. - - The steps in a group are executed concurrently, while the groups are executed - sequentially. The order of the groups is the order in which they are executed. - """ - - -class TaskExecutionStatusStep(BaseModel): - id: Optional[str] = None - """ID is the ID of the execution step""" - - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message summarises why the step failed to operate. - - If this is non-empty the step has failed to operate and will likely transition - to a failed state. - """ - - phase: Optional[ - Literal[ - "TASK_EXECUTION_PHASE_UNSPECIFIED", - "TASK_EXECUTION_PHASE_PENDING", - "TASK_EXECUTION_PHASE_RUNNING", - "TASK_EXECUTION_PHASE_SUCCEEDED", - "TASK_EXECUTION_PHASE_FAILED", - "TASK_EXECUTION_PHASE_STOPPED", - ] - ] = None - """phase is the current phase of the execution step""" - - -class TaskExecutionStatus(BaseModel): - failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) - """failure_message summarises why the task execution failed to operate. - - If this is non-empty the task execution has failed to operate and will likely - transition to a failed state. - """ - - log_url: Optional[str] = FieldInfo(alias="logUrl", default=None) - """log_url is the URL to the logs of the task's steps. - - If this is empty, the task either has no logs or has not yet started. - """ - - phase: Optional[ - Literal[ - "TASK_EXECUTION_PHASE_UNSPECIFIED", - "TASK_EXECUTION_PHASE_PENDING", - "TASK_EXECUTION_PHASE_RUNNING", - "TASK_EXECUTION_PHASE_SUCCEEDED", - "TASK_EXECUTION_PHASE_FAILED", - "TASK_EXECUTION_PHASE_STOPPED", - ] - ] = None - """the phase of a task execution represents the aggregated phase of all steps.""" - - status_version: Optional[str] = FieldInfo(alias="statusVersion", default=None) - """version of the status update. - - Task executions themselves are unversioned, but their status has different - versions. The value of this field has no semantic meaning (e.g. don't interpret - it as as a timestamp), but it can be used to impose a partial order. If - a.status_version < b.status_version then a was the status before b. - """ - - steps: Optional[List[TaskExecutionStatusStep]] = None - """steps provides the status for each individual step of the task execution. - - If a step is missing it has not yet started. - """ - - -class TaskExecution(BaseModel): - id: Optional[str] = None - - metadata: Optional[TaskExecutionMetadata] = None - - spec: Optional[TaskExecutionSpec] = None - - status: Optional[TaskExecutionStatus] = None +__all__ = ["ExecutionRetrieveResponse"] class ExecutionRetrieveResponse(BaseModel): diff --git a/src/gitpod/types/environments/automations_file_param.py b/src/gitpod/types/environments/automations_file_param.py new file mode 100644 index 0000000..e2c0a7e --- /dev/null +++ b/src/gitpod/types/environments/automations_file_param.py @@ -0,0 +1,77 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List +from typing_extensions import Literal, Annotated, TypedDict + +from ..._utils import PropertyInfo +from ..shared_params.runs_on import RunsOn + +__all__ = ["AutomationsFileParam", "Services", "ServicesCommands", "Tasks"] + + +class ServicesCommands(TypedDict, total=False): + ready: str + """ + ready is an optional command that is run repeatedly until it exits with a zero + exit code. If set, the service will first go into a Starting phase, and then + into a Running phase once the ready command exits with a zero exit code. + """ + + start: str + """ + start is the command to start and run the service. If start exits, the service + will transition to the following phase: + + - Stopped: if the exit code is 0 + - Failed: if the exit code is not 0 If the stop command is not set, the start + command will receive a SIGTERM signal when the service is requested to stop. + If it does not exit within 2 minutes, it will receive a SIGKILL signal. + """ + + stop: str + """ + stop is an optional command that runs when the service is requested to stop. If + set, instead of sending a SIGTERM signal to the start command, the stop command + will be run. Once the stop command exits, the start command will receive a + SIGKILL signal. If the stop command exits with a non-zero exit code, the service + will transition to the Failed phase. If the stop command does not exit within 2 + minutes, a SIGKILL signal will be sent to both the start and stop commands. + """ + + +class Services(TypedDict, total=False): + commands: ServicesCommands + + description: str + + name: str + + runs_on: Annotated[RunsOn, PropertyInfo(alias="runsOn")] + + triggered_by: Annotated[ + List[Literal["manual", "postEnvironmentStart", "postDevcontainerStart"]], PropertyInfo(alias="triggeredBy") + ] + + +class Tasks(TypedDict, total=False): + command: str + + depends_on: Annotated[List[str], PropertyInfo(alias="dependsOn")] + + description: str + + name: str + + runs_on: Annotated[RunsOn, PropertyInfo(alias="runsOn")] + + triggered_by: Annotated[ + List[Literal["manual", "postEnvironmentStart", "postDevcontainerStart"]], PropertyInfo(alias="triggeredBy") + ] + + +class AutomationsFileParam(TypedDict, total=False): + services: Dict[str, Services] + + tasks: Dict[str, Tasks] diff --git a/src/gitpod/types/environments/class_list_params.py b/src/gitpod/types/environments/class_list_params.py index ca0eaf4..046d982 100644 --- a/src/gitpod/types/environments/class_list_params.py +++ b/src/gitpod/types/environments/class_list_params.py @@ -2,7 +2,8 @@ from __future__ import annotations -from typing_extensions import Required, Annotated, TypedDict +from typing import List, Optional +from typing_extensions import Annotated, TypedDict from ..._utils import PropertyInfo @@ -21,12 +22,15 @@ class ClassListParams(TypedDict, total=False): class Filter(TypedDict, total=False): - enabled: Required[bool] + enabled: Optional[bool] """ enabled filters the response to only enabled or disabled environment classes. If not set, all environment classes are returned. """ + runner_ids: Annotated[List[str], PropertyInfo(alias="runnerIds")] + """runner_ids filters the response to only EnvironmentClasses of these Runner IDs""" + class Pagination(TypedDict, total=False): token: str diff --git a/src/gitpod/types/event_list_params.py b/src/gitpod/types/event_list_params.py index 7339620..f444df6 100644 --- a/src/gitpod/types/event_list_params.py +++ b/src/gitpod/types/event_list_params.py @@ -3,9 +3,11 @@ from __future__ import annotations from typing import List -from typing_extensions import Literal, Annotated, TypedDict +from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo +from .resource_type import ResourceType +from .shared.principal import Principal __all__ = ["EventListParams", "Filter", "Pagination"] @@ -24,47 +26,11 @@ class EventListParams(TypedDict, total=False): class Filter(TypedDict, total=False): actor_ids: Annotated[List[str], PropertyInfo(alias="actorIds")] - actor_principals: Annotated[ - List[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ], - PropertyInfo(alias="actorPrincipals"), - ] + actor_principals: Annotated[List[Principal], PropertyInfo(alias="actorPrincipals")] subject_ids: Annotated[List[str], PropertyInfo(alias="subjectIds")] - subject_types: Annotated[ - List[ - Literal[ - "RESOURCE_TYPE_UNSPECIFIED", - "RESOURCE_TYPE_ENVIRONMENT", - "RESOURCE_TYPE_RUNNER", - "RESOURCE_TYPE_PROJECT", - "RESOURCE_TYPE_TASK", - "RESOURCE_TYPE_TASK_EXECUTION", - "RESOURCE_TYPE_SERVICE", - "RESOURCE_TYPE_ORGANIZATION", - "RESOURCE_TYPE_USER", - "RESOURCE_TYPE_ENVIRONMENT_CLASS", - "RESOURCE_TYPE_RUNNER_SCM_INTEGRATION", - "RESOURCE_TYPE_HOST_AUTHENTICATION_TOKEN", - "RESOURCE_TYPE_GROUP", - "RESOURCE_TYPE_PERSONAL_ACCESS_TOKEN", - "RESOURCE_TYPE_USER_PREFERENCE", - "RESOURCE_TYPE_SERVICE_ACCOUNT", - "RESOURCE_TYPE_SECRET", - "RESOURCE_TYPE_SSO_CONFIG", - ] - ], - PropertyInfo(alias="subjectTypes"), - ] + subject_types: Annotated[List[ResourceType], PropertyInfo(alias="subjectTypes")] class Pagination(TypedDict, total=False): diff --git a/src/gitpod/types/event_list_response.py b/src/gitpod/types/event_list_response.py index b49844c..ce8fb8b 100644 --- a/src/gitpod/types/event_list_response.py +++ b/src/gitpod/types/event_list_response.py @@ -2,11 +2,12 @@ from typing import Optional from datetime import datetime -from typing_extensions import Literal from pydantic import Field as FieldInfo from .._models import BaseModel +from .resource_type import ResourceType +from .shared.principal import Principal __all__ = ["EventListResponse"] @@ -18,16 +19,7 @@ class EventListResponse(BaseModel): actor_id: Optional[str] = FieldInfo(alias="actorId", default=None) - actor_principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = FieldInfo(alias="actorPrincipal", default=None) + actor_principal: Optional[Principal] = FieldInfo(alias="actorPrincipal", default=None) created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) """ @@ -123,25 +115,4 @@ class EventListResponse(BaseModel): subject_id: Optional[str] = FieldInfo(alias="subjectId", default=None) - subject_type: Optional[ - Literal[ - "RESOURCE_TYPE_UNSPECIFIED", - "RESOURCE_TYPE_ENVIRONMENT", - "RESOURCE_TYPE_RUNNER", - "RESOURCE_TYPE_PROJECT", - "RESOURCE_TYPE_TASK", - "RESOURCE_TYPE_TASK_EXECUTION", - "RESOURCE_TYPE_SERVICE", - "RESOURCE_TYPE_ORGANIZATION", - "RESOURCE_TYPE_USER", - "RESOURCE_TYPE_ENVIRONMENT_CLASS", - "RESOURCE_TYPE_RUNNER_SCM_INTEGRATION", - "RESOURCE_TYPE_HOST_AUTHENTICATION_TOKEN", - "RESOURCE_TYPE_GROUP", - "RESOURCE_TYPE_PERSONAL_ACCESS_TOKEN", - "RESOURCE_TYPE_USER_PREFERENCE", - "RESOURCE_TYPE_SERVICE_ACCOUNT", - "RESOURCE_TYPE_SECRET", - "RESOURCE_TYPE_SSO_CONFIG", - ] - ] = FieldInfo(alias="subjectType", default=None) + subject_type: Optional[ResourceType] = FieldInfo(alias="subjectType", default=None) diff --git a/src/gitpod/types/event_watch_params.py b/src/gitpod/types/event_watch_params.py index 77d3092..0465a09 100644 --- a/src/gitpod/types/event_watch_params.py +++ b/src/gitpod/types/event_watch_params.py @@ -2,40 +2,23 @@ from __future__ import annotations -from typing import Union -from typing_extensions import Required, Annotated, TypeAlias, TypedDict +from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo -__all__ = [ - "EventWatchParams", - "EnvironmentScopeProducesEventsForTheEnvironmentItselfAllTasksTaskExecutionsAndServicesAssociatedWithThatEnvironment", - "OrganizationScopeProducesEventsForAllProjectsRunnersAndEnvironmentsTheCallerCanSeeWithinTheirOrganizationNoTaskTaskExecutionOrServiceEventsAreProdued", -] +__all__ = ["EventWatchParams"] -class EnvironmentScopeProducesEventsForTheEnvironmentItselfAllTasksTaskExecutionsAndServicesAssociatedWithThatEnvironment( - TypedDict, total=False -): - environment_id: Required[Annotated[str, PropertyInfo(alias="environmentId")]] +class EventWatchParams(TypedDict, total=False): + environment_id: Annotated[str, PropertyInfo(alias="environmentId")] """ Environment scope produces events for the environment itself, all tasks, task executions, and services associated with that environment. """ - -class OrganizationScopeProducesEventsForAllProjectsRunnersAndEnvironmentsTheCallerCanSeeWithinTheirOrganizationNoTaskTaskExecutionOrServiceEventsAreProdued( - TypedDict, total=False -): - organization: Required[bool] + organization: bool """ Organization scope produces events for all projects, runners and environments the caller can see within their organization. No task, task execution or service events are produed. """ - - -EventWatchParams: TypeAlias = Union[ - EnvironmentScopeProducesEventsForTheEnvironmentItselfAllTasksTaskExecutionsAndServicesAssociatedWithThatEnvironment, - OrganizationScopeProducesEventsForAllProjectsRunnersAndEnvironmentsTheCallerCanSeeWithinTheirOrganizationNoTaskTaskExecutionOrServiceEventsAreProdued, -] diff --git a/src/gitpod/types/event_watch_response.py b/src/gitpod/types/event_watch_response.py index ec289a8..9780ee1 100644 --- a/src/gitpod/types/event_watch_response.py +++ b/src/gitpod/types/event_watch_response.py @@ -1,47 +1,19 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional -from typing_extensions import Literal from pydantic import Field as FieldInfo from .._models import BaseModel +from .resource_type import ResourceType +from .resource_operation import ResourceOperation __all__ = ["EventWatchResponse"] class EventWatchResponse(BaseModel): - operation: Optional[ - Literal[ - "RESOURCE_OPERATION_UNSPECIFIED", - "RESOURCE_OPERATION_CREATE", - "RESOURCE_OPERATION_UPDATE", - "RESOURCE_OPERATION_DELETE", - "RESOURCE_OPERATION_UPDATE_STATUS", - ] - ] = None + operation: Optional[ResourceOperation] = None resource_id: Optional[str] = FieldInfo(alias="resourceId", default=None) - resource_type: Optional[ - Literal[ - "RESOURCE_TYPE_UNSPECIFIED", - "RESOURCE_TYPE_ENVIRONMENT", - "RESOURCE_TYPE_RUNNER", - "RESOURCE_TYPE_PROJECT", - "RESOURCE_TYPE_TASK", - "RESOURCE_TYPE_TASK_EXECUTION", - "RESOURCE_TYPE_SERVICE", - "RESOURCE_TYPE_ORGANIZATION", - "RESOURCE_TYPE_USER", - "RESOURCE_TYPE_ENVIRONMENT_CLASS", - "RESOURCE_TYPE_RUNNER_SCM_INTEGRATION", - "RESOURCE_TYPE_HOST_AUTHENTICATION_TOKEN", - "RESOURCE_TYPE_GROUP", - "RESOURCE_TYPE_PERSONAL_ACCESS_TOKEN", - "RESOURCE_TYPE_USER_PREFERENCE", - "RESOURCE_TYPE_SERVICE_ACCOUNT", - "RESOURCE_TYPE_SECRET", - "RESOURCE_TYPE_SSO_CONFIG", - ] - ] = FieldInfo(alias="resourceType", default=None) + resource_type: Optional[ResourceType] = FieldInfo(alias="resourceType", default=None) diff --git a/src/gitpod/types/group_list_response.py b/src/gitpod/types/group.py similarity index 99% rename from src/gitpod/types/group_list_response.py rename to src/gitpod/types/group.py index 3a44f28..a98b80b 100644 --- a/src/gitpod/types/group_list_response.py +++ b/src/gitpod/types/group.py @@ -7,10 +7,10 @@ from .._models import BaseModel -__all__ = ["GroupListResponse"] +__all__ = ["Group"] -class GroupListResponse(BaseModel): +class Group(BaseModel): id: Optional[str] = None created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) diff --git a/src/gitpod/types/identity_get_authenticated_identity_response.py b/src/gitpod/types/identity_get_authenticated_identity_response.py index fb9635b..f04ad09 100644 --- a/src/gitpod/types/identity_get_authenticated_identity_response.py +++ b/src/gitpod/types/identity_get_authenticated_identity_response.py @@ -1,30 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional -from typing_extensions import Literal from pydantic import Field as FieldInfo from .._models import BaseModel +from .shared.subject import Subject -__all__ = ["IdentityGetAuthenticatedIdentityResponse", "Subject"] - - -class Subject(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" +__all__ = ["IdentityGetAuthenticatedIdentityResponse"] class IdentityGetAuthenticatedIdentityResponse(BaseModel): diff --git a/src/gitpod/types/invite_domains.py b/src/gitpod/types/invite_domains.py new file mode 100644 index 0000000..32a0c7f --- /dev/null +++ b/src/gitpod/types/invite_domains.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from .._models import BaseModel + +__all__ = ["InviteDomains"] + + +class InviteDomains(BaseModel): + domains: Optional[List[str]] = None + """domains is the list of domains that are allowed to join the organization""" diff --git a/src/gitpod/types/invite_domains_param.py b/src/gitpod/types/invite_domains_param.py new file mode 100644 index 0000000..d38601a --- /dev/null +++ b/src/gitpod/types/invite_domains_param.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import TypedDict + +__all__ = ["InviteDomainsParam"] + + +class InviteDomainsParam(TypedDict, total=False): + domains: List[str] + """domains is the list of domains that are allowed to join the organization""" diff --git a/src/gitpod/types/joinable_organization.py b/src/gitpod/types/joinable_organization.py new file mode 100644 index 0000000..f2fa957 --- /dev/null +++ b/src/gitpod/types/joinable_organization.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["JoinableOrganization"] + + +class JoinableOrganization(BaseModel): + organization_id: Optional[str] = FieldInfo(alias="organizationId", default=None) + """organization_id is the id of the organization the user can join""" + + organization_member_count: Optional[int] = FieldInfo(alias="organizationMemberCount", default=None) + """ + organization_member_count is the member count of the organization the user can + join + """ + + organization_name: Optional[str] = FieldInfo(alias="organizationName", default=None) + """organization_name is the name of the organization the user can join""" diff --git a/src/gitpod/types/account_list_login_providers_response.py b/src/gitpod/types/login_provider.py similarity index 82% rename from src/gitpod/types/account_list_login_providers_response.py rename to src/gitpod/types/login_provider.py index 825d987..1a3b194 100644 --- a/src/gitpod/types/account_list_login_providers_response.py +++ b/src/gitpod/types/login_provider.py @@ -6,10 +6,10 @@ from .._models import BaseModel -__all__ = ["AccountListLoginProvidersResponse"] +__all__ = ["LoginProvider"] -class AccountListLoginProvidersResponse(BaseModel): +class LoginProvider(BaseModel): login_url: Optional[str] = FieldInfo(alias="loginUrl", default=None) """login_url is the URL to redirect the browser agent to for login""" diff --git a/src/gitpod/types/organization_list_response.py b/src/gitpod/types/organization.py similarity index 96% rename from src/gitpod/types/organization_list_response.py rename to src/gitpod/types/organization.py index 1bb91db..4fd832b 100644 --- a/src/gitpod/types/organization_list_response.py +++ b/src/gitpod/types/organization.py @@ -1,21 +1,17 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Optional from datetime import datetime from pydantic import Field as FieldInfo from .._models import BaseModel +from .invite_domains import InviteDomains -__all__ = ["OrganizationListResponse", "InviteDomains"] +__all__ = ["Organization"] -class InviteDomains(BaseModel): - domains: Optional[List[str]] = None - """domains is the list of domains that are allowed to join the organization""" - - -class OrganizationListResponse(BaseModel): +class Organization(BaseModel): id: Optional[str] = None created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) diff --git a/src/gitpod/types/organization_create_response.py b/src/gitpod/types/organization_create_response.py index c4ff11e..a716cae 100644 --- a/src/gitpod/types/organization_create_response.py +++ b/src/gitpod/types/organization_create_response.py @@ -1,328 +1,16 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from pydantic import Field as FieldInfo +from typing import Optional from .._models import BaseModel +from .organization import Organization +from .organization_member import OrganizationMember -__all__ = ["OrganizationCreateResponse", "Member", "Organization", "OrganizationInviteDomains"] - - -class Member(BaseModel): - avatar_url: Optional[str] = FieldInfo(alias="avatarUrl", default=None) - - email: Optional[str] = None - - full_name: Optional[str] = FieldInfo(alias="fullName", default=None) - - login_provider: Optional[str] = FieldInfo(alias="loginProvider", default=None) - """login_provider is the login provider the user uses to sign in""" - - member_since: Optional[datetime] = FieldInfo(alias="memberSince", 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - role: Optional[Literal["ORGANIZATION_ROLE_UNSPECIFIED", "ORGANIZATION_ROLE_ADMIN", "ORGANIZATION_ROLE_MEMBER"]] = ( - None - ) - - status: Optional[ - Literal["USER_STATUS_UNSPECIFIED", "USER_STATUS_ACTIVE", "USER_STATUS_SUSPENDED", "USER_STATUS_LEFT"] - ] = None - - user_id: Optional[str] = FieldInfo(alias="userId", default=None) - - -class OrganizationInviteDomains(BaseModel): - domains: Optional[List[str]] = None - """domains is the list of domains that are allowed to join the organization""" - - -class Organization(BaseModel): - id: Optional[str] = None - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - invite_domains: Optional[OrganizationInviteDomains] = FieldInfo(alias="inviteDomains", default=None) - - name: Optional[str] = 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ +__all__ = ["OrganizationCreateResponse"] class OrganizationCreateResponse(BaseModel): - member: Optional[Member] = None + member: Optional[OrganizationMember] = None """member is the member that joined the org on creation. Only set if specified "join_organization" is "true" in the request. diff --git a/src/gitpod/types/organization_join_params.py b/src/gitpod/types/organization_join_params.py index f70703f..25f8223 100644 --- a/src/gitpod/types/organization_join_params.py +++ b/src/gitpod/types/organization_join_params.py @@ -2,29 +2,16 @@ from __future__ import annotations -from typing import Union -from typing_extensions import Required, Annotated, TypeAlias, TypedDict +from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo -__all__ = [ - "OrganizationJoinParams", - "InviteIDIsTheUniqueIdentifierOfTheInviteToJoinTheOrganization", - "OrganizationIDIsTheUniqueIdentifierOfTheOrganizationToJoin", -] +__all__ = ["OrganizationJoinParams"] -class InviteIDIsTheUniqueIdentifierOfTheInviteToJoinTheOrganization(TypedDict, total=False): - invite_id: Required[Annotated[str, PropertyInfo(alias="inviteId")]] +class OrganizationJoinParams(TypedDict, total=False): + invite_id: Annotated[str, PropertyInfo(alias="inviteId")] """invite_id is the unique identifier of the invite to join the organization.""" - -class OrganizationIDIsTheUniqueIdentifierOfTheOrganizationToJoin(TypedDict, total=False): - organization_id: Required[Annotated[str, PropertyInfo(alias="organizationId")]] + organization_id: Annotated[str, PropertyInfo(alias="organizationId")] """organization_id is the unique identifier of the Organization to join.""" - - -OrganizationJoinParams: TypeAlias = Union[ - InviteIDIsTheUniqueIdentifierOfTheInviteToJoinTheOrganization, - OrganizationIDIsTheUniqueIdentifierOfTheOrganizationToJoin, -] diff --git a/src/gitpod/types/organization_join_response.py b/src/gitpod/types/organization_join_response.py index da8cff5..880a93d 100644 --- a/src/gitpod/types/organization_join_response.py +++ b/src/gitpod/types/organization_join_response.py @@ -1,129 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from pydantic import Field as FieldInfo from .._models import BaseModel +from .organization_member import OrganizationMember -__all__ = ["OrganizationJoinResponse", "Member"] - - -class Member(BaseModel): - avatar_url: Optional[str] = FieldInfo(alias="avatarUrl", default=None) - - email: Optional[str] = None - - full_name: Optional[str] = FieldInfo(alias="fullName", default=None) - - login_provider: Optional[str] = FieldInfo(alias="loginProvider", default=None) - """login_provider is the login provider the user uses to sign in""" - - member_since: Optional[datetime] = FieldInfo(alias="memberSince", 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - role: Optional[Literal["ORGANIZATION_ROLE_UNSPECIFIED", "ORGANIZATION_ROLE_ADMIN", "ORGANIZATION_ROLE_MEMBER"]] = ( - None - ) - - status: Optional[ - Literal["USER_STATUS_UNSPECIFIED", "USER_STATUS_ACTIVE", "USER_STATUS_SUSPENDED", "USER_STATUS_LEFT"] - ] = None - - user_id: Optional[str] = FieldInfo(alias="userId", default=None) +__all__ = ["OrganizationJoinResponse"] class OrganizationJoinResponse(BaseModel): - member: Optional[Member] = None + member: Optional[OrganizationMember] = None """member is the member that was created by joining the organization.""" diff --git a/src/gitpod/types/organization_list_params.py b/src/gitpod/types/organization_list_params.py index 34b6434..edecdc2 100644 --- a/src/gitpod/types/organization_list_params.py +++ b/src/gitpod/types/organization_list_params.py @@ -2,8 +2,9 @@ from __future__ import annotations -from typing_extensions import Literal, Annotated, TypedDict +from typing_extensions import Annotated, TypedDict +from .scope import Scope from .._utils import PropertyInfo __all__ = ["OrganizationListParams", "Pagination"] @@ -17,7 +18,7 @@ class OrganizationListParams(TypedDict, total=False): pagination: Pagination """pagination contains the pagination options for listing organizations""" - scope: Literal["SCOPE_UNSPECIFIED", "SCOPE_MEMBER", "SCOPE_ALL"] + scope: Scope """scope is the scope of the organizations to list""" diff --git a/src/gitpod/types/organization_list_members_response.py b/src/gitpod/types/organization_member.py similarity index 91% rename from src/gitpod/types/organization_list_members_response.py rename to src/gitpod/types/organization_member.py index f95c22a..b1a0109 100644 --- a/src/gitpod/types/organization_list_members_response.py +++ b/src/gitpod/types/organization_member.py @@ -2,16 +2,17 @@ from typing import Optional from datetime import datetime -from typing_extensions import Literal from pydantic import Field as FieldInfo from .._models import BaseModel +from .shared.user_status import UserStatus +from .shared.organization_role import OrganizationRole -__all__ = ["OrganizationListMembersResponse"] +__all__ = ["OrganizationMember"] -class OrganizationListMembersResponse(BaseModel): +class OrganizationMember(BaseModel): avatar_url: Optional[str] = FieldInfo(alias="avatarUrl", default=None) email: Optional[str] = None @@ -113,12 +114,8 @@ class OrganizationListMembersResponse(BaseModel): to obtain a formatter capable of generating timestamps in this format. """ - role: Optional[Literal["ORGANIZATION_ROLE_UNSPECIFIED", "ORGANIZATION_ROLE_ADMIN", "ORGANIZATION_ROLE_MEMBER"]] = ( - None - ) + role: Optional[OrganizationRole] = None - status: Optional[ - Literal["USER_STATUS_UNSPECIFIED", "USER_STATUS_ACTIVE", "USER_STATUS_SUSPENDED", "USER_STATUS_LEFT"] - ] = None + status: Optional[UserStatus] = None user_id: Optional[str] = FieldInfo(alias="userId", default=None) diff --git a/src/gitpod/types/organization_retrieve_response.py b/src/gitpod/types/organization_retrieve_response.py index b645736..4cb085e 100644 --- a/src/gitpod/types/organization_retrieve_response.py +++ b/src/gitpod/types/organization_retrieve_response.py @@ -1,210 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional -from datetime import datetime - -from pydantic import Field as FieldInfo +from typing import Optional from .._models import BaseModel +from .organization import Organization -__all__ = ["OrganizationRetrieveResponse", "Organization", "OrganizationInviteDomains"] - - -class OrganizationInviteDomains(BaseModel): - domains: Optional[List[str]] = None - """domains is the list of domains that are allowed to join the organization""" - - -class Organization(BaseModel): - id: Optional[str] = None - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - invite_domains: Optional[OrganizationInviteDomains] = FieldInfo(alias="inviteDomains", default=None) - - name: Optional[str] = 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ +__all__ = ["OrganizationRetrieveResponse"] class OrganizationRetrieveResponse(BaseModel): diff --git a/src/gitpod/types/organization_set_role_params.py b/src/gitpod/types/organization_set_role_params.py index 1a81fb4..fd565ec 100644 --- a/src/gitpod/types/organization_set_role_params.py +++ b/src/gitpod/types/organization_set_role_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing_extensions import Literal, Annotated, TypedDict +from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo +from .shared.organization_role import OrganizationRole __all__ = ["OrganizationSetRoleParams"] @@ -12,6 +13,6 @@ class OrganizationSetRoleParams(TypedDict, total=False): organization_id: Annotated[str, PropertyInfo(alias="organizationId")] - role: Literal["ORGANIZATION_ROLE_UNSPECIFIED", "ORGANIZATION_ROLE_ADMIN", "ORGANIZATION_ROLE_MEMBER"] + role: OrganizationRole user_id: Annotated[str, PropertyInfo(alias="userId")] diff --git a/src/gitpod/types/organization_update_params.py b/src/gitpod/types/organization_update_params.py index 096c594..90e4d51 100644 --- a/src/gitpod/types/organization_update_params.py +++ b/src/gitpod/types/organization_update_params.py @@ -2,36 +2,21 @@ from __future__ import annotations -from typing import List, Union -from typing_extensions import Required, Annotated, TypeAlias, TypedDict +from typing import Optional +from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo +from .invite_domains_param import InviteDomainsParam -__all__ = [ - "OrganizationUpdateParams", - "InviteDomainsIsTheDomainAllowlistOfTheOrganization", - "InviteDomainsIsTheDomainAllowlistOfTheOrganizationInviteDomains", - "NameIsTheNewNameOfTheOrganization", -] +__all__ = ["OrganizationUpdateParams"] -class InviteDomainsIsTheDomainAllowlistOfTheOrganization(TypedDict, total=False): - invite_domains: Required[ - Annotated[InviteDomainsIsTheDomainAllowlistOfTheOrganizationInviteDomains, PropertyInfo(alias="inviteDomains")] - ] +class OrganizationUpdateParams(TypedDict, total=False): + invite_domains: Annotated[Optional[InviteDomainsParam], PropertyInfo(alias="inviteDomains")] """invite_domains is the domain allowlist of the organization""" - -class InviteDomainsIsTheDomainAllowlistOfTheOrganizationInviteDomains(TypedDict, total=False): - domains: List[str] - """domains is the list of domains that are allowed to join the organization""" - - -class NameIsTheNewNameOfTheOrganization(TypedDict, total=False): - name: Required[str] + name: Optional[str] """name is the new name of the organization""" - -OrganizationUpdateParams: TypeAlias = Union[ - InviteDomainsIsTheDomainAllowlistOfTheOrganization, NameIsTheNewNameOfTheOrganization -] + organization_id: Annotated[str, PropertyInfo(alias="organizationId")] + """organization_id is the ID of the organization to update the settings for.""" diff --git a/src/gitpod/types/organization_update_response.py b/src/gitpod/types/organization_update_response.py index c3a2f97..fed05e6 100644 --- a/src/gitpod/types/organization_update_response.py +++ b/src/gitpod/types/organization_update_response.py @@ -1,210 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional -from datetime import datetime - -from pydantic import Field as FieldInfo +from typing import Optional from .._models import BaseModel +from .organization import Organization -__all__ = ["OrganizationUpdateResponse", "Organization", "OrganizationInviteDomains"] - - -class OrganizationInviteDomains(BaseModel): - domains: Optional[List[str]] = None - """domains is the list of domains that are allowed to join the organization""" - - -class Organization(BaseModel): - id: Optional[str] = None - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - invite_domains: Optional[OrganizationInviteDomains] = FieldInfo(alias="inviteDomains", default=None) - - name: Optional[str] = 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ +__all__ = ["OrganizationUpdateResponse"] class OrganizationUpdateResponse(BaseModel): diff --git a/src/gitpod/types/organizations/__init__.py b/src/gitpod/types/organizations/__init__.py index 0cc2d0e..ce9a399 100644 --- a/src/gitpod/types/organizations/__init__.py +++ b/src/gitpod/types/organizations/__init__.py @@ -2,16 +2,19 @@ from __future__ import annotations +from .provider_type import ProviderType as ProviderType +from .sso_configuration import SSOConfiguration as SSOConfiguration +from .organization_invite import OrganizationInvite as OrganizationInvite from .invite_create_params import InviteCreateParams as InviteCreateParams from .invite_create_response import InviteCreateResponse as InviteCreateResponse from .invite_retrieve_params import InviteRetrieveParams as InviteRetrieveParams +from .sso_configuration_state import SSOConfigurationState as SSOConfigurationState from .invite_retrieve_response import InviteRetrieveResponse as InviteRetrieveResponse from .invite_get_summary_params import InviteGetSummaryParams as InviteGetSummaryParams from .invite_get_summary_response import InviteGetSummaryResponse as InviteGetSummaryResponse from .sso_configuration_list_params import SSOConfigurationListParams as SSOConfigurationListParams from .sso_configuration_create_params import SSOConfigurationCreateParams as SSOConfigurationCreateParams from .sso_configuration_delete_params import SSOConfigurationDeleteParams as SSOConfigurationDeleteParams -from .sso_configuration_list_response import SSOConfigurationListResponse as SSOConfigurationListResponse from .sso_configuration_update_params import SSOConfigurationUpdateParams as SSOConfigurationUpdateParams from .sso_configuration_create_response import SSOConfigurationCreateResponse as SSOConfigurationCreateResponse from .sso_configuration_retrieve_params import SSOConfigurationRetrieveParams as SSOConfigurationRetrieveParams diff --git a/src/gitpod/types/organizations/invite_create_response.py b/src/gitpod/types/organizations/invite_create_response.py index fb0cbba..95c8bd7 100644 --- a/src/gitpod/types/organizations/invite_create_response.py +++ b/src/gitpod/types/organizations/invite_create_response.py @@ -2,20 +2,11 @@ from typing import Optional -from pydantic import Field as FieldInfo - from ..._models import BaseModel +from .organization_invite import OrganizationInvite -__all__ = ["InviteCreateResponse", "Invite"] - - -class Invite(BaseModel): - invite_id: Optional[str] = FieldInfo(alias="inviteId", default=None) - """ - invite_id is the unique identifier of the invite to join the organization. Use - JoinOrganization with this ID to join the organization. - """ +__all__ = ["InviteCreateResponse"] class InviteCreateResponse(BaseModel): - invite: Optional[Invite] = None + invite: Optional[OrganizationInvite] = None diff --git a/src/gitpod/types/organizations/invite_retrieve_response.py b/src/gitpod/types/organizations/invite_retrieve_response.py index ea2cbb0..bbdcdc8 100644 --- a/src/gitpod/types/organizations/invite_retrieve_response.py +++ b/src/gitpod/types/organizations/invite_retrieve_response.py @@ -2,20 +2,11 @@ from typing import Optional -from pydantic import Field as FieldInfo - from ..._models import BaseModel +from .organization_invite import OrganizationInvite -__all__ = ["InviteRetrieveResponse", "Invite"] - - -class Invite(BaseModel): - invite_id: Optional[str] = FieldInfo(alias="inviteId", default=None) - """ - invite_id is the unique identifier of the invite to join the organization. Use - JoinOrganization with this ID to join the organization. - """ +__all__ = ["InviteRetrieveResponse"] class InviteRetrieveResponse(BaseModel): - invite: Optional[Invite] = None + invite: Optional[OrganizationInvite] = None diff --git a/src/gitpod/types/organizations/organization_invite.py b/src/gitpod/types/organizations/organization_invite.py new file mode 100644 index 0000000..d31f882 --- /dev/null +++ b/src/gitpod/types/organizations/organization_invite.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["OrganizationInvite"] + + +class OrganizationInvite(BaseModel): + invite_id: Optional[str] = FieldInfo(alias="inviteId", default=None) + """ + invite_id is the unique identifier of the invite to join the organization. Use + JoinOrganization with this ID to join the organization. + """ diff --git a/src/gitpod/types/organizations/provider_type.py b/src/gitpod/types/organizations/provider_type.py new file mode 100644 index 0000000..a5691eb --- /dev/null +++ b/src/gitpod/types/organizations/provider_type.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["ProviderType"] + +ProviderType: TypeAlias = Literal["PROVIDER_TYPE_UNSPECIFIED", "PROVIDER_TYPE_BUILTIN", "PROVIDER_TYPE_CUSTOM"] diff --git a/src/gitpod/types/organizations/sso_configuration_list_response.py b/src/gitpod/types/organizations/sso_configuration.py similarity index 66% rename from src/gitpod/types/organizations/sso_configuration_list_response.py rename to src/gitpod/types/organizations/sso_configuration.py index 92917a1..fec9955 100644 --- a/src/gitpod/types/organizations/sso_configuration_list_response.py +++ b/src/gitpod/types/organizations/sso_configuration.py @@ -1,16 +1,17 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Dict, Optional -from typing_extensions import Literal from pydantic import Field as FieldInfo from ..._models import BaseModel +from .provider_type import ProviderType +from .sso_configuration_state import SSOConfigurationState -__all__ = ["SSOConfigurationListResponse"] +__all__ = ["SSOConfiguration"] -class SSOConfigurationListResponse(BaseModel): +class SSOConfiguration(BaseModel): id: Optional[str] = None """id is the unique identifier of the SSO configuration""" @@ -27,14 +28,8 @@ class SSOConfigurationListResponse(BaseModel): organization_id: Optional[str] = FieldInfo(alias="organizationId", default=None) - provider_type: Optional[Literal["PROVIDER_TYPE_UNSPECIFIED", "PROVIDER_TYPE_BUILTIN", "PROVIDER_TYPE_CUSTOM"]] = ( - FieldInfo(alias="providerType", default=None) - ) + provider_type: Optional[ProviderType] = FieldInfo(alias="providerType", default=None) """provider_type defines the type of the SSO configuration""" - state: Optional[ - Literal[ - "SSO_CONFIGURATION_STATE_UNSPECIFIED", "SSO_CONFIGURATION_STATE_INACTIVE", "SSO_CONFIGURATION_STATE_ACTIVE" - ] - ] = None + state: Optional[SSOConfigurationState] = None """state is the state of the SSO configuration""" diff --git a/src/gitpod/types/organizations/sso_configuration_create_response.py b/src/gitpod/types/organizations/sso_configuration_create_response.py index 6909b0e..962038c 100644 --- a/src/gitpod/types/organizations/sso_configuration_create_response.py +++ b/src/gitpod/types/organizations/sso_configuration_create_response.py @@ -1,43 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Optional -from typing_extensions import Literal +from typing import Optional from pydantic import Field as FieldInfo from ..._models import BaseModel +from .sso_configuration import SSOConfiguration -__all__ = ["SSOConfigurationCreateResponse", "SSOConfiguration"] - - -class SSOConfiguration(BaseModel): - id: Optional[str] = None - """id is the unique identifier of the SSO configuration""" - - claims: Optional[Dict[str, str]] = None - """claims are key/value pairs that defines a mapping of claims issued by the IdP.""" - - client_id: Optional[str] = FieldInfo(alias="clientId", default=None) - """client_id is the client ID of the OIDC application set on the IdP""" - - email_domain: Optional[str] = FieldInfo(alias="emailDomain", default=None) - - issuer_url: Optional[str] = FieldInfo(alias="issuerUrl", default=None) - """issuer_url is the URL of the IdP issuer""" - - organization_id: Optional[str] = FieldInfo(alias="organizationId", default=None) - - provider_type: Optional[Literal["PROVIDER_TYPE_UNSPECIFIED", "PROVIDER_TYPE_BUILTIN", "PROVIDER_TYPE_CUSTOM"]] = ( - FieldInfo(alias="providerType", default=None) - ) - """provider_type defines the type of the SSO configuration""" - - state: Optional[ - Literal[ - "SSO_CONFIGURATION_STATE_UNSPECIFIED", "SSO_CONFIGURATION_STATE_INACTIVE", "SSO_CONFIGURATION_STATE_ACTIVE" - ] - ] = None - """state is the state of the SSO configuration""" +__all__ = ["SSOConfigurationCreateResponse"] class SSOConfigurationCreateResponse(BaseModel): diff --git a/src/gitpod/types/organizations/sso_configuration_retrieve_response.py b/src/gitpod/types/organizations/sso_configuration_retrieve_response.py index c5b31cf..20aa128 100644 --- a/src/gitpod/types/organizations/sso_configuration_retrieve_response.py +++ b/src/gitpod/types/organizations/sso_configuration_retrieve_response.py @@ -1,43 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Optional -from typing_extensions import Literal +from typing import Optional from pydantic import Field as FieldInfo from ..._models import BaseModel +from .sso_configuration import SSOConfiguration -__all__ = ["SSOConfigurationRetrieveResponse", "SSOConfiguration"] - - -class SSOConfiguration(BaseModel): - id: Optional[str] = None - """id is the unique identifier of the SSO configuration""" - - claims: Optional[Dict[str, str]] = None - """claims are key/value pairs that defines a mapping of claims issued by the IdP.""" - - client_id: Optional[str] = FieldInfo(alias="clientId", default=None) - """client_id is the client ID of the OIDC application set on the IdP""" - - email_domain: Optional[str] = FieldInfo(alias="emailDomain", default=None) - - issuer_url: Optional[str] = FieldInfo(alias="issuerUrl", default=None) - """issuer_url is the URL of the IdP issuer""" - - organization_id: Optional[str] = FieldInfo(alias="organizationId", default=None) - - provider_type: Optional[Literal["PROVIDER_TYPE_UNSPECIFIED", "PROVIDER_TYPE_BUILTIN", "PROVIDER_TYPE_CUSTOM"]] = ( - FieldInfo(alias="providerType", default=None) - ) - """provider_type defines the type of the SSO configuration""" - - state: Optional[ - Literal[ - "SSO_CONFIGURATION_STATE_UNSPECIFIED", "SSO_CONFIGURATION_STATE_INACTIVE", "SSO_CONFIGURATION_STATE_ACTIVE" - ] - ] = None - """state is the state of the SSO configuration""" +__all__ = ["SSOConfigurationRetrieveResponse"] class SSOConfigurationRetrieveResponse(BaseModel): diff --git a/src/gitpod/types/organizations/sso_configuration_state.py b/src/gitpod/types/organizations/sso_configuration_state.py new file mode 100644 index 0000000..e866445 --- /dev/null +++ b/src/gitpod/types/organizations/sso_configuration_state.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["SSOConfigurationState"] + +SSOConfigurationState: TypeAlias = Literal[ + "SSO_CONFIGURATION_STATE_UNSPECIFIED", "SSO_CONFIGURATION_STATE_INACTIVE", "SSO_CONFIGURATION_STATE_ACTIVE" +] diff --git a/src/gitpod/types/organizations/sso_configuration_update_params.py b/src/gitpod/types/organizations/sso_configuration_update_params.py index 47698ca..129ce2c 100644 --- a/src/gitpod/types/organizations/sso_configuration_update_params.py +++ b/src/gitpod/types/organizations/sso_configuration_update_params.py @@ -2,53 +2,32 @@ from __future__ import annotations -from typing import Union -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing import Dict, Optional +from typing_extensions import Annotated, TypedDict from ..._utils import PropertyInfo +from .sso_configuration_state import SSOConfigurationState -__all__ = [ - "SSOConfigurationUpdateParams", - "ClientIDIsTheClientIDOfTheSSOProvider", - "ClientSecretIsTheClientSecretOfTheSSOProvider", - "Variant2", - "IssuerURLIsTheURLOfTheIDPIssuer", - "StateIsTheStateOfTheSSOConfiguration", -] +__all__ = ["SSOConfigurationUpdateParams"] -class ClientIDIsTheClientIDOfTheSSOProvider(TypedDict, total=False): - client_id: Required[Annotated[str, PropertyInfo(alias="clientId")]] - """client_id is the client ID of the SSO provider""" +class SSOConfigurationUpdateParams(TypedDict, total=False): + claims: Dict[str, str] + """claims are key/value pairs that defines a mapping of claims issued by the IdP.""" + client_id: Annotated[Optional[str], PropertyInfo(alias="clientId")] + """client_id is the client ID of the SSO provider""" -class ClientSecretIsTheClientSecretOfTheSSOProvider(TypedDict, total=False): - client_secret: Required[Annotated[str, PropertyInfo(alias="clientSecret")]] + client_secret: Annotated[Optional[str], PropertyInfo(alias="clientSecret")] """client_secret is the client secret of the SSO provider""" + email_domain: Annotated[Optional[str], PropertyInfo(alias="emailDomain")] -class Variant2(TypedDict, total=False): - email_domain: Required[Annotated[str, PropertyInfo(alias="emailDomain")]] - - -class IssuerURLIsTheURLOfTheIDPIssuer(TypedDict, total=False): - issuer_url: Required[Annotated[str, PropertyInfo(alias="issuerUrl")]] + issuer_url: Annotated[Optional[str], PropertyInfo(alias="issuerUrl")] """issuer_url is the URL of the IdP issuer""" + sso_configuration_id: Annotated[str, PropertyInfo(alias="ssoConfigurationId")] + """sso_configuration_id is the ID of the SSO configuration to update""" -class StateIsTheStateOfTheSSOConfiguration(TypedDict, total=False): - state: Required[ - Literal[ - "SSO_CONFIGURATION_STATE_UNSPECIFIED", "SSO_CONFIGURATION_STATE_INACTIVE", "SSO_CONFIGURATION_STATE_ACTIVE" - ] - ] + state: Optional[SSOConfigurationState] """state is the state of the SSO configuration""" - - -SSOConfigurationUpdateParams: TypeAlias = Union[ - ClientIDIsTheClientIDOfTheSSOProvider, - ClientSecretIsTheClientSecretOfTheSSOProvider, - Variant2, - IssuerURLIsTheURLOfTheIDPIssuer, - StateIsTheStateOfTheSSOConfiguration, -] diff --git a/src/gitpod/types/project.py b/src/gitpod/types/project.py new file mode 100644 index 0000000..9fc31a9 --- /dev/null +++ b/src/gitpod/types/project.py @@ -0,0 +1,50 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.subject import Subject +from .project_metadata import ProjectMetadata +from .environment_initializer import EnvironmentInitializer +from .project_environment_class import ProjectEnvironmentClass + +__all__ = ["Project", "UsedBy"] + + +class UsedBy(BaseModel): + subjects: Optional[List[Subject]] = None + """ + Subjects are the 10 most recent subjects who have used the project to create an + environment + """ + + total_subjects: Optional[int] = FieldInfo(alias="totalSubjects", default=None) + """Total number of unique subjects who have used the project""" + + +class Project(BaseModel): + environment_class: ProjectEnvironmentClass = FieldInfo(alias="environmentClass") + + id: Optional[str] = None + """id is the unique identifier for the project""" + + automations_file_path: Optional[str] = FieldInfo(alias="automationsFilePath", default=None) + """ + automations_file_path is the path to the automations file relative to the repo + root + """ + + devcontainer_file_path: Optional[str] = FieldInfo(alias="devcontainerFilePath", default=None) + """ + devcontainer_file_path is the path to the devcontainer file relative to the repo + root + """ + + initializer: Optional[EnvironmentInitializer] = None + """EnvironmentInitializer specifies how an environment is to be initialized""" + + metadata: Optional[ProjectMetadata] = None + + used_by: Optional[UsedBy] = FieldInfo(alias="usedBy", default=None) diff --git a/src/gitpod/types/project_create_from_environment_response.py b/src/gitpod/types/project_create_from_environment_response.py index 5fc8cf4..5076ce2 100644 --- a/src/gitpod/types/project_create_from_environment_response.py +++ b/src/gitpod/types/project_create_from_environment_response.py @@ -1,364 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias - -from pydantic import Field as FieldInfo +from typing import Optional +from .project import Project from .._models import BaseModel -__all__ = [ - "ProjectCreateFromEnvironmentResponse", - "Project", - "ProjectEnvironmentClass", - "ProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass", - "ProjectEnvironmentClassUseALocalRunnerForTheUser", - "ProjectInitializer", - "ProjectInitializerSpec", - "ProjectInitializerSpecContextURL", - "ProjectInitializerSpecContextURLContextURL", - "ProjectInitializerSpecGit", - "ProjectInitializerSpecGitGit", - "ProjectMetadata", - "ProjectMetadataCreator", - "ProjectUsedBy", - "ProjectUsedBySubject", -] - - -class ProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass( - BaseModel -): - environment_class_id: str = FieldInfo(alias="environmentClassId") - """Use a fixed environment class on a given Runner. - - This cannot be a local runner's environment class. - """ - - -class ProjectEnvironmentClassUseALocalRunnerForTheUser(BaseModel): - local_runner: bool = FieldInfo(alias="localRunner") - """Use a local runner for the user""" - - -ProjectEnvironmentClass: TypeAlias = Union[ - ProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass, - ProjectEnvironmentClassUseALocalRunnerForTheUser, -] - - -class ProjectInitializerSpecContextURLContextURL(BaseModel): - url: Optional[str] = None - """url is the URL from which the environment is created""" - - -class ProjectInitializerSpecContextURL(BaseModel): - context_url: ProjectInitializerSpecContextURLContextURL = FieldInfo(alias="contextUrl") - - -class ProjectInitializerSpecGitGit(BaseModel): - checkout_location: Optional[str] = FieldInfo(alias="checkoutLocation", default=None) - """ - a path relative to the environment root in which the code will be checked out to - """ - - clone_target: Optional[str] = FieldInfo(alias="cloneTarget", default=None) - """the value for the clone target mode - use depends on the target mode""" - - remote_uri: Optional[str] = FieldInfo(alias="remoteUri", default=None) - """remote_uri is the Git remote origin""" - - target_mode: Optional[ - Literal[ - "CLONE_TARGET_MODE_UNSPECIFIED", - "CLONE_TARGET_MODE_REMOTE_HEAD", - "CLONE_TARGET_MODE_REMOTE_COMMIT", - "CLONE_TARGET_MODE_REMOTE_BRANCH", - "CLONE_TARGET_MODE_LOCAL_BRANCH", - ] - ] = FieldInfo(alias="targetMode", default=None) - """CloneTargetMode is the target state in which we want to leave a GitEnvironment""" - - upstream_remote_uri: Optional[str] = FieldInfo(alias="upstreamRemoteUri", default=None) - """upstream_Remote_uri is the fork upstream of a repository""" - - -class ProjectInitializerSpecGit(BaseModel): - git: ProjectInitializerSpecGitGit - - -ProjectInitializerSpec: TypeAlias = Union[ProjectInitializerSpecContextURL, ProjectInitializerSpecGit] - - -class ProjectInitializer(BaseModel): - specs: Optional[List[ProjectInitializerSpec]] = None - - -class ProjectMetadataCreator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class ProjectMetadata(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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - creator: Optional[ProjectMetadataCreator] = None - """creator is the identity of the project creator""" - - name: Optional[str] = None - """name is the human readable name of the project""" - - organization_id: Optional[str] = FieldInfo(alias="organizationId", default=None) - """organization_id is the ID of the organization that contains the environment""" - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - -class ProjectUsedBySubject(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class ProjectUsedBy(BaseModel): - subjects: Optional[List[ProjectUsedBySubject]] = None - """ - Subjects are the 10 most recent subjects who have used the project to create an - environment - """ - - total_subjects: Optional[int] = FieldInfo(alias="totalSubjects", default=None) - """Total number of unique subjects who have used the project""" - - -class Project(BaseModel): - environment_class: ProjectEnvironmentClass = FieldInfo(alias="environmentClass") - - id: Optional[str] = None - """id is the unique identifier for the project""" - - automations_file_path: Optional[str] = FieldInfo(alias="automationsFilePath", default=None) - """ - automations_file_path is the path to the automations file relative to the repo - root - """ - - devcontainer_file_path: Optional[str] = FieldInfo(alias="devcontainerFilePath", default=None) - """ - devcontainer_file_path is the path to the devcontainer file relative to the repo - root - """ - - initializer: Optional[ProjectInitializer] = None - """EnvironmentInitializer specifies how an environment is to be initialized""" - - metadata: Optional[ProjectMetadata] = None - - used_by: Optional[ProjectUsedBy] = FieldInfo(alias="usedBy", default=None) +__all__ = ["ProjectCreateFromEnvironmentResponse"] class ProjectCreateFromEnvironmentResponse(BaseModel): diff --git a/src/gitpod/types/project_create_params.py b/src/gitpod/types/project_create_params.py index 47f1619..cb04ea5 100644 --- a/src/gitpod/types/project_create_params.py +++ b/src/gitpod/types/project_create_params.py @@ -2,29 +2,19 @@ from __future__ import annotations -from typing import Union, Iterable -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing_extensions import Required, Annotated, TypedDict from .._utils import PropertyInfo +from .environment_initializer_param import EnvironmentInitializerParam +from .project_environment_class_param import ProjectEnvironmentClassParam -__all__ = [ - "ProjectCreateParams", - "EnvironmentClass", - "EnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass", - "EnvironmentClassUseALocalRunnerForTheUser", - "Initializer", - "InitializerSpec", - "InitializerSpecContextURL", - "InitializerSpecContextURLContextURL", - "InitializerSpecGit", - "InitializerSpecGitGit", -] +__all__ = ["ProjectCreateParams"] class ProjectCreateParams(TypedDict, total=False): - environment_class: Required[Annotated[EnvironmentClass, PropertyInfo(alias="environmentClass")]] + environment_class: Required[Annotated[ProjectEnvironmentClassParam, PropertyInfo(alias="environmentClass")]] - initializer: Required[Initializer] + initializer: Required[EnvironmentInitializerParam] """EnvironmentInitializer specifies how an environment is to be initialized""" automations_file_path: Annotated[str, PropertyInfo(alias="automationsFilePath")] @@ -48,72 +38,3 @@ class ProjectCreateParams(TypedDict, total=False): """ name: str - - -class EnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass( - TypedDict, total=False -): - environment_class_id: Required[Annotated[str, PropertyInfo(alias="environmentClassId")]] - """Use a fixed environment class on a given Runner. - - This cannot be a local runner's environment class. - """ - - -class EnvironmentClassUseALocalRunnerForTheUser(TypedDict, total=False): - local_runner: Required[Annotated[bool, PropertyInfo(alias="localRunner")]] - """Use a local runner for the user""" - - -EnvironmentClass: TypeAlias = Union[ - EnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass, - EnvironmentClassUseALocalRunnerForTheUser, -] - - -class InitializerSpecContextURLContextURL(TypedDict, total=False): - url: str - """url is the URL from which the environment is created""" - - -class InitializerSpecContextURL(TypedDict, total=False): - context_url: Required[Annotated[InitializerSpecContextURLContextURL, PropertyInfo(alias="contextUrl")]] - - -class InitializerSpecGitGit(TypedDict, total=False): - checkout_location: Annotated[str, PropertyInfo(alias="checkoutLocation")] - """ - a path relative to the environment root in which the code will be checked out to - """ - - clone_target: Annotated[str, PropertyInfo(alias="cloneTarget")] - """the value for the clone target mode - use depends on the target mode""" - - remote_uri: Annotated[str, PropertyInfo(alias="remoteUri")] - """remote_uri is the Git remote origin""" - - target_mode: Annotated[ - Literal[ - "CLONE_TARGET_MODE_UNSPECIFIED", - "CLONE_TARGET_MODE_REMOTE_HEAD", - "CLONE_TARGET_MODE_REMOTE_COMMIT", - "CLONE_TARGET_MODE_REMOTE_BRANCH", - "CLONE_TARGET_MODE_LOCAL_BRANCH", - ], - PropertyInfo(alias="targetMode"), - ] - """CloneTargetMode is the target state in which we want to leave a GitEnvironment""" - - upstream_remote_uri: Annotated[str, PropertyInfo(alias="upstreamRemoteUri")] - """upstream_Remote_uri is the fork upstream of a repository""" - - -class InitializerSpecGit(TypedDict, total=False): - git: Required[InitializerSpecGitGit] - - -InitializerSpec: TypeAlias = Union[InitializerSpecContextURL, InitializerSpecGit] - - -class Initializer(TypedDict, total=False): - specs: Iterable[InitializerSpec] diff --git a/src/gitpod/types/project_create_response.py b/src/gitpod/types/project_create_response.py index 06cfd52..81a0d7e 100644 --- a/src/gitpod/types/project_create_response.py +++ b/src/gitpod/types/project_create_response.py @@ -1,364 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias - -from pydantic import Field as FieldInfo +from typing import Optional +from .project import Project from .._models import BaseModel -__all__ = [ - "ProjectCreateResponse", - "Project", - "ProjectEnvironmentClass", - "ProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass", - "ProjectEnvironmentClassUseALocalRunnerForTheUser", - "ProjectInitializer", - "ProjectInitializerSpec", - "ProjectInitializerSpecContextURL", - "ProjectInitializerSpecContextURLContextURL", - "ProjectInitializerSpecGit", - "ProjectInitializerSpecGitGit", - "ProjectMetadata", - "ProjectMetadataCreator", - "ProjectUsedBy", - "ProjectUsedBySubject", -] - - -class ProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass( - BaseModel -): - environment_class_id: str = FieldInfo(alias="environmentClassId") - """Use a fixed environment class on a given Runner. - - This cannot be a local runner's environment class. - """ - - -class ProjectEnvironmentClassUseALocalRunnerForTheUser(BaseModel): - local_runner: bool = FieldInfo(alias="localRunner") - """Use a local runner for the user""" - - -ProjectEnvironmentClass: TypeAlias = Union[ - ProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass, - ProjectEnvironmentClassUseALocalRunnerForTheUser, -] - - -class ProjectInitializerSpecContextURLContextURL(BaseModel): - url: Optional[str] = None - """url is the URL from which the environment is created""" - - -class ProjectInitializerSpecContextURL(BaseModel): - context_url: ProjectInitializerSpecContextURLContextURL = FieldInfo(alias="contextUrl") - - -class ProjectInitializerSpecGitGit(BaseModel): - checkout_location: Optional[str] = FieldInfo(alias="checkoutLocation", default=None) - """ - a path relative to the environment root in which the code will be checked out to - """ - - clone_target: Optional[str] = FieldInfo(alias="cloneTarget", default=None) - """the value for the clone target mode - use depends on the target mode""" - - remote_uri: Optional[str] = FieldInfo(alias="remoteUri", default=None) - """remote_uri is the Git remote origin""" - - target_mode: Optional[ - Literal[ - "CLONE_TARGET_MODE_UNSPECIFIED", - "CLONE_TARGET_MODE_REMOTE_HEAD", - "CLONE_TARGET_MODE_REMOTE_COMMIT", - "CLONE_TARGET_MODE_REMOTE_BRANCH", - "CLONE_TARGET_MODE_LOCAL_BRANCH", - ] - ] = FieldInfo(alias="targetMode", default=None) - """CloneTargetMode is the target state in which we want to leave a GitEnvironment""" - - upstream_remote_uri: Optional[str] = FieldInfo(alias="upstreamRemoteUri", default=None) - """upstream_Remote_uri is the fork upstream of a repository""" - - -class ProjectInitializerSpecGit(BaseModel): - git: ProjectInitializerSpecGitGit - - -ProjectInitializerSpec: TypeAlias = Union[ProjectInitializerSpecContextURL, ProjectInitializerSpecGit] - - -class ProjectInitializer(BaseModel): - specs: Optional[List[ProjectInitializerSpec]] = None - - -class ProjectMetadataCreator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class ProjectMetadata(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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - creator: Optional[ProjectMetadataCreator] = None - """creator is the identity of the project creator""" - - name: Optional[str] = None - """name is the human readable name of the project""" - - organization_id: Optional[str] = FieldInfo(alias="organizationId", default=None) - """organization_id is the ID of the organization that contains the environment""" - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - -class ProjectUsedBySubject(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class ProjectUsedBy(BaseModel): - subjects: Optional[List[ProjectUsedBySubject]] = None - """ - Subjects are the 10 most recent subjects who have used the project to create an - environment - """ - - total_subjects: Optional[int] = FieldInfo(alias="totalSubjects", default=None) - """Total number of unique subjects who have used the project""" - - -class Project(BaseModel): - environment_class: ProjectEnvironmentClass = FieldInfo(alias="environmentClass") - - id: Optional[str] = None - """id is the unique identifier for the project""" - - automations_file_path: Optional[str] = FieldInfo(alias="automationsFilePath", default=None) - """ - automations_file_path is the path to the automations file relative to the repo - root - """ - - devcontainer_file_path: Optional[str] = FieldInfo(alias="devcontainerFilePath", default=None) - """ - devcontainer_file_path is the path to the devcontainer file relative to the repo - root - """ - - initializer: Optional[ProjectInitializer] = None - """EnvironmentInitializer specifies how an environment is to be initialized""" - - metadata: Optional[ProjectMetadata] = None - - used_by: Optional[ProjectUsedBy] = FieldInfo(alias="usedBy", default=None) +__all__ = ["ProjectCreateResponse"] class ProjectCreateResponse(BaseModel): diff --git a/src/gitpod/types/project_environment_class.py b/src/gitpod/types/project_environment_class.py new file mode 100644 index 0000000..a969845 --- /dev/null +++ b/src/gitpod/types/project_environment_class.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["ProjectEnvironmentClass"] + + +class ProjectEnvironmentClass(BaseModel): + environment_class_id: Optional[str] = FieldInfo(alias="environmentClassId", default=None) + """Use a fixed environment class on a given Runner. + + This cannot be a local runner's environment class. + """ + + local_runner: Optional[bool] = FieldInfo(alias="localRunner", default=None) + """Use a local runner for the user""" diff --git a/src/gitpod/types/project_environment_class_param.py b/src/gitpod/types/project_environment_class_param.py new file mode 100644 index 0000000..c6e2918 --- /dev/null +++ b/src/gitpod/types/project_environment_class_param.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["ProjectEnvironmentClassParam"] + + +class ProjectEnvironmentClassParam(TypedDict, total=False): + environment_class_id: Annotated[str, PropertyInfo(alias="environmentClassId")] + """Use a fixed environment class on a given Runner. + + This cannot be a local runner's environment class. + """ + + local_runner: Annotated[bool, PropertyInfo(alias="localRunner")] + """Use a local runner for the user""" diff --git a/src/gitpod/types/project_list_response.py b/src/gitpod/types/project_metadata.py similarity index 63% rename from src/gitpod/types/project_list_response.py rename to src/gitpod/types/project_metadata.py index 8f42ed7..5a39bda 100644 --- a/src/gitpod/types/project_list_response.py +++ b/src/gitpod/types/project_metadata.py @@ -1,115 +1,17 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import Optional from datetime import datetime -from typing_extensions import Literal, TypeAlias from pydantic import Field as FieldInfo from .._models import BaseModel +from .shared.subject import Subject -__all__ = [ - "ProjectListResponse", - "EnvironmentClass", - "EnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass", - "EnvironmentClassUseALocalRunnerForTheUser", - "Initializer", - "InitializerSpec", - "InitializerSpecContextURL", - "InitializerSpecContextURLContextURL", - "InitializerSpecGit", - "InitializerSpecGitGit", - "Metadata", - "MetadataCreator", - "UsedBy", - "UsedBySubject", -] - - -class EnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass(BaseModel): - environment_class_id: str = FieldInfo(alias="environmentClassId") - """Use a fixed environment class on a given Runner. - - This cannot be a local runner's environment class. - """ - - -class EnvironmentClassUseALocalRunnerForTheUser(BaseModel): - local_runner: bool = FieldInfo(alias="localRunner") - """Use a local runner for the user""" - - -EnvironmentClass: TypeAlias = Union[ - EnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass, - EnvironmentClassUseALocalRunnerForTheUser, -] - - -class InitializerSpecContextURLContextURL(BaseModel): - url: Optional[str] = None - """url is the URL from which the environment is created""" - - -class InitializerSpecContextURL(BaseModel): - context_url: InitializerSpecContextURLContextURL = FieldInfo(alias="contextUrl") - - -class InitializerSpecGitGit(BaseModel): - checkout_location: Optional[str] = FieldInfo(alias="checkoutLocation", default=None) - """ - a path relative to the environment root in which the code will be checked out to - """ - - clone_target: Optional[str] = FieldInfo(alias="cloneTarget", default=None) - """the value for the clone target mode - use depends on the target mode""" - - remote_uri: Optional[str] = FieldInfo(alias="remoteUri", default=None) - """remote_uri is the Git remote origin""" - - target_mode: Optional[ - Literal[ - "CLONE_TARGET_MODE_UNSPECIFIED", - "CLONE_TARGET_MODE_REMOTE_HEAD", - "CLONE_TARGET_MODE_REMOTE_COMMIT", - "CLONE_TARGET_MODE_REMOTE_BRANCH", - "CLONE_TARGET_MODE_LOCAL_BRANCH", - ] - ] = FieldInfo(alias="targetMode", default=None) - """CloneTargetMode is the target state in which we want to leave a GitEnvironment""" - - upstream_remote_uri: Optional[str] = FieldInfo(alias="upstreamRemoteUri", default=None) - """upstream_Remote_uri is the fork upstream of a repository""" - - -class InitializerSpecGit(BaseModel): - git: InitializerSpecGitGit - - -InitializerSpec: TypeAlias = Union[InitializerSpecContextURL, InitializerSpecGit] - - -class Initializer(BaseModel): - specs: Optional[List[InitializerSpec]] = None +__all__ = ["ProjectMetadata"] -class MetadataCreator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class Metadata(BaseModel): +class ProjectMetadata(BaseModel): created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) """ A Timestamp represents a point in time independent of any time zone or local @@ -202,7 +104,7 @@ class Metadata(BaseModel): to obtain a formatter capable of generating timestamps in this format. """ - creator: Optional[MetadataCreator] = None + creator: Optional[Subject] = None """creator is the identity of the project creator""" name: Optional[str] = None @@ -302,57 +204,3 @@ class Metadata(BaseModel): [`ISODateTimeFormat.dateTime()`]() to obtain a formatter capable of generating timestamps in this format. """ - - -class UsedBySubject(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class UsedBy(BaseModel): - subjects: Optional[List[UsedBySubject]] = None - """ - Subjects are the 10 most recent subjects who have used the project to create an - environment - """ - - total_subjects: Optional[int] = FieldInfo(alias="totalSubjects", default=None) - """Total number of unique subjects who have used the project""" - - -class ProjectListResponse(BaseModel): - environment_class: EnvironmentClass = FieldInfo(alias="environmentClass") - - id: Optional[str] = None - """id is the unique identifier for the project""" - - automations_file_path: Optional[str] = FieldInfo(alias="automationsFilePath", default=None) - """ - automations_file_path is the path to the automations file relative to the repo - root - """ - - devcontainer_file_path: Optional[str] = FieldInfo(alias="devcontainerFilePath", default=None) - """ - devcontainer_file_path is the path to the devcontainer file relative to the repo - root - """ - - initializer: Optional[Initializer] = None - """EnvironmentInitializer specifies how an environment is to be initialized""" - - metadata: Optional[Metadata] = None - - used_by: Optional[UsedBy] = FieldInfo(alias="usedBy", default=None) diff --git a/src/gitpod/types/project_retrieve_response.py b/src/gitpod/types/project_retrieve_response.py index 788d1eb..066a721 100644 --- a/src/gitpod/types/project_retrieve_response.py +++ b/src/gitpod/types/project_retrieve_response.py @@ -1,364 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias - -from pydantic import Field as FieldInfo +from typing import Optional +from .project import Project from .._models import BaseModel -__all__ = [ - "ProjectRetrieveResponse", - "Project", - "ProjectEnvironmentClass", - "ProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass", - "ProjectEnvironmentClassUseALocalRunnerForTheUser", - "ProjectInitializer", - "ProjectInitializerSpec", - "ProjectInitializerSpecContextURL", - "ProjectInitializerSpecContextURLContextURL", - "ProjectInitializerSpecGit", - "ProjectInitializerSpecGitGit", - "ProjectMetadata", - "ProjectMetadataCreator", - "ProjectUsedBy", - "ProjectUsedBySubject", -] - - -class ProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass( - BaseModel -): - environment_class_id: str = FieldInfo(alias="environmentClassId") - """Use a fixed environment class on a given Runner. - - This cannot be a local runner's environment class. - """ - - -class ProjectEnvironmentClassUseALocalRunnerForTheUser(BaseModel): - local_runner: bool = FieldInfo(alias="localRunner") - """Use a local runner for the user""" - - -ProjectEnvironmentClass: TypeAlias = Union[ - ProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass, - ProjectEnvironmentClassUseALocalRunnerForTheUser, -] - - -class ProjectInitializerSpecContextURLContextURL(BaseModel): - url: Optional[str] = None - """url is the URL from which the environment is created""" - - -class ProjectInitializerSpecContextURL(BaseModel): - context_url: ProjectInitializerSpecContextURLContextURL = FieldInfo(alias="contextUrl") - - -class ProjectInitializerSpecGitGit(BaseModel): - checkout_location: Optional[str] = FieldInfo(alias="checkoutLocation", default=None) - """ - a path relative to the environment root in which the code will be checked out to - """ - - clone_target: Optional[str] = FieldInfo(alias="cloneTarget", default=None) - """the value for the clone target mode - use depends on the target mode""" - - remote_uri: Optional[str] = FieldInfo(alias="remoteUri", default=None) - """remote_uri is the Git remote origin""" - - target_mode: Optional[ - Literal[ - "CLONE_TARGET_MODE_UNSPECIFIED", - "CLONE_TARGET_MODE_REMOTE_HEAD", - "CLONE_TARGET_MODE_REMOTE_COMMIT", - "CLONE_TARGET_MODE_REMOTE_BRANCH", - "CLONE_TARGET_MODE_LOCAL_BRANCH", - ] - ] = FieldInfo(alias="targetMode", default=None) - """CloneTargetMode is the target state in which we want to leave a GitEnvironment""" - - upstream_remote_uri: Optional[str] = FieldInfo(alias="upstreamRemoteUri", default=None) - """upstream_Remote_uri is the fork upstream of a repository""" - - -class ProjectInitializerSpecGit(BaseModel): - git: ProjectInitializerSpecGitGit - - -ProjectInitializerSpec: TypeAlias = Union[ProjectInitializerSpecContextURL, ProjectInitializerSpecGit] - - -class ProjectInitializer(BaseModel): - specs: Optional[List[ProjectInitializerSpec]] = None - - -class ProjectMetadataCreator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class ProjectMetadata(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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - creator: Optional[ProjectMetadataCreator] = None - """creator is the identity of the project creator""" - - name: Optional[str] = None - """name is the human readable name of the project""" - - organization_id: Optional[str] = FieldInfo(alias="organizationId", default=None) - """organization_id is the ID of the organization that contains the environment""" - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - -class ProjectUsedBySubject(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class ProjectUsedBy(BaseModel): - subjects: Optional[List[ProjectUsedBySubject]] = None - """ - Subjects are the 10 most recent subjects who have used the project to create an - environment - """ - - total_subjects: Optional[int] = FieldInfo(alias="totalSubjects", default=None) - """Total number of unique subjects who have used the project""" - - -class Project(BaseModel): - environment_class: ProjectEnvironmentClass = FieldInfo(alias="environmentClass") - - id: Optional[str] = None - """id is the unique identifier for the project""" - - automations_file_path: Optional[str] = FieldInfo(alias="automationsFilePath", default=None) - """ - automations_file_path is the path to the automations file relative to the repo - root - """ - - devcontainer_file_path: Optional[str] = FieldInfo(alias="devcontainerFilePath", default=None) - """ - devcontainer_file_path is the path to the devcontainer file relative to the repo - root - """ - - initializer: Optional[ProjectInitializer] = None - """EnvironmentInitializer specifies how an environment is to be initialized""" - - metadata: Optional[ProjectMetadata] = None - - used_by: Optional[ProjectUsedBy] = FieldInfo(alias="usedBy", default=None) +__all__ = ["ProjectRetrieveResponse"] class ProjectRetrieveResponse(BaseModel): diff --git a/src/gitpod/types/project_update_params.py b/src/gitpod/types/project_update_params.py index e826452..c22d35e 100644 --- a/src/gitpod/types/project_update_params.py +++ b/src/gitpod/types/project_update_params.py @@ -2,32 +2,18 @@ from __future__ import annotations -from typing import Union, Iterable -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing import Optional +from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo +from .environment_initializer_param import EnvironmentInitializerParam +from .project_environment_class_param import ProjectEnvironmentClassParam -__all__ = [ - "ProjectUpdateParams", - "AutomationsFilePathIsThePathToTheAutomationsFileRelativeToTheRepoRoot", - "DevcontainerFilePathIsThePathToTheDevcontainerFileRelativeToTheRepoRoot", - "Variant2", - "Variant2EnvironmentClass", - "Variant2EnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass", - "Variant2EnvironmentClassUseALocalRunnerForTheUser", - "InitializerIsTheContentInitializer", - "InitializerIsTheContentInitializerInitializer", - "InitializerIsTheContentInitializerInitializerSpec", - "InitializerIsTheContentInitializerInitializerSpecContextURL", - "InitializerIsTheContentInitializerInitializerSpecContextURLContextURL", - "InitializerIsTheContentInitializerInitializerSpecGit", - "InitializerIsTheContentInitializerInitializerSpecGitGit", - "Variant4", -] +__all__ = ["ProjectUpdateParams"] -class AutomationsFilePathIsThePathToTheAutomationsFileRelativeToTheRepoRoot(TypedDict, total=False): - automations_file_path: Required[Annotated[str, PropertyInfo(alias="automationsFilePath")]] +class ProjectUpdateParams(TypedDict, total=False): + automations_file_path: Annotated[Optional[str], PropertyInfo(alias="automationsFilePath")] """ automations_file_path is the path to the automations file relative to the repo root path must not be absolute (start with a /): @@ -37,9 +23,7 @@ class AutomationsFilePathIsThePathToTheAutomationsFileRelativeToTheRepoRoot(Type ``` """ - -class DevcontainerFilePathIsThePathToTheDevcontainerFileRelativeToTheRepoRoot(TypedDict, total=False): - devcontainer_file_path: Required[Annotated[str, PropertyInfo(alias="devcontainerFilePath")]] + devcontainer_file_path: Annotated[Optional[str], PropertyInfo(alias="devcontainerFilePath")] """ devcontainer_file_path is the path to the devcontainer file relative to the repo root path must not be absolute (start with a /): @@ -49,99 +33,12 @@ class DevcontainerFilePathIsThePathToTheDevcontainerFileRelativeToTheRepoRoot(Ty ``` """ + environment_class: Annotated[Optional[ProjectEnvironmentClassParam], PropertyInfo(alias="environmentClass")] -class Variant2(TypedDict, total=False): - environment_class: Required[Annotated[Variant2EnvironmentClass, PropertyInfo(alias="environmentClass")]] - - -class Variant2EnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass( - TypedDict, total=False -): - environment_class_id: Required[Annotated[str, PropertyInfo(alias="environmentClassId")]] - """Use a fixed environment class on a given Runner. - - This cannot be a local runner's environment class. - """ - - -class Variant2EnvironmentClassUseALocalRunnerForTheUser(TypedDict, total=False): - local_runner: Required[Annotated[bool, PropertyInfo(alias="localRunner")]] - """Use a local runner for the user""" - - -Variant2EnvironmentClass: TypeAlias = Union[ - Variant2EnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass, - Variant2EnvironmentClassUseALocalRunnerForTheUser, -] - - -class InitializerIsTheContentInitializer(TypedDict, total=False): - initializer: Required[InitializerIsTheContentInitializerInitializer] + initializer: Optional[EnvironmentInitializerParam] """EnvironmentInitializer specifies how an environment is to be initialized""" + name: Optional[str] -class InitializerIsTheContentInitializerInitializerSpecContextURLContextURL(TypedDict, total=False): - url: str - """url is the URL from which the environment is created""" - - -class InitializerIsTheContentInitializerInitializerSpecContextURL(TypedDict, total=False): - context_url: Required[ - Annotated[ - InitializerIsTheContentInitializerInitializerSpecContextURLContextURL, PropertyInfo(alias="contextUrl") - ] - ] - - -class InitializerIsTheContentInitializerInitializerSpecGitGit(TypedDict, total=False): - checkout_location: Annotated[str, PropertyInfo(alias="checkoutLocation")] - """ - a path relative to the environment root in which the code will be checked out to - """ - - clone_target: Annotated[str, PropertyInfo(alias="cloneTarget")] - """the value for the clone target mode - use depends on the target mode""" - - remote_uri: Annotated[str, PropertyInfo(alias="remoteUri")] - """remote_uri is the Git remote origin""" - - target_mode: Annotated[ - Literal[ - "CLONE_TARGET_MODE_UNSPECIFIED", - "CLONE_TARGET_MODE_REMOTE_HEAD", - "CLONE_TARGET_MODE_REMOTE_COMMIT", - "CLONE_TARGET_MODE_REMOTE_BRANCH", - "CLONE_TARGET_MODE_LOCAL_BRANCH", - ], - PropertyInfo(alias="targetMode"), - ] - """CloneTargetMode is the target state in which we want to leave a GitEnvironment""" - - upstream_remote_uri: Annotated[str, PropertyInfo(alias="upstreamRemoteUri")] - """upstream_Remote_uri is the fork upstream of a repository""" - - -class InitializerIsTheContentInitializerInitializerSpecGit(TypedDict, total=False): - git: Required[InitializerIsTheContentInitializerInitializerSpecGitGit] - - -InitializerIsTheContentInitializerInitializerSpec: TypeAlias = Union[ - InitializerIsTheContentInitializerInitializerSpecContextURL, InitializerIsTheContentInitializerInitializerSpecGit -] - - -class InitializerIsTheContentInitializerInitializer(TypedDict, total=False): - specs: Iterable[InitializerIsTheContentInitializerInitializerSpec] - - -class Variant4(TypedDict, total=False): - name: Required[str] - - -ProjectUpdateParams: TypeAlias = Union[ - AutomationsFilePathIsThePathToTheAutomationsFileRelativeToTheRepoRoot, - DevcontainerFilePathIsThePathToTheDevcontainerFileRelativeToTheRepoRoot, - Variant2, - InitializerIsTheContentInitializer, - Variant4, -] + project_id: Annotated[str, PropertyInfo(alias="projectId")] + """project_id specifies the project identifier""" diff --git a/src/gitpod/types/project_update_response.py b/src/gitpod/types/project_update_response.py index c01a502..b426723 100644 --- a/src/gitpod/types/project_update_response.py +++ b/src/gitpod/types/project_update_response.py @@ -1,364 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias - -from pydantic import Field as FieldInfo +from typing import Optional +from .project import Project from .._models import BaseModel -__all__ = [ - "ProjectUpdateResponse", - "Project", - "ProjectEnvironmentClass", - "ProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass", - "ProjectEnvironmentClassUseALocalRunnerForTheUser", - "ProjectInitializer", - "ProjectInitializerSpec", - "ProjectInitializerSpecContextURL", - "ProjectInitializerSpecContextURLContextURL", - "ProjectInitializerSpecGit", - "ProjectInitializerSpecGitGit", - "ProjectMetadata", - "ProjectMetadataCreator", - "ProjectUsedBy", - "ProjectUsedBySubject", -] - - -class ProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass( - BaseModel -): - environment_class_id: str = FieldInfo(alias="environmentClassId") - """Use a fixed environment class on a given Runner. - - This cannot be a local runner's environment class. - """ - - -class ProjectEnvironmentClassUseALocalRunnerForTheUser(BaseModel): - local_runner: bool = FieldInfo(alias="localRunner") - """Use a local runner for the user""" - - -ProjectEnvironmentClass: TypeAlias = Union[ - ProjectEnvironmentClassUseAFixedEnvironmentClassOnAGivenRunnerThisCannotBeALocalRunnerSEnvironmentClass, - ProjectEnvironmentClassUseALocalRunnerForTheUser, -] - - -class ProjectInitializerSpecContextURLContextURL(BaseModel): - url: Optional[str] = None - """url is the URL from which the environment is created""" - - -class ProjectInitializerSpecContextURL(BaseModel): - context_url: ProjectInitializerSpecContextURLContextURL = FieldInfo(alias="contextUrl") - - -class ProjectInitializerSpecGitGit(BaseModel): - checkout_location: Optional[str] = FieldInfo(alias="checkoutLocation", default=None) - """ - a path relative to the environment root in which the code will be checked out to - """ - - clone_target: Optional[str] = FieldInfo(alias="cloneTarget", default=None) - """the value for the clone target mode - use depends on the target mode""" - - remote_uri: Optional[str] = FieldInfo(alias="remoteUri", default=None) - """remote_uri is the Git remote origin""" - - target_mode: Optional[ - Literal[ - "CLONE_TARGET_MODE_UNSPECIFIED", - "CLONE_TARGET_MODE_REMOTE_HEAD", - "CLONE_TARGET_MODE_REMOTE_COMMIT", - "CLONE_TARGET_MODE_REMOTE_BRANCH", - "CLONE_TARGET_MODE_LOCAL_BRANCH", - ] - ] = FieldInfo(alias="targetMode", default=None) - """CloneTargetMode is the target state in which we want to leave a GitEnvironment""" - - upstream_remote_uri: Optional[str] = FieldInfo(alias="upstreamRemoteUri", default=None) - """upstream_Remote_uri is the fork upstream of a repository""" - - -class ProjectInitializerSpecGit(BaseModel): - git: ProjectInitializerSpecGitGit - - -ProjectInitializerSpec: TypeAlias = Union[ProjectInitializerSpecContextURL, ProjectInitializerSpecGit] - - -class ProjectInitializer(BaseModel): - specs: Optional[List[ProjectInitializerSpec]] = None - - -class ProjectMetadataCreator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class ProjectMetadata(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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - creator: Optional[ProjectMetadataCreator] = None - """creator is the identity of the project creator""" - - name: Optional[str] = None - """name is the human readable name of the project""" - - organization_id: Optional[str] = FieldInfo(alias="organizationId", default=None) - """organization_id is the ID of the organization that contains the environment""" - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - -class ProjectUsedBySubject(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class ProjectUsedBy(BaseModel): - subjects: Optional[List[ProjectUsedBySubject]] = None - """ - Subjects are the 10 most recent subjects who have used the project to create an - environment - """ - - total_subjects: Optional[int] = FieldInfo(alias="totalSubjects", default=None) - """Total number of unique subjects who have used the project""" - - -class Project(BaseModel): - environment_class: ProjectEnvironmentClass = FieldInfo(alias="environmentClass") - - id: Optional[str] = None - """id is the unique identifier for the project""" - - automations_file_path: Optional[str] = FieldInfo(alias="automationsFilePath", default=None) - """ - automations_file_path is the path to the automations file relative to the repo - root - """ - - devcontainer_file_path: Optional[str] = FieldInfo(alias="devcontainerFilePath", default=None) - """ - devcontainer_file_path is the path to the devcontainer file relative to the repo - root - """ - - initializer: Optional[ProjectInitializer] = None - """EnvironmentInitializer specifies how an environment is to be initialized""" - - metadata: Optional[ProjectMetadata] = None - - used_by: Optional[ProjectUsedBy] = FieldInfo(alias="usedBy", default=None) +__all__ = ["ProjectUpdateResponse"] class ProjectUpdateResponse(BaseModel): diff --git a/src/gitpod/types/projects/__init__.py b/src/gitpod/types/projects/__init__.py index 7bea3a6..f6f8d0b 100644 --- a/src/gitpod/types/projects/__init__.py +++ b/src/gitpod/types/projects/__init__.py @@ -2,10 +2,11 @@ from __future__ import annotations +from .project_role import ProjectRole as ProjectRole +from .project_policy import ProjectPolicy as ProjectPolicy from .policy_list_params import PolicyListParams as PolicyListParams from .policy_create_params import PolicyCreateParams as PolicyCreateParams from .policy_delete_params import PolicyDeleteParams as PolicyDeleteParams -from .policy_list_response import PolicyListResponse as PolicyListResponse from .policy_update_params import PolicyUpdateParams as PolicyUpdateParams from .policy_create_response import PolicyCreateResponse as PolicyCreateResponse from .policy_update_response import PolicyUpdateResponse as PolicyUpdateResponse diff --git a/src/gitpod/types/projects/policy_create_params.py b/src/gitpod/types/projects/policy_create_params.py index fb0bdf2..1b72ad6 100644 --- a/src/gitpod/types/projects/policy_create_params.py +++ b/src/gitpod/types/projects/policy_create_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing_extensions import Literal, Annotated, TypedDict +from typing_extensions import Annotated, TypedDict from ..._utils import PropertyInfo +from .project_role import ProjectRole __all__ = ["PolicyCreateParams"] @@ -16,4 +17,4 @@ class PolicyCreateParams(TypedDict, total=False): project_id: Annotated[str, PropertyInfo(alias="projectId")] """project_id specifies the project identifier""" - role: Literal["PROJECT_ROLE_UNSPECIFIED", "PROJECT_ROLE_ADMIN", "PROJECT_ROLE_USER"] + role: ProjectRole diff --git a/src/gitpod/types/projects/policy_create_response.py b/src/gitpod/types/projects/policy_create_response.py index 217faeb..0d79a48 100644 --- a/src/gitpod/types/projects/policy_create_response.py +++ b/src/gitpod/types/projects/policy_create_response.py @@ -1,21 +1,12 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo from ..._models import BaseModel +from .project_policy import ProjectPolicy -__all__ = ["PolicyCreateResponse", "Policy"] - - -class Policy(BaseModel): - group_id: Optional[str] = FieldInfo(alias="groupId", default=None) - - role: Optional[Literal["PROJECT_ROLE_UNSPECIFIED", "PROJECT_ROLE_ADMIN", "PROJECT_ROLE_USER"]] = None - """role is the role assigned to the group""" +__all__ = ["PolicyCreateResponse"] class PolicyCreateResponse(BaseModel): - policy: Optional[Policy] = None + policy: Optional[ProjectPolicy] = None diff --git a/src/gitpod/types/projects/policy_update_params.py b/src/gitpod/types/projects/policy_update_params.py index e9b4348..c53cb50 100644 --- a/src/gitpod/types/projects/policy_update_params.py +++ b/src/gitpod/types/projects/policy_update_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing_extensions import Literal, Annotated, TypedDict +from typing_extensions import Annotated, TypedDict from ..._utils import PropertyInfo +from .project_role import ProjectRole __all__ = ["PolicyUpdateParams"] @@ -16,4 +17,4 @@ class PolicyUpdateParams(TypedDict, total=False): project_id: Annotated[str, PropertyInfo(alias="projectId")] """project_id specifies the project identifier""" - role: Literal["PROJECT_ROLE_UNSPECIFIED", "PROJECT_ROLE_ADMIN", "PROJECT_ROLE_USER"] + role: ProjectRole diff --git a/src/gitpod/types/projects/policy_update_response.py b/src/gitpod/types/projects/policy_update_response.py index 5a5a9c8..96b4cce 100644 --- a/src/gitpod/types/projects/policy_update_response.py +++ b/src/gitpod/types/projects/policy_update_response.py @@ -1,21 +1,12 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo from ..._models import BaseModel +from .project_policy import ProjectPolicy -__all__ = ["PolicyUpdateResponse", "Policy"] - - -class Policy(BaseModel): - group_id: Optional[str] = FieldInfo(alias="groupId", default=None) - - role: Optional[Literal["PROJECT_ROLE_UNSPECIFIED", "PROJECT_ROLE_ADMIN", "PROJECT_ROLE_USER"]] = None - """role is the role assigned to the group""" +__all__ = ["PolicyUpdateResponse"] class PolicyUpdateResponse(BaseModel): - policy: Optional[Policy] = None + policy: Optional[ProjectPolicy] = None diff --git a/src/gitpod/types/runners/policy_list_response.py b/src/gitpod/types/projects/project_policy.py similarity index 59% rename from src/gitpod/types/runners/policy_list_response.py rename to src/gitpod/types/projects/project_policy.py index e69b114..dfeb4e9 100644 --- a/src/gitpod/types/runners/policy_list_response.py +++ b/src/gitpod/types/projects/project_policy.py @@ -1,17 +1,17 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional -from typing_extensions import Literal from pydantic import Field as FieldInfo from ..._models import BaseModel +from .project_role import ProjectRole -__all__ = ["PolicyListResponse"] +__all__ = ["ProjectPolicy"] -class PolicyListResponse(BaseModel): +class ProjectPolicy(BaseModel): group_id: Optional[str] = FieldInfo(alias="groupId", default=None) - role: Optional[Literal["RUNNER_ROLE_UNSPECIFIED", "RUNNER_ROLE_ADMIN", "RUNNER_ROLE_USER"]] = None + role: Optional[ProjectRole] = None """role is the role assigned to the group""" diff --git a/src/gitpod/types/projects/project_role.py b/src/gitpod/types/projects/project_role.py new file mode 100644 index 0000000..b2a6261 --- /dev/null +++ b/src/gitpod/types/projects/project_role.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["ProjectRole"] + +ProjectRole: TypeAlias = Literal["PROJECT_ROLE_UNSPECIFIED", "PROJECT_ROLE_ADMIN", "PROJECT_ROLE_USER"] diff --git a/src/gitpod/types/resource_operation.py b/src/gitpod/types/resource_operation.py new file mode 100644 index 0000000..3527c79 --- /dev/null +++ b/src/gitpod/types/resource_operation.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["ResourceOperation"] + +ResourceOperation: TypeAlias = Literal[ + "RESOURCE_OPERATION_UNSPECIFIED", + "RESOURCE_OPERATION_CREATE", + "RESOURCE_OPERATION_UPDATE", + "RESOURCE_OPERATION_DELETE", + "RESOURCE_OPERATION_UPDATE_STATUS", +] diff --git a/src/gitpod/types/resource_type.py b/src/gitpod/types/resource_type.py new file mode 100644 index 0000000..c34eaea --- /dev/null +++ b/src/gitpod/types/resource_type.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["ResourceType"] + +ResourceType: TypeAlias = Literal[ + "RESOURCE_TYPE_UNSPECIFIED", + "RESOURCE_TYPE_ENVIRONMENT", + "RESOURCE_TYPE_RUNNER", + "RESOURCE_TYPE_PROJECT", + "RESOURCE_TYPE_TASK", + "RESOURCE_TYPE_TASK_EXECUTION", + "RESOURCE_TYPE_SERVICE", + "RESOURCE_TYPE_ORGANIZATION", + "RESOURCE_TYPE_USER", + "RESOURCE_TYPE_ENVIRONMENT_CLASS", + "RESOURCE_TYPE_RUNNER_SCM_INTEGRATION", + "RESOURCE_TYPE_HOST_AUTHENTICATION_TOKEN", + "RESOURCE_TYPE_GROUP", + "RESOURCE_TYPE_PERSONAL_ACCESS_TOKEN", + "RESOURCE_TYPE_USER_PREFERENCE", + "RESOURCE_TYPE_SERVICE_ACCOUNT", + "RESOURCE_TYPE_SECRET", + "RESOURCE_TYPE_SSO_CONFIG", +] diff --git a/src/gitpod/types/runner.py b/src/gitpod/types/runner.py new file mode 100644 index 0000000..505ab36 --- /dev/null +++ b/src/gitpod/types/runner.py @@ -0,0 +1,225 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .runner_kind import RunnerKind +from .runner_spec import RunnerSpec +from .runner_status import RunnerStatus +from .shared.subject import Subject +from .runner_provider import RunnerProvider + +__all__ = ["Runner"] + + +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()`]() + to obtain a formatter capable of generating timestamps in this format. + """ + + 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""" + + 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. + """ + + runner_id: Optional[str] = FieldInfo(alias="runnerId", default=None) + + spec: Optional[RunnerSpec] = None + """The runner's specification""" + + status: Optional[RunnerStatus] = None + """RunnerStatus represents the status of a runner""" + + 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()`]() + to obtain a formatter capable of generating timestamps in this format. + """ diff --git a/src/gitpod/types/runner_capability.py b/src/gitpod/types/runner_capability.py new file mode 100644 index 0000000..256e893 --- /dev/null +++ b/src/gitpod/types/runner_capability.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["RunnerCapability"] + +RunnerCapability: TypeAlias = Literal["RUNNER_CAPABILITY_UNSPECIFIED", "RUNNER_CAPABILITY_FETCH_LOCAL_SCM_INTEGRATIONS"] diff --git a/src/gitpod/types/runner_configuration.py b/src/gitpod/types/runner_configuration.py new file mode 100644 index 0000000..ebb3336 --- /dev/null +++ b/src/gitpod/types/runner_configuration.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .runner_release_channel import RunnerReleaseChannel + +__all__ = ["RunnerConfiguration"] + + +class RunnerConfiguration(BaseModel): + auto_update: Optional[bool] = FieldInfo(alias="autoUpdate", default=None) + """auto_update indicates whether the runner should automatically update itself.""" + + region: Optional[str] = None + """ + Region to deploy the runner in, if applicable. This is mainly used for remote + runners, and is only a hint. The runner may be deployed in a different region. + See the runner's status for the actual region. + """ + + release_channel: Optional[RunnerReleaseChannel] = FieldInfo(alias="releaseChannel", default=None) + """The release channel the runner is on""" diff --git a/src/gitpod/types/runner_configuration_param.py b/src/gitpod/types/runner_configuration_param.py new file mode 100644 index 0000000..3f3b95b --- /dev/null +++ b/src/gitpod/types/runner_configuration_param.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Annotated, TypedDict + +from .._utils import PropertyInfo +from .runner_release_channel import RunnerReleaseChannel + +__all__ = ["RunnerConfigurationParam"] + + +class RunnerConfigurationParam(TypedDict, total=False): + auto_update: Annotated[bool, PropertyInfo(alias="autoUpdate")] + """auto_update indicates whether the runner should automatically update itself.""" + + region: str + """ + Region to deploy the runner in, if applicable. This is mainly used for remote + runners, and is only a hint. The runner may be deployed in a different region. + See the runner's status for the actual region. + """ + + release_channel: Annotated[RunnerReleaseChannel, PropertyInfo(alias="releaseChannel")] + """The release channel the runner is on""" diff --git a/src/gitpod/types/runner_create_params.py b/src/gitpod/types/runner_create_params.py index 787f46b..fc5580f 100644 --- a/src/gitpod/types/runner_create_params.py +++ b/src/gitpod/types/runner_create_params.py @@ -2,69 +2,27 @@ from __future__ import annotations -from typing_extensions import Literal, Annotated, TypedDict +from typing_extensions import TypedDict -from .._utils import PropertyInfo +from .runner_kind import RunnerKind +from .runner_provider import RunnerProvider +from .runner_spec_param import RunnerSpecParam -__all__ = ["RunnerCreateParams", "Spec", "SpecConfiguration"] +__all__ = ["RunnerCreateParams"] class RunnerCreateParams(TypedDict, total=False): - kind: Literal[ - "RUNNER_KIND_UNSPECIFIED", "RUNNER_KIND_LOCAL", "RUNNER_KIND_REMOTE", "RUNNER_KIND_LOCAL_CONFIGURATION" - ] + kind: RunnerKind """RunnerKind represents the kind of a runner""" name: str """The runner name for humans""" - provider: Literal[ - "RUNNER_PROVIDER_UNSPECIFIED", - "RUNNER_PROVIDER_AWS_EC2", - "RUNNER_PROVIDER_LINUX_HOST", - "RUNNER_PROVIDER_DESKTOP_MAC", - ] + 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. """ - spec: Spec - - -class SpecConfiguration(TypedDict, total=False): - auto_update: Annotated[bool, PropertyInfo(alias="autoUpdate")] - """auto_update indicates whether the runner should automatically update itself.""" - - region: str - """ - Region to deploy the runner in, if applicable. This is mainly used for remote - runners, and is only a hint. The runner may be deployed in a different region. - See the runner's status for the actual region. - """ - - release_channel: Annotated[ - Literal["RUNNER_RELEASE_CHANNEL_UNSPECIFIED", "RUNNER_RELEASE_CHANNEL_STABLE", "RUNNER_RELEASE_CHANNEL_LATEST"], - PropertyInfo(alias="releaseChannel"), - ] - """The release channel the runner is on""" - - -class Spec(TypedDict, total=False): - configuration: SpecConfiguration - """The runner's configuration""" - - desired_phase: Annotated[ - Literal[ - "RUNNER_PHASE_UNSPECIFIED", - "RUNNER_PHASE_CREATED", - "RUNNER_PHASE_INACTIVE", - "RUNNER_PHASE_ACTIVE", - "RUNNER_PHASE_DELETING", - "RUNNER_PHASE_DELETED", - "RUNNER_PHASE_DEGRADED", - ], - PropertyInfo(alias="desiredPhase"), - ] - """RunnerPhase represents the phase a runner is in""" + spec: RunnerSpecParam diff --git a/src/gitpod/types/runner_create_response.py b/src/gitpod/types/runner_create_response.py index 35c8678..7a2bbd4 100644 --- a/src/gitpod/types/runner_create_response.py +++ b/src/gitpod/types/runner_create_response.py @@ -1,435 +1,24 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal +from typing import Optional from pydantic import Field as FieldInfo +from .runner import Runner from .._models import BaseModel -__all__ = [ - "RunnerCreateResponse", - "Runner", - "RunnerCreator", - "RunnerSpec", - "RunnerSpecConfiguration", - "RunnerStatus", - "RunnerStatusAdditionalInfo", -] +__all__ = ["RunnerCreateResponse"] -class RunnerCreator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class RunnerSpecConfiguration(BaseModel): - auto_update: Optional[bool] = FieldInfo(alias="autoUpdate", default=None) - """auto_update indicates whether the runner should automatically update itself.""" - - region: Optional[str] = None - """ - Region to deploy the runner in, if applicable. This is mainly used for remote - runners, and is only a hint. The runner may be deployed in a different region. - See the runner's status for the actual region. - """ - - release_channel: Optional[ - Literal["RUNNER_RELEASE_CHANNEL_UNSPECIFIED", "RUNNER_RELEASE_CHANNEL_STABLE", "RUNNER_RELEASE_CHANNEL_LATEST"] - ] = FieldInfo(alias="releaseChannel", default=None) - """The release channel the runner is on""" - - -class RunnerSpec(BaseModel): - configuration: Optional[RunnerSpecConfiguration] = None - """The runner's configuration""" - - desired_phase: Optional[ - Literal[ - "RUNNER_PHASE_UNSPECIFIED", - "RUNNER_PHASE_CREATED", - "RUNNER_PHASE_INACTIVE", - "RUNNER_PHASE_ACTIVE", - "RUNNER_PHASE_DELETING", - "RUNNER_PHASE_DELETED", - "RUNNER_PHASE_DEGRADED", - ] - ] = FieldInfo(alias="desiredPhase", default=None) - """RunnerPhase represents the phase a runner is in""" - - -class RunnerStatusAdditionalInfo(BaseModel): - key: Optional[str] = None - - value: Optional[str] = None - - -class RunnerStatus(BaseModel): - additional_info: Optional[List[RunnerStatusAdditionalInfo]] = FieldInfo(alias="additionalInfo", default=None) - """additional_info contains additional information about the runner, e.g. - - a CloudFormation stack URL. - """ - - capabilities: Optional[ - List[Literal["RUNNER_CAPABILITY_UNSPECIFIED", "RUNNER_CAPABILITY_FETCH_LOCAL_SCM_INTEGRATIONS"]] - ] = None - """capabilities is a list of capabilities the runner supports.""" - - log_url: Optional[str] = FieldInfo(alias="logUrl", default=None) - - message: Optional[str] = None - """ - The runner's reported message which is shown to users. This message adds more - context to the runner's phase. - """ - - phase: Optional[ - Literal[ - "RUNNER_PHASE_UNSPECIFIED", - "RUNNER_PHASE_CREATED", - "RUNNER_PHASE_INACTIVE", - "RUNNER_PHASE_ACTIVE", - "RUNNER_PHASE_DELETING", - "RUNNER_PHASE_DELETED", - "RUNNER_PHASE_DEGRADED", - ] - ] = None - """RunnerPhase represents the phase a runner is in""" - - region: Optional[str] = None - """region is the region the runner is running in, if applicable.""" - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - version: Optional[str] = None - - -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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - creator: Optional[RunnerCreator] = None - """creator is the identity of the creator of the environment""" - - kind: Optional[ - Literal["RUNNER_KIND_UNSPECIFIED", "RUNNER_KIND_LOCAL", "RUNNER_KIND_REMOTE", "RUNNER_KIND_LOCAL_CONFIGURATION"] - ] = None - """RunnerKind represents the kind of a runner""" - - name: Optional[str] = None - """The runner's name which is shown to users""" - - provider: Optional[ - Literal[ - "RUNNER_PROVIDER_UNSPECIFIED", - "RUNNER_PROVIDER_AWS_EC2", - "RUNNER_PROVIDER_LINUX_HOST", - "RUNNER_PROVIDER_DESKTOP_MAC", - ] - ] = 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. - """ - - runner_id: Optional[str] = FieldInfo(alias="runnerId", default=None) - - spec: Optional[RunnerSpec] = None - """The runner's specification""" - - status: Optional[RunnerStatus] = None - """RunnerStatus represents the status of a runner""" +class RunnerCreateResponse(BaseModel): + access_token: Optional[str] = FieldInfo(alias="accessToken", default=None) + """deprecated, will be removed. Use exchange_token instead.""" - updated_at: Optional[datetime] = FieldInfo(alias="updatedAt", default=None) + exchange_token: Optional[str] = FieldInfo(alias="exchangeToken", 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()`]() - to obtain a formatter capable of generating timestamps in this format. + exchange_token is a one-time use token that should be exchanged by the runner + for an access token, using the IdentityService.ExchangeToken rpc. The token + expires after 24 hours. """ - -class RunnerCreateResponse(BaseModel): - access_token: Optional[str] = FieldInfo(alias="accessToken", default=None) - runner: Optional[Runner] = None diff --git a/src/gitpod/types/runner_create_runner_token_response.py b/src/gitpod/types/runner_create_runner_token_response.py index c74f578..0f793a3 100644 --- a/src/gitpod/types/runner_create_runner_token_response.py +++ b/src/gitpod/types/runner_create_runner_token_response.py @@ -11,3 +11,11 @@ class RunnerCreateRunnerTokenResponse(BaseModel): access_token: Optional[str] = FieldInfo(alias="accessToken", default=None) + """deprecated, will be removed. Use exchange_token instead.""" + + exchange_token: Optional[str] = FieldInfo(alias="exchangeToken", default=None) + """ + exchange_token is a one-time use token that should be exchanged by the runner + for an access token, using the IdentityService.ExchangeToken rpc. The token + expires after 24 hours. + """ diff --git a/src/gitpod/types/runner_kind.py b/src/gitpod/types/runner_kind.py new file mode 100644 index 0000000..2302dbe --- /dev/null +++ b/src/gitpod/types/runner_kind.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["RunnerKind"] + +RunnerKind: TypeAlias = Literal[ + "RUNNER_KIND_UNSPECIFIED", "RUNNER_KIND_LOCAL", "RUNNER_KIND_REMOTE", "RUNNER_KIND_LOCAL_CONFIGURATION" +] diff --git a/src/gitpod/types/runner_list_params.py b/src/gitpod/types/runner_list_params.py index 8963496..7d2a986 100644 --- a/src/gitpod/types/runner_list_params.py +++ b/src/gitpod/types/runner_list_params.py @@ -3,9 +3,11 @@ from __future__ import annotations from typing import List -from typing_extensions import Literal, Annotated, TypedDict +from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo +from .runner_kind import RunnerKind +from .runner_provider import RunnerProvider __all__ = ["RunnerListParams", "Filter", "Pagination"] @@ -25,19 +27,10 @@ class Filter(TypedDict, total=False): creator_ids: Annotated[List[str], PropertyInfo(alias="creatorIds")] """creator_ids filters the response to only runner created by specified users""" - kinds: List[ - Literal["RUNNER_KIND_UNSPECIFIED", "RUNNER_KIND_LOCAL", "RUNNER_KIND_REMOTE", "RUNNER_KIND_LOCAL_CONFIGURATION"] - ] + kinds: List[RunnerKind] """kinds filters the response to only runners of the specified kinds""" - providers: List[ - Literal[ - "RUNNER_PROVIDER_UNSPECIFIED", - "RUNNER_PROVIDER_AWS_EC2", - "RUNNER_PROVIDER_LINUX_HOST", - "RUNNER_PROVIDER_DESKTOP_MAC", - ] - ] + providers: List[RunnerProvider] """providers filters the response to only runners of the specified providers""" diff --git a/src/gitpod/types/runner_phase.py b/src/gitpod/types/runner_phase.py new file mode 100644 index 0000000..b7cd3e9 --- /dev/null +++ b/src/gitpod/types/runner_phase.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["RunnerPhase"] + +RunnerPhase: TypeAlias = Literal[ + "RUNNER_PHASE_UNSPECIFIED", + "RUNNER_PHASE_CREATED", + "RUNNER_PHASE_INACTIVE", + "RUNNER_PHASE_ACTIVE", + "RUNNER_PHASE_DELETING", + "RUNNER_PHASE_DELETED", + "RUNNER_PHASE_DEGRADED", +] diff --git a/src/gitpod/types/runner_provider.py b/src/gitpod/types/runner_provider.py new file mode 100644 index 0000000..371260b --- /dev/null +++ b/src/gitpod/types/runner_provider.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["RunnerProvider"] + +RunnerProvider: TypeAlias = Literal[ + "RUNNER_PROVIDER_UNSPECIFIED", + "RUNNER_PROVIDER_AWS_EC2", + "RUNNER_PROVIDER_LINUX_HOST", + "RUNNER_PROVIDER_DESKTOP_MAC", +] diff --git a/src/gitpod/types/runner_release_channel.py b/src/gitpod/types/runner_release_channel.py new file mode 100644 index 0000000..c85e07a --- /dev/null +++ b/src/gitpod/types/runner_release_channel.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["RunnerReleaseChannel"] + +RunnerReleaseChannel: TypeAlias = Literal[ + "RUNNER_RELEASE_CHANNEL_UNSPECIFIED", "RUNNER_RELEASE_CHANNEL_STABLE", "RUNNER_RELEASE_CHANNEL_LATEST" +] diff --git a/src/gitpod/types/runner_retrieve_response.py b/src/gitpod/types/runner_retrieve_response.py index c2f7320..6877822 100644 --- a/src/gitpod/types/runner_retrieve_response.py +++ b/src/gitpod/types/runner_retrieve_response.py @@ -1,432 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from pydantic import Field as FieldInfo +from typing import Optional +from .runner import Runner from .._models import BaseModel -__all__ = [ - "RunnerRetrieveResponse", - "Runner", - "RunnerCreator", - "RunnerSpec", - "RunnerSpecConfiguration", - "RunnerStatus", - "RunnerStatusAdditionalInfo", -] - - -class RunnerCreator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class RunnerSpecConfiguration(BaseModel): - auto_update: Optional[bool] = FieldInfo(alias="autoUpdate", default=None) - """auto_update indicates whether the runner should automatically update itself.""" - - region: Optional[str] = None - """ - Region to deploy the runner in, if applicable. This is mainly used for remote - runners, and is only a hint. The runner may be deployed in a different region. - See the runner's status for the actual region. - """ - - release_channel: Optional[ - Literal["RUNNER_RELEASE_CHANNEL_UNSPECIFIED", "RUNNER_RELEASE_CHANNEL_STABLE", "RUNNER_RELEASE_CHANNEL_LATEST"] - ] = FieldInfo(alias="releaseChannel", default=None) - """The release channel the runner is on""" - - -class RunnerSpec(BaseModel): - configuration: Optional[RunnerSpecConfiguration] = None - """The runner's configuration""" - - desired_phase: Optional[ - Literal[ - "RUNNER_PHASE_UNSPECIFIED", - "RUNNER_PHASE_CREATED", - "RUNNER_PHASE_INACTIVE", - "RUNNER_PHASE_ACTIVE", - "RUNNER_PHASE_DELETING", - "RUNNER_PHASE_DELETED", - "RUNNER_PHASE_DEGRADED", - ] - ] = FieldInfo(alias="desiredPhase", default=None) - """RunnerPhase represents the phase a runner is in""" - - -class RunnerStatusAdditionalInfo(BaseModel): - key: Optional[str] = None - - value: Optional[str] = None - - -class RunnerStatus(BaseModel): - additional_info: Optional[List[RunnerStatusAdditionalInfo]] = FieldInfo(alias="additionalInfo", default=None) - """additional_info contains additional information about the runner, e.g. - - a CloudFormation stack URL. - """ - - capabilities: Optional[ - List[Literal["RUNNER_CAPABILITY_UNSPECIFIED", "RUNNER_CAPABILITY_FETCH_LOCAL_SCM_INTEGRATIONS"]] - ] = None - """capabilities is a list of capabilities the runner supports.""" - - log_url: Optional[str] = FieldInfo(alias="logUrl", default=None) - - message: Optional[str] = None - """ - The runner's reported message which is shown to users. This message adds more - context to the runner's phase. - """ - - phase: Optional[ - Literal[ - "RUNNER_PHASE_UNSPECIFIED", - "RUNNER_PHASE_CREATED", - "RUNNER_PHASE_INACTIVE", - "RUNNER_PHASE_ACTIVE", - "RUNNER_PHASE_DELETING", - "RUNNER_PHASE_DELETED", - "RUNNER_PHASE_DEGRADED", - ] - ] = None - """RunnerPhase represents the phase a runner is in""" - - region: Optional[str] = None - """region is the region the runner is running in, if applicable.""" - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - version: Optional[str] = None - - -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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - creator: Optional[RunnerCreator] = None - """creator is the identity of the creator of the environment""" - - kind: Optional[ - Literal["RUNNER_KIND_UNSPECIFIED", "RUNNER_KIND_LOCAL", "RUNNER_KIND_REMOTE", "RUNNER_KIND_LOCAL_CONFIGURATION"] - ] = None - """RunnerKind represents the kind of a runner""" - - name: Optional[str] = None - """The runner's name which is shown to users""" - - provider: Optional[ - Literal[ - "RUNNER_PROVIDER_UNSPECIFIED", - "RUNNER_PROVIDER_AWS_EC2", - "RUNNER_PROVIDER_LINUX_HOST", - "RUNNER_PROVIDER_DESKTOP_MAC", - ] - ] = 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. - """ - - runner_id: Optional[str] = FieldInfo(alias="runnerId", default=None) - - spec: Optional[RunnerSpec] = None - """The runner's specification""" - - status: Optional[RunnerStatus] = None - """RunnerStatus represents the status of a runner""" - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ +__all__ = ["RunnerRetrieveResponse"] class RunnerRetrieveResponse(BaseModel): diff --git a/src/gitpod/types/runner_spec.py b/src/gitpod/types/runner_spec.py new file mode 100644 index 0000000..9fb4811 --- /dev/null +++ b/src/gitpod/types/runner_spec.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .runner_phase import RunnerPhase +from .runner_configuration import RunnerConfiguration + +__all__ = ["RunnerSpec"] + + +class RunnerSpec(BaseModel): + configuration: Optional[RunnerConfiguration] = None + """The runner's configuration""" + + desired_phase: Optional[RunnerPhase] = FieldInfo(alias="desiredPhase", default=None) + """RunnerPhase represents the phase a runner is in""" diff --git a/src/gitpod/types/runner_spec_param.py b/src/gitpod/types/runner_spec_param.py new file mode 100644 index 0000000..c356eb3 --- /dev/null +++ b/src/gitpod/types/runner_spec_param.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Annotated, TypedDict + +from .._utils import PropertyInfo +from .runner_phase import RunnerPhase +from .runner_configuration_param import RunnerConfigurationParam + +__all__ = ["RunnerSpecParam"] + + +class RunnerSpecParam(TypedDict, total=False): + configuration: RunnerConfigurationParam + """The runner's configuration""" + + desired_phase: Annotated[RunnerPhase, PropertyInfo(alias="desiredPhase")] + """RunnerPhase represents the phase a runner is in""" diff --git a/src/gitpod/types/runner_status.py b/src/gitpod/types/runner_status.py new file mode 100644 index 0000000..e516dcb --- /dev/null +++ b/src/gitpod/types/runner_status.py @@ -0,0 +1,134 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .runner_phase import RunnerPhase +from .runner_capability import RunnerCapability +from .shared.field_value import FieldValue + +__all__ = ["RunnerStatus"] + + +class RunnerStatus(BaseModel): + additional_info: Optional[List[FieldValue]] = FieldInfo(alias="additionalInfo", default=None) + """additional_info contains additional information about the runner, e.g. + + a CloudFormation stack URL. + """ + + capabilities: Optional[List[RunnerCapability]] = None + """capabilities is a list of capabilities the runner supports.""" + + log_url: Optional[str] = FieldInfo(alias="logUrl", default=None) + + message: Optional[str] = None + """ + The runner's reported message which is shown to users. This message adds more + context to the runner's phase. + """ + + phase: Optional[RunnerPhase] = None + """RunnerPhase represents the phase a runner is in""" + + region: Optional[str] = None + """region is the region the runner is running in, if applicable.""" + + 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()`]() + to obtain a formatter capable of generating timestamps in this format. + """ + + version: Optional[str] = None diff --git a/src/gitpod/types/runner_update_params.py b/src/gitpod/types/runner_update_params.py index d13d613..975f069 100644 --- a/src/gitpod/types/runner_update_params.py +++ b/src/gitpod/types/runner_update_params.py @@ -2,85 +2,39 @@ from __future__ import annotations -from typing import Union -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing import Optional +from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo +from .runner_phase import RunnerPhase +from .runner_release_channel import RunnerReleaseChannel -__all__ = [ - "RunnerUpdateParams", - "TheRunnerSNameWhichIsShownToUsers", - "Variant1", - "Variant1Spec", - "Variant1SpecConfiguration", - "Variant1SpecConfigurationConfiguration", - "Variant1SpecConfigurationConfigurationAutoUpdateIndicatesWhetherTheRunnerShouldAutomaticallyUpdateItself", - "Variant1SpecConfigurationConfigurationTheReleaseChannelTheRunnerIsOn", - "Variant1SpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunners", -] +__all__ = ["RunnerUpdateParams", "Spec", "SpecConfiguration"] -class TheRunnerSNameWhichIsShownToUsers(TypedDict, total=False): - name: Required[str] +class RunnerUpdateParams(TypedDict, total=False): + name: Optional[str] """The runner's name which is shown to users""" + runner_id: Annotated[str, PropertyInfo(alias="runnerId")] + """runner_id specifies which runner to be updated. -class Variant1(TypedDict, total=False): - spec: Required[Variant1Spec] + +required + """ + spec: Optional[Spec] -class Variant1SpecConfigurationConfigurationAutoUpdateIndicatesWhetherTheRunnerShouldAutomaticallyUpdateItself( - TypedDict, total=False -): - auto_update: Required[Annotated[bool, PropertyInfo(alias="autoUpdate")]] - """auto_update indicates whether the runner should automatically update itself.""" +class SpecConfiguration(TypedDict, total=False): + auto_update: Annotated[Optional[bool], PropertyInfo(alias="autoUpdate")] + """auto_update indicates whether the runner should automatically update itself.""" -class Variant1SpecConfigurationConfigurationTheReleaseChannelTheRunnerIsOn(TypedDict, total=False): - release_channel: Required[ - Annotated[ - Literal[ - "RUNNER_RELEASE_CHANNEL_UNSPECIFIED", "RUNNER_RELEASE_CHANNEL_STABLE", "RUNNER_RELEASE_CHANNEL_LATEST" - ], - PropertyInfo(alias="releaseChannel"), - ] - ] + release_channel: Annotated[Optional[RunnerReleaseChannel], PropertyInfo(alias="releaseChannel")] """The release channel the runner is on""" -Variant1SpecConfigurationConfiguration: TypeAlias = Union[ - Variant1SpecConfigurationConfigurationAutoUpdateIndicatesWhetherTheRunnerShouldAutomaticallyUpdateItself, - Variant1SpecConfigurationConfigurationTheReleaseChannelTheRunnerIsOn, -] - - -class Variant1SpecConfiguration(TypedDict, total=False): - configuration: Required[Variant1SpecConfigurationConfiguration] +class Spec(TypedDict, total=False): + configuration: Optional[SpecConfiguration] - -class Variant1SpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunners( - TypedDict, total=False -): - desired_phase: Required[ - Annotated[ - Literal[ - "RUNNER_PHASE_UNSPECIFIED", - "RUNNER_PHASE_CREATED", - "RUNNER_PHASE_INACTIVE", - "RUNNER_PHASE_ACTIVE", - "RUNNER_PHASE_DELETING", - "RUNNER_PHASE_DELETED", - "RUNNER_PHASE_DEGRADED", - ], - PropertyInfo(alias="desiredPhase"), - ] - ] + desired_phase: Annotated[Optional[RunnerPhase], PropertyInfo(alias="desiredPhase")] """RunnerPhase represents the phase a runner is in""" - - -Variant1Spec: TypeAlias = Union[ - Variant1SpecConfiguration, - Variant1SpecDesiredPhaseCanCurrentlyOnlyBeUpdatedOnLocalConfigurationRunnersToToggleWhetherLocalRunnersAreAllowedForRunningEnvironmentsInTheOrganizationSetToActiveToEnableLocalRunnersInactiveToDisableAllLocalRunnersExistingLocalRunnersAndTheirEnvironmentsWillStopAndCannotBeStartedAgainUntilTheDesiredPhaseIsSetToActiveUseThisCarefullyAsItWillAffectAllUsersInTheOrganizationWhoUseLocalRunners, -] - -RunnerUpdateParams: TypeAlias = Union[TheRunnerSNameWhichIsShownToUsers, Variant1] diff --git a/src/gitpod/types/runners/__init__.py b/src/gitpod/types/runners/__init__.py index aa75098..4d19ee2 100644 --- a/src/gitpod/types/runners/__init__.py +++ b/src/gitpod/types/runners/__init__.py @@ -2,12 +2,16 @@ from __future__ import annotations +from .runner_role import RunnerRole as RunnerRole +from .runner_policy import RunnerPolicy as RunnerPolicy from .policy_list_params import PolicyListParams as PolicyListParams from .policy_create_params import PolicyCreateParams as PolicyCreateParams from .policy_delete_params import PolicyDeleteParams as PolicyDeleteParams -from .policy_list_response import PolicyListResponse as PolicyListResponse from .policy_update_params import PolicyUpdateParams as PolicyUpdateParams +from .field_validation_error import FieldValidationError as FieldValidationError from .policy_create_response import PolicyCreateResponse as PolicyCreateResponse from .policy_update_response import PolicyUpdateResponse as PolicyUpdateResponse from .configuration_validate_params import ConfigurationValidateParams as ConfigurationValidateParams from .configuration_validate_response import ConfigurationValidateResponse as ConfigurationValidateResponse +from .scm_integration_validation_result import ScmIntegrationValidationResult as ScmIntegrationValidationResult +from .environment_class_validation_result import EnvironmentClassValidationResult as EnvironmentClassValidationResult diff --git a/src/gitpod/types/runners/configuration_validate_params.py b/src/gitpod/types/runners/configuration_validate_params.py index 0bb99fa..df2d65e 100644 --- a/src/gitpod/types/runners/configuration_validate_params.py +++ b/src/gitpod/types/runners/configuration_validate_params.py @@ -2,85 +2,39 @@ from __future__ import annotations -from typing import Union, Iterable -from typing_extensions import Required, Annotated, TypeAlias, TypedDict +from typing import Union, Optional +from typing_extensions import Annotated, TypedDict from ..._types import Base64FileInput from ..._utils import PropertyInfo from ..._models import set_pydantic_config +from ..shared_params.environment_class import EnvironmentClass -__all__ = [ - "ConfigurationValidateParams", - "Variant0", - "Variant0EnvironmentClass", - "Variant0EnvironmentClassConfiguration", - "Variant1", - "Variant1ScmIntegration", - "Variant1ScmIntegrationOAuthClientIDIsTheOAuthAppSClientIDIfOAuthIsConfiguredIfConfiguredOAuthClientSecretMustAlsoBeSet", - "Variant1ScmIntegrationOAuthEncryptedClientSecretIsTheOAuthAppSClientSecretEncryptedWithTheRunnerSPublicKeyIfOAuthIsConfiguredThisCanBeUsedToEGValidateAnAlreadyEncryptedClientSecretOfAnExistingScmIntegration", - "Variant1ScmIntegrationOAuthPlaintextClientSecretIsTheOAuthAppSClientSecretInClearTextIfOAuthIsConfiguredThisCanBeSetToValidateAnyNewClientSecretBeforeItIsEncryptedAndStoredThisValueWillNotBeStoredAndGetEncryptedWithTheRunnerSPublicKeyBeforePassingItToTheRunner", -] +__all__ = ["ConfigurationValidateParams", "ScmIntegration"] -class Variant0(TypedDict, total=False): - environment_class: Required[Annotated[Variant0EnvironmentClass, PropertyInfo(alias="environmentClass")]] +class ConfigurationValidateParams(TypedDict, total=False): + environment_class: Annotated[EnvironmentClass, PropertyInfo(alias="environmentClass")] runner_id: Annotated[str, PropertyInfo(alias="runnerId")] + scm_integration: Annotated[ScmIntegration, PropertyInfo(alias="scmIntegration")] -class Variant0EnvironmentClassConfiguration(TypedDict, total=False): - key: str - value: str - - -class Variant0EnvironmentClass(TypedDict, total=False): +class ScmIntegration(TypedDict, total=False): id: str - """id is the unique identifier of the environment class""" - - configuration: Iterable[Variant0EnvironmentClassConfiguration] - """configuration describes the configuration of the environment class""" + """id is the unique identifier of the SCM integration""" - description: str - """description is a human readable description of the environment class""" - - display_name: Annotated[str, PropertyInfo(alias="displayName")] - """display_name is the human readable name of the environment class""" - - enabled: bool - """ - enabled indicates whether the environment class can be used to create new - environments. - """ + host: str - runner_id: Annotated[str, PropertyInfo(alias="runnerId")] - """ - runner_id is the unique identifier of the runner the environment class belongs - to - """ - - -class Variant1(TypedDict, total=False): - scm_integration: Required[Annotated[Variant1ScmIntegration, PropertyInfo(alias="scmIntegration")]] - - runner_id: Annotated[str, PropertyInfo(alias="runnerId")] - - -class Variant1ScmIntegrationOAuthClientIDIsTheOAuthAppSClientIDIfOAuthIsConfiguredIfConfiguredOAuthClientSecretMustAlsoBeSet( - TypedDict, total=False -): - oauth_client_id: Required[Annotated[str, PropertyInfo(alias="oauthClientId")]] + oauth_client_id: Annotated[Optional[str], PropertyInfo(alias="oauthClientId")] """ oauth_client_id is the OAuth app's client ID, if OAuth is configured. If configured, oauth_client_secret must also be set. """ - -class Variant1ScmIntegrationOAuthEncryptedClientSecretIsTheOAuthAppSClientSecretEncryptedWithTheRunnerSPublicKeyIfOAuthIsConfiguredThisCanBeUsedToEGValidateAnAlreadyEncryptedClientSecretOfAnExistingScmIntegration( - TypedDict, total=False -): - oauth_encrypted_client_secret: Required[ - Annotated[Union[str, Base64FileInput], PropertyInfo(alias="oauthEncryptedClientSecret", format="base64")] + oauth_encrypted_client_secret: Annotated[ + Union[str, Base64FileInput], PropertyInfo(alias="oauthEncryptedClientSecret", format="base64") ] """ oauth_encrypted_client_secret is the OAuth app's client secret encrypted with @@ -88,17 +42,7 @@ class Variant1ScmIntegrationOAuthEncryptedClientSecretIsTheOAuthAppSClientSecret validate an already encrypted client secret of an existing SCM integration. """ - -set_pydantic_config( - Variant1ScmIntegrationOAuthEncryptedClientSecretIsTheOAuthAppSClientSecretEncryptedWithTheRunnerSPublicKeyIfOAuthIsConfiguredThisCanBeUsedToEGValidateAnAlreadyEncryptedClientSecretOfAnExistingScmIntegration, - {"arbitrary_types_allowed": True}, -) - - -class Variant1ScmIntegrationOAuthPlaintextClientSecretIsTheOAuthAppSClientSecretInClearTextIfOAuthIsConfiguredThisCanBeSetToValidateAnyNewClientSecretBeforeItIsEncryptedAndStoredThisValueWillNotBeStoredAndGetEncryptedWithTheRunnerSPublicKeyBeforePassingItToTheRunner( - TypedDict, total=False -): - oauth_plaintext_client_secret: Required[Annotated[str, PropertyInfo(alias="oauthPlaintextClientSecret")]] + oauth_plaintext_client_secret: Annotated[str, PropertyInfo(alias="oauthPlaintextClientSecret")] """ oauth_plaintext_client_secret is the OAuth app's client secret in clear text, if OAuth is configured. This can be set to validate any new client secret before it @@ -106,11 +50,13 @@ class Variant1ScmIntegrationOAuthPlaintextClientSecretIsTheOAuthAppSClientSecret the runner's public key before passing it to the runner. """ + pat: bool + + scm_id: Annotated[str, PropertyInfo(alias="scmId")] + """ + scm_id references the scm_id in the runner's configuration schema that this + integration is for + """ -Variant1ScmIntegration: TypeAlias = Union[ - Variant1ScmIntegrationOAuthClientIDIsTheOAuthAppSClientIDIfOAuthIsConfiguredIfConfiguredOAuthClientSecretMustAlsoBeSet, - Variant1ScmIntegrationOAuthEncryptedClientSecretIsTheOAuthAppSClientSecretEncryptedWithTheRunnerSPublicKeyIfOAuthIsConfiguredThisCanBeUsedToEGValidateAnAlreadyEncryptedClientSecretOfAnExistingScmIntegration, - Variant1ScmIntegrationOAuthPlaintextClientSecretIsTheOAuthAppSClientSecretInClearTextIfOAuthIsConfiguredThisCanBeSetToValidateAnyNewClientSecretBeforeItIsEncryptedAndStoredThisValueWillNotBeStoredAndGetEncryptedWithTheRunnerSPublicKeyBeforePassingItToTheRunner, -] -ConfigurationValidateParams: TypeAlias = Union[Variant0, Variant1] +set_pydantic_config(ScmIntegration, {"arbitrary_types_allowed": True}) diff --git a/src/gitpod/types/runners/configuration_validate_response.py b/src/gitpod/types/runners/configuration_validate_response.py index a16f687..3009132 100644 --- a/src/gitpod/types/runners/configuration_validate_response.py +++ b/src/gitpod/types/runners/configuration_validate_response.py @@ -1,70 +1,17 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union -from typing_extensions import TypeAlias +from typing import Optional from pydantic import Field as FieldInfo from ..._models import BaseModel +from .scm_integration_validation_result import ScmIntegrationValidationResult +from .environment_class_validation_result import EnvironmentClassValidationResult -__all__ = [ - "ConfigurationValidateResponse", - "EnvironmentClass", - "EnvironmentClassEnvironmentClass", - "EnvironmentClassEnvironmentClassDescriptionError", - "EnvironmentClassEnvironmentClassDisplayNameError", - "ScmIntegration", - "ScmIntegrationScmIntegration", - "ScmIntegrationScmIntegrationHostError", - "ScmIntegrationScmIntegrationOAuthError", - "ScmIntegrationScmIntegrationPatError", - "ScmIntegrationScmIntegrationScmIDError", -] +__all__ = ["ConfigurationValidateResponse"] -class EnvironmentClassEnvironmentClassDescriptionError(BaseModel): - description_error: str = FieldInfo(alias="descriptionError") +class ConfigurationValidateResponse(BaseModel): + environment_class: Optional[EnvironmentClassValidationResult] = FieldInfo(alias="environmentClass", default=None) - -class EnvironmentClassEnvironmentClassDisplayNameError(BaseModel): - display_name_error: str = FieldInfo(alias="displayNameError") - - -EnvironmentClassEnvironmentClass: TypeAlias = Union[ - EnvironmentClassEnvironmentClassDescriptionError, EnvironmentClassEnvironmentClassDisplayNameError -] - - -class EnvironmentClass(BaseModel): - environment_class: EnvironmentClassEnvironmentClass = FieldInfo(alias="environmentClass") - - -class ScmIntegrationScmIntegrationHostError(BaseModel): - host_error: str = FieldInfo(alias="hostError") - - -class ScmIntegrationScmIntegrationOAuthError(BaseModel): - oauth_error: str = FieldInfo(alias="oauthError") - - -class ScmIntegrationScmIntegrationPatError(BaseModel): - pat_error: str = FieldInfo(alias="patError") - - -class ScmIntegrationScmIntegrationScmIDError(BaseModel): - scm_id_error: str = FieldInfo(alias="scmIdError") - - -ScmIntegrationScmIntegration: TypeAlias = Union[ - ScmIntegrationScmIntegrationHostError, - ScmIntegrationScmIntegrationOAuthError, - ScmIntegrationScmIntegrationPatError, - ScmIntegrationScmIntegrationScmIDError, -] - - -class ScmIntegration(BaseModel): - scm_integration: ScmIntegrationScmIntegration = FieldInfo(alias="scmIntegration") - - -ConfigurationValidateResponse: TypeAlias = Union[EnvironmentClass, ScmIntegration] + scm_integration: Optional[ScmIntegrationValidationResult] = FieldInfo(alias="scmIntegration", default=None) diff --git a/src/gitpod/types/runners/configurations/__init__.py b/src/gitpod/types/runners/configurations/__init__.py index d614bb2..5a36d94 100644 --- a/src/gitpod/types/runners/configurations/__init__.py +++ b/src/gitpod/types/runners/configurations/__init__.py @@ -2,19 +2,22 @@ from __future__ import annotations +from .scm_integration import ScmIntegration as ScmIntegration from .schema_retrieve_params import SchemaRetrieveParams as SchemaRetrieveParams from .schema_retrieve_response import SchemaRetrieveResponse as SchemaRetrieveResponse +from .host_authentication_token import HostAuthenticationToken as HostAuthenticationToken +from .runner_configuration_schema import RunnerConfigurationSchema as RunnerConfigurationSchema from .scm_integration_list_params import ScmIntegrationListParams as ScmIntegrationListParams +from .scm_integration_oauth_config import ScmIntegrationOAuthConfig as ScmIntegrationOAuthConfig from .environment_class_list_params import EnvironmentClassListParams as EnvironmentClassListParams from .scm_integration_create_params import ScmIntegrationCreateParams as ScmIntegrationCreateParams from .scm_integration_delete_params import ScmIntegrationDeleteParams as ScmIntegrationDeleteParams -from .scm_integration_list_response import ScmIntegrationListResponse as ScmIntegrationListResponse from .scm_integration_update_params import ScmIntegrationUpdateParams as ScmIntegrationUpdateParams from .environment_class_create_params import EnvironmentClassCreateParams as EnvironmentClassCreateParams -from .environment_class_list_response import EnvironmentClassListResponse as EnvironmentClassListResponse from .environment_class_update_params import EnvironmentClassUpdateParams as EnvironmentClassUpdateParams from .scm_integration_create_response import ScmIntegrationCreateResponse as ScmIntegrationCreateResponse from .scm_integration_retrieve_params import ScmIntegrationRetrieveParams as ScmIntegrationRetrieveParams +from .host_authentication_token_source import HostAuthenticationTokenSource as HostAuthenticationTokenSource from .environment_class_create_response import EnvironmentClassCreateResponse as EnvironmentClassCreateResponse from .environment_class_retrieve_params import EnvironmentClassRetrieveParams as EnvironmentClassRetrieveParams from .scm_integration_retrieve_response import ScmIntegrationRetrieveResponse as ScmIntegrationRetrieveResponse @@ -28,9 +31,6 @@ from .host_authentication_token_delete_params import ( HostAuthenticationTokenDeleteParams as HostAuthenticationTokenDeleteParams, ) -from .host_authentication_token_list_response import ( - HostAuthenticationTokenListResponse as HostAuthenticationTokenListResponse, -) from .host_authentication_token_update_params import ( HostAuthenticationTokenUpdateParams as HostAuthenticationTokenUpdateParams, ) diff --git a/src/gitpod/types/runners/configurations/environment_class_create_params.py b/src/gitpod/types/runners/configurations/environment_class_create_params.py index 659e64e..1f624b0 100644 --- a/src/gitpod/types/runners/configurations/environment_class_create_params.py +++ b/src/gitpod/types/runners/configurations/environment_class_create_params.py @@ -6,21 +6,16 @@ from typing_extensions import Annotated, TypedDict from ...._utils import PropertyInfo +from ...shared_params.field_value import FieldValue -__all__ = ["EnvironmentClassCreateParams", "Configuration"] +__all__ = ["EnvironmentClassCreateParams"] class EnvironmentClassCreateParams(TypedDict, total=False): - configuration: Iterable[Configuration] + configuration: Iterable[FieldValue] description: str display_name: Annotated[str, PropertyInfo(alias="displayName")] runner_id: Annotated[str, PropertyInfo(alias="runnerId")] - - -class Configuration(TypedDict, total=False): - key: str - - value: str diff --git a/src/gitpod/types/runners/configurations/environment_class_list_params.py b/src/gitpod/types/runners/configurations/environment_class_list_params.py index ce42b41..c5c59b1 100644 --- a/src/gitpod/types/runners/configurations/environment_class_list_params.py +++ b/src/gitpod/types/runners/configurations/environment_class_list_params.py @@ -2,7 +2,8 @@ from __future__ import annotations -from typing_extensions import Required, Annotated, TypedDict +from typing import List, Optional +from typing_extensions import Annotated, TypedDict from ...._utils import PropertyInfo @@ -21,12 +22,15 @@ class EnvironmentClassListParams(TypedDict, total=False): class Filter(TypedDict, total=False): - enabled: Required[bool] + enabled: Optional[bool] """ enabled filters the response to only enabled or disabled environment classes. If not set, all environment classes are returned. """ + runner_ids: Annotated[List[str], PropertyInfo(alias="runnerIds")] + """runner_ids filters the response to only EnvironmentClasses of these Runner IDs""" + class Pagination(TypedDict, total=False): token: str diff --git a/src/gitpod/types/runners/configurations/environment_class_list_response.py b/src/gitpod/types/runners/configurations/environment_class_list_response.py deleted file mode 100644 index a5d220d..0000000 --- a/src/gitpod/types/runners/configurations/environment_class_list_response.py +++ /dev/null @@ -1,41 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = ["EnvironmentClassListResponse", "Configuration"] - - -class Configuration(BaseModel): - key: Optional[str] = None - - value: Optional[str] = None - - -class EnvironmentClassListResponse(BaseModel): - id: Optional[str] = None - """id is the unique identifier of the environment class""" - - configuration: Optional[List[Configuration]] = None - """configuration describes the configuration of the environment class""" - - description: Optional[str] = None - """description is a human readable description of the environment class""" - - display_name: Optional[str] = FieldInfo(alias="displayName", default=None) - """display_name is the human readable name of the environment class""" - - enabled: Optional[bool] = None - """ - enabled indicates whether the environment class can be used to create new - environments. - """ - - runner_id: Optional[str] = FieldInfo(alias="runnerId", default=None) - """ - runner_id is the unique identifier of the runner the environment class belongs - to - """ diff --git a/src/gitpod/types/runners/configurations/environment_class_retrieve_response.py b/src/gitpod/types/runners/configurations/environment_class_retrieve_response.py index fd91634..36ad250 100644 --- a/src/gitpod/types/runners/configurations/environment_class_retrieve_response.py +++ b/src/gitpod/types/runners/configurations/environment_class_retrieve_response.py @@ -1,44 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Optional from pydantic import Field as FieldInfo from ...._models import BaseModel +from ...shared.environment_class import EnvironmentClass -__all__ = ["EnvironmentClassRetrieveResponse", "EnvironmentClass", "EnvironmentClassConfiguration"] - - -class EnvironmentClassConfiguration(BaseModel): - key: Optional[str] = None - - value: Optional[str] = None - - -class EnvironmentClass(BaseModel): - id: Optional[str] = None - """id is the unique identifier of the environment class""" - - configuration: Optional[List[EnvironmentClassConfiguration]] = None - """configuration describes the configuration of the environment class""" - - description: Optional[str] = None - """description is a human readable description of the environment class""" - - display_name: Optional[str] = FieldInfo(alias="displayName", default=None) - """display_name is the human readable name of the environment class""" - - enabled: Optional[bool] = None - """ - enabled indicates whether the environment class can be used to create new - environments. - """ - - runner_id: Optional[str] = FieldInfo(alias="runnerId", default=None) - """ - runner_id is the unique identifier of the runner the environment class belongs - to - """ +__all__ = ["EnvironmentClassRetrieveResponse"] class EnvironmentClassRetrieveResponse(BaseModel): diff --git a/src/gitpod/types/runners/configurations/environment_class_update_params.py b/src/gitpod/types/runners/configurations/environment_class_update_params.py index 53006f3..e161361 100644 --- a/src/gitpod/types/runners/configurations/environment_class_update_params.py +++ b/src/gitpod/types/runners/configurations/environment_class_update_params.py @@ -2,24 +2,19 @@ from __future__ import annotations -from typing import Union -from typing_extensions import Required, Annotated, TypeAlias, TypedDict +from typing import Optional +from typing_extensions import Annotated, TypedDict from ...._utils import PropertyInfo -__all__ = ["EnvironmentClassUpdateParams", "Variant0", "Variant1", "Variant2"] +__all__ = ["EnvironmentClassUpdateParams"] -class Variant0(TypedDict, total=False): - description: Required[str] +class EnvironmentClassUpdateParams(TypedDict, total=False): + description: Optional[str] + display_name: Annotated[Optional[str], PropertyInfo(alias="displayName")] -class Variant1(TypedDict, total=False): - display_name: Required[Annotated[str, PropertyInfo(alias="displayName")]] + enabled: Optional[bool] - -class Variant2(TypedDict, total=False): - enabled: Required[bool] - - -EnvironmentClassUpdateParams: TypeAlias = Union[Variant0, Variant1, Variant2] + environment_class_id: Annotated[str, PropertyInfo(alias="environmentClassId")] diff --git a/src/gitpod/types/runners/configurations/host_authentication_token_list_response.py b/src/gitpod/types/runners/configurations/host_authentication_token.py similarity index 92% rename from src/gitpod/types/runners/configurations/host_authentication_token_list_response.py rename to src/gitpod/types/runners/configurations/host_authentication_token.py index 03cdca9..6ebf74a 100644 --- a/src/gitpod/types/runners/configurations/host_authentication_token_list_response.py +++ b/src/gitpod/types/runners/configurations/host_authentication_token.py @@ -2,16 +2,16 @@ from typing import Optional from datetime import datetime -from typing_extensions import Literal from pydantic import Field as FieldInfo from ...._models import BaseModel +from .host_authentication_token_source import HostAuthenticationTokenSource -__all__ = ["HostAuthenticationTokenListResponse"] +__all__ = ["HostAuthenticationToken"] -class HostAuthenticationTokenListResponse(BaseModel): +class HostAuthenticationToken(BaseModel): id: Optional[str] = None expires_at: Optional[datetime] = FieldInfo(alias="expiresAt", default=None) @@ -110,12 +110,6 @@ class HostAuthenticationTokenListResponse(BaseModel): runner_id: Optional[str] = FieldInfo(alias="runnerId", default=None) - source: Optional[ - Literal[ - "HOST_AUTHENTICATION_TOKEN_SOURCE_UNSPECIFIED", - "HOST_AUTHENTICATION_TOKEN_SOURCE_OAUTH", - "HOST_AUTHENTICATION_TOKEN_SOURCE_PAT", - ] - ] = None + source: Optional[HostAuthenticationTokenSource] = None user_id: Optional[str] = FieldInfo(alias="userId", default=None) diff --git a/src/gitpod/types/runners/configurations/host_authentication_token_create_params.py b/src/gitpod/types/runners/configurations/host_authentication_token_create_params.py index ae8e98b..f0ba68e 100644 --- a/src/gitpod/types/runners/configurations/host_authentication_token_create_params.py +++ b/src/gitpod/types/runners/configurations/host_authentication_token_create_params.py @@ -4,9 +4,10 @@ from typing import Union from datetime import datetime -from typing_extensions import Literal, Annotated, TypedDict +from typing_extensions import Annotated, TypedDict from ...._utils import PropertyInfo +from .host_authentication_token_source import HostAuthenticationTokenSource __all__ = ["HostAuthenticationTokenCreateParams"] @@ -112,10 +113,6 @@ class HostAuthenticationTokenCreateParams(TypedDict, total=False): runner_id: Annotated[str, PropertyInfo(alias="runnerId")] - source: Literal[ - "HOST_AUTHENTICATION_TOKEN_SOURCE_UNSPECIFIED", - "HOST_AUTHENTICATION_TOKEN_SOURCE_OAUTH", - "HOST_AUTHENTICATION_TOKEN_SOURCE_PAT", - ] + source: HostAuthenticationTokenSource user_id: Annotated[str, PropertyInfo(alias="userId")] diff --git a/src/gitpod/types/runners/configurations/host_authentication_token_create_response.py b/src/gitpod/types/runners/configurations/host_authentication_token_create_response.py index fe368a6..b351bfe 100644 --- a/src/gitpod/types/runners/configurations/host_authentication_token_create_response.py +++ b/src/gitpod/types/runners/configurations/host_authentication_token_create_response.py @@ -1,125 +1,12 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from pydantic import Field as FieldInfo from ...._models import BaseModel +from .host_authentication_token import HostAuthenticationToken -__all__ = ["HostAuthenticationTokenCreateResponse", "Token"] - - -class Token(BaseModel): - id: Optional[str] = None - - expires_at: Optional[datetime] = FieldInfo(alias="expiresAt", 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - host: Optional[str] = None - - runner_id: Optional[str] = FieldInfo(alias="runnerId", default=None) - - source: Optional[ - Literal[ - "HOST_AUTHENTICATION_TOKEN_SOURCE_UNSPECIFIED", - "HOST_AUTHENTICATION_TOKEN_SOURCE_OAUTH", - "HOST_AUTHENTICATION_TOKEN_SOURCE_PAT", - ] - ] = None - - user_id: Optional[str] = FieldInfo(alias="userId", default=None) +__all__ = ["HostAuthenticationTokenCreateResponse"] class HostAuthenticationTokenCreateResponse(BaseModel): - token: Optional[Token] = None + token: Optional[HostAuthenticationToken] = None diff --git a/src/gitpod/types/runners/configurations/host_authentication_token_list_params.py b/src/gitpod/types/runners/configurations/host_authentication_token_list_params.py index 77b971f..2576f40 100644 --- a/src/gitpod/types/runners/configurations/host_authentication_token_list_params.py +++ b/src/gitpod/types/runners/configurations/host_authentication_token_list_params.py @@ -2,12 +2,12 @@ from __future__ import annotations -from typing import Union -from typing_extensions import Required, Annotated, TypeAlias, TypedDict +from typing import Optional +from typing_extensions import Annotated, TypedDict from ...._utils import PropertyInfo -__all__ = ["HostAuthenticationTokenListParams", "Filter", "FilterRunnerID", "FilterUserID", "Pagination"] +__all__ = ["HostAuthenticationTokenListParams", "Filter", "Pagination"] class HostAuthenticationTokenListParams(TypedDict, total=False): @@ -20,15 +20,10 @@ class HostAuthenticationTokenListParams(TypedDict, total=False): pagination: Pagination -class FilterRunnerID(TypedDict, total=False): - runner_id: Required[Annotated[str, PropertyInfo(alias="runnerId")]] +class Filter(TypedDict, total=False): + runner_id: Annotated[Optional[str], PropertyInfo(alias="runnerId")] - -class FilterUserID(TypedDict, total=False): - user_id: Required[Annotated[str, PropertyInfo(alias="userId")]] - - -Filter: TypeAlias = Union[FilterRunnerID, FilterUserID] + user_id: Annotated[Optional[str], PropertyInfo(alias="userId")] class Pagination(TypedDict, total=False): diff --git a/src/gitpod/types/runners/configurations/host_authentication_token_retrieve_response.py b/src/gitpod/types/runners/configurations/host_authentication_token_retrieve_response.py index 85cb946..50e478b 100644 --- a/src/gitpod/types/runners/configurations/host_authentication_token_retrieve_response.py +++ b/src/gitpod/types/runners/configurations/host_authentication_token_retrieve_response.py @@ -1,125 +1,12 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from pydantic import Field as FieldInfo from ...._models import BaseModel +from .host_authentication_token import HostAuthenticationToken -__all__ = ["HostAuthenticationTokenRetrieveResponse", "Token"] - - -class Token(BaseModel): - id: Optional[str] = None - - expires_at: Optional[datetime] = FieldInfo(alias="expiresAt", 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - host: Optional[str] = None - - runner_id: Optional[str] = FieldInfo(alias="runnerId", default=None) - - source: Optional[ - Literal[ - "HOST_AUTHENTICATION_TOKEN_SOURCE_UNSPECIFIED", - "HOST_AUTHENTICATION_TOKEN_SOURCE_OAUTH", - "HOST_AUTHENTICATION_TOKEN_SOURCE_PAT", - ] - ] = None - - user_id: Optional[str] = FieldInfo(alias="userId", default=None) +__all__ = ["HostAuthenticationTokenRetrieveResponse"] class HostAuthenticationTokenRetrieveResponse(BaseModel): - token: Optional[Token] = None + token: Optional[HostAuthenticationToken] = None diff --git a/src/gitpod/types/runners/configurations/host_authentication_token_source.py b/src/gitpod/types/runners/configurations/host_authentication_token_source.py new file mode 100644 index 0000000..c610d07 --- /dev/null +++ b/src/gitpod/types/runners/configurations/host_authentication_token_source.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["HostAuthenticationTokenSource"] + +HostAuthenticationTokenSource: TypeAlias = Literal[ + "HOST_AUTHENTICATION_TOKEN_SOURCE_UNSPECIFIED", + "HOST_AUTHENTICATION_TOKEN_SOURCE_OAUTH", + "HOST_AUTHENTICATION_TOKEN_SOURCE_PAT", +] diff --git a/src/gitpod/types/runners/configurations/host_authentication_token_update_params.py b/src/gitpod/types/runners/configurations/host_authentication_token_update_params.py index aea852e..50dfcd2 100644 --- a/src/gitpod/types/runners/configurations/host_authentication_token_update_params.py +++ b/src/gitpod/types/runners/configurations/host_authentication_token_update_params.py @@ -2,17 +2,21 @@ from __future__ import annotations -from typing import Union +from typing import Union, Optional from datetime import datetime -from typing_extensions import Required, Annotated, TypeAlias, TypedDict +from typing_extensions import Annotated, TypedDict from ...._utils import PropertyInfo -__all__ = ["HostAuthenticationTokenUpdateParams", "Variant0", "Variant1", "Variant2"] +__all__ = ["HostAuthenticationTokenUpdateParams"] -class Variant0(TypedDict, total=False): - expires_at: Required[Annotated[Union[str, datetime], PropertyInfo(alias="expiresAt", format="iso8601")]] +class HostAuthenticationTokenUpdateParams(TypedDict, total=False): + id: str + + token: Optional[str] + + expires_at: Annotated[Union[str, datetime, None], PropertyInfo(alias="expiresAt", 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 @@ -104,13 +108,4 @@ class Variant0(TypedDict, total=False): to obtain a formatter capable of generating timestamps in this format. """ - -class Variant1(TypedDict, total=False): - refresh_token: Required[Annotated[str, PropertyInfo(alias="refreshToken")]] - - -class Variant2(TypedDict, total=False): - token: Required[str] - - -HostAuthenticationTokenUpdateParams: TypeAlias = Union[Variant0, Variant1, Variant2] + refresh_token: Annotated[Optional[str], PropertyInfo(alias="refreshToken")] diff --git a/src/gitpod/types/runners/configurations/runner_configuration_schema.py b/src/gitpod/types/runners/configurations/runner_configuration_schema.py new file mode 100644 index 0000000..fff9b91 --- /dev/null +++ b/src/gitpod/types/runners/configurations/runner_configuration_schema.py @@ -0,0 +1,169 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import builtins +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = [ + "RunnerConfigurationSchema", + "EnvironmentClass", + "EnvironmentClassBool", + "EnvironmentClassDisplay", + "EnvironmentClassEnum", + "EnvironmentClassInt", + "EnvironmentClassString", + "RunnerConfig", + "RunnerConfigBool", + "RunnerConfigDisplay", + "RunnerConfigEnum", + "RunnerConfigInt", + "RunnerConfigString", + "Scm", + "ScmOAuth", + "ScmPat", +] + + +class EnvironmentClassBool(BaseModel): + default: Optional[bool] = None + + +class EnvironmentClassDisplay(BaseModel): + default: Optional[str] = None + + +class EnvironmentClassEnum(BaseModel): + default: Optional[str] = None + + values: Optional[List[str]] = None + + +class EnvironmentClassInt(BaseModel): + default: Optional[int] = None + + max: Optional[int] = None + + min: Optional[int] = None + + +class EnvironmentClassString(BaseModel): + default: Optional[str] = None + + pattern: Optional[str] = None + + +class EnvironmentClass(BaseModel): + id: Optional[str] = None + + bool: Optional[EnvironmentClassBool] = None + + description: Optional[str] = None + + display: Optional[EnvironmentClassDisplay] = None + + enum: Optional[EnvironmentClassEnum] = None + + int: Optional[EnvironmentClassInt] = None + + name: Optional[str] = None + + required: Optional[builtins.bool] = None + + secret: Optional[builtins.bool] = None + + string: Optional[EnvironmentClassString] = None + + +class RunnerConfigBool(BaseModel): + default: Optional[bool] = None + + +class RunnerConfigDisplay(BaseModel): + default: Optional[str] = None + + +class RunnerConfigEnum(BaseModel): + default: Optional[str] = None + + values: Optional[List[str]] = None + + +class RunnerConfigInt(BaseModel): + default: Optional[int] = None + + max: Optional[int] = None + + min: Optional[int] = None + + +class RunnerConfigString(BaseModel): + default: Optional[str] = None + + pattern: Optional[str] = None + + +class RunnerConfig(BaseModel): + id: Optional[str] = None + + bool: Optional[RunnerConfigBool] = None + + description: Optional[str] = None + + display: Optional[RunnerConfigDisplay] = None + + enum: Optional[RunnerConfigEnum] = None + + int: Optional[RunnerConfigInt] = None + + name: Optional[str] = None + + required: Optional[builtins.bool] = None + + secret: Optional[builtins.bool] = None + + string: Optional[RunnerConfigString] = None + + +class ScmOAuth(BaseModel): + callback_url: Optional[str] = FieldInfo(alias="callbackUrl", default=None) + """ + callback_url is the URL the OAuth app will redirect to after the user has + authenticated. + """ + + +class ScmPat(BaseModel): + description: Optional[str] = None + """description is a human-readable description of the PAT.""" + + docs_link: Optional[str] = FieldInfo(alias="docsLink", default=None) + """ + docs_link is a link to the documentation on how to create a PAT for this SCM + system. + """ + + +class Scm(BaseModel): + default_hosts: Optional[List[str]] = FieldInfo(alias="defaultHosts", default=None) + + name: Optional[str] = None + + oauth: Optional[ScmOAuth] = None + + pat: Optional[ScmPat] = None + + scm_id: Optional[str] = FieldInfo(alias="scmId", default=None) + + +class RunnerConfigurationSchema(BaseModel): + environment_classes: Optional[List[EnvironmentClass]] = FieldInfo(alias="environmentClasses", default=None) + + runner_config: Optional[List[RunnerConfig]] = FieldInfo(alias="runnerConfig", default=None) + + scm: Optional[List[Scm]] = None + + version: Optional[str] = None + """The schema version""" diff --git a/src/gitpod/types/runners/configurations/schema_retrieve_response.py b/src/gitpod/types/runners/configurations/schema_retrieve_response.py index 8ebcad6..64f13c7 100644 --- a/src/gitpod/types/runners/configurations/schema_retrieve_response.py +++ b/src/gitpod/types/runners/configurations/schema_retrieve_response.py @@ -1,299 +1,14 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import builtins -from typing import List, Union, Optional -from typing_extensions import TypeAlias +from typing import Optional from pydantic import Field as FieldInfo from ...._models import BaseModel +from .runner_configuration_schema import RunnerConfigurationSchema -__all__ = [ - "SchemaRetrieveResponse", - "Schema", - "SchemaEnvironmentClass", - "SchemaEnvironmentClassUnionMember0", - "SchemaEnvironmentClassUnionMember0Bool", - "SchemaEnvironmentClassUnionMember1", - "SchemaEnvironmentClassUnionMember1Display", - "SchemaEnvironmentClassUnionMember2", - "SchemaEnvironmentClassUnionMember2Enum", - "SchemaEnvironmentClassUnionMember3", - "SchemaEnvironmentClassUnionMember3Int", - "SchemaEnvironmentClassUnionMember4", - "SchemaEnvironmentClassUnionMember4String", - "SchemaRunnerConfig", - "SchemaRunnerConfigUnionMember0", - "SchemaRunnerConfigUnionMember0Bool", - "SchemaRunnerConfigUnionMember1", - "SchemaRunnerConfigUnionMember1Display", - "SchemaRunnerConfigUnionMember2", - "SchemaRunnerConfigUnionMember2Enum", - "SchemaRunnerConfigUnionMember3", - "SchemaRunnerConfigUnionMember3Int", - "SchemaRunnerConfigUnionMember4", - "SchemaRunnerConfigUnionMember4String", - "SchemaScm", - "SchemaScmOAuth", - "SchemaScmPat", -] - - -class SchemaEnvironmentClassUnionMember0Bool(BaseModel): - default: Optional[bool] = None - - -class SchemaEnvironmentClassUnionMember0(BaseModel): - bool: SchemaEnvironmentClassUnionMember0Bool - - id: Optional[str] = None - - description: Optional[str] = None - - name: Optional[str] = None - - required: Optional[builtins.bool] = None - - secret: Optional[builtins.bool] = None - - -class SchemaEnvironmentClassUnionMember1Display(BaseModel): - default: Optional[str] = None - - -class SchemaEnvironmentClassUnionMember1(BaseModel): - display: SchemaEnvironmentClassUnionMember1Display - - id: Optional[str] = None - - description: Optional[str] = None - - name: Optional[str] = None - - required: Optional[bool] = None - - secret: Optional[bool] = None - - -class SchemaEnvironmentClassUnionMember2Enum(BaseModel): - default: Optional[str] = None - - values: Optional[List[str]] = None - - -class SchemaEnvironmentClassUnionMember2(BaseModel): - enum: SchemaEnvironmentClassUnionMember2Enum - - id: Optional[str] = None - - description: Optional[str] = None - - name: Optional[str] = None - - required: Optional[bool] = None - - secret: Optional[bool] = None - - -class SchemaEnvironmentClassUnionMember3Int(BaseModel): - default: Optional[int] = None - - max: Optional[int] = None - - min: Optional[int] = None - - -class SchemaEnvironmentClassUnionMember3(BaseModel): - int: SchemaEnvironmentClassUnionMember3Int - - id: Optional[str] = None - - description: Optional[str] = None - - name: Optional[str] = None - - required: Optional[bool] = None - - secret: Optional[bool] = None - - -class SchemaEnvironmentClassUnionMember4String(BaseModel): - default: Optional[str] = None - - pattern: Optional[str] = None - - -class SchemaEnvironmentClassUnionMember4(BaseModel): - string: SchemaEnvironmentClassUnionMember4String - - id: Optional[str] = None - - description: Optional[str] = None - - name: Optional[str] = None - - required: Optional[bool] = None - - secret: Optional[bool] = None - - -SchemaEnvironmentClass: TypeAlias = Union[ - SchemaEnvironmentClassUnionMember0, - SchemaEnvironmentClassUnionMember1, - SchemaEnvironmentClassUnionMember2, - SchemaEnvironmentClassUnionMember3, - SchemaEnvironmentClassUnionMember4, -] - - -class SchemaRunnerConfigUnionMember0Bool(BaseModel): - default: Optional[bool] = None - - -class SchemaRunnerConfigUnionMember0(BaseModel): - bool: SchemaRunnerConfigUnionMember0Bool - - id: Optional[str] = None - - description: Optional[str] = None - - name: Optional[str] = None - - required: Optional[builtins.bool] = None - - secret: Optional[builtins.bool] = None - - -class SchemaRunnerConfigUnionMember1Display(BaseModel): - default: Optional[str] = None - - -class SchemaRunnerConfigUnionMember1(BaseModel): - display: SchemaRunnerConfigUnionMember1Display - - id: Optional[str] = None - - description: Optional[str] = None - - name: Optional[str] = None - - required: Optional[bool] = None - - secret: Optional[bool] = None - - -class SchemaRunnerConfigUnionMember2Enum(BaseModel): - default: Optional[str] = None - - values: Optional[List[str]] = None - - -class SchemaRunnerConfigUnionMember2(BaseModel): - enum: SchemaRunnerConfigUnionMember2Enum - - id: Optional[str] = None - - description: Optional[str] = None - - name: Optional[str] = None - - required: Optional[bool] = None - - secret: Optional[bool] = None - - -class SchemaRunnerConfigUnionMember3Int(BaseModel): - default: Optional[int] = None - - max: Optional[int] = None - - min: Optional[int] = None - - -class SchemaRunnerConfigUnionMember3(BaseModel): - int: SchemaRunnerConfigUnionMember3Int - - id: Optional[str] = None - - description: Optional[str] = None - - name: Optional[str] = None - - required: Optional[bool] = None - - secret: Optional[bool] = None - - -class SchemaRunnerConfigUnionMember4String(BaseModel): - default: Optional[str] = None - - pattern: Optional[str] = None - - -class SchemaRunnerConfigUnionMember4(BaseModel): - string: SchemaRunnerConfigUnionMember4String - - id: Optional[str] = None - - description: Optional[str] = None - - name: Optional[str] = None - - required: Optional[bool] = None - - secret: Optional[bool] = None - - -SchemaRunnerConfig: TypeAlias = Union[ - SchemaRunnerConfigUnionMember0, - SchemaRunnerConfigUnionMember1, - SchemaRunnerConfigUnionMember2, - SchemaRunnerConfigUnionMember3, - SchemaRunnerConfigUnionMember4, -] - - -class SchemaScmOAuth(BaseModel): - callback_url: Optional[str] = FieldInfo(alias="callbackUrl", default=None) - """ - callback_url is the URL the OAuth app will redirect to after the user has - authenticated. - """ - - -class SchemaScmPat(BaseModel): - description: Optional[str] = None - """description is a human-readable description of the PAT.""" - - docs_link: Optional[str] = FieldInfo(alias="docsLink", default=None) - """ - docs_link is a link to the documentation on how to create a PAT for this SCM - system. - """ - - -class SchemaScm(BaseModel): - default_hosts: Optional[List[str]] = FieldInfo(alias="defaultHosts", default=None) - - name: Optional[str] = None - - oauth: Optional[SchemaScmOAuth] = None - - pat: Optional[SchemaScmPat] = None - - scm_id: Optional[str] = FieldInfo(alias="scmId", default=None) - - -class Schema(BaseModel): - environment_classes: Optional[List[SchemaEnvironmentClass]] = FieldInfo(alias="environmentClasses", default=None) - - runner_config: Optional[List[SchemaRunnerConfig]] = FieldInfo(alias="runnerConfig", default=None) - - scm: Optional[List[SchemaScm]] = None - - version: Optional[str] = None - """The schema version""" +__all__ = ["SchemaRetrieveResponse"] class SchemaRetrieveResponse(BaseModel): - schema_: Optional[Schema] = FieldInfo(alias="schema", default=None) + schema_: Optional[RunnerConfigurationSchema] = FieldInfo(alias="schema", default=None) diff --git a/src/gitpod/types/runners/configurations/scm_integration_list_response.py b/src/gitpod/types/runners/configurations/scm_integration.py similarity index 55% rename from src/gitpod/types/runners/configurations/scm_integration_list_response.py rename to src/gitpod/types/runners/configurations/scm_integration.py index 50b1110..05841dc 100644 --- a/src/gitpod/types/runners/configurations/scm_integration_list_response.py +++ b/src/gitpod/types/runners/configurations/scm_integration.py @@ -5,29 +5,19 @@ from pydantic import Field as FieldInfo from ...._models import BaseModel +from .scm_integration_oauth_config import ScmIntegrationOAuthConfig -__all__ = ["ScmIntegrationListResponse", "OAuth"] +__all__ = ["ScmIntegration"] -class OAuth(BaseModel): - client_id: Optional[str] = FieldInfo(alias="clientId", default=None) - """client_id is the OAuth app's client ID in clear text.""" - - encrypted_client_secret: Optional[str] = FieldInfo(alias="encryptedClientSecret", default=None) - """ - encrypted_client_secret is the OAuth app's secret encrypted with the runner's - public key. - """ - - -class ScmIntegrationListResponse(BaseModel): - oauth: OAuth - +class ScmIntegration(BaseModel): id: Optional[str] = None """id is the unique identifier of the SCM integration""" host: Optional[str] = None + oauth: Optional[ScmIntegrationOAuthConfig] = None + pat: Optional[bool] = None runner_id: Optional[str] = FieldInfo(alias="runnerId", default=None) diff --git a/src/gitpod/types/runners/configurations/scm_integration_create_params.py b/src/gitpod/types/runners/configurations/scm_integration_create_params.py index 1bbfe2b..9713c07 100644 --- a/src/gitpod/types/runners/configurations/scm_integration_create_params.py +++ b/src/gitpod/types/runners/configurations/scm_integration_create_params.py @@ -2,39 +2,35 @@ from __future__ import annotations -from typing import Union -from typing_extensions import Required, Annotated, TypeAlias, TypedDict +from typing import Optional +from typing_extensions import Annotated, TypedDict from ...._utils import PropertyInfo -__all__ = [ - "ScmIntegrationCreateParams", - "OAuthClientIDIsTheOAuthAppSClientIDIfOAuthIsConfiguredIfConfiguredOAuthPlaintextClientSecretMustAlsoBeSet", - "OAuthPlaintextClientSecretIsTheOAuthAppSClientSecretInClearTextThisWillFirstBeEncryptedWithTheRunnerSPublicKeyBeforeBeingStored", -] +__all__ = ["ScmIntegrationCreateParams"] -class OAuthClientIDIsTheOAuthAppSClientIDIfOAuthIsConfiguredIfConfiguredOAuthPlaintextClientSecretMustAlsoBeSet( - TypedDict, total=False -): - oauth_client_id: Required[Annotated[str, PropertyInfo(alias="oauthClientId")]] +class ScmIntegrationCreateParams(TypedDict, total=False): + host: str + + oauth_client_id: Annotated[Optional[str], PropertyInfo(alias="oauthClientId")] """ oauth_client_id is the OAuth app's client ID, if OAuth is configured. If configured, oauth_plaintext_client_secret must also be set. """ - -class OAuthPlaintextClientSecretIsTheOAuthAppSClientSecretInClearTextThisWillFirstBeEncryptedWithTheRunnerSPublicKeyBeforeBeingStored( - TypedDict, total=False -): - oauth_plaintext_client_secret: Required[Annotated[str, PropertyInfo(alias="oauthPlaintextClientSecret")]] + oauth_plaintext_client_secret: Annotated[Optional[str], PropertyInfo(alias="oauthPlaintextClientSecret")] """ oauth_plaintext_client_secret is the OAuth app's client secret in clear text. This will first be encrypted with the runner's public key before being stored. """ + pat: bool + + runner_id: Annotated[str, PropertyInfo(alias="runnerId")] -ScmIntegrationCreateParams: TypeAlias = Union[ - OAuthClientIDIsTheOAuthAppSClientIDIfOAuthIsConfiguredIfConfiguredOAuthPlaintextClientSecretMustAlsoBeSet, - OAuthPlaintextClientSecretIsTheOAuthAppSClientSecretInClearTextThisWillFirstBeEncryptedWithTheRunnerSPublicKeyBeforeBeingStored, -] + scm_id: Annotated[str, PropertyInfo(alias="scmId")] + """ + scm_id references the scm_id in the runner's configuration schema that this + integration is for + """ diff --git a/src/gitpod/types/runners/configurations/scm_integration_oauth_config.py b/src/gitpod/types/runners/configurations/scm_integration_oauth_config.py new file mode 100644 index 0000000..bda03c2 --- /dev/null +++ b/src/gitpod/types/runners/configurations/scm_integration_oauth_config.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = ["ScmIntegrationOAuthConfig"] + + +class ScmIntegrationOAuthConfig(BaseModel): + client_id: Optional[str] = FieldInfo(alias="clientId", default=None) + """client_id is the OAuth app's client ID in clear text.""" + + encrypted_client_secret: Optional[str] = FieldInfo(alias="encryptedClientSecret", default=None) + """ + encrypted_client_secret is the OAuth app's secret encrypted with the runner's + public key. + """ diff --git a/src/gitpod/types/runners/configurations/scm_integration_retrieve_response.py b/src/gitpod/types/runners/configurations/scm_integration_retrieve_response.py index 619b46d..d19d32d 100644 --- a/src/gitpod/types/runners/configurations/scm_integration_retrieve_response.py +++ b/src/gitpod/types/runners/configurations/scm_integration_retrieve_response.py @@ -2,27 +2,11 @@ from typing import Optional -from pydantic import Field as FieldInfo - from ...._models import BaseModel +from .scm_integration import ScmIntegration -__all__ = ["ScmIntegrationRetrieveResponse", "Integration", "IntegrationOAuth"] - - -class IntegrationOAuth(BaseModel): - client_id: Optional[str] = FieldInfo(alias="clientId", default=None) - """client_id is the OAuth app's client ID in clear text.""" - - encrypted_client_secret: Optional[str] = FieldInfo(alias="encryptedClientSecret", default=None) - """ - encrypted_client_secret is the OAuth app's secret encrypted with the runner's - public key. - """ - - -class Integration(BaseModel): - oauth: IntegrationOAuth +__all__ = ["ScmIntegrationRetrieveResponse"] class ScmIntegrationRetrieveResponse(BaseModel): - integration: Optional[Integration] = None + integration: Optional[ScmIntegration] = None diff --git a/src/gitpod/types/runners/configurations/scm_integration_update_params.py b/src/gitpod/types/runners/configurations/scm_integration_update_params.py index 2732ed1..94e14e0 100644 --- a/src/gitpod/types/runners/configurations/scm_integration_update_params.py +++ b/src/gitpod/types/runners/configurations/scm_integration_update_params.py @@ -2,23 +2,18 @@ from __future__ import annotations -from typing import Union -from typing_extensions import Required, Annotated, TypeAlias, TypedDict +from typing import Optional +from typing_extensions import Annotated, TypedDict from ...._utils import PropertyInfo -__all__ = [ - "ScmIntegrationUpdateParams", - "OAuthClientIDCanBeSetToUpdateTheOAuthAppSClientIDIfAnEmptyStringIsSetTheOAuthConfigurationWillBeRemovedRegardlessOfWhetherAClientSecretIsSetAndAnyExistingHostAuthenticationTokensForTheScmIntegrationSRunnerAndHostThatWereCreatedUsingTheOAuthAppWillBeDeletedThisMightLeadToUsersBeingUnableToAccessTheirRepositoriesUntilTheyReAuthenticate", - "OAuthPlaintextClientSecretCanBeSetToUpdateTheOAuthAppSClientSecretTheCleartextSecretWillBeEncryptedWithTheRunnerSPublicKeyBeforeBeingStored", - "PatCanBeSetToEnableOrDisablePersonalAccessTokensSupportWhenDisablingPaTsAnyExistingHostAuthenticationTokensForTheScmIntegrationSRunnerAndHostThatWereCreatedUsingAPatWillBeDeletedThisMightLeadToUsersBeingUnableToAccessTheirRepositoriesUntilTheyReAuthenticate", -] +__all__ = ["ScmIntegrationUpdateParams"] -class OAuthClientIDCanBeSetToUpdateTheOAuthAppSClientIDIfAnEmptyStringIsSetTheOAuthConfigurationWillBeRemovedRegardlessOfWhetherAClientSecretIsSetAndAnyExistingHostAuthenticationTokensForTheScmIntegrationSRunnerAndHostThatWereCreatedUsingTheOAuthAppWillBeDeletedThisMightLeadToUsersBeingUnableToAccessTheirRepositoriesUntilTheyReAuthenticate( - TypedDict, total=False -): - oauth_client_id: Required[Annotated[str, PropertyInfo(alias="oauthClientId")]] +class ScmIntegrationUpdateParams(TypedDict, total=False): + id: str + + oauth_client_id: Annotated[Optional[str], PropertyInfo(alias="oauthClientId")] """ oauth_client_id can be set to update the OAuth app's client ID. If an empty string is set, the OAuth configuration will be removed (regardless of whether a @@ -28,22 +23,14 @@ class OAuthClientIDCanBeSetToUpdateTheOAuthAppSClientIDIfAnEmptyStringIsSetTheOA until they re-authenticate. """ - -class OAuthPlaintextClientSecretCanBeSetToUpdateTheOAuthAppSClientSecretTheCleartextSecretWillBeEncryptedWithTheRunnerSPublicKeyBeforeBeingStored( - TypedDict, total=False -): - oauth_plaintext_client_secret: Required[Annotated[str, PropertyInfo(alias="oauthPlaintextClientSecret")]] + oauth_plaintext_client_secret: Annotated[Optional[str], PropertyInfo(alias="oauthPlaintextClientSecret")] """ oauth_plaintext_client_secret can be set to update the OAuth app's client secret. The cleartext secret will be encrypted with the runner's public key before being stored. """ - -class PatCanBeSetToEnableOrDisablePersonalAccessTokensSupportWhenDisablingPaTsAnyExistingHostAuthenticationTokensForTheScmIntegrationSRunnerAndHostThatWereCreatedUsingAPatWillBeDeletedThisMightLeadToUsersBeingUnableToAccessTheirRepositoriesUntilTheyReAuthenticate( - TypedDict, total=False -): - pat: Required[bool] + pat: Optional[bool] """ pat can be set to enable or disable Personal Access Tokens support. When disabling PATs, any existing Host Authentication Tokens for the SCM @@ -51,10 +38,3 @@ class PatCanBeSetToEnableOrDisablePersonalAccessTokensSupportWhenDisablingPaTsAn This might lead to users being unable to access their repositories until they re-authenticate. """ - - -ScmIntegrationUpdateParams: TypeAlias = Union[ - OAuthClientIDCanBeSetToUpdateTheOAuthAppSClientIDIfAnEmptyStringIsSetTheOAuthConfigurationWillBeRemovedRegardlessOfWhetherAClientSecretIsSetAndAnyExistingHostAuthenticationTokensForTheScmIntegrationSRunnerAndHostThatWereCreatedUsingTheOAuthAppWillBeDeletedThisMightLeadToUsersBeingUnableToAccessTheirRepositoriesUntilTheyReAuthenticate, - OAuthPlaintextClientSecretCanBeSetToUpdateTheOAuthAppSClientSecretTheCleartextSecretWillBeEncryptedWithTheRunnerSPublicKeyBeforeBeingStored, - PatCanBeSetToEnableOrDisablePersonalAccessTokensSupportWhenDisablingPaTsAnyExistingHostAuthenticationTokensForTheScmIntegrationSRunnerAndHostThatWereCreatedUsingAPatWillBeDeletedThisMightLeadToUsersBeingUnableToAccessTheirRepositoriesUntilTheyReAuthenticate, -] diff --git a/src/gitpod/types/runners/environment_class_validation_result.py b/src/gitpod/types/runners/environment_class_validation_result.py new file mode 100644 index 0000000..3b7e146 --- /dev/null +++ b/src/gitpod/types/runners/environment_class_validation_result.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel +from .field_validation_error import FieldValidationError + +__all__ = ["EnvironmentClassValidationResult"] + + +class EnvironmentClassValidationResult(BaseModel): + configuration_errors: Optional[List[FieldValidationError]] = FieldInfo(alias="configurationErrors", default=None) + + description_error: Optional[str] = FieldInfo(alias="descriptionError", default=None) + + display_name_error: Optional[str] = FieldInfo(alias="displayNameError", default=None) + + valid: Optional[bool] = None diff --git a/src/gitpod/types/runners/field_validation_error.py b/src/gitpod/types/runners/field_validation_error.py new file mode 100644 index 0000000..6db05ce --- /dev/null +++ b/src/gitpod/types/runners/field_validation_error.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["FieldValidationError"] + + +class FieldValidationError(BaseModel): + error: Optional[str] = None + + key: Optional[str] = None diff --git a/src/gitpod/types/runners/policy_create_params.py b/src/gitpod/types/runners/policy_create_params.py index c79c1ef..5391627 100644 --- a/src/gitpod/types/runners/policy_create_params.py +++ b/src/gitpod/types/runners/policy_create_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing_extensions import Literal, Annotated, TypedDict +from typing_extensions import Annotated, TypedDict from ..._utils import PropertyInfo +from .runner_role import RunnerRole __all__ = ["PolicyCreateParams"] @@ -13,7 +14,7 @@ class PolicyCreateParams(TypedDict, total=False): group_id: Annotated[str, PropertyInfo(alias="groupId")] """group_id specifies the group_id identifier""" - role: Literal["RUNNER_ROLE_UNSPECIFIED", "RUNNER_ROLE_ADMIN", "RUNNER_ROLE_USER"] + role: RunnerRole runner_id: Annotated[str, PropertyInfo(alias="runnerId")] """runner_id specifies the project identifier""" diff --git a/src/gitpod/types/runners/policy_create_response.py b/src/gitpod/types/runners/policy_create_response.py index 5ab2ef2..0520b58 100644 --- a/src/gitpod/types/runners/policy_create_response.py +++ b/src/gitpod/types/runners/policy_create_response.py @@ -1,21 +1,12 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo from ..._models import BaseModel +from .runner_policy import RunnerPolicy -__all__ = ["PolicyCreateResponse", "Policy"] - - -class Policy(BaseModel): - group_id: Optional[str] = FieldInfo(alias="groupId", default=None) - - role: Optional[Literal["RUNNER_ROLE_UNSPECIFIED", "RUNNER_ROLE_ADMIN", "RUNNER_ROLE_USER"]] = None - """role is the role assigned to the group""" +__all__ = ["PolicyCreateResponse"] class PolicyCreateResponse(BaseModel): - policy: Optional[Policy] = None + policy: Optional[RunnerPolicy] = None diff --git a/src/gitpod/types/runners/policy_update_params.py b/src/gitpod/types/runners/policy_update_params.py index 9f44d6b..71066d2 100644 --- a/src/gitpod/types/runners/policy_update_params.py +++ b/src/gitpod/types/runners/policy_update_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing_extensions import Literal, Annotated, TypedDict +from typing_extensions import Annotated, TypedDict from ..._utils import PropertyInfo +from .runner_role import RunnerRole __all__ = ["PolicyUpdateParams"] @@ -13,7 +14,7 @@ class PolicyUpdateParams(TypedDict, total=False): group_id: Annotated[str, PropertyInfo(alias="groupId")] """group_id specifies the group_id identifier""" - role: Literal["RUNNER_ROLE_UNSPECIFIED", "RUNNER_ROLE_ADMIN", "RUNNER_ROLE_USER"] + role: RunnerRole runner_id: Annotated[str, PropertyInfo(alias="runnerId")] """runner_id specifies the project identifier""" diff --git a/src/gitpod/types/runners/policy_update_response.py b/src/gitpod/types/runners/policy_update_response.py index 15e3918..b5c96d6 100644 --- a/src/gitpod/types/runners/policy_update_response.py +++ b/src/gitpod/types/runners/policy_update_response.py @@ -1,21 +1,12 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo from ..._models import BaseModel +from .runner_policy import RunnerPolicy -__all__ = ["PolicyUpdateResponse", "Policy"] - - -class Policy(BaseModel): - group_id: Optional[str] = FieldInfo(alias="groupId", default=None) - - role: Optional[Literal["RUNNER_ROLE_UNSPECIFIED", "RUNNER_ROLE_ADMIN", "RUNNER_ROLE_USER"]] = None - """role is the role assigned to the group""" +__all__ = ["PolicyUpdateResponse"] class PolicyUpdateResponse(BaseModel): - policy: Optional[Policy] = None + policy: Optional[RunnerPolicy] = None diff --git a/src/gitpod/types/projects/policy_list_response.py b/src/gitpod/types/runners/runner_policy.py similarity index 59% rename from src/gitpod/types/projects/policy_list_response.py rename to src/gitpod/types/runners/runner_policy.py index 12ef5fd..c107db4 100644 --- a/src/gitpod/types/projects/policy_list_response.py +++ b/src/gitpod/types/runners/runner_policy.py @@ -1,17 +1,17 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional -from typing_extensions import Literal from pydantic import Field as FieldInfo from ..._models import BaseModel +from .runner_role import RunnerRole -__all__ = ["PolicyListResponse"] +__all__ = ["RunnerPolicy"] -class PolicyListResponse(BaseModel): +class RunnerPolicy(BaseModel): group_id: Optional[str] = FieldInfo(alias="groupId", default=None) - role: Optional[Literal["PROJECT_ROLE_UNSPECIFIED", "PROJECT_ROLE_ADMIN", "PROJECT_ROLE_USER"]] = None + role: Optional[RunnerRole] = None """role is the role assigned to the group""" diff --git a/src/gitpod/types/runners/runner_role.py b/src/gitpod/types/runners/runner_role.py new file mode 100644 index 0000000..b4e95a1 --- /dev/null +++ b/src/gitpod/types/runners/runner_role.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["RunnerRole"] + +RunnerRole: TypeAlias = Literal["RUNNER_ROLE_UNSPECIFIED", "RUNNER_ROLE_ADMIN", "RUNNER_ROLE_USER"] diff --git a/src/gitpod/types/runners/scm_integration_validation_result.py b/src/gitpod/types/runners/scm_integration_validation_result.py new file mode 100644 index 0000000..3a99c80 --- /dev/null +++ b/src/gitpod/types/runners/scm_integration_validation_result.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["ScmIntegrationValidationResult"] + + +class ScmIntegrationValidationResult(BaseModel): + host_error: Optional[str] = FieldInfo(alias="hostError", default=None) + + oauth_error: Optional[str] = FieldInfo(alias="oauthError", default=None) + + pat_error: Optional[str] = FieldInfo(alias="patError", default=None) + + scm_id_error: Optional[str] = FieldInfo(alias="scmIdError", default=None) + + valid: Optional[bool] = None diff --git a/src/gitpod/types/scope.py b/src/gitpod/types/scope.py new file mode 100644 index 0000000..0f1bd71 --- /dev/null +++ b/src/gitpod/types/scope.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["Scope"] + +Scope: TypeAlias = Literal["SCOPE_UNSPECIFIED", "SCOPE_MEMBER", "SCOPE_ALL"] diff --git a/src/gitpod/types/secret.py b/src/gitpod/types/secret.py new file mode 100644 index 0000000..13e91d3 --- /dev/null +++ b/src/gitpod/types/secret.py @@ -0,0 +1,217 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.subject import Subject + +__all__ = ["Secret"] + + +class Secret(BaseModel): + id: Optional[str] = None + + 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()`]() + to obtain a formatter capable of generating timestamps in this format. + """ + + creator: Optional[Subject] = None + """creator is the identity of the creator of the secret""" + + environment_variable: Optional[bool] = FieldInfo(alias="environmentVariable", default=None) + """ + secret will be created as an Environment Variable with the same name as the + secret + """ + + file_path: Optional[str] = FieldInfo(alias="filePath", default=None) + """absolute path to the file where the secret is mounted""" + + name: Optional[str] = None + """Name of the secret for humans.""" + + project_id: Optional[str] = FieldInfo(alias="projectId", default=None) + """The Project ID this Secret belongs to""" + + 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()`]() + to obtain a formatter capable of generating timestamps in this format. + """ diff --git a/src/gitpod/types/secret_create_params.py b/src/gitpod/types/secret_create_params.py index b11ca47..99447e0 100644 --- a/src/gitpod/types/secret_create_params.py +++ b/src/gitpod/types/secret_create_params.py @@ -2,36 +2,21 @@ from __future__ import annotations -from typing import Union -from typing_extensions import Required, Annotated, TypeAlias, TypedDict +from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo -__all__ = [ - "SecretCreateParams", - "SecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret", - "AbsolutePathToTheFileWhereTheSecretIsMounted", -] +__all__ = ["SecretCreateParams"] -class SecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret(TypedDict, total=False): - environment_variable: Required[Annotated[bool, PropertyInfo(alias="environmentVariable")]] +class SecretCreateParams(TypedDict, total=False): + environment_variable: Annotated[bool, PropertyInfo(alias="environmentVariable")] """ secret will be created as an Environment Variable with the same name as the secret """ - name: str - - project_id: Annotated[str, PropertyInfo(alias="projectId")] - """project_id is the ProjectID this Secret belongs to""" - - value: str - """value is the plaintext value of the secret""" - - -class AbsolutePathToTheFileWhereTheSecretIsMounted(TypedDict, total=False): - file_path: Required[Annotated[str, PropertyInfo(alias="filePath")]] + file_path: Annotated[str, PropertyInfo(alias="filePath")] """ absolute path to the file where the secret is mounted value must be an absolute path (start with a /): @@ -48,8 +33,3 @@ class AbsolutePathToTheFileWhereTheSecretIsMounted(TypedDict, total=False): value: str """value is the plaintext value of the secret""" - - -SecretCreateParams: TypeAlias = Union[ - SecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret, AbsolutePathToTheFileWhereTheSecretIsMounted -] diff --git a/src/gitpod/types/secret_create_response.py b/src/gitpod/types/secret_create_response.py index 53a103b..bf7c768 100644 --- a/src/gitpod/types/secret_create_response.py +++ b/src/gitpod/types/secret_create_response.py @@ -1,37 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional -from typing_extensions import TypeAlias - -from pydantic import Field as FieldInfo +from typing import Optional +from .secret import Secret from .._models import BaseModel -__all__ = [ - "SecretCreateResponse", - "Secret", - "SecretSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret", - "SecretAbsolutePathToTheFileWhereTheSecretIsMounted", -] - - -class SecretSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret(BaseModel): - environment_variable: bool = FieldInfo(alias="environmentVariable") - """ - secret will be created as an Environment Variable with the same name as the - secret - """ - - -class SecretAbsolutePathToTheFileWhereTheSecretIsMounted(BaseModel): - file_path: str = FieldInfo(alias="filePath") - """absolute path to the file where the secret is mounted""" - - -Secret: TypeAlias = Union[ - SecretSecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret, - SecretAbsolutePathToTheFileWhereTheSecretIsMounted, -] +__all__ = ["SecretCreateResponse"] class SecretCreateResponse(BaseModel): diff --git a/src/gitpod/types/secret_list_response.py b/src/gitpod/types/secret_list_response.py deleted file mode 100644 index ab94527..0000000 --- a/src/gitpod/types/secret_list_response.py +++ /dev/null @@ -1,459 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = [ - "SecretListResponse", - "SecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret", - "SecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreator", - "AbsolutePathToTheFileWhereTheSecretIsMounted", - "AbsolutePathToTheFileWhereTheSecretIsMountedCreator", -] - - -class SecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class SecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret(BaseModel): - environment_variable: bool = FieldInfo(alias="environmentVariable") - """ - secret will be created as an Environment Variable with the same name as the - secret - """ - - id: Optional[str] = None - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - creator: Optional[SecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecretCreator] = None - """creator is the identity of the creator of the secret""" - - name: Optional[str] = None - """Name of the secret for humans.""" - - project_id: Optional[str] = FieldInfo(alias="projectId", default=None) - """The Project ID this Secret belongs to""" - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - -class AbsolutePathToTheFileWhereTheSecretIsMountedCreator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class AbsolutePathToTheFileWhereTheSecretIsMounted(BaseModel): - file_path: str = FieldInfo(alias="filePath") - """absolute path to the file where the secret is mounted""" - - id: Optional[str] = None - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - creator: Optional[AbsolutePathToTheFileWhereTheSecretIsMountedCreator] = None - """creator is the identity of the creator of the secret""" - - name: Optional[str] = None - """Name of the secret for humans.""" - - project_id: Optional[str] = FieldInfo(alias="projectId", default=None) - """The Project ID this Secret belongs to""" - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - -SecretListResponse: TypeAlias = Union[ - SecretWillBeCreatedAsAnEnvironmentVariableWithTheSameNameAsTheSecret, AbsolutePathToTheFileWhereTheSecretIsMounted -] diff --git a/src/gitpod/types/shared/__init__.py b/src/gitpod/types/shared/__init__.py new file mode 100644 index 0000000..4911a8a --- /dev/null +++ b/src/gitpod/types/shared/__init__.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .runs_on import RunsOn as RunsOn +from .subject import Subject as Subject +from .principal import Principal as Principal +from .field_value import FieldValue as FieldValue +from .user_status import UserStatus as UserStatus +from .task_execution import TaskExecution as TaskExecution +from .environment_class import EnvironmentClass as EnvironmentClass +from .organization_role import OrganizationRole as OrganizationRole +from .automation_trigger import AutomationTrigger as AutomationTrigger +from .task_execution_spec import TaskExecutionSpec as TaskExecutionSpec +from .task_execution_phase import TaskExecutionPhase as TaskExecutionPhase +from .task_execution_status import TaskExecutionStatus as TaskExecutionStatus +from .task_execution_metadata import TaskExecutionMetadata as TaskExecutionMetadata diff --git a/src/gitpod/types/shared/automation_trigger.py b/src/gitpod/types/shared/automation_trigger.py new file mode 100644 index 0000000..2b5eba3 --- /dev/null +++ b/src/gitpod/types/shared/automation_trigger.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["AutomationTrigger"] + + +class AutomationTrigger(BaseModel): + manual: Optional[bool] = None + + post_devcontainer_start: Optional[bool] = FieldInfo(alias="postDevcontainerStart", default=None) + + post_environment_start: Optional[bool] = FieldInfo(alias="postEnvironmentStart", default=None) diff --git a/src/gitpod/types/environments/class_list_response.py b/src/gitpod/types/shared/environment_class.py similarity index 80% rename from src/gitpod/types/environments/class_list_response.py rename to src/gitpod/types/shared/environment_class.py index 59606af..24f66bb 100644 --- a/src/gitpod/types/environments/class_list_response.py +++ b/src/gitpod/types/shared/environment_class.py @@ -5,21 +5,16 @@ from pydantic import Field as FieldInfo from ..._models import BaseModel +from .field_value import FieldValue -__all__ = ["ClassListResponse", "Configuration"] +__all__ = ["EnvironmentClass"] -class Configuration(BaseModel): - key: Optional[str] = None - - value: Optional[str] = None - - -class ClassListResponse(BaseModel): +class EnvironmentClass(BaseModel): id: Optional[str] = None """id is the unique identifier of the environment class""" - configuration: Optional[List[Configuration]] = None + configuration: Optional[List[FieldValue]] = None """configuration describes the configuration of the environment class""" description: Optional[str] = None diff --git a/src/gitpod/types/shared/field_value.py b/src/gitpod/types/shared/field_value.py new file mode 100644 index 0000000..90a9019 --- /dev/null +++ b/src/gitpod/types/shared/field_value.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["FieldValue"] + + +class FieldValue(BaseModel): + key: Optional[str] = None + + value: Optional[str] = None diff --git a/src/gitpod/types/shared/organization_role.py b/src/gitpod/types/shared/organization_role.py new file mode 100644 index 0000000..202e7a3 --- /dev/null +++ b/src/gitpod/types/shared/organization_role.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["OrganizationRole"] + +OrganizationRole: TypeAlias = Literal[ + "ORGANIZATION_ROLE_UNSPECIFIED", "ORGANIZATION_ROLE_ADMIN", "ORGANIZATION_ROLE_MEMBER" +] diff --git a/src/gitpod/types/shared/principal.py b/src/gitpod/types/shared/principal.py new file mode 100644 index 0000000..bd0a3b9 --- /dev/null +++ b/src/gitpod/types/shared/principal.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["Principal"] + +Principal: TypeAlias = Literal[ + "PRINCIPAL_UNSPECIFIED", + "PRINCIPAL_ACCOUNT", + "PRINCIPAL_USER", + "PRINCIPAL_RUNNER", + "PRINCIPAL_ENVIRONMENT", + "PRINCIPAL_SERVICE_ACCOUNT", +] diff --git a/src/gitpod/types/shared/runs_on.py b/src/gitpod/types/shared/runs_on.py new file mode 100644 index 0000000..7702279 --- /dev/null +++ b/src/gitpod/types/shared/runs_on.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["RunsOn", "Docker"] + + +class Docker(BaseModel): + environment: Optional[List[str]] = None + + image: Optional[str] = None + + +class RunsOn(BaseModel): + docker: Docker diff --git a/src/gitpod/types/shared/subject.py b/src/gitpod/types/shared/subject.py new file mode 100644 index 0000000..88a258c --- /dev/null +++ b/src/gitpod/types/shared/subject.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from .principal import Principal + +__all__ = ["Subject"] + + +class Subject(BaseModel): + id: Optional[str] = None + """id is the UUID of the subject""" + + principal: Optional[Principal] = None + """Principal is the principal of the subject""" diff --git a/src/gitpod/types/shared/task_execution.py b/src/gitpod/types/shared/task_execution.py new file mode 100644 index 0000000..072f66c --- /dev/null +++ b/src/gitpod/types/shared/task_execution.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from .task_execution_spec import TaskExecutionSpec +from .task_execution_status import TaskExecutionStatus +from .task_execution_metadata import TaskExecutionMetadata + +__all__ = ["TaskExecution"] + + +class TaskExecution(BaseModel): + id: Optional[str] = None + + metadata: Optional[TaskExecutionMetadata] = None + + spec: Optional[TaskExecutionSpec] = None + + status: Optional[TaskExecutionStatus] = None diff --git a/src/gitpod/types/runner_list_response.py b/src/gitpod/types/shared/task_execution_metadata.py similarity index 72% rename from src/gitpod/types/runner_list_response.py rename to src/gitpod/types/shared/task_execution_metadata.py index a3029d6..b0e28c9 100644 --- a/src/gitpod/types/runner_list_response.py +++ b/src/gitpod/types/shared/task_execution_metadata.py @@ -1,113 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Optional from datetime import datetime -from typing_extensions import Literal from pydantic import Field as FieldInfo -from .._models import BaseModel +from .subject import Subject +from ..._models import BaseModel -__all__ = ["RunnerListResponse", "Creator", "Spec", "SpecConfiguration", "Status", "StatusAdditionalInfo"] +__all__ = ["TaskExecutionMetadata"] -class Creator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class SpecConfiguration(BaseModel): - auto_update: Optional[bool] = FieldInfo(alias="autoUpdate", default=None) - """auto_update indicates whether the runner should automatically update itself.""" - - region: Optional[str] = None - """ - Region to deploy the runner in, if applicable. This is mainly used for remote - runners, and is only a hint. The runner may be deployed in a different region. - See the runner's status for the actual region. - """ - - release_channel: Optional[ - Literal["RUNNER_RELEASE_CHANNEL_UNSPECIFIED", "RUNNER_RELEASE_CHANNEL_STABLE", "RUNNER_RELEASE_CHANNEL_LATEST"] - ] = FieldInfo(alias="releaseChannel", default=None) - """The release channel the runner is on""" - - -class Spec(BaseModel): - configuration: Optional[SpecConfiguration] = None - """The runner's configuration""" - - desired_phase: Optional[ - Literal[ - "RUNNER_PHASE_UNSPECIFIED", - "RUNNER_PHASE_CREATED", - "RUNNER_PHASE_INACTIVE", - "RUNNER_PHASE_ACTIVE", - "RUNNER_PHASE_DELETING", - "RUNNER_PHASE_DELETED", - "RUNNER_PHASE_DEGRADED", - ] - ] = FieldInfo(alias="desiredPhase", default=None) - """RunnerPhase represents the phase a runner is in""" - - -class StatusAdditionalInfo(BaseModel): - key: Optional[str] = None - - value: Optional[str] = None - - -class Status(BaseModel): - additional_info: Optional[List[StatusAdditionalInfo]] = FieldInfo(alias="additionalInfo", default=None) - """additional_info contains additional information about the runner, e.g. - - a CloudFormation stack URL. - """ - - capabilities: Optional[ - List[Literal["RUNNER_CAPABILITY_UNSPECIFIED", "RUNNER_CAPABILITY_FETCH_LOCAL_SCM_INTEGRATIONS"]] - ] = None - """capabilities is a list of capabilities the runner supports.""" - - log_url: Optional[str] = FieldInfo(alias="logUrl", default=None) - - message: Optional[str] = None - """ - The runner's reported message which is shown to users. This message adds more - context to the runner's phase. - """ - - phase: Optional[ - Literal[ - "RUNNER_PHASE_UNSPECIFIED", - "RUNNER_PHASE_CREATED", - "RUNNER_PHASE_INACTIVE", - "RUNNER_PHASE_ACTIVE", - "RUNNER_PHASE_DELETING", - "RUNNER_PHASE_DELETED", - "RUNNER_PHASE_DEGRADED", - ] - ] = None - """RunnerPhase represents the phase a runner is in""" - - region: Optional[str] = None - """region is the region the runner is running in, if applicable.""" - - system_details: Optional[str] = FieldInfo(alias="systemDetails", default=None) - - updated_at: Optional[datetime] = FieldInfo(alias="updatedAt", default=None) +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 @@ -199,10 +104,6 @@ class Status(BaseModel): to obtain a formatter capable of generating timestamps in this format. """ - version: Optional[str] = None - - -class RunnerListResponse(BaseModel): created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) """ A Timestamp represents a point in time independent of any time zone or local @@ -295,40 +196,13 @@ class RunnerListResponse(BaseModel): to obtain a formatter capable of generating timestamps in this format. """ - creator: Optional[Creator] = None - """creator is the identity of the creator of the environment""" - - kind: Optional[ - Literal["RUNNER_KIND_UNSPECIFIED", "RUNNER_KIND_LOCAL", "RUNNER_KIND_REMOTE", "RUNNER_KIND_LOCAL_CONFIGURATION"] - ] = None - """RunnerKind represents the kind of a runner""" - - name: Optional[str] = None - """The runner's name which is shown to users""" - - provider: Optional[ - Literal[ - "RUNNER_PROVIDER_UNSPECIFIED", - "RUNNER_PROVIDER_AWS_EC2", - "RUNNER_PROVIDER_LINUX_HOST", - "RUNNER_PROVIDER_DESKTOP_MAC", - ] - ] = 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. - """ - - runner_id: Optional[str] = FieldInfo(alias="runnerId", default=None) + creator: Optional[Subject] = None + """creator describes the principal who created/started the task run.""" - spec: Optional[Spec] = None - """The runner's specification""" + environment_id: Optional[str] = FieldInfo(alias="environmentId", default=None) + """environment_id is the ID of the environment in which the task run is executed.""" - status: Optional[Status] = None - """RunnerStatus represents the status of a runner""" - - updated_at: Optional[datetime] = FieldInfo(alias="updatedAt", default=None) + 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 @@ -419,3 +293,9 @@ class RunnerListResponse(BaseModel): [`ISODateTimeFormat.dateTime()`]() to obtain a formatter capable of generating timestamps in this format. """ + + started_by: Optional[str] = FieldInfo(alias="startedBy", default=None) + """started_by describes the trigger that started the task execution.""" + + task_id: Optional[str] = FieldInfo(alias="taskId", default=None) + """task_id is the ID of the main task being executed.""" diff --git a/src/gitpod/types/shared/task_execution_phase.py b/src/gitpod/types/shared/task_execution_phase.py new file mode 100644 index 0000000..84b6f31 --- /dev/null +++ b/src/gitpod/types/shared/task_execution_phase.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["TaskExecutionPhase"] + +TaskExecutionPhase: TypeAlias = Literal[ + "TASK_EXECUTION_PHASE_UNSPECIFIED", + "TASK_EXECUTION_PHASE_PENDING", + "TASK_EXECUTION_PHASE_RUNNING", + "TASK_EXECUTION_PHASE_SUCCEEDED", + "TASK_EXECUTION_PHASE_FAILED", + "TASK_EXECUTION_PHASE_STOPPED", +] diff --git a/src/gitpod/types/shared/task_execution_spec.py b/src/gitpod/types/shared/task_execution_spec.py new file mode 100644 index 0000000..923f5f6 --- /dev/null +++ b/src/gitpod/types/shared/task_execution_spec.py @@ -0,0 +1,49 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel +from .task_execution_phase import TaskExecutionPhase +from ..environments.automations.task_spec import TaskSpec + +__all__ = ["TaskExecutionSpec", "Plan", "PlanStep", "PlanStepTask"] + + +class PlanStepTask(BaseModel): + id: Optional[str] = None + + spec: Optional[TaskSpec] = None + + +class PlanStep(BaseModel): + id: Optional[str] = None + """ID is the ID of the execution step""" + + depends_on: Optional[List[str]] = FieldInfo(alias="dependsOn", default=None) + + label: Optional[str] = None + + service_id: Optional[str] = FieldInfo(alias="serviceId", default=None) + + task: Optional[PlanStepTask] = None + + +class Plan(BaseModel): + steps: Optional[List[PlanStep]] = None + + +class TaskExecutionSpec(BaseModel): + desired_phase: Optional[TaskExecutionPhase] = FieldInfo(alias="desiredPhase", default=None) + """desired_phase is the phase the task execution should be in. + + Used to stop a running task execution early. + """ + + plan: Optional[List[Plan]] = None + """plan is a list of groups of steps. + + The steps in a group are executed concurrently, while the groups are executed + sequentially. The order of the groups is the order in which they are executed. + """ diff --git a/src/gitpod/types/shared/task_execution_status.py b/src/gitpod/types/shared/task_execution_status.py new file mode 100644 index 0000000..b5ab03a --- /dev/null +++ b/src/gitpod/types/shared/task_execution_status.py @@ -0,0 +1,58 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel +from .task_execution_phase import TaskExecutionPhase + +__all__ = ["TaskExecutionStatus", "Step"] + + +class Step(BaseModel): + id: Optional[str] = None + """ID is the ID of the execution step""" + + failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) + """failure_message summarises why the step failed to operate. + + If this is non-empty the step has failed to operate and will likely transition + to a failed state. + """ + + phase: Optional[TaskExecutionPhase] = None + """phase is the current phase of the execution step""" + + +class TaskExecutionStatus(BaseModel): + failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) + """failure_message summarises why the task execution failed to operate. + + If this is non-empty the task execution has failed to operate and will likely + transition to a failed state. + """ + + log_url: Optional[str] = FieldInfo(alias="logUrl", default=None) + """log_url is the URL to the logs of the task's steps. + + If this is empty, the task either has no logs or has not yet started. + """ + + phase: Optional[TaskExecutionPhase] = None + """the phase of a task execution represents the aggregated phase of all steps.""" + + status_version: Optional[str] = FieldInfo(alias="statusVersion", default=None) + """version of the status update. + + Task executions themselves are unversioned, but their status has different + versions. The value of this field has no semantic meaning (e.g. don't interpret + it as as a timestamp), but it can be used to impose a partial order. If + a.status_version < b.status_version then a was the status before b. + """ + + steps: Optional[List[Step]] = None + """steps provides the status for each individual step of the task execution. + + If a step is missing it has not yet started. + """ diff --git a/src/gitpod/types/shared/user_status.py b/src/gitpod/types/shared/user_status.py new file mode 100644 index 0000000..d13e58c --- /dev/null +++ b/src/gitpod/types/shared/user_status.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["UserStatus"] + +UserStatus: TypeAlias = Literal[ + "USER_STATUS_UNSPECIFIED", "USER_STATUS_ACTIVE", "USER_STATUS_SUSPENDED", "USER_STATUS_LEFT" +] diff --git a/src/gitpod/types/shared_params/__init__.py b/src/gitpod/types/shared_params/__init__.py new file mode 100644 index 0000000..d98911f --- /dev/null +++ b/src/gitpod/types/shared_params/__init__.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .runs_on import RunsOn as RunsOn +from .subject import Subject as Subject +from .principal import Principal as Principal +from .field_value import FieldValue as FieldValue +from .environment_class import EnvironmentClass as EnvironmentClass +from .organization_role import OrganizationRole as OrganizationRole +from .automation_trigger import AutomationTrigger as AutomationTrigger +from .task_execution_phase import TaskExecutionPhase as TaskExecutionPhase diff --git a/src/gitpod/types/shared_params/automation_trigger.py b/src/gitpod/types/shared_params/automation_trigger.py new file mode 100644 index 0000000..173dff4 --- /dev/null +++ b/src/gitpod/types/shared_params/automation_trigger.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["AutomationTrigger"] + + +class AutomationTrigger(TypedDict, total=False): + manual: bool + + post_devcontainer_start: Annotated[bool, PropertyInfo(alias="postDevcontainerStart")] + + post_environment_start: Annotated[bool, PropertyInfo(alias="postEnvironmentStart")] diff --git a/src/gitpod/types/shared_params/environment_class.py b/src/gitpod/types/shared_params/environment_class.py new file mode 100644 index 0000000..17e43a4 --- /dev/null +++ b/src/gitpod/types/shared_params/environment_class.py @@ -0,0 +1,37 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Annotated, TypedDict + +from ..._utils import PropertyInfo +from .field_value import FieldValue + +__all__ = ["EnvironmentClass"] + + +class EnvironmentClass(TypedDict, total=False): + id: str + """id is the unique identifier of the environment class""" + + configuration: Iterable[FieldValue] + """configuration describes the configuration of the environment class""" + + description: str + """description is a human readable description of the environment class""" + + display_name: Annotated[str, PropertyInfo(alias="displayName")] + """display_name is the human readable name of the environment class""" + + enabled: bool + """ + enabled indicates whether the environment class can be used to create new + environments. + """ + + runner_id: Annotated[str, PropertyInfo(alias="runnerId")] + """ + runner_id is the unique identifier of the runner the environment class belongs + to + """ diff --git a/src/gitpod/types/shared_params/field_value.py b/src/gitpod/types/shared_params/field_value.py new file mode 100644 index 0000000..05f28c1 --- /dev/null +++ b/src/gitpod/types/shared_params/field_value.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["FieldValue"] + + +class FieldValue(TypedDict, total=False): + key: str + + value: str diff --git a/src/gitpod/types/shared_params/organization_role.py b/src/gitpod/types/shared_params/organization_role.py new file mode 100644 index 0000000..1c3d4f1 --- /dev/null +++ b/src/gitpod/types/shared_params/organization_role.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypeAlias + +__all__ = ["OrganizationRole"] + +OrganizationRole: TypeAlias = Literal[ + "ORGANIZATION_ROLE_UNSPECIFIED", "ORGANIZATION_ROLE_ADMIN", "ORGANIZATION_ROLE_MEMBER" +] diff --git a/src/gitpod/types/shared_params/principal.py b/src/gitpod/types/shared_params/principal.py new file mode 100644 index 0000000..1f2e22e --- /dev/null +++ b/src/gitpod/types/shared_params/principal.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypeAlias + +__all__ = ["Principal"] + +Principal: TypeAlias = Literal[ + "PRINCIPAL_UNSPECIFIED", + "PRINCIPAL_ACCOUNT", + "PRINCIPAL_USER", + "PRINCIPAL_RUNNER", + "PRINCIPAL_ENVIRONMENT", + "PRINCIPAL_SERVICE_ACCOUNT", +] diff --git a/src/gitpod/types/shared_params/runs_on.py b/src/gitpod/types/shared_params/runs_on.py new file mode 100644 index 0000000..55a079f --- /dev/null +++ b/src/gitpod/types/shared_params/runs_on.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Required, TypedDict + +__all__ = ["RunsOn", "Docker"] + + +class Docker(TypedDict, total=False): + environment: List[str] + + image: str + + +class RunsOn(TypedDict, total=False): + docker: Required[Docker] diff --git a/src/gitpod/types/shared_params/subject.py b/src/gitpod/types/shared_params/subject.py new file mode 100644 index 0000000..1c1293b --- /dev/null +++ b/src/gitpod/types/shared_params/subject.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from ..shared.principal import Principal + +__all__ = ["Subject"] + + +class Subject(TypedDict, total=False): + id: str + """id is the UUID of the subject""" + + principal: Principal + """Principal is the principal of the subject""" diff --git a/src/gitpod/types/shared_params/task_execution_phase.py b/src/gitpod/types/shared_params/task_execution_phase.py new file mode 100644 index 0000000..60b1bc3 --- /dev/null +++ b/src/gitpod/types/shared_params/task_execution_phase.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypeAlias + +__all__ = ["TaskExecutionPhase"] + +TaskExecutionPhase: TypeAlias = Literal[ + "TASK_EXECUTION_PHASE_UNSPECIFIED", + "TASK_EXECUTION_PHASE_PENDING", + "TASK_EXECUTION_PHASE_RUNNING", + "TASK_EXECUTION_PHASE_SUCCEEDED", + "TASK_EXECUTION_PHASE_FAILED", + "TASK_EXECUTION_PHASE_STOPPED", +] diff --git a/src/gitpod/types/user.py b/src/gitpod/types/user.py new file mode 100644 index 0000000..47c3be9 --- /dev/null +++ b/src/gitpod/types/user.py @@ -0,0 +1,123 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.user_status import UserStatus + +__all__ = ["User"] + + +class User(BaseModel): + id: Optional[str] = None + """id is a UUID of the user""" + + avatar_url: Optional[str] = FieldInfo(alias="avatarUrl", default=None) + """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()`]() + to obtain a formatter capable of generating timestamps in this format. + """ + + name: Optional[str] = None + """name is the full name of the user""" + + organization_id: Optional[str] = FieldInfo(alias="organizationId", default=None) + """organization_id is the id of the organization this account is owned by. + + +optional if not set, this account is owned by the installation. + """ + + status: Optional[UserStatus] = None + """status is the status the user is in""" diff --git a/src/gitpod/types/user_get_authenticated_user_response.py b/src/gitpod/types/user_get_authenticated_user_response.py index 5dc0b4f..7760c4a 100644 --- a/src/gitpod/types/user_get_authenticated_user_response.py +++ b/src/gitpod/types/user_get_authenticated_user_response.py @@ -1,128 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from pydantic import Field as FieldInfo +from .user import User from .._models import BaseModel -__all__ = ["UserGetAuthenticatedUserResponse", "User"] - - -class User(BaseModel): - id: Optional[str] = None - """id is a UUID of the user""" - - avatar_url: Optional[str] = FieldInfo(alias="avatarUrl", default=None) - """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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - name: Optional[str] = None - """name is the full name of the user""" - - organization_id: Optional[str] = FieldInfo(alias="organizationId", default=None) - """organization_id is the id of the organization this account is owned by. - - +optional if not set, this account is owned by the installation. - """ - - status: Optional[ - Literal["USER_STATUS_UNSPECIFIED", "USER_STATUS_ACTIVE", "USER_STATUS_SUSPENDED", "USER_STATUS_LEFT"] - ] = None - """status is the status the user is in""" +__all__ = ["UserGetAuthenticatedUserResponse"] class UserGetAuthenticatedUserResponse(BaseModel): diff --git a/src/gitpod/types/users/__init__.py b/src/gitpod/types/users/__init__.py index c5d40ad..b54651e 100644 --- a/src/gitpod/types/users/__init__.py +++ b/src/gitpod/types/users/__init__.py @@ -6,4 +6,4 @@ from .pat_list_params import PatListParams as PatListParams from .pat_get_response import PatGetResponse as PatGetResponse from .pat_delete_params import PatDeleteParams as PatDeleteParams -from .pat_list_response import PatListResponse as PatListResponse +from .personal_access_token import PersonalAccessToken as PersonalAccessToken diff --git a/src/gitpod/types/users/pat_get_response.py b/src/gitpod/types/users/pat_get_response.py index 8616d1a..6be85d5 100644 --- a/src/gitpod/types/users/pat_get_response.py +++ b/src/gitpod/types/users/pat_get_response.py @@ -1,318 +1,12 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from pydantic import Field as FieldInfo from ..._models import BaseModel +from .personal_access_token import PersonalAccessToken -__all__ = ["PatGetResponse", "Pat", "PatCreator"] - - -class PatCreator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class Pat(BaseModel): - id: Optional[str] = None - - 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - creator: Optional[PatCreator] = None - - description: Optional[str] = None - - expires_at: Optional[datetime] = FieldInfo(alias="expiresAt", 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - last_used: Optional[datetime] = FieldInfo(alias="lastUsed", 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()`]() - to obtain a formatter capable of generating timestamps in this format. - """ - - user_id: Optional[str] = FieldInfo(alias="userId", default=None) +__all__ = ["PatGetResponse"] class PatGetResponse(BaseModel): - pat: Optional[Pat] = None + pat: Optional[PersonalAccessToken] = None diff --git a/src/gitpod/types/users/pat_list_response.py b/src/gitpod/types/users/personal_access_token.py similarity index 95% rename from src/gitpod/types/users/pat_list_response.py rename to src/gitpod/types/users/personal_access_token.py index ec1e95b..c094c3c 100644 --- a/src/gitpod/types/users/pat_list_response.py +++ b/src/gitpod/types/users/personal_access_token.py @@ -2,33 +2,16 @@ from typing import Optional from datetime import datetime -from typing_extensions import Literal from pydantic import Field as FieldInfo from ..._models import BaseModel +from ..shared.subject import Subject -__all__ = ["PatListResponse", "Creator"] +__all__ = ["PersonalAccessToken"] -class Creator(BaseModel): - id: Optional[str] = None - """id is the UUID of the subject""" - - principal: Optional[ - Literal[ - "PRINCIPAL_UNSPECIFIED", - "PRINCIPAL_ACCOUNT", - "PRINCIPAL_USER", - "PRINCIPAL_RUNNER", - "PRINCIPAL_ENVIRONMENT", - "PRINCIPAL_SERVICE_ACCOUNT", - ] - ] = None - """Principal is the principal of the subject""" - - -class PatListResponse(BaseModel): +class PersonalAccessToken(BaseModel): id: Optional[str] = None created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) @@ -123,7 +106,7 @@ class PatListResponse(BaseModel): to obtain a formatter capable of generating timestamps in this format. """ - creator: Optional[Creator] = None + creator: Optional[Subject] = None description: Optional[str] = None diff --git a/tests/api_resources/environments/automations/tasks/test_executions.py b/tests/api_resources/environments/automations/tasks/test_executions.py index 136a011..45ce226 100644 --- a/tests/api_resources/environments/automations/tasks/test_executions.py +++ b/tests/api_resources/environments/automations/tasks/test_executions.py @@ -10,8 +10,8 @@ from gitpod import Gitpod, AsyncGitpod from tests.utils import assert_matches_type from gitpod.pagination import SyncTaskExecutionsPage, AsyncTaskExecutionsPage +from gitpod.types.shared import TaskExecution from gitpod.types.environments.automations.tasks import ( - ExecutionListResponse, ExecutionRetrieveResponse, ) @@ -61,7 +61,7 @@ def test_streaming_response_retrieve(self, client: Gitpod) -> None: @parametrize def test_method_list(self, client: Gitpod) -> None: execution = client.environments.automations.tasks.executions.list() - assert_matches_type(SyncTaskExecutionsPage[ExecutionListResponse], execution, path=["response"]) + assert_matches_type(SyncTaskExecutionsPage[TaskExecution], execution, path=["response"]) @pytest.mark.skip() @parametrize @@ -80,7 +80,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: "page_size": 100, }, ) - assert_matches_type(SyncTaskExecutionsPage[ExecutionListResponse], execution, path=["response"]) + assert_matches_type(SyncTaskExecutionsPage[TaskExecution], execution, path=["response"]) @pytest.mark.skip() @parametrize @@ -90,7 +90,7 @@ def test_raw_response_list(self, client: Gitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" execution = response.parse() - assert_matches_type(SyncTaskExecutionsPage[ExecutionListResponse], execution, path=["response"]) + assert_matches_type(SyncTaskExecutionsPage[TaskExecution], execution, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +100,7 @@ def test_streaming_response_list(self, client: Gitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" execution = response.parse() - assert_matches_type(SyncTaskExecutionsPage[ExecutionListResponse], execution, path=["response"]) + assert_matches_type(SyncTaskExecutionsPage[TaskExecution], execution, path=["response"]) assert cast(Any, response.is_closed) is True @@ -186,7 +186,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncGitpod) -> N @parametrize async def test_method_list(self, async_client: AsyncGitpod) -> None: execution = await async_client.environments.automations.tasks.executions.list() - assert_matches_type(AsyncTaskExecutionsPage[ExecutionListResponse], execution, path=["response"]) + assert_matches_type(AsyncTaskExecutionsPage[TaskExecution], execution, path=["response"]) @pytest.mark.skip() @parametrize @@ -205,7 +205,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N "page_size": 100, }, ) - assert_matches_type(AsyncTaskExecutionsPage[ExecutionListResponse], execution, path=["response"]) + assert_matches_type(AsyncTaskExecutionsPage[TaskExecution], execution, path=["response"]) @pytest.mark.skip() @parametrize @@ -215,7 +215,7 @@ async def test_raw_response_list(self, async_client: AsyncGitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" execution = await response.parse() - assert_matches_type(AsyncTaskExecutionsPage[ExecutionListResponse], execution, path=["response"]) + assert_matches_type(AsyncTaskExecutionsPage[TaskExecution], execution, path=["response"]) @pytest.mark.skip() @parametrize @@ -225,7 +225,7 @@ async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" execution = await response.parse() - assert_matches_type(AsyncTaskExecutionsPage[ExecutionListResponse], execution, path=["response"]) + assert_matches_type(AsyncTaskExecutionsPage[TaskExecution], execution, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/environments/automations/test_services.py b/tests/api_resources/environments/automations/test_services.py index f6a1893..9c90a24 100644 --- a/tests/api_resources/environments/automations/test_services.py +++ b/tests/api_resources/environments/automations/test_services.py @@ -12,7 +12,7 @@ from gitpod._utils import parse_datetime from gitpod.pagination import SyncServicesPage, AsyncServicesPage from gitpod.types.environments.automations import ( - ServiceListResponse, + Service, ServiceCreateResponse, ServiceRetrieveResponse, ) @@ -43,7 +43,13 @@ def test_method_create_with_all_params(self, client: Gitpod) -> None: "description": "description", "name": "x", "reference": "reference", - "triggered_by": [{"manual": True}], + "triggered_by": [ + { + "manual": True, + "post_devcontainer_start": True, + "post_environment_start": True, + } + ], }, spec={ "commands": { @@ -133,9 +139,38 @@ def test_method_update(self, client: Gitpod) -> None: def test_method_update_with_all_params(self, client: Gitpod) -> None: service = client.environments.automations.services.update( id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - metadata={"description": "description"}, - spec={"commands": {"ready": "ready"}}, - status={"failure_message": "failureMessage"}, + metadata={ + "description": "description", + "name": "x", + "triggered_by": { + "trigger": [ + { + "manual": True, + "post_devcontainer_start": True, + "post_environment_start": True, + } + ] + }, + }, + spec={ + "commands": { + "ready": "ready", + "start": "start", + "stop": "stop", + }, + "runs_on": { + "docker": { + "environment": ["string"], + "image": "x", + } + }, + }, + status={ + "failure_message": "failureMessage", + "log_url": "logUrl", + "phase": "SERVICE_PHASE_UNSPECIFIED", + "session": "session", + }, ) assert_matches_type(object, service, path=["response"]) @@ -165,7 +200,7 @@ def test_streaming_response_update(self, client: Gitpod) -> None: @parametrize def test_method_list(self, client: Gitpod) -> None: service = client.environments.automations.services.list() - assert_matches_type(SyncServicesPage[ServiceListResponse], service, path=["response"]) + assert_matches_type(SyncServicesPage[Service], service, path=["response"]) @pytest.mark.skip() @parametrize @@ -183,7 +218,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: "page_size": 100, }, ) - assert_matches_type(SyncServicesPage[ServiceListResponse], service, path=["response"]) + assert_matches_type(SyncServicesPage[Service], service, path=["response"]) @pytest.mark.skip() @parametrize @@ -193,7 +228,7 @@ def test_raw_response_list(self, client: Gitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" service = response.parse() - assert_matches_type(SyncServicesPage[ServiceListResponse], service, path=["response"]) + assert_matches_type(SyncServicesPage[Service], service, path=["response"]) @pytest.mark.skip() @parametrize @@ -203,7 +238,7 @@ def test_streaming_response_list(self, client: Gitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" service = response.parse() - assert_matches_type(SyncServicesPage[ServiceListResponse], service, path=["response"]) + assert_matches_type(SyncServicesPage[Service], service, path=["response"]) assert cast(Any, response.is_closed) is True @@ -340,7 +375,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> "description": "description", "name": "x", "reference": "reference", - "triggered_by": [{"manual": True}], + "triggered_by": [ + { + "manual": True, + "post_devcontainer_start": True, + "post_environment_start": True, + } + ], }, spec={ "commands": { @@ -430,9 +471,38 @@ async def test_method_update(self, async_client: AsyncGitpod) -> None: async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> None: service = await async_client.environments.automations.services.update( id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - metadata={"description": "description"}, - spec={"commands": {"ready": "ready"}}, - status={"failure_message": "failureMessage"}, + metadata={ + "description": "description", + "name": "x", + "triggered_by": { + "trigger": [ + { + "manual": True, + "post_devcontainer_start": True, + "post_environment_start": True, + } + ] + }, + }, + spec={ + "commands": { + "ready": "ready", + "start": "start", + "stop": "stop", + }, + "runs_on": { + "docker": { + "environment": ["string"], + "image": "x", + } + }, + }, + status={ + "failure_message": "failureMessage", + "log_url": "logUrl", + "phase": "SERVICE_PHASE_UNSPECIFIED", + "session": "session", + }, ) assert_matches_type(object, service, path=["response"]) @@ -462,7 +532,7 @@ async def test_streaming_response_update(self, async_client: AsyncGitpod) -> Non @parametrize async def test_method_list(self, async_client: AsyncGitpod) -> None: service = await async_client.environments.automations.services.list() - assert_matches_type(AsyncServicesPage[ServiceListResponse], service, path=["response"]) + assert_matches_type(AsyncServicesPage[Service], service, path=["response"]) @pytest.mark.skip() @parametrize @@ -480,7 +550,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N "page_size": 100, }, ) - assert_matches_type(AsyncServicesPage[ServiceListResponse], service, path=["response"]) + assert_matches_type(AsyncServicesPage[Service], service, path=["response"]) @pytest.mark.skip() @parametrize @@ -490,7 +560,7 @@ async def test_raw_response_list(self, async_client: AsyncGitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" service = await response.parse() - assert_matches_type(AsyncServicesPage[ServiceListResponse], service, path=["response"]) + assert_matches_type(AsyncServicesPage[Service], service, path=["response"]) @pytest.mark.skip() @parametrize @@ -500,7 +570,7 @@ async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" service = await response.parse() - assert_matches_type(AsyncServicesPage[ServiceListResponse], service, path=["response"]) + assert_matches_type(AsyncServicesPage[Service], service, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/environments/automations/test_tasks.py b/tests/api_resources/environments/automations/test_tasks.py index 381d28f..4cee7ae 100644 --- a/tests/api_resources/environments/automations/test_tasks.py +++ b/tests/api_resources/environments/automations/test_tasks.py @@ -12,7 +12,7 @@ from gitpod._utils import parse_datetime from gitpod.pagination import SyncTasksPage, AsyncTasksPage from gitpod.types.environments.automations import ( - TaskListResponse, + Task, TaskStartResponse, TaskCreateResponse, TaskRetrieveResponse, @@ -45,7 +45,13 @@ def test_method_create_with_all_params(self, client: Gitpod) -> None: "description": "description", "name": "x", "reference": "reference", - "triggered_by": [{"manual": True}], + "triggered_by": [ + { + "manual": True, + "post_devcontainer_start": True, + "post_environment_start": True, + } + ], }, spec={ "command": "command", @@ -129,8 +135,28 @@ def test_method_update_with_all_params(self, client: Gitpod) -> None: task = client.environments.automations.tasks.update( id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", depends_on=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - metadata={"description": "description"}, - spec={"command": "command"}, + metadata={ + "description": "description", + "name": "x", + "triggered_by": { + "trigger": [ + { + "manual": True, + "post_devcontainer_start": True, + "post_environment_start": True, + } + ] + }, + }, + spec={ + "command": "command", + "runs_on": { + "docker": { + "environment": ["string"], + "image": "x", + } + }, + }, ) assert_matches_type(object, task, path=["response"]) @@ -160,7 +186,7 @@ def test_streaming_response_update(self, client: Gitpod) -> None: @parametrize def test_method_list(self, client: Gitpod) -> None: task = client.environments.automations.tasks.list() - assert_matches_type(SyncTasksPage[TaskListResponse], task, path=["response"]) + assert_matches_type(SyncTasksPage[Task], task, path=["response"]) @pytest.mark.skip() @parametrize @@ -178,7 +204,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: "page_size": 100, }, ) - assert_matches_type(SyncTasksPage[TaskListResponse], task, path=["response"]) + assert_matches_type(SyncTasksPage[Task], task, path=["response"]) @pytest.mark.skip() @parametrize @@ -188,7 +214,7 @@ def test_raw_response_list(self, client: Gitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" task = response.parse() - assert_matches_type(SyncTasksPage[TaskListResponse], task, path=["response"]) + assert_matches_type(SyncTasksPage[Task], task, path=["response"]) @pytest.mark.skip() @parametrize @@ -198,7 +224,7 @@ def test_streaming_response_list(self, client: Gitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" task = response.parse() - assert_matches_type(SyncTasksPage[TaskListResponse], task, path=["response"]) + assert_matches_type(SyncTasksPage[Task], task, path=["response"]) assert cast(Any, response.is_closed) is True @@ -299,7 +325,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> "description": "description", "name": "x", "reference": "reference", - "triggered_by": [{"manual": True}], + "triggered_by": [ + { + "manual": True, + "post_devcontainer_start": True, + "post_environment_start": True, + } + ], }, spec={ "command": "command", @@ -383,8 +415,28 @@ async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> task = await async_client.environments.automations.tasks.update( id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", depends_on=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - metadata={"description": "description"}, - spec={"command": "command"}, + metadata={ + "description": "description", + "name": "x", + "triggered_by": { + "trigger": [ + { + "manual": True, + "post_devcontainer_start": True, + "post_environment_start": True, + } + ] + }, + }, + spec={ + "command": "command", + "runs_on": { + "docker": { + "environment": ["string"], + "image": "x", + } + }, + }, ) assert_matches_type(object, task, path=["response"]) @@ -414,7 +466,7 @@ async def test_streaming_response_update(self, async_client: AsyncGitpod) -> Non @parametrize async def test_method_list(self, async_client: AsyncGitpod) -> None: task = await async_client.environments.automations.tasks.list() - assert_matches_type(AsyncTasksPage[TaskListResponse], task, path=["response"]) + assert_matches_type(AsyncTasksPage[Task], task, path=["response"]) @pytest.mark.skip() @parametrize @@ -432,7 +484,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N "page_size": 100, }, ) - assert_matches_type(AsyncTasksPage[TaskListResponse], task, path=["response"]) + assert_matches_type(AsyncTasksPage[Task], task, path=["response"]) @pytest.mark.skip() @parametrize @@ -442,7 +494,7 @@ async def test_raw_response_list(self, async_client: AsyncGitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" task = await response.parse() - assert_matches_type(AsyncTasksPage[TaskListResponse], task, path=["response"]) + assert_matches_type(AsyncTasksPage[Task], task, path=["response"]) @pytest.mark.skip() @parametrize @@ -452,7 +504,7 @@ async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" task = await response.parse() - assert_matches_type(AsyncTasksPage[TaskListResponse], task, path=["response"]) + assert_matches_type(AsyncTasksPage[Task], task, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/environments/test_classes.py b/tests/api_resources/environments/test_classes.py index 3b525f3..f097f89 100644 --- a/tests/api_resources/environments/test_classes.py +++ b/tests/api_resources/environments/test_classes.py @@ -10,7 +10,7 @@ from gitpod import Gitpod, AsyncGitpod from tests.utils import assert_matches_type from gitpod.pagination import SyncEnvironmentClassesPage, AsyncEnvironmentClassesPage -from gitpod.types.environments import ClassListResponse +from gitpod.types.shared import EnvironmentClass base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,7 +22,7 @@ class TestClasses: @parametrize def test_method_list(self, client: Gitpod) -> None: class_ = client.environments.classes.list() - assert_matches_type(SyncEnvironmentClassesPage[ClassListResponse], class_, path=["response"]) + assert_matches_type(SyncEnvironmentClassesPage[EnvironmentClass], class_, path=["response"]) @pytest.mark.skip() @parametrize @@ -30,13 +30,16 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: class_ = client.environments.classes.list( token="token", page_size=0, - filter={"enabled": True}, + filter={ + "enabled": True, + "runner_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + }, pagination={ "token": "token", "page_size": 100, }, ) - assert_matches_type(SyncEnvironmentClassesPage[ClassListResponse], class_, path=["response"]) + assert_matches_type(SyncEnvironmentClassesPage[EnvironmentClass], class_, path=["response"]) @pytest.mark.skip() @parametrize @@ -46,7 +49,7 @@ def test_raw_response_list(self, client: Gitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" class_ = response.parse() - assert_matches_type(SyncEnvironmentClassesPage[ClassListResponse], class_, path=["response"]) + assert_matches_type(SyncEnvironmentClassesPage[EnvironmentClass], class_, path=["response"]) @pytest.mark.skip() @parametrize @@ -56,7 +59,7 @@ def test_streaming_response_list(self, client: Gitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" class_ = response.parse() - assert_matches_type(SyncEnvironmentClassesPage[ClassListResponse], class_, path=["response"]) + assert_matches_type(SyncEnvironmentClassesPage[EnvironmentClass], class_, path=["response"]) assert cast(Any, response.is_closed) is True @@ -68,7 +71,7 @@ class TestAsyncClasses: @parametrize async def test_method_list(self, async_client: AsyncGitpod) -> None: class_ = await async_client.environments.classes.list() - assert_matches_type(AsyncEnvironmentClassesPage[ClassListResponse], class_, path=["response"]) + assert_matches_type(AsyncEnvironmentClassesPage[EnvironmentClass], class_, path=["response"]) @pytest.mark.skip() @parametrize @@ -76,13 +79,16 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N class_ = await async_client.environments.classes.list( token="token", page_size=0, - filter={"enabled": True}, + filter={ + "enabled": True, + "runner_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + }, pagination={ "token": "token", "page_size": 100, }, ) - assert_matches_type(AsyncEnvironmentClassesPage[ClassListResponse], class_, path=["response"]) + assert_matches_type(AsyncEnvironmentClassesPage[EnvironmentClass], class_, path=["response"]) @pytest.mark.skip() @parametrize @@ -92,7 +98,7 @@ async def test_raw_response_list(self, async_client: AsyncGitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" class_ = await response.parse() - assert_matches_type(AsyncEnvironmentClassesPage[ClassListResponse], class_, path=["response"]) + assert_matches_type(AsyncEnvironmentClassesPage[EnvironmentClass], class_, path=["response"]) @pytest.mark.skip() @parametrize @@ -102,6 +108,6 @@ async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" class_ = await response.parse() - assert_matches_type(AsyncEnvironmentClassesPage[ClassListResponse], class_, path=["response"]) + assert_matches_type(AsyncEnvironmentClassesPage[EnvironmentClass], class_, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/organizations/test_sso_configurations.py b/tests/api_resources/organizations/test_sso_configurations.py index 04d19db..c8f45ad 100644 --- a/tests/api_resources/organizations/test_sso_configurations.py +++ b/tests/api_resources/organizations/test_sso_configurations.py @@ -11,7 +11,7 @@ from tests.utils import assert_matches_type from gitpod.pagination import SyncSSOConfigurationsPage, AsyncSSOConfigurationsPage from gitpod.types.organizations import ( - SSOConfigurationListResponse, + SSOConfiguration, SSOConfigurationCreateResponse, SSOConfigurationRetrieveResponse, ) @@ -100,154 +100,28 @@ def test_streaming_response_retrieve(self, client: Gitpod) -> None: @pytest.mark.skip() @parametrize - def test_method_update_overload_1(self, client: Gitpod) -> None: - sso_configuration = client.organizations.sso_configurations.update( - client_id="x", - ) + def test_method_update(self, client: Gitpod) -> None: + sso_configuration = client.organizations.sso_configurations.update() assert_matches_type(object, sso_configuration, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_update_overload_1(self, client: Gitpod) -> None: - response = client.organizations.sso_configurations.with_raw_response.update( - client_id="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - sso_configuration = response.parse() - assert_matches_type(object, sso_configuration, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update_overload_1(self, client: Gitpod) -> None: - with client.organizations.sso_configurations.with_streaming_response.update( - client_id="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - sso_configuration = response.parse() - assert_matches_type(object, sso_configuration, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_update_overload_2(self, client: Gitpod) -> None: + def test_method_update_with_all_params(self, client: Gitpod) -> None: sso_configuration = client.organizations.sso_configurations.update( + claims={"foo": "string"}, + client_id="x", client_secret="x", - ) - assert_matches_type(object, sso_configuration, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update_overload_2(self, client: Gitpod) -> None: - response = client.organizations.sso_configurations.with_raw_response.update( - client_secret="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - sso_configuration = response.parse() - assert_matches_type(object, sso_configuration, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update_overload_2(self, client: Gitpod) -> None: - with client.organizations.sso_configurations.with_streaming_response.update( - client_secret="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - sso_configuration = response.parse() - assert_matches_type(object, sso_configuration, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_update_overload_3(self, client: Gitpod) -> None: - sso_configuration = client.organizations.sso_configurations.update( email_domain="xxxx", - ) - assert_matches_type(object, sso_configuration, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update_overload_3(self, client: Gitpod) -> None: - response = client.organizations.sso_configurations.with_raw_response.update( - email_domain="xxxx", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - sso_configuration = response.parse() - assert_matches_type(object, sso_configuration, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update_overload_3(self, client: Gitpod) -> None: - with client.organizations.sso_configurations.with_streaming_response.update( - email_domain="xxxx", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - sso_configuration = response.parse() - assert_matches_type(object, sso_configuration, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_update_overload_4(self, client: Gitpod) -> None: - sso_configuration = client.organizations.sso_configurations.update( - issuer_url="https://example.com", - ) - assert_matches_type(object, sso_configuration, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update_overload_4(self, client: Gitpod) -> None: - response = client.organizations.sso_configurations.with_raw_response.update( issuer_url="https://example.com", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - sso_configuration = response.parse() - assert_matches_type(object, sso_configuration, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update_overload_4(self, client: Gitpod) -> None: - with client.organizations.sso_configurations.with_streaming_response.update( - issuer_url="https://example.com", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - sso_configuration = response.parse() - assert_matches_type(object, sso_configuration, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_update_overload_5(self, client: Gitpod) -> None: - sso_configuration = client.organizations.sso_configurations.update( + sso_configuration_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", state="SSO_CONFIGURATION_STATE_UNSPECIFIED", ) assert_matches_type(object, sso_configuration, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_update_overload_5(self, client: Gitpod) -> None: - response = client.organizations.sso_configurations.with_raw_response.update( - state="SSO_CONFIGURATION_STATE_UNSPECIFIED", - ) + def test_raw_response_update(self, client: Gitpod) -> None: + response = client.organizations.sso_configurations.with_raw_response.update() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -256,10 +130,8 @@ def test_raw_response_update_overload_5(self, client: Gitpod) -> None: @pytest.mark.skip() @parametrize - def test_streaming_response_update_overload_5(self, client: Gitpod) -> None: - with client.organizations.sso_configurations.with_streaming_response.update( - state="SSO_CONFIGURATION_STATE_UNSPECIFIED", - ) as response: + def test_streaming_response_update(self, client: Gitpod) -> None: + with client.organizations.sso_configurations.with_streaming_response.update() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -272,9 +144,7 @@ def test_streaming_response_update_overload_5(self, client: Gitpod) -> None: @parametrize def test_method_list(self, client: Gitpod) -> None: sso_configuration = client.organizations.sso_configurations.list() - assert_matches_type( - SyncSSOConfigurationsPage[SSOConfigurationListResponse], sso_configuration, path=["response"] - ) + assert_matches_type(SyncSSOConfigurationsPage[SSOConfiguration], sso_configuration, path=["response"]) @pytest.mark.skip() @parametrize @@ -288,9 +158,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: "page_size": 100, }, ) - assert_matches_type( - SyncSSOConfigurationsPage[SSOConfigurationListResponse], sso_configuration, path=["response"] - ) + assert_matches_type(SyncSSOConfigurationsPage[SSOConfiguration], sso_configuration, path=["response"]) @pytest.mark.skip() @parametrize @@ -300,9 +168,7 @@ def test_raw_response_list(self, client: Gitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" sso_configuration = response.parse() - assert_matches_type( - SyncSSOConfigurationsPage[SSOConfigurationListResponse], sso_configuration, path=["response"] - ) + assert_matches_type(SyncSSOConfigurationsPage[SSOConfiguration], sso_configuration, path=["response"]) @pytest.mark.skip() @parametrize @@ -312,9 +178,7 @@ def test_streaming_response_list(self, client: Gitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" sso_configuration = response.parse() - assert_matches_type( - SyncSSOConfigurationsPage[SSOConfigurationListResponse], sso_configuration, path=["response"] - ) + assert_matches_type(SyncSSOConfigurationsPage[SSOConfiguration], sso_configuration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -436,154 +300,28 @@ async def test_streaming_response_retrieve(self, async_client: AsyncGitpod) -> N @pytest.mark.skip() @parametrize - async def test_method_update_overload_1(self, async_client: AsyncGitpod) -> None: - sso_configuration = await async_client.organizations.sso_configurations.update( - client_id="x", - ) + async def test_method_update(self, async_client: AsyncGitpod) -> None: + sso_configuration = await async_client.organizations.sso_configurations.update() assert_matches_type(object, sso_configuration, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_update_overload_1(self, async_client: AsyncGitpod) -> None: - response = await async_client.organizations.sso_configurations.with_raw_response.update( - client_id="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - sso_configuration = await response.parse() - assert_matches_type(object, sso_configuration, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update_overload_1(self, async_client: AsyncGitpod) -> None: - async with async_client.organizations.sso_configurations.with_streaming_response.update( - client_id="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - sso_configuration = await response.parse() - assert_matches_type(object, sso_configuration, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_update_overload_2(self, async_client: AsyncGitpod) -> None: + async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> None: sso_configuration = await async_client.organizations.sso_configurations.update( + claims={"foo": "string"}, + client_id="x", client_secret="x", - ) - assert_matches_type(object, sso_configuration, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update_overload_2(self, async_client: AsyncGitpod) -> None: - response = await async_client.organizations.sso_configurations.with_raw_response.update( - client_secret="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - sso_configuration = await response.parse() - assert_matches_type(object, sso_configuration, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update_overload_2(self, async_client: AsyncGitpod) -> None: - async with async_client.organizations.sso_configurations.with_streaming_response.update( - client_secret="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - sso_configuration = await response.parse() - assert_matches_type(object, sso_configuration, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_update_overload_3(self, async_client: AsyncGitpod) -> None: - sso_configuration = await async_client.organizations.sso_configurations.update( email_domain="xxxx", - ) - assert_matches_type(object, sso_configuration, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update_overload_3(self, async_client: AsyncGitpod) -> None: - response = await async_client.organizations.sso_configurations.with_raw_response.update( - email_domain="xxxx", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - sso_configuration = await response.parse() - assert_matches_type(object, sso_configuration, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update_overload_3(self, async_client: AsyncGitpod) -> None: - async with async_client.organizations.sso_configurations.with_streaming_response.update( - email_domain="xxxx", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - sso_configuration = await response.parse() - assert_matches_type(object, sso_configuration, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_update_overload_4(self, async_client: AsyncGitpod) -> None: - sso_configuration = await async_client.organizations.sso_configurations.update( - issuer_url="https://example.com", - ) - assert_matches_type(object, sso_configuration, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update_overload_4(self, async_client: AsyncGitpod) -> None: - response = await async_client.organizations.sso_configurations.with_raw_response.update( issuer_url="https://example.com", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - sso_configuration = await response.parse() - assert_matches_type(object, sso_configuration, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update_overload_4(self, async_client: AsyncGitpod) -> None: - async with async_client.organizations.sso_configurations.with_streaming_response.update( - issuer_url="https://example.com", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - sso_configuration = await response.parse() - assert_matches_type(object, sso_configuration, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_update_overload_5(self, async_client: AsyncGitpod) -> None: - sso_configuration = await async_client.organizations.sso_configurations.update( + sso_configuration_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", state="SSO_CONFIGURATION_STATE_UNSPECIFIED", ) assert_matches_type(object, sso_configuration, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_update_overload_5(self, async_client: AsyncGitpod) -> None: - response = await async_client.organizations.sso_configurations.with_raw_response.update( - state="SSO_CONFIGURATION_STATE_UNSPECIFIED", - ) + async def test_raw_response_update(self, async_client: AsyncGitpod) -> None: + response = await async_client.organizations.sso_configurations.with_raw_response.update() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -592,10 +330,8 @@ async def test_raw_response_update_overload_5(self, async_client: AsyncGitpod) - @pytest.mark.skip() @parametrize - async def test_streaming_response_update_overload_5(self, async_client: AsyncGitpod) -> None: - async with async_client.organizations.sso_configurations.with_streaming_response.update( - state="SSO_CONFIGURATION_STATE_UNSPECIFIED", - ) as response: + async def test_streaming_response_update(self, async_client: AsyncGitpod) -> None: + async with async_client.organizations.sso_configurations.with_streaming_response.update() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -608,9 +344,7 @@ async def test_streaming_response_update_overload_5(self, async_client: AsyncGit @parametrize async def test_method_list(self, async_client: AsyncGitpod) -> None: sso_configuration = await async_client.organizations.sso_configurations.list() - assert_matches_type( - AsyncSSOConfigurationsPage[SSOConfigurationListResponse], sso_configuration, path=["response"] - ) + assert_matches_type(AsyncSSOConfigurationsPage[SSOConfiguration], sso_configuration, path=["response"]) @pytest.mark.skip() @parametrize @@ -624,9 +358,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N "page_size": 100, }, ) - assert_matches_type( - AsyncSSOConfigurationsPage[SSOConfigurationListResponse], sso_configuration, path=["response"] - ) + assert_matches_type(AsyncSSOConfigurationsPage[SSOConfiguration], sso_configuration, path=["response"]) @pytest.mark.skip() @parametrize @@ -636,9 +368,7 @@ async def test_raw_response_list(self, async_client: AsyncGitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" sso_configuration = await response.parse() - assert_matches_type( - AsyncSSOConfigurationsPage[SSOConfigurationListResponse], sso_configuration, path=["response"] - ) + assert_matches_type(AsyncSSOConfigurationsPage[SSOConfiguration], sso_configuration, path=["response"]) @pytest.mark.skip() @parametrize @@ -648,9 +378,7 @@ async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" sso_configuration = await response.parse() - assert_matches_type( - AsyncSSOConfigurationsPage[SSOConfigurationListResponse], sso_configuration, path=["response"] - ) + assert_matches_type(AsyncSSOConfigurationsPage[SSOConfiguration], sso_configuration, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/projects/test_policies.py b/tests/api_resources/projects/test_policies.py index c066dcb..cf0a4f4 100644 --- a/tests/api_resources/projects/test_policies.py +++ b/tests/api_resources/projects/test_policies.py @@ -11,7 +11,7 @@ from tests.utils import assert_matches_type from gitpod.pagination import SyncPoliciesPage, AsyncPoliciesPage from gitpod.types.projects import ( - PolicyListResponse, + ProjectPolicy, PolicyCreateResponse, PolicyUpdateResponse, ) @@ -102,7 +102,7 @@ def test_streaming_response_update(self, client: Gitpod) -> None: @parametrize def test_method_list(self, client: Gitpod) -> None: policy = client.projects.policies.list() - assert_matches_type(SyncPoliciesPage[PolicyListResponse], policy, path=["response"]) + assert_matches_type(SyncPoliciesPage[ProjectPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -116,7 +116,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: }, project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) - assert_matches_type(SyncPoliciesPage[PolicyListResponse], policy, path=["response"]) + assert_matches_type(SyncPoliciesPage[ProjectPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -126,7 +126,7 @@ def test_raw_response_list(self, client: Gitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(SyncPoliciesPage[PolicyListResponse], policy, path=["response"]) + assert_matches_type(SyncPoliciesPage[ProjectPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -136,7 +136,7 @@ def test_streaming_response_list(self, client: Gitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(SyncPoliciesPage[PolicyListResponse], policy, path=["response"]) + assert_matches_type(SyncPoliciesPage[ProjectPolicy], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -261,7 +261,7 @@ async def test_streaming_response_update(self, async_client: AsyncGitpod) -> Non @parametrize async def test_method_list(self, async_client: AsyncGitpod) -> None: policy = await async_client.projects.policies.list() - assert_matches_type(AsyncPoliciesPage[PolicyListResponse], policy, path=["response"]) + assert_matches_type(AsyncPoliciesPage[ProjectPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -275,7 +275,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N }, project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) - assert_matches_type(AsyncPoliciesPage[PolicyListResponse], policy, path=["response"]) + assert_matches_type(AsyncPoliciesPage[ProjectPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -285,7 +285,7 @@ async def test_raw_response_list(self, async_client: AsyncGitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(AsyncPoliciesPage[PolicyListResponse], policy, path=["response"]) + assert_matches_type(AsyncPoliciesPage[ProjectPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -295,7 +295,7 @@ async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(AsyncPoliciesPage[PolicyListResponse], policy, path=["response"]) + assert_matches_type(AsyncPoliciesPage[ProjectPolicy], policy, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/runners/configurations/test_environment_classes.py b/tests/api_resources/runners/configurations/test_environment_classes.py index d08bb88..de30bc1 100644 --- a/tests/api_resources/runners/configurations/test_environment_classes.py +++ b/tests/api_resources/runners/configurations/test_environment_classes.py @@ -10,8 +10,8 @@ from gitpod import Gitpod, AsyncGitpod from tests.utils import assert_matches_type from gitpod.pagination import SyncEnvironmentClassesPage, AsyncEnvironmentClassesPage +from gitpod.types.shared import EnvironmentClass from gitpod.types.runners.configurations import ( - EnvironmentClassListResponse, EnvironmentClassCreateResponse, EnvironmentClassRetrieveResponse, ) @@ -104,86 +104,25 @@ def test_streaming_response_retrieve(self, client: Gitpod) -> None: @pytest.mark.skip() @parametrize - def test_method_update_overload_1(self, client: Gitpod) -> None: - environment_class = client.runners.configurations.environment_classes.update( - description="xxx", - ) - assert_matches_type(object, environment_class, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update_overload_1(self, client: Gitpod) -> None: - response = client.runners.configurations.environment_classes.with_raw_response.update( - description="xxx", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - environment_class = response.parse() + def test_method_update(self, client: Gitpod) -> None: + environment_class = client.runners.configurations.environment_classes.update() assert_matches_type(object, environment_class, path=["response"]) @pytest.mark.skip() @parametrize - def test_streaming_response_update_overload_1(self, client: Gitpod) -> None: - with client.runners.configurations.environment_classes.with_streaming_response.update( - description="xxx", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - environment_class = response.parse() - assert_matches_type(object, environment_class, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_update_overload_2(self, client: Gitpod) -> None: + def test_method_update_with_all_params(self, client: Gitpod) -> None: environment_class = client.runners.configurations.environment_classes.update( + description="xxx", display_name="xxx", - ) - assert_matches_type(object, environment_class, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update_overload_2(self, client: Gitpod) -> None: - response = client.runners.configurations.environment_classes.with_raw_response.update( - display_name="xxx", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - environment_class = response.parse() - assert_matches_type(object, environment_class, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update_overload_2(self, client: Gitpod) -> None: - with client.runners.configurations.environment_classes.with_streaming_response.update( - display_name="xxx", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - environment_class = response.parse() - assert_matches_type(object, environment_class, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_update_overload_3(self, client: Gitpod) -> None: - environment_class = client.runners.configurations.environment_classes.update( enabled=True, + environment_class_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) assert_matches_type(object, environment_class, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_update_overload_3(self, client: Gitpod) -> None: - response = client.runners.configurations.environment_classes.with_raw_response.update( - enabled=True, - ) + def test_raw_response_update(self, client: Gitpod) -> None: + response = client.runners.configurations.environment_classes.with_raw_response.update() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -192,10 +131,8 @@ def test_raw_response_update_overload_3(self, client: Gitpod) -> None: @pytest.mark.skip() @parametrize - def test_streaming_response_update_overload_3(self, client: Gitpod) -> None: - with client.runners.configurations.environment_classes.with_streaming_response.update( - enabled=True, - ) as response: + def test_streaming_response_update(self, client: Gitpod) -> None: + with client.runners.configurations.environment_classes.with_streaming_response.update() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -208,9 +145,7 @@ def test_streaming_response_update_overload_3(self, client: Gitpod) -> None: @parametrize def test_method_list(self, client: Gitpod) -> None: environment_class = client.runners.configurations.environment_classes.list() - assert_matches_type( - SyncEnvironmentClassesPage[EnvironmentClassListResponse], environment_class, path=["response"] - ) + assert_matches_type(SyncEnvironmentClassesPage[EnvironmentClass], environment_class, path=["response"]) @pytest.mark.skip() @parametrize @@ -218,15 +153,16 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: environment_class = client.runners.configurations.environment_classes.list( token="token", page_size=0, - filter={"enabled": True}, + filter={ + "enabled": True, + "runner_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + }, pagination={ "token": "token", "page_size": 100, }, ) - assert_matches_type( - SyncEnvironmentClassesPage[EnvironmentClassListResponse], environment_class, path=["response"] - ) + assert_matches_type(SyncEnvironmentClassesPage[EnvironmentClass], environment_class, path=["response"]) @pytest.mark.skip() @parametrize @@ -236,9 +172,7 @@ def test_raw_response_list(self, client: Gitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" environment_class = response.parse() - assert_matches_type( - SyncEnvironmentClassesPage[EnvironmentClassListResponse], environment_class, path=["response"] - ) + assert_matches_type(SyncEnvironmentClassesPage[EnvironmentClass], environment_class, path=["response"]) @pytest.mark.skip() @parametrize @@ -248,9 +182,7 @@ def test_streaming_response_list(self, client: Gitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" environment_class = response.parse() - assert_matches_type( - SyncEnvironmentClassesPage[EnvironmentClassListResponse], environment_class, path=["response"] - ) + assert_matches_type(SyncEnvironmentClassesPage[EnvironmentClass], environment_class, path=["response"]) assert cast(Any, response.is_closed) is True @@ -342,86 +274,25 @@ async def test_streaming_response_retrieve(self, async_client: AsyncGitpod) -> N @pytest.mark.skip() @parametrize - async def test_method_update_overload_1(self, async_client: AsyncGitpod) -> None: - environment_class = await async_client.runners.configurations.environment_classes.update( - description="xxx", - ) - assert_matches_type(object, environment_class, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update_overload_1(self, async_client: AsyncGitpod) -> None: - response = await async_client.runners.configurations.environment_classes.with_raw_response.update( - description="xxx", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - environment_class = await response.parse() + async def test_method_update(self, async_client: AsyncGitpod) -> None: + environment_class = await async_client.runners.configurations.environment_classes.update() assert_matches_type(object, environment_class, path=["response"]) @pytest.mark.skip() @parametrize - async def test_streaming_response_update_overload_1(self, async_client: AsyncGitpod) -> None: - async with async_client.runners.configurations.environment_classes.with_streaming_response.update( - description="xxx", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - environment_class = await response.parse() - assert_matches_type(object, environment_class, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_update_overload_2(self, async_client: AsyncGitpod) -> None: + 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", - ) - assert_matches_type(object, environment_class, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update_overload_2(self, async_client: AsyncGitpod) -> None: - response = await async_client.runners.configurations.environment_classes.with_raw_response.update( - display_name="xxx", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - environment_class = await response.parse() - assert_matches_type(object, environment_class, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update_overload_2(self, async_client: AsyncGitpod) -> None: - async with async_client.runners.configurations.environment_classes.with_streaming_response.update( - display_name="xxx", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - environment_class = await response.parse() - assert_matches_type(object, environment_class, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_update_overload_3(self, async_client: AsyncGitpod) -> None: - environment_class = await async_client.runners.configurations.environment_classes.update( enabled=True, + environment_class_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) assert_matches_type(object, environment_class, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_update_overload_3(self, async_client: AsyncGitpod) -> None: - response = await async_client.runners.configurations.environment_classes.with_raw_response.update( - enabled=True, - ) + async def test_raw_response_update(self, async_client: AsyncGitpod) -> None: + response = await async_client.runners.configurations.environment_classes.with_raw_response.update() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -430,10 +301,8 @@ async def test_raw_response_update_overload_3(self, async_client: AsyncGitpod) - @pytest.mark.skip() @parametrize - async def test_streaming_response_update_overload_3(self, async_client: AsyncGitpod) -> None: - async with async_client.runners.configurations.environment_classes.with_streaming_response.update( - enabled=True, - ) as response: + async def test_streaming_response_update(self, async_client: AsyncGitpod) -> None: + async with async_client.runners.configurations.environment_classes.with_streaming_response.update() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -446,9 +315,7 @@ async def test_streaming_response_update_overload_3(self, async_client: AsyncGit @parametrize async def test_method_list(self, async_client: AsyncGitpod) -> None: environment_class = await async_client.runners.configurations.environment_classes.list() - assert_matches_type( - AsyncEnvironmentClassesPage[EnvironmentClassListResponse], environment_class, path=["response"] - ) + assert_matches_type(AsyncEnvironmentClassesPage[EnvironmentClass], environment_class, path=["response"]) @pytest.mark.skip() @parametrize @@ -456,15 +323,16 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N environment_class = await async_client.runners.configurations.environment_classes.list( token="token", page_size=0, - filter={"enabled": True}, + filter={ + "enabled": True, + "runner_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + }, pagination={ "token": "token", "page_size": 100, }, ) - assert_matches_type( - AsyncEnvironmentClassesPage[EnvironmentClassListResponse], environment_class, path=["response"] - ) + assert_matches_type(AsyncEnvironmentClassesPage[EnvironmentClass], environment_class, path=["response"]) @pytest.mark.skip() @parametrize @@ -474,9 +342,7 @@ async def test_raw_response_list(self, async_client: AsyncGitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" environment_class = await response.parse() - assert_matches_type( - AsyncEnvironmentClassesPage[EnvironmentClassListResponse], environment_class, path=["response"] - ) + assert_matches_type(AsyncEnvironmentClassesPage[EnvironmentClass], environment_class, path=["response"]) @pytest.mark.skip() @parametrize @@ -486,8 +352,6 @@ async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" environment_class = await response.parse() - assert_matches_type( - AsyncEnvironmentClassesPage[EnvironmentClassListResponse], environment_class, path=["response"] - ) + assert_matches_type(AsyncEnvironmentClassesPage[EnvironmentClass], environment_class, path=["response"]) assert cast(Any, response.is_closed) is True 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 1520b2a..27694ae 100644 --- a/tests/api_resources/runners/configurations/test_host_authentication_tokens.py +++ b/tests/api_resources/runners/configurations/test_host_authentication_tokens.py @@ -12,7 +12,7 @@ from gitpod._utils import parse_datetime from gitpod.pagination import SyncTokensPage, AsyncTokensPage from gitpod.types.runners.configurations import ( - HostAuthenticationTokenListResponse, + HostAuthenticationToken, HostAuthenticationTokenCreateResponse, HostAuthenticationTokenRetrieveResponse, ) @@ -103,86 +103,25 @@ def test_streaming_response_retrieve(self, client: Gitpod) -> None: @pytest.mark.skip() @parametrize - def test_method_update_overload_1(self, client: Gitpod) -> None: - host_authentication_token = client.runners.configurations.host_authentication_tokens.update( - expires_at=parse_datetime("2019-12-27T18:11:19.117Z"), - ) + def test_method_update(self, client: Gitpod) -> None: + host_authentication_token = client.runners.configurations.host_authentication_tokens.update() assert_matches_type(object, host_authentication_token, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_update_overload_1(self, client: Gitpod) -> None: - response = client.runners.configurations.host_authentication_tokens.with_raw_response.update( - expires_at=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - host_authentication_token = response.parse() - assert_matches_type(object, host_authentication_token, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update_overload_1(self, client: Gitpod) -> None: - with client.runners.configurations.host_authentication_tokens.with_streaming_response.update( - expires_at=parse_datetime("2019-12-27T18:11:19.117Z"), - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - host_authentication_token = response.parse() - assert_matches_type(object, host_authentication_token, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_update_overload_2(self, client: Gitpod) -> None: - host_authentication_token = client.runners.configurations.host_authentication_tokens.update( - refresh_token="refreshToken", - ) - assert_matches_type(object, host_authentication_token, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update_overload_2(self, client: Gitpod) -> None: - response = client.runners.configurations.host_authentication_tokens.with_raw_response.update( - refresh_token="refreshToken", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - host_authentication_token = response.parse() - assert_matches_type(object, host_authentication_token, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update_overload_2(self, client: Gitpod) -> None: - with client.runners.configurations.host_authentication_tokens.with_streaming_response.update( - refresh_token="refreshToken", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - host_authentication_token = response.parse() - assert_matches_type(object, host_authentication_token, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_update_overload_3(self, client: Gitpod) -> None: + 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", ) assert_matches_type(object, host_authentication_token, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_update_overload_3(self, client: Gitpod) -> None: - response = client.runners.configurations.host_authentication_tokens.with_raw_response.update( - token="x", - ) + def test_raw_response_update(self, client: Gitpod) -> None: + response = client.runners.configurations.host_authentication_tokens.with_raw_response.update() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -191,10 +130,8 @@ def test_raw_response_update_overload_3(self, client: Gitpod) -> None: @pytest.mark.skip() @parametrize - def test_streaming_response_update_overload_3(self, client: Gitpod) -> None: - with client.runners.configurations.host_authentication_tokens.with_streaming_response.update( - token="x", - ) as response: + def test_streaming_response_update(self, client: Gitpod) -> None: + with client.runners.configurations.host_authentication_tokens.with_streaming_response.update() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -207,9 +144,7 @@ def test_streaming_response_update_overload_3(self, client: Gitpod) -> None: @parametrize def test_method_list(self, client: Gitpod) -> None: host_authentication_token = client.runners.configurations.host_authentication_tokens.list() - assert_matches_type( - SyncTokensPage[HostAuthenticationTokenListResponse], host_authentication_token, path=["response"] - ) + assert_matches_type(SyncTokensPage[HostAuthenticationToken], host_authentication_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -217,15 +152,16 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: host_authentication_token = client.runners.configurations.host_authentication_tokens.list( token="token", page_size=0, - filter={"runner_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}, + filter={ + "runner_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "user_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + }, pagination={ "token": "token", "page_size": 100, }, ) - assert_matches_type( - SyncTokensPage[HostAuthenticationTokenListResponse], host_authentication_token, path=["response"] - ) + assert_matches_type(SyncTokensPage[HostAuthenticationToken], host_authentication_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -235,9 +171,7 @@ def test_raw_response_list(self, client: Gitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" host_authentication_token = response.parse() - assert_matches_type( - SyncTokensPage[HostAuthenticationTokenListResponse], host_authentication_token, path=["response"] - ) + assert_matches_type(SyncTokensPage[HostAuthenticationToken], host_authentication_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -247,9 +181,7 @@ def test_streaming_response_list(self, client: Gitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" host_authentication_token = response.parse() - assert_matches_type( - SyncTokensPage[HostAuthenticationTokenListResponse], host_authentication_token, path=["response"] - ) + assert_matches_type(SyncTokensPage[HostAuthenticationToken], host_authentication_token, path=["response"]) assert cast(Any, response.is_closed) is True @@ -377,86 +309,25 @@ async def test_streaming_response_retrieve(self, async_client: AsyncGitpod) -> N @pytest.mark.skip() @parametrize - async def test_method_update_overload_1(self, async_client: AsyncGitpod) -> None: - host_authentication_token = await async_client.runners.configurations.host_authentication_tokens.update( - expires_at=parse_datetime("2019-12-27T18:11:19.117Z"), - ) + async def test_method_update(self, async_client: AsyncGitpod) -> None: + host_authentication_token = await async_client.runners.configurations.host_authentication_tokens.update() assert_matches_type(object, host_authentication_token, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_update_overload_1(self, async_client: AsyncGitpod) -> None: - response = await async_client.runners.configurations.host_authentication_tokens.with_raw_response.update( - expires_at=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - host_authentication_token = await response.parse() - assert_matches_type(object, host_authentication_token, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update_overload_1(self, async_client: AsyncGitpod) -> None: - async with async_client.runners.configurations.host_authentication_tokens.with_streaming_response.update( - expires_at=parse_datetime("2019-12-27T18:11:19.117Z"), - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - host_authentication_token = await response.parse() - assert_matches_type(object, host_authentication_token, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_update_overload_2(self, async_client: AsyncGitpod) -> None: - host_authentication_token = await async_client.runners.configurations.host_authentication_tokens.update( - refresh_token="refreshToken", - ) - assert_matches_type(object, host_authentication_token, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update_overload_2(self, async_client: AsyncGitpod) -> None: - response = await async_client.runners.configurations.host_authentication_tokens.with_raw_response.update( - refresh_token="refreshToken", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - host_authentication_token = await response.parse() - assert_matches_type(object, host_authentication_token, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update_overload_2(self, async_client: AsyncGitpod) -> None: - async with async_client.runners.configurations.host_authentication_tokens.with_streaming_response.update( - refresh_token="refreshToken", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - host_authentication_token = await response.parse() - assert_matches_type(object, host_authentication_token, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_update_overload_3(self, async_client: AsyncGitpod) -> None: + 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", ) assert_matches_type(object, host_authentication_token, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_update_overload_3(self, async_client: AsyncGitpod) -> None: - response = await async_client.runners.configurations.host_authentication_tokens.with_raw_response.update( - token="x", - ) + async def test_raw_response_update(self, async_client: AsyncGitpod) -> None: + response = await async_client.runners.configurations.host_authentication_tokens.with_raw_response.update() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -465,9 +336,9 @@ async def test_raw_response_update_overload_3(self, async_client: AsyncGitpod) - @pytest.mark.skip() @parametrize - async def test_streaming_response_update_overload_3(self, async_client: AsyncGitpod) -> None: - async with async_client.runners.configurations.host_authentication_tokens.with_streaming_response.update( - token="x", + async def test_streaming_response_update(self, async_client: AsyncGitpod) -> None: + async with ( + async_client.runners.configurations.host_authentication_tokens.with_streaming_response.update() ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -481,9 +352,7 @@ async def test_streaming_response_update_overload_3(self, async_client: AsyncGit @parametrize async def test_method_list(self, async_client: AsyncGitpod) -> None: host_authentication_token = await async_client.runners.configurations.host_authentication_tokens.list() - assert_matches_type( - AsyncTokensPage[HostAuthenticationTokenListResponse], host_authentication_token, path=["response"] - ) + assert_matches_type(AsyncTokensPage[HostAuthenticationToken], host_authentication_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -491,15 +360,16 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N host_authentication_token = await async_client.runners.configurations.host_authentication_tokens.list( token="token", page_size=0, - filter={"runner_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}, + filter={ + "runner_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "user_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + }, pagination={ "token": "token", "page_size": 100, }, ) - assert_matches_type( - AsyncTokensPage[HostAuthenticationTokenListResponse], host_authentication_token, path=["response"] - ) + assert_matches_type(AsyncTokensPage[HostAuthenticationToken], host_authentication_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -509,9 +379,7 @@ async def test_raw_response_list(self, async_client: AsyncGitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" host_authentication_token = await response.parse() - assert_matches_type( - AsyncTokensPage[HostAuthenticationTokenListResponse], host_authentication_token, path=["response"] - ) + assert_matches_type(AsyncTokensPage[HostAuthenticationToken], host_authentication_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -523,9 +391,7 @@ async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" host_authentication_token = await response.parse() - assert_matches_type( - AsyncTokensPage[HostAuthenticationTokenListResponse], host_authentication_token, path=["response"] - ) + assert_matches_type(AsyncTokensPage[HostAuthenticationToken], host_authentication_token, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/runners/configurations/test_scm_integrations.py b/tests/api_resources/runners/configurations/test_scm_integrations.py index e827e39..41ee4a5 100644 --- a/tests/api_resources/runners/configurations/test_scm_integrations.py +++ b/tests/api_resources/runners/configurations/test_scm_integrations.py @@ -11,7 +11,7 @@ from tests.utils import assert_matches_type from gitpod.pagination import SyncIntegrationsPage, AsyncIntegrationsPage from gitpod.types.runners.configurations import ( - ScmIntegrationListResponse, + ScmIntegration, ScmIntegrationCreateResponse, ScmIntegrationRetrieveResponse, ) @@ -24,52 +24,27 @@ class TestScmIntegrations: @pytest.mark.skip() @parametrize - def test_method_create_overload_1(self, client: Gitpod) -> None: - scm_integration = client.runners.configurations.scm_integrations.create( - oauth_client_id="oauthClientId", - ) - assert_matches_type(ScmIntegrationCreateResponse, scm_integration, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_create_overload_1(self, client: Gitpod) -> None: - response = client.runners.configurations.scm_integrations.with_raw_response.create( - oauth_client_id="oauthClientId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - scm_integration = response.parse() + def test_method_create(self, client: Gitpod) -> None: + scm_integration = client.runners.configurations.scm_integrations.create() assert_matches_type(ScmIntegrationCreateResponse, scm_integration, path=["response"]) @pytest.mark.skip() @parametrize - def test_streaming_response_create_overload_1(self, client: Gitpod) -> None: - with client.runners.configurations.scm_integrations.with_streaming_response.create( - oauth_client_id="oauthClientId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - scm_integration = response.parse() - assert_matches_type(ScmIntegrationCreateResponse, scm_integration, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_create_overload_2(self, client: Gitpod) -> None: + 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", + pat=True, + runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + scm_id="scmId", ) assert_matches_type(ScmIntegrationCreateResponse, scm_integration, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_create_overload_2(self, client: Gitpod) -> None: - response = client.runners.configurations.scm_integrations.with_raw_response.create( - oauth_plaintext_client_secret="oauthPlaintextClientSecret", - ) + def test_raw_response_create(self, client: Gitpod) -> None: + response = client.runners.configurations.scm_integrations.with_raw_response.create() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -78,10 +53,8 @@ def test_raw_response_create_overload_2(self, client: Gitpod) -> None: @pytest.mark.skip() @parametrize - def test_streaming_response_create_overload_2(self, client: Gitpod) -> None: - with client.runners.configurations.scm_integrations.with_streaming_response.create( - oauth_plaintext_client_secret="oauthPlaintextClientSecret", - ) as response: + def test_streaming_response_create(self, client: Gitpod) -> None: + with client.runners.configurations.scm_integrations.with_streaming_response.create() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -128,86 +101,25 @@ def test_streaming_response_retrieve(self, client: Gitpod) -> None: @pytest.mark.skip() @parametrize - def test_method_update_overload_1(self, client: Gitpod) -> None: - scm_integration = client.runners.configurations.scm_integrations.update( - oauth_client_id="oauthClientId", - ) + def test_method_update(self, client: Gitpod) -> None: + scm_integration = client.runners.configurations.scm_integrations.update() assert_matches_type(object, scm_integration, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_update_overload_1(self, client: Gitpod) -> None: - response = client.runners.configurations.scm_integrations.with_raw_response.update( - oauth_client_id="oauthClientId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - scm_integration = response.parse() - assert_matches_type(object, scm_integration, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update_overload_1(self, client: Gitpod) -> None: - with client.runners.configurations.scm_integrations.with_streaming_response.update( - oauth_client_id="oauthClientId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - scm_integration = response.parse() - assert_matches_type(object, scm_integration, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_update_overload_2(self, client: Gitpod) -> None: + 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", - ) - assert_matches_type(object, scm_integration, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update_overload_2(self, client: Gitpod) -> None: - response = client.runners.configurations.scm_integrations.with_raw_response.update( - oauth_plaintext_client_secret="oauthPlaintextClientSecret", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - scm_integration = response.parse() - assert_matches_type(object, scm_integration, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update_overload_2(self, client: Gitpod) -> None: - with client.runners.configurations.scm_integrations.with_streaming_response.update( - oauth_plaintext_client_secret="oauthPlaintextClientSecret", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - scm_integration = response.parse() - assert_matches_type(object, scm_integration, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_update_overload_3(self, client: Gitpod) -> None: - scm_integration = client.runners.configurations.scm_integrations.update( pat=True, ) assert_matches_type(object, scm_integration, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_update_overload_3(self, client: Gitpod) -> None: - response = client.runners.configurations.scm_integrations.with_raw_response.update( - pat=True, - ) + def test_raw_response_update(self, client: Gitpod) -> None: + response = client.runners.configurations.scm_integrations.with_raw_response.update() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -216,10 +128,8 @@ def test_raw_response_update_overload_3(self, client: Gitpod) -> None: @pytest.mark.skip() @parametrize - def test_streaming_response_update_overload_3(self, client: Gitpod) -> None: - with client.runners.configurations.scm_integrations.with_streaming_response.update( - pat=True, - ) as response: + def test_streaming_response_update(self, client: Gitpod) -> None: + with client.runners.configurations.scm_integrations.with_streaming_response.update() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -232,7 +142,7 @@ def test_streaming_response_update_overload_3(self, client: Gitpod) -> None: @parametrize def test_method_list(self, client: Gitpod) -> None: scm_integration = client.runners.configurations.scm_integrations.list() - assert_matches_type(SyncIntegrationsPage[ScmIntegrationListResponse], scm_integration, path=["response"]) + assert_matches_type(SyncIntegrationsPage[ScmIntegration], scm_integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -246,7 +156,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: "page_size": 100, }, ) - assert_matches_type(SyncIntegrationsPage[ScmIntegrationListResponse], scm_integration, path=["response"]) + assert_matches_type(SyncIntegrationsPage[ScmIntegration], scm_integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -256,7 +166,7 @@ def test_raw_response_list(self, client: Gitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" scm_integration = response.parse() - assert_matches_type(SyncIntegrationsPage[ScmIntegrationListResponse], scm_integration, path=["response"]) + assert_matches_type(SyncIntegrationsPage[ScmIntegration], scm_integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -266,7 +176,7 @@ def test_streaming_response_list(self, client: Gitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" scm_integration = response.parse() - assert_matches_type(SyncIntegrationsPage[ScmIntegrationListResponse], scm_integration, path=["response"]) + assert_matches_type(SyncIntegrationsPage[ScmIntegration], scm_integration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -312,52 +222,27 @@ class TestAsyncScmIntegrations: @pytest.mark.skip() @parametrize - async def test_method_create_overload_1(self, async_client: AsyncGitpod) -> None: - scm_integration = await async_client.runners.configurations.scm_integrations.create( - oauth_client_id="oauthClientId", - ) - assert_matches_type(ScmIntegrationCreateResponse, scm_integration, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_create_overload_1(self, async_client: AsyncGitpod) -> None: - response = await async_client.runners.configurations.scm_integrations.with_raw_response.create( - oauth_client_id="oauthClientId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - scm_integration = await response.parse() + async def test_method_create(self, async_client: AsyncGitpod) -> None: + scm_integration = await async_client.runners.configurations.scm_integrations.create() assert_matches_type(ScmIntegrationCreateResponse, scm_integration, path=["response"]) @pytest.mark.skip() @parametrize - async def test_streaming_response_create_overload_1(self, async_client: AsyncGitpod) -> None: - async with async_client.runners.configurations.scm_integrations.with_streaming_response.create( - oauth_client_id="oauthClientId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - scm_integration = await response.parse() - assert_matches_type(ScmIntegrationCreateResponse, scm_integration, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_create_overload_2(self, async_client: AsyncGitpod) -> None: + 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", + pat=True, + runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + scm_id="scmId", ) assert_matches_type(ScmIntegrationCreateResponse, scm_integration, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_create_overload_2(self, async_client: AsyncGitpod) -> None: - response = await async_client.runners.configurations.scm_integrations.with_raw_response.create( - oauth_plaintext_client_secret="oauthPlaintextClientSecret", - ) + async def test_raw_response_create(self, async_client: AsyncGitpod) -> None: + response = await async_client.runners.configurations.scm_integrations.with_raw_response.create() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -366,10 +251,8 @@ async def test_raw_response_create_overload_2(self, async_client: AsyncGitpod) - @pytest.mark.skip() @parametrize - async def test_streaming_response_create_overload_2(self, async_client: AsyncGitpod) -> None: - async with async_client.runners.configurations.scm_integrations.with_streaming_response.create( - oauth_plaintext_client_secret="oauthPlaintextClientSecret", - ) as response: + async def test_streaming_response_create(self, async_client: AsyncGitpod) -> None: + async with async_client.runners.configurations.scm_integrations.with_streaming_response.create() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -416,86 +299,25 @@ async def test_streaming_response_retrieve(self, async_client: AsyncGitpod) -> N @pytest.mark.skip() @parametrize - async def test_method_update_overload_1(self, async_client: AsyncGitpod) -> None: - scm_integration = await async_client.runners.configurations.scm_integrations.update( - oauth_client_id="oauthClientId", - ) + async def test_method_update(self, async_client: AsyncGitpod) -> None: + scm_integration = await async_client.runners.configurations.scm_integrations.update() assert_matches_type(object, scm_integration, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_update_overload_1(self, async_client: AsyncGitpod) -> None: - response = await async_client.runners.configurations.scm_integrations.with_raw_response.update( - oauth_client_id="oauthClientId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - scm_integration = await response.parse() - assert_matches_type(object, scm_integration, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update_overload_1(self, async_client: AsyncGitpod) -> None: - async with async_client.runners.configurations.scm_integrations.with_streaming_response.update( - oauth_client_id="oauthClientId", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - scm_integration = await response.parse() - assert_matches_type(object, scm_integration, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_update_overload_2(self, async_client: AsyncGitpod) -> None: + 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", - ) - assert_matches_type(object, scm_integration, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update_overload_2(self, async_client: AsyncGitpod) -> None: - response = await async_client.runners.configurations.scm_integrations.with_raw_response.update( - oauth_plaintext_client_secret="oauthPlaintextClientSecret", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - scm_integration = await response.parse() - assert_matches_type(object, scm_integration, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update_overload_2(self, async_client: AsyncGitpod) -> None: - async with async_client.runners.configurations.scm_integrations.with_streaming_response.update( - oauth_plaintext_client_secret="oauthPlaintextClientSecret", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - scm_integration = await response.parse() - assert_matches_type(object, scm_integration, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_update_overload_3(self, async_client: AsyncGitpod) -> None: - scm_integration = await async_client.runners.configurations.scm_integrations.update( pat=True, ) assert_matches_type(object, scm_integration, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_update_overload_3(self, async_client: AsyncGitpod) -> None: - response = await async_client.runners.configurations.scm_integrations.with_raw_response.update( - pat=True, - ) + async def test_raw_response_update(self, async_client: AsyncGitpod) -> None: + response = await async_client.runners.configurations.scm_integrations.with_raw_response.update() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -504,10 +326,8 @@ async def test_raw_response_update_overload_3(self, async_client: AsyncGitpod) - @pytest.mark.skip() @parametrize - async def test_streaming_response_update_overload_3(self, async_client: AsyncGitpod) -> None: - async with async_client.runners.configurations.scm_integrations.with_streaming_response.update( - pat=True, - ) as response: + async def test_streaming_response_update(self, async_client: AsyncGitpod) -> None: + async with async_client.runners.configurations.scm_integrations.with_streaming_response.update() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -520,7 +340,7 @@ async def test_streaming_response_update_overload_3(self, async_client: AsyncGit @parametrize async def test_method_list(self, async_client: AsyncGitpod) -> None: scm_integration = await async_client.runners.configurations.scm_integrations.list() - assert_matches_type(AsyncIntegrationsPage[ScmIntegrationListResponse], scm_integration, path=["response"]) + assert_matches_type(AsyncIntegrationsPage[ScmIntegration], scm_integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -534,7 +354,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N "page_size": 100, }, ) - assert_matches_type(AsyncIntegrationsPage[ScmIntegrationListResponse], scm_integration, path=["response"]) + assert_matches_type(AsyncIntegrationsPage[ScmIntegration], scm_integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -544,7 +364,7 @@ async def test_raw_response_list(self, async_client: AsyncGitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" scm_integration = await response.parse() - assert_matches_type(AsyncIntegrationsPage[ScmIntegrationListResponse], scm_integration, path=["response"]) + assert_matches_type(AsyncIntegrationsPage[ScmIntegration], scm_integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -554,7 +374,7 @@ async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" scm_integration = await response.parse() - assert_matches_type(AsyncIntegrationsPage[ScmIntegrationListResponse], scm_integration, path=["response"]) + assert_matches_type(AsyncIntegrationsPage[ScmIntegration], scm_integration, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/runners/test_configurations.py b/tests/api_resources/runners/test_configurations.py index 833058d..e917ea8 100644 --- a/tests/api_resources/runners/test_configurations.py +++ b/tests/api_resources/runners/test_configurations.py @@ -19,15 +19,13 @@ class TestConfigurations: @pytest.mark.skip() @parametrize - def test_method_validate_overload_1(self, client: Gitpod) -> None: - configuration = client.runners.configurations.validate( - environment_class={}, - ) + def test_method_validate(self, client: Gitpod) -> None: + configuration = client.runners.configurations.validate() assert_matches_type(ConfigurationValidateResponse, configuration, path=["response"]) @pytest.mark.skip() @parametrize - def test_method_validate_with_all_params_overload_1(self, client: Gitpod) -> None: + def test_method_validate_with_all_params(self, client: Gitpod) -> None: configuration = client.runners.configurations.validate( environment_class={ "id": "id", @@ -43,58 +41,22 @@ def test_method_validate_with_all_params_overload_1(self, client: Gitpod) -> Non "runner_id": "runnerId", }, runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + scm_integration={ + "id": "id", + "host": "host", + "oauth_client_id": "oauthClientId", + "oauth_encrypted_client_secret": "U3RhaW5sZXNzIHJvY2tz", + "oauth_plaintext_client_secret": "oauthPlaintextClientSecret", + "pat": True, + "scm_id": "scmId", + }, ) assert_matches_type(ConfigurationValidateResponse, configuration, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_validate_overload_1(self, client: Gitpod) -> None: - response = client.runners.configurations.with_raw_response.validate( - environment_class={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - configuration = response.parse() - assert_matches_type(ConfigurationValidateResponse, configuration, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_validate_overload_1(self, client: Gitpod) -> None: - with client.runners.configurations.with_streaming_response.validate( - environment_class={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - configuration = response.parse() - assert_matches_type(ConfigurationValidateResponse, configuration, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_validate_overload_2(self, client: Gitpod) -> None: - configuration = client.runners.configurations.validate( - scm_integration={"oauth_client_id": "oauthClientId"}, - ) - assert_matches_type(ConfigurationValidateResponse, configuration, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_validate_with_all_params_overload_2(self, client: Gitpod) -> None: - configuration = client.runners.configurations.validate( - scm_integration={"oauth_client_id": "oauthClientId"}, - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(ConfigurationValidateResponse, configuration, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_validate_overload_2(self, client: Gitpod) -> None: - response = client.runners.configurations.with_raw_response.validate( - scm_integration={"oauth_client_id": "oauthClientId"}, - ) + def test_raw_response_validate(self, client: Gitpod) -> None: + response = client.runners.configurations.with_raw_response.validate() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -103,10 +65,8 @@ def test_raw_response_validate_overload_2(self, client: Gitpod) -> None: @pytest.mark.skip() @parametrize - def test_streaming_response_validate_overload_2(self, client: Gitpod) -> None: - with client.runners.configurations.with_streaming_response.validate( - scm_integration={"oauth_client_id": "oauthClientId"}, - ) as response: + def test_streaming_response_validate(self, client: Gitpod) -> None: + with client.runners.configurations.with_streaming_response.validate() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -121,15 +81,13 @@ class TestAsyncConfigurations: @pytest.mark.skip() @parametrize - async def test_method_validate_overload_1(self, async_client: AsyncGitpod) -> None: - configuration = await async_client.runners.configurations.validate( - environment_class={}, - ) + async def test_method_validate(self, async_client: AsyncGitpod) -> None: + configuration = await async_client.runners.configurations.validate() assert_matches_type(ConfigurationValidateResponse, configuration, path=["response"]) @pytest.mark.skip() @parametrize - async def test_method_validate_with_all_params_overload_1(self, async_client: AsyncGitpod) -> None: + async def test_method_validate_with_all_params(self, async_client: AsyncGitpod) -> None: configuration = await async_client.runners.configurations.validate( environment_class={ "id": "id", @@ -145,58 +103,22 @@ async def test_method_validate_with_all_params_overload_1(self, async_client: As "runner_id": "runnerId", }, runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + scm_integration={ + "id": "id", + "host": "host", + "oauth_client_id": "oauthClientId", + "oauth_encrypted_client_secret": "U3RhaW5sZXNzIHJvY2tz", + "oauth_plaintext_client_secret": "oauthPlaintextClientSecret", + "pat": True, + "scm_id": "scmId", + }, ) assert_matches_type(ConfigurationValidateResponse, configuration, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_validate_overload_1(self, async_client: AsyncGitpod) -> None: - response = await async_client.runners.configurations.with_raw_response.validate( - environment_class={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - configuration = await response.parse() - assert_matches_type(ConfigurationValidateResponse, configuration, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_validate_overload_1(self, async_client: AsyncGitpod) -> None: - async with async_client.runners.configurations.with_streaming_response.validate( - environment_class={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - configuration = await response.parse() - assert_matches_type(ConfigurationValidateResponse, configuration, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_validate_overload_2(self, async_client: AsyncGitpod) -> None: - configuration = await async_client.runners.configurations.validate( - scm_integration={"oauth_client_id": "oauthClientId"}, - ) - assert_matches_type(ConfigurationValidateResponse, configuration, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_validate_with_all_params_overload_2(self, async_client: AsyncGitpod) -> None: - configuration = await async_client.runners.configurations.validate( - scm_integration={"oauth_client_id": "oauthClientId"}, - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(ConfigurationValidateResponse, configuration, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_validate_overload_2(self, async_client: AsyncGitpod) -> None: - response = await async_client.runners.configurations.with_raw_response.validate( - scm_integration={"oauth_client_id": "oauthClientId"}, - ) + async def test_raw_response_validate(self, async_client: AsyncGitpod) -> None: + response = await async_client.runners.configurations.with_raw_response.validate() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -205,10 +127,8 @@ async def test_raw_response_validate_overload_2(self, async_client: AsyncGitpod) @pytest.mark.skip() @parametrize - async def test_streaming_response_validate_overload_2(self, async_client: AsyncGitpod) -> None: - async with async_client.runners.configurations.with_streaming_response.validate( - scm_integration={"oauth_client_id": "oauthClientId"}, - ) as response: + async def test_streaming_response_validate(self, async_client: AsyncGitpod) -> None: + async with async_client.runners.configurations.with_streaming_response.validate() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/runners/test_policies.py b/tests/api_resources/runners/test_policies.py index bd75557..f0bcafa 100644 --- a/tests/api_resources/runners/test_policies.py +++ b/tests/api_resources/runners/test_policies.py @@ -11,7 +11,7 @@ from tests.utils import assert_matches_type from gitpod.pagination import SyncPoliciesPage, AsyncPoliciesPage from gitpod.types.runners import ( - PolicyListResponse, + RunnerPolicy, PolicyCreateResponse, PolicyUpdateResponse, ) @@ -102,7 +102,7 @@ def test_streaming_response_update(self, client: Gitpod) -> None: @parametrize def test_method_list(self, client: Gitpod) -> None: policy = client.runners.policies.list() - assert_matches_type(SyncPoliciesPage[PolicyListResponse], policy, path=["response"]) + assert_matches_type(SyncPoliciesPage[RunnerPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -116,7 +116,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: }, runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) - assert_matches_type(SyncPoliciesPage[PolicyListResponse], policy, path=["response"]) + assert_matches_type(SyncPoliciesPage[RunnerPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -126,7 +126,7 @@ def test_raw_response_list(self, client: Gitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(SyncPoliciesPage[PolicyListResponse], policy, path=["response"]) + assert_matches_type(SyncPoliciesPage[RunnerPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -136,7 +136,7 @@ def test_streaming_response_list(self, client: Gitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(SyncPoliciesPage[PolicyListResponse], policy, path=["response"]) + assert_matches_type(SyncPoliciesPage[RunnerPolicy], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -261,7 +261,7 @@ async def test_streaming_response_update(self, async_client: AsyncGitpod) -> Non @parametrize async def test_method_list(self, async_client: AsyncGitpod) -> None: policy = await async_client.runners.policies.list() - assert_matches_type(AsyncPoliciesPage[PolicyListResponse], policy, path=["response"]) + assert_matches_type(AsyncPoliciesPage[RunnerPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -275,7 +275,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N }, runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) - assert_matches_type(AsyncPoliciesPage[PolicyListResponse], policy, path=["response"]) + assert_matches_type(AsyncPoliciesPage[RunnerPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -285,7 +285,7 @@ async def test_raw_response_list(self, async_client: AsyncGitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(AsyncPoliciesPage[PolicyListResponse], policy, path=["response"]) + assert_matches_type(AsyncPoliciesPage[RunnerPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -295,7 +295,7 @@ async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(AsyncPoliciesPage[PolicyListResponse], policy, path=["response"]) + assert_matches_type(AsyncPoliciesPage[RunnerPolicy], policy, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_accounts.py b/tests/api_resources/test_accounts.py index 54d712e..94b1a9f 100644 --- a/tests/api_resources/test_accounts.py +++ b/tests/api_resources/test_accounts.py @@ -10,9 +10,9 @@ from gitpod import Gitpod, AsyncGitpod from tests.utils import assert_matches_type from gitpod.types import ( + LoginProvider, AccountRetrieveResponse, AccountGetSSOLoginURLResponse, - AccountListLoginProvidersResponse, ) from gitpod.pagination import SyncLoginProvidersPage, AsyncLoginProvidersPage @@ -97,26 +97,22 @@ def test_streaming_response_delete(self, client: Gitpod) -> None: @pytest.mark.skip() @parametrize def test_method_get_sso_login_url(self, client: Gitpod) -> None: - account = client.accounts.get_sso_login_url( - return_to="https://example.com", - ) + account = client.accounts.get_sso_login_url() assert_matches_type(AccountGetSSOLoginURLResponse, account, path=["response"]) @pytest.mark.skip() @parametrize def test_method_get_sso_login_url_with_all_params(self, client: Gitpod) -> None: account = client.accounts.get_sso_login_url( - return_to="https://example.com", email="dev@stainlessapi.com", + return_to="https://example.com", ) assert_matches_type(AccountGetSSOLoginURLResponse, account, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_get_sso_login_url(self, client: Gitpod) -> None: - response = client.accounts.with_raw_response.get_sso_login_url( - return_to="https://example.com", - ) + response = client.accounts.with_raw_response.get_sso_login_url() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -126,9 +122,7 @@ def test_raw_response_get_sso_login_url(self, client: Gitpod) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_get_sso_login_url(self, client: Gitpod) -> None: - with client.accounts.with_streaming_response.get_sso_login_url( - return_to="https://example.com", - ) as response: + with client.accounts.with_streaming_response.get_sso_login_url() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -141,7 +135,7 @@ def test_streaming_response_get_sso_login_url(self, client: Gitpod) -> None: @parametrize def test_method_list_login_providers(self, client: Gitpod) -> None: account = client.accounts.list_login_providers() - assert_matches_type(SyncLoginProvidersPage[AccountListLoginProvidersResponse], account, path=["response"]) + assert_matches_type(SyncLoginProvidersPage[LoginProvider], account, path=["response"]) @pytest.mark.skip() @parametrize @@ -155,7 +149,7 @@ def test_method_list_login_providers_with_all_params(self, client: Gitpod) -> No "page_size": 100, }, ) - assert_matches_type(SyncLoginProvidersPage[AccountListLoginProvidersResponse], account, path=["response"]) + assert_matches_type(SyncLoginProvidersPage[LoginProvider], account, path=["response"]) @pytest.mark.skip() @parametrize @@ -165,7 +159,7 @@ def test_raw_response_list_login_providers(self, client: Gitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" account = response.parse() - assert_matches_type(SyncLoginProvidersPage[AccountListLoginProvidersResponse], account, path=["response"]) + assert_matches_type(SyncLoginProvidersPage[LoginProvider], account, path=["response"]) @pytest.mark.skip() @parametrize @@ -175,7 +169,7 @@ def test_streaming_response_list_login_providers(self, client: Gitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" account = response.parse() - assert_matches_type(SyncLoginProvidersPage[AccountListLoginProvidersResponse], account, path=["response"]) + assert_matches_type(SyncLoginProvidersPage[LoginProvider], account, path=["response"]) assert cast(Any, response.is_closed) is True @@ -258,26 +252,22 @@ async def test_streaming_response_delete(self, async_client: AsyncGitpod) -> Non @pytest.mark.skip() @parametrize async def test_method_get_sso_login_url(self, async_client: AsyncGitpod) -> None: - account = await async_client.accounts.get_sso_login_url( - return_to="https://example.com", - ) + account = await async_client.accounts.get_sso_login_url() assert_matches_type(AccountGetSSOLoginURLResponse, account, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_get_sso_login_url_with_all_params(self, async_client: AsyncGitpod) -> None: account = await async_client.accounts.get_sso_login_url( - return_to="https://example.com", email="dev@stainlessapi.com", + return_to="https://example.com", ) assert_matches_type(AccountGetSSOLoginURLResponse, account, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_get_sso_login_url(self, async_client: AsyncGitpod) -> None: - response = await async_client.accounts.with_raw_response.get_sso_login_url( - return_to="https://example.com", - ) + response = await async_client.accounts.with_raw_response.get_sso_login_url() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -287,9 +277,7 @@ async def test_raw_response_get_sso_login_url(self, async_client: AsyncGitpod) - @pytest.mark.skip() @parametrize async def test_streaming_response_get_sso_login_url(self, async_client: AsyncGitpod) -> None: - async with async_client.accounts.with_streaming_response.get_sso_login_url( - return_to="https://example.com", - ) as response: + async with async_client.accounts.with_streaming_response.get_sso_login_url() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -302,7 +290,7 @@ async def test_streaming_response_get_sso_login_url(self, async_client: AsyncGit @parametrize async def test_method_list_login_providers(self, async_client: AsyncGitpod) -> None: account = await async_client.accounts.list_login_providers() - assert_matches_type(AsyncLoginProvidersPage[AccountListLoginProvidersResponse], account, path=["response"]) + assert_matches_type(AsyncLoginProvidersPage[LoginProvider], account, path=["response"]) @pytest.mark.skip() @parametrize @@ -316,7 +304,7 @@ async def test_method_list_login_providers_with_all_params(self, async_client: A "page_size": 100, }, ) - assert_matches_type(AsyncLoginProvidersPage[AccountListLoginProvidersResponse], account, path=["response"]) + assert_matches_type(AsyncLoginProvidersPage[LoginProvider], account, path=["response"]) @pytest.mark.skip() @parametrize @@ -326,7 +314,7 @@ async def test_raw_response_list_login_providers(self, async_client: AsyncGitpod assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" account = await response.parse() - assert_matches_type(AsyncLoginProvidersPage[AccountListLoginProvidersResponse], account, path=["response"]) + assert_matches_type(AsyncLoginProvidersPage[LoginProvider], account, path=["response"]) @pytest.mark.skip() @parametrize @@ -336,6 +324,6 @@ async def test_streaming_response_list_login_providers(self, async_client: Async assert response.http_request.headers.get("X-Stainless-Lang") == "python" account = await response.parse() - assert_matches_type(AsyncLoginProvidersPage[AccountListLoginProvidersResponse], account, path=["response"]) + assert_matches_type(AsyncLoginProvidersPage[LoginProvider], account, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_editors.py b/tests/api_resources/test_editors.py index d3de302..9ef5526 100644 --- a/tests/api_resources/test_editors.py +++ b/tests/api_resources/test_editors.py @@ -10,7 +10,7 @@ from gitpod import Gitpod, AsyncGitpod from tests.utils import assert_matches_type from gitpod.types import ( - EditorListResponse, + Editor, EditorRetrieveResponse, EditorResolveURLResponse, ) @@ -62,7 +62,7 @@ def test_streaming_response_retrieve(self, client: Gitpod) -> None: @parametrize def test_method_list(self, client: Gitpod) -> None: editor = client.editors.list() - assert_matches_type(SyncEditorsPage[EditorListResponse], editor, path=["response"]) + assert_matches_type(SyncEditorsPage[Editor], editor, path=["response"]) @pytest.mark.skip() @parametrize @@ -75,7 +75,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: "page_size": 100, }, ) - assert_matches_type(SyncEditorsPage[EditorListResponse], editor, path=["response"]) + assert_matches_type(SyncEditorsPage[Editor], editor, path=["response"]) @pytest.mark.skip() @parametrize @@ -85,7 +85,7 @@ def test_raw_response_list(self, client: Gitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" editor = response.parse() - assert_matches_type(SyncEditorsPage[EditorListResponse], editor, path=["response"]) + assert_matches_type(SyncEditorsPage[Editor], editor, path=["response"]) @pytest.mark.skip() @parametrize @@ -95,7 +95,7 @@ def test_streaming_response_list(self, client: Gitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" editor = response.parse() - assert_matches_type(SyncEditorsPage[EditorListResponse], editor, path=["response"]) + assert_matches_type(SyncEditorsPage[Editor], editor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -181,7 +181,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncGitpod) -> N @parametrize async def test_method_list(self, async_client: AsyncGitpod) -> None: editor = await async_client.editors.list() - assert_matches_type(AsyncEditorsPage[EditorListResponse], editor, path=["response"]) + assert_matches_type(AsyncEditorsPage[Editor], editor, path=["response"]) @pytest.mark.skip() @parametrize @@ -194,7 +194,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N "page_size": 100, }, ) - assert_matches_type(AsyncEditorsPage[EditorListResponse], editor, path=["response"]) + assert_matches_type(AsyncEditorsPage[Editor], editor, path=["response"]) @pytest.mark.skip() @parametrize @@ -204,7 +204,7 @@ async def test_raw_response_list(self, async_client: AsyncGitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" editor = await response.parse() - assert_matches_type(AsyncEditorsPage[EditorListResponse], editor, path=["response"]) + assert_matches_type(AsyncEditorsPage[Editor], editor, path=["response"]) @pytest.mark.skip() @parametrize @@ -214,7 +214,7 @@ async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" editor = await response.parse() - assert_matches_type(AsyncEditorsPage[EditorListResponse], editor, path=["response"]) + assert_matches_type(AsyncEditorsPage[Editor], editor, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_environments.py b/tests/api_resources/test_environments.py index b954bf5..992d3b2 100644 --- a/tests/api_resources/test_environments.py +++ b/tests/api_resources/test_environments.py @@ -10,7 +10,7 @@ from gitpod import Gitpod, AsyncGitpod from tests.utils import assert_matches_type from gitpod.types import ( - EnvironmentListResponse, + Environment, EnvironmentCreateResponse, EnvironmentRetrieveResponse, EnvironmentCreateLogsTokenResponse, @@ -44,7 +44,20 @@ def test_method_create_with_all_params(self, client: Gitpod) -> None: "content": { "git_email": "gitEmail", "git_username": "gitUsername", - "initializer": {"specs": [{"context_url": {"url": "https://example.com"}}]}, + "initializer": { + "specs": [ + { + "context_url": {"url": "https://github.com/gitpod-io/gitpod"}, + "git": { + "checkout_location": "checkoutLocation", + "clone_target": "cloneTarget", + "remote_uri": "remoteUri", + "target_mode": "CLONE_TARGET_MODE_UNSPECIFIED", + "upstream_remote_uri": "upstreamRemoteUri", + }, + } + ] + }, "session": "session", }, "desired_phase": "ENVIRONMENT_PHASE_UNSPECIFIED", @@ -53,7 +66,7 @@ def test_method_create_with_all_params(self, client: Gitpod) -> None: "session": "session", }, "machine": { - "class": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "class": "61000000-0000-0000-0000-000000000000", "session": "session", }, "ports": [ @@ -66,6 +79,8 @@ def test_method_create_with_all_params(self, client: Gitpod) -> None: "secrets": [ { "environment_variable": "environmentVariable", + "file_path": "filePath", + "git_credential_host": "gitCredentialHost", "name": "name", "session": "session", "source": "source", @@ -154,7 +169,49 @@ def test_method_update_with_all_params(self, client: Gitpod) -> None: environment = client.environments.update( environment_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", metadata={}, - spec={"automations_file": {"automations_file_path": "automationsFilePath"}}, + spec={ + "automations_file": { + "automations_file_path": "automationsFilePath", + "session": "session", + }, + "content": { + "git_email": "gitEmail", + "git_username": "gitUsername", + "initializer": { + "specs": [ + { + "context_url": {"url": "https://example.com"}, + "git": { + "checkout_location": "checkoutLocation", + "clone_target": "cloneTarget", + "remote_uri": "remoteUri", + "target_mode": "CLONE_TARGET_MODE_UNSPECIFIED", + "upstream_remote_uri": "upstreamRemoteUri", + }, + } + ] + }, + "session": "session", + }, + "devcontainer": { + "devcontainer_file_path": "devcontainerFilePath", + "session": "session", + }, + "ports": [ + { + "admission": "ADMISSION_LEVEL_UNSPECIFIED", + "name": "x", + "port": 1, + } + ], + "ssh_public_keys": [ + { + "id": "id", + "value": "value", + } + ], + "timeout": {"disconnected": "+9125115.360s"}, + }, ) assert_matches_type(object, environment, path=["response"]) @@ -184,7 +241,7 @@ def test_streaming_response_update(self, client: Gitpod) -> None: @parametrize def test_method_list(self, client: Gitpod) -> None: environment = client.environments.list() - assert_matches_type(SyncEnvironmentsPage[EnvironmentListResponse], environment, path=["response"]) + assert_matches_type(SyncEnvironmentsPage[Environment], environment, path=["response"]) @pytest.mark.skip() @parametrize @@ -205,7 +262,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: "page_size": 100, }, ) - assert_matches_type(SyncEnvironmentsPage[EnvironmentListResponse], environment, path=["response"]) + assert_matches_type(SyncEnvironmentsPage[Environment], environment, path=["response"]) @pytest.mark.skip() @parametrize @@ -215,7 +272,7 @@ def test_raw_response_list(self, client: Gitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" environment = response.parse() - assert_matches_type(SyncEnvironmentsPage[EnvironmentListResponse], environment, path=["response"]) + assert_matches_type(SyncEnvironmentsPage[Environment], environment, path=["response"]) @pytest.mark.skip() @parametrize @@ -225,7 +282,7 @@ def test_streaming_response_list(self, client: Gitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" environment = response.parse() - assert_matches_type(SyncEnvironmentsPage[EnvironmentListResponse], environment, path=["response"]) + assert_matches_type(SyncEnvironmentsPage[Environment], environment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -286,7 +343,20 @@ def test_method_create_from_project_with_all_params(self, client: Gitpod) -> Non "content": { "git_email": "gitEmail", "git_username": "gitUsername", - "initializer": {"specs": [{"context_url": {"url": "https://example.com"}}]}, + "initializer": { + "specs": [ + { + "context_url": {"url": "https://example.com"}, + "git": { + "checkout_location": "checkoutLocation", + "clone_target": "cloneTarget", + "remote_uri": "remoteUri", + "target_mode": "CLONE_TARGET_MODE_UNSPECIFIED", + "upstream_remote_uri": "upstreamRemoteUri", + }, + } + ] + }, "session": "session", }, "desired_phase": "ENVIRONMENT_PHASE_UNSPECIFIED", @@ -308,6 +378,8 @@ def test_method_create_from_project_with_all_params(self, client: Gitpod) -> Non "secrets": [ { "environment_variable": "environmentVariable", + "file_path": "filePath", + "git_credential_host": "gitCredentialHost", "name": "name", "session": "session", "source": "source", @@ -519,7 +591,20 @@ async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> "content": { "git_email": "gitEmail", "git_username": "gitUsername", - "initializer": {"specs": [{"context_url": {"url": "https://example.com"}}]}, + "initializer": { + "specs": [ + { + "context_url": {"url": "https://github.com/gitpod-io/gitpod"}, + "git": { + "checkout_location": "checkoutLocation", + "clone_target": "cloneTarget", + "remote_uri": "remoteUri", + "target_mode": "CLONE_TARGET_MODE_UNSPECIFIED", + "upstream_remote_uri": "upstreamRemoteUri", + }, + } + ] + }, "session": "session", }, "desired_phase": "ENVIRONMENT_PHASE_UNSPECIFIED", @@ -528,7 +613,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> "session": "session", }, "machine": { - "class": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "class": "61000000-0000-0000-0000-000000000000", "session": "session", }, "ports": [ @@ -541,6 +626,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> "secrets": [ { "environment_variable": "environmentVariable", + "file_path": "filePath", + "git_credential_host": "gitCredentialHost", "name": "name", "session": "session", "source": "source", @@ -629,7 +716,49 @@ async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> environment = await async_client.environments.update( environment_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", metadata={}, - spec={"automations_file": {"automations_file_path": "automationsFilePath"}}, + spec={ + "automations_file": { + "automations_file_path": "automationsFilePath", + "session": "session", + }, + "content": { + "git_email": "gitEmail", + "git_username": "gitUsername", + "initializer": { + "specs": [ + { + "context_url": {"url": "https://example.com"}, + "git": { + "checkout_location": "checkoutLocation", + "clone_target": "cloneTarget", + "remote_uri": "remoteUri", + "target_mode": "CLONE_TARGET_MODE_UNSPECIFIED", + "upstream_remote_uri": "upstreamRemoteUri", + }, + } + ] + }, + "session": "session", + }, + "devcontainer": { + "devcontainer_file_path": "devcontainerFilePath", + "session": "session", + }, + "ports": [ + { + "admission": "ADMISSION_LEVEL_UNSPECIFIED", + "name": "x", + "port": 1, + } + ], + "ssh_public_keys": [ + { + "id": "id", + "value": "value", + } + ], + "timeout": {"disconnected": "+9125115.360s"}, + }, ) assert_matches_type(object, environment, path=["response"]) @@ -659,7 +788,7 @@ async def test_streaming_response_update(self, async_client: AsyncGitpod) -> Non @parametrize async def test_method_list(self, async_client: AsyncGitpod) -> None: environment = await async_client.environments.list() - assert_matches_type(AsyncEnvironmentsPage[EnvironmentListResponse], environment, path=["response"]) + assert_matches_type(AsyncEnvironmentsPage[Environment], environment, path=["response"]) @pytest.mark.skip() @parametrize @@ -680,7 +809,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N "page_size": 100, }, ) - assert_matches_type(AsyncEnvironmentsPage[EnvironmentListResponse], environment, path=["response"]) + assert_matches_type(AsyncEnvironmentsPage[Environment], environment, path=["response"]) @pytest.mark.skip() @parametrize @@ -690,7 +819,7 @@ async def test_raw_response_list(self, async_client: AsyncGitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" environment = await response.parse() - assert_matches_type(AsyncEnvironmentsPage[EnvironmentListResponse], environment, path=["response"]) + assert_matches_type(AsyncEnvironmentsPage[Environment], environment, path=["response"]) @pytest.mark.skip() @parametrize @@ -700,7 +829,7 @@ async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" environment = await response.parse() - assert_matches_type(AsyncEnvironmentsPage[EnvironmentListResponse], environment, path=["response"]) + assert_matches_type(AsyncEnvironmentsPage[Environment], environment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -761,7 +890,20 @@ async def test_method_create_from_project_with_all_params(self, async_client: As "content": { "git_email": "gitEmail", "git_username": "gitUsername", - "initializer": {"specs": [{"context_url": {"url": "https://example.com"}}]}, + "initializer": { + "specs": [ + { + "context_url": {"url": "https://example.com"}, + "git": { + "checkout_location": "checkoutLocation", + "clone_target": "cloneTarget", + "remote_uri": "remoteUri", + "target_mode": "CLONE_TARGET_MODE_UNSPECIFIED", + "upstream_remote_uri": "upstreamRemoteUri", + }, + } + ] + }, "session": "session", }, "desired_phase": "ENVIRONMENT_PHASE_UNSPECIFIED", @@ -783,6 +925,8 @@ async def test_method_create_from_project_with_all_params(self, async_client: As "secrets": [ { "environment_variable": "environmentVariable", + "file_path": "filePath", + "git_credential_host": "gitCredentialHost", "name": "name", "session": "session", "source": "source", diff --git a/tests/api_resources/test_events.py b/tests/api_resources/test_events.py index b3fdfdd..11a2ab9 100644 --- a/tests/api_resources/test_events.py +++ b/tests/api_resources/test_events.py @@ -68,52 +68,23 @@ 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_overload_1(self, client: Gitpod) -> None: - event = client.events.watch( - environment_id="environmentId", - ) - assert_matches_type(JSONLDecoder[EventWatchResponse], event, path=["response"]) - - @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") - @parametrize - def test_raw_response_watch_overload_1(self, client: Gitpod) -> None: - response = client.events.with_raw_response.watch( - environment_id="environmentId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = response.parse() + def test_method_watch(self, client: Gitpod) -> None: + event = client.events.watch() assert_matches_type(JSONLDecoder[EventWatchResponse], event, path=["response"]) @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize - def test_streaming_response_watch_overload_1(self, client: Gitpod) -> None: - with client.events.with_streaming_response.watch( - environment_id="environmentId", - ) as response: - 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"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") - @parametrize - def test_method_watch_overload_2(self, client: Gitpod) -> None: + def test_method_watch_with_all_params(self, client: Gitpod) -> None: event = client.events.watch( + environment_id="environmentId", organization=True, ) assert_matches_type(JSONLDecoder[EventWatchResponse], event, path=["response"]) @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize - def test_raw_response_watch_overload_2(self, client: Gitpod) -> None: - response = client.events.with_raw_response.watch( - organization=True, - ) + 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" @@ -122,10 +93,8 @@ def test_raw_response_watch_overload_2(self, client: Gitpod) -> None: @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize - def test_streaming_response_watch_overload_2(self, client: Gitpod) -> None: - with client.events.with_streaming_response.watch( - organization=True, - ) as response: + def test_streaming_response_watch(self, client: Gitpod) -> None: + with client.events.with_streaming_response.watch() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -187,52 +156,23 @@ 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_overload_1(self, async_client: AsyncGitpod) -> None: - event = await async_client.events.watch( - environment_id="environmentId", - ) - assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event, path=["response"]) - - @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") - @parametrize - async def test_raw_response_watch_overload_1(self, async_client: AsyncGitpod) -> None: - response = await async_client.events.with_raw_response.watch( - environment_id="environmentId", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = await response.parse() + async def test_method_watch(self, async_client: AsyncGitpod) -> None: + event = await async_client.events.watch() assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event, path=["response"]) @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize - async def test_streaming_response_watch_overload_1(self, async_client: AsyncGitpod) -> None: - async with async_client.events.with_streaming_response.watch( - environment_id="environmentId", - ) as response: - 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"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") - @parametrize - async def test_method_watch_overload_2(self, async_client: AsyncGitpod) -> None: + async def test_method_watch_with_all_params(self, async_client: AsyncGitpod) -> None: event = await async_client.events.watch( + environment_id="environmentId", organization=True, ) assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event, path=["response"]) @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize - async def test_raw_response_watch_overload_2(self, async_client: AsyncGitpod) -> None: - response = await async_client.events.with_raw_response.watch( - organization=True, - ) + 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" @@ -241,10 +181,8 @@ async def test_raw_response_watch_overload_2(self, async_client: AsyncGitpod) -> @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize - async def test_streaming_response_watch_overload_2(self, async_client: AsyncGitpod) -> None: - async with async_client.events.with_streaming_response.watch( - organization=True, - ) as response: + async def test_streaming_response_watch(self, async_client: AsyncGitpod) -> None: + async with async_client.events.with_streaming_response.watch() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_groups.py b/tests/api_resources/test_groups.py index 2d4abe9..00bfe68 100644 --- a/tests/api_resources/test_groups.py +++ b/tests/api_resources/test_groups.py @@ -9,7 +9,7 @@ from gitpod import Gitpod, AsyncGitpod from tests.utils import assert_matches_type -from gitpod.types import GroupListResponse +from gitpod.types import Group from gitpod.pagination import SyncGroupsPage, AsyncGroupsPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,7 +22,7 @@ class TestGroups: @parametrize def test_method_list(self, client: Gitpod) -> None: group = client.groups.list() - assert_matches_type(SyncGroupsPage[GroupListResponse], group, path=["response"]) + assert_matches_type(SyncGroupsPage[Group], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +35,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: "page_size": 100, }, ) - assert_matches_type(SyncGroupsPage[GroupListResponse], group, path=["response"]) + assert_matches_type(SyncGroupsPage[Group], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -45,7 +45,7 @@ def test_raw_response_list(self, client: Gitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = response.parse() - assert_matches_type(SyncGroupsPage[GroupListResponse], group, path=["response"]) + assert_matches_type(SyncGroupsPage[Group], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -55,7 +55,7 @@ def test_streaming_response_list(self, client: Gitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = response.parse() - assert_matches_type(SyncGroupsPage[GroupListResponse], group, path=["response"]) + assert_matches_type(SyncGroupsPage[Group], group, path=["response"]) assert cast(Any, response.is_closed) is True @@ -67,7 +67,7 @@ class TestAsyncGroups: @parametrize async def test_method_list(self, async_client: AsyncGitpod) -> None: group = await async_client.groups.list() - assert_matches_type(AsyncGroupsPage[GroupListResponse], group, path=["response"]) + assert_matches_type(AsyncGroupsPage[Group], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -80,7 +80,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N "page_size": 100, }, ) - assert_matches_type(AsyncGroupsPage[GroupListResponse], group, path=["response"]) + assert_matches_type(AsyncGroupsPage[Group], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -90,7 +90,7 @@ async def test_raw_response_list(self, async_client: AsyncGitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = await response.parse() - assert_matches_type(AsyncGroupsPage[GroupListResponse], group, path=["response"]) + assert_matches_type(AsyncGroupsPage[Group], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,6 +100,6 @@ async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = await response.parse() - assert_matches_type(AsyncGroupsPage[GroupListResponse], group, path=["response"]) + assert_matches_type(AsyncGroupsPage[Group], group, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_organizations.py b/tests/api_resources/test_organizations.py index 1c0c5af..8dbf451 100644 --- a/tests/api_resources/test_organizations.py +++ b/tests/api_resources/test_organizations.py @@ -10,12 +10,12 @@ from gitpod import Gitpod, AsyncGitpod from tests.utils import assert_matches_type from gitpod.types import ( + Organization, + OrganizationMember, OrganizationJoinResponse, - OrganizationListResponse, OrganizationCreateResponse, OrganizationUpdateResponse, OrganizationRetrieveResponse, - OrganizationListMembersResponse, ) from gitpod.pagination import SyncMembersPage, AsyncMembersPage, SyncOrganizationsPage, AsyncOrganizationsPage @@ -101,60 +101,24 @@ def test_streaming_response_retrieve(self, client: Gitpod) -> None: @pytest.mark.skip() @parametrize - def test_method_update_overload_1(self, client: Gitpod) -> None: - organization = client.organizations.update( - invite_domains={}, - ) + def test_method_update(self, client: Gitpod) -> None: + organization = client.organizations.update() assert_matches_type(OrganizationUpdateResponse, organization, path=["response"]) @pytest.mark.skip() @parametrize - def test_method_update_with_all_params_overload_1(self, client: Gitpod) -> None: + def test_method_update_with_all_params(self, client: Gitpod) -> None: organization = client.organizations.update( invite_domains={"domains": ["sfN2.l.iJR-BU.u9JV9.a.m.o2D-4b-Jd.0Z-kX.L.n.S.f.UKbxB"]}, - ) - assert_matches_type(OrganizationUpdateResponse, organization, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update_overload_1(self, client: Gitpod) -> None: - response = client.organizations.with_raw_response.update( - invite_domains={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - organization = response.parse() - assert_matches_type(OrganizationUpdateResponse, organization, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update_overload_1(self, client: Gitpod) -> None: - with client.organizations.with_streaming_response.update( - invite_domains={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - organization = response.parse() - assert_matches_type(OrganizationUpdateResponse, organization, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_update_overload_2(self, client: Gitpod) -> None: - organization = client.organizations.update( name="name", + organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) assert_matches_type(OrganizationUpdateResponse, organization, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_update_overload_2(self, client: Gitpod) -> None: - response = client.organizations.with_raw_response.update( - name="name", - ) + def test_raw_response_update(self, client: Gitpod) -> None: + response = client.organizations.with_raw_response.update() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -163,10 +127,8 @@ def test_raw_response_update_overload_2(self, client: Gitpod) -> None: @pytest.mark.skip() @parametrize - def test_streaming_response_update_overload_2(self, client: Gitpod) -> None: - with client.organizations.with_streaming_response.update( - name="name", - ) as response: + def test_streaming_response_update(self, client: Gitpod) -> None: + with client.organizations.with_streaming_response.update() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -179,7 +141,7 @@ def test_streaming_response_update_overload_2(self, client: Gitpod) -> None: @parametrize def test_method_list(self, client: Gitpod) -> None: organization = client.organizations.list() - assert_matches_type(SyncOrganizationsPage[OrganizationListResponse], organization, path=["response"]) + assert_matches_type(SyncOrganizationsPage[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -193,7 +155,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: }, scope="SCOPE_UNSPECIFIED", ) - assert_matches_type(SyncOrganizationsPage[OrganizationListResponse], organization, path=["response"]) + assert_matches_type(SyncOrganizationsPage[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -203,7 +165,7 @@ def test_raw_response_list(self, client: Gitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = response.parse() - assert_matches_type(SyncOrganizationsPage[OrganizationListResponse], organization, path=["response"]) + assert_matches_type(SyncOrganizationsPage[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -213,7 +175,7 @@ def test_streaming_response_list(self, client: Gitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = response.parse() - assert_matches_type(SyncOrganizationsPage[OrganizationListResponse], organization, path=["response"]) + assert_matches_type(SyncOrganizationsPage[Organization], organization, path=["response"]) assert cast(Any, response.is_closed) is True @@ -255,52 +217,23 @@ def test_streaming_response_delete(self, client: Gitpod) -> None: @pytest.mark.skip() @parametrize - def test_method_join_overload_1(self, client: Gitpod) -> None: - organization = client.organizations.join( - invite_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + def test_method_join(self, client: Gitpod) -> None: + organization = client.organizations.join() assert_matches_type(OrganizationJoinResponse, organization, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_join_overload_1(self, client: Gitpod) -> None: - response = client.organizations.with_raw_response.join( - invite_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - organization = response.parse() - assert_matches_type(OrganizationJoinResponse, organization, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_join_overload_1(self, client: Gitpod) -> None: - with client.organizations.with_streaming_response.join( - invite_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - organization = response.parse() - assert_matches_type(OrganizationJoinResponse, organization, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_join_overload_2(self, client: Gitpod) -> None: + def test_method_join_with_all_params(self, client: Gitpod) -> None: organization = client.organizations.join( + invite_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) assert_matches_type(OrganizationJoinResponse, organization, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_join_overload_2(self, client: Gitpod) -> None: - response = client.organizations.with_raw_response.join( - organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + def test_raw_response_join(self, client: Gitpod) -> None: + response = client.organizations.with_raw_response.join() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -309,10 +242,8 @@ def test_raw_response_join_overload_2(self, client: Gitpod) -> None: @pytest.mark.skip() @parametrize - def test_streaming_response_join_overload_2(self, client: Gitpod) -> None: - with client.organizations.with_streaming_response.join( - organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: + def test_streaming_response_join(self, client: Gitpod) -> None: + with client.organizations.with_streaming_response.join() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -361,7 +292,7 @@ def test_streaming_response_leave(self, client: Gitpod) -> None: @parametrize def test_method_list_members(self, client: Gitpod) -> None: organization = client.organizations.list_members() - assert_matches_type(SyncMembersPage[OrganizationListMembersResponse], organization, path=["response"]) + assert_matches_type(SyncMembersPage[OrganizationMember], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -375,7 +306,7 @@ def test_method_list_members_with_all_params(self, client: Gitpod) -> None: "page_size": 100, }, ) - assert_matches_type(SyncMembersPage[OrganizationListMembersResponse], organization, path=["response"]) + assert_matches_type(SyncMembersPage[OrganizationMember], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -385,7 +316,7 @@ def test_raw_response_list_members(self, client: Gitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = response.parse() - assert_matches_type(SyncMembersPage[OrganizationListMembersResponse], organization, path=["response"]) + assert_matches_type(SyncMembersPage[OrganizationMember], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -395,7 +326,7 @@ def test_streaming_response_list_members(self, client: Gitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = response.parse() - assert_matches_type(SyncMembersPage[OrganizationListMembersResponse], organization, path=["response"]) + assert_matches_type(SyncMembersPage[OrganizationMember], organization, path=["response"]) assert cast(Any, response.is_closed) is True @@ -517,60 +448,24 @@ async def test_streaming_response_retrieve(self, async_client: AsyncGitpod) -> N @pytest.mark.skip() @parametrize - async def test_method_update_overload_1(self, async_client: AsyncGitpod) -> None: - organization = await async_client.organizations.update( - invite_domains={}, - ) + async def test_method_update(self, async_client: AsyncGitpod) -> None: + organization = await async_client.organizations.update() assert_matches_type(OrganizationUpdateResponse, organization, path=["response"]) @pytest.mark.skip() @parametrize - async def test_method_update_with_all_params_overload_1(self, async_client: AsyncGitpod) -> None: + async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> None: organization = await async_client.organizations.update( invite_domains={"domains": ["sfN2.l.iJR-BU.u9JV9.a.m.o2D-4b-Jd.0Z-kX.L.n.S.f.UKbxB"]}, - ) - assert_matches_type(OrganizationUpdateResponse, organization, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update_overload_1(self, async_client: AsyncGitpod) -> None: - response = await async_client.organizations.with_raw_response.update( - invite_domains={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - organization = await response.parse() - assert_matches_type(OrganizationUpdateResponse, organization, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update_overload_1(self, async_client: AsyncGitpod) -> None: - async with async_client.organizations.with_streaming_response.update( - invite_domains={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - organization = await response.parse() - assert_matches_type(OrganizationUpdateResponse, organization, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_update_overload_2(self, async_client: AsyncGitpod) -> None: - organization = await async_client.organizations.update( name="name", + organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) assert_matches_type(OrganizationUpdateResponse, organization, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_update_overload_2(self, async_client: AsyncGitpod) -> None: - response = await async_client.organizations.with_raw_response.update( - name="name", - ) + async def test_raw_response_update(self, async_client: AsyncGitpod) -> None: + response = await async_client.organizations.with_raw_response.update() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -579,10 +474,8 @@ async def test_raw_response_update_overload_2(self, async_client: AsyncGitpod) - @pytest.mark.skip() @parametrize - async def test_streaming_response_update_overload_2(self, async_client: AsyncGitpod) -> None: - async with async_client.organizations.with_streaming_response.update( - name="name", - ) as response: + async def test_streaming_response_update(self, async_client: AsyncGitpod) -> None: + async with async_client.organizations.with_streaming_response.update() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -595,7 +488,7 @@ async def test_streaming_response_update_overload_2(self, async_client: AsyncGit @parametrize async def test_method_list(self, async_client: AsyncGitpod) -> None: organization = await async_client.organizations.list() - assert_matches_type(AsyncOrganizationsPage[OrganizationListResponse], organization, path=["response"]) + assert_matches_type(AsyncOrganizationsPage[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -609,7 +502,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N }, scope="SCOPE_UNSPECIFIED", ) - assert_matches_type(AsyncOrganizationsPage[OrganizationListResponse], organization, path=["response"]) + assert_matches_type(AsyncOrganizationsPage[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -619,7 +512,7 @@ async def test_raw_response_list(self, async_client: AsyncGitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = await response.parse() - assert_matches_type(AsyncOrganizationsPage[OrganizationListResponse], organization, path=["response"]) + assert_matches_type(AsyncOrganizationsPage[Organization], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -629,7 +522,7 @@ async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = await response.parse() - assert_matches_type(AsyncOrganizationsPage[OrganizationListResponse], organization, path=["response"]) + assert_matches_type(AsyncOrganizationsPage[Organization], organization, path=["response"]) assert cast(Any, response.is_closed) is True @@ -671,52 +564,23 @@ async def test_streaming_response_delete(self, async_client: AsyncGitpod) -> Non @pytest.mark.skip() @parametrize - async def test_method_join_overload_1(self, async_client: AsyncGitpod) -> None: - organization = await async_client.organizations.join( - invite_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + async def test_method_join(self, async_client: AsyncGitpod) -> None: + organization = await async_client.organizations.join() assert_matches_type(OrganizationJoinResponse, organization, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_join_overload_1(self, async_client: AsyncGitpod) -> None: - response = await async_client.organizations.with_raw_response.join( - invite_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - organization = await response.parse() - assert_matches_type(OrganizationJoinResponse, organization, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_join_overload_1(self, async_client: AsyncGitpod) -> None: - async with async_client.organizations.with_streaming_response.join( - invite_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - organization = await response.parse() - assert_matches_type(OrganizationJoinResponse, organization, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_join_overload_2(self, async_client: AsyncGitpod) -> None: + async def test_method_join_with_all_params(self, async_client: AsyncGitpod) -> None: organization = await async_client.organizations.join( + invite_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) assert_matches_type(OrganizationJoinResponse, organization, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_join_overload_2(self, async_client: AsyncGitpod) -> None: - response = await async_client.organizations.with_raw_response.join( - organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + async def test_raw_response_join(self, async_client: AsyncGitpod) -> None: + response = await async_client.organizations.with_raw_response.join() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -725,10 +589,8 @@ async def test_raw_response_join_overload_2(self, async_client: AsyncGitpod) -> @pytest.mark.skip() @parametrize - async def test_streaming_response_join_overload_2(self, async_client: AsyncGitpod) -> None: - async with async_client.organizations.with_streaming_response.join( - organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: + async def test_streaming_response_join(self, async_client: AsyncGitpod) -> None: + async with async_client.organizations.with_streaming_response.join() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -777,7 +639,7 @@ async def test_streaming_response_leave(self, async_client: AsyncGitpod) -> None @parametrize async def test_method_list_members(self, async_client: AsyncGitpod) -> None: organization = await async_client.organizations.list_members() - assert_matches_type(AsyncMembersPage[OrganizationListMembersResponse], organization, path=["response"]) + assert_matches_type(AsyncMembersPage[OrganizationMember], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -791,7 +653,7 @@ async def test_method_list_members_with_all_params(self, async_client: AsyncGitp "page_size": 100, }, ) - assert_matches_type(AsyncMembersPage[OrganizationListMembersResponse], organization, path=["response"]) + assert_matches_type(AsyncMembersPage[OrganizationMember], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -801,7 +663,7 @@ async def test_raw_response_list_members(self, async_client: AsyncGitpod) -> Non assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = await response.parse() - assert_matches_type(AsyncMembersPage[OrganizationListMembersResponse], organization, path=["response"]) + assert_matches_type(AsyncMembersPage[OrganizationMember], organization, path=["response"]) @pytest.mark.skip() @parametrize @@ -811,7 +673,7 @@ async def test_streaming_response_list_members(self, async_client: AsyncGitpod) assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = await response.parse() - assert_matches_type(AsyncMembersPage[OrganizationListMembersResponse], organization, path=["response"]) + assert_matches_type(AsyncMembersPage[OrganizationMember], organization, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_projects.py b/tests/api_resources/test_projects.py index 754f439..4a57297 100644 --- a/tests/api_resources/test_projects.py +++ b/tests/api_resources/test_projects.py @@ -10,7 +10,7 @@ from gitpod import Gitpod, AsyncGitpod from tests.utils import assert_matches_type from gitpod.types import ( - ProjectListResponse, + Project, ProjectCreateResponse, ProjectUpdateResponse, ProjectRetrieveResponse, @@ -28,7 +28,7 @@ class TestProjects: @parametrize def test_method_create(self, client: Gitpod) -> None: project = client.projects.create( - environment_class={"environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}, + environment_class={}, initializer={}, ) assert_matches_type(ProjectCreateResponse, project, path=["response"]) @@ -37,8 +37,24 @@ def test_method_create(self, client: Gitpod) -> None: @parametrize 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"}, - initializer={"specs": [{"context_url": {"url": "https://example.com"}}]}, + environment_class={ + "environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "local_runner": True, + }, + initializer={ + "specs": [ + { + "context_url": {"url": "https://example.com"}, + "git": { + "checkout_location": "checkoutLocation", + "clone_target": "cloneTarget", + "remote_uri": "remoteUri", + "target_mode": "CLONE_TARGET_MODE_UNSPECIFIED", + "upstream_remote_uri": "upstreamRemoteUri", + }, + } + ] + }, automations_file_path="automationsFilePath", devcontainer_file_path="devcontainerFilePath", name="x", @@ -49,7 +65,7 @@ def test_method_create_with_all_params(self, client: Gitpod) -> None: @parametrize def test_raw_response_create(self, client: Gitpod) -> None: response = client.projects.with_raw_response.create( - environment_class={"environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}, + environment_class={}, initializer={}, ) @@ -62,7 +78,7 @@ def test_raw_response_create(self, client: Gitpod) -> None: @parametrize def test_streaming_response_create(self, client: Gitpod) -> None: with client.projects.with_streaming_response.create( - environment_class={"environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}, + environment_class={}, initializer={}, ) as response: assert not response.is_closed @@ -111,162 +127,43 @@ def test_streaming_response_retrieve(self, client: Gitpod) -> None: @pytest.mark.skip() @parametrize - def test_method_update_overload_1(self, client: Gitpod) -> None: - project = client.projects.update( - automations_file_path="automationsFilePath", - ) - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update_overload_1(self, client: Gitpod) -> None: - response = client.projects.with_raw_response.update( - automations_file_path="automationsFilePath", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = response.parse() + def test_method_update(self, client: Gitpod) -> None: + project = client.projects.update() assert_matches_type(ProjectUpdateResponse, project, path=["response"]) @pytest.mark.skip() @parametrize - def test_streaming_response_update_overload_1(self, client: Gitpod) -> None: - with client.projects.with_streaming_response.update( - automations_file_path="automationsFilePath", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - project = response.parse() - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_update_overload_2(self, client: Gitpod) -> None: + def test_method_update_with_all_params(self, client: Gitpod) -> None: project = client.projects.update( + automations_file_path="automationsFilePath", devcontainer_file_path="devcontainerFilePath", - ) - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update_overload_2(self, client: Gitpod) -> None: - response = client.projects.with_raw_response.update( - devcontainer_file_path="devcontainerFilePath", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = response.parse() - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update_overload_2(self, client: Gitpod) -> None: - with client.projects.with_streaming_response.update( - devcontainer_file_path="devcontainerFilePath", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - project = response.parse() - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_update_overload_3(self, client: Gitpod) -> None: - project = client.projects.update( - environment_class={"environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}, - ) - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update_overload_3(self, client: Gitpod) -> None: - response = client.projects.with_raw_response.update( - environment_class={"environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = response.parse() - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update_overload_3(self, client: Gitpod) -> None: - with client.projects.with_streaming_response.update( - environment_class={"environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - project = response.parse() - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_update_overload_4(self, client: Gitpod) -> None: - project = client.projects.update( - initializer={}, - ) - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_update_with_all_params_overload_4(self, client: Gitpod) -> None: - project = client.projects.update( - initializer={"specs": [{"context_url": {"url": "https://example.com"}}]}, - ) - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update_overload_4(self, client: Gitpod) -> None: - response = client.projects.with_raw_response.update( - initializer={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = response.parse() - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update_overload_4(self, client: Gitpod) -> None: - with client.projects.with_streaming_response.update( - initializer={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - project = response.parse() - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_update_overload_5(self, client: Gitpod) -> None: - project = client.projects.update( + environment_class={ + "environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "local_runner": True, + }, + initializer={ + "specs": [ + { + "context_url": {"url": "https://example.com"}, + "git": { + "checkout_location": "checkoutLocation", + "clone_target": "cloneTarget", + "remote_uri": "remoteUri", + "target_mode": "CLONE_TARGET_MODE_UNSPECIFIED", + "upstream_remote_uri": "upstreamRemoteUri", + }, + } + ] + }, name="x", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) assert_matches_type(ProjectUpdateResponse, project, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_update_overload_5(self, client: Gitpod) -> None: - response = client.projects.with_raw_response.update( - name="x", - ) + def test_raw_response_update(self, client: Gitpod) -> None: + response = client.projects.with_raw_response.update() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -275,10 +172,8 @@ def test_raw_response_update_overload_5(self, client: Gitpod) -> None: @pytest.mark.skip() @parametrize - def test_streaming_response_update_overload_5(self, client: Gitpod) -> None: - with client.projects.with_streaming_response.update( - name="x", - ) as response: + def test_streaming_response_update(self, client: Gitpod) -> None: + with client.projects.with_streaming_response.update() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -291,7 +186,7 @@ def test_streaming_response_update_overload_5(self, client: Gitpod) -> None: @parametrize def test_method_list(self, client: Gitpod) -> None: project = client.projects.list() - assert_matches_type(SyncProjectsPage[ProjectListResponse], project, path=["response"]) + assert_matches_type(SyncProjectsPage[Project], project, path=["response"]) @pytest.mark.skip() @parametrize @@ -304,7 +199,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: "page_size": 100, }, ) - assert_matches_type(SyncProjectsPage[ProjectListResponse], project, path=["response"]) + assert_matches_type(SyncProjectsPage[Project], project, path=["response"]) @pytest.mark.skip() @parametrize @@ -314,7 +209,7 @@ def test_raw_response_list(self, client: Gitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = response.parse() - assert_matches_type(SyncProjectsPage[ProjectListResponse], project, path=["response"]) + assert_matches_type(SyncProjectsPage[Project], project, path=["response"]) @pytest.mark.skip() @parametrize @@ -324,7 +219,7 @@ def test_streaming_response_list(self, client: Gitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = response.parse() - assert_matches_type(SyncProjectsPage[ProjectListResponse], project, path=["response"]) + assert_matches_type(SyncProjectsPage[Project], project, path=["response"]) assert cast(Any, response.is_closed) is True @@ -409,7 +304,7 @@ class TestAsyncProjects: @parametrize async def test_method_create(self, async_client: AsyncGitpod) -> None: project = await async_client.projects.create( - environment_class={"environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}, + environment_class={}, initializer={}, ) assert_matches_type(ProjectCreateResponse, project, path=["response"]) @@ -418,8 +313,24 @@ async def test_method_create(self, async_client: AsyncGitpod) -> None: @parametrize 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"}, - initializer={"specs": [{"context_url": {"url": "https://example.com"}}]}, + environment_class={ + "environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "local_runner": True, + }, + initializer={ + "specs": [ + { + "context_url": {"url": "https://example.com"}, + "git": { + "checkout_location": "checkoutLocation", + "clone_target": "cloneTarget", + "remote_uri": "remoteUri", + "target_mode": "CLONE_TARGET_MODE_UNSPECIFIED", + "upstream_remote_uri": "upstreamRemoteUri", + }, + } + ] + }, automations_file_path="automationsFilePath", devcontainer_file_path="devcontainerFilePath", name="x", @@ -430,7 +341,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> @parametrize async def test_raw_response_create(self, async_client: AsyncGitpod) -> None: response = await async_client.projects.with_raw_response.create( - environment_class={"environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}, + environment_class={}, initializer={}, ) @@ -443,7 +354,7 @@ async def test_raw_response_create(self, async_client: AsyncGitpod) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGitpod) -> None: async with async_client.projects.with_streaming_response.create( - environment_class={"environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}, + environment_class={}, initializer={}, ) as response: assert not response.is_closed @@ -492,162 +403,43 @@ async def test_streaming_response_retrieve(self, async_client: AsyncGitpod) -> N @pytest.mark.skip() @parametrize - async def test_method_update_overload_1(self, async_client: AsyncGitpod) -> None: - project = await async_client.projects.update( - automations_file_path="automationsFilePath", - ) - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update_overload_1(self, async_client: AsyncGitpod) -> None: - response = await async_client.projects.with_raw_response.update( - automations_file_path="automationsFilePath", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = await response.parse() + async def test_method_update(self, async_client: AsyncGitpod) -> None: + project = await async_client.projects.update() assert_matches_type(ProjectUpdateResponse, project, path=["response"]) @pytest.mark.skip() @parametrize - async def test_streaming_response_update_overload_1(self, async_client: AsyncGitpod) -> None: - async with async_client.projects.with_streaming_response.update( - automations_file_path="automationsFilePath", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - project = await response.parse() - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_update_overload_2(self, async_client: AsyncGitpod) -> None: + async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> None: project = await async_client.projects.update( + automations_file_path="automationsFilePath", devcontainer_file_path="devcontainerFilePath", - ) - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update_overload_2(self, async_client: AsyncGitpod) -> None: - response = await async_client.projects.with_raw_response.update( - devcontainer_file_path="devcontainerFilePath", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = await response.parse() - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update_overload_2(self, async_client: AsyncGitpod) -> None: - async with async_client.projects.with_streaming_response.update( - devcontainer_file_path="devcontainerFilePath", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - project = await response.parse() - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_update_overload_3(self, async_client: AsyncGitpod) -> None: - project = await async_client.projects.update( - environment_class={"environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}, - ) - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update_overload_3(self, async_client: AsyncGitpod) -> None: - response = await async_client.projects.with_raw_response.update( - environment_class={"environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = await response.parse() - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update_overload_3(self, async_client: AsyncGitpod) -> None: - async with async_client.projects.with_streaming_response.update( - environment_class={"environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - project = await response.parse() - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_update_overload_4(self, async_client: AsyncGitpod) -> None: - project = await async_client.projects.update( - initializer={}, - ) - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_update_with_all_params_overload_4(self, async_client: AsyncGitpod) -> None: - project = await async_client.projects.update( - initializer={"specs": [{"context_url": {"url": "https://example.com"}}]}, - ) - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update_overload_4(self, async_client: AsyncGitpod) -> None: - response = await async_client.projects.with_raw_response.update( - initializer={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = await response.parse() - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update_overload_4(self, async_client: AsyncGitpod) -> None: - async with async_client.projects.with_streaming_response.update( - initializer={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - project = await response.parse() - assert_matches_type(ProjectUpdateResponse, project, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_update_overload_5(self, async_client: AsyncGitpod) -> None: - project = await async_client.projects.update( + environment_class={ + "environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "local_runner": True, + }, + initializer={ + "specs": [ + { + "context_url": {"url": "https://example.com"}, + "git": { + "checkout_location": "checkoutLocation", + "clone_target": "cloneTarget", + "remote_uri": "remoteUri", + "target_mode": "CLONE_TARGET_MODE_UNSPECIFIED", + "upstream_remote_uri": "upstreamRemoteUri", + }, + } + ] + }, name="x", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) assert_matches_type(ProjectUpdateResponse, project, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_update_overload_5(self, async_client: AsyncGitpod) -> None: - response = await async_client.projects.with_raw_response.update( - name="x", - ) + async def test_raw_response_update(self, async_client: AsyncGitpod) -> None: + response = await async_client.projects.with_raw_response.update() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -656,10 +448,8 @@ async def test_raw_response_update_overload_5(self, async_client: AsyncGitpod) - @pytest.mark.skip() @parametrize - async def test_streaming_response_update_overload_5(self, async_client: AsyncGitpod) -> None: - async with async_client.projects.with_streaming_response.update( - name="x", - ) as response: + async def test_streaming_response_update(self, async_client: AsyncGitpod) -> None: + async with async_client.projects.with_streaming_response.update() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -672,7 +462,7 @@ async def test_streaming_response_update_overload_5(self, async_client: AsyncGit @parametrize async def test_method_list(self, async_client: AsyncGitpod) -> None: project = await async_client.projects.list() - assert_matches_type(AsyncProjectsPage[ProjectListResponse], project, path=["response"]) + assert_matches_type(AsyncProjectsPage[Project], project, path=["response"]) @pytest.mark.skip() @parametrize @@ -685,7 +475,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N "page_size": 100, }, ) - assert_matches_type(AsyncProjectsPage[ProjectListResponse], project, path=["response"]) + assert_matches_type(AsyncProjectsPage[Project], project, path=["response"]) @pytest.mark.skip() @parametrize @@ -695,7 +485,7 @@ async def test_raw_response_list(self, async_client: AsyncGitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = await response.parse() - assert_matches_type(AsyncProjectsPage[ProjectListResponse], project, path=["response"]) + assert_matches_type(AsyncProjectsPage[Project], project, path=["response"]) @pytest.mark.skip() @parametrize @@ -705,7 +495,7 @@ async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = await response.parse() - assert_matches_type(AsyncProjectsPage[ProjectListResponse], project, path=["response"]) + assert_matches_type(AsyncProjectsPage[Project], project, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_runners.py b/tests/api_resources/test_runners.py index 6c510f2..3829f7d 100644 --- a/tests/api_resources/test_runners.py +++ b/tests/api_resources/test_runners.py @@ -10,7 +10,7 @@ from gitpod import Gitpod, AsyncGitpod from tests.utils import assert_matches_type from gitpod.types import ( - RunnerListResponse, + Runner, RunnerCreateResponse, RunnerRetrieveResponse, RunnerParseContextURLResponse, @@ -109,52 +109,30 @@ def test_streaming_response_retrieve(self, client: Gitpod) -> None: @pytest.mark.skip() @parametrize - def test_method_update_overload_1(self, client: Gitpod) -> None: - runner = client.runners.update( - name="xxx", - ) + def test_method_update(self, client: Gitpod) -> None: + runner = client.runners.update() assert_matches_type(object, runner, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_update_overload_1(self, client: Gitpod) -> None: - response = client.runners.with_raw_response.update( - name="xxx", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - runner = response.parse() - assert_matches_type(object, runner, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update_overload_1(self, client: Gitpod) -> None: - with client.runners.with_streaming_response.update( - name="xxx", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - runner = response.parse() - assert_matches_type(object, runner, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_update_overload_2(self, client: Gitpod) -> None: + def test_method_update_with_all_params(self, client: Gitpod) -> None: runner = client.runners.update( - spec={"configuration": {"auto_update": True}}, + name="xxx", + runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + spec={ + "configuration": { + "auto_update": True, + "release_channel": "RUNNER_RELEASE_CHANNEL_UNSPECIFIED", + }, + "desired_phase": "RUNNER_PHASE_UNSPECIFIED", + }, ) assert_matches_type(object, runner, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_update_overload_2(self, client: Gitpod) -> None: - response = client.runners.with_raw_response.update( - spec={"configuration": {"auto_update": True}}, - ) + def test_raw_response_update(self, client: Gitpod) -> None: + response = client.runners.with_raw_response.update() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -163,10 +141,8 @@ def test_raw_response_update_overload_2(self, client: Gitpod) -> None: @pytest.mark.skip() @parametrize - def test_streaming_response_update_overload_2(self, client: Gitpod) -> None: - with client.runners.with_streaming_response.update( - spec={"configuration": {"auto_update": True}}, - ) as response: + def test_streaming_response_update(self, client: Gitpod) -> None: + with client.runners.with_streaming_response.update() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -179,7 +155,7 @@ def test_streaming_response_update_overload_2(self, client: Gitpod) -> None: @parametrize def test_method_list(self, client: Gitpod) -> None: runner = client.runners.list() - assert_matches_type(SyncRunnersPage[RunnerListResponse], runner, path=["response"]) + assert_matches_type(SyncRunnersPage[Runner], runner, path=["response"]) @pytest.mark.skip() @parametrize @@ -197,7 +173,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: "page_size": 100, }, ) - assert_matches_type(SyncRunnersPage[RunnerListResponse], runner, path=["response"]) + assert_matches_type(SyncRunnersPage[Runner], runner, path=["response"]) @pytest.mark.skip() @parametrize @@ -207,7 +183,7 @@ def test_raw_response_list(self, client: Gitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" runner = response.parse() - assert_matches_type(SyncRunnersPage[RunnerListResponse], runner, path=["response"]) + assert_matches_type(SyncRunnersPage[Runner], runner, path=["response"]) @pytest.mark.skip() @parametrize @@ -217,7 +193,7 @@ def test_streaming_response_list(self, client: Gitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" runner = response.parse() - assert_matches_type(SyncRunnersPage[RunnerListResponse], runner, path=["response"]) + assert_matches_type(SyncRunnersPage[Runner], runner, path=["response"]) assert cast(Any, response.is_closed) is True @@ -456,52 +432,30 @@ async def test_streaming_response_retrieve(self, async_client: AsyncGitpod) -> N @pytest.mark.skip() @parametrize - async def test_method_update_overload_1(self, async_client: AsyncGitpod) -> None: - runner = await async_client.runners.update( - name="xxx", - ) + async def test_method_update(self, async_client: AsyncGitpod) -> None: + runner = await async_client.runners.update() assert_matches_type(object, runner, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_update_overload_1(self, async_client: AsyncGitpod) -> None: - response = await async_client.runners.with_raw_response.update( - name="xxx", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - runner = await response.parse() - assert_matches_type(object, runner, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update_overload_1(self, async_client: AsyncGitpod) -> None: - async with async_client.runners.with_streaming_response.update( - name="xxx", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - runner = await response.parse() - assert_matches_type(object, runner, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_update_overload_2(self, async_client: AsyncGitpod) -> None: + async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> None: runner = await async_client.runners.update( - spec={"configuration": {"auto_update": True}}, + name="xxx", + runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + spec={ + "configuration": { + "auto_update": True, + "release_channel": "RUNNER_RELEASE_CHANNEL_UNSPECIFIED", + }, + "desired_phase": "RUNNER_PHASE_UNSPECIFIED", + }, ) assert_matches_type(object, runner, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_update_overload_2(self, async_client: AsyncGitpod) -> None: - response = await async_client.runners.with_raw_response.update( - spec={"configuration": {"auto_update": True}}, - ) + async def test_raw_response_update(self, async_client: AsyncGitpod) -> None: + response = await async_client.runners.with_raw_response.update() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -510,10 +464,8 @@ async def test_raw_response_update_overload_2(self, async_client: AsyncGitpod) - @pytest.mark.skip() @parametrize - async def test_streaming_response_update_overload_2(self, async_client: AsyncGitpod) -> None: - async with async_client.runners.with_streaming_response.update( - spec={"configuration": {"auto_update": True}}, - ) as response: + async def test_streaming_response_update(self, async_client: AsyncGitpod) -> None: + async with async_client.runners.with_streaming_response.update() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -526,7 +478,7 @@ async def test_streaming_response_update_overload_2(self, async_client: AsyncGit @parametrize async def test_method_list(self, async_client: AsyncGitpod) -> None: runner = await async_client.runners.list() - assert_matches_type(AsyncRunnersPage[RunnerListResponse], runner, path=["response"]) + assert_matches_type(AsyncRunnersPage[Runner], runner, path=["response"]) @pytest.mark.skip() @parametrize @@ -544,7 +496,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N "page_size": 100, }, ) - assert_matches_type(AsyncRunnersPage[RunnerListResponse], runner, path=["response"]) + assert_matches_type(AsyncRunnersPage[Runner], runner, path=["response"]) @pytest.mark.skip() @parametrize @@ -554,7 +506,7 @@ async def test_raw_response_list(self, async_client: AsyncGitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" runner = await response.parse() - assert_matches_type(AsyncRunnersPage[RunnerListResponse], runner, path=["response"]) + assert_matches_type(AsyncRunnersPage[Runner], runner, path=["response"]) @pytest.mark.skip() @parametrize @@ -564,7 +516,7 @@ async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" runner = await response.parse() - assert_matches_type(AsyncRunnersPage[RunnerListResponse], runner, path=["response"]) + assert_matches_type(AsyncRunnersPage[Runner], runner, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_secrets.py b/tests/api_resources/test_secrets.py index 07fd383..ce95778 100644 --- a/tests/api_resources/test_secrets.py +++ b/tests/api_resources/test_secrets.py @@ -10,7 +10,7 @@ from gitpod import Gitpod, AsyncGitpod from tests.utils import assert_matches_type from gitpod.types import ( - SecretListResponse, + Secret, SecretCreateResponse, SecretGetValueResponse, ) @@ -24,61 +24,15 @@ class TestSecrets: @pytest.mark.skip() @parametrize - def test_method_create_overload_1(self, client: Gitpod) -> None: - secret = client.secrets.create( - environment_variable=True, - ) + def test_method_create(self, client: Gitpod) -> None: + secret = client.secrets.create() assert_matches_type(SecretCreateResponse, secret, path=["response"]) @pytest.mark.skip() @parametrize - def test_method_create_with_all_params_overload_1(self, client: Gitpod) -> None: + def test_method_create_with_all_params(self, client: Gitpod) -> None: secret = client.secrets.create( environment_variable=True, - name="name", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - value="x", - ) - assert_matches_type(SecretCreateResponse, secret, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_create_overload_1(self, client: Gitpod) -> None: - response = client.secrets.with_raw_response.create( - environment_variable=True, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - secret = response.parse() - assert_matches_type(SecretCreateResponse, secret, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_create_overload_1(self, client: Gitpod) -> None: - with client.secrets.with_streaming_response.create( - environment_variable=True, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - secret = response.parse() - assert_matches_type(SecretCreateResponse, secret, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_method_create_overload_2(self, client: Gitpod) -> None: - secret = client.secrets.create( - file_path="filePath", - ) - assert_matches_type(SecretCreateResponse, secret, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_create_with_all_params_overload_2(self, client: Gitpod) -> None: - secret = client.secrets.create( file_path="filePath", name="name", project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", @@ -88,10 +42,8 @@ def test_method_create_with_all_params_overload_2(self, client: Gitpod) -> None: @pytest.mark.skip() @parametrize - def test_raw_response_create_overload_2(self, client: Gitpod) -> None: - response = client.secrets.with_raw_response.create( - file_path="filePath", - ) + def test_raw_response_create(self, client: Gitpod) -> None: + response = client.secrets.with_raw_response.create() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -100,10 +52,8 @@ def test_raw_response_create_overload_2(self, client: Gitpod) -> None: @pytest.mark.skip() @parametrize - def test_streaming_response_create_overload_2(self, client: Gitpod) -> None: - with client.secrets.with_streaming_response.create( - file_path="filePath", - ) as response: + def test_streaming_response_create(self, client: Gitpod) -> None: + with client.secrets.with_streaming_response.create() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -116,7 +66,7 @@ def test_streaming_response_create_overload_2(self, client: Gitpod) -> None: @parametrize def test_method_list(self, client: Gitpod) -> None: secret = client.secrets.list() - assert_matches_type(SyncSecretsPage[SecretListResponse], secret, path=["response"]) + assert_matches_type(SyncSecretsPage[Secret], secret, path=["response"]) @pytest.mark.skip() @parametrize @@ -130,7 +80,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: "page_size": 100, }, ) - assert_matches_type(SyncSecretsPage[SecretListResponse], secret, path=["response"]) + assert_matches_type(SyncSecretsPage[Secret], secret, path=["response"]) @pytest.mark.skip() @parametrize @@ -140,7 +90,7 @@ def test_raw_response_list(self, client: Gitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" secret = response.parse() - assert_matches_type(SyncSecretsPage[SecretListResponse], secret, path=["response"]) + assert_matches_type(SyncSecretsPage[Secret], secret, path=["response"]) @pytest.mark.skip() @parametrize @@ -150,7 +100,7 @@ def test_streaming_response_list(self, client: Gitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" secret = response.parse() - assert_matches_type(SyncSecretsPage[SecretListResponse], secret, path=["response"]) + assert_matches_type(SyncSecretsPage[Secret], secret, path=["response"]) assert cast(Any, response.is_closed) is True @@ -269,61 +219,15 @@ class TestAsyncSecrets: @pytest.mark.skip() @parametrize - async def test_method_create_overload_1(self, async_client: AsyncGitpod) -> None: - secret = await async_client.secrets.create( - environment_variable=True, - ) + async def test_method_create(self, async_client: AsyncGitpod) -> None: + secret = await async_client.secrets.create() assert_matches_type(SecretCreateResponse, secret, path=["response"]) @pytest.mark.skip() @parametrize - async def test_method_create_with_all_params_overload_1(self, async_client: AsyncGitpod) -> None: + async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> None: secret = await async_client.secrets.create( environment_variable=True, - name="name", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - value="x", - ) - assert_matches_type(SecretCreateResponse, secret, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_create_overload_1(self, async_client: AsyncGitpod) -> None: - response = await async_client.secrets.with_raw_response.create( - environment_variable=True, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - secret = await response.parse() - assert_matches_type(SecretCreateResponse, secret, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_create_overload_1(self, async_client: AsyncGitpod) -> None: - async with async_client.secrets.with_streaming_response.create( - environment_variable=True, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - secret = await response.parse() - assert_matches_type(SecretCreateResponse, secret, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_method_create_overload_2(self, async_client: AsyncGitpod) -> None: - secret = await async_client.secrets.create( - file_path="filePath", - ) - assert_matches_type(SecretCreateResponse, secret, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create_with_all_params_overload_2(self, async_client: AsyncGitpod) -> None: - secret = await async_client.secrets.create( file_path="filePath", name="name", project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", @@ -333,10 +237,8 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn @pytest.mark.skip() @parametrize - async def test_raw_response_create_overload_2(self, async_client: AsyncGitpod) -> None: - response = await async_client.secrets.with_raw_response.create( - file_path="filePath", - ) + async def test_raw_response_create(self, async_client: AsyncGitpod) -> None: + response = await async_client.secrets.with_raw_response.create() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -345,10 +247,8 @@ async def test_raw_response_create_overload_2(self, async_client: AsyncGitpod) - @pytest.mark.skip() @parametrize - async def test_streaming_response_create_overload_2(self, async_client: AsyncGitpod) -> None: - async with async_client.secrets.with_streaming_response.create( - file_path="filePath", - ) as response: + async def test_streaming_response_create(self, async_client: AsyncGitpod) -> None: + async with async_client.secrets.with_streaming_response.create() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -361,7 +261,7 @@ async def test_streaming_response_create_overload_2(self, async_client: AsyncGit @parametrize async def test_method_list(self, async_client: AsyncGitpod) -> None: secret = await async_client.secrets.list() - assert_matches_type(AsyncSecretsPage[SecretListResponse], secret, path=["response"]) + assert_matches_type(AsyncSecretsPage[Secret], secret, path=["response"]) @pytest.mark.skip() @parametrize @@ -375,7 +275,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N "page_size": 100, }, ) - assert_matches_type(AsyncSecretsPage[SecretListResponse], secret, path=["response"]) + assert_matches_type(AsyncSecretsPage[Secret], secret, path=["response"]) @pytest.mark.skip() @parametrize @@ -385,7 +285,7 @@ async def test_raw_response_list(self, async_client: AsyncGitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" secret = await response.parse() - assert_matches_type(AsyncSecretsPage[SecretListResponse], secret, path=["response"]) + assert_matches_type(AsyncSecretsPage[Secret], secret, path=["response"]) @pytest.mark.skip() @parametrize @@ -395,7 +295,7 @@ async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" secret = await response.parse() - assert_matches_type(AsyncSecretsPage[SecretListResponse], secret, path=["response"]) + assert_matches_type(AsyncSecretsPage[Secret], secret, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/users/test_pats.py b/tests/api_resources/users/test_pats.py index d20704e..bf3ea01 100644 --- a/tests/api_resources/users/test_pats.py +++ b/tests/api_resources/users/test_pats.py @@ -10,7 +10,7 @@ from gitpod import Gitpod, AsyncGitpod from tests.utils import assert_matches_type from gitpod.pagination import SyncPersonalAccessTokensPage, AsyncPersonalAccessTokensPage -from gitpod.types.users import PatGetResponse, PatListResponse +from gitpod.types.users import PatGetResponse, PersonalAccessToken base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,7 +22,7 @@ class TestPats: @parametrize def test_method_list(self, client: Gitpod) -> None: pat = client.users.pats.list() - assert_matches_type(SyncPersonalAccessTokensPage[PatListResponse], pat, path=["response"]) + assert_matches_type(SyncPersonalAccessTokensPage[PersonalAccessToken], pat, path=["response"]) @pytest.mark.skip() @parametrize @@ -36,7 +36,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: "page_size": 100, }, ) - assert_matches_type(SyncPersonalAccessTokensPage[PatListResponse], pat, path=["response"]) + assert_matches_type(SyncPersonalAccessTokensPage[PersonalAccessToken], pat, path=["response"]) @pytest.mark.skip() @parametrize @@ -46,7 +46,7 @@ def test_raw_response_list(self, client: Gitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pat = response.parse() - assert_matches_type(SyncPersonalAccessTokensPage[PatListResponse], pat, path=["response"]) + assert_matches_type(SyncPersonalAccessTokensPage[PersonalAccessToken], pat, path=["response"]) @pytest.mark.skip() @parametrize @@ -56,7 +56,7 @@ def test_streaming_response_list(self, client: Gitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pat = response.parse() - assert_matches_type(SyncPersonalAccessTokensPage[PatListResponse], pat, path=["response"]) + assert_matches_type(SyncPersonalAccessTokensPage[PersonalAccessToken], pat, path=["response"]) assert cast(Any, response.is_closed) is True @@ -140,7 +140,7 @@ class TestAsyncPats: @parametrize async def test_method_list(self, async_client: AsyncGitpod) -> None: pat = await async_client.users.pats.list() - assert_matches_type(AsyncPersonalAccessTokensPage[PatListResponse], pat, path=["response"]) + assert_matches_type(AsyncPersonalAccessTokensPage[PersonalAccessToken], pat, path=["response"]) @pytest.mark.skip() @parametrize @@ -154,7 +154,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N "page_size": 100, }, ) - assert_matches_type(AsyncPersonalAccessTokensPage[PatListResponse], pat, path=["response"]) + assert_matches_type(AsyncPersonalAccessTokensPage[PersonalAccessToken], pat, path=["response"]) @pytest.mark.skip() @parametrize @@ -164,7 +164,7 @@ async def test_raw_response_list(self, async_client: AsyncGitpod) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pat = await response.parse() - assert_matches_type(AsyncPersonalAccessTokensPage[PatListResponse], pat, path=["response"]) + assert_matches_type(AsyncPersonalAccessTokensPage[PersonalAccessToken], pat, path=["response"]) @pytest.mark.skip() @parametrize @@ -174,7 +174,7 @@ async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pat = await response.parse() - assert_matches_type(AsyncPersonalAccessTokensPage[PatListResponse], pat, path=["response"]) + assert_matches_type(AsyncPersonalAccessTokensPage[PersonalAccessToken], pat, path=["response"]) assert cast(Any, response.is_closed) is True