diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 14aa9d4..f54c600 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -2,7 +2,7 @@ FROM mcr.microsoft.com/devcontainers/python:3.12 USER vscode -RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.35.0" RYE_INSTALL_OPTION="--yes" bash +RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.44.0" RYE_INSTALL_OPTION="--yes" bash ENV PATH=/home/vscode/.rye/shims:$PATH RUN echo "[[ -d .venv ]] && source .venv/bin/activate || export PATH=\$PATH" >> /home/vscode/.bashrc diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8a8a4f..a15f255 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,18 +1,18 @@ name: CI on: push: - branches: - - main - pull_request: - branches: - - main - - next + branches-ignore: + - 'generated' + - 'codegen/**' + - 'integrated/**' + - 'stl-preview-head/**' + - 'stl-preview-base/**' jobs: lint: + timeout-minutes: 10 name: lint - runs-on: ubuntu-latest - + runs-on: ${{ github.repository == 'stainless-sdks/gitpod-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v4 @@ -21,7 +21,7 @@ jobs: curl -sSf https://rye.astral.sh/get | bash echo "$HOME/.rye/shims" >> $GITHUB_PATH env: - RYE_VERSION: '0.35.0' + RYE_VERSION: '0.44.0' RYE_INSTALL_OPTION: '--yes' - name: Install dependencies @@ -30,10 +30,34 @@ jobs: - name: Run lints run: ./scripts/lint + upload: + if: github.repository == 'stainless-sdks/gitpod-python' + timeout-minutes: 10 + name: upload + permissions: + contents: read + id-token: write + runs-on: depot-ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + + - name: Get GitHub OIDC Token + id: github-oidc + uses: actions/github-script@v6 + with: + script: core.setOutput('github_token', await core.getIDToken()); + + - name: Upload tarball + env: + URL: https://pkg.stainless.com/s + AUTH: ${{ steps.github-oidc.outputs.github_token }} + SHA: ${{ github.sha }} + run: ./scripts/utils/upload-artifact.sh + test: + timeout-minutes: 10 name: test - runs-on: ubuntu-latest - + runs-on: ${{ github.repository == 'stainless-sdks/gitpod-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v4 @@ -42,7 +66,7 @@ jobs: curl -sSf https://rye.astral.sh/get | bash echo "$HOME/.rye/shims" >> $GITHUB_PATH env: - RYE_VERSION: '0.35.0' + RYE_VERSION: '0.44.0' RYE_INSTALL_OPTION: '--yes' - name: Bootstrap diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index df62ae1..6cd33a6 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -21,7 +21,7 @@ jobs: curl -sSf https://rye.astral.sh/get | bash echo "$HOME/.rye/shims" >> $GITHUB_PATH env: - RYE_VERSION: '0.35.0' + RYE_VERSION: '0.44.0' RYE_INSTALL_OPTION: '--yes' - name: Publish to PyPI diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b06ba91..6b7b74c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.2.1" + ".": "0.3.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index f08fd6b..d375176 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,4 @@ -configured_endpoints: 111 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-cd6a05ae99d2a050577fa0e729e6ae89b4eacd78f61366a77269398368f8a877.yml +configured_endpoints: 119 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-ca9a49ac7fbb63f55611fd7cd48a22a3ff8b38a797125c8513e891d9b7345550.yml +openapi_spec_hash: fd6ffbdfaefcc555e61ca1c565e05214 +config_hash: bb9d0a0bdadbee0985dd7c1e4f0e9e8a diff --git a/CHANGELOG.md b/CHANGELOG.md index 9efc8e8..860b8fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,67 @@ # Changelog +## 0.3.0 (2025-06-06) + +Full Changelog: [v0.2.1...v0.3.0](https://github.com/gitpod-io/gitpod-sdk-python/compare/v0.2.1...v0.3.0) + +### Features + +* **api:** manual updates ([640479a](https://github.com/gitpod-io/gitpod-sdk-python/commit/640479ad011cec5bc45b8036f92ec07008e48d76)) +* **api:** manual updates ([72320f5](https://github.com/gitpod-io/gitpod-sdk-python/commit/72320f5101905608aa1819520251813c28a498ab)) +* **api:** manual updates ([530d80c](https://github.com/gitpod-io/gitpod-sdk-python/commit/530d80c68524c0ff5adfdcc157fafdf44f69a2c8)) +* **api:** manual updates ([2717e93](https://github.com/gitpod-io/gitpod-sdk-python/commit/2717e930a0978b5c596d4486464e6faf5e3121b9)) +* **api:** manual updates ([416c2ef](https://github.com/gitpod-io/gitpod-sdk-python/commit/416c2ef62dd99f6b6690d9e1f311019244f2dc78)) +* **api:** manual updates ([#61](https://github.com/gitpod-io/gitpod-sdk-python/issues/61)) ([f8a2a44](https://github.com/gitpod-io/gitpod-sdk-python/commit/f8a2a44972841b5799dddf39cefb1e75a29e67be)) +* **api:** manual updates ([#64](https://github.com/gitpod-io/gitpod-sdk-python/issues/64)) ([f29b9ba](https://github.com/gitpod-io/gitpod-sdk-python/commit/f29b9ba65db6e3c1737c2d781e82ac3bcd457e3a)) +* **client:** allow passing `NotGiven` for body ([#63](https://github.com/gitpod-io/gitpod-sdk-python/issues/63)) ([a62be8a](https://github.com/gitpod-io/gitpod-sdk-python/commit/a62be8a6e5ce5af0aeaec008db7f0a214222515d)) + + +### Bug Fixes + +* **ci:** ensure pip is always available ([#75](https://github.com/gitpod-io/gitpod-sdk-python/issues/75)) ([2a3ae1d](https://github.com/gitpod-io/gitpod-sdk-python/commit/2a3ae1d9237518fbdc267f64dcca813ed6251192)) +* **ci:** remove publishing patch ([#76](https://github.com/gitpod-io/gitpod-sdk-python/issues/76)) ([fc6ffe9](https://github.com/gitpod-io/gitpod-sdk-python/commit/fc6ffe9aa684e00af4a44001a2617452df84f106)) +* **client:** mark some request bodies as optional ([a62be8a](https://github.com/gitpod-io/gitpod-sdk-python/commit/a62be8a6e5ce5af0aeaec008db7f0a214222515d)) +* **perf:** optimize some hot paths ([4a25116](https://github.com/gitpod-io/gitpod-sdk-python/commit/4a251160e74c27a9826fd9146ee630981423994f)) +* **perf:** skip traversing types for NotGiven values ([655645b](https://github.com/gitpod-io/gitpod-sdk-python/commit/655645b8376a92c4a15e985fdeb862a0837cdda2)) +* **pydantic v1:** more robust ModelField.annotation check ([6b28a69](https://github.com/gitpod-io/gitpod-sdk-python/commit/6b28a69cc3af92639a9e90f8c949ab55a16baeea)) +* **types:** handle more discriminated union shapes ([#74](https://github.com/gitpod-io/gitpod-sdk-python/issues/74)) ([e2efe2b](https://github.com/gitpod-io/gitpod-sdk-python/commit/e2efe2bf0a2547b937f8d459172c9b3fd172fd32)) + + +### Chores + +* broadly detect json family of content-type headers ([a4e4e7a](https://github.com/gitpod-io/gitpod-sdk-python/commit/a4e4e7a6c31a7109c129cd21ea86921c212af657)) +* **ci:** add timeout thresholds for CI jobs ([9112f34](https://github.com/gitpod-io/gitpod-sdk-python/commit/9112f34a032563f4805ff367ea46a7376560e4a3)) +* **ci:** only use depot for staging repos ([e00a169](https://github.com/gitpod-io/gitpod-sdk-python/commit/e00a1694e5677db460b8046c9b42b5916a737891)) +* **client:** minor internal fixes ([48341b1](https://github.com/gitpod-io/gitpod-sdk-python/commit/48341b1e44daa967e37e6a9b85429d8231177c81)) +* **docs:** update client docstring ([#68](https://github.com/gitpod-io/gitpod-sdk-python/issues/68)) ([65a92c5](https://github.com/gitpod-io/gitpod-sdk-python/commit/65a92c5c0cb39bf290d24567450a30eda21a7e5b)) +* fix typos ([#77](https://github.com/gitpod-io/gitpod-sdk-python/issues/77)) ([ad69954](https://github.com/gitpod-io/gitpod-sdk-python/commit/ad69954af16f51fb4f89a932d0bbc50501b40119)) +* **internal:** base client updates ([4615096](https://github.com/gitpod-io/gitpod-sdk-python/commit/4615096ade22d29d38d419d18a076ca020dc5563)) +* **internal:** bump pyright version ([9073aa6](https://github.com/gitpod-io/gitpod-sdk-python/commit/9073aa6de0e29f0fdf01e1463a4d513de695fcf3)) +* **internal:** bump rye to 0.44.0 ([#73](https://github.com/gitpod-io/gitpod-sdk-python/issues/73)) ([64be852](https://github.com/gitpod-io/gitpod-sdk-python/commit/64be85212587bec1388214453bd4d7f0ddff57a4)) +* **internal:** codegen related update ([0067daf](https://github.com/gitpod-io/gitpod-sdk-python/commit/0067daffa78169feae6f0c5b6c7d3c94e7fb0a9c)) +* **internal:** codegen related update ([#70](https://github.com/gitpod-io/gitpod-sdk-python/issues/70)) ([317e72c](https://github.com/gitpod-io/gitpod-sdk-python/commit/317e72c74e544cb15945bd610a2ddadebd76be1a)) +* **internal:** codegen related update ([#72](https://github.com/gitpod-io/gitpod-sdk-python/issues/72)) ([a8f27cc](https://github.com/gitpod-io/gitpod-sdk-python/commit/a8f27ccf962b45cc626331ee5ead0a0560235ee6)) +* **internal:** expand CI branch coverage ([c99fbf1](https://github.com/gitpod-io/gitpod-sdk-python/commit/c99fbf1293bfae482b24cfcdfdcff9508bea73f3)) +* **internal:** fix list file params ([4a852b4](https://github.com/gitpod-io/gitpod-sdk-python/commit/4a852b476184043f3508591751a6ccdadf0cc8e8)) +* **internal:** import reformatting ([702e260](https://github.com/gitpod-io/gitpod-sdk-python/commit/702e26060fcc0373063c0b1a873e7c53dbb11f8f)) +* **internal:** minor formatting changes ([759ff42](https://github.com/gitpod-io/gitpod-sdk-python/commit/759ff42ae1059b7697b94e5fa04dc861addd7439)) +* **internal:** properly set __pydantic_private__ ([#66](https://github.com/gitpod-io/gitpod-sdk-python/issues/66)) ([ce1db49](https://github.com/gitpod-io/gitpod-sdk-python/commit/ce1db49b85a64443a5a2143a5b00224d0e3192d1)) +* **internal:** reduce CI branch coverage ([f9fb625](https://github.com/gitpod-io/gitpod-sdk-python/commit/f9fb625d504b60d4374078e2be8320c2a9a3018a)) +* **internal:** refactor retries to not use recursion ([fba2a60](https://github.com/gitpod-io/gitpod-sdk-python/commit/fba2a601a842c7a7d1c211cbd8cc3dcdc5343492)) +* **internal:** remove extra empty newlines ([#71](https://github.com/gitpod-io/gitpod-sdk-python/issues/71)) ([5166c0c](https://github.com/gitpod-io/gitpod-sdk-python/commit/5166c0c48aaa8e59c90d1c23c1dd1bd3d93ba6d9)) +* **internal:** remove trailing character ([#78](https://github.com/gitpod-io/gitpod-sdk-python/issues/78)) ([140ac8b](https://github.com/gitpod-io/gitpod-sdk-python/commit/140ac8b28ddda23e63830cf6049d13498efd015d)) +* **internal:** remove unused http client options forwarding ([#69](https://github.com/gitpod-io/gitpod-sdk-python/issues/69)) ([69a6bde](https://github.com/gitpod-io/gitpod-sdk-python/commit/69a6bde0c2630357e6bcbb26d3848a1679e62bfe)) +* **internal:** slight transform perf improvement ([#80](https://github.com/gitpod-io/gitpod-sdk-python/issues/80)) ([62166e9](https://github.com/gitpod-io/gitpod-sdk-python/commit/62166e9543adfd3ab32fb403c9ab3a26b767f618)) +* **internal:** update models test ([55f3b64](https://github.com/gitpod-io/gitpod-sdk-python/commit/55f3b64a6d9a69cd0cf04b4c71b606ec96c99eab)) +* **internal:** update pyright settings ([d924d39](https://github.com/gitpod-io/gitpod-sdk-python/commit/d924d395581530e38250a0e1c906ce72939b9837)) +* **internal:** variable name and test updates ([#79](https://github.com/gitpod-io/gitpod-sdk-python/issues/79)) ([7de371c](https://github.com/gitpod-io/gitpod-sdk-python/commit/7de371cb2912224280342f8793b181feaed8129a)) +* **tests:** improve enum examples ([#81](https://github.com/gitpod-io/gitpod-sdk-python/issues/81)) ([7b5fc94](https://github.com/gitpod-io/gitpod-sdk-python/commit/7b5fc94fa15074885fde8cea674bd5ad0bbfb2a8)) + + +### Documentation + +* update URLs from stainlessapi.com to stainless.com ([#67](https://github.com/gitpod-io/gitpod-sdk-python/issues/67)) ([cfce519](https://github.com/gitpod-io/gitpod-sdk-python/commit/cfce51963c3e840969f7395d1fd448d3fe33871e)) + ## 0.2.1 (2025-02-18) Full Changelog: [v0.2.0...v0.2.1](https://github.com/gitpod-io/gitpod-sdk-python/compare/v0.2.0...v0.2.1) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 63af707..8e1d17a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,8 +17,7 @@ $ rye sync --all-features You can then run scripts using `rye run python script.py` or by activating the virtual environment: ```sh -$ rye shell -# or manually activate - https://docs.python.org/3/library/venv.html#how-venvs-work +# Activate the virtual environment - https://docs.python.org/3/library/venv.html#how-venvs-work $ source .venv/bin/activate # now you can omit the `rye run` prefix diff --git a/README.md b/README.md index 468f536..f442188 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ The Gitpod Python library provides convenient access to the Gitpod REST API from application. The library includes type definitions for all request params and response fields, and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx). -It is generated with [Stainless](https://www.stainlessapi.com/). +It is generated with [Stainless](https://www.stainless.com/). ## Documentation @@ -136,6 +136,21 @@ for environment in first_page.environments: # Remove `await` for non-async usage. ``` +## Nested params + +Nested parameters are dictionaries, typed using `TypedDict`, for example: + +```python +from gitpod import Gitpod + +client = Gitpod() + +page = client.accounts.list_login_providers( + filter={}, +) +print(page.login_providers) +``` + ## Handling errors When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `gitpod.APIConnectionError` is raised. diff --git a/SECURITY.md b/SECURITY.md index 0985c82..efd9088 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,9 +2,9 @@ ## Reporting Security Issues -This SDK is generated by [Stainless Software Inc](http://stainlessapi.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. +This SDK is generated by [Stainless Software Inc](http://stainless.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. -To report a security issue, please contact the Stainless team at security@stainlessapi.com. +To report a security issue, please contact the Stainless team at security@stainless.com. ## Responsible Disclosure @@ -16,11 +16,11 @@ before making any information public. ## Reporting Non-SDK Related Security Issues If you encounter security issues that are not directly related to SDKs but pertain to the services -or products provided by Gitpod please follow the respective company's security reporting guidelines. +or products provided by Gitpod, please follow the respective company's security reporting guidelines. ### Gitpod Terms and Policies -Please contact dev-feedback@gitpod.com for any questions or concerns regarding security of our services. +Please contact dev-feedback@gitpod.com for any questions or concerns regarding the security of our services. --- diff --git a/api.md b/api.md index e0c317e..d6b34b7 100644 --- a/api.md +++ b/api.md @@ -6,6 +6,7 @@ from gitpod.types import ( EnvironmentClass, ErrorCode, FieldValue, + Gateway, OrganizationRole, Principal, RunsOn, @@ -33,16 +34,17 @@ from gitpod.types import ( JoinableOrganization, LoginProvider, AccountRetrieveResponse, - AccountDeleteResponse, AccountGetSSOLoginURLResponse, + AccountListJoinableOrganizationsResponse, ) ``` Methods: - client.accounts.retrieve(\*\*params) -> AccountRetrieveResponse -- client.accounts.delete(\*\*params) -> object +- client.accounts.delete(\*\*params) -> object - client.accounts.get_sso_login_url(\*\*params) -> AccountGetSSOLoginURLResponse +- client.accounts.list_joinable_organizations(\*\*params) -> AccountListJoinableOrganizationsResponse - client.accounts.list_login_providers(\*\*params) -> SyncLoginProvidersPage[LoginProvider] # Editors @@ -74,13 +76,9 @@ from gitpod.types import ( EnvironmentStatus, EnvironmentCreateResponse, EnvironmentRetrieveResponse, - EnvironmentUpdateResponse, - EnvironmentDeleteResponse, + EnvironmentCreateEnvironmentTokenResponse, EnvironmentCreateFromProjectResponse, EnvironmentCreateLogsTokenResponse, - EnvironmentMarkActiveResponse, - EnvironmentStartResponse, - EnvironmentStopResponse, ) ``` @@ -88,14 +86,16 @@ Methods: - client.environments.create(\*\*params) -> EnvironmentCreateResponse - client.environments.retrieve(\*\*params) -> EnvironmentRetrieveResponse -- client.environments.update(\*\*params) -> object +- client.environments.update(\*\*params) -> object - client.environments.list(\*\*params) -> SyncEnvironmentsPage[Environment] -- client.environments.delete(\*\*params) -> object +- client.environments.delete(\*\*params) -> object +- client.environments.create_environment_token(\*\*params) -> EnvironmentCreateEnvironmentTokenResponse - client.environments.create_from_project(\*\*params) -> EnvironmentCreateFromProjectResponse - client.environments.create_logs_token(\*\*params) -> EnvironmentCreateLogsTokenResponse -- client.environments.mark_active(\*\*params) -> object -- client.environments.start(\*\*params) -> object -- client.environments.stop(\*\*params) -> object +- client.environments.mark_active(\*\*params) -> object +- client.environments.start(\*\*params) -> object +- client.environments.stop(\*\*params) -> object +- client.environments.unarchive(\*\*params) -> object ## Automations @@ -122,10 +122,6 @@ from gitpod.types.environments.automations import ( ServiceStatus, ServiceCreateResponse, ServiceRetrieveResponse, - ServiceUpdateResponse, - ServiceDeleteResponse, - ServiceStartResponse, - ServiceStopResponse, ) ``` @@ -133,11 +129,11 @@ 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.update(\*\*params) -> object - 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 +- client.environments.automations.services.delete(\*\*params) -> object +- client.environments.automations.services.start(\*\*params) -> object +- client.environments.automations.services.stop(\*\*params) -> object ### Tasks @@ -147,8 +143,6 @@ Types: from gitpod.types.environments.automations import ( TaskCreateResponse, TaskRetrieveResponse, - TaskUpdateResponse, - TaskDeleteResponse, TaskStartResponse, ) ``` @@ -157,9 +151,9 @@ 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.update(\*\*params) -> object - client.environments.automations.tasks.list(\*\*params) -> SyncTasksPage[Task] -- client.environments.automations.tasks.delete(\*\*params) -> object +- client.environments.automations.tasks.delete(\*\*params) -> object - client.environments.automations.tasks.start(\*\*params) -> TaskStartResponse #### Executions @@ -167,17 +161,14 @@ Methods: Types: ```python -from gitpod.types.environments.automations.tasks import ( - ExecutionRetrieveResponse, - ExecutionStopResponse, -) +from gitpod.types.environments.automations.tasks import ExecutionRetrieveResponse ``` Methods: - client.environments.automations.tasks.executions.retrieve(\*\*params) -> ExecutionRetrieveResponse - client.environments.automations.tasks.executions.list(\*\*params) -> SyncTaskExecutionsPage[TaskExecution] -- client.environments.automations.tasks.executions.stop(\*\*params) -> object +- client.environments.automations.tasks.executions.stop(\*\*params) -> object ## Classes @@ -198,6 +189,12 @@ Methods: - client.events.list(\*\*params) -> SyncEntriesPage[EventListResponse] - client.events.watch(\*\*params) -> JSONLDecoder[EventWatchResponse] +# Gateways + +Methods: + +- client.gateways.list(\*\*params) -> SyncGatewaysPage[Gateway] + # Groups Types: @@ -216,6 +213,7 @@ Types: ```python from gitpod.types import ( + IDTokenVersion, IdentityExchangeTokenResponse, IdentityGetAuthenticatedIdentityResponse, IdentityGetIDTokenResponse, @@ -237,14 +235,11 @@ from gitpod.types import ( InviteDomains, Organization, OrganizationMember, - Scope, + OrganizationTier, OrganizationCreateResponse, OrganizationRetrieveResponse, OrganizationUpdateResponse, - OrganizationDeleteResponse, OrganizationJoinResponse, - OrganizationLeaveResponse, - OrganizationSetRoleResponse, ) ``` @@ -253,12 +248,11 @@ Methods: - client.organizations.create(\*\*params) -> OrganizationCreateResponse - client.organizations.retrieve(\*\*params) -> OrganizationRetrieveResponse - client.organizations.update(\*\*params) -> OrganizationUpdateResponse -- client.organizations.list(\*\*params) -> SyncOrganizationsPage[Organization] -- client.organizations.delete(\*\*params) -> object +- client.organizations.delete(\*\*params) -> object - client.organizations.join(\*\*params) -> OrganizationJoinResponse -- client.organizations.leave(\*\*params) -> object +- client.organizations.leave(\*\*params) -> object - client.organizations.list_members(\*\*params) -> SyncMembersPage[OrganizationMember] -- client.organizations.set_role(\*\*params) -> object +- client.organizations.set_role(\*\*params) -> object ## DomainVerifications @@ -270,7 +264,6 @@ from gitpod.types.organizations import ( DomainVerificationState, DomainVerificationCreateResponse, DomainVerificationRetrieveResponse, - DomainVerificationDeleteResponse, DomainVerificationVerifyResponse, ) ``` @@ -280,7 +273,7 @@ Methods: - client.organizations.domain_verifications.create(\*\*params) -> DomainVerificationCreateResponse - client.organizations.domain_verifications.retrieve(\*\*params) -> DomainVerificationRetrieveResponse - client.organizations.domain_verifications.list(\*\*params) -> SyncDomainVerificationsPage[DomainVerification] -- client.organizations.domain_verifications.delete(\*\*params) -> object +- client.organizations.domain_verifications.delete(\*\*params) -> object - client.organizations.domain_verifications.verify(\*\*params) -> DomainVerificationVerifyResponse ## Invites @@ -302,6 +295,19 @@ Methods: - client.organizations.invites.retrieve(\*\*params) -> InviteRetrieveResponse - client.organizations.invites.get_summary(\*\*params) -> InviteGetSummaryResponse +## Policies + +Types: + +```python +from gitpod.types.organizations import OrganizationPolicies, PolicyRetrieveResponse +``` + +Methods: + +- client.organizations.policies.retrieve(\*\*params) -> PolicyRetrieveResponse +- client.organizations.policies.update(\*\*params) -> object + ## SSOConfigurations Types: @@ -313,8 +319,6 @@ from gitpod.types.organizations import ( SSOConfigurationState, SSOConfigurationCreateResponse, SSOConfigurationRetrieveResponse, - SSOConfigurationUpdateResponse, - SSOConfigurationDeleteResponse, ) ``` @@ -322,9 +326,9 @@ 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.update(\*\*params) -> object - client.organizations.sso_configurations.list(\*\*params) -> SyncSSOConfigurationsPage[SSOConfiguration] -- client.organizations.sso_configurations.delete(\*\*params) -> object +- client.organizations.sso_configurations.delete(\*\*params) -> object # Projects @@ -339,7 +343,6 @@ from gitpod.types import ( ProjectCreateResponse, ProjectRetrieveResponse, ProjectUpdateResponse, - ProjectDeleteResponse, ProjectCreateFromEnvironmentResponse, ) ``` @@ -350,7 +353,7 @@ Methods: - client.projects.retrieve(\*\*params) -> ProjectRetrieveResponse - client.projects.update(\*\*params) -> ProjectUpdateResponse - client.projects.list(\*\*params) -> SyncProjectsPage[Project] -- client.projects.delete(\*\*params) -> object +- client.projects.delete(\*\*params) -> object - client.projects.create_from_environment(\*\*params) -> ProjectCreateFromEnvironmentResponse ## Policies @@ -363,7 +366,6 @@ from gitpod.types.projects import ( ProjectRole, PolicyCreateResponse, PolicyUpdateResponse, - PolicyDeleteResponse, ) ``` @@ -372,7 +374,7 @@ Methods: - client.projects.policies.create(\*\*params) -> PolicyCreateResponse - client.projects.policies.update(\*\*params) -> PolicyUpdateResponse - client.projects.policies.list(\*\*params) -> SyncPoliciesPage[ProjectPolicy] -- client.projects.policies.delete(\*\*params) -> object +- client.projects.policies.delete(\*\*params) -> object # Runners @@ -380,6 +382,9 @@ Types: ```python from gitpod.types import ( + GatewayInfo, + LogLevel, + MetricsConfiguration, Runner, RunnerCapability, RunnerConfiguration, @@ -391,8 +396,6 @@ from gitpod.types import ( RunnerStatus, RunnerCreateResponse, RunnerRetrieveResponse, - RunnerUpdateResponse, - RunnerDeleteResponse, RunnerCheckAuthenticationForHostResponse, RunnerCreateRunnerTokenResponse, RunnerParseContextURLResponse, @@ -403,9 +406,9 @@ Methods: - client.runners.create(\*\*params) -> RunnerCreateResponse - client.runners.retrieve(\*\*params) -> RunnerRetrieveResponse -- client.runners.update(\*\*params) -> object +- client.runners.update(\*\*params) -> object - client.runners.list(\*\*params) -> SyncRunnersPage[Runner] -- client.runners.delete(\*\*params) -> object +- client.runners.delete(\*\*params) -> object - client.runners.check_authentication_for_host(\*\*params) -> RunnerCheckAuthenticationForHostResponse - client.runners.create_runner_token(\*\*params) -> RunnerCreateRunnerTokenResponse - client.runners.parse_context_url(\*\*params) -> RunnerParseContextURLResponse @@ -435,7 +438,6 @@ Types: from gitpod.types.runners.configurations import ( EnvironmentClassCreateResponse, EnvironmentClassRetrieveResponse, - EnvironmentClassUpdateResponse, ) ``` @@ -443,7 +445,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.update(\*\*params) -> object - client.runners.configurations.environment_classes.list(\*\*params) -> SyncEnvironmentClassesPage[EnvironmentClass] ### HostAuthenticationTokens @@ -456,8 +458,6 @@ from gitpod.types.runners.configurations import ( HostAuthenticationTokenSource, HostAuthenticationTokenCreateResponse, HostAuthenticationTokenRetrieveResponse, - HostAuthenticationTokenUpdateResponse, - HostAuthenticationTokenDeleteResponse, ) ``` @@ -465,9 +465,9 @@ 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.update(\*\*params) -> object - client.runners.configurations.host_authentication_tokens.list(\*\*params) -> SyncTokensPage[HostAuthenticationToken] -- client.runners.configurations.host_authentication_tokens.delete(\*\*params) -> object +- client.runners.configurations.host_authentication_tokens.delete(\*\*params) -> object ### Schema @@ -491,8 +491,6 @@ from gitpod.types.runners.configurations import ( ScmIntegrationOAuthConfig, ScmIntegrationCreateResponse, ScmIntegrationRetrieveResponse, - ScmIntegrationUpdateResponse, - ScmIntegrationDeleteResponse, ) ``` @@ -500,9 +498,9 @@ 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.update(\*\*params) -> object - client.runners.configurations.scm_integrations.list(\*\*params) -> SyncIntegrationsPage[ScmIntegration] -- client.runners.configurations.scm_integrations.delete(\*\*params) -> object +- client.runners.configurations.scm_integrations.delete(\*\*params) -> object ## Policies @@ -514,7 +512,6 @@ from gitpod.types.runners import ( RunnerRole, PolicyCreateResponse, PolicyUpdateResponse, - PolicyDeleteResponse, ) ``` @@ -523,53 +520,72 @@ Methods: - client.runners.policies.create(\*\*params) -> PolicyCreateResponse - client.runners.policies.update(\*\*params) -> PolicyUpdateResponse - client.runners.policies.list(\*\*params) -> SyncPoliciesPage[RunnerPolicy] -- client.runners.policies.delete(\*\*params) -> object +- client.runners.policies.delete(\*\*params) -> object # Secrets Types: ```python -from gitpod.types import ( - Secret, - SecretCreateResponse, - SecretDeleteResponse, - SecretGetValueResponse, - SecretUpdateValueResponse, -) +from gitpod.types import Secret, SecretScope, SecretCreateResponse, SecretGetValueResponse ``` Methods: - client.secrets.create(\*\*params) -> SecretCreateResponse - client.secrets.list(\*\*params) -> SyncSecretsPage[Secret] -- client.secrets.delete(\*\*params) -> object +- client.secrets.delete(\*\*params) -> object - client.secrets.get_value(\*\*params) -> SecretGetValueResponse -- client.secrets.update_value(\*\*params) -> object +- client.secrets.update_value(\*\*params) -> object + +# Usage + +Types: + +```python +from gitpod.types import EnvironmentUsageRecord +``` + +Methods: + +- client.usage.list_environment_runtime_records(\*\*params) -> SyncRecordsPage[EnvironmentUsageRecord] # Users Types: ```python -from gitpod.types import User, UserGetAuthenticatedUserResponse, UserSetSuspendedResponse +from gitpod.types import User, UserGetAuthenticatedUserResponse ``` Methods: - client.users.get_authenticated_user(\*\*params) -> UserGetAuthenticatedUserResponse -- client.users.set_suspended(\*\*params) -> object +- client.users.set_suspended(\*\*params) -> object + +## Dotfiles + +Types: + +```python +from gitpod.types.users import DotfilesConfiguration, DotfileGetResponse +``` + +Methods: + +- client.users.dotfiles.get(\*\*params) -> DotfileGetResponse +- client.users.dotfiles.set(\*\*params) -> object ## Pats Types: ```python -from gitpod.types.users import PersonalAccessToken, PatDeleteResponse, PatGetResponse +from gitpod.types.users import PersonalAccessToken, PatGetResponse ``` Methods: - client.users.pats.list(\*\*params) -> SyncPersonalAccessTokensPage[PersonalAccessToken] -- client.users.pats.delete(\*\*params) -> object +- client.users.pats.delete(\*\*params) -> object - client.users.pats.get(\*\*params) -> PatGetResponse diff --git a/bin/publish-pypi b/bin/publish-pypi index 05bfccb..826054e 100644 --- a/bin/publish-pypi +++ b/bin/publish-pypi @@ -3,7 +3,4 @@ set -eux mkdir -p dist rye build --clean -# Patching importlib-metadata version until upstream library version is updated -# https://github.com/pypa/twine/issues/977#issuecomment-2189800841 -"$HOME/.rye/self/bin/python3" -m pip install 'importlib-metadata==7.2.1' rye publish --yes --token=$PYPI_TOKEN diff --git a/pyproject.toml b/pyproject.toml index 217748a..475cce5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gitpod-sdk" -version = "0.2.1" +version = "0.3.0" description = "The official Python library for the gitpod API" dynamic = ["readme"] license = "Apache-2.0" @@ -38,12 +38,11 @@ Homepage = "https://github.com/gitpod-io/gitpod-sdk-python" Repository = "https://github.com/gitpod-io/gitpod-sdk-python" - [tool.rye] managed = true # version pins are in requirements-dev.lock dev-dependencies = [ - "pyright>=1.1.359", + "pyright==1.1.399", "mypy", "respx", "pytest", @@ -90,7 +89,7 @@ typecheck = { chain = [ "typecheck:mypy" = "mypy ." [build-system] -requires = ["hatchling", "hatch-fancy-pypi-readme"] +requires = ["hatchling==1.26.3", "hatch-fancy-pypi-readme"] build-backend = "hatchling.build" [tool.hatch.build] @@ -151,11 +150,11 @@ exclude = [ ] reportImplicitOverride = true +reportOverlappingOverload = false reportImportCycles = false reportPrivateUsage = false - [tool.ruff] line-length = 120 output-format = "grouped" diff --git a/requirements-dev.lock b/requirements-dev.lock index b22f43c..ade760f 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -7,6 +7,7 @@ # all-features: true # with-sources: false # generate-hashes: false +# universal: false -e file:. annotated-types==0.6.0 @@ -88,7 +89,7 @@ pygments==2.18.0 # via rich pynacl==1.5.0 # via paramiko -pyright==1.1.392.post0 +pyright==1.1.399 pytest==8.3.3 # via pytest-asyncio pytest-asyncio==0.24.0 diff --git a/requirements.lock b/requirements.lock index 65e7618..b542a71 100644 --- a/requirements.lock +++ b/requirements.lock @@ -7,6 +7,7 @@ # all-features: true # with-sources: false # generate-hashes: false +# universal: false -e file:. annotated-types==0.6.0 diff --git a/scripts/test b/scripts/test index 4fa5698..2b87845 100755 --- a/scripts/test +++ b/scripts/test @@ -52,6 +52,8 @@ else echo fi +export DEFER_PYDANTIC_BUILD=false + echo "==> Running tests" rye run pytest "$@" diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh new file mode 100755 index 0000000..f50929a --- /dev/null +++ b/scripts/utils/upload-artifact.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +set -exuo pipefail + +RESPONSE=$(curl -X POST "$URL" \ + -H "Authorization: Bearer $AUTH" \ + -H "Content-Type: application/json") + +SIGNED_URL=$(echo "$RESPONSE" | jq -r '.url') + +if [[ "$SIGNED_URL" == "null" ]]; then + echo -e "\033[31mFailed to get signed URL.\033[0m" + exit 1 +fi + +UPLOAD_RESPONSE=$(tar -cz . | curl -v -X PUT \ + -H "Content-Type: application/gzip" \ + --data-binary @- "$SIGNED_URL" 2>&1) + +if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then + echo -e "\033[32mUploaded build to Stainless storage.\033[0m" + echo -e "\033[32mInstallation: pip install 'https://pkg.stainless.com/s/gitpod-python/$SHA'\033[0m" +else + echo -e "\033[31mFailed to upload artifact.\033[0m" + exit 1 +fi diff --git a/src/gitpod/__init__.py b/src/gitpod/__init__.py index 4bba6eb..ce63e16 100644 --- a/src/gitpod/__init__.py +++ b/src/gitpod/__init__.py @@ -1,5 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +import typing as _t + from . import types from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes from ._utils import file_from_path @@ -68,6 +70,9 @@ "DefaultAsyncHttpxClient", ] +if not _t.TYPE_CHECKING: + from ._utils._resources_proxy import resources as resources + _setup_logging() # Update the __module__ attribute for exported symbols so that diff --git a/src/gitpod/_base_client.py b/src/gitpod/_base_client.py index eb601ba..34005d2 100644 --- a/src/gitpod/_base_client.py +++ b/src/gitpod/_base_client.py @@ -9,7 +9,6 @@ import inspect import logging import platform -import warnings import email.utils from types import TracebackType from random import random @@ -36,7 +35,7 @@ import httpx import distro import pydantic -from httpx import URL, Limits +from httpx import URL from pydantic import PrivateAttr from . import _exceptions @@ -51,19 +50,16 @@ Timeout, NotGiven, ResponseT, - Transport, AnyMapping, PostParser, - ProxiesTypes, RequestFiles, HttpxSendArgs, - AsyncTransport, RequestOptions, HttpxRequestFiles, ModelBuilderProtocol, ) from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping -from ._compat import model_copy, model_dump +from ._compat import PYDANTIC_V2, model_copy, model_dump from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type from ._response import ( APIResponse, @@ -102,7 +98,11 @@ _AsyncStreamT = TypeVar("_AsyncStreamT", bound=AsyncStream[Any]) if TYPE_CHECKING: - from httpx._config import DEFAULT_TIMEOUT_CONFIG as HTTPX_DEFAULT_TIMEOUT + from httpx._config import ( + DEFAULT_TIMEOUT_CONFIG, # pyright: ignore[reportPrivateImportUsage] + ) + + HTTPX_DEFAULT_TIMEOUT = DEFAULT_TIMEOUT_CONFIG else: try: from httpx._config import DEFAULT_TIMEOUT_CONFIG as HTTPX_DEFAULT_TIMEOUT @@ -119,6 +119,7 @@ class PageInfo: url: URL | NotGiven params: Query | NotGiven + json: Body | NotGiven @overload def __init__( @@ -134,19 +135,30 @@ def __init__( params: Query, ) -> None: ... + @overload + def __init__( + self, + *, + json: Body, + ) -> None: ... + def __init__( self, *, url: URL | NotGiven = NOT_GIVEN, + json: Body | NotGiven = NOT_GIVEN, params: Query | NotGiven = NOT_GIVEN, ) -> None: self.url = url + self.json = json self.params = params @override def __repr__(self) -> str: if self.url: return f"{self.__class__.__name__}(url={self.url})" + if self.json: + return f"{self.__class__.__name__}(json={self.json})" return f"{self.__class__.__name__}(params={self.params})" @@ -195,6 +207,19 @@ def _info_to_options(self, info: PageInfo) -> FinalRequestOptions: options.url = str(url) return options + if not isinstance(info.json, NotGiven): + if not is_mapping(info.json): + raise TypeError("Pagination is only supported with mappings") + + if not options.json_data: + options.json_data = {**info.json} + else: + if not is_mapping(options.json_data): + raise TypeError("Pagination is only supported with mappings") + + options.json_data = {**options.json_data, **info.json} + return options + raise ValueError("Unexpected PageInfo state") @@ -207,6 +232,9 @@ def _set_private_attributes( model: Type[_T], options: FinalRequestOptions, ) -> None: + if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + self.__pydantic_private__ = {} + self._model = model self._client = client self._options = options @@ -292,6 +320,9 @@ def _set_private_attributes( client: AsyncAPIClient, options: FinalRequestOptions, ) -> None: + if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + self.__pydantic_private__ = {} + self._model = model self._client = client self._options = options @@ -331,9 +362,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]): _base_url: URL max_retries: int timeout: Union[float, Timeout, None] - _limits: httpx.Limits - _proxies: ProxiesTypes | None - _transport: Transport | AsyncTransport | None _strict_response_validation: bool _idempotency_header: str | None _default_stream_cls: type[_DefaultStreamT] | None = None @@ -346,9 +374,6 @@ def __init__( _strict_response_validation: bool, max_retries: int = DEFAULT_MAX_RETRIES, timeout: float | Timeout | None = DEFAULT_TIMEOUT, - limits: httpx.Limits, - transport: Transport | AsyncTransport | None, - proxies: ProxiesTypes | None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, ) -> None: @@ -356,9 +381,6 @@ def __init__( self._base_url = self._enforce_trailing_slash(URL(base_url)) self.max_retries = max_retries self.timeout = timeout - self._limits = limits - self._proxies = proxies - self._transport = transport self._custom_headers = custom_headers or {} self._custom_query = custom_query or {} self._strict_response_validation = _strict_response_validation @@ -415,8 +437,8 @@ def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0 headers = httpx.Headers(headers_dict) idempotency_header = self._idempotency_header - if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers: - headers[idempotency_header] = options.idempotency_key or self._idempotency_key() + if idempotency_header and options.idempotency_key and idempotency_header not in headers: + headers[idempotency_header] = options.idempotency_key # Don't set these headers if they were already set or removed by the caller. We check # `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case. @@ -518,7 +540,7 @@ def _build_request( # so that passing a `TypedDict` doesn't cause an error. # https://github.com/microsoft/pyright/issues/3526#event-6715453066 params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None, - json=json_data, + json=json_data if is_given(json_data) else None, files=files, **kwargs, ) @@ -794,46 +816,11 @@ def __init__( base_url: str | URL, max_retries: int = DEFAULT_MAX_RETRIES, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, - transport: Transport | None = None, - proxies: ProxiesTypes | None = None, - limits: Limits | None = None, http_client: httpx.Client | None = None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, _strict_response_validation: bool, ) -> None: - kwargs: dict[str, Any] = {} - if limits is not None: - warnings.warn( - "The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`") - else: - limits = DEFAULT_CONNECTION_LIMITS - - if transport is not None: - kwargs["transport"] = transport - warnings.warn( - "The `transport` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `transport`") - - if proxies is not None: - kwargs["proxies"] = proxies - warnings.warn( - "The `proxies` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `proxies`") - if not is_given(timeout): # if the user passed in a custom http client with a non-default # timeout set then we use that timeout. @@ -854,12 +841,9 @@ def __init__( super().__init__( version=version, - limits=limits, # cast to a valid type because mypy doesn't understand our type narrowing timeout=cast(Timeout, timeout), - proxies=proxies, base_url=base_url, - transport=transport, max_retries=max_retries, custom_query=custom_query, custom_headers=custom_headers, @@ -869,9 +853,6 @@ def __init__( base_url=base_url, # cast to a valid type because mypy doesn't understand our type narrowing timeout=cast(Timeout, timeout), - limits=limits, - follow_redirects=True, - **kwargs, # type: ignore ) def is_closed(self) -> bool: @@ -921,7 +902,6 @@ def request( self, cast_to: Type[ResponseT], options: FinalRequestOptions, - remaining_retries: Optional[int] = None, *, stream: Literal[True], stream_cls: Type[_StreamT], @@ -932,7 +912,6 @@ def request( self, cast_to: Type[ResponseT], options: FinalRequestOptions, - remaining_retries: Optional[int] = None, *, stream: Literal[False] = False, ) -> ResponseT: ... @@ -942,7 +921,6 @@ def request( self, cast_to: Type[ResponseT], options: FinalRequestOptions, - remaining_retries: Optional[int] = None, *, stream: bool = False, stream_cls: Type[_StreamT] | None = None, @@ -952,121 +930,112 @@ def request( self, cast_to: Type[ResponseT], options: FinalRequestOptions, - remaining_retries: Optional[int] = None, *, stream: bool = False, stream_cls: type[_StreamT] | None = None, ) -> ResponseT | _StreamT: - if remaining_retries is not None: - retries_taken = options.get_max_retries(self.max_retries) - remaining_retries - else: - retries_taken = 0 - - return self._request( - cast_to=cast_to, - options=options, - stream=stream, - stream_cls=stream_cls, - retries_taken=retries_taken, - ) + cast_to = self._maybe_override_cast_to(cast_to, options) - def _request( - self, - *, - cast_to: Type[ResponseT], - options: FinalRequestOptions, - retries_taken: int, - stream: bool, - stream_cls: type[_StreamT] | None, - ) -> ResponseT | _StreamT: # create a copy of the options we were given so that if the # options are mutated later & we then retry, the retries are # given the original options input_options = model_copy(options) + if input_options.idempotency_key is None and input_options.method.lower() != "get": + # ensure the idempotency key is reused between requests + input_options.idempotency_key = self._idempotency_key() - cast_to = self._maybe_override_cast_to(cast_to, options) - options = self._prepare_options(options) + response: httpx.Response | None = None + max_retries = input_options.get_max_retries(self.max_retries) - remaining_retries = options.get_max_retries(self.max_retries) - retries_taken - request = self._build_request(options, retries_taken=retries_taken) - self._prepare_request(request) + retries_taken = 0 + for retries_taken in range(max_retries + 1): + options = model_copy(input_options) + options = self._prepare_options(options) - kwargs: HttpxSendArgs = {} - if self.custom_auth is not None: - kwargs["auth"] = self.custom_auth + remaining_retries = max_retries - retries_taken + request = self._build_request(options, retries_taken=retries_taken) + self._prepare_request(request) - log.debug("Sending HTTP Request: %s %s", request.method, request.url) + kwargs: HttpxSendArgs = {} + if self.custom_auth is not None: + kwargs["auth"] = self.custom_auth - try: - response = self._client.send( - request, - stream=stream or self._should_stream_response_body(request=request), - **kwargs, - ) - except httpx.TimeoutException as err: - log.debug("Encountered httpx.TimeoutException", exc_info=True) + if options.follow_redirects is not None: + kwargs["follow_redirects"] = options.follow_redirects - if remaining_retries > 0: - return self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - stream=stream, - stream_cls=stream_cls, - response_headers=None, - ) + log.debug("Sending HTTP Request: %s %s", request.method, request.url) - log.debug("Raising timeout error") - raise APITimeoutError(request=request) from err - except Exception as err: - log.debug("Encountered Exception", exc_info=True) - - if remaining_retries > 0: - return self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - stream=stream, - stream_cls=stream_cls, - response_headers=None, + response = None + try: + response = self._client.send( + request, + stream=stream or self._should_stream_response_body(request=request), + **kwargs, ) + except httpx.TimeoutException as err: + log.debug("Encountered httpx.TimeoutException", exc_info=True) + + if remaining_retries > 0: + self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising timeout error") + raise APITimeoutError(request=request) from err + except Exception as err: + log.debug("Encountered Exception", exc_info=True) + + if remaining_retries > 0: + self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising connection error") + raise APIConnectionError(request=request) from err + + log.debug( + 'HTTP Response: %s %s "%i %s" %s', + request.method, + request.url, + response.status_code, + response.reason_phrase, + response.headers, + ) - log.debug("Raising connection error") - raise APIConnectionError(request=request) from err - - log.debug( - 'HTTP Response: %s %s "%i %s" %s', - request.method, - request.url, - response.status_code, - response.reason_phrase, - response.headers, - ) + try: + response.raise_for_status() + except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code + log.debug("Encountered httpx.HTTPStatusError", exc_info=True) + + if remaining_retries > 0 and self._should_retry(err.response): + err.response.close() + self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=response, + ) + continue - try: - response.raise_for_status() - except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code - log.debug("Encountered httpx.HTTPStatusError", exc_info=True) - - if remaining_retries > 0 and self._should_retry(err.response): - err.response.close() - return self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - response_headers=err.response.headers, - stream=stream, - stream_cls=stream_cls, - ) + # If the response is streamed then we need to explicitly read the response + # to completion before attempting to access the response text. + if not err.response.is_closed: + err.response.read() - # If the response is streamed then we need to explicitly read the response - # to completion before attempting to access the response text. - if not err.response.is_closed: - err.response.read() + log.debug("Re-raising status error") + raise self._make_status_error_from_response(err.response) from None - log.debug("Re-raising status error") - raise self._make_status_error_from_response(err.response) from None + break + assert response is not None, "could not resolve response (should never happen)" return self._process_response( cast_to=cast_to, options=options, @@ -1076,37 +1045,20 @@ def _request( retries_taken=retries_taken, ) - def _retry_request( - self, - options: FinalRequestOptions, - cast_to: Type[ResponseT], - *, - retries_taken: int, - response_headers: httpx.Headers | None, - stream: bool, - stream_cls: type[_StreamT] | None, - ) -> ResponseT | _StreamT: - remaining_retries = options.get_max_retries(self.max_retries) - retries_taken + def _sleep_for_retry( + self, *, retries_taken: int, max_retries: int, options: FinalRequestOptions, response: httpx.Response | None + ) -> None: + remaining_retries = max_retries - retries_taken if remaining_retries == 1: log.debug("1 retry left") else: log.debug("%i retries left", remaining_retries) - timeout = self._calculate_retry_timeout(remaining_retries, options, response_headers) + timeout = self._calculate_retry_timeout(remaining_retries, options, response.headers if response else None) log.info("Retrying request to %s in %f seconds", options.url, timeout) - # In a synchronous context we are blocking the entire thread. Up to the library user to run the client in a - # different thread if necessary. time.sleep(timeout) - return self._request( - options=options, - cast_to=cast_to, - retries_taken=retries_taken + 1, - stream=stream, - stream_cls=stream_cls, - ) - def _process_response( self, *, @@ -1366,45 +1318,10 @@ def __init__( _strict_response_validation: bool, max_retries: int = DEFAULT_MAX_RETRIES, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, - transport: AsyncTransport | None = None, - proxies: ProxiesTypes | None = None, - limits: Limits | None = None, http_client: httpx.AsyncClient | None = None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, ) -> None: - kwargs: dict[str, Any] = {} - if limits is not None: - warnings.warn( - "The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`") - else: - limits = DEFAULT_CONNECTION_LIMITS - - if transport is not None: - kwargs["transport"] = transport - warnings.warn( - "The `transport` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `transport`") - - if proxies is not None: - kwargs["proxies"] = proxies - warnings.warn( - "The `proxies` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `proxies`") - if not is_given(timeout): # if the user passed in a custom http client with a non-default # timeout set then we use that timeout. @@ -1426,11 +1343,8 @@ def __init__( super().__init__( version=version, base_url=base_url, - limits=limits, # cast to a valid type because mypy doesn't understand our type narrowing timeout=cast(Timeout, timeout), - proxies=proxies, - transport=transport, max_retries=max_retries, custom_query=custom_query, custom_headers=custom_headers, @@ -1440,9 +1354,6 @@ def __init__( base_url=base_url, # cast to a valid type because mypy doesn't understand our type narrowing timeout=cast(Timeout, timeout), - limits=limits, - follow_redirects=True, - **kwargs, # type: ignore ) def is_closed(self) -> bool: @@ -1491,7 +1402,6 @@ async def request( options: FinalRequestOptions, *, stream: Literal[False] = False, - remaining_retries: Optional[int] = None, ) -> ResponseT: ... @overload @@ -1502,7 +1412,6 @@ async def request( *, stream: Literal[True], stream_cls: type[_AsyncStreamT], - remaining_retries: Optional[int] = None, ) -> _AsyncStreamT: ... @overload @@ -1513,7 +1422,6 @@ async def request( *, stream: bool, stream_cls: type[_AsyncStreamT] | None = None, - remaining_retries: Optional[int] = None, ) -> ResponseT | _AsyncStreamT: ... async def request( @@ -1523,116 +1431,114 @@ async def request( *, stream: bool = False, stream_cls: type[_AsyncStreamT] | None = None, - remaining_retries: Optional[int] = None, - ) -> ResponseT | _AsyncStreamT: - if remaining_retries is not None: - retries_taken = options.get_max_retries(self.max_retries) - remaining_retries - else: - retries_taken = 0 - - return await self._request( - cast_to=cast_to, - options=options, - stream=stream, - stream_cls=stream_cls, - retries_taken=retries_taken, - ) - - async def _request( - self, - cast_to: Type[ResponseT], - options: FinalRequestOptions, - *, - stream: bool, - stream_cls: type[_AsyncStreamT] | None, - retries_taken: int, ) -> ResponseT | _AsyncStreamT: if self._platform is None: # `get_platform` can make blocking IO calls so we # execute it earlier while we are in an async context self._platform = await asyncify(get_platform)() + cast_to = self._maybe_override_cast_to(cast_to, options) + # create a copy of the options we were given so that if the # options are mutated later & we then retry, the retries are # given the original options input_options = model_copy(options) + if input_options.idempotency_key is None and input_options.method.lower() != "get": + # ensure the idempotency key is reused between requests + input_options.idempotency_key = self._idempotency_key() - cast_to = self._maybe_override_cast_to(cast_to, options) - options = await self._prepare_options(options) + response: httpx.Response | None = None + max_retries = input_options.get_max_retries(self.max_retries) - remaining_retries = options.get_max_retries(self.max_retries) - retries_taken - request = self._build_request(options, retries_taken=retries_taken) - await self._prepare_request(request) + retries_taken = 0 + for retries_taken in range(max_retries + 1): + options = model_copy(input_options) + options = await self._prepare_options(options) - kwargs: HttpxSendArgs = {} - if self.custom_auth is not None: - kwargs["auth"] = self.custom_auth + remaining_retries = max_retries - retries_taken + request = self._build_request(options, retries_taken=retries_taken) + await self._prepare_request(request) - try: - response = await self._client.send( - request, - stream=stream or self._should_stream_response_body(request=request), - **kwargs, - ) - except httpx.TimeoutException as err: - log.debug("Encountered httpx.TimeoutException", exc_info=True) + kwargs: HttpxSendArgs = {} + if self.custom_auth is not None: + kwargs["auth"] = self.custom_auth - if remaining_retries > 0: - return await self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - stream=stream, - stream_cls=stream_cls, - response_headers=None, - ) + if options.follow_redirects is not None: + kwargs["follow_redirects"] = options.follow_redirects - log.debug("Raising timeout error") - raise APITimeoutError(request=request) from err - except Exception as err: - log.debug("Encountered Exception", exc_info=True) + log.debug("Sending HTTP Request: %s %s", request.method, request.url) - if remaining_retries > 0: - return await self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - stream=stream, - stream_cls=stream_cls, - response_headers=None, + response = None + try: + response = await self._client.send( + request, + stream=stream or self._should_stream_response_body(request=request), + **kwargs, ) + except httpx.TimeoutException as err: + log.debug("Encountered httpx.TimeoutException", exc_info=True) + + if remaining_retries > 0: + await self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising timeout error") + raise APITimeoutError(request=request) from err + except Exception as err: + log.debug("Encountered Exception", exc_info=True) + + if remaining_retries > 0: + await self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising connection error") + raise APIConnectionError(request=request) from err + + log.debug( + 'HTTP Response: %s %s "%i %s" %s', + request.method, + request.url, + response.status_code, + response.reason_phrase, + response.headers, + ) - log.debug("Raising connection error") - raise APIConnectionError(request=request) from err - - log.debug( - 'HTTP Request: %s %s "%i %s"', request.method, request.url, response.status_code, response.reason_phrase - ) + try: + response.raise_for_status() + except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code + log.debug("Encountered httpx.HTTPStatusError", exc_info=True) + + if remaining_retries > 0 and self._should_retry(err.response): + await err.response.aclose() + await self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=response, + ) + continue - try: - response.raise_for_status() - except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code - log.debug("Encountered httpx.HTTPStatusError", exc_info=True) - - if remaining_retries > 0 and self._should_retry(err.response): - await err.response.aclose() - return await self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - response_headers=err.response.headers, - stream=stream, - stream_cls=stream_cls, - ) + # If the response is streamed then we need to explicitly read the response + # to completion before attempting to access the response text. + if not err.response.is_closed: + await err.response.aread() - # If the response is streamed then we need to explicitly read the response - # to completion before attempting to access the response text. - if not err.response.is_closed: - await err.response.aread() + log.debug("Re-raising status error") + raise self._make_status_error_from_response(err.response) from None - log.debug("Re-raising status error") - raise self._make_status_error_from_response(err.response) from None + break + assert response is not None, "could not resolve response (should never happen)" return await self._process_response( cast_to=cast_to, options=options, @@ -1642,35 +1548,20 @@ async def _request( retries_taken=retries_taken, ) - async def _retry_request( - self, - options: FinalRequestOptions, - cast_to: Type[ResponseT], - *, - retries_taken: int, - response_headers: httpx.Headers | None, - stream: bool, - stream_cls: type[_AsyncStreamT] | None, - ) -> ResponseT | _AsyncStreamT: - remaining_retries = options.get_max_retries(self.max_retries) - retries_taken + async def _sleep_for_retry( + self, *, retries_taken: int, max_retries: int, options: FinalRequestOptions, response: httpx.Response | None + ) -> None: + remaining_retries = max_retries - retries_taken if remaining_retries == 1: log.debug("1 retry left") else: log.debug("%i retries left", remaining_retries) - timeout = self._calculate_retry_timeout(remaining_retries, options, response_headers) + timeout = self._calculate_retry_timeout(remaining_retries, options, response.headers if response else None) log.info("Retrying request to %s in %f seconds", options.url, timeout) await anyio.sleep(timeout) - return await self._request( - options=options, - cast_to=cast_to, - retries_taken=retries_taken + 1, - stream=stream, - stream_cls=stream_cls, - ) - async def _process_response( self, *, diff --git a/src/gitpod/_client.py b/src/gitpod/_client.py index 3fad133..dd0ccc2 100644 --- a/src/gitpod/_client.py +++ b/src/gitpod/_client.py @@ -19,12 +19,9 @@ ProxiesTypes, RequestOptions, ) -from ._utils import ( - is_given, - get_async_library, -) +from ._utils import is_given, get_async_library from ._version import __version__ -from .resources import events, groups, editors, secrets, accounts, identity +from .resources import usage, events, groups, editors, secrets, accounts, gateways, identity from ._streaming import Stream as Stream, AsyncStream as AsyncStream from ._exceptions import GitpodError, APIStatusError from ._base_client import ( @@ -46,12 +43,14 @@ class Gitpod(SyncAPIClient): editors: editors.EditorsResource environments: environments.EnvironmentsResource events: events.EventsResource + gateways: gateways.GatewaysResource groups: groups.GroupsResource identity: identity.IdentityResource organizations: organizations.OrganizationsResource projects: projects.ProjectsResource runners: runners.RunnersResource secrets: secrets.SecretsResource + usage: usage.UsageResource users: users.UsersResource with_raw_response: GitpodWithRawResponse with_streaming_response: GitpodWithStreamedResponse @@ -82,7 +81,7 @@ def __init__( # part of our public interface in the future. _strict_response_validation: bool = False, ) -> None: - """Construct a new synchronous gitpod client instance. + """Construct a new synchronous Gitpod client instance. This automatically infers the `bearer_token` argument from the `GITPOD_API_KEY` environment variable if it is not provided. """ @@ -114,12 +113,14 @@ def __init__( self.editors = editors.EditorsResource(self) self.environments = environments.EnvironmentsResource(self) self.events = events.EventsResource(self) + self.gateways = gateways.GatewaysResource(self) self.groups = groups.GroupsResource(self) self.identity = identity.IdentityResource(self) self.organizations = organizations.OrganizationsResource(self) self.projects = projects.ProjectsResource(self) self.runners = runners.RunnersResource(self) self.secrets = secrets.SecretsResource(self) + self.usage = usage.UsageResource(self) self.users = users.UsersResource(self) self.with_raw_response = GitpodWithRawResponse(self) self.with_streaming_response = GitpodWithStreamedResponse(self) @@ -234,12 +235,14 @@ class AsyncGitpod(AsyncAPIClient): editors: editors.AsyncEditorsResource environments: environments.AsyncEnvironmentsResource events: events.AsyncEventsResource + gateways: gateways.AsyncGatewaysResource groups: groups.AsyncGroupsResource identity: identity.AsyncIdentityResource organizations: organizations.AsyncOrganizationsResource projects: projects.AsyncProjectsResource runners: runners.AsyncRunnersResource secrets: secrets.AsyncSecretsResource + usage: usage.AsyncUsageResource users: users.AsyncUsersResource with_raw_response: AsyncGitpodWithRawResponse with_streaming_response: AsyncGitpodWithStreamedResponse @@ -270,7 +273,7 @@ def __init__( # part of our public interface in the future. _strict_response_validation: bool = False, ) -> None: - """Construct a new async gitpod client instance. + """Construct a new async AsyncGitpod client instance. This automatically infers the `bearer_token` argument from the `GITPOD_API_KEY` environment variable if it is not provided. """ @@ -302,12 +305,14 @@ def __init__( self.editors = editors.AsyncEditorsResource(self) self.environments = environments.AsyncEnvironmentsResource(self) self.events = events.AsyncEventsResource(self) + self.gateways = gateways.AsyncGatewaysResource(self) self.groups = groups.AsyncGroupsResource(self) self.identity = identity.AsyncIdentityResource(self) self.organizations = organizations.AsyncOrganizationsResource(self) self.projects = projects.AsyncProjectsResource(self) self.runners = runners.AsyncRunnersResource(self) self.secrets = secrets.AsyncSecretsResource(self) + self.usage = usage.AsyncUsageResource(self) self.users = users.AsyncUsersResource(self) self.with_raw_response = AsyncGitpodWithRawResponse(self) self.with_streaming_response = AsyncGitpodWithStreamedResponse(self) @@ -423,12 +428,14 @@ def __init__(self, client: Gitpod) -> None: self.editors = editors.EditorsResourceWithRawResponse(client.editors) self.environments = environments.EnvironmentsResourceWithRawResponse(client.environments) self.events = events.EventsResourceWithRawResponse(client.events) + self.gateways = gateways.GatewaysResourceWithRawResponse(client.gateways) self.groups = groups.GroupsResourceWithRawResponse(client.groups) self.identity = identity.IdentityResourceWithRawResponse(client.identity) self.organizations = organizations.OrganizationsResourceWithRawResponse(client.organizations) self.projects = projects.ProjectsResourceWithRawResponse(client.projects) self.runners = runners.RunnersResourceWithRawResponse(client.runners) self.secrets = secrets.SecretsResourceWithRawResponse(client.secrets) + self.usage = usage.UsageResourceWithRawResponse(client.usage) self.users = users.UsersResourceWithRawResponse(client.users) @@ -438,12 +445,14 @@ def __init__(self, client: AsyncGitpod) -> None: self.editors = editors.AsyncEditorsResourceWithRawResponse(client.editors) self.environments = environments.AsyncEnvironmentsResourceWithRawResponse(client.environments) self.events = events.AsyncEventsResourceWithRawResponse(client.events) + self.gateways = gateways.AsyncGatewaysResourceWithRawResponse(client.gateways) self.groups = groups.AsyncGroupsResourceWithRawResponse(client.groups) self.identity = identity.AsyncIdentityResourceWithRawResponse(client.identity) self.organizations = organizations.AsyncOrganizationsResourceWithRawResponse(client.organizations) self.projects = projects.AsyncProjectsResourceWithRawResponse(client.projects) self.runners = runners.AsyncRunnersResourceWithRawResponse(client.runners) self.secrets = secrets.AsyncSecretsResourceWithRawResponse(client.secrets) + self.usage = usage.AsyncUsageResourceWithRawResponse(client.usage) self.users = users.AsyncUsersResourceWithRawResponse(client.users) @@ -453,12 +462,14 @@ def __init__(self, client: Gitpod) -> None: self.editors = editors.EditorsResourceWithStreamingResponse(client.editors) self.environments = environments.EnvironmentsResourceWithStreamingResponse(client.environments) self.events = events.EventsResourceWithStreamingResponse(client.events) + self.gateways = gateways.GatewaysResourceWithStreamingResponse(client.gateways) self.groups = groups.GroupsResourceWithStreamingResponse(client.groups) self.identity = identity.IdentityResourceWithStreamingResponse(client.identity) self.organizations = organizations.OrganizationsResourceWithStreamingResponse(client.organizations) self.projects = projects.ProjectsResourceWithStreamingResponse(client.projects) self.runners = runners.RunnersResourceWithStreamingResponse(client.runners) self.secrets = secrets.SecretsResourceWithStreamingResponse(client.secrets) + self.usage = usage.UsageResourceWithStreamingResponse(client.usage) self.users = users.UsersResourceWithStreamingResponse(client.users) @@ -468,12 +479,14 @@ def __init__(self, client: AsyncGitpod) -> None: self.editors = editors.AsyncEditorsResourceWithStreamingResponse(client.editors) self.environments = environments.AsyncEnvironmentsResourceWithStreamingResponse(client.environments) self.events = events.AsyncEventsResourceWithStreamingResponse(client.events) + self.gateways = gateways.AsyncGatewaysResourceWithStreamingResponse(client.gateways) self.groups = groups.AsyncGroupsResourceWithStreamingResponse(client.groups) self.identity = identity.AsyncIdentityResourceWithStreamingResponse(client.identity) self.organizations = organizations.AsyncOrganizationsResourceWithStreamingResponse(client.organizations) self.projects = projects.AsyncProjectsResourceWithStreamingResponse(client.projects) self.runners = runners.AsyncRunnersResourceWithStreamingResponse(client.runners) self.secrets = secrets.AsyncSecretsResourceWithStreamingResponse(client.secrets) + self.usage = usage.AsyncUsageResourceWithStreamingResponse(client.usage) self.users = users.AsyncUsersResourceWithStreamingResponse(client.users) diff --git a/src/gitpod/_models.py b/src/gitpod/_models.py index c4401ff..4f21498 100644 --- a/src/gitpod/_models.py +++ b/src/gitpod/_models.py @@ -19,7 +19,6 @@ ) import pydantic -import pydantic.generics from pydantic.fields import FieldInfo from ._types import ( @@ -65,7 +64,7 @@ from ._constants import RAW_RESPONSE_HEADER if TYPE_CHECKING: - from pydantic_core.core_schema import ModelField, LiteralSchema, ModelFieldsSchema + from pydantic_core.core_schema import ModelField, ModelSchema, LiteralSchema, ModelFieldsSchema __all__ = ["BaseModel", "GenericModel"] @@ -627,8 +626,8 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, # Note: if one variant defines an alias then they all should discriminator_alias = field_info.alias - if field_info.annotation and is_literal_type(field_info.annotation): - for entry in get_args(field_info.annotation): + if (annotation := getattr(field_info, "annotation", None)) and is_literal_type(annotation): + for entry in get_args(annotation): if isinstance(entry, str): mapping[entry] = variant @@ -646,15 +645,18 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, def _extract_field_schema_pv2(model: type[BaseModel], field_name: str) -> ModelField | None: schema = model.__pydantic_core_schema__ + if schema["type"] == "definitions": + schema = schema["schema"] + if schema["type"] != "model": return None + schema = cast("ModelSchema", schema) fields_schema = schema["schema"] if fields_schema["type"] != "model-fields": return None fields_schema = cast("ModelFieldsSchema", fields_schema) - field = fields_schema["fields"].get(field_name) if not field: return None @@ -678,7 +680,7 @@ def set_pydantic_config(typ: Any, config: pydantic.ConfigDict) -> None: setattr(typ, "__pydantic_config__", config) # noqa: B010 -# our use of subclasssing here causes weirdness for type checkers, +# our use of subclassing here causes weirdness for type checkers, # so we just pretend that we don't subclass if TYPE_CHECKING: GenericModel = BaseModel @@ -735,6 +737,7 @@ class FinalRequestOptionsInput(TypedDict, total=False): idempotency_key: str json_data: Body extra_json: AnyMapping + follow_redirects: bool @final @@ -748,6 +751,7 @@ class FinalRequestOptions(pydantic.BaseModel): files: Union[HttpxRequestFiles, None] = None idempotency_key: Union[str, None] = None post_parser: Union[Callable[[Any], Any], NotGiven] = NotGiven() + follow_redirects: Union[bool, None] = None # It should be noted that we cannot use `json` here as that would override # a BaseModel method in an incompatible fashion. diff --git a/src/gitpod/_response.py b/src/gitpod/_response.py index 38a11e6..6211d72 100644 --- a/src/gitpod/_response.py +++ b/src/gitpod/_response.py @@ -255,7 +255,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: # split is required to handle cases where additional information is included # in the response, e.g. application/json; charset=utf-8 content_type, *_ = response.headers.get("content-type", "*").split(";") - if content_type != "application/json": + if not content_type.endswith("json"): if is_basemodel(cast_to): try: data = response.json() diff --git a/src/gitpod/_types.py b/src/gitpod/_types.py index 618f188..b5cea32 100644 --- a/src/gitpod/_types.py +++ b/src/gitpod/_types.py @@ -100,6 +100,7 @@ class RequestOptions(TypedDict, total=False): params: Query extra_json: AnyMapping idempotency_key: str + follow_redirects: bool # Sentinel class used until PEP 0661 is accepted @@ -215,3 +216,4 @@ class _GenericAlias(Protocol): class HttpxSendArgs(TypedDict, total=False): auth: httpx.Auth + follow_redirects: bool diff --git a/src/gitpod/_utils/_proxy.py b/src/gitpod/_utils/_proxy.py index ffd883e..0f239a3 100644 --- a/src/gitpod/_utils/_proxy.py +++ b/src/gitpod/_utils/_proxy.py @@ -46,7 +46,10 @@ def __dir__(self) -> Iterable[str]: @property # type: ignore @override def __class__(self) -> type: # pyright: ignore - proxied = self.__get_proxied__() + try: + proxied = self.__get_proxied__() + except Exception: + return type(self) if issubclass(type(proxied), LazyProxy): return type(proxied) return proxied.__class__ diff --git a/src/gitpod/_utils/_resources_proxy.py b/src/gitpod/_utils/_resources_proxy.py new file mode 100644 index 0000000..7ffe977 --- /dev/null +++ b/src/gitpod/_utils/_resources_proxy.py @@ -0,0 +1,24 @@ +from __future__ import annotations + +from typing import Any +from typing_extensions import override + +from ._proxy import LazyProxy + + +class ResourcesProxy(LazyProxy[Any]): + """A proxy for the `gitpod.resources` module. + + This is used so that we can lazily import `gitpod.resources` only when + needed *and* so that users can just import `gitpod` and reference `gitpod.resources` + """ + + @override + def __load__(self) -> Any: + import importlib + + mod = importlib.import_module("gitpod.resources") + return mod + + +resources = ResourcesProxy().__as_proxied__() diff --git a/src/gitpod/_utils/_transform.py b/src/gitpod/_utils/_transform.py index 18afd9d..b0cc20a 100644 --- a/src/gitpod/_utils/_transform.py +++ b/src/gitpod/_utils/_transform.py @@ -5,13 +5,15 @@ import pathlib from typing import Any, Mapping, TypeVar, cast from datetime import date, datetime -from typing_extensions import Literal, get_args, override, get_type_hints +from typing_extensions import Literal, get_args, override, get_type_hints as _get_type_hints import anyio import pydantic from ._utils import ( is_list, + is_given, + lru_cache, is_mapping, is_iterable, ) @@ -108,6 +110,7 @@ class Params(TypedDict, total=False): return cast(_T, transformed) +@lru_cache(maxsize=8096) def _get_annotated_type(type_: type) -> type | None: """If the given type is an `Annotated` type then it is returned, if not `None` is returned. @@ -126,7 +129,7 @@ def _get_annotated_type(type_: type) -> type | None: def _maybe_transform_key(key: str, type_: type) -> str: """Transform the given `data` based on the annotations provided in `type_`. - Note: this function only looks at `Annotated` types that contain `PropertInfo` metadata. + Note: this function only looks at `Annotated` types that contain `PropertyInfo` metadata. """ annotated_type = _get_annotated_type(type_) if annotated_type is None: @@ -142,6 +145,10 @@ def _maybe_transform_key(key: str, type_: type) -> str: return key +def _no_transform_needed(annotation: type) -> bool: + return annotation == float or annotation == int + + def _transform_recursive( data: object, *, @@ -184,6 +191,15 @@ def _transform_recursive( return cast(object, data) inner_type = extract_type_arg(stripped_type, 0) + if _no_transform_needed(inner_type): + # for some types there is no need to transform anything, so we can get a small + # perf boost from skipping that work. + # + # but we still need to convert to a list to ensure the data is json-serializable + if is_list(data): + return data + return list(data) + return [_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data] if is_union_type(stripped_type): @@ -245,6 +261,11 @@ def _transform_typeddict( result: dict[str, object] = {} annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): + if not is_given(value): + # we don't need to include `NotGiven` values here as they'll + # be stripped out before the request is sent anyway + continue + type_ = annotations.get(key) if type_ is None: # we do not have a type annotation for this field, leave it as is @@ -332,6 +353,15 @@ async def _async_transform_recursive( return cast(object, data) inner_type = extract_type_arg(stripped_type, 0) + if _no_transform_needed(inner_type): + # for some types there is no need to transform anything, so we can get a small + # perf boost from skipping that work. + # + # but we still need to convert to a list to ensure the data is json-serializable + if is_list(data): + return data + return list(data) + return [await _async_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data] if is_union_type(stripped_type): @@ -393,6 +423,11 @@ async def _async_transform_typeddict( result: dict[str, object] = {} annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): + if not is_given(value): + # we don't need to include `NotGiven` values here as they'll + # be stripped out before the request is sent anyway + continue + type_ = annotations.get(key) if type_ is None: # we do not have a type annotation for this field, leave it as is @@ -400,3 +435,13 @@ async def _async_transform_typeddict( else: result[_maybe_transform_key(key, type_)] = await _async_transform_recursive(value, annotation=type_) return result + + +@lru_cache(maxsize=8096) +def get_type_hints( + obj: Any, + globalns: dict[str, Any] | None = None, + localns: Mapping[str, Any] | None = None, + include_extras: bool = False, +) -> dict[str, Any]: + return _get_type_hints(obj, globalns=globalns, localns=localns, include_extras=include_extras) diff --git a/src/gitpod/_utils/_typing.py b/src/gitpod/_utils/_typing.py index 278749b..1bac954 100644 --- a/src/gitpod/_utils/_typing.py +++ b/src/gitpod/_utils/_typing.py @@ -13,6 +13,7 @@ get_origin, ) +from ._utils import lru_cache from .._types import InheritsGeneric from .._compat import is_union as _is_union @@ -66,6 +67,7 @@ def is_type_alias_type(tp: Any, /) -> TypeIs[typing_extensions.TypeAliasType]: # Extracts T from Annotated[T, ...] or from Required[Annotated[T, ...]] +@lru_cache(maxsize=8096) def strip_annotated_type(typ: type) -> type: if is_required_type(typ) or is_annotated_type(typ): return strip_annotated_type(cast(type, get_args(typ)[0])) @@ -108,7 +110,7 @@ class MyResponse(Foo[_T]): ``` """ cls = cast(object, get_origin(typ) or typ) - if cls in generic_bases: + if cls in generic_bases: # pyright: ignore[reportUnnecessaryContains] # we're given the class directly return extract_type_arg(typ, index) diff --git a/src/gitpod/_utils/_utils.py b/src/gitpod/_utils/_utils.py index e5811bb..ea3cf3f 100644 --- a/src/gitpod/_utils/_utils.py +++ b/src/gitpod/_utils/_utils.py @@ -72,8 +72,16 @@ def _extract_items( from .._files import assert_is_file_content # We have exhausted the path, return the entry we found. - assert_is_file_content(obj, key=flattened_key) assert flattened_key is not None + + if is_list(obj): + files: list[tuple[str, FileTypes]] = [] + for entry in obj: + assert_is_file_content(entry, key=flattened_key + "[]" if flattened_key else "") + files.append((flattened_key + "[]", cast(FileTypes, entry))) + return files + + assert_is_file_content(obj, key=flattened_key) return [(flattened_key, cast(FileTypes, obj))] index += 1 diff --git a/src/gitpod/_version.py b/src/gitpod/_version.py index c48ae7a..1bd510f 100644 --- a/src/gitpod/_version.py +++ b/src/gitpod/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "gitpod" -__version__ = "0.2.1" # x-release-please-version +__version__ = "0.3.0" # x-release-please-version diff --git a/src/gitpod/pagination.py b/src/gitpod/pagination.py index a8e74f8..647ccd9 100644 --- a/src/gitpod/pagination.py +++ b/src/gitpod/pagination.py @@ -24,6 +24,9 @@ "EnvironmentsPagePagination", "SyncEnvironmentsPage", "AsyncEnvironmentsPage", + "GatewaysPagePagination", + "SyncGatewaysPage", + "AsyncGatewaysPage", "GroupsPagePagination", "SyncGroupsPage", "AsyncGroupsPage", @@ -36,9 +39,6 @@ "MembersPagePagination", "SyncMembersPage", "AsyncMembersPage", - "OrganizationsPagePagination", - "SyncOrganizationsPage", - "AsyncOrganizationsPage", "PersonalAccessTokensPagePagination", "SyncPersonalAccessTokensPage", "AsyncPersonalAccessTokensPage", @@ -48,6 +48,9 @@ "ProjectsPagePagination", "SyncProjectsPage", "AsyncProjectsPage", + "RecordsPagePagination", + "SyncRecordsPage", + "AsyncRecordsPage", "RunnersPagePagination", "SyncRunnersPage", "AsyncRunnersPage", @@ -324,6 +327,56 @@ def next_page_info(self) -> Optional[PageInfo]: return PageInfo(params={"token": next_token}) +class GatewaysPagePagination(BaseModel): + next_token: Optional[str] = FieldInfo(alias="nextToken", default=None) + + +class SyncGatewaysPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + gateways: List[_T] + pagination: Optional[GatewaysPagePagination] = None + + @override + def _get_page_items(self) -> List[_T]: + gateways = self.gateways + if not gateways: + return [] + return gateways + + @override + def next_page_info(self) -> Optional[PageInfo]: + next_token = None + if self.pagination is not None: + if self.pagination.next_token is not None: + next_token = self.pagination.next_token + if not next_token: + return None + + return PageInfo(params={"token": next_token}) + + +class AsyncGatewaysPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + gateways: List[_T] + pagination: Optional[GatewaysPagePagination] = None + + @override + def _get_page_items(self) -> List[_T]: + gateways = self.gateways + if not gateways: + return [] + return gateways + + @override + def next_page_info(self) -> Optional[PageInfo]: + next_token = None + if self.pagination is not None: + if self.pagination.next_token is not None: + next_token = self.pagination.next_token + if not next_token: + return None + + return PageInfo(params={"token": next_token}) + + class GroupsPagePagination(BaseModel): next_token: Optional[str] = FieldInfo(alias="nextToken", default=None) @@ -524,56 +577,6 @@ def next_page_info(self) -> Optional[PageInfo]: return PageInfo(params={"token": next_token}) -class OrganizationsPagePagination(BaseModel): - next_token: Optional[str] = FieldInfo(alias="nextToken", default=None) - - -class SyncOrganizationsPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]): - organizations: List[_T] - pagination: Optional[OrganizationsPagePagination] = None - - @override - def _get_page_items(self) -> List[_T]: - organizations = self.organizations - if not organizations: - return [] - return organizations - - @override - def next_page_info(self) -> Optional[PageInfo]: - next_token = None - if self.pagination is not None: - if self.pagination.next_token is not None: - next_token = self.pagination.next_token - if not next_token: - return None - - return PageInfo(params={"token": next_token}) - - -class AsyncOrganizationsPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): - organizations: List[_T] - pagination: Optional[OrganizationsPagePagination] = None - - @override - def _get_page_items(self) -> List[_T]: - organizations = self.organizations - if not organizations: - return [] - return organizations - - @override - def next_page_info(self) -> Optional[PageInfo]: - next_token = None - if self.pagination is not None: - if self.pagination.next_token is not None: - next_token = self.pagination.next_token - if not next_token: - return None - - return PageInfo(params={"token": next_token}) - - class PersonalAccessTokensPagePagination(BaseModel): next_token: Optional[str] = FieldInfo(alias="nextToken", default=None) @@ -724,6 +727,56 @@ def next_page_info(self) -> Optional[PageInfo]: return PageInfo(params={"token": next_token}) +class RecordsPagePagination(BaseModel): + next_token: Optional[str] = FieldInfo(alias="nextToken", default=None) + + +class SyncRecordsPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + pagination: Optional[RecordsPagePagination] = None + records: List[_T] + + @override + def _get_page_items(self) -> List[_T]: + records = self.records + if not records: + return [] + return records + + @override + def next_page_info(self) -> Optional[PageInfo]: + next_token = None + if self.pagination is not None: + if self.pagination.next_token is not None: + next_token = self.pagination.next_token + if not next_token: + return None + + return PageInfo(params={"token": next_token}) + + +class AsyncRecordsPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + pagination: Optional[RecordsPagePagination] = None + records: List[_T] + + @override + def _get_page_items(self) -> List[_T]: + records = self.records + if not records: + return [] + return records + + @override + def next_page_info(self) -> Optional[PageInfo]: + next_token = None + if self.pagination is not None: + if self.pagination.next_token is not None: + next_token = self.pagination.next_token + if not next_token: + return None + + return PageInfo(params={"token": next_token}) + + class RunnersPagePagination(BaseModel): next_token: Optional[str] = FieldInfo(alias="nextToken", default=None) diff --git a/src/gitpod/resources/__init__.py b/src/gitpod/resources/__init__.py index 1e169c2..fe63612 100644 --- a/src/gitpod/resources/__init__.py +++ b/src/gitpod/resources/__init__.py @@ -1,5 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .usage import ( + UsageResource, + AsyncUsageResource, + UsageResourceWithRawResponse, + AsyncUsageResourceWithRawResponse, + UsageResourceWithStreamingResponse, + AsyncUsageResourceWithStreamingResponse, +) from .users import ( UsersResource, AsyncUsersResource, @@ -56,6 +64,14 @@ AccountsResourceWithStreamingResponse, AsyncAccountsResourceWithStreamingResponse, ) +from .gateways import ( + GatewaysResource, + AsyncGatewaysResource, + GatewaysResourceWithRawResponse, + AsyncGatewaysResourceWithRawResponse, + GatewaysResourceWithStreamingResponse, + AsyncGatewaysResourceWithStreamingResponse, +) from .identity import ( IdentityResource, AsyncIdentityResource, @@ -114,6 +130,12 @@ "AsyncEventsResourceWithRawResponse", "EventsResourceWithStreamingResponse", "AsyncEventsResourceWithStreamingResponse", + "GatewaysResource", + "AsyncGatewaysResource", + "GatewaysResourceWithRawResponse", + "AsyncGatewaysResourceWithRawResponse", + "GatewaysResourceWithStreamingResponse", + "AsyncGatewaysResourceWithStreamingResponse", "GroupsResource", "AsyncGroupsResource", "GroupsResourceWithRawResponse", @@ -150,6 +172,12 @@ "AsyncSecretsResourceWithRawResponse", "SecretsResourceWithStreamingResponse", "AsyncSecretsResourceWithStreamingResponse", + "UsageResource", + "AsyncUsageResource", + "UsageResourceWithRawResponse", + "AsyncUsageResourceWithRawResponse", + "UsageResourceWithStreamingResponse", + "AsyncUsageResourceWithStreamingResponse", "UsersResource", "AsyncUsersResource", "UsersResourceWithRawResponse", diff --git a/src/gitpod/resources/accounts.py b/src/gitpod/resources/accounts.py index 7f3c4f7..e756632 100644 --- a/src/gitpod/resources/accounts.py +++ b/src/gitpod/resources/accounts.py @@ -11,12 +11,10 @@ account_retrieve_params, account_get_sso_login_url_params, account_list_login_providers_params, + account_list_joinable_organizations_params, ) from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -30,6 +28,7 @@ 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_joinable_organizations_response import AccountListJoinableOrganizationsResponse __all__ = ["AccountsResource", "AsyncAccountsResource"] @@ -221,6 +220,68 @@ def get_sso_login_url( cast_to=AccountGetSSOLoginURLResponse, ) + def list_joinable_organizations( + self, + *, + token: str | NotGiven = NOT_GIVEN, + page_size: int | NotGiven = NOT_GIVEN, + empty: 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, + ) -> AccountListJoinableOrganizationsResponse: + """ + Lists organizations that the currently authenticated account can join. + + Use this method to: + + - Discover organizations associated with the account's email domain. + - Allow users to join existing organizations. + - Display potential organizations during onboarding. + + ### Examples + + - List joinable organizations: + + Retrieves a list of organizations the account can join. + + ```yaml + {} + ``` + + 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 + """ + return self._post( + "/gitpod.v1.AccountService/ListJoinableOrganizations", + body=maybe_transform( + {"empty": empty}, account_list_joinable_organizations_params.AccountListJoinableOrganizationsParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "token": token, + "page_size": page_size, + }, + account_list_joinable_organizations_params.AccountListJoinableOrganizationsParams, + ), + ), + cast_to=AccountListJoinableOrganizationsResponse, + ) + def list_login_providers( self, *, @@ -494,6 +555,68 @@ async def get_sso_login_url( cast_to=AccountGetSSOLoginURLResponse, ) + async def list_joinable_organizations( + self, + *, + token: str | NotGiven = NOT_GIVEN, + page_size: int | NotGiven = NOT_GIVEN, + empty: 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, + ) -> AccountListJoinableOrganizationsResponse: + """ + Lists organizations that the currently authenticated account can join. + + Use this method to: + + - Discover organizations associated with the account's email domain. + - Allow users to join existing organizations. + - Display potential organizations during onboarding. + + ### Examples + + - List joinable organizations: + + Retrieves a list of organizations the account can join. + + ```yaml + {} + ``` + + 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 + """ + return await self._post( + "/gitpod.v1.AccountService/ListJoinableOrganizations", + body=await async_maybe_transform( + {"empty": empty}, account_list_joinable_organizations_params.AccountListJoinableOrganizationsParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "token": token, + "page_size": page_size, + }, + account_list_joinable_organizations_params.AccountListJoinableOrganizationsParams, + ), + ), + cast_to=AccountListJoinableOrganizationsResponse, + ) + def list_login_providers( self, *, @@ -593,6 +716,9 @@ def __init__(self, accounts: AccountsResource) -> None: self.get_sso_login_url = to_raw_response_wrapper( accounts.get_sso_login_url, ) + self.list_joinable_organizations = to_raw_response_wrapper( + accounts.list_joinable_organizations, + ) self.list_login_providers = to_raw_response_wrapper( accounts.list_login_providers, ) @@ -611,6 +737,9 @@ def __init__(self, accounts: AsyncAccountsResource) -> None: self.get_sso_login_url = async_to_raw_response_wrapper( accounts.get_sso_login_url, ) + self.list_joinable_organizations = async_to_raw_response_wrapper( + accounts.list_joinable_organizations, + ) self.list_login_providers = async_to_raw_response_wrapper( accounts.list_login_providers, ) @@ -629,6 +758,9 @@ def __init__(self, accounts: AccountsResource) -> None: self.get_sso_login_url = to_streamed_response_wrapper( accounts.get_sso_login_url, ) + self.list_joinable_organizations = to_streamed_response_wrapper( + accounts.list_joinable_organizations, + ) self.list_login_providers = to_streamed_response_wrapper( accounts.list_login_providers, ) @@ -647,6 +779,9 @@ def __init__(self, accounts: AsyncAccountsResource) -> None: self.get_sso_login_url = async_to_streamed_response_wrapper( accounts.get_sso_login_url, ) + self.list_joinable_organizations = async_to_streamed_response_wrapper( + accounts.list_joinable_organizations, + ) self.list_login_providers = async_to_streamed_response_wrapper( accounts.list_login_providers, ) diff --git a/src/gitpod/resources/editors.py b/src/gitpod/resources/editors.py index 3ea08ba..3c3075f 100644 --- a/src/gitpod/resources/editors.py +++ b/src/gitpod/resources/editors.py @@ -6,10 +6,7 @@ from ..types import editor_list_params, editor_retrieve_params, editor_resolve_url_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -101,6 +98,7 @@ def list( *, token: str | NotGiven = NOT_GIVEN, page_size: int | NotGiven = NOT_GIVEN, + filter: editor_list_params.Filter | NotGiven = NOT_GIVEN, pagination: editor_list_params.Pagination | 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. @@ -110,7 +108,8 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncEditorsPage[Editor]: """ - Lists all available code editors. + Lists all available code editors, optionally filtered to those allowed in an + organization. Use this method to: @@ -130,7 +129,21 @@ def list( pageSize: 20 ``` + - List editors available to the organization: + + Shows all available editors that are allowed by the policies enforced in the + organization with pagination. + + ```yaml + pagination: + pageSize: 20 + filter: + allowedByPolicy: true + ``` + Args: + filter: filter contains the filter options for listing editors + pagination: pagination contains the pagination options for listing environments extra_headers: Send extra headers @@ -144,7 +157,13 @@ def list( return self._get_api_list( "/gitpod.v1.EditorService/ListEditors", page=SyncEditorsPage[Editor], - body=maybe_transform({"pagination": pagination}, editor_list_params.EditorListParams), + body=maybe_transform( + { + "filter": filter, + "pagination": pagination, + }, + editor_list_params.EditorListParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -303,6 +322,7 @@ def list( *, token: str | NotGiven = NOT_GIVEN, page_size: int | NotGiven = NOT_GIVEN, + filter: editor_list_params.Filter | NotGiven = NOT_GIVEN, pagination: editor_list_params.Pagination | 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. @@ -312,7 +332,8 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[Editor, AsyncEditorsPage[Editor]]: """ - Lists all available code editors. + Lists all available code editors, optionally filtered to those allowed in an + organization. Use this method to: @@ -332,7 +353,21 @@ def list( pageSize: 20 ``` + - List editors available to the organization: + + Shows all available editors that are allowed by the policies enforced in the + organization with pagination. + + ```yaml + pagination: + pageSize: 20 + filter: + allowedByPolicy: true + ``` + Args: + filter: filter contains the filter options for listing editors + pagination: pagination contains the pagination options for listing environments extra_headers: Send extra headers @@ -346,7 +381,13 @@ def list( return self._get_api_list( "/gitpod.v1.EditorService/ListEditors", page=AsyncEditorsPage[Editor], - body=maybe_transform({"pagination": pagination}, editor_list_params.EditorListParams), + body=maybe_transform( + { + "filter": filter, + "pagination": pagination, + }, + editor_list_params.EditorListParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gitpod/resources/environments/automations/automations.py b/src/gitpod/resources/environments/automations/automations.py index d7816c3..9eda852 100644 --- a/src/gitpod/resources/environments/automations/automations.py +++ b/src/gitpod/resources/environments/automations/automations.py @@ -13,10 +13,7 @@ AsyncServicesResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from .tasks.tasks import ( TasksResource, diff --git a/src/gitpod/resources/environments/automations/services.py b/src/gitpod/resources/environments/automations/services.py index c48e96c..0083cfb 100644 --- a/src/gitpod/resources/environments/automations/services.py +++ b/src/gitpod/resources/environments/automations/services.py @@ -5,10 +5,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( diff --git a/src/gitpod/resources/environments/automations/tasks/executions.py b/src/gitpod/resources/environments/automations/tasks/executions.py index 62181fe..3fff111 100644 --- a/src/gitpod/resources/environments/automations/tasks/executions.py +++ b/src/gitpod/resources/environments/automations/tasks/executions.py @@ -5,10 +5,7 @@ import httpx from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ....._utils import ( - maybe_transform, - async_maybe_transform, -) +from ....._utils import maybe_transform, async_maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource from ....._response import ( diff --git a/src/gitpod/resources/environments/automations/tasks/tasks.py b/src/gitpod/resources/environments/automations/tasks/tasks.py index 782b917..b8a1b22 100644 --- a/src/gitpod/resources/environments/automations/tasks/tasks.py +++ b/src/gitpod/resources/environments/automations/tasks/tasks.py @@ -7,10 +7,7 @@ import httpx from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ....._utils import ( - maybe_transform, - async_maybe_transform, -) +from ....._utils import maybe_transform, async_maybe_transform from .executions import ( ExecutionsResource, AsyncExecutionsResource, diff --git a/src/gitpod/resources/environments/environments.py b/src/gitpod/resources/environments/environments.py index c5e250f..e57316b 100644 --- a/src/gitpod/resources/environments/environments.py +++ b/src/gitpod/resources/environments/environments.py @@ -14,9 +14,11 @@ environment_delete_params, environment_update_params, environment_retrieve_params, + environment_unarchive_params, environment_mark_active_params, environment_create_logs_token_params, environment_create_from_project_params, + environment_create_environment_token_params, ) from .classes import ( ClassesResource, @@ -27,10 +29,7 @@ AsyncClassesResourceWithStreamingResponse, ) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -56,6 +55,7 @@ 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 +from ...types.environment_create_environment_token_response import EnvironmentCreateEnvironmentTokenResponse __all__ = ["EnvironmentsResource", "AsyncEnvironmentsResource"] @@ -164,8 +164,8 @@ def create( ``` Args: - spec: EnvironmentSpec specifies the configuration of an environment for an environment - start + spec: spec is the configuration of the environment that's required for the to start + the environment extra_headers: Send extra headers @@ -243,7 +243,7 @@ def update( self, *, environment_id: str | NotGiven = NOT_GIVEN, - metadata: Optional[object] | NotGiven = NOT_GIVEN, + metadata: Optional[environment_update_params.Metadata] | NotGiven = NOT_GIVEN, spec: Optional[environment_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. @@ -495,6 +495,57 @@ def delete( cast_to=object, ) + def create_environment_token( + self, + *, + environment_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, + ) -> EnvironmentCreateEnvironmentTokenResponse: + """ + Creates an access token for the environment. + + Generated tokens are valid for one hour and provide environment-specific access + permissions. The token is scoped to a specific environment. + + ### Examples + + - Generate environment token: + + Creates a temporary access token for accessing an environment. + + ```yaml + environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" + ``` + + Args: + environment_id: environment_id specifies the environment for which the access token should be + created. + + 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 + """ + return self._post( + "/gitpod.v1.EnvironmentService/CreateEnvironmentAccessToken", + body=maybe_transform( + {"environment_id": environment_id}, + environment_create_environment_token_params.EnvironmentCreateEnvironmentTokenParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=EnvironmentCreateEnvironmentTokenResponse, + ) + def create_from_project( self, *, @@ -540,8 +591,9 @@ def create_from_project( ``` Args: - spec: EnvironmentSpec specifies the configuration of an environment for an environment - start + spec: Spec is the configuration of the environment that's required for the runner to + start the environment Configuration already defined in the Project will override + parts of the spec, if set extra_headers: Send extra headers @@ -651,7 +703,7 @@ def mark_active( ``` Args: - activity_signal: EnvironmentActivitySignal used to signal activity for an environment. + activity_signal: activity_signal specifies the activity. environment_id: The ID of the environment to update activity for. @@ -775,6 +827,52 @@ def stop( cast_to=object, ) + def unarchive( + self, + *, + 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> object: + """ + Unarchives an environment. + + ### Examples + + - Unarchive an environment: + + ```yaml + environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" + ``` + + Args: + environment_id: environment_id specifies the environment to unarchive. + + +required + + 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 + """ + return self._post( + "/gitpod.v1.EnvironmentService/UnarchiveEnvironment", + body=maybe_transform( + {"environment_id": environment_id}, environment_unarchive_params.EnvironmentUnarchiveParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + class AsyncEnvironmentsResource(AsyncAPIResource): @cached_property @@ -880,8 +978,8 @@ async def create( ``` Args: - spec: EnvironmentSpec specifies the configuration of an environment for an environment - start + spec: spec is the configuration of the environment that's required for the to start + the environment extra_headers: Send extra headers @@ -959,7 +1057,7 @@ async def update( self, *, environment_id: str | NotGiven = NOT_GIVEN, - metadata: Optional[object] | NotGiven = NOT_GIVEN, + metadata: Optional[environment_update_params.Metadata] | NotGiven = NOT_GIVEN, spec: Optional[environment_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. @@ -1211,6 +1309,57 @@ async def delete( cast_to=object, ) + async def create_environment_token( + self, + *, + environment_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, + ) -> EnvironmentCreateEnvironmentTokenResponse: + """ + Creates an access token for the environment. + + Generated tokens are valid for one hour and provide environment-specific access + permissions. The token is scoped to a specific environment. + + ### Examples + + - Generate environment token: + + Creates a temporary access token for accessing an environment. + + ```yaml + environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" + ``` + + Args: + environment_id: environment_id specifies the environment for which the access token should be + created. + + 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 + """ + return await self._post( + "/gitpod.v1.EnvironmentService/CreateEnvironmentAccessToken", + body=await async_maybe_transform( + {"environment_id": environment_id}, + environment_create_environment_token_params.EnvironmentCreateEnvironmentTokenParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=EnvironmentCreateEnvironmentTokenResponse, + ) + async def create_from_project( self, *, @@ -1256,8 +1405,9 @@ async def create_from_project( ``` Args: - spec: EnvironmentSpec specifies the configuration of an environment for an environment - start + spec: Spec is the configuration of the environment that's required for the runner to + start the environment Configuration already defined in the Project will override + parts of the spec, if set extra_headers: Send extra headers @@ -1367,7 +1517,7 @@ async def mark_active( ``` Args: - activity_signal: EnvironmentActivitySignal used to signal activity for an environment. + activity_signal: activity_signal specifies the activity. environment_id: The ID of the environment to update activity for. @@ -1495,6 +1645,52 @@ async def stop( cast_to=object, ) + async def unarchive( + self, + *, + 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> object: + """ + Unarchives an environment. + + ### Examples + + - Unarchive an environment: + + ```yaml + environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" + ``` + + Args: + environment_id: environment_id specifies the environment to unarchive. + + +required + + 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 + """ + return await self._post( + "/gitpod.v1.EnvironmentService/UnarchiveEnvironment", + body=await async_maybe_transform( + {"environment_id": environment_id}, environment_unarchive_params.EnvironmentUnarchiveParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + class EnvironmentsResourceWithRawResponse: def __init__(self, environments: EnvironmentsResource) -> None: @@ -1515,6 +1711,9 @@ def __init__(self, environments: EnvironmentsResource) -> None: self.delete = to_raw_response_wrapper( environments.delete, ) + self.create_environment_token = to_raw_response_wrapper( + environments.create_environment_token, + ) self.create_from_project = to_raw_response_wrapper( environments.create_from_project, ) @@ -1530,6 +1729,9 @@ def __init__(self, environments: EnvironmentsResource) -> None: self.stop = to_raw_response_wrapper( environments.stop, ) + self.unarchive = to_raw_response_wrapper( + environments.unarchive, + ) @cached_property def automations(self) -> AutomationsResourceWithRawResponse: @@ -1559,6 +1761,9 @@ def __init__(self, environments: AsyncEnvironmentsResource) -> None: self.delete = async_to_raw_response_wrapper( environments.delete, ) + self.create_environment_token = async_to_raw_response_wrapper( + environments.create_environment_token, + ) self.create_from_project = async_to_raw_response_wrapper( environments.create_from_project, ) @@ -1574,6 +1779,9 @@ def __init__(self, environments: AsyncEnvironmentsResource) -> None: self.stop = async_to_raw_response_wrapper( environments.stop, ) + self.unarchive = async_to_raw_response_wrapper( + environments.unarchive, + ) @cached_property def automations(self) -> AsyncAutomationsResourceWithRawResponse: @@ -1603,6 +1811,9 @@ def __init__(self, environments: EnvironmentsResource) -> None: self.delete = to_streamed_response_wrapper( environments.delete, ) + self.create_environment_token = to_streamed_response_wrapper( + environments.create_environment_token, + ) self.create_from_project = to_streamed_response_wrapper( environments.create_from_project, ) @@ -1618,6 +1829,9 @@ def __init__(self, environments: EnvironmentsResource) -> None: self.stop = to_streamed_response_wrapper( environments.stop, ) + self.unarchive = to_streamed_response_wrapper( + environments.unarchive, + ) @cached_property def automations(self) -> AutomationsResourceWithStreamingResponse: @@ -1647,6 +1861,9 @@ def __init__(self, environments: AsyncEnvironmentsResource) -> None: self.delete = async_to_streamed_response_wrapper( environments.delete, ) + self.create_environment_token = async_to_streamed_response_wrapper( + environments.create_environment_token, + ) self.create_from_project = async_to_streamed_response_wrapper( environments.create_from_project, ) @@ -1662,6 +1879,9 @@ def __init__(self, environments: AsyncEnvironmentsResource) -> None: self.stop = async_to_streamed_response_wrapper( environments.stop, ) + self.unarchive = async_to_streamed_response_wrapper( + environments.unarchive, + ) @cached_property def automations(self) -> AsyncAutomationsResourceWithStreamingResponse: diff --git a/src/gitpod/resources/events.py b/src/gitpod/resources/events.py index 8a7ebdd..b28929f 100644 --- a/src/gitpod/resources/events.py +++ b/src/gitpod/resources/events.py @@ -6,10 +6,7 @@ from ..types import event_list_params, event_watch_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -62,8 +59,32 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncEntriesPage[EventListResponse]: """ - ListAuditLogs retrieves a paginated list of audit logs for the specified - organization + Lists audit logs with filtering and pagination options. + + Use this method to: + + - View audit history + - Track user actions + - Monitor system changes + + ### Examples + + - List all logs: + + ```yaml + pagination: + pageSize: 20 + ``` + + - Filter by actor: + + ```yaml + filter: + actorIds: ["d2c94c27-3b76-4a42-b88c-95a85e392c68"] + actorPrincipals: ["PRINCIPAL_USER"] + pagination: + pageSize: 20 + ``` Args: pagination: pagination contains the pagination options for listing environments @@ -116,7 +137,23 @@ def watch( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> JSONLDecoder[EventWatchResponse]: """ - WatchEvents streams all requests events to the client + Streams events for all projects, runners, environments, tasks, and services + based on the specified scope. + + Use this method to: + + - Monitor resource changes in real-time + - Track system events + - Receive notifications + + The scope parameter determines which events to watch: + + - Organization scope (default): Watch all organization-wide events including + projects, runners and environments. Task and service events are not included. + Use by setting organization=true or omitting the scope. + - Environment scope: Watch events for a specific environment, including its + tasks, task executions, and services. Use by setting environment_id to the + UUID of the environment to watch. Args: environment_id: Environment scope produces events for the environment itself, all tasks, task @@ -187,8 +224,32 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[EventListResponse, AsyncEntriesPage[EventListResponse]]: """ - ListAuditLogs retrieves a paginated list of audit logs for the specified - organization + Lists audit logs with filtering and pagination options. + + Use this method to: + + - View audit history + - Track user actions + - Monitor system changes + + ### Examples + + - List all logs: + + ```yaml + pagination: + pageSize: 20 + ``` + + - Filter by actor: + + ```yaml + filter: + actorIds: ["d2c94c27-3b76-4a42-b88c-95a85e392c68"] + actorPrincipals: ["PRINCIPAL_USER"] + pagination: + pageSize: 20 + ``` Args: pagination: pagination contains the pagination options for listing environments @@ -241,7 +302,23 @@ async def watch( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncJSONLDecoder[EventWatchResponse]: """ - WatchEvents streams all requests events to the client + Streams events for all projects, runners, environments, tasks, and services + based on the specified scope. + + Use this method to: + + - Monitor resource changes in real-time + - Track system events + - Receive notifications + + The scope parameter determines which events to watch: + + - Organization scope (default): Watch all organization-wide events including + projects, runners and environments. Task and service events are not included. + Use by setting organization=true or omitting the scope. + - Environment scope: Watch events for a specific environment, including its + tasks, task executions, and services. Use by setting environment_id to the + UUID of the environment to watch. Args: environment_id: Environment scope produces events for the environment itself, all tasks, task diff --git a/src/gitpod/resources/gateways.py b/src/gitpod/resources/gateways.py new file mode 100644 index 0000000..9351d6a --- /dev/null +++ b/src/gitpod/resources/gateways.py @@ -0,0 +1,196 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..types import gateway_list_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..pagination import SyncGatewaysPage, AsyncGatewaysPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.shared.gateway import Gateway + +__all__ = ["GatewaysResource", "AsyncGatewaysResource"] + + +class GatewaysResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> GatewaysResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/gitpod-io/gitpod-sdk-python#accessing-raw-response-data-eg-headers + """ + return GatewaysResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> GatewaysResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/gitpod-io/gitpod-sdk-python#with_streaming_response + """ + return GatewaysResourceWithStreamingResponse(self) + + def list( + self, + *, + token: str | NotGiven = NOT_GIVEN, + page_size: int | NotGiven = NOT_GIVEN, + pagination: gateway_list_params.Pagination | 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, + ) -> SyncGatewaysPage[Gateway]: + """ + ListGateways + + Args: + pagination: pagination contains the pagination options for listing gateways + + 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 + """ + return self._get_api_list( + "/gitpod.v1.GatewayService/ListGateways", + page=SyncGatewaysPage[Gateway], + body=maybe_transform({"pagination": pagination}, gateway_list_params.GatewayListParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "token": token, + "page_size": page_size, + }, + gateway_list_params.GatewayListParams, + ), + ), + model=Gateway, + method="post", + ) + + +class AsyncGatewaysResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncGatewaysResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/gitpod-io/gitpod-sdk-python#accessing-raw-response-data-eg-headers + """ + return AsyncGatewaysResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncGatewaysResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/gitpod-io/gitpod-sdk-python#with_streaming_response + """ + return AsyncGatewaysResourceWithStreamingResponse(self) + + def list( + self, + *, + token: str | NotGiven = NOT_GIVEN, + page_size: int | NotGiven = NOT_GIVEN, + pagination: gateway_list_params.Pagination | 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[Gateway, AsyncGatewaysPage[Gateway]]: + """ + ListGateways + + Args: + pagination: pagination contains the pagination options for listing gateways + + 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 + """ + return self._get_api_list( + "/gitpod.v1.GatewayService/ListGateways", + page=AsyncGatewaysPage[Gateway], + body=maybe_transform({"pagination": pagination}, gateway_list_params.GatewayListParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "token": token, + "page_size": page_size, + }, + gateway_list_params.GatewayListParams, + ), + ), + model=Gateway, + method="post", + ) + + +class GatewaysResourceWithRawResponse: + def __init__(self, gateways: GatewaysResource) -> None: + self._gateways = gateways + + self.list = to_raw_response_wrapper( + gateways.list, + ) + + +class AsyncGatewaysResourceWithRawResponse: + def __init__(self, gateways: AsyncGatewaysResource) -> None: + self._gateways = gateways + + self.list = async_to_raw_response_wrapper( + gateways.list, + ) + + +class GatewaysResourceWithStreamingResponse: + def __init__(self, gateways: GatewaysResource) -> None: + self._gateways = gateways + + self.list = to_streamed_response_wrapper( + gateways.list, + ) + + +class AsyncGatewaysResourceWithStreamingResponse: + def __init__(self, gateways: AsyncGatewaysResource) -> None: + self._gateways = gateways + + self.list = async_to_streamed_response_wrapper( + gateways.list, + ) diff --git a/src/gitpod/resources/groups.py b/src/gitpod/resources/groups.py index 233e4b0..56c681f 100644 --- a/src/gitpod/resources/groups.py +++ b/src/gitpod/resources/groups.py @@ -56,7 +56,35 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncGroupsPage[Group]: """ - ListGroups lists groups + Lists groups with optional pagination. + + Use this method to: + + - View all groups + - Check group memberships + - Monitor group configurations + - Audit group access + + ### Examples + + - List all groups: + + Shows all groups with pagination. + + ```yaml + pagination: + pageSize: 20 + ``` + + - List with custom page size: + + Shows groups with specified page size. + + ```yaml + pagination: + pageSize: 50 + token: "next-page-token-from-previous-response" + ``` Args: pagination: pagination contains the pagination options for listing groups @@ -125,7 +153,35 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[Group, AsyncGroupsPage[Group]]: """ - ListGroups lists groups + Lists groups with optional pagination. + + Use this method to: + + - View all groups + - Check group memberships + - Monitor group configurations + - Audit group access + + ### Examples + + - List all groups: + + Shows all groups with pagination. + + ```yaml + pagination: + pageSize: 20 + ``` + + - List with custom page size: + + Shows groups with specified page size. + + ```yaml + pagination: + pageSize: 50 + token: "next-page-token-from-previous-response" + ``` Args: pagination: pagination contains the pagination options for listing groups diff --git a/src/gitpod/resources/identity.py b/src/gitpod/resources/identity.py index 736e308..25b859b 100644 --- a/src/gitpod/resources/identity.py +++ b/src/gitpod/resources/identity.py @@ -7,15 +7,13 @@ import httpx from ..types import ( + IDTokenVersion, identity_get_id_token_params, identity_exchange_token_params, identity_get_authenticated_identity_params, ) from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -25,6 +23,7 @@ async_to_streamed_response_wrapper, ) from .._base_client import make_request_options +from ..types.id_token_version import IDTokenVersion from ..types.identity_get_id_token_response import IdentityGetIDTokenResponse from ..types.identity_exchange_token_response import IdentityExchangeTokenResponse from ..types.identity_get_authenticated_identity_response import IdentityGetAuthenticatedIdentityResponse @@ -159,6 +158,7 @@ def get_id_token( self, *, audience: List[str] | NotGiven = NOT_GIVEN, + version: IDTokenVersion | 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,6 +197,8 @@ def get_id_token( ``` Args: + version: version is the version of the ID token. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -207,7 +209,13 @@ def get_id_token( """ return self._post( "/gitpod.v1.IdentityService/GetIDToken", - body=maybe_transform({"audience": audience}, identity_get_id_token_params.IdentityGetIDTokenParams), + body=maybe_transform( + { + "audience": audience, + "version": version, + }, + identity_get_id_token_params.IdentityGetIDTokenParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -342,6 +350,7 @@ async def get_id_token( self, *, audience: List[str] | NotGiven = NOT_GIVEN, + version: IDTokenVersion | 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, @@ -380,6 +389,8 @@ async def get_id_token( ``` Args: + version: version is the version of the ID token. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -391,7 +402,11 @@ async def get_id_token( return await self._post( "/gitpod.v1.IdentityService/GetIDToken", body=await async_maybe_transform( - {"audience": audience}, identity_get_id_token_params.IdentityGetIDTokenParams + { + "audience": audience, + "version": version, + }, + identity_get_id_token_params.IdentityGetIDTokenParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gitpod/resources/organizations/__init__.py b/src/gitpod/resources/organizations/__init__.py index 3b7cf4e..28e5eed 100644 --- a/src/gitpod/resources/organizations/__init__.py +++ b/src/gitpod/resources/organizations/__init__.py @@ -8,6 +8,14 @@ InvitesResourceWithStreamingResponse, AsyncInvitesResourceWithStreamingResponse, ) +from .policies import ( + PoliciesResource, + AsyncPoliciesResource, + PoliciesResourceWithRawResponse, + AsyncPoliciesResourceWithRawResponse, + PoliciesResourceWithStreamingResponse, + AsyncPoliciesResourceWithStreamingResponse, +) from .organizations import ( OrganizationsResource, AsyncOrganizationsResource, @@ -46,6 +54,12 @@ "AsyncInvitesResourceWithRawResponse", "InvitesResourceWithStreamingResponse", "AsyncInvitesResourceWithStreamingResponse", + "PoliciesResource", + "AsyncPoliciesResource", + "PoliciesResourceWithRawResponse", + "AsyncPoliciesResourceWithRawResponse", + "PoliciesResourceWithStreamingResponse", + "AsyncPoliciesResourceWithStreamingResponse", "SSOConfigurationsResource", "AsyncSSOConfigurationsResource", "SSOConfigurationsResourceWithRawResponse", diff --git a/src/gitpod/resources/organizations/domain_verifications.py b/src/gitpod/resources/organizations/domain_verifications.py index 8661f18..5468ac8 100644 --- a/src/gitpod/resources/organizations/domain_verifications.py +++ b/src/gitpod/resources/organizations/domain_verifications.py @@ -5,10 +5,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( diff --git a/src/gitpod/resources/organizations/invites.py b/src/gitpod/resources/organizations/invites.py index ac39a54..8ed2e02 100644 --- a/src/gitpod/resources/organizations/invites.py +++ b/src/gitpod/resources/organizations/invites.py @@ -5,10 +5,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( diff --git a/src/gitpod/resources/organizations/organizations.py b/src/gitpod/resources/organizations/organizations.py index f5fea4a..0e989d8 100644 --- a/src/gitpod/resources/organizations/organizations.py +++ b/src/gitpod/resources/organizations/organizations.py @@ -7,9 +7,7 @@ import httpx from ...types import ( - Scope, organization_join_params, - organization_list_params, organization_leave_params, organization_create_params, organization_delete_params, @@ -27,9 +25,14 @@ AsyncInvitesResourceWithStreamingResponse, ) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, +from ..._utils import maybe_transform, async_maybe_transform +from .policies import ( + PoliciesResource, + AsyncPoliciesResource, + PoliciesResourceWithRawResponse, + AsyncPoliciesResourceWithRawResponse, + PoliciesResourceWithStreamingResponse, + AsyncPoliciesResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -39,8 +42,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...pagination import SyncMembersPage, AsyncMembersPage, SyncOrganizationsPage, AsyncOrganizationsPage -from ...types.scope import Scope +from ...pagination import SyncMembersPage, AsyncMembersPage from ..._base_client import AsyncPaginator, make_request_options from .sso_configurations import ( SSOConfigurationsResource, @@ -50,7 +52,6 @@ SSOConfigurationsResourceWithStreamingResponse, AsyncSSOConfigurationsResourceWithStreamingResponse, ) -from ...types.organization import Organization from .domain_verifications import ( DomainVerificationsResource, AsyncDomainVerificationsResource, @@ -79,6 +80,10 @@ def domain_verifications(self) -> DomainVerificationsResource: def invites(self) -> InvitesResource: return InvitesResource(self._client) + @cached_property + def policies(self) -> PoliciesResource: + return PoliciesResource(self._client) + @cached_property def sso_configurations(self) -> SSOConfigurationsResource: return SSOConfigurationsResource(self._client) @@ -311,91 +316,6 @@ def update( cast_to=OrganizationUpdateResponse, ) - def list( - self, - *, - token: str | NotGiven = NOT_GIVEN, - page_size: int | NotGiven = NOT_GIVEN, - pagination: organization_list_params.Pagination | 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[Organization]: - """ - Lists all organizations the caller has access to with optional filtering. - - Use this method to: - - - View organizations you're a member of - - Browse all available organizations - - Paginate through organization results - - ### Examples - - - List member organizations: - - Shows organizations where the caller is a member. - - ```yaml - pagination: - pageSize: 20 - scope: SCOPE_MEMBER - ``` - - - List all organizations: - - Shows all organizations visible to the caller. - - ```yaml - pagination: - pageSize: 50 - scope: SCOPE_ALL - ``` - - Args: - pagination: pagination contains the pagination options for listing organizations - - scope: scope is the scope of the organizations to list - - 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 - """ - return self._get_api_list( - "/gitpod.v1.OrganizationService/ListOrganizations", - page=SyncOrganizationsPage[Organization], - body=maybe_transform( - { - "pagination": pagination, - "scope": scope, - }, - organization_list_params.OrganizationListParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "token": token, - "page_size": page_size, - }, - organization_list_params.OrganizationListParams, - ), - ), - model=Organization, - method="post", - ) - def delete( self, *, @@ -733,6 +653,10 @@ def domain_verifications(self) -> AsyncDomainVerificationsResource: def invites(self) -> AsyncInvitesResource: return AsyncInvitesResource(self._client) + @cached_property + def policies(self) -> AsyncPoliciesResource: + return AsyncPoliciesResource(self._client) + @cached_property def sso_configurations(self) -> AsyncSSOConfigurationsResource: return AsyncSSOConfigurationsResource(self._client) @@ -965,91 +889,6 @@ async def update( cast_to=OrganizationUpdateResponse, ) - def list( - self, - *, - token: str | NotGiven = NOT_GIVEN, - page_size: int | NotGiven = NOT_GIVEN, - pagination: organization_list_params.Pagination | 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[Organization, AsyncOrganizationsPage[Organization]]: - """ - Lists all organizations the caller has access to with optional filtering. - - Use this method to: - - - View organizations you're a member of - - Browse all available organizations - - Paginate through organization results - - ### Examples - - - List member organizations: - - Shows organizations where the caller is a member. - - ```yaml - pagination: - pageSize: 20 - scope: SCOPE_MEMBER - ``` - - - List all organizations: - - Shows all organizations visible to the caller. - - ```yaml - pagination: - pageSize: 50 - scope: SCOPE_ALL - ``` - - Args: - pagination: pagination contains the pagination options for listing organizations - - scope: scope is the scope of the organizations to list - - 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 - """ - return self._get_api_list( - "/gitpod.v1.OrganizationService/ListOrganizations", - page=AsyncOrganizationsPage[Organization], - body=maybe_transform( - { - "pagination": pagination, - "scope": scope, - }, - organization_list_params.OrganizationListParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "token": token, - "page_size": page_size, - }, - organization_list_params.OrganizationListParams, - ), - ), - model=Organization, - method="post", - ) - async def delete( self, *, @@ -1391,9 +1230,6 @@ def __init__(self, organizations: OrganizationsResource) -> None: self.update = to_raw_response_wrapper( organizations.update, ) - self.list = to_raw_response_wrapper( - organizations.list, - ) self.delete = to_raw_response_wrapper( organizations.delete, ) @@ -1418,6 +1254,10 @@ def domain_verifications(self) -> DomainVerificationsResourceWithRawResponse: def invites(self) -> InvitesResourceWithRawResponse: return InvitesResourceWithRawResponse(self._organizations.invites) + @cached_property + def policies(self) -> PoliciesResourceWithRawResponse: + return PoliciesResourceWithRawResponse(self._organizations.policies) + @cached_property def sso_configurations(self) -> SSOConfigurationsResourceWithRawResponse: return SSOConfigurationsResourceWithRawResponse(self._organizations.sso_configurations) @@ -1436,9 +1276,6 @@ def __init__(self, organizations: AsyncOrganizationsResource) -> None: self.update = async_to_raw_response_wrapper( organizations.update, ) - self.list = async_to_raw_response_wrapper( - organizations.list, - ) self.delete = async_to_raw_response_wrapper( organizations.delete, ) @@ -1463,6 +1300,10 @@ def domain_verifications(self) -> AsyncDomainVerificationsResourceWithRawRespons def invites(self) -> AsyncInvitesResourceWithRawResponse: return AsyncInvitesResourceWithRawResponse(self._organizations.invites) + @cached_property + def policies(self) -> AsyncPoliciesResourceWithRawResponse: + return AsyncPoliciesResourceWithRawResponse(self._organizations.policies) + @cached_property def sso_configurations(self) -> AsyncSSOConfigurationsResourceWithRawResponse: return AsyncSSOConfigurationsResourceWithRawResponse(self._organizations.sso_configurations) @@ -1481,9 +1322,6 @@ def __init__(self, organizations: OrganizationsResource) -> None: self.update = to_streamed_response_wrapper( organizations.update, ) - self.list = to_streamed_response_wrapper( - organizations.list, - ) self.delete = to_streamed_response_wrapper( organizations.delete, ) @@ -1508,6 +1346,10 @@ def domain_verifications(self) -> DomainVerificationsResourceWithStreamingRespon def invites(self) -> InvitesResourceWithStreamingResponse: return InvitesResourceWithStreamingResponse(self._organizations.invites) + @cached_property + def policies(self) -> PoliciesResourceWithStreamingResponse: + return PoliciesResourceWithStreamingResponse(self._organizations.policies) + @cached_property def sso_configurations(self) -> SSOConfigurationsResourceWithStreamingResponse: return SSOConfigurationsResourceWithStreamingResponse(self._organizations.sso_configurations) @@ -1526,9 +1368,6 @@ def __init__(self, organizations: AsyncOrganizationsResource) -> None: self.update = async_to_streamed_response_wrapper( organizations.update, ) - self.list = async_to_streamed_response_wrapper( - organizations.list, - ) self.delete = async_to_streamed_response_wrapper( organizations.delete, ) @@ -1553,6 +1392,10 @@ def domain_verifications(self) -> AsyncDomainVerificationsResourceWithStreamingR def invites(self) -> AsyncInvitesResourceWithStreamingResponse: return AsyncInvitesResourceWithStreamingResponse(self._organizations.invites) + @cached_property + def policies(self) -> AsyncPoliciesResourceWithStreamingResponse: + return AsyncPoliciesResourceWithStreamingResponse(self._organizations.policies) + @cached_property def sso_configurations(self) -> AsyncSSOConfigurationsResourceWithStreamingResponse: return AsyncSSOConfigurationsResourceWithStreamingResponse(self._organizations.sso_configurations) diff --git a/src/gitpod/resources/organizations/policies.py b/src/gitpod/resources/organizations/policies.py new file mode 100644 index 0000000..feb894c --- /dev/null +++ b/src/gitpod/resources/organizations/policies.py @@ -0,0 +1,457 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.organizations import policy_update_params, policy_retrieve_params +from ...types.organizations.policy_retrieve_response import PolicyRetrieveResponse + +__all__ = ["PoliciesResource", "AsyncPoliciesResource"] + + +class PoliciesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> PoliciesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/gitpod-io/gitpod-sdk-python#accessing-raw-response-data-eg-headers + """ + return PoliciesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> PoliciesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/gitpod-io/gitpod-sdk-python#with_streaming_response + """ + return PoliciesResourceWithStreamingResponse(self) + + def retrieve( + 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, + ) -> PolicyRetrieveResponse: + """ + Gets organization policy settings by organization ID. + + Use this method to: + + - Retrieve current policy settings for an organization + - View resource limits and restrictions + - Check allowed editors and other configurations + + ### Examples + + - Get organization policies: + + Retrieves policy settings for a specific organization. + + ```yaml + organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + ``` + + Args: + organization_id: organization_id is the ID of the organization to retrieve policies for + + 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 + """ + return self._post( + "/gitpod.v1.OrganizationService/GetOrganizationPolicies", + body=maybe_transform({"organization_id": organization_id}, policy_retrieve_params.PolicyRetrieveParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PolicyRetrieveResponse, + ) + + def update( + self, + *, + organization_id: str, + allowed_editor_ids: List[str] | NotGiven = NOT_GIVEN, + allow_local_runners: Optional[bool] | NotGiven = NOT_GIVEN, + default_editor_id: Optional[str] | NotGiven = NOT_GIVEN, + default_environment_image: Optional[str] | NotGiven = NOT_GIVEN, + maximum_environments_per_user: Optional[str] | NotGiven = NOT_GIVEN, + maximum_environment_timeout: Optional[str] | NotGiven = NOT_GIVEN, + maximum_running_environments_per_user: Optional[str] | NotGiven = NOT_GIVEN, + members_create_projects: Optional[bool] | NotGiven = NOT_GIVEN, + members_require_projects: Optional[bool] | NotGiven = NOT_GIVEN, + port_sharing_disabled: 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, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> object: + """ + Updates organization policy settings. + + Use this method to: + + - Configure editor restrictions + - Set environment resource limits + - Define project creation permissions + - Customize default configurations + + ### Examples + + - Update editor policies: + + Restricts available editors and sets a default. + + ```yaml + organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + allowedEditorIds: + - "vscode" + - "jetbrains" + defaultEditorId: "vscode" + ``` + + - Set environment limits: + + Configures limits for environment usage. + + ```yaml + organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + maximumEnvironmentTimeout: "3600s" + maximumRunningEnvironmentsPerUser: "5" + maximumEnvironmentsPerUser: "20" + ``` + + Args: + organization_id: organization_id is the ID of the organization to update policies for + + allowed_editor_ids: allowed_editor_ids is the list of editor IDs that are allowed to be used in the + organization + + allow_local_runners: allow_local_runners controls whether local runners are allowed to be used in the + organization + + default_editor_id: default_editor_id is the default editor ID to be used when a user doesn't + specify one + + default_environment_image: default_environment_image is the default container image when none is defined in + repo + + maximum_environments_per_user: maximum_environments_per_user limits total environments (running or stopped) per + user + + maximum_environment_timeout: maximum_environment_timeout controls the maximum timeout allowed for + environments in seconds. 0 means no limit (never). Minimum duration is 30 + minutes. + + maximum_running_environments_per_user: maximum_running_environments_per_user limits simultaneously running environments + per user + + members_create_projects: members_create_projects controls whether members can create projects + + members_require_projects: members_require_projects controls whether environments can only be created from + projects by non-admin users + + port_sharing_disabled: port_sharing_disabled controls whether port sharing is disabled in 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 + """ + return self._post( + "/gitpod.v1.OrganizationService/UpdateOrganizationPolicies", + body=maybe_transform( + { + "organization_id": organization_id, + "allowed_editor_ids": allowed_editor_ids, + "allow_local_runners": allow_local_runners, + "default_editor_id": default_editor_id, + "default_environment_image": default_environment_image, + "maximum_environments_per_user": maximum_environments_per_user, + "maximum_environment_timeout": maximum_environment_timeout, + "maximum_running_environments_per_user": maximum_running_environments_per_user, + "members_create_projects": members_create_projects, + "members_require_projects": members_require_projects, + "port_sharing_disabled": port_sharing_disabled, + }, + policy_update_params.PolicyUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + +class AsyncPoliciesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncPoliciesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/gitpod-io/gitpod-sdk-python#accessing-raw-response-data-eg-headers + """ + return AsyncPoliciesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncPoliciesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/gitpod-io/gitpod-sdk-python#with_streaming_response + """ + return AsyncPoliciesResourceWithStreamingResponse(self) + + async def retrieve( + 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, + ) -> PolicyRetrieveResponse: + """ + Gets organization policy settings by organization ID. + + Use this method to: + + - Retrieve current policy settings for an organization + - View resource limits and restrictions + - Check allowed editors and other configurations + + ### Examples + + - Get organization policies: + + Retrieves policy settings for a specific organization. + + ```yaml + organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + ``` + + Args: + organization_id: organization_id is the ID of the organization to retrieve policies for + + 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 + """ + return await self._post( + "/gitpod.v1.OrganizationService/GetOrganizationPolicies", + body=await async_maybe_transform( + {"organization_id": organization_id}, policy_retrieve_params.PolicyRetrieveParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PolicyRetrieveResponse, + ) + + async def update( + self, + *, + organization_id: str, + allowed_editor_ids: List[str] | NotGiven = NOT_GIVEN, + allow_local_runners: Optional[bool] | NotGiven = NOT_GIVEN, + default_editor_id: Optional[str] | NotGiven = NOT_GIVEN, + default_environment_image: Optional[str] | NotGiven = NOT_GIVEN, + maximum_environments_per_user: Optional[str] | NotGiven = NOT_GIVEN, + maximum_environment_timeout: Optional[str] | NotGiven = NOT_GIVEN, + maximum_running_environments_per_user: Optional[str] | NotGiven = NOT_GIVEN, + members_create_projects: Optional[bool] | NotGiven = NOT_GIVEN, + members_require_projects: Optional[bool] | NotGiven = NOT_GIVEN, + port_sharing_disabled: 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, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> object: + """ + Updates organization policy settings. + + Use this method to: + + - Configure editor restrictions + - Set environment resource limits + - Define project creation permissions + - Customize default configurations + + ### Examples + + - Update editor policies: + + Restricts available editors and sets a default. + + ```yaml + organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + allowedEditorIds: + - "vscode" + - "jetbrains" + defaultEditorId: "vscode" + ``` + + - Set environment limits: + + Configures limits for environment usage. + + ```yaml + organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + maximumEnvironmentTimeout: "3600s" + maximumRunningEnvironmentsPerUser: "5" + maximumEnvironmentsPerUser: "20" + ``` + + Args: + organization_id: organization_id is the ID of the organization to update policies for + + allowed_editor_ids: allowed_editor_ids is the list of editor IDs that are allowed to be used in the + organization + + allow_local_runners: allow_local_runners controls whether local runners are allowed to be used in the + organization + + default_editor_id: default_editor_id is the default editor ID to be used when a user doesn't + specify one + + default_environment_image: default_environment_image is the default container image when none is defined in + repo + + maximum_environments_per_user: maximum_environments_per_user limits total environments (running or stopped) per + user + + maximum_environment_timeout: maximum_environment_timeout controls the maximum timeout allowed for + environments in seconds. 0 means no limit (never). Minimum duration is 30 + minutes. + + maximum_running_environments_per_user: maximum_running_environments_per_user limits simultaneously running environments + per user + + members_create_projects: members_create_projects controls whether members can create projects + + members_require_projects: members_require_projects controls whether environments can only be created from + projects by non-admin users + + port_sharing_disabled: port_sharing_disabled controls whether port sharing is disabled in 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 + """ + return await self._post( + "/gitpod.v1.OrganizationService/UpdateOrganizationPolicies", + body=await async_maybe_transform( + { + "organization_id": organization_id, + "allowed_editor_ids": allowed_editor_ids, + "allow_local_runners": allow_local_runners, + "default_editor_id": default_editor_id, + "default_environment_image": default_environment_image, + "maximum_environments_per_user": maximum_environments_per_user, + "maximum_environment_timeout": maximum_environment_timeout, + "maximum_running_environments_per_user": maximum_running_environments_per_user, + "members_create_projects": members_create_projects, + "members_require_projects": members_require_projects, + "port_sharing_disabled": port_sharing_disabled, + }, + policy_update_params.PolicyUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + +class PoliciesResourceWithRawResponse: + def __init__(self, policies: PoliciesResource) -> None: + self._policies = policies + + self.retrieve = to_raw_response_wrapper( + policies.retrieve, + ) + self.update = to_raw_response_wrapper( + policies.update, + ) + + +class AsyncPoliciesResourceWithRawResponse: + def __init__(self, policies: AsyncPoliciesResource) -> None: + self._policies = policies + + self.retrieve = async_to_raw_response_wrapper( + policies.retrieve, + ) + self.update = async_to_raw_response_wrapper( + policies.update, + ) + + +class PoliciesResourceWithStreamingResponse: + def __init__(self, policies: PoliciesResource) -> None: + self._policies = policies + + self.retrieve = to_streamed_response_wrapper( + policies.retrieve, + ) + self.update = to_streamed_response_wrapper( + policies.update, + ) + + +class AsyncPoliciesResourceWithStreamingResponse: + def __init__(self, policies: AsyncPoliciesResource) -> None: + self._policies = policies + + self.retrieve = async_to_streamed_response_wrapper( + policies.retrieve, + ) + self.update = async_to_streamed_response_wrapper( + policies.update, + ) diff --git a/src/gitpod/resources/organizations/sso_configurations.py b/src/gitpod/resources/organizations/sso_configurations.py index 68266b7..6cdb528 100644 --- a/src/gitpod/resources/organizations/sso_configurations.py +++ b/src/gitpod/resources/organizations/sso_configurations.py @@ -7,10 +7,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( diff --git a/src/gitpod/resources/projects/policies.py b/src/gitpod/resources/projects/policies.py index ffac162..fc12621 100644 --- a/src/gitpod/resources/projects/policies.py +++ b/src/gitpod/resources/projects/policies.py @@ -5,10 +5,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -68,7 +65,25 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> PolicyCreateResponse: """ - CreateProjectPolicy creates a Project Policy. + Creates a new policy for a project. + + Use this method to: + + - Set up access controls + - Define group permissions + - Configure role-based access + + ### Examples + + - Create admin policy: + + Grants admin access to a group. + + ```yaml + projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + groupId: "f53d2330-3795-4c5d-a1f3-453121af9c60" + role: PROJECT_ROLE_ADMIN + ``` Args: group_id: group_id specifies the group_id identifier @@ -113,7 +128,25 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> PolicyUpdateResponse: """ - UpdateProjectPolicy updates a Project Policy. + Updates an existing project policy. + + Use this method to: + + - Modify access levels + - Change group roles + - Update permissions + + ### Examples + + - Update policy role: + + Changes a group's access level. + + ```yaml + projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + groupId: "f53d2330-3795-4c5d-a1f3-453121af9c60" + role: PROJECT_ROLE_EDITOR + ``` Args: group_id: group_id specifies the group_id identifier @@ -159,7 +192,25 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncPoliciesPage[ProjectPolicy]: """ - ListProjectPolicies lists policies for a project. + Lists policies for a project. + + Use this method to: + + - View access controls + - Check policy configurations + - Audit permissions + + ### Examples + + - List policies: + + Shows all policies for a project. + + ```yaml + projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + pagination: + pageSize: 20 + ``` Args: pagination: pagination contains the pagination options for listing project policies @@ -214,7 +265,24 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - DeleteProjectPolicy deletes a Project Policy. + Deletes a project policy. + + Use this method to: + + - Remove access controls + - Revoke permissions + - Clean up policies + + ### Examples + + - Delete policy: + + Removes a group's access policy. + + ```yaml + projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + groupId: "f53d2330-3795-4c5d-a1f3-453121af9c60" + ``` Args: group_id: group_id specifies the group_id identifier @@ -279,7 +347,25 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> PolicyCreateResponse: """ - CreateProjectPolicy creates a Project Policy. + Creates a new policy for a project. + + Use this method to: + + - Set up access controls + - Define group permissions + - Configure role-based access + + ### Examples + + - Create admin policy: + + Grants admin access to a group. + + ```yaml + projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + groupId: "f53d2330-3795-4c5d-a1f3-453121af9c60" + role: PROJECT_ROLE_ADMIN + ``` Args: group_id: group_id specifies the group_id identifier @@ -324,7 +410,25 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> PolicyUpdateResponse: """ - UpdateProjectPolicy updates a Project Policy. + Updates an existing project policy. + + Use this method to: + + - Modify access levels + - Change group roles + - Update permissions + + ### Examples + + - Update policy role: + + Changes a group's access level. + + ```yaml + projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + groupId: "f53d2330-3795-4c5d-a1f3-453121af9c60" + role: PROJECT_ROLE_EDITOR + ``` Args: group_id: group_id specifies the group_id identifier @@ -370,7 +474,25 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[ProjectPolicy, AsyncPoliciesPage[ProjectPolicy]]: """ - ListProjectPolicies lists policies for a project. + Lists policies for a project. + + Use this method to: + + - View access controls + - Check policy configurations + - Audit permissions + + ### Examples + + - List policies: + + Shows all policies for a project. + + ```yaml + projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + pagination: + pageSize: 20 + ``` Args: pagination: pagination contains the pagination options for listing project policies @@ -425,7 +547,24 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - DeleteProjectPolicy deletes a Project Policy. + Deletes a project policy. + + Use this method to: + + - Remove access controls + - Revoke permissions + - Clean up policies + + ### Examples + + - Delete policy: + + Removes a group's access policy. + + ```yaml + projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + groupId: "f53d2330-3795-4c5d-a1f3-453121af9c60" + ``` Args: group_id: group_id specifies the group_id identifier diff --git a/src/gitpod/resources/projects/projects.py b/src/gitpod/resources/projects/projects.py index b3cd146..2c8e637 100644 --- a/src/gitpod/resources/projects/projects.py +++ b/src/gitpod/resources/projects/projects.py @@ -15,10 +15,7 @@ project_create_from_environment_params, ) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from .policies import ( PoliciesResource, AsyncPoliciesResource, @@ -80,6 +77,7 @@ def create( automations_file_path: str | NotGiven = NOT_GIVEN, devcontainer_file_path: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + technical_description: 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, @@ -88,10 +86,49 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ProjectCreateResponse: """ - CreateProject creates a new Project. + Creates a new project with specified configuration. + + Use this method to: + + - Set up development projects + - Configure project environments + - Define project settings + - Initialize project content + + ### Examples + + - Create basic project: + + Creates a project with minimal configuration. + + ```yaml + name: "Web Application" + environmentClass: + environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + initializer: + specs: + - git: + remoteUri: "https://github.com/org/repo" + ``` + + - Create project with devcontainer: + + Creates a project with custom development container. + + ```yaml + name: "Backend Service" + environmentClass: + environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + initializer: + specs: + - git: + remoteUri: "https://github.com/org/backend" + devcontainerFilePath: ".devcontainer/devcontainer.json" + automationsFilePath: ".gitpod/automations.yaml" + ``` Args: - initializer: EnvironmentInitializer specifies how an environment is to be initialized + initializer: initializer is the content initializer automations_file_path: automations_file_path is the path to the automations file relative to the repo root path must not be absolute (start with a /): @@ -107,6 +144,9 @@ def create( this.matches("^$|^[^/].*") ``` + technical_description: technical_description is a detailed technical description of the project This + field is not returned by default in GetProject or ListProjects responses 8KB max + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -124,6 +164,7 @@ def create( "automations_file_path": automations_file_path, "devcontainer_file_path": devcontainer_file_path, "name": name, + "technical_description": technical_description, }, project_create_params.ProjectCreateParams, ), @@ -145,7 +186,23 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ProjectRetrieveResponse: """ - GetProject retrieves a single Project. + Gets details about a specific project. + + Use this method to: + + - View project configuration + - Check project status + - Get project metadata + + ### Examples + + - Get project details: + + Retrieves information about a specific project. + + ```yaml + projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + ``` Args: project_id: project_id specifies the project identifier @@ -176,6 +233,7 @@ def update( initializer: Optional[EnvironmentInitializerParam] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, project_id: str | NotGiven = NOT_GIVEN, + technical_description: 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, @@ -184,7 +242,35 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ProjectUpdateResponse: """ - UpdateProject updates the properties of a Project. + Updates a project's configuration. + + Use this method to: + + - Modify project settings + - Update environment class + - Change project name + - Configure initializers + + ### Examples + + - Update project name: + + Changes the project's display name. + + ```yaml + projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + name: "New Project Name" + ``` + + - Update environment class: + + Changes the project's environment class. + + ```yaml + projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + environmentClass: + environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + ``` Args: automations_file_path: automations_file_path is the path to the automations file relative to the repo @@ -201,10 +287,13 @@ def update( this.matches("^$|^[^/].*") ``` - initializer: EnvironmentInitializer specifies how an environment is to be initialized + initializer: initializer is the content initializer project_id: project_id specifies the project identifier + technical_description: technical_description is a detailed technical description of the project This + field is not returned by default in GetProject or ListProjects responses 8KB max + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -223,6 +312,7 @@ def update( "initializer": initializer, "name": name, "project_id": project_id, + "technical_description": technical_description, }, project_update_params.ProjectUpdateParams, ), @@ -237,6 +327,7 @@ def list( *, token: str | NotGiven = NOT_GIVEN, page_size: int | NotGiven = NOT_GIVEN, + filter: project_list_params.Filter | NotGiven = NOT_GIVEN, pagination: project_list_params.Pagination | 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. @@ -246,7 +337,24 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncProjectsPage[Project]: """ - ListProjects lists all projects the caller has access to. + Lists projects with optional filtering. + + Use this method to: + + - View all accessible projects + - Browse project configurations + - Monitor project status + + ### Examples + + - List projects: + + Shows all projects with pagination. + + ```yaml + pagination: + pageSize: 20 + ``` Args: pagination: pagination contains the pagination options for listing organizations @@ -262,7 +370,13 @@ def list( return self._get_api_list( "/gitpod.v1.ProjectService/ListProjects", page=SyncProjectsPage[Project], - body=maybe_transform({"pagination": pagination}, project_list_params.ProjectListParams), + body=maybe_transform( + { + "filter": filter, + "pagination": pagination, + }, + project_list_params.ProjectListParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -292,7 +406,23 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - DeleteProject deletes the specified project. + Deletes a project permanently. + + Use this method to: + + - Remove unused projects + - Clean up test projects + - Delete obsolete configurations + + ### Examples + + - Delete project: + + Permanently removes a project. + + ```yaml + projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + ``` Args: project_id: project_id specifies the project identifier @@ -327,7 +457,24 @@ def create_from_environment( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ProjectCreateFromEnvironmentResponse: """ - CreateProject creates a new Project using an environment as template. + Creates a new project using an existing environment as a template. + + Use this method to: + + - Clone environment configurations + - Create projects from templates + - Share environment setups + + ### Examples + + - Create from environment: + + Creates a project based on existing environment. + + ```yaml + name: "Frontend Project" + environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" + ``` Args: environment_id: environment_id specifies the environment identifier @@ -388,6 +535,7 @@ async def create( automations_file_path: str | NotGiven = NOT_GIVEN, devcontainer_file_path: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + technical_description: 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, @@ -396,10 +544,49 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ProjectCreateResponse: """ - CreateProject creates a new Project. + Creates a new project with specified configuration. + + Use this method to: + + - Set up development projects + - Configure project environments + - Define project settings + - Initialize project content + + ### Examples + + - Create basic project: + + Creates a project with minimal configuration. + + ```yaml + name: "Web Application" + environmentClass: + environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + initializer: + specs: + - git: + remoteUri: "https://github.com/org/repo" + ``` + + - Create project with devcontainer: + + Creates a project with custom development container. + + ```yaml + name: "Backend Service" + environmentClass: + environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + initializer: + specs: + - git: + remoteUri: "https://github.com/org/backend" + devcontainerFilePath: ".devcontainer/devcontainer.json" + automationsFilePath: ".gitpod/automations.yaml" + ``` Args: - initializer: EnvironmentInitializer specifies how an environment is to be initialized + initializer: initializer is the content initializer automations_file_path: automations_file_path is the path to the automations file relative to the repo root path must not be absolute (start with a /): @@ -415,6 +602,9 @@ async def create( this.matches("^$|^[^/].*") ``` + technical_description: technical_description is a detailed technical description of the project This + field is not returned by default in GetProject or ListProjects responses 8KB max + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -432,6 +622,7 @@ async def create( "automations_file_path": automations_file_path, "devcontainer_file_path": devcontainer_file_path, "name": name, + "technical_description": technical_description, }, project_create_params.ProjectCreateParams, ), @@ -453,7 +644,23 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ProjectRetrieveResponse: """ - GetProject retrieves a single Project. + Gets details about a specific project. + + Use this method to: + + - View project configuration + - Check project status + - Get project metadata + + ### Examples + + - Get project details: + + Retrieves information about a specific project. + + ```yaml + projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + ``` Args: project_id: project_id specifies the project identifier @@ -484,6 +691,7 @@ async def update( initializer: Optional[EnvironmentInitializerParam] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, project_id: str | NotGiven = NOT_GIVEN, + technical_description: 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, @@ -492,7 +700,35 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ProjectUpdateResponse: """ - UpdateProject updates the properties of a Project. + Updates a project's configuration. + + Use this method to: + + - Modify project settings + - Update environment class + - Change project name + - Configure initializers + + ### Examples + + - Update project name: + + Changes the project's display name. + + ```yaml + projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + name: "New Project Name" + ``` + + - Update environment class: + + Changes the project's environment class. + + ```yaml + projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + environmentClass: + environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + ``` Args: automations_file_path: automations_file_path is the path to the automations file relative to the repo @@ -509,10 +745,13 @@ async def update( this.matches("^$|^[^/].*") ``` - initializer: EnvironmentInitializer specifies how an environment is to be initialized + initializer: initializer is the content initializer project_id: project_id specifies the project identifier + technical_description: technical_description is a detailed technical description of the project This + field is not returned by default in GetProject or ListProjects responses 8KB max + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -531,6 +770,7 @@ async def update( "initializer": initializer, "name": name, "project_id": project_id, + "technical_description": technical_description, }, project_update_params.ProjectUpdateParams, ), @@ -545,6 +785,7 @@ def list( *, token: str | NotGiven = NOT_GIVEN, page_size: int | NotGiven = NOT_GIVEN, + filter: project_list_params.Filter | NotGiven = NOT_GIVEN, pagination: project_list_params.Pagination | 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. @@ -554,7 +795,24 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[Project, AsyncProjectsPage[Project]]: """ - ListProjects lists all projects the caller has access to. + Lists projects with optional filtering. + + Use this method to: + + - View all accessible projects + - Browse project configurations + - Monitor project status + + ### Examples + + - List projects: + + Shows all projects with pagination. + + ```yaml + pagination: + pageSize: 20 + ``` Args: pagination: pagination contains the pagination options for listing organizations @@ -570,7 +828,13 @@ def list( return self._get_api_list( "/gitpod.v1.ProjectService/ListProjects", page=AsyncProjectsPage[Project], - body=maybe_transform({"pagination": pagination}, project_list_params.ProjectListParams), + body=maybe_transform( + { + "filter": filter, + "pagination": pagination, + }, + project_list_params.ProjectListParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -600,7 +864,23 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - DeleteProject deletes the specified project. + Deletes a project permanently. + + Use this method to: + + - Remove unused projects + - Clean up test projects + - Delete obsolete configurations + + ### Examples + + - Delete project: + + Permanently removes a project. + + ```yaml + projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + ``` Args: project_id: project_id specifies the project identifier @@ -635,7 +915,24 @@ async def create_from_environment( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ProjectCreateFromEnvironmentResponse: """ - CreateProject creates a new Project using an environment as template. + Creates a new project using an existing environment as a template. + + Use this method to: + + - Clone environment configurations + - Create projects from templates + - Share environment setups + + ### Examples + + - Create from environment: + + Creates a project based on existing environment. + + ```yaml + name: "Frontend Project" + environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" + ``` Args: environment_id: environment_id specifies the environment identifier diff --git a/src/gitpod/resources/runners/configurations/configurations.py b/src/gitpod/resources/runners/configurations/configurations.py index 135c788..b9b2c27 100644 --- a/src/gitpod/resources/runners/configurations/configurations.py +++ b/src/gitpod/resources/runners/configurations/configurations.py @@ -13,10 +13,7 @@ AsyncSchemaResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -106,10 +103,30 @@ def validate( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ConfigurationValidateResponse: - """ValidateRunnerConfiguration validates a runner configuration (e.g. + """ + Validates a runner configuration. + + Use this method to: + + - Check configuration validity + - Verify integration settings + - Validate environment classes + + ### Examples + + - Validate SCM integration: + + Checks if an SCM integration is valid. - environment - class, SCM integration) with the runner. + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + scmIntegration: + id: "integration-id" + scmId: "github" + host: "github.com" + oauthClientId: "client_id" + oauthPlaintextClientSecret: "client_secret" + ``` Args: extra_headers: Send extra headers @@ -186,10 +203,30 @@ async def validate( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ConfigurationValidateResponse: - """ValidateRunnerConfiguration validates a runner configuration (e.g. + """ + Validates a runner configuration. + + Use this method to: + + - Check configuration validity + - Verify integration settings + - Validate environment classes + + ### Examples + + - Validate SCM integration: + + Checks if an SCM integration is valid. - environment - class, SCM integration) with the runner. + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + scmIntegration: + id: "integration-id" + scmId: "github" + host: "github.com" + oauthClientId: "client_id" + oauthPlaintextClientSecret: "client_secret" + ``` Args: extra_headers: Send extra headers diff --git a/src/gitpod/resources/runners/configurations/environment_classes.py b/src/gitpod/resources/runners/configurations/environment_classes.py index e790fe7..ba2137c 100644 --- a/src/gitpod/resources/runners/configurations/environment_classes.py +++ b/src/gitpod/resources/runners/configurations/environment_classes.py @@ -7,10 +7,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -70,7 +67,30 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> EnvironmentClassCreateResponse: """ - CreateEnvironmentClass creates a new environment class on a runner. + Creates a new environment class for a runner. + + Use this method to: + + - Define compute resources + - Configure environment settings + - Set up runtime options + + ### Examples + + - Create environment class: + + Creates a new environment configuration. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + displayName: "Large Instance" + description: "8 CPU, 16GB RAM" + configuration: + - key: "cpu" + value: "8" + - key: "memory" + value: "16384" + ``` Args: extra_headers: Send extra headers @@ -110,7 +130,23 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> EnvironmentClassRetrieveResponse: """ - GetEnvironmentClass returns a single environment class configured for a runner. + Gets details about a specific environment class. + + Use this method to: + + - View class configuration + - Check resource settings + - Verify availability + + ### Examples + + - Get class details: + + Retrieves information about a specific class. + + ```yaml + environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + ``` Args: extra_headers: Send extra headers @@ -148,7 +184,26 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - UpdateEnvironmentClass updates an existing environment class on a runner. + Updates an environment class. + + Use this method to: + + - Modify class settings + - Update resource limits + - Change availability + + ### Examples + + - Update class: + + Changes class configuration. + + ```yaml + environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + displayName: "Updated Large Instance" + description: "16 CPU, 32GB RAM" + enabled: true + ``` Args: extra_headers: Send extra headers @@ -191,8 +246,37 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncEnvironmentClassesPage[EnvironmentClass]: """ - buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE ListEnvironmentClasses returns all - environment classes configured for a runner. + Lists environment classes with optional filtering. + + Use this method to: + + - View available classes + - Filter by capability + - Check enabled status + + ### Examples + + - List all classes: + + Shows all environment classes. + + ```yaml + pagination: + pageSize: 20 + ``` + + - Filter enabled classes: + + Lists only enabled environment classes. + + ```yaml + filter: + enabled: true + pagination: + pageSize: 20 + ``` + + buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE Args: pagination: pagination contains the pagination options for listing environment classes @@ -268,7 +352,30 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> EnvironmentClassCreateResponse: """ - CreateEnvironmentClass creates a new environment class on a runner. + Creates a new environment class for a runner. + + Use this method to: + + - Define compute resources + - Configure environment settings + - Set up runtime options + + ### Examples + + - Create environment class: + + Creates a new environment configuration. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + displayName: "Large Instance" + description: "8 CPU, 16GB RAM" + configuration: + - key: "cpu" + value: "8" + - key: "memory" + value: "16384" + ``` Args: extra_headers: Send extra headers @@ -308,7 +415,23 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> EnvironmentClassRetrieveResponse: """ - GetEnvironmentClass returns a single environment class configured for a runner. + Gets details about a specific environment class. + + Use this method to: + + - View class configuration + - Check resource settings + - Verify availability + + ### Examples + + - Get class details: + + Retrieves information about a specific class. + + ```yaml + environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + ``` Args: extra_headers: Send extra headers @@ -346,7 +469,26 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - UpdateEnvironmentClass updates an existing environment class on a runner. + Updates an environment class. + + Use this method to: + + - Modify class settings + - Update resource limits + - Change availability + + ### Examples + + - Update class: + + Changes class configuration. + + ```yaml + environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + displayName: "Updated Large Instance" + description: "16 CPU, 32GB RAM" + enabled: true + ``` Args: extra_headers: Send extra headers @@ -389,8 +531,37 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[EnvironmentClass, AsyncEnvironmentClassesPage[EnvironmentClass]]: """ - buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE ListEnvironmentClasses returns all - environment classes configured for a runner. + Lists environment classes with optional filtering. + + Use this method to: + + - View available classes + - Filter by capability + - Check enabled status + + ### Examples + + - List all classes: + + Shows all environment classes. + + ```yaml + pagination: + pageSize: 20 + ``` + + - Filter enabled classes: + + Lists only enabled environment classes. + + ```yaml + filter: + enabled: true + pagination: + pageSize: 20 + ``` + + buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE Args: pagination: pagination contains the pagination options for listing environment classes diff --git a/src/gitpod/resources/runners/configurations/host_authentication_tokens.py b/src/gitpod/resources/runners/configurations/host_authentication_tokens.py index 4f49af8..af044ec 100644 --- a/src/gitpod/resources/runners/configurations/host_authentication_tokens.py +++ b/src/gitpod/resources/runners/configurations/host_authentication_tokens.py @@ -8,10 +8,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -80,7 +77,29 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> HostAuthenticationTokenCreateResponse: """ - CreateHostAuthenticationToken + Creates a new authentication token for accessing remote hosts. + + Use this method to: + + - Set up SCM authentication + - Configure OAuth credentials + - Manage PAT tokens + + ### Examples + + - Create OAuth token: + + Creates a new OAuth-based authentication token. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + userId: "f53d2330-3795-4c5d-a1f3-453121af9c60" + host: "github.com" + token: "gho_xxxxxxxxxxxx" + source: HOST_AUTHENTICATION_TOKEN_SOURCE_OAUTH + expiresAt: "2024-12-31T23:59:59Z" + refreshToken: "ghr_xxxxxxxxxxxx" + ``` Args: expires_at: A Timestamp represents a point in time independent of any time zone or local @@ -212,7 +231,23 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> HostAuthenticationTokenRetrieveResponse: """ - GetHostAuthenticationToken + Gets details about a specific host authentication token. + + Use this method to: + + - View token information + - Check token expiration + - Verify token validity + + ### Examples + + - Get token details: + + Retrieves information about a specific token. + + ```yaml + id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + ``` Args: extra_headers: Send extra headers @@ -249,7 +284,26 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - UpdateHostAuthenticationToken + Updates an existing host authentication token. + + Use this method to: + + - Refresh token values + - Update expiration + - Modify token settings + + ### Examples + + - Update token: + + Updates token value and expiration. + + ```yaml + id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + token: "gho_xxxxxxxxxxxx" + expiresAt: "2024-12-31T23:59:59Z" + refreshToken: "ghr_xxxxxxxxxxxx" + ``` Args: expires_at: A Timestamp represents a point in time independent of any time zone or local @@ -381,7 +435,35 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncTokensPage[HostAuthenticationToken]: """ - ListHostAuthenticationTokens + Lists host authentication tokens with optional filtering. + + Use this method to: + + - View all tokens + - Filter by runner or user + - Monitor token status + + ### Examples + + - List all tokens: + + Shows all tokens with pagination. + + ```yaml + pagination: + pageSize: 20 + ``` + + - Filter by runner: + + Lists tokens for a specific runner. + + ```yaml + filter: + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + pagination: + pageSize: 20 + ``` Args: extra_headers: Send extra headers @@ -431,7 +513,23 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - DeleteHostAuthenticationToken + Deletes a host authentication token. + + Use this method to: + + - Remove unused tokens + - Revoke access + - Clean up expired tokens + + ### Examples + + - Delete token: + + Permanently removes a token. + + ```yaml + id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + ``` Args: extra_headers: Send extra headers @@ -492,7 +590,29 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> HostAuthenticationTokenCreateResponse: """ - CreateHostAuthenticationToken + Creates a new authentication token for accessing remote hosts. + + Use this method to: + + - Set up SCM authentication + - Configure OAuth credentials + - Manage PAT tokens + + ### Examples + + - Create OAuth token: + + Creates a new OAuth-based authentication token. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + userId: "f53d2330-3795-4c5d-a1f3-453121af9c60" + host: "github.com" + token: "gho_xxxxxxxxxxxx" + source: HOST_AUTHENTICATION_TOKEN_SOURCE_OAUTH + expiresAt: "2024-12-31T23:59:59Z" + refreshToken: "ghr_xxxxxxxxxxxx" + ``` Args: expires_at: A Timestamp represents a point in time independent of any time zone or local @@ -624,7 +744,23 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> HostAuthenticationTokenRetrieveResponse: """ - GetHostAuthenticationToken + Gets details about a specific host authentication token. + + Use this method to: + + - View token information + - Check token expiration + - Verify token validity + + ### Examples + + - Get token details: + + Retrieves information about a specific token. + + ```yaml + id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + ``` Args: extra_headers: Send extra headers @@ -661,7 +797,26 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - UpdateHostAuthenticationToken + Updates an existing host authentication token. + + Use this method to: + + - Refresh token values + - Update expiration + - Modify token settings + + ### Examples + + - Update token: + + Updates token value and expiration. + + ```yaml + id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + token: "gho_xxxxxxxxxxxx" + expiresAt: "2024-12-31T23:59:59Z" + refreshToken: "ghr_xxxxxxxxxxxx" + ``` Args: expires_at: A Timestamp represents a point in time independent of any time zone or local @@ -793,7 +948,35 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[HostAuthenticationToken, AsyncTokensPage[HostAuthenticationToken]]: """ - ListHostAuthenticationTokens + Lists host authentication tokens with optional filtering. + + Use this method to: + + - View all tokens + - Filter by runner or user + - Monitor token status + + ### Examples + + - List all tokens: + + Shows all tokens with pagination. + + ```yaml + pagination: + pageSize: 20 + ``` + + - Filter by runner: + + Lists tokens for a specific runner. + + ```yaml + filter: + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + pagination: + pageSize: 20 + ``` Args: extra_headers: Send extra headers @@ -843,7 +1026,23 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - DeleteHostAuthenticationToken + Deletes a host authentication token. + + Use this method to: + + - Remove unused tokens + - Revoke access + - Clean up expired tokens + + ### Examples + + - Delete token: + + Permanently removes a token. + + ```yaml + id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + ``` Args: extra_headers: Send extra headers diff --git a/src/gitpod/resources/runners/configurations/schema.py b/src/gitpod/resources/runners/configurations/schema.py index 4d3f3e5..06963e1 100644 --- a/src/gitpod/resources/runners/configurations/schema.py +++ b/src/gitpod/resources/runners/configurations/schema.py @@ -5,10 +5,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -56,7 +53,23 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SchemaRetrieveResponse: """ - GetRunnerConfigurationSchema retrieves the latest Runner configuration schema + Gets the latest runner configuration schema. + + Use this method to: + + - View available settings + - Check configuration options + - Validate configurations + + ### Examples + + - Get schema: + + Retrieves configuration schema for a runner. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + ``` Args: extra_headers: Send extra headers @@ -109,7 +122,23 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SchemaRetrieveResponse: """ - GetRunnerConfigurationSchema retrieves the latest Runner configuration schema + Gets the latest runner configuration schema. + + Use this method to: + + - View available settings + - Check configuration options + - Validate configurations + + ### Examples + + - Get schema: + + Retrieves configuration schema for a runner. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + ``` Args: extra_headers: Send extra headers diff --git a/src/gitpod/resources/runners/configurations/scm_integrations.py b/src/gitpod/resources/runners/configurations/scm_integrations.py index 97aa260..2947b2e 100644 --- a/src/gitpod/resources/runners/configurations/scm_integrations.py +++ b/src/gitpod/resources/runners/configurations/scm_integrations.py @@ -7,10 +7,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -59,6 +56,7 @@ def create( self, *, host: str | NotGiven = NOT_GIVEN, + issuer_url: Optional[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, @@ -72,9 +70,32 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ScmIntegrationCreateResponse: """ - CreateSCMIntegration creates a new SCM integration on a runner. + Creates a new SCM integration for a runner. + + Use this method to: + + - Configure source control access + - Set up repository integrations + - Enable code synchronization + + ### Examples + + - Create GitHub integration: + + Sets up GitHub SCM integration. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + scmId: "github" + host: "github.com" + oauthClientId: "client_id" + oauthPlaintextClientSecret: "client_secret" + ``` Args: + issuer_url: issuer_url can be set to override the authentication provider URL, if it doesn't + match the SCM host. + 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. @@ -97,6 +118,7 @@ def create( body=maybe_transform( { "host": host, + "issuer_url": issuer_url, "oauth_client_id": oauth_client_id, "oauth_plaintext_client_secret": oauth_plaintext_client_secret, "pat": pat, @@ -123,7 +145,23 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ScmIntegrationRetrieveResponse: """ - GetSCMIntegration returns a single SCM integration configured for a runner. + Gets details about a specific SCM integration. + + Use this method to: + + - View integration settings + - Check integration status + - Verify configuration + + ### Examples + + - Get integration details: + + Retrieves information about a specific integration. + + ```yaml + id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + ``` Args: extra_headers: Send extra headers @@ -147,6 +185,7 @@ def update( self, *, id: str | NotGiven = NOT_GIVEN, + issuer_url: Optional[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, @@ -158,9 +197,30 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - UpdateSCMIntegration updates an existing SCM integration on a runner. + Updates an existing SCM integration. + + Use this method to: + + - Modify integration settings + - Update credentials + - Change configuration + + ### Examples + + - Update integration: + + Updates OAuth credentials. + + ```yaml + id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + oauthClientId: "new_client_id" + oauthPlaintextClientSecret: "new_client_secret" + ``` Args: + issuer_url: issuer_url can be set to override the authentication provider URL, if it doesn't + match the SCM host. + oauth_client_id: oauth_client_id can be set to update the OAuth app's client ID. If an empty string is set, the OAuth configuration will be removed (regardless of whether a client secret is set), and any existing Host Authentication Tokens for the SCM @@ -191,6 +251,7 @@ def update( body=maybe_transform( { "id": id, + "issuer_url": issuer_url, "oauth_client_id": oauth_client_id, "oauth_plaintext_client_secret": oauth_plaintext_client_secret, "pat": pat, @@ -218,7 +279,26 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncIntegrationsPage[ScmIntegration]: """ - ListSCMIntegrations returns all SCM integrations configured for a runner. + Lists SCM integrations for a runner. + + Use this method to: + + - View all integrations + - Monitor integration status + - Check available SCMs + + ### Examples + + - List integrations: + + Shows all SCM integrations. + + ```yaml + filter: + runnerIds: ["d2c94c27-3b76-4a42-b88c-95a85e392c68"] + pagination: + pageSize: 20 + ``` Args: pagination: pagination contains the pagination options for listing scm integrations @@ -270,7 +350,23 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - DeleteSCMIntegration deletes an existing SCM integration on a runner. + Deletes an SCM integration. + + Use this method to: + + - Remove unused integrations + - Clean up configurations + - Revoke SCM access + + ### Examples + + - Delete integration: + + Removes an SCM integration. + + ```yaml + id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + ``` Args: extra_headers: Send extra headers @@ -315,6 +411,7 @@ async def create( self, *, host: str | NotGiven = NOT_GIVEN, + issuer_url: Optional[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, @@ -328,9 +425,32 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ScmIntegrationCreateResponse: """ - CreateSCMIntegration creates a new SCM integration on a runner. + Creates a new SCM integration for a runner. + + Use this method to: + + - Configure source control access + - Set up repository integrations + - Enable code synchronization + + ### Examples + + - Create GitHub integration: + + Sets up GitHub SCM integration. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + scmId: "github" + host: "github.com" + oauthClientId: "client_id" + oauthPlaintextClientSecret: "client_secret" + ``` Args: + issuer_url: issuer_url can be set to override the authentication provider URL, if it doesn't + match the SCM host. + 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. @@ -353,6 +473,7 @@ async def create( body=await async_maybe_transform( { "host": host, + "issuer_url": issuer_url, "oauth_client_id": oauth_client_id, "oauth_plaintext_client_secret": oauth_plaintext_client_secret, "pat": pat, @@ -379,7 +500,23 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ScmIntegrationRetrieveResponse: """ - GetSCMIntegration returns a single SCM integration configured for a runner. + Gets details about a specific SCM integration. + + Use this method to: + + - View integration settings + - Check integration status + - Verify configuration + + ### Examples + + - Get integration details: + + Retrieves information about a specific integration. + + ```yaml + id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + ``` Args: extra_headers: Send extra headers @@ -403,6 +540,7 @@ async def update( self, *, id: str | NotGiven = NOT_GIVEN, + issuer_url: Optional[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, @@ -414,9 +552,30 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - UpdateSCMIntegration updates an existing SCM integration on a runner. + Updates an existing SCM integration. + + Use this method to: + + - Modify integration settings + - Update credentials + - Change configuration + + ### Examples + + - Update integration: + + Updates OAuth credentials. + + ```yaml + id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + oauthClientId: "new_client_id" + oauthPlaintextClientSecret: "new_client_secret" + ``` Args: + issuer_url: issuer_url can be set to override the authentication provider URL, if it doesn't + match the SCM host. + oauth_client_id: oauth_client_id can be set to update the OAuth app's client ID. If an empty string is set, the OAuth configuration will be removed (regardless of whether a client secret is set), and any existing Host Authentication Tokens for the SCM @@ -447,6 +606,7 @@ async def update( body=await async_maybe_transform( { "id": id, + "issuer_url": issuer_url, "oauth_client_id": oauth_client_id, "oauth_plaintext_client_secret": oauth_plaintext_client_secret, "pat": pat, @@ -474,7 +634,26 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[ScmIntegration, AsyncIntegrationsPage[ScmIntegration]]: """ - ListSCMIntegrations returns all SCM integrations configured for a runner. + Lists SCM integrations for a runner. + + Use this method to: + + - View all integrations + - Monitor integration status + - Check available SCMs + + ### Examples + + - List integrations: + + Shows all SCM integrations. + + ```yaml + filter: + runnerIds: ["d2c94c27-3b76-4a42-b88c-95a85e392c68"] + pagination: + pageSize: 20 + ``` Args: pagination: pagination contains the pagination options for listing scm integrations @@ -526,7 +705,23 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - DeleteSCMIntegration deletes an existing SCM integration on a runner. + Deletes an SCM integration. + + Use this method to: + + - Remove unused integrations + - Clean up configurations + - Revoke SCM access + + ### Examples + + - Delete integration: + + Removes an SCM integration. + + ```yaml + id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + ``` Args: extra_headers: Send extra headers diff --git a/src/gitpod/resources/runners/policies.py b/src/gitpod/resources/runners/policies.py index 09de7ed..4ce6cc3 100644 --- a/src/gitpod/resources/runners/policies.py +++ b/src/gitpod/resources/runners/policies.py @@ -5,10 +5,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -68,7 +65,25 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> PolicyCreateResponse: """ - CreateRunnerPolicy creates a new runner policy. + Creates a new policy for a runner. + + Use this method to: + + - Set up access controls + - Define group permissions + - Configure role-based access + + ### Examples + + - Create admin policy: + + Grants admin access to a group. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + groupId: "f53d2330-3795-4c5d-a1f3-453121af9c60" + role: RUNNER_ROLE_ADMIN + ``` Args: group_id: group_id specifies the group_id identifier @@ -113,7 +128,25 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> PolicyUpdateResponse: """ - UpdateRunnerPolicy an existing runner policy. + Updates an existing runner policy. + + Use this method to: + + - Modify access levels + - Change group roles + - Update permissions + + ### Examples + + - Update policy role: + + Changes a group's access level. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + groupId: "f53d2330-3795-4c5d-a1f3-453121af9c60" + role: RUNNER_ROLE_USER + ``` Args: group_id: group_id specifies the group_id identifier @@ -159,7 +192,25 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncPoliciesPage[RunnerPolicy]: """ - ListRunnerPolicies lists runner policies. + Lists policies for a runner. + + Use this method to: + + - View access controls + - Check policy configurations + - Audit permissions + + ### Examples + + - List policies: + + Shows all policies for a runner. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + pagination: + pageSize: 20 + ``` Args: pagination: pagination contains the pagination options for listing project policies @@ -214,7 +265,24 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - DeleteRunnerPolicy deletes a runner policy. + Deletes a runner policy. + + Use this method to: + + - Remove access controls + - Revoke permissions + - Clean up policies + + ### Examples + + - Delete policy: + + Removes a group's access policy. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + groupId: "f53d2330-3795-4c5d-a1f3-453121af9c60" + ``` Args: group_id: group_id specifies the group_id identifier @@ -279,7 +347,25 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> PolicyCreateResponse: """ - CreateRunnerPolicy creates a new runner policy. + Creates a new policy for a runner. + + Use this method to: + + - Set up access controls + - Define group permissions + - Configure role-based access + + ### Examples + + - Create admin policy: + + Grants admin access to a group. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + groupId: "f53d2330-3795-4c5d-a1f3-453121af9c60" + role: RUNNER_ROLE_ADMIN + ``` Args: group_id: group_id specifies the group_id identifier @@ -324,7 +410,25 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> PolicyUpdateResponse: """ - UpdateRunnerPolicy an existing runner policy. + Updates an existing runner policy. + + Use this method to: + + - Modify access levels + - Change group roles + - Update permissions + + ### Examples + + - Update policy role: + + Changes a group's access level. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + groupId: "f53d2330-3795-4c5d-a1f3-453121af9c60" + role: RUNNER_ROLE_USER + ``` Args: group_id: group_id specifies the group_id identifier @@ -370,7 +474,25 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[RunnerPolicy, AsyncPoliciesPage[RunnerPolicy]]: """ - ListRunnerPolicies lists runner policies. + Lists policies for a runner. + + Use this method to: + + - View access controls + - Check policy configurations + - Audit permissions + + ### Examples + + - List policies: + + Shows all policies for a runner. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + pagination: + pageSize: 20 + ``` Args: pagination: pagination contains the pagination options for listing project policies @@ -425,7 +547,24 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - DeleteRunnerPolicy deletes a runner policy. + Deletes a runner policy. + + Use this method to: + + - Remove access controls + - Revoke permissions + - Clean up policies + + ### Examples + + - Delete policy: + + Removes a group's access policy. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + groupId: "f53d2330-3795-4c5d-a1f3-453121af9c60" + ``` Args: group_id: group_id specifies the group_id identifier diff --git a/src/gitpod/resources/runners/runners.py b/src/gitpod/resources/runners/runners.py index 66fc4e7..876c529 100644 --- a/src/gitpod/resources/runners/runners.py +++ b/src/gitpod/resources/runners/runners.py @@ -19,10 +19,7 @@ runner_check_authentication_for_host_params, ) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from .policies import ( PoliciesResource, AsyncPoliciesResource, @@ -96,6 +93,7 @@ def create( kind: RunnerKind | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, provider: RunnerProvider | NotGiven = NOT_GIVEN, + runner_manager_id: str | 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. @@ -104,20 +102,62 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RunnerCreateResponse: - """CreateRunner creates a new runner with the server. + """Creates a new runner registration with the server. Registrations are very - short-lived and must be renewed every 30 seconds. Runners can be registered for - an entire organisation or a single user. + short-lived and must be renewed every 30 seconds. + + Use this method to: + + - Register organization runners + - Set up runner configurations + - Initialize runner credentials + - Configure auto-updates + + ### Examples + + - Create cloud runner: + + Creates a new runner in AWS EC2. + + ```yaml + name: "Production Runner" + provider: RUNNER_PROVIDER_AWS_EC2 + spec: + desiredPhase: RUNNER_PHASE_ACTIVE + configuration: + region: "us-west" + releaseChannel: RUNNER_RELEASE_CHANNEL_STABLE + autoUpdate: true + ``` + + - Create local runner: + + Creates a new local runner on Linux. + + ```yaml + name: "Local Development Runner" + provider: RUNNER_PROVIDER_LINUX_HOST + spec: + desiredPhase: RUNNER_PHASE_ACTIVE + configuration: + releaseChannel: RUNNER_RELEASE_CHANNEL_LATEST + autoUpdate: true + ``` Args: - kind: RunnerKind represents the kind of a runner + kind: The runner's kind This field is optional and here for backwards-compatibility. + Use the provider field instead. If provider is set, the runner's kind will be + deduced from the provider. Only one of kind and provider must be set. name: The runner name for humans - provider: RunnerProvider identifies the specific implementation type of a runner. Each - provider maps to a specific kind of runner (local or remote), as specified below - for each provider. + provider: The specific implementation type of the runner This field is optional for + backwards compatibility but will be required in the future. When specified, kind + must not be specified (will be deduced from provider) + + runner_manager_id: The runner manager id specifies the runner manager for the managed runner. This + field is mandatory for managed runners, otheriwse should not be set. extra_headers: Send extra headers @@ -134,6 +174,7 @@ def create( "kind": kind, "name": name, "provider": provider, + "runner_manager_id": runner_manager_id, "spec": spec, }, runner_create_params.RunnerCreateParams, @@ -156,7 +197,24 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RunnerRetrieveResponse: """ - GetRunner returns a single runner. + Gets details about a specific runner. + + Use this method to: + + - Check runner status + - View runner configuration + - Monitor runner health + - Verify runner capabilities + + ### Examples + + - Get runner details: + + Retrieves information about a specific runner. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + ``` Args: extra_headers: Send extra headers @@ -190,7 +248,29 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - UpdateRunner updates an environment runner. + Updates a runner's configuration. + + Use this method to: + + - Modify runner settings + - Update release channels + - Change runner status + - Configure auto-update settings + + ### Examples + + - Update configuration: + + Changes runner settings. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + name: "Updated Runner Name" + spec: + configuration: + releaseChannel: RUNNER_RELEASE_CHANNEL_LATEST + autoUpdate: true + ``` Args: name: The runner's name which is shown to users @@ -238,7 +318,36 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncRunnersPage[Runner]: """ - ListRunners returns all runners registered in the scope. + Lists all registered runners with optional filtering. + + Use this method to: + + - View all available runners + - Filter by runner type + - Monitor runner status + - Check runner availability + + ### Examples + + - List all runners: + + Shows all runners with pagination. + + ```yaml + pagination: + pageSize: 20 + ``` + + - Filter by provider: + + Lists only AWS EC2 runners. + + ```yaml + filter: + providers: ["RUNNER_PROVIDER_AWS_EC2"] + pagination: + pageSize: 20 + ``` Args: pagination: pagination contains the pagination options for listing runners @@ -291,7 +400,23 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - DeleteRunner deletes an environment runner. + Deletes a runner permanently. + + Use this method to: + + - Remove unused runners + - Clean up runner registrations + - Delete obsolete runners + + ### Examples + + - Delete runner: + + Permanently removes a runner. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + ``` Args: force: force indicates whether the runner should be deleted forcefully. When force @@ -335,10 +460,23 @@ def check_authentication_for_host( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RunnerCheckAuthenticationForHostResponse: """ - CheckAuthenticationForHost asks a runner if the user is authenticated against a - particular host, e.g. an SCM system. If not, this function will return a URL - that the user should visit to authenticate, or indicate that Personal Access - Tokens are supported. + Checks if a user is authenticated for a specific host. + + Use this method to: + + - Verify authentication status + - Get authentication URLs + - Check PAT support + + ### Examples + + - Check authentication: + + Verifies authentication for a host. + + ```yaml + host: "github.com" + ``` Args: extra_headers: Send extra headers @@ -375,11 +513,26 @@ def create_runner_token( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RunnerCreateRunnerTokenResponse: - """CreateRunnerToken returns a token that can be used to authenticate as the - runner. + """ + Creates a new authentication token for a runner. + + Use this method to: + + - Generate runner credentials + - Renew expired tokens + - Set up runner authentication + + Note: This does not expire previously issued tokens. + + ### Examples + + - Create token: - Use this call to renew an outdated token - this does not expire any - previously issued tokens. + Creates a new token for runner authentication. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + ``` Args: extra_headers: Send extra headers @@ -414,18 +567,30 @@ def parse_context_url( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RunnerParseContextURLResponse: """ - ParseContextURL asks a runner to parse a context URL, and return the parsed - result. + Parses a context URL and returns the parsed result. + + Use this method to: + + - Validate context URLs + - Check repository access + - Verify branch existence + + Returns: + + - FAILED_PRECONDITION if authentication is required + - PERMISSION_DENIED if access is not allowed + - INVALID_ARGUMENT if URL is invalid + - NOT_FOUND if repository/branch doesn't exist + + ### Examples + + - Parse URL: - This call returns + Parses and validates a context URL. - - FAILED_PRECONDITION if the user requires authentication on the runner to - access the context URL - - PERMISSION_DENIED if the user is not allowed to access the context URL using - the credentials they have - - INVALID_ARGUMENT if the context URL is invalid - - NOT_FOUND if the repository or branch indicated by the context URL does not - exist + ```yaml + contextUrl: "https://github.com/org/repo/tree/main" + ``` Args: extra_headers: Send extra headers @@ -486,6 +651,7 @@ async def create( kind: RunnerKind | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, provider: RunnerProvider | NotGiven = NOT_GIVEN, + runner_manager_id: str | 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. @@ -494,20 +660,62 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RunnerCreateResponse: - """CreateRunner creates a new runner with the server. + """Creates a new runner registration with the server. Registrations are very - short-lived and must be renewed every 30 seconds. Runners can be registered for - an entire organisation or a single user. + short-lived and must be renewed every 30 seconds. + + Use this method to: + + - Register organization runners + - Set up runner configurations + - Initialize runner credentials + - Configure auto-updates + + ### Examples + + - Create cloud runner: + + Creates a new runner in AWS EC2. + + ```yaml + name: "Production Runner" + provider: RUNNER_PROVIDER_AWS_EC2 + spec: + desiredPhase: RUNNER_PHASE_ACTIVE + configuration: + region: "us-west" + releaseChannel: RUNNER_RELEASE_CHANNEL_STABLE + autoUpdate: true + ``` + + - Create local runner: + + Creates a new local runner on Linux. + + ```yaml + name: "Local Development Runner" + provider: RUNNER_PROVIDER_LINUX_HOST + spec: + desiredPhase: RUNNER_PHASE_ACTIVE + configuration: + releaseChannel: RUNNER_RELEASE_CHANNEL_LATEST + autoUpdate: true + ``` Args: - kind: RunnerKind represents the kind of a runner + kind: The runner's kind This field is optional and here for backwards-compatibility. + Use the provider field instead. If provider is set, the runner's kind will be + deduced from the provider. Only one of kind and provider must be set. name: The runner name for humans - provider: RunnerProvider identifies the specific implementation type of a runner. Each - provider maps to a specific kind of runner (local or remote), as specified below - for each provider. + provider: The specific implementation type of the runner This field is optional for + backwards compatibility but will be required in the future. When specified, kind + must not be specified (will be deduced from provider) + + runner_manager_id: The runner manager id specifies the runner manager for the managed runner. This + field is mandatory for managed runners, otheriwse should not be set. extra_headers: Send extra headers @@ -524,6 +732,7 @@ async def create( "kind": kind, "name": name, "provider": provider, + "runner_manager_id": runner_manager_id, "spec": spec, }, runner_create_params.RunnerCreateParams, @@ -546,7 +755,24 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RunnerRetrieveResponse: """ - GetRunner returns a single runner. + Gets details about a specific runner. + + Use this method to: + + - Check runner status + - View runner configuration + - Monitor runner health + - Verify runner capabilities + + ### Examples + + - Get runner details: + + Retrieves information about a specific runner. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + ``` Args: extra_headers: Send extra headers @@ -580,7 +806,29 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - UpdateRunner updates an environment runner. + Updates a runner's configuration. + + Use this method to: + + - Modify runner settings + - Update release channels + - Change runner status + - Configure auto-update settings + + ### Examples + + - Update configuration: + + Changes runner settings. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + name: "Updated Runner Name" + spec: + configuration: + releaseChannel: RUNNER_RELEASE_CHANNEL_LATEST + autoUpdate: true + ``` Args: name: The runner's name which is shown to users @@ -628,7 +876,36 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[Runner, AsyncRunnersPage[Runner]]: """ - ListRunners returns all runners registered in the scope. + Lists all registered runners with optional filtering. + + Use this method to: + + - View all available runners + - Filter by runner type + - Monitor runner status + - Check runner availability + + ### Examples + + - List all runners: + + Shows all runners with pagination. + + ```yaml + pagination: + pageSize: 20 + ``` + + - Filter by provider: + + Lists only AWS EC2 runners. + + ```yaml + filter: + providers: ["RUNNER_PROVIDER_AWS_EC2"] + pagination: + pageSize: 20 + ``` Args: pagination: pagination contains the pagination options for listing runners @@ -681,7 +958,23 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> object: """ - DeleteRunner deletes an environment runner. + Deletes a runner permanently. + + Use this method to: + + - Remove unused runners + - Clean up runner registrations + - Delete obsolete runners + + ### Examples + + - Delete runner: + + Permanently removes a runner. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + ``` Args: force: force indicates whether the runner should be deleted forcefully. When force @@ -725,10 +1018,23 @@ async def check_authentication_for_host( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RunnerCheckAuthenticationForHostResponse: """ - CheckAuthenticationForHost asks a runner if the user is authenticated against a - particular host, e.g. an SCM system. If not, this function will return a URL - that the user should visit to authenticate, or indicate that Personal Access - Tokens are supported. + Checks if a user is authenticated for a specific host. + + Use this method to: + + - Verify authentication status + - Get authentication URLs + - Check PAT support + + ### Examples + + - Check authentication: + + Verifies authentication for a host. + + ```yaml + host: "github.com" + ``` Args: extra_headers: Send extra headers @@ -765,11 +1071,26 @@ async def create_runner_token( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RunnerCreateRunnerTokenResponse: - """CreateRunnerToken returns a token that can be used to authenticate as the - runner. + """ + Creates a new authentication token for a runner. + + Use this method to: + + - Generate runner credentials + - Renew expired tokens + - Set up runner authentication + + Note: This does not expire previously issued tokens. + + ### Examples + + - Create token: - Use this call to renew an outdated token - this does not expire any - previously issued tokens. + Creates a new token for runner authentication. + + ```yaml + runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + ``` Args: extra_headers: Send extra headers @@ -804,18 +1125,30 @@ async def parse_context_url( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RunnerParseContextURLResponse: """ - ParseContextURL asks a runner to parse a context URL, and return the parsed - result. + Parses a context URL and returns the parsed result. + + Use this method to: + + - Validate context URLs + - Check repository access + - Verify branch existence + + Returns: + + - FAILED_PRECONDITION if authentication is required + - PERMISSION_DENIED if access is not allowed + - INVALID_ARGUMENT if URL is invalid + - NOT_FOUND if repository/branch doesn't exist + + ### Examples + + - Parse URL: - This call returns + Parses and validates a context URL. - - FAILED_PRECONDITION if the user requires authentication on the runner to - access the context URL - - PERMISSION_DENIED if the user is not allowed to access the context URL using - the credentials they have - - INVALID_ARGUMENT if the context URL is invalid - - NOT_FOUND if the repository or branch indicated by the context URL does not - exist + ```yaml + contextUrl: "https://github.com/org/repo/tree/main" + ``` Args: extra_headers: Send extra headers diff --git a/src/gitpod/resources/secrets.py b/src/gitpod/resources/secrets.py index 53c051b..42c8485 100644 --- a/src/gitpod/resources/secrets.py +++ b/src/gitpod/resources/secrets.py @@ -12,10 +12,7 @@ secret_update_value_params, ) from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -27,6 +24,7 @@ from ..pagination import SyncSecretsPage, AsyncSecretsPage from .._base_client import AsyncPaginator, make_request_options from ..types.secret import Secret +from ..types.secret_scope_param import SecretScopeParam from ..types.secret_create_response import SecretCreateResponse from ..types.secret_get_value_response import SecretGetValueResponse @@ -61,6 +59,7 @@ def create( file_path: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, project_id: str | NotGiven = NOT_GIVEN, + scope: SecretScopeParam | 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. @@ -128,7 +127,9 @@ def create( this.matches("^/(?:[^/]*/)*.*$") ``` - project_id: project_id is the ProjectID this Secret belongs to + project_id: project_id is the ProjectID this Secret belongs to Deprecated: use scope instead + + scope: scope is the scope of the secret value: value is the plaintext value of the secret @@ -149,6 +150,7 @@ def create( "file_path": file_path, "name": name, "project_id": project_id, + "scope": scope, "value": value, }, secret_create_params.SecretCreateParams, @@ -174,12 +176,12 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncSecretsPage[Secret]: """ - Lists secrets with optional filtering. + Lists secrets Use this method to: - View all project secrets - - Filter secrets by project + - View all user secrets ### Examples @@ -189,7 +191,20 @@ def list( ```yaml filter: - projectIds: ["b0e12f6c-4c67-429d-a4a6-d9838b5da047"] + scope: + projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + pagination: + pageSize: 20 + ``` + + - List user secrets: + + Shows all secrets for a user. + + ```yaml + filter: + scope: + userId: "123e4567-e89b-12d3-a456-426614174000" pagination: pageSize: 20 ``` @@ -414,6 +429,7 @@ async def create( file_path: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, project_id: str | NotGiven = NOT_GIVEN, + scope: SecretScopeParam | 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. @@ -481,7 +497,9 @@ async def create( this.matches("^/(?:[^/]*/)*.*$") ``` - project_id: project_id is the ProjectID this Secret belongs to + project_id: project_id is the ProjectID this Secret belongs to Deprecated: use scope instead + + scope: scope is the scope of the secret value: value is the plaintext value of the secret @@ -502,6 +520,7 @@ async def create( "file_path": file_path, "name": name, "project_id": project_id, + "scope": scope, "value": value, }, secret_create_params.SecretCreateParams, @@ -527,12 +546,12 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[Secret, AsyncSecretsPage[Secret]]: """ - Lists secrets with optional filtering. + Lists secrets Use this method to: - View all project secrets - - Filter secrets by project + - View all user secrets ### Examples @@ -542,7 +561,20 @@ def list( ```yaml filter: - projectIds: ["b0e12f6c-4c67-429d-a4a6-d9838b5da047"] + scope: + projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + pagination: + pageSize: 20 + ``` + + - List user secrets: + + Shows all secrets for a user. + + ```yaml + filter: + scope: + userId: "123e4567-e89b-12d3-a456-426614174000" pagination: pageSize: 20 ``` diff --git a/src/gitpod/resources/usage.py b/src/gitpod/resources/usage.py new file mode 100644 index 0000000..71c698e --- /dev/null +++ b/src/gitpod/resources/usage.py @@ -0,0 +1,258 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..types import usage_list_environment_runtime_records_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..pagination import SyncRecordsPage, AsyncRecordsPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.environment_usage_record import EnvironmentUsageRecord + +__all__ = ["UsageResource", "AsyncUsageResource"] + + +class UsageResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> UsageResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/gitpod-io/gitpod-sdk-python#accessing-raw-response-data-eg-headers + """ + return UsageResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> UsageResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/gitpod-io/gitpod-sdk-python#with_streaming_response + """ + return UsageResourceWithStreamingResponse(self) + + def list_environment_runtime_records( + self, + *, + token: str | NotGiven = NOT_GIVEN, + page_size: int | NotGiven = NOT_GIVEN, + filter: usage_list_environment_runtime_records_params.Filter | NotGiven = NOT_GIVEN, + pagination: usage_list_environment_runtime_records_params.Pagination | 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, + ) -> SyncRecordsPage[EnvironmentUsageRecord]: + """ + Lists completed environment runtime records within a specified date range. + + Returns a list of environment runtime records that were completed within the + specified date range. Records of currently running environments are not + included. + + Use this method to: + + - View environment runtime records + - Filter by project + - Create custom usage reports + + ### Example + + ```yaml + filter: + projectId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + dateRange: + startTime: "2024-01-01T00:00:00Z" + endTime: "2024-01-02T00:00:00Z" + pagination: + pageSize: 100 + ``` + + Args: + filter: Filter options. + + pagination: Pagination options. + + 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 + """ + return self._get_api_list( + "/gitpod.v1.UsageService/ListEnvironmentUsageRecords", + page=SyncRecordsPage[EnvironmentUsageRecord], + body=maybe_transform( + { + "filter": filter, + "pagination": pagination, + }, + usage_list_environment_runtime_records_params.UsageListEnvironmentRuntimeRecordsParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "token": token, + "page_size": page_size, + }, + usage_list_environment_runtime_records_params.UsageListEnvironmentRuntimeRecordsParams, + ), + ), + model=EnvironmentUsageRecord, + method="post", + ) + + +class AsyncUsageResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncUsageResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/gitpod-io/gitpod-sdk-python#accessing-raw-response-data-eg-headers + """ + return AsyncUsageResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncUsageResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/gitpod-io/gitpod-sdk-python#with_streaming_response + """ + return AsyncUsageResourceWithStreamingResponse(self) + + def list_environment_runtime_records( + self, + *, + token: str | NotGiven = NOT_GIVEN, + page_size: int | NotGiven = NOT_GIVEN, + filter: usage_list_environment_runtime_records_params.Filter | NotGiven = NOT_GIVEN, + pagination: usage_list_environment_runtime_records_params.Pagination | 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[EnvironmentUsageRecord, AsyncRecordsPage[EnvironmentUsageRecord]]: + """ + Lists completed environment runtime records within a specified date range. + + Returns a list of environment runtime records that were completed within the + specified date range. Records of currently running environments are not + included. + + Use this method to: + + - View environment runtime records + - Filter by project + - Create custom usage reports + + ### Example + + ```yaml + filter: + projectId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + dateRange: + startTime: "2024-01-01T00:00:00Z" + endTime: "2024-01-02T00:00:00Z" + pagination: + pageSize: 100 + ``` + + Args: + filter: Filter options. + + pagination: Pagination options. + + 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 + """ + return self._get_api_list( + "/gitpod.v1.UsageService/ListEnvironmentUsageRecords", + page=AsyncRecordsPage[EnvironmentUsageRecord], + body=maybe_transform( + { + "filter": filter, + "pagination": pagination, + }, + usage_list_environment_runtime_records_params.UsageListEnvironmentRuntimeRecordsParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "token": token, + "page_size": page_size, + }, + usage_list_environment_runtime_records_params.UsageListEnvironmentRuntimeRecordsParams, + ), + ), + model=EnvironmentUsageRecord, + method="post", + ) + + +class UsageResourceWithRawResponse: + def __init__(self, usage: UsageResource) -> None: + self._usage = usage + + self.list_environment_runtime_records = to_raw_response_wrapper( + usage.list_environment_runtime_records, + ) + + +class AsyncUsageResourceWithRawResponse: + def __init__(self, usage: AsyncUsageResource) -> None: + self._usage = usage + + self.list_environment_runtime_records = async_to_raw_response_wrapper( + usage.list_environment_runtime_records, + ) + + +class UsageResourceWithStreamingResponse: + def __init__(self, usage: UsageResource) -> None: + self._usage = usage + + self.list_environment_runtime_records = to_streamed_response_wrapper( + usage.list_environment_runtime_records, + ) + + +class AsyncUsageResourceWithStreamingResponse: + def __init__(self, usage: AsyncUsageResource) -> None: + self._usage = usage + + self.list_environment_runtime_records = async_to_streamed_response_wrapper( + usage.list_environment_runtime_records, + ) diff --git a/src/gitpod/resources/users/__init__.py b/src/gitpod/resources/users/__init__.py index c138e0b..7250286 100644 --- a/src/gitpod/resources/users/__init__.py +++ b/src/gitpod/resources/users/__init__.py @@ -16,8 +16,22 @@ UsersResourceWithStreamingResponse, AsyncUsersResourceWithStreamingResponse, ) +from .dotfiles import ( + DotfilesResource, + AsyncDotfilesResource, + DotfilesResourceWithRawResponse, + AsyncDotfilesResourceWithRawResponse, + DotfilesResourceWithStreamingResponse, + AsyncDotfilesResourceWithStreamingResponse, +) __all__ = [ + "DotfilesResource", + "AsyncDotfilesResource", + "DotfilesResourceWithRawResponse", + "AsyncDotfilesResourceWithRawResponse", + "DotfilesResourceWithStreamingResponse", + "AsyncDotfilesResourceWithStreamingResponse", "PatsResource", "AsyncPatsResource", "PatsResourceWithRawResponse", diff --git a/src/gitpod/resources/users/dotfiles.py b/src/gitpod/resources/users/dotfiles.py new file mode 100644 index 0000000..6e14987 --- /dev/null +++ b/src/gitpod/resources/users/dotfiles.py @@ -0,0 +1,313 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.users import dotfile_get_params, dotfile_set_params +from ..._base_client import make_request_options +from ...types.users.dotfile_get_response import DotfileGetResponse + +__all__ = ["DotfilesResource", "AsyncDotfilesResource"] + + +class DotfilesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> DotfilesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/gitpod-io/gitpod-sdk-python#accessing-raw-response-data-eg-headers + """ + return DotfilesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> DotfilesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/gitpod-io/gitpod-sdk-python#with_streaming_response + """ + return DotfilesResourceWithStreamingResponse(self) + + def get( + self, + *, + empty: 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, + ) -> DotfileGetResponse: + """ + Gets the dotfiles for a user. + + Use this method to: + + - Retrieve user dotfiles + + ### Examples + + - Get dotfiles: + + Retrieves the dotfiles for the current user. + + ```yaml + {} + ``` + + 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 + """ + return self._post( + "/gitpod.v1.UserService/GetDotfilesConfiguration", + body=maybe_transform({"empty": empty}, dotfile_get_params.DotfileGetParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DotfileGetResponse, + ) + + def set( + self, + *, + repository: 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: + """ + Sets the dotfiles configuration for a user. + + Use this method to: + + - Configure user dotfiles + - Update dotfiles settings + + ### Examples + + - Set dotfiles configuration: + + Sets the dotfiles configuration for the current user. + + ```yaml + { "repository": "https://github.com/gitpod-io/dotfiles" } + ``` + + - Remove dotfiles: + + Removes the dotfiles for the current user. + + ```yaml + {} + ``` + + 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 + """ + return self._post( + "/gitpod.v1.UserService/SetDotfilesConfiguration", + body=maybe_transform({"repository": repository}, dotfile_set_params.DotfileSetParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + +class AsyncDotfilesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncDotfilesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/gitpod-io/gitpod-sdk-python#accessing-raw-response-data-eg-headers + """ + return AsyncDotfilesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncDotfilesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/gitpod-io/gitpod-sdk-python#with_streaming_response + """ + return AsyncDotfilesResourceWithStreamingResponse(self) + + async def get( + self, + *, + empty: 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, + ) -> DotfileGetResponse: + """ + Gets the dotfiles for a user. + + Use this method to: + + - Retrieve user dotfiles + + ### Examples + + - Get dotfiles: + + Retrieves the dotfiles for the current user. + + ```yaml + {} + ``` + + 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 + """ + return await self._post( + "/gitpod.v1.UserService/GetDotfilesConfiguration", + body=await async_maybe_transform({"empty": empty}, dotfile_get_params.DotfileGetParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DotfileGetResponse, + ) + + async def set( + self, + *, + repository: 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: + """ + Sets the dotfiles configuration for a user. + + Use this method to: + + - Configure user dotfiles + - Update dotfiles settings + + ### Examples + + - Set dotfiles configuration: + + Sets the dotfiles configuration for the current user. + + ```yaml + { "repository": "https://github.com/gitpod-io/dotfiles" } + ``` + + - Remove dotfiles: + + Removes the dotfiles for the current user. + + ```yaml + {} + ``` + + 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 + """ + return await self._post( + "/gitpod.v1.UserService/SetDotfilesConfiguration", + body=await async_maybe_transform({"repository": repository}, dotfile_set_params.DotfileSetParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + +class DotfilesResourceWithRawResponse: + def __init__(self, dotfiles: DotfilesResource) -> None: + self._dotfiles = dotfiles + + self.get = to_raw_response_wrapper( + dotfiles.get, + ) + self.set = to_raw_response_wrapper( + dotfiles.set, + ) + + +class AsyncDotfilesResourceWithRawResponse: + def __init__(self, dotfiles: AsyncDotfilesResource) -> None: + self._dotfiles = dotfiles + + self.get = async_to_raw_response_wrapper( + dotfiles.get, + ) + self.set = async_to_raw_response_wrapper( + dotfiles.set, + ) + + +class DotfilesResourceWithStreamingResponse: + def __init__(self, dotfiles: DotfilesResource) -> None: + self._dotfiles = dotfiles + + self.get = to_streamed_response_wrapper( + dotfiles.get, + ) + self.set = to_streamed_response_wrapper( + dotfiles.set, + ) + + +class AsyncDotfilesResourceWithStreamingResponse: + def __init__(self, dotfiles: AsyncDotfilesResource) -> None: + self._dotfiles = dotfiles + + self.get = async_to_streamed_response_wrapper( + dotfiles.get, + ) + self.set = async_to_streamed_response_wrapper( + dotfiles.set, + ) diff --git a/src/gitpod/resources/users/pats.py b/src/gitpod/resources/users/pats.py index 1253895..95511b8 100644 --- a/src/gitpod/resources/users/pats.py +++ b/src/gitpod/resources/users/pats.py @@ -5,10 +5,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( diff --git a/src/gitpod/resources/users/users.py b/src/gitpod/resources/users/users.py index ab3e3c9..0ffe276 100644 --- a/src/gitpod/resources/users/users.py +++ b/src/gitpod/resources/users/users.py @@ -14,9 +14,14 @@ ) from ...types import user_set_suspended_params, user_get_authenticated_user_params from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, +from ..._utils import maybe_transform, async_maybe_transform +from .dotfiles import ( + DotfilesResource, + AsyncDotfilesResource, + DotfilesResourceWithRawResponse, + AsyncDotfilesResourceWithRawResponse, + DotfilesResourceWithStreamingResponse, + AsyncDotfilesResourceWithStreamingResponse, ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -33,6 +38,10 @@ class UsersResource(SyncAPIResource): + @cached_property + def dotfiles(self) -> DotfilesResource: + return DotfilesResource(self._client) + @cached_property def pats(self) -> PatsResource: return PatsResource(self._client) @@ -172,6 +181,10 @@ def set_suspended( class AsyncUsersResource(AsyncAPIResource): + @cached_property + def dotfiles(self) -> AsyncDotfilesResource: + return AsyncDotfilesResource(self._client) + @cached_property def pats(self) -> AsyncPatsResource: return AsyncPatsResource(self._client) @@ -323,6 +336,10 @@ def __init__(self, users: UsersResource) -> None: users.set_suspended, ) + @cached_property + def dotfiles(self) -> DotfilesResourceWithRawResponse: + return DotfilesResourceWithRawResponse(self._users.dotfiles) + @cached_property def pats(self) -> PatsResourceWithRawResponse: return PatsResourceWithRawResponse(self._users.pats) @@ -339,6 +356,10 @@ def __init__(self, users: AsyncUsersResource) -> None: users.set_suspended, ) + @cached_property + def dotfiles(self) -> AsyncDotfilesResourceWithRawResponse: + return AsyncDotfilesResourceWithRawResponse(self._users.dotfiles) + @cached_property def pats(self) -> AsyncPatsResourceWithRawResponse: return AsyncPatsResourceWithRawResponse(self._users.pats) @@ -355,6 +376,10 @@ def __init__(self, users: UsersResource) -> None: users.set_suspended, ) + @cached_property + def dotfiles(self) -> DotfilesResourceWithStreamingResponse: + return DotfilesResourceWithStreamingResponse(self._users.dotfiles) + @cached_property def pats(self) -> PatsResourceWithStreamingResponse: return PatsResourceWithStreamingResponse(self._users.pats) @@ -371,6 +396,10 @@ def __init__(self, users: AsyncUsersResource) -> None: users.set_suspended, ) + @cached_property + def dotfiles(self) -> AsyncDotfilesResourceWithStreamingResponse: + return AsyncDotfilesResourceWithStreamingResponse(self._users.dotfiles) + @cached_property def pats(self) -> AsyncPatsResourceWithStreamingResponse: return AsyncPatsResourceWithStreamingResponse(self._users.pats) diff --git a/src/gitpod/types/__init__.py b/src/gitpod/types/__init__.py index 49ac2a0..cfa1c5d 100644 --- a/src/gitpod/types/__init__.py +++ b/src/gitpod/types/__init__.py @@ -4,13 +4,13 @@ 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 ( Task as Task, RunsOn as RunsOn, + Gateway as Gateway, Subject as Subject, TaskSpec as TaskSpec, ErrorCode as ErrorCode, @@ -29,11 +29,14 @@ ) from .account import Account as Account from .project import Project as Project +from .log_level import LogLevel as LogLevel from .environment import Environment as Environment from .runner_kind import RunnerKind as RunnerKind from .runner_spec import RunnerSpec as RunnerSpec +from .gateway_info import GatewayInfo as GatewayInfo from .organization import Organization as Organization from .runner_phase import RunnerPhase as RunnerPhase +from .secret_scope import SecretScope as SecretScope from .resource_type import ResourceType as ResourceType from .runner_status import RunnerStatus as RunnerStatus from .invite_domains import InviteDomains as InviteDomains @@ -41,10 +44,12 @@ from .admission_level import AdmissionLevel as AdmissionLevel from .runner_provider import RunnerProvider as RunnerProvider from .environment_spec import EnvironmentSpec as EnvironmentSpec +from .id_token_version import IDTokenVersion as IDTokenVersion 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 .organization_tier import OrganizationTier as OrganizationTier from .runner_capability import RunnerCapability as RunnerCapability from .runner_spec_param import RunnerSpecParam as RunnerSpecParam from .account_membership import AccountMembership as AccountMembership @@ -54,7 +59,9 @@ from .resource_operation import ResourceOperation as ResourceOperation from .runner_list_params import RunnerListParams as RunnerListParams from .secret_list_params import SecretListParams as SecretListParams +from .secret_scope_param import SecretScopeParam as SecretScopeParam from .event_list_response import EventListResponse as EventListResponse +from .gateway_list_params import GatewayListParams as GatewayListParams from .organization_member import OrganizationMember as OrganizationMember from .project_list_params import ProjectListParams as ProjectListParams from .environment_metadata import EnvironmentMetadata as EnvironmentMetadata @@ -68,6 +75,7 @@ from .secret_delete_params import SecretDeleteParams as SecretDeleteParams from .account_delete_params import AccountDeleteParams as AccountDeleteParams from .joinable_organization import JoinableOrganization as JoinableOrganization +from .metrics_configuration import MetricsConfiguration as MetricsConfiguration from .project_create_params import ProjectCreateParams as ProjectCreateParams from .project_delete_params import ProjectDeleteParams as ProjectDeleteParams from .project_update_params import ProjectUpdateParams as ProjectUpdateParams @@ -87,8 +95,8 @@ from .secret_get_value_params import SecretGetValueParams as SecretGetValueParams from .editor_retrieve_response import EditorRetrieveResponse as EditorRetrieveResponse from .environment_start_params import EnvironmentStartParams as EnvironmentStartParams +from .environment_usage_record import EnvironmentUsageRecord as EnvironmentUsageRecord from .organization_join_params import OrganizationJoinParams as OrganizationJoinParams -from .organization_list_params import OrganizationListParams as OrganizationListParams from .runner_retrieve_response import RunnerRetrieveResponse as RunnerRetrieveResponse from .account_retrieve_response import AccountRetrieveResponse as AccountRetrieveResponse from .editor_resolve_url_params import EditorResolveURLParams as EditorResolveURLParams @@ -110,6 +118,8 @@ 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 .metrics_configuration_param import MetricsConfigurationParam as MetricsConfigurationParam +from .environment_unarchive_params import EnvironmentUnarchiveParams as EnvironmentUnarchiveParams from .identity_get_id_token_params import IdentityGetIDTokenParams as IdentityGetIDTokenParams from .organization_create_response import OrganizationCreateResponse as OrganizationCreateResponse from .organization_retrieve_params import OrganizationRetrieveParams as OrganizationRetrieveParams @@ -150,15 +160,30 @@ from .project_create_from_environment_response import ( ProjectCreateFromEnvironmentResponse as ProjectCreateFromEnvironmentResponse, ) +from .account_list_joinable_organizations_params import ( + AccountListJoinableOrganizationsParams as AccountListJoinableOrganizationsParams, +) from .identity_get_authenticated_identity_params import ( IdentityGetAuthenticatedIdentityParams as IdentityGetAuthenticatedIdentityParams, ) +from .environment_create_environment_token_params import ( + EnvironmentCreateEnvironmentTokenParams as EnvironmentCreateEnvironmentTokenParams, +) from .runner_check_authentication_for_host_params import ( RunnerCheckAuthenticationForHostParams as RunnerCheckAuthenticationForHostParams, ) +from .account_list_joinable_organizations_response import ( + AccountListJoinableOrganizationsResponse as AccountListJoinableOrganizationsResponse, +) from .identity_get_authenticated_identity_response import ( IdentityGetAuthenticatedIdentityResponse as IdentityGetAuthenticatedIdentityResponse, ) +from .environment_create_environment_token_response import ( + EnvironmentCreateEnvironmentTokenResponse as EnvironmentCreateEnvironmentTokenResponse, +) from .runner_check_authentication_for_host_response import ( RunnerCheckAuthenticationForHostResponse as RunnerCheckAuthenticationForHostResponse, ) +from .usage_list_environment_runtime_records_params import ( + UsageListEnvironmentRuntimeRecordsParams as UsageListEnvironmentRuntimeRecordsParams, +) diff --git a/src/gitpod/types/account.py b/src/gitpod/types/account.py index f84d864..41ee046 100644 --- a/src/gitpod/types/account.py +++ b/src/gitpod/types/account.py @@ -206,6 +206,7 @@ class Account(BaseModel): avatar_url: Optional[str] = FieldInfo(alias="avatarUrl", default=None) joinables: Optional[List[JoinableOrganization]] = None + """joinables is deprecated. Use ListJoinableOrganizations instead.""" memberships: Optional[List[AccountMembership]] = None diff --git a/src/gitpod/types/account_get_sso_login_url_response.py b/src/gitpod/types/account_get_sso_login_url_response.py index 192a5fc..fd289cd 100644 --- a/src/gitpod/types/account_get_sso_login_url_response.py +++ b/src/gitpod/types/account_get_sso_login_url_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from pydantic import Field as FieldInfo from .._models import BaseModel diff --git a/src/gitpod/types/account_list_joinable_organizations_params.py b/src/gitpod/types/account_list_joinable_organizations_params.py new file mode 100644 index 0000000..d4531fb --- /dev/null +++ b/src/gitpod/types/account_list_joinable_organizations_params.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__ = ["AccountListJoinableOrganizationsParams"] + + +class AccountListJoinableOrganizationsParams(TypedDict, total=False): + token: str + + page_size: Annotated[int, PropertyInfo(alias="pageSize")] + + empty: bool diff --git a/src/gitpod/types/account_list_joinable_organizations_response.py b/src/gitpod/types/account_list_joinable_organizations_response.py new file mode 100644 index 0000000..3253ba5 --- /dev/null +++ b/src/gitpod/types/account_list_joinable_organizations_response.py @@ -0,0 +1,16 @@ +# 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 .joinable_organization import JoinableOrganization + +__all__ = ["AccountListJoinableOrganizationsResponse"] + + +class AccountListJoinableOrganizationsResponse(BaseModel): + joinable_organizations: Optional[List[JoinableOrganization]] = FieldInfo( + alias="joinableOrganizations", default=None + ) diff --git a/src/gitpod/types/account_retrieve_response.py b/src/gitpod/types/account_retrieve_response.py index 2768a2d..c32afbb 100644 --- a/src/gitpod/types/account_retrieve_response.py +++ b/src/gitpod/types/account_retrieve_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from .account import Account from .._models import BaseModel diff --git a/src/gitpod/types/editor_list_params.py b/src/gitpod/types/editor_list_params.py index 1318467..42f9426 100644 --- a/src/gitpod/types/editor_list_params.py +++ b/src/gitpod/types/editor_list_params.py @@ -6,7 +6,7 @@ from .._utils import PropertyInfo -__all__ = ["EditorListParams", "Pagination"] +__all__ = ["EditorListParams", "Filter", "Pagination"] class EditorListParams(TypedDict, total=False): @@ -14,10 +14,21 @@ class EditorListParams(TypedDict, total=False): page_size: Annotated[int, PropertyInfo(alias="pageSize")] + filter: Filter + """filter contains the filter options for listing editors""" + pagination: Pagination """pagination contains the pagination options for listing environments""" +class Filter(TypedDict, total=False): + allowed_by_policy: Annotated[bool, PropertyInfo(alias="allowedByPolicy")] + """ + allowed_by_policy filters the response to only editors that are allowed by the + policies enforced in the organization + """ + + class Pagination(TypedDict, total=False): token: str """ diff --git a/src/gitpod/types/editor_resolve_url_response.py b/src/gitpod/types/editor_resolve_url_response.py index f22f8cb..9633464 100644 --- a/src/gitpod/types/editor_resolve_url_response.py +++ b/src/gitpod/types/editor_resolve_url_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from .._models import BaseModel __all__ = ["EditorResolveURLResponse"] diff --git a/src/gitpod/types/editor_retrieve_response.py b/src/gitpod/types/editor_retrieve_response.py index fa5bbe9..0a40810 100644 --- a/src/gitpod/types/editor_retrieve_response.py +++ b/src/gitpod/types/editor_retrieve_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from .editor import Editor from .._models import BaseModel diff --git a/src/gitpod/types/environment.py b/src/gitpod/types/environment.py index 5dd6728..560cf25 100644 --- a/src/gitpod/types/environment.py +++ b/src/gitpod/types/environment.py @@ -20,15 +20,15 @@ class Environment(BaseModel): metadata: Optional[EnvironmentMetadata] = None """ - EnvironmentMetadata is data associated with an environment that's required for - other parts of the system to function + Metadata is data associated with this environment that's required for other + parts of Gitpod to function """ spec: Optional[EnvironmentSpec] = None """ - EnvironmentSpec specifies the configuration of an environment for an environment - start + Spec is the configuration of the environment that's required for the runner to + start the environment """ status: Optional[EnvironmentStatus] = None - """EnvironmentStatus describes an environment status""" + """Status is the current status of the environment""" diff --git a/src/gitpod/types/environment_activity_signal.py b/src/gitpod/types/environment_activity_signal.py index ea825be..afedc99 100644 --- a/src/gitpod/types/environment_activity_signal.py +++ b/src/gitpod/types/environment_activity_signal.py @@ -18,92 +18,6 @@ class EnvironmentActivitySignal(BaseModel): timestamp: Optional[datetime] = None """ - A Timestamp represents a point in time independent of any time zone or local - calendar, encoded as a count of seconds and fractions of seconds at nanosecond - resolution. The count is relative to an epoch at UTC midnight on January 1, - 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - backwards to year one. - - All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - second table is needed for interpretation, using a - [24-hour linear smear](https://developers.google.com/time/smear). - - The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - restricting to that range, we ensure that we can convert to and from - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - - # Examples - - Example 1: Compute Timestamp from POSIX `time()`. - - Timestamp timestamp; - timestamp.set_seconds(time(NULL)); - timestamp.set_nanos(0); - - Example 2: Compute Timestamp from POSIX `gettimeofday()`. - - struct timeval tv; - gettimeofday(&tv, NULL); - - Timestamp timestamp; - timestamp.set_seconds(tv.tv_sec); - timestamp.set_nanos(tv.tv_usec * 1000); - - Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - - FILETIME ft; - GetSystemTimeAsFileTime(&ft); - UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - - // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - Timestamp timestamp; - timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - - Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - - long millis = System.currentTimeMillis(); - - Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - .setNanos((int) ((millis % 1000) * 1000000)).build(); - - Example 5: Compute Timestamp from Java `Instant.now()`. - - Instant now = Instant.now(); - - Timestamp timestamp = - Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - .setNanos(now.getNano()).build(); - - Example 6: Compute Timestamp from current time in Python. - - timestamp = Timestamp() - timestamp.GetCurrentTime() - - # JSON Mapping - - In JSON format, the Timestamp type is encoded as a string in the - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - zero-padded to two digits each. The fractional seconds, which can go up to 9 - digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - serializer should always use UTC (as indicated by "Z") when printing the - Timestamp type and a proto3 JSON parser should be able to accept both UTC and - other timezones (as indicated by an offset). - - For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - January 15, 2017. - - In JavaScript, one can convert a Date object to this format using the standard - [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - method. In Python, a standard `datetime.datetime` object can be converted to - this format using - [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - Joda Time's - [`ISODateTimeFormat.dateTime()`]() - to obtain a formatter capable of generating timestamps in this format. + timestamp of when the activity was observed by the source. Only reported every 5 + minutes. Zero value means no activity was observed. """ diff --git a/src/gitpod/types/environment_activity_signal_param.py b/src/gitpod/types/environment_activity_signal_param.py index d097493..a9cb0c1 100644 --- a/src/gitpod/types/environment_activity_signal_param.py +++ b/src/gitpod/types/environment_activity_signal_param.py @@ -21,92 +21,6 @@ class EnvironmentActivitySignalParam(TypedDict, total=False): timestamp: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] """ - A Timestamp represents a point in time independent of any time zone or local - calendar, encoded as a count of seconds and fractions of seconds at nanosecond - resolution. The count is relative to an epoch at UTC midnight on January 1, - 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - backwards to year one. - - All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - second table is needed for interpretation, using a - [24-hour linear smear](https://developers.google.com/time/smear). - - The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - restricting to that range, we ensure that we can convert to and from - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - - # Examples - - Example 1: Compute Timestamp from POSIX `time()`. - - Timestamp timestamp; - timestamp.set_seconds(time(NULL)); - timestamp.set_nanos(0); - - Example 2: Compute Timestamp from POSIX `gettimeofday()`. - - struct timeval tv; - gettimeofday(&tv, NULL); - - Timestamp timestamp; - timestamp.set_seconds(tv.tv_sec); - timestamp.set_nanos(tv.tv_usec * 1000); - - Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - - FILETIME ft; - GetSystemTimeAsFileTime(&ft); - UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - - // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - Timestamp timestamp; - timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - - Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - - long millis = System.currentTimeMillis(); - - Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - .setNanos((int) ((millis % 1000) * 1000000)).build(); - - Example 5: Compute Timestamp from Java `Instant.now()`. - - Instant now = Instant.now(); - - Timestamp timestamp = - Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - .setNanos(now.getNano()).build(); - - Example 6: Compute Timestamp from current time in Python. - - timestamp = Timestamp() - timestamp.GetCurrentTime() - - # JSON Mapping - - In JSON format, the Timestamp type is encoded as a string in the - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - zero-padded to two digits each. The fractional seconds, which can go up to 9 - digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - serializer should always use UTC (as indicated by "Z") when printing the - Timestamp type and a proto3 JSON parser should be able to accept both UTC and - other timezones (as indicated by an offset). - - For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - January 15, 2017. - - In JavaScript, one can convert a Date object to this format using the standard - [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - method. In Python, a standard `datetime.datetime` object can be converted to - this format using - [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - Joda Time's - [`ISODateTimeFormat.dateTime()`]() - to obtain a formatter capable of generating timestamps in this format. + timestamp of when the activity was observed by the source. Only reported every 5 + minutes. Zero value means no activity was observed. """ diff --git a/src/gitpod/types/environment_create_environment_token_params.py b/src/gitpod/types/environment_create_environment_token_params.py new file mode 100644 index 0000000..cf7fdd1 --- /dev/null +++ b/src/gitpod/types/environment_create_environment_token_params.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 Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["EnvironmentCreateEnvironmentTokenParams"] + + +class EnvironmentCreateEnvironmentTokenParams(TypedDict, total=False): + environment_id: Required[Annotated[str, PropertyInfo(alias="environmentId")]] + """ + environment_id specifies the environment for which the access token should be + created. + """ diff --git a/src/gitpod/types/environment_create_environment_token_response.py b/src/gitpod/types/environment_create_environment_token_response.py new file mode 100644 index 0000000..64b74d7 --- /dev/null +++ b/src/gitpod/types/environment_create_environment_token_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["EnvironmentCreateEnvironmentTokenResponse"] + + +class EnvironmentCreateEnvironmentTokenResponse(BaseModel): + access_token: str = FieldInfo(alias="accessToken") + """access_token is the token that can be used for environment authentication""" diff --git a/src/gitpod/types/environment_create_from_project_params.py b/src/gitpod/types/environment_create_from_project_params.py index d8d6092..2c9806f 100644 --- a/src/gitpod/types/environment_create_from_project_params.py +++ b/src/gitpod/types/environment_create_from_project_params.py @@ -15,6 +15,7 @@ class EnvironmentCreateFromProjectParams(TypedDict, total=False): spec: EnvironmentSpecParam """ - EnvironmentSpec specifies the configuration of an environment for an environment - start + Spec is the configuration of the environment that's required for the runner to + start the environment Configuration already defined in the Project will override + parts of the spec, if set """ diff --git a/src/gitpod/types/environment_create_from_project_response.py b/src/gitpod/types/environment_create_from_project_response.py index 7c66870..3390ce0 100644 --- a/src/gitpod/types/environment_create_from_project_response.py +++ b/src/gitpod/types/environment_create_from_project_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from .._models import BaseModel from .environment import Environment diff --git a/src/gitpod/types/environment_create_logs_token_response.py b/src/gitpod/types/environment_create_logs_token_response.py index 70f9c6a..c8a81b7 100644 --- a/src/gitpod/types/environment_create_logs_token_response.py +++ b/src/gitpod/types/environment_create_logs_token_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from pydantic import Field as FieldInfo from .._models import BaseModel diff --git a/src/gitpod/types/environment_create_params.py b/src/gitpod/types/environment_create_params.py index 33e65d8..e49a7d2 100644 --- a/src/gitpod/types/environment_create_params.py +++ b/src/gitpod/types/environment_create_params.py @@ -12,6 +12,6 @@ class EnvironmentCreateParams(TypedDict, total=False): spec: EnvironmentSpecParam """ - EnvironmentSpec specifies the configuration of an environment for an environment - start + spec is the configuration of the environment that's required for the to start + the environment """ diff --git a/src/gitpod/types/environment_create_response.py b/src/gitpod/types/environment_create_response.py index ac25a62..e3c53f0 100644 --- a/src/gitpod/types/environment_create_response.py +++ b/src/gitpod/types/environment_create_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from .._models import BaseModel from .environment import Environment diff --git a/src/gitpod/types/environment_initializer.py b/src/gitpod/types/environment_initializer.py index 8630b15..2a2866a 100644 --- a/src/gitpod/types/environment_initializer.py +++ b/src/gitpod/types/environment_initializer.py @@ -36,7 +36,7 @@ class SpecGit(BaseModel): "CLONE_TARGET_MODE_LOCAL_BRANCH", ] ] = FieldInfo(alias="targetMode", default=None) - """CloneTargetMode is the target state in which we want to leave a GitEnvironment""" + """the target mode determines what gets checked out""" upstream_remote_uri: Optional[str] = FieldInfo(alias="upstreamRemoteUri", default=None) """upstream_Remote_uri is the fork upstream of a repository""" diff --git a/src/gitpod/types/environment_initializer_param.py b/src/gitpod/types/environment_initializer_param.py index 32b0a64..695d836 100644 --- a/src/gitpod/types/environment_initializer_param.py +++ b/src/gitpod/types/environment_initializer_param.py @@ -37,7 +37,7 @@ class SpecGit(TypedDict, total=False): ], PropertyInfo(alias="targetMode"), ] - """CloneTargetMode is the target state in which we want to leave a GitEnvironment""" + """the target mode determines what gets checked out""" upstream_remote_uri: Annotated[str, PropertyInfo(alias="upstreamRemoteUri")] """upstream_Remote_uri is the fork upstream of a repository""" diff --git a/src/gitpod/types/environment_list_params.py b/src/gitpod/types/environment_list_params.py index 4fe1e4c..eedde71 100644 --- a/src/gitpod/types/environment_list_params.py +++ b/src/gitpod/types/environment_list_params.py @@ -2,8 +2,8 @@ from __future__ import annotations -from typing import List -from typing_extensions import Annotated, TypedDict +from typing import List, Optional +from typing_extensions import Literal, Annotated, TypedDict from .._utils import PropertyInfo from .runner_kind import RunnerKind @@ -24,6 +24,19 @@ class EnvironmentListParams(TypedDict, total=False): class Filter(TypedDict, total=False): + archival_status: Annotated[ + Optional[ + Literal[ + "ARCHIVAL_STATUS_UNSPECIFIED", + "ARCHIVAL_STATUS_ACTIVE", + "ARCHIVAL_STATUS_ARCHIVED", + "ARCHIVAL_STATUS_ALL", + ] + ], + PropertyInfo(alias="archivalStatus"), + ] + """archival_status filters the response based on environment archive status""" + creator_ids: Annotated[List[str], PropertyInfo(alias="creatorIds")] """ creator_ids filters the response to only Environments created by specified diff --git a/src/gitpod/types/environment_mark_active_params.py b/src/gitpod/types/environment_mark_active_params.py index 8e2cbce..0e10971 100644 --- a/src/gitpod/types/environment_mark_active_params.py +++ b/src/gitpod/types/environment_mark_active_params.py @@ -12,7 +12,7 @@ class EnvironmentMarkActiveParams(TypedDict, total=False): activity_signal: Annotated[EnvironmentActivitySignalParam, PropertyInfo(alias="activitySignal")] - """EnvironmentActivitySignal used to signal activity for an environment.""" + """activity_signal specifies the activity.""" environment_id: Annotated[str, PropertyInfo(alias="environmentId")] """The ID of the environment to update activity for.""" diff --git a/src/gitpod/types/environment_metadata.py b/src/gitpod/types/environment_metadata.py index 412b7ae..67090e0 100644 --- a/src/gitpod/types/environment_metadata.py +++ b/src/gitpod/types/environment_metadata.py @@ -18,191 +18,22 @@ class EnvironmentMetadata(BaseModel): +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)); + archived_at: Optional[datetime] = FieldInfo(alias="archivedAt", default=None) + """Time when the Environment was archived. - 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. + If not set, the environment is not archived. """ + created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) + """Time when the Environment was created.""" + creator: Optional[Subject] = None """creator is the identity of the creator of the environment""" last_started_at: Optional[datetime] = FieldInfo(alias="lastStartedAt", default=None) - """ - A Timestamp represents a point in time independent of any time zone or local - calendar, encoded as a count of seconds and fractions of seconds at nanosecond - resolution. The count is relative to an epoch at UTC midnight on January 1, - 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - backwards to year one. - - All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - second table is needed for interpretation, using a - [24-hour linear smear](https://developers.google.com/time/smear). - - The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - restricting to that range, we ensure that we can convert to and from - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - - # Examples - - Example 1: Compute Timestamp from POSIX `time()`. - - Timestamp timestamp; - timestamp.set_seconds(time(NULL)); - timestamp.set_nanos(0); - - Example 2: Compute Timestamp from POSIX `gettimeofday()`. - - struct timeval tv; - gettimeofday(&tv, NULL); - - Timestamp timestamp; - timestamp.set_seconds(tv.tv_sec); - timestamp.set_nanos(tv.tv_usec * 1000); - - Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - - FILETIME ft; - GetSystemTimeAsFileTime(&ft); - UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - - // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - Timestamp timestamp; - timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - - Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - - long millis = System.currentTimeMillis(); - - Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - .setNanos((int) ((millis % 1000) * 1000000)).build(); - - Example 5: Compute Timestamp from Java `Instant.now()`. - - Instant now = Instant.now(); - - Timestamp timestamp = - Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - .setNanos(now.getNano()).build(); - - Example 6: Compute Timestamp from current time in Python. - - timestamp = Timestamp() - timestamp.GetCurrentTime() - - # JSON Mapping - - In JSON format, the Timestamp type is encoded as a string in the - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - zero-padded to two digits each. The fractional seconds, which can go up to 9 - digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - serializer should always use UTC (as indicated by "Z") when printing the - Timestamp type and a proto3 JSON parser should be able to accept both UTC and - other timezones (as indicated by an offset). - - For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - January 15, 2017. + """Time when the Environment was last started (i.e. - In JavaScript, one can convert a Date object to this format using the standard - [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - method. In Python, a standard `datetime.datetime` object can be converted to - this format using - [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - Joda Time's - [`ISODateTimeFormat.dateTime()`]() - to obtain a formatter capable of generating timestamps in this format. + CreateEnvironment or StartEnvironment were called). """ name: Optional[str] = None diff --git a/src/gitpod/types/environment_retrieve_response.py b/src/gitpod/types/environment_retrieve_response.py index 0a3963b..1409d07 100644 --- a/src/gitpod/types/environment_retrieve_response.py +++ b/src/gitpod/types/environment_retrieve_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from .._models import BaseModel from .environment import Environment diff --git a/src/gitpod/types/environment_spec.py b/src/gitpod/types/environment_spec.py index b001bdc..a6ccaa6 100644 --- a/src/gitpod/types/environment_spec.py +++ b/src/gitpod/types/environment_spec.py @@ -46,7 +46,7 @@ class Content(BaseModel): """The Git username""" initializer: Optional[EnvironmentInitializer] = None - """EnvironmentInitializer specifies how an environment is to be initialized""" + """initializer configures how the environment is to be initialized""" session: Optional[str] = None @@ -55,22 +55,14 @@ class DevcontainerDotfiles(BaseModel): repository: str """URL of a dotfiles Git repository (e.g. https://github.com/owner/repository)""" - install_command: Optional[str] = FieldInfo(alias="installCommand", default=None) - """install_command is the command to run after cloning the dotfiles repository. - Defaults to run the first file of `install.sh`, `install`, `bootstrap.sh`, - `bootstrap`, `setup.sh` and `setup` found in the dotfiles repository's root - folder. +class Devcontainer(BaseModel): + default_devcontainer_image: Optional[str] = FieldInfo(alias="defaultDevcontainerImage", default=None) """ - - target_path: Optional[str] = FieldInfo(alias="targetPath", default=None) - """target_path is the path to clone the dotfiles repository to. - - Defaults to `~/dotfiles`. + default_devcontainer_image is the default image that is used to start the + devcontainer if no devcontainer config file is found """ - -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 @@ -96,7 +88,7 @@ class Machine(BaseModel): class Port(BaseModel): admission: Optional[AdmissionLevel] = None - """Admission level describes who can access an environment instance and its ports.""" + """policy of this port""" name: Optional[str] = None """name of this port""" @@ -106,6 +98,9 @@ class Port(BaseModel): class Secret(BaseModel): + id: Optional[str] = None + """id is the unique identifier of the secret.""" + container_registry_basic_auth_host: Optional[str] = FieldInfo(alias="containerRegistryBasicAuthHost", default=None) """ container_registry_basic_auth_host is the hostname of the container registry @@ -146,69 +141,14 @@ class SSHPublicKey(BaseModel): class Timeout(BaseModel): disconnected: Optional[str] = None """ - A Duration represents a signed, fixed-length span of time represented as a count - of seconds and fractions of seconds at nanosecond resolution. It is independent - of any calendar and concepts like "day" or "month". It is related to Timestamp - in that the difference between two Timestamp values is a Duration and it can be - added or subtracted from a Timestamp. Range is approximately +-10,000 years. - - # Examples - - Example 1: Compute Duration from two Timestamps in pseudo code. - - Timestamp start = ...; - Timestamp end = ...; - Duration duration = ...; - - duration.seconds = end.seconds - start.seconds; - duration.nanos = end.nanos - start.nanos; - - if (duration.seconds < 0 && duration.nanos > 0) { - duration.seconds += 1; - duration.nanos -= 1000000000; - } else if (duration.seconds > 0 && duration.nanos < 0) { - duration.seconds -= 1; - duration.nanos += 1000000000; - } - - Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. - - Timestamp start = ...; - Duration duration = ...; - Timestamp end = ...; - - end.seconds = start.seconds + duration.seconds; - end.nanos = start.nanos + duration.nanos; - - if (end.nanos < 0) { - end.seconds -= 1; - end.nanos += 1000000000; - } else if (end.nanos >= 1000000000) { - end.seconds += 1; - end.nanos -= 1000000000; - } - - Example 3: Compute Duration from datetime.timedelta in Python. - - td = datetime.timedelta(days=3, minutes=10) - duration = Duration() - duration.FromTimedelta(td) - - # JSON Mapping - - In JSON format, the Duration type is encoded as a string rather than an object, - where the string ends in the suffix "s" (indicating seconds) and is preceded by - the number of seconds, with nanoseconds expressed as fractional seconds. For - example, 3 seconds with 0 nanoseconds should be encoded in JSON format as "3s", - while 3 seconds and 1 nanosecond should be expressed in JSON format as - "3.000000001s", and 3 seconds and 1 microsecond should be expressed in JSON - format as "3.000001s". + inacitivity is the maximum time of disconnection before the environment is + stopped or paused. Minimum duration is 30 minutes. Set to 0 to disable. """ class EnvironmentSpec(BaseModel): admission: Optional[AdmissionLevel] = None - """Admission level describes who can access an environment instance and its ports.""" + """admission controlls who can access the environment and its ports.""" automations_file: Optional[AutomationsFile] = FieldInfo(alias="automationsFile", default=None) """automations_file is the automations file spec of the environment""" diff --git a/src/gitpod/types/environment_spec_param.py b/src/gitpod/types/environment_spec_param.py index 4853ee8..6e846a5 100644 --- a/src/gitpod/types/environment_spec_param.py +++ b/src/gitpod/types/environment_spec_param.py @@ -47,7 +47,7 @@ class Content(TypedDict, total=False): """The Git username""" initializer: EnvironmentInitializerParam - """EnvironmentInitializer specifies how an environment is to be initialized""" + """initializer configures how the environment is to be initialized""" session: str @@ -56,22 +56,14 @@ class DevcontainerDotfiles(TypedDict, total=False): repository: Required[str] """URL of a dotfiles Git repository (e.g. https://github.com/owner/repository)""" - install_command: Annotated[str, PropertyInfo(alias="installCommand")] - """install_command is the command to run after cloning the dotfiles repository. - Defaults to run the first file of `install.sh`, `install`, `bootstrap.sh`, - `bootstrap`, `setup.sh` and `setup` found in the dotfiles repository's root - folder. +class Devcontainer(TypedDict, total=False): + default_devcontainer_image: Annotated[str, PropertyInfo(alias="defaultDevcontainerImage")] """ - - target_path: Annotated[str, PropertyInfo(alias="targetPath")] - """target_path is the path to clone the dotfiles repository to. - - Defaults to `~/dotfiles`. + default_devcontainer_image is the default image that is used to start the + devcontainer if no devcontainer config file is found """ - -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 @@ -103,7 +95,7 @@ class Machine(_MachineReservedKeywords, total=False): class Port(TypedDict, total=False): admission: AdmissionLevel - """Admission level describes who can access an environment instance and its ports.""" + """policy of this port""" name: str """name of this port""" @@ -113,6 +105,9 @@ class Port(TypedDict, total=False): class Secret(TypedDict, total=False): + id: str + """id is the unique identifier of the secret.""" + container_registry_basic_auth_host: Annotated[str, PropertyInfo(alias="containerRegistryBasicAuthHost")] """ container_registry_basic_auth_host is the hostname of the container registry @@ -153,69 +148,14 @@ class SSHPublicKey(TypedDict, total=False): class Timeout(TypedDict, total=False): disconnected: str """ - A Duration represents a signed, fixed-length span of time represented as a count - of seconds and fractions of seconds at nanosecond resolution. It is independent - of any calendar and concepts like "day" or "month". It is related to Timestamp - in that the difference between two Timestamp values is a Duration and it can be - added or subtracted from a Timestamp. Range is approximately +-10,000 years. - - # Examples - - Example 1: Compute Duration from two Timestamps in pseudo code. - - Timestamp start = ...; - Timestamp end = ...; - Duration duration = ...; - - duration.seconds = end.seconds - start.seconds; - duration.nanos = end.nanos - start.nanos; - - if (duration.seconds < 0 && duration.nanos > 0) { - duration.seconds += 1; - duration.nanos -= 1000000000; - } else if (duration.seconds > 0 && duration.nanos < 0) { - duration.seconds -= 1; - duration.nanos += 1000000000; - } - - Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. - - Timestamp start = ...; - Duration duration = ...; - Timestamp end = ...; - - end.seconds = start.seconds + duration.seconds; - end.nanos = start.nanos + duration.nanos; - - if (end.nanos < 0) { - end.seconds -= 1; - end.nanos += 1000000000; - } else if (end.nanos >= 1000000000) { - end.seconds += 1; - end.nanos -= 1000000000; - } - - Example 3: Compute Duration from datetime.timedelta in Python. - - td = datetime.timedelta(days=3, minutes=10) - duration = Duration() - duration.FromTimedelta(td) - - # JSON Mapping - - In JSON format, the Duration type is encoded as a string rather than an object, - where the string ends in the suffix "s" (indicating seconds) and is preceded by - the number of seconds, with nanoseconds expressed as fractional seconds. For - example, 3 seconds with 0 nanoseconds should be encoded in JSON format as "3s", - while 3 seconds and 1 nanosecond should be expressed in JSON format as - "3.000000001s", and 3 seconds and 1 microsecond should be expressed in JSON - format as "3.000001s". + inacitivity is the maximum time of disconnection before the environment is + stopped or paused. Minimum duration is 30 minutes. Set to 0 to disable. """ class EnvironmentSpecParam(TypedDict, total=False): admission: AdmissionLevel - """Admission level describes who can access an environment instance and its ports.""" + """admission controlls who can access the environment and its ports.""" automations_file: Annotated[AutomationsFile, PropertyInfo(alias="automationsFile")] """automations_file is the automations file spec of the environment""" diff --git a/src/gitpod/types/environment_status.py b/src/gitpod/types/environment_status.py index 6fd1a83..4595543 100644 --- a/src/gitpod/types/environment_status.py +++ b/src/gitpod/types/environment_status.py @@ -66,6 +66,12 @@ class AutomationsFile(BaseModel): environment. """ + warning_message: Optional[str] = FieldInfo(alias="warningMessage", default=None) + """warning_message contains warnings, e.g. + + when no triggers are defined in the automations file. + """ + class ContentGitChangedFile(BaseModel): change_type: Optional[ @@ -297,6 +303,9 @@ class RunnerAck(BaseModel): class Secret(BaseModel): + id: Optional[str] = None + """id is the unique identifier of the secret.""" + failure_message: Optional[str] = FieldInfo(alias="failureMessage", default=None) """failure_message contains the reason the secret failed to be materialize.""" @@ -342,7 +351,7 @@ class SSHPublicKey(BaseModel): class EnvironmentStatus(BaseModel): activity_signal: Optional[EnvironmentActivitySignal] = FieldInfo(alias="activitySignal", default=None) - """EnvironmentActivitySignal used to signal activity for an environment.""" + """activity_signal is the last activity signal for the environment.""" automations_file: Optional[AutomationsFile] = FieldInfo(alias="automationsFile", default=None) """automations_file contains the status of the automations file.""" @@ -377,7 +386,7 @@ class EnvironmentStatus(BaseModel): runner_ack: Optional[RunnerAck] = FieldInfo(alias="runnerAck", default=None) """ - RunnerACK is the acknowledgement from the runner that is has received the + runner_ack contains the acknowledgement from the runner that is has received the environment spec. """ diff --git a/src/gitpod/types/environment_unarchive_params.py b/src/gitpod/types/environment_unarchive_params.py new file mode 100644 index 0000000..862c3be --- /dev/null +++ b/src/gitpod/types/environment_unarchive_params.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__ = ["EnvironmentUnarchiveParams"] + + +class EnvironmentUnarchiveParams(TypedDict, total=False): + environment_id: Annotated[str, PropertyInfo(alias="environmentId")] + """environment_id specifies the environment to unarchive. + + +required + """ diff --git a/src/gitpod/types/environment_update_params.py b/src/gitpod/types/environment_update_params.py index 9768d6b..60d7bfc 100644 --- a/src/gitpod/types/environment_update_params.py +++ b/src/gitpod/types/environment_update_params.py @@ -11,6 +11,7 @@ __all__ = [ "EnvironmentUpdateParams", + "Metadata", "Spec", "SpecAutomationsFile", "SpecContent", @@ -28,11 +29,16 @@ class EnvironmentUpdateParams(TypedDict, total=False): +required """ - metadata: Optional[object] + metadata: Optional[Metadata] spec: Optional[Spec] +class Metadata(TypedDict, total=False): + name: Optional[str] + """name is the user-defined display name of the environment""" + + class SpecAutomationsFile(TypedDict, total=False): automations_file_path: Annotated[Optional[str], PropertyInfo(alias="automationsFilePath")] """ @@ -56,7 +62,7 @@ class SpecContent(TypedDict, total=False): """The Git username""" initializer: Optional[EnvironmentInitializerParam] - """EnvironmentInitializer specifies how an environment is to be initialized""" + """initializer configures how the environment is to be initialized""" session: Optional[str] """session should be changed to trigger a content reinitialization""" @@ -79,7 +85,7 @@ class SpecDevcontainer(TypedDict, total=False): class SpecPort(TypedDict, total=False): admission: AdmissionLevel - """Admission level describes who can access an environment instance and its ports.""" + """policy of this port""" name: str """name of this port""" @@ -102,63 +108,8 @@ class SpecSSHPublicKey(TypedDict, total=False): class SpecTimeout(TypedDict, total=False): disconnected: Optional[str] """ - A Duration represents a signed, fixed-length span of time represented as a count - of seconds and fractions of seconds at nanosecond resolution. It is independent - of any calendar and concepts like "day" or "month". It is related to Timestamp - in that the difference between two Timestamp values is a Duration and it can be - added or subtracted from a Timestamp. Range is approximately +-10,000 years. - - # Examples - - Example 1: Compute Duration from two Timestamps in pseudo code. - - Timestamp start = ...; - Timestamp end = ...; - Duration duration = ...; - - duration.seconds = end.seconds - start.seconds; - duration.nanos = end.nanos - start.nanos; - - if (duration.seconds < 0 && duration.nanos > 0) { - duration.seconds += 1; - duration.nanos -= 1000000000; - } else if (duration.seconds > 0 && duration.nanos < 0) { - duration.seconds -= 1; - duration.nanos += 1000000000; - } - - Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. - - Timestamp start = ...; - Duration duration = ...; - Timestamp end = ...; - - end.seconds = start.seconds + duration.seconds; - end.nanos = start.nanos + duration.nanos; - - if (end.nanos < 0) { - end.seconds -= 1; - end.nanos += 1000000000; - } else if (end.nanos >= 1000000000) { - end.seconds += 1; - end.nanos -= 1000000000; - } - - Example 3: Compute Duration from datetime.timedelta in Python. - - td = datetime.timedelta(days=3, minutes=10) - duration = Duration() - duration.FromTimedelta(td) - - # JSON Mapping - - In JSON format, the Duration type is encoded as a string rather than an object, - where the string ends in the suffix "s" (indicating seconds) and is preceded by - the number of seconds, with nanoseconds expressed as fractional seconds. For - example, 3 seconds with 0 nanoseconds should be encoded in JSON format as "3s", - while 3 seconds and 1 nanosecond should be expressed in JSON format as - "3.000000001s", and 3 seconds and 1 microsecond should be expressed in JSON - format as "3.000001s". + inacitivity is the maximum time of disconnection before the environment is + stopped or paused. Minimum duration is 30 minutes. Set to 0 to disable. """ diff --git a/src/gitpod/types/environment_usage_record.py b/src/gitpod/types/environment_usage_record.py new file mode 100644 index 0000000..59c85a7 --- /dev/null +++ b/src/gitpod/types/environment_usage_record.py @@ -0,0 +1,39 @@ +# 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 + +__all__ = ["EnvironmentUsageRecord"] + + +class EnvironmentUsageRecord(BaseModel): + id: Optional[str] = None + """Environment usage record ID.""" + + created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) + """Time when the environment was created.""" + + environment_class_id: Optional[str] = FieldInfo(alias="environmentClassId", default=None) + """Environment class ID associated with the record.""" + + environment_id: Optional[str] = FieldInfo(alias="environmentId", default=None) + """Environment ID associated with the record.""" + + project_id: Optional[str] = FieldInfo(alias="projectId", default=None) + """Project ID associated with the environment (if available).""" + + runner_id: Optional[str] = FieldInfo(alias="runnerId", default=None) + """Runner ID associated with the environment.""" + + stopped_at: Optional[datetime] = FieldInfo(alias="stoppedAt", default=None) + """Time when the environment was stopped.""" + + user_id: Optional[str] = FieldInfo(alias="userId", default=None) + """ + User ID is the ID of the user who created the environment associated with the + record. + """ diff --git a/src/gitpod/types/environments/automations/service_create_response.py b/src/gitpod/types/environments/automations/service_create_response.py index 79ceb84..0aa85db 100644 --- a/src/gitpod/types/environments/automations/service_create_response.py +++ b/src/gitpod/types/environments/automations/service_create_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from .service import Service from ...._models import BaseModel diff --git a/src/gitpod/types/environments/automations/service_metadata.py b/src/gitpod/types/environments/automations/service_metadata.py index b21e2c6..4555022 100644 --- a/src/gitpod/types/environments/automations/service_metadata.py +++ b/src/gitpod/types/environments/automations/service_metadata.py @@ -14,96 +14,7 @@ class ServiceMetadata(BaseModel): created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) - """ - A Timestamp represents a point in time independent of any time zone or local - calendar, encoded as a count of seconds and fractions of seconds at nanosecond - resolution. The count is relative to an epoch at UTC midnight on January 1, - 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - backwards to year one. - - All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - second table is needed for interpretation, using a - [24-hour linear smear](https://developers.google.com/time/smear). - - The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - restricting to that range, we ensure that we can convert to and from - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - - # Examples - - Example 1: Compute Timestamp from POSIX `time()`. - - Timestamp timestamp; - timestamp.set_seconds(time(NULL)); - timestamp.set_nanos(0); - - Example 2: Compute Timestamp from POSIX `gettimeofday()`. - - struct timeval tv; - gettimeofday(&tv, NULL); - - Timestamp timestamp; - timestamp.set_seconds(tv.tv_sec); - timestamp.set_nanos(tv.tv_usec * 1000); - - Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - - FILETIME ft; - GetSystemTimeAsFileTime(&ft); - UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - - // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - Timestamp timestamp; - timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - - Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - - long millis = System.currentTimeMillis(); - - Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - .setNanos((int) ((millis % 1000) * 1000000)).build(); - - Example 5: Compute Timestamp from Java `Instant.now()`. - - Instant now = Instant.now(); - - Timestamp timestamp = - Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - .setNanos(now.getNano()).build(); - - Example 6: Compute Timestamp from current time in Python. - - timestamp = Timestamp() - timestamp.GetCurrentTime() - - # JSON Mapping - - In JSON format, the Timestamp type is encoded as a string in the - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - zero-padded to two digits each. The fractional seconds, which can go up to 9 - digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - serializer should always use UTC (as indicated by "Z") when printing the - Timestamp type and a proto3 JSON parser should be able to accept both UTC and - other timezones (as indicated by an offset). - - For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - January 15, 2017. - - In JavaScript, one can convert a Date object to this format using the standard - [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - method. In Python, a standard `datetime.datetime` object can be converted to - this format using - [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - Joda Time's - [`ISODateTimeFormat.dateTime()`]() - to obtain a formatter capable of generating timestamps in this format. - """ + """created_at is the time the service was created.""" creator: Optional[Subject] = None """creator describes the principal who created the service.""" diff --git a/src/gitpod/types/environments/automations/service_metadata_param.py b/src/gitpod/types/environments/automations/service_metadata_param.py index 8599c69..669b250 100644 --- a/src/gitpod/types/environments/automations/service_metadata_param.py +++ b/src/gitpod/types/environments/automations/service_metadata_param.py @@ -15,96 +15,7 @@ class ServiceMetadataParam(TypedDict, total=False): created_at: Annotated[Union[str, datetime], PropertyInfo(alias="createdAt", format="iso8601")] - """ - A Timestamp represents a point in time independent of any time zone or local - calendar, encoded as a count of seconds and fractions of seconds at nanosecond - resolution. The count is relative to an epoch at UTC midnight on January 1, - 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - backwards to year one. - - All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - second table is needed for interpretation, using a - [24-hour linear smear](https://developers.google.com/time/smear). - - The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - restricting to that range, we ensure that we can convert to and from - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - - # Examples - - Example 1: Compute Timestamp from POSIX `time()`. - - Timestamp timestamp; - timestamp.set_seconds(time(NULL)); - timestamp.set_nanos(0); - - Example 2: Compute Timestamp from POSIX `gettimeofday()`. - - struct timeval tv; - gettimeofday(&tv, NULL); - - Timestamp timestamp; - timestamp.set_seconds(tv.tv_sec); - timestamp.set_nanos(tv.tv_usec * 1000); - - Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - - FILETIME ft; - GetSystemTimeAsFileTime(&ft); - UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - - // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - Timestamp timestamp; - timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - - Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - - long millis = System.currentTimeMillis(); - - Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - .setNanos((int) ((millis % 1000) * 1000000)).build(); - - Example 5: Compute Timestamp from Java `Instant.now()`. - - Instant now = Instant.now(); - - Timestamp timestamp = - Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - .setNanos(now.getNano()).build(); - - Example 6: Compute Timestamp from current time in Python. - - timestamp = Timestamp() - timestamp.GetCurrentTime() - - # JSON Mapping - - In JSON format, the Timestamp type is encoded as a string in the - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - zero-padded to two digits each. The fractional seconds, which can go up to 9 - digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - serializer should always use UTC (as indicated by "Z") when printing the - Timestamp type and a proto3 JSON parser should be able to accept both UTC and - other timezones (as indicated by an offset). - - For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - January 15, 2017. - - In JavaScript, one can convert a Date object to this format using the standard - [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - method. In Python, a standard `datetime.datetime` object can be converted to - this format using - [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - Joda Time's - [`ISODateTimeFormat.dateTime()`]() - to obtain a formatter capable of generating timestamps in this format. - """ + """created_at is the time the service was created.""" creator: Subject """creator describes the principal who created the service.""" diff --git a/src/gitpod/types/environments/automations/service_retrieve_response.py b/src/gitpod/types/environments/automations/service_retrieve_response.py index ecf9035..e377837 100644 --- a/src/gitpod/types/environments/automations/service_retrieve_response.py +++ b/src/gitpod/types/environments/automations/service_retrieve_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from .service import Service from ...._models import BaseModel diff --git a/src/gitpod/types/environments/automations/service_status.py b/src/gitpod/types/environments/automations/service_status.py index cfda3ec..b95049b 100644 --- a/src/gitpod/types/environments/automations/service_status.py +++ b/src/gitpod/types/environments/automations/service_status.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import Dict, Optional from pydantic import Field as FieldInfo @@ -21,6 +21,12 @@ class ServiceStatus(BaseModel): log_url: Optional[str] = FieldInfo(alias="logUrl", default=None) """log_url contains the URL at which the service logs can be accessed.""" + output: Optional[Dict[str, str]] = None + """ + output contains the output of the service. setting an output field to empty + string will unset it. + """ + phase: Optional[ServicePhase] = None """phase is the current phase of the service.""" diff --git a/src/gitpod/types/environments/automations/service_update_params.py b/src/gitpod/types/environments/automations/service_update_params.py index 80a22fb..3fba2a0 100644 --- a/src/gitpod/types/environments/automations/service_update_params.py +++ b/src/gitpod/types/environments/automations/service_update_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Iterable, Optional +from typing import Dict, Iterable, Optional from typing_extensions import Annotated, TypedDict from ...._utils import PropertyInfo @@ -64,6 +64,9 @@ class Status(TypedDict, total=False): log_url: Annotated[Optional[str], PropertyInfo(alias="logUrl")] + output: Dict[str, str] + """setting an output field to empty string will unset it.""" + phase: Optional[ServicePhase] session: Optional[str] diff --git a/src/gitpod/types/environments/automations/task_create_response.py b/src/gitpod/types/environments/automations/task_create_response.py index 5fbdae6..a00af2b 100644 --- a/src/gitpod/types/environments/automations/task_create_response.py +++ b/src/gitpod/types/environments/automations/task_create_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from ...._models import BaseModel from ...shared.task import Task diff --git a/src/gitpod/types/environments/automations/task_retrieve_response.py b/src/gitpod/types/environments/automations/task_retrieve_response.py index e65439b..546b7b0 100644 --- a/src/gitpod/types/environments/automations/task_retrieve_response.py +++ b/src/gitpod/types/environments/automations/task_retrieve_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from ...._models import BaseModel from ...shared.task import Task diff --git a/src/gitpod/types/environments/automations/task_start_response.py b/src/gitpod/types/environments/automations/task_start_response.py index 93ee370..bb0fb10 100644 --- a/src/gitpod/types/environments/automations/task_start_response.py +++ b/src/gitpod/types/environments/automations/task_start_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from pydantic import Field as FieldInfo from ...._models import BaseModel 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 58c5baa..59483ce 100644 --- a/src/gitpod/types/environments/automations/tasks/execution_retrieve_response.py +++ b/src/gitpod/types/environments/automations/tasks/execution_retrieve_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from pydantic import Field as FieldInfo from ....._models import BaseModel diff --git a/src/gitpod/types/gateway_info.py b/src/gitpod/types/gateway_info.py new file mode 100644 index 0000000..d8211a9 --- /dev/null +++ b/src/gitpod/types/gateway_info.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 .shared.gateway import Gateway + +__all__ = ["GatewayInfo"] + + +class GatewayInfo(BaseModel): + gateway: Optional[Gateway] = None + """Gateway represents a system gateway that provides access to services""" + + latency: Optional[str] = None + """latency is the round-trip time of the runner to the gateway in milliseconds.""" diff --git a/src/gitpod/types/organization_list_params.py b/src/gitpod/types/gateway_list_params.py similarity index 70% rename from src/gitpod/types/organization_list_params.py rename to src/gitpod/types/gateway_list_params.py index edecdc2..8afa467 100644 --- a/src/gitpod/types/organization_list_params.py +++ b/src/gitpod/types/gateway_list_params.py @@ -4,22 +4,18 @@ from typing_extensions import Annotated, TypedDict -from .scope import Scope from .._utils import PropertyInfo -__all__ = ["OrganizationListParams", "Pagination"] +__all__ = ["GatewayListParams", "Pagination"] -class OrganizationListParams(TypedDict, total=False): +class GatewayListParams(TypedDict, total=False): token: str page_size: Annotated[int, PropertyInfo(alias="pageSize")] pagination: Pagination - """pagination contains the pagination options for listing organizations""" - - scope: Scope - """scope is the scope of the organizations to list""" + """pagination contains the pagination options for listing gateways""" class Pagination(TypedDict, total=False): diff --git a/src/gitpod/types/id_token_version.py b/src/gitpod/types/id_token_version.py new file mode 100644 index 0000000..ecbfdba --- /dev/null +++ b/src/gitpod/types/id_token_version.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__ = ["IDTokenVersion"] + +IDTokenVersion: TypeAlias = Literal["ID_TOKEN_VERSION_UNSPECIFIED", "ID_TOKEN_VERSION_V1", "ID_TOKEN_VERSION_V2"] diff --git a/src/gitpod/types/identity_get_id_token_params.py b/src/gitpod/types/identity_get_id_token_params.py index e1d4c82..c5686ae 100644 --- a/src/gitpod/types/identity_get_id_token_params.py +++ b/src/gitpod/types/identity_get_id_token_params.py @@ -5,8 +5,13 @@ from typing import List from typing_extensions import TypedDict +from .id_token_version import IDTokenVersion + __all__ = ["IdentityGetIDTokenParams"] class IdentityGetIDTokenParams(TypedDict, total=False): audience: List[str] + + version: IDTokenVersion + """version is the version of the ID token.""" diff --git a/src/gitpod/types/log_level.py b/src/gitpod/types/log_level.py new file mode 100644 index 0000000..7f2abd1 --- /dev/null +++ b/src/gitpod/types/log_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__ = ["LogLevel"] + +LogLevel: TypeAlias = Literal[ + "LOG_LEVEL_UNSPECIFIED", "LOG_LEVEL_DEBUG", "LOG_LEVEL_INFO", "LOG_LEVEL_WARN", "LOG_LEVEL_ERROR" +] diff --git a/src/gitpod/types/metrics_configuration.py b/src/gitpod/types/metrics_configuration.py new file mode 100644 index 0000000..0f6a075 --- /dev/null +++ b/src/gitpod/types/metrics_configuration.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from .._models import BaseModel + +__all__ = ["MetricsConfiguration"] + + +class MetricsConfiguration(BaseModel): + enabled: Optional[bool] = None + """enabled indicates whether the runner should collect metrics""" + + password: Optional[str] = None + """password is the password to use for the metrics collector""" + + url: Optional[str] = None + """url is the URL of the metrics collector""" + + username: Optional[str] = None + """username is the username to use for the metrics collector""" diff --git a/src/gitpod/types/metrics_configuration_param.py b/src/gitpod/types/metrics_configuration_param.py new file mode 100644 index 0000000..252253e --- /dev/null +++ b/src/gitpod/types/metrics_configuration_param.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["MetricsConfigurationParam"] + + +class MetricsConfigurationParam(TypedDict, total=False): + enabled: bool + """enabled indicates whether the runner should collect metrics""" + + password: str + """password is the password to use for the metrics collector""" + + url: str + """url is the URL of the metrics collector""" + + username: str + """username is the username to use for the metrics collector""" diff --git a/src/gitpod/types/organization.py b/src/gitpod/types/organization.py index 4d5eaee..9ecda14 100644 --- a/src/gitpod/types/organization.py +++ b/src/gitpod/types/organization.py @@ -7,6 +7,7 @@ from .._models import BaseModel from .invite_domains import InviteDomains +from .organization_tier import OrganizationTier __all__ = ["Organization"] @@ -108,6 +109,9 @@ class Organization(BaseModel): name: str + tier: OrganizationTier + """The tier of the organization - free or enterprise""" + updated_at: datetime = FieldInfo(alias="updatedAt") """ A Timestamp represents a point in time independent of any time zone or local diff --git a/src/gitpod/types/organization_join_response.py b/src/gitpod/types/organization_join_response.py index f6a4f3d..78e8ff9 100644 --- a/src/gitpod/types/organization_join_response.py +++ b/src/gitpod/types/organization_join_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from .._models import BaseModel from .organization_member import OrganizationMember diff --git a/src/gitpod/types/organization_retrieve_response.py b/src/gitpod/types/organization_retrieve_response.py index 064ba4a..b557f52 100644 --- a/src/gitpod/types/organization_retrieve_response.py +++ b/src/gitpod/types/organization_retrieve_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from .._models import BaseModel from .organization import Organization diff --git a/src/gitpod/types/organization_tier.py b/src/gitpod/types/organization_tier.py new file mode 100644 index 0000000..ea000b2 --- /dev/null +++ b/src/gitpod/types/organization_tier.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__ = ["OrganizationTier"] + +OrganizationTier: TypeAlias = Literal[ + "ORGANIZATION_TIER_UNSPECIFIED", "ORGANIZATION_TIER_FREE", "ORGANIZATION_TIER_ENTERPRISE" +] diff --git a/src/gitpod/types/organization_update_response.py b/src/gitpod/types/organization_update_response.py index f5fcb1b..d904634 100644 --- a/src/gitpod/types/organization_update_response.py +++ b/src/gitpod/types/organization_update_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from .._models import BaseModel from .organization import Organization diff --git a/src/gitpod/types/organizations/__init__.py b/src/gitpod/types/organizations/__init__.py index 83301d7..edd5451 100644 --- a/src/gitpod/types/organizations/__init__.py +++ b/src/gitpod/types/organizations/__init__.py @@ -7,10 +7,14 @@ from .domain_verification import DomainVerification as DomainVerification from .organization_invite import OrganizationInvite as OrganizationInvite from .invite_create_params import InviteCreateParams as InviteCreateParams +from .policy_update_params import PolicyUpdateParams as PolicyUpdateParams +from .organization_policies import OrganizationPolicies as OrganizationPolicies from .invite_create_response import InviteCreateResponse as InviteCreateResponse from .invite_retrieve_params import InviteRetrieveParams as InviteRetrieveParams +from .policy_retrieve_params import PolicyRetrieveParams as PolicyRetrieveParams from .sso_configuration_state import SSOConfigurationState as SSOConfigurationState from .invite_retrieve_response import InviteRetrieveResponse as InviteRetrieveResponse +from .policy_retrieve_response import PolicyRetrieveResponse as PolicyRetrieveResponse from .domain_verification_state import DomainVerificationState as DomainVerificationState from .invite_get_summary_params import InviteGetSummaryParams as InviteGetSummaryParams from .invite_get_summary_response import InviteGetSummaryResponse as InviteGetSummaryResponse diff --git a/src/gitpod/types/organizations/domain_verification.py b/src/gitpod/types/organizations/domain_verification.py index abb3605..3d2e32a 100644 --- a/src/gitpod/types/organizations/domain_verification.py +++ b/src/gitpod/types/organizations/domain_verification.py @@ -20,6 +20,100 @@ class DomainVerification(BaseModel): state: DomainVerificationState + created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) + """ + A Timestamp represents a point in time independent of any time zone or local + calendar, encoded as a count of seconds and fractions of seconds at nanosecond + resolution. The count is relative to an epoch at UTC midnight on January 1, + 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar + backwards to year one. + + All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + second table is needed for interpretation, using a + [24-hour linear smear](https://developers.google.com/time/smear). + + The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + restricting to that range, we ensure that we can convert to and from + [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + + # Examples + + Example 1: Compute Timestamp from POSIX `time()`. + + Timestamp timestamp; + timestamp.set_seconds(time(NULL)); + timestamp.set_nanos(0); + + Example 2: Compute Timestamp from POSIX `gettimeofday()`. + + struct timeval tv; + gettimeofday(&tv, NULL); + + Timestamp timestamp; + timestamp.set_seconds(tv.tv_sec); + timestamp.set_nanos(tv.tv_usec * 1000); + + Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + + FILETIME ft; + GetSystemTimeAsFileTime(&ft); + UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + + // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + Timestamp timestamp; + timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + + Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + + long millis = System.currentTimeMillis(); + + Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + .setNanos((int) ((millis % 1000) * 1000000)).build(); + + Example 5: Compute Timestamp from Java `Instant.now()`. + + Instant now = Instant.now(); + + Timestamp timestamp = + Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + .setNanos(now.getNano()).build(); + + Example 6: Compute Timestamp from current time in Python. + + timestamp = Timestamp() + timestamp.GetCurrentTime() + + # JSON Mapping + + In JSON format, the Timestamp type is encoded as a string in the + [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is + "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always + expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are + zero-padded to two digits each. The fractional seconds, which can go up to 9 + digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix + indicates the timezone ("UTC"); the timezone is required. A proto3 JSON + serializer should always use UTC (as indicated by "Z") when printing the + Timestamp type and a proto3 JSON parser should be able to accept both UTC and + other timezones (as indicated by an offset). + + For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on + January 15, 2017. + + In JavaScript, one can convert a Date object to this format using the standard + [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + method. In Python, a standard `datetime.datetime` object can be converted to + this format using + [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the + time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the + Joda Time's + [`ISODateTimeFormat.dateTime()`]() + to obtain a formatter capable of generating timestamps in this format. + """ + + verification_token: Optional[str] = FieldInfo(alias="verificationToken", default=None) + verified_at: Optional[datetime] = FieldInfo(alias="verifiedAt", default=None) """ A Timestamp represents a point in time independent of any time zone or local diff --git a/src/gitpod/types/organizations/domain_verification_create_response.py b/src/gitpod/types/organizations/domain_verification_create_response.py index 548d08a..3429a61 100644 --- a/src/gitpod/types/organizations/domain_verification_create_response.py +++ b/src/gitpod/types/organizations/domain_verification_create_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from pydantic import Field as FieldInfo from ..._models import BaseModel diff --git a/src/gitpod/types/organizations/domain_verification_retrieve_response.py b/src/gitpod/types/organizations/domain_verification_retrieve_response.py index 88577d6..7f8d7e1 100644 --- a/src/gitpod/types/organizations/domain_verification_retrieve_response.py +++ b/src/gitpod/types/organizations/domain_verification_retrieve_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from pydantic import Field as FieldInfo from ..._models import BaseModel diff --git a/src/gitpod/types/organizations/domain_verification_verify_response.py b/src/gitpod/types/organizations/domain_verification_verify_response.py index 8d2c649..307656e 100644 --- a/src/gitpod/types/organizations/domain_verification_verify_response.py +++ b/src/gitpod/types/organizations/domain_verification_verify_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from pydantic import Field as FieldInfo from ..._models import BaseModel diff --git a/src/gitpod/types/organizations/invite_create_response.py b/src/gitpod/types/organizations/invite_create_response.py index 36297d0..9a00dac 100644 --- a/src/gitpod/types/organizations/invite_create_response.py +++ b/src/gitpod/types/organizations/invite_create_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from ..._models import BaseModel from .organization_invite import OrganizationInvite diff --git a/src/gitpod/types/organizations/invite_retrieve_response.py b/src/gitpod/types/organizations/invite_retrieve_response.py index aa4239f..d00f343 100644 --- a/src/gitpod/types/organizations/invite_retrieve_response.py +++ b/src/gitpod/types/organizations/invite_retrieve_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from ..._models import BaseModel from .organization_invite import OrganizationInvite diff --git a/src/gitpod/types/organizations/organization_invite.py b/src/gitpod/types/organizations/organization_invite.py index 3f8e7f1..b33984a 100644 --- a/src/gitpod/types/organizations/organization_invite.py +++ b/src/gitpod/types/organizations/organization_invite.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from pydantic import Field as FieldInfo from ..._models import BaseModel diff --git a/src/gitpod/types/organizations/organization_policies.py b/src/gitpod/types/organizations/organization_policies.py new file mode 100644 index 0000000..673c756 --- /dev/null +++ b/src/gitpod/types/organizations/organization_policies.py @@ -0,0 +1,72 @@ +# 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__ = ["OrganizationPolicies"] + + +class OrganizationPolicies(BaseModel): + allowed_editor_ids: List[str] = FieldInfo(alias="allowedEditorIds") + """ + allowed_editor_ids is the list of editor IDs that are allowed to be used in the + organization + """ + + allow_local_runners: bool = FieldInfo(alias="allowLocalRunners") + """ + allow_local_runners controls whether local runners are allowed to be used in the + organization + """ + + default_editor_id: str = FieldInfo(alias="defaultEditorId") + """ + default_editor_id is the default editor ID to be used when a user doesn't + specify one + """ + + default_environment_image: str = FieldInfo(alias="defaultEnvironmentImage") + """ + default_environment_image is the default container image when none is defined in + repo + """ + + maximum_environments_per_user: str = FieldInfo(alias="maximumEnvironmentsPerUser") + """ + maximum_environments_per_user limits total environments (running or stopped) per + user + """ + + maximum_running_environments_per_user: str = FieldInfo(alias="maximumRunningEnvironmentsPerUser") + """ + maximum_running_environments_per_user limits simultaneously running environments + per user + """ + + members_create_projects: bool = FieldInfo(alias="membersCreateProjects") + """members_create_projects controls whether members can create projects""" + + members_require_projects: bool = FieldInfo(alias="membersRequireProjects") + """ + members_require_projects controls whether environments can only be created from + projects by non-admin users + """ + + organization_id: str = FieldInfo(alias="organizationId") + """organization_id is the ID of the organization""" + + port_sharing_disabled: bool = FieldInfo(alias="portSharingDisabled") + """ + port_sharing_disabled controls whether port sharing is disabled in the + organization + """ + + maximum_environment_timeout: Optional[str] = FieldInfo(alias="maximumEnvironmentTimeout", default=None) + """ + maximum_environment_timeout controls the maximum timeout allowed for + environments in seconds. 0 means no limit (never). Minimum duration is 30 + minutes. + """ diff --git a/src/gitpod/types/organizations/policy_retrieve_params.py b/src/gitpod/types/organizations/policy_retrieve_params.py new file mode 100644 index 0000000..8c54248 --- /dev/null +++ b/src/gitpod/types/organizations/policy_retrieve_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["PolicyRetrieveParams"] + + +class PolicyRetrieveParams(TypedDict, total=False): + organization_id: Required[Annotated[str, PropertyInfo(alias="organizationId")]] + """organization_id is the ID of the organization to retrieve policies for""" diff --git a/src/gitpod/types/organizations/policy_retrieve_response.py b/src/gitpod/types/organizations/policy_retrieve_response.py new file mode 100644 index 0000000..c54a1e7 --- /dev/null +++ b/src/gitpod/types/organizations/policy_retrieve_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel +from .organization_policies import OrganizationPolicies + +__all__ = ["PolicyRetrieveResponse"] + + +class PolicyRetrieveResponse(BaseModel): + policies: OrganizationPolicies diff --git a/src/gitpod/types/organizations/policy_update_params.py b/src/gitpod/types/organizations/policy_update_params.py new file mode 100644 index 0000000..ca6b8ab --- /dev/null +++ b/src/gitpod/types/organizations/policy_update_params.py @@ -0,0 +1,75 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["PolicyUpdateParams"] + + +class PolicyUpdateParams(TypedDict, total=False): + organization_id: Required[Annotated[str, PropertyInfo(alias="organizationId")]] + """organization_id is the ID of the organization to update policies for""" + + allowed_editor_ids: Annotated[List[str], PropertyInfo(alias="allowedEditorIds")] + """ + allowed_editor_ids is the list of editor IDs that are allowed to be used in the + organization + """ + + allow_local_runners: Annotated[Optional[bool], PropertyInfo(alias="allowLocalRunners")] + """ + allow_local_runners controls whether local runners are allowed to be used in the + organization + """ + + default_editor_id: Annotated[Optional[str], PropertyInfo(alias="defaultEditorId")] + """ + default_editor_id is the default editor ID to be used when a user doesn't + specify one + """ + + default_environment_image: Annotated[Optional[str], PropertyInfo(alias="defaultEnvironmentImage")] + """ + default_environment_image is the default container image when none is defined in + repo + """ + + maximum_environments_per_user: Annotated[Optional[str], PropertyInfo(alias="maximumEnvironmentsPerUser")] + """ + maximum_environments_per_user limits total environments (running or stopped) per + user + """ + + maximum_environment_timeout: Annotated[Optional[str], PropertyInfo(alias="maximumEnvironmentTimeout")] + """ + maximum_environment_timeout controls the maximum timeout allowed for + environments in seconds. 0 means no limit (never). Minimum duration is 30 + minutes. + """ + + maximum_running_environments_per_user: Annotated[ + Optional[str], PropertyInfo(alias="maximumRunningEnvironmentsPerUser") + ] + """ + maximum_running_environments_per_user limits simultaneously running environments + per user + """ + + members_create_projects: Annotated[Optional[bool], PropertyInfo(alias="membersCreateProjects")] + """members_create_projects controls whether members can create projects""" + + members_require_projects: Annotated[Optional[bool], PropertyInfo(alias="membersRequireProjects")] + """ + members_require_projects controls whether environments can only be created from + projects by non-admin users + """ + + port_sharing_disabled: Annotated[Optional[bool], PropertyInfo(alias="portSharingDisabled")] + """ + port_sharing_disabled controls whether port sharing is disabled in the + organization + """ diff --git a/src/gitpod/types/organizations/sso_configuration_create_response.py b/src/gitpod/types/organizations/sso_configuration_create_response.py index 0a2da39..7e85bbe 100644 --- a/src/gitpod/types/organizations/sso_configuration_create_response.py +++ b/src/gitpod/types/organizations/sso_configuration_create_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from pydantic import Field as FieldInfo from ..._models import BaseModel diff --git a/src/gitpod/types/organizations/sso_configuration_retrieve_response.py b/src/gitpod/types/organizations/sso_configuration_retrieve_response.py index 9a1da1a..c5e0bd3 100644 --- a/src/gitpod/types/organizations/sso_configuration_retrieve_response.py +++ b/src/gitpod/types/organizations/sso_configuration_retrieve_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from pydantic import Field as FieldInfo from ..._models import BaseModel diff --git a/src/gitpod/types/project.py b/src/gitpod/types/project.py index 9fc31a9..80e2586 100644 --- a/src/gitpod/types/project.py +++ b/src/gitpod/types/project.py @@ -43,8 +43,14 @@ class Project(BaseModel): """ initializer: Optional[EnvironmentInitializer] = None - """EnvironmentInitializer specifies how an environment is to be initialized""" + """initializer is the content initializer""" metadata: Optional[ProjectMetadata] = None + technical_description: Optional[str] = FieldInfo(alias="technicalDescription", default=None) + """ + technical_description is a detailed technical description of the project This + field is not returned by default in GetProject or ListProjects responses + """ + used_by: Optional[UsedBy] = FieldInfo(alias="usedBy", default=None) diff --git a/src/gitpod/types/project_create_params.py b/src/gitpod/types/project_create_params.py index cb04ea5..ff3b8b2 100644 --- a/src/gitpod/types/project_create_params.py +++ b/src/gitpod/types/project_create_params.py @@ -15,7 +15,7 @@ class ProjectCreateParams(TypedDict, total=False): environment_class: Required[Annotated[ProjectEnvironmentClassParam, PropertyInfo(alias="environmentClass")]] initializer: Required[EnvironmentInitializerParam] - """EnvironmentInitializer specifies how an environment is to be initialized""" + """initializer is the content initializer""" automations_file_path: Annotated[str, PropertyInfo(alias="automationsFilePath")] """ @@ -38,3 +38,9 @@ class ProjectCreateParams(TypedDict, total=False): """ name: str + + technical_description: Annotated[str, PropertyInfo(alias="technicalDescription")] + """ + technical_description is a detailed technical description of the project This + field is not returned by default in GetProject or ListProjects responses 8KB max + """ diff --git a/src/gitpod/types/project_list_params.py b/src/gitpod/types/project_list_params.py index 3d2202d..4709a7b 100644 --- a/src/gitpod/types/project_list_params.py +++ b/src/gitpod/types/project_list_params.py @@ -2,11 +2,12 @@ from __future__ import annotations +from typing import List from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo -__all__ = ["ProjectListParams", "Pagination"] +__all__ = ["ProjectListParams", "Filter", "Pagination"] class ProjectListParams(TypedDict, total=False): @@ -14,10 +15,17 @@ class ProjectListParams(TypedDict, total=False): page_size: Annotated[int, PropertyInfo(alias="pageSize")] + filter: Filter + pagination: Pagination """pagination contains the pagination options for listing organizations""" +class Filter(TypedDict, total=False): + project_ids: Annotated[List[str], PropertyInfo(alias="projectIds")] + """project_ids filters the response to only projects with these IDs""" + + class Pagination(TypedDict, total=False): token: str """ diff --git a/src/gitpod/types/project_update_params.py b/src/gitpod/types/project_update_params.py index c22d35e..214d3fa 100644 --- a/src/gitpod/types/project_update_params.py +++ b/src/gitpod/types/project_update_params.py @@ -36,9 +36,15 @@ class ProjectUpdateParams(TypedDict, total=False): environment_class: Annotated[Optional[ProjectEnvironmentClassParam], PropertyInfo(alias="environmentClass")] initializer: Optional[EnvironmentInitializerParam] - """EnvironmentInitializer specifies how an environment is to be initialized""" + """initializer is the content initializer""" name: Optional[str] project_id: Annotated[str, PropertyInfo(alias="projectId")] """project_id specifies the project identifier""" + + technical_description: Annotated[Optional[str], PropertyInfo(alias="technicalDescription")] + """ + technical_description is a detailed technical description of the project This + field is not returned by default in GetProject or ListProjects responses 8KB max + """ diff --git a/src/gitpod/types/resource_type.py b/src/gitpod/types/resource_type.py index ed64eee..c273d47 100644 --- a/src/gitpod/types/resource_type.py +++ b/src/gitpod/types/resource_type.py @@ -24,4 +24,10 @@ "RESOURCE_TYPE_SECRET", "RESOURCE_TYPE_SSO_CONFIG", "RESOURCE_TYPE_DOMAIN_VERIFICATION", + "RESOURCE_TYPE_AGENT_EXECUTION", + "RESOURCE_TYPE_RUNNER_LLM_INTEGRATION", + "RESOURCE_TYPE_AGENT", + "RESOURCE_TYPE_ENVIRONMENT_SESSION", + "RESOURCE_TYPE_USER_SECRET", + "RESOURCE_TYPE_ORGANIZATION_POLICY", ] diff --git a/src/gitpod/types/runner.py b/src/gitpod/types/runner.py index 505ab36..ec169a3 100644 --- a/src/gitpod/types/runner.py +++ b/src/gitpod/types/runner.py @@ -17,112 +17,19 @@ class Runner(BaseModel): created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) - """ - A Timestamp represents a point in time independent of any time zone or local - calendar, encoded as a count of seconds and fractions of seconds at nanosecond - resolution. The count is relative to an epoch at UTC midnight on January 1, - 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - backwards to year one. - - All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - second table is needed for interpretation, using a - [24-hour linear smear](https://developers.google.com/time/smear). - - The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - restricting to that range, we ensure that we can convert to and from - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - - # Examples - - Example 1: Compute Timestamp from POSIX `time()`. - - Timestamp timestamp; - timestamp.set_seconds(time(NULL)); - timestamp.set_nanos(0); - - Example 2: Compute Timestamp from POSIX `gettimeofday()`. - - struct timeval tv; - gettimeofday(&tv, NULL); - - Timestamp timestamp; - timestamp.set_seconds(tv.tv_sec); - timestamp.set_nanos(tv.tv_usec * 1000); - - Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - - FILETIME ft; - GetSystemTimeAsFileTime(&ft); - UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - - // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - Timestamp timestamp; - timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - - Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - - long millis = System.currentTimeMillis(); - - Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - .setNanos((int) ((millis % 1000) * 1000000)).build(); - - Example 5: Compute Timestamp from Java `Instant.now()`. - - Instant now = Instant.now(); - - Timestamp timestamp = - Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - .setNanos(now.getNano()).build(); - - Example 6: Compute Timestamp from current time in Python. - - timestamp = Timestamp() - timestamp.GetCurrentTime() - - # JSON Mapping - - In JSON format, the Timestamp type is encoded as a string in the - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - zero-padded to two digits each. The fractional seconds, which can go up to 9 - digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - serializer should always use UTC (as indicated by "Z") when printing the - Timestamp type and a proto3 JSON parser should be able to accept both UTC and - other timezones (as indicated by an offset). - - For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - January 15, 2017. - - In JavaScript, one can convert a Date object to this format using the standard - [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - method. In Python, a standard `datetime.datetime` object can be converted to - this format using - [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - Joda Time's - [`ISODateTimeFormat.dateTime()`]() - to obtain a formatter capable of generating timestamps in this format. - """ + """Time when the Runner was created.""" creator: Optional[Subject] = None """creator is the identity of the creator of the environment""" kind: Optional[RunnerKind] = None - """RunnerKind represents the kind of a runner""" + """The runner's kind""" name: Optional[str] = None """The runner's name which is shown to users""" provider: Optional[RunnerProvider] = None - """ - RunnerProvider identifies the specific implementation type of a runner. Each - provider maps to a specific kind of runner (local or remote), as specified below - for each provider. - """ + """The runner's provider""" runner_id: Optional[str] = FieldInfo(alias="runnerId", default=None) @@ -130,96 +37,7 @@ class Runner(BaseModel): """The runner's specification""" status: Optional[RunnerStatus] = None - """RunnerStatus represents the status of a runner""" + """The runner's status""" updated_at: Optional[datetime] = FieldInfo(alias="updatedAt", default=None) - """ - A Timestamp represents a point in time independent of any time zone or local - calendar, encoded as a count of seconds and fractions of seconds at nanosecond - resolution. The count is relative to an epoch at UTC midnight on January 1, - 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - backwards to year one. - - All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - second table is needed for interpretation, using a - [24-hour linear smear](https://developers.google.com/time/smear). - - The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - restricting to that range, we ensure that we can convert to and from - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - - # Examples - - Example 1: Compute Timestamp from POSIX `time()`. - - Timestamp timestamp; - timestamp.set_seconds(time(NULL)); - timestamp.set_nanos(0); - - Example 2: Compute Timestamp from POSIX `gettimeofday()`. - - struct timeval tv; - gettimeofday(&tv, NULL); - - Timestamp timestamp; - timestamp.set_seconds(tv.tv_sec); - timestamp.set_nanos(tv.tv_usec * 1000); - - Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - - FILETIME ft; - GetSystemTimeAsFileTime(&ft); - UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - - // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - Timestamp timestamp; - timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - - Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - - long millis = System.currentTimeMillis(); - - Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - .setNanos((int) ((millis % 1000) * 1000000)).build(); - - Example 5: Compute Timestamp from Java `Instant.now()`. - - Instant now = Instant.now(); - - Timestamp timestamp = - Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - .setNanos(now.getNano()).build(); - - Example 6: Compute Timestamp from current time in Python. - - timestamp = Timestamp() - timestamp.GetCurrentTime() - - # JSON Mapping - - In JSON format, the Timestamp type is encoded as a string in the - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - zero-padded to two digits each. The fractional seconds, which can go up to 9 - digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - serializer should always use UTC (as indicated by "Z") when printing the - Timestamp type and a proto3 JSON parser should be able to accept both UTC and - other timezones (as indicated by an offset). - - For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - January 15, 2017. - - In JavaScript, one can convert a Date object to this format using the standard - [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - method. In Python, a standard `datetime.datetime` object can be converted to - this format using - [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - Joda Time's - [`ISODateTimeFormat.dateTime()`]() - to obtain a formatter capable of generating timestamps in this format. - """ + """Time when the Runner was last udpated.""" diff --git a/src/gitpod/types/runner_capability.py b/src/gitpod/types/runner_capability.py index 261e033..0a66872 100644 --- a/src/gitpod/types/runner_capability.py +++ b/src/gitpod/types/runner_capability.py @@ -8,4 +8,7 @@ "RUNNER_CAPABILITY_UNSPECIFIED", "RUNNER_CAPABILITY_FETCH_LOCAL_SCM_INTEGRATIONS", "RUNNER_CAPABILITY_SECRET_CONTAINER_REGISTRY", + "RUNNER_CAPABILITY_AGENT_EXECUTION", + "RUNNER_CAPABILITY_ALLOW_ENV_TOKEN_POPULATION", + "RUNNER_CAPABILITY_DEFAULT_DEV_CONTAINER_IMAGE", ] diff --git a/src/gitpod/types/runner_configuration.py b/src/gitpod/types/runner_configuration.py index ebb3336..4f91d55 100644 --- a/src/gitpod/types/runner_configuration.py +++ b/src/gitpod/types/runner_configuration.py @@ -5,6 +5,8 @@ from pydantic import Field as FieldInfo from .._models import BaseModel +from .log_level import LogLevel +from .metrics_configuration import MetricsConfiguration from .runner_release_channel import RunnerReleaseChannel __all__ = ["RunnerConfiguration"] @@ -14,6 +16,19 @@ class RunnerConfiguration(BaseModel): auto_update: Optional[bool] = FieldInfo(alias="autoUpdate", default=None) """auto_update indicates whether the runner should automatically update itself.""" + devcontainer_image_cache_enabled: Optional[bool] = FieldInfo(alias="devcontainerImageCacheEnabled", default=None) + """ + devcontainer_image_cache_enabled controls whether the devcontainer build cache + is enabled for this runner. Only takes effect on supported runners, currently + only AWS EC2 runners. + """ + + log_level: Optional[LogLevel] = FieldInfo(alias="logLevel", default=None) + """log_level is the log level for the runner""" + + metrics: Optional[MetricsConfiguration] = None + """metrics contains configuration for the runner's metrics collection""" + region: Optional[str] = None """ Region to deploy the runner in, if applicable. This is mainly used for remote diff --git a/src/gitpod/types/runner_configuration_param.py b/src/gitpod/types/runner_configuration_param.py index 3f3b95b..7ba49ee 100644 --- a/src/gitpod/types/runner_configuration_param.py +++ b/src/gitpod/types/runner_configuration_param.py @@ -5,7 +5,9 @@ from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo +from .log_level import LogLevel from .runner_release_channel import RunnerReleaseChannel +from .metrics_configuration_param import MetricsConfigurationParam __all__ = ["RunnerConfigurationParam"] @@ -14,6 +16,19 @@ class RunnerConfigurationParam(TypedDict, total=False): auto_update: Annotated[bool, PropertyInfo(alias="autoUpdate")] """auto_update indicates whether the runner should automatically update itself.""" + devcontainer_image_cache_enabled: Annotated[bool, PropertyInfo(alias="devcontainerImageCacheEnabled")] + """ + devcontainer_image_cache_enabled controls whether the devcontainer build cache + is enabled for this runner. Only takes effect on supported runners, currently + only AWS EC2 runners. + """ + + log_level: Annotated[LogLevel, PropertyInfo(alias="logLevel")] + """log_level is the log level for the runner""" + + metrics: MetricsConfigurationParam + """metrics contains configuration for the runner's metrics collection""" + region: str """ Region to deploy the runner in, if applicable. This is mainly used for remote diff --git a/src/gitpod/types/runner_create_params.py b/src/gitpod/types/runner_create_params.py index fc5580f..6834fa3 100644 --- a/src/gitpod/types/runner_create_params.py +++ b/src/gitpod/types/runner_create_params.py @@ -2,8 +2,9 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing_extensions import Annotated, TypedDict +from .._utils import PropertyInfo from .runner_kind import RunnerKind from .runner_provider import RunnerProvider from .runner_spec_param import RunnerSpecParam @@ -13,16 +14,26 @@ class RunnerCreateParams(TypedDict, total=False): kind: RunnerKind - """RunnerKind represents the kind of a runner""" + """The runner's kind This field is optional and here for backwards-compatibility. + + Use the provider field instead. If provider is set, the runner's kind will be + deduced from the provider. Only one of kind and provider must be set. + """ name: str """The runner name for humans""" provider: RunnerProvider """ - RunnerProvider identifies the specific implementation type of a runner. Each - provider maps to a specific kind of runner (local or remote), as specified below - for each provider. + The specific implementation type of the runner This field is optional for + backwards compatibility but will be required in the future. When specified, kind + must not be specified (will be deduced from provider) + """ + + runner_manager_id: Annotated[str, PropertyInfo(alias="runnerManagerId")] + """ + The runner manager id specifies the runner manager for the managed runner. This + field is mandatory for managed runners, otheriwse should not be set. """ spec: RunnerSpecParam diff --git a/src/gitpod/types/runner_parse_context_url_response.py b/src/gitpod/types/runner_parse_context_url_response.py index f51e857..e34f770 100644 --- a/src/gitpod/types/runner_parse_context_url_response.py +++ b/src/gitpod/types/runner_parse_context_url_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import List, Optional from pydantic import Field as FieldInfo @@ -29,3 +29,6 @@ class RunnerParseContextURLResponse(BaseModel): git: Optional[Git] = None original_context_url: Optional[str] = FieldInfo(alias="originalContextUrl", default=None) + + project_ids: Optional[List[str]] = FieldInfo(alias="projectIds", default=None) + """project_ids is a list of projects to which the context URL belongs to.""" diff --git a/src/gitpod/types/runner_provider.py b/src/gitpod/types/runner_provider.py index 371260b..8f8efef 100644 --- a/src/gitpod/types/runner_provider.py +++ b/src/gitpod/types/runner_provider.py @@ -9,4 +9,5 @@ "RUNNER_PROVIDER_AWS_EC2", "RUNNER_PROVIDER_LINUX_HOST", "RUNNER_PROVIDER_DESKTOP_MAC", + "RUNNER_PROVIDER_MANAGED", ] diff --git a/src/gitpod/types/runner_retrieve_response.py b/src/gitpod/types/runner_retrieve_response.py index 1bda9f3..b4ec6d8 100644 --- a/src/gitpod/types/runner_retrieve_response.py +++ b/src/gitpod/types/runner_retrieve_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from .runner import Runner from .._models import BaseModel diff --git a/src/gitpod/types/runner_status.py b/src/gitpod/types/runner_status.py index e516dcb..a302c70 100644 --- a/src/gitpod/types/runner_status.py +++ b/src/gitpod/types/runner_status.py @@ -6,6 +6,7 @@ from pydantic import Field as FieldInfo from .._models import BaseModel +from .gateway_info import GatewayInfo from .runner_phase import RunnerPhase from .runner_capability import RunnerCapability from .shared.field_value import FieldValue @@ -23,6 +24,9 @@ class RunnerStatus(BaseModel): capabilities: Optional[List[RunnerCapability]] = None """capabilities is a list of capabilities the runner supports.""" + gateway_info: Optional[GatewayInfo] = FieldInfo(alias="gatewayInfo", default=None) + """gateway_info is information about the gateway to which the runner is connected.""" + log_url: Optional[str] = FieldInfo(alias="logUrl", default=None) message: Optional[str] = None @@ -32,7 +36,7 @@ class RunnerStatus(BaseModel): """ phase: Optional[RunnerPhase] = None - """RunnerPhase represents the phase a runner is in""" + """The runner's reported phase""" region: Optional[str] = None """region is the region the runner is running in, if applicable.""" @@ -40,95 +44,6 @@ class RunnerStatus(BaseModel): system_details: Optional[str] = FieldInfo(alias="systemDetails", default=None) updated_at: Optional[datetime] = FieldInfo(alias="updatedAt", default=None) - """ - A Timestamp represents a point in time independent of any time zone or local - calendar, encoded as a count of seconds and fractions of seconds at nanosecond - resolution. The count is relative to an epoch at UTC midnight on January 1, - 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - backwards to year one. - - All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - second table is needed for interpretation, using a - [24-hour linear smear](https://developers.google.com/time/smear). - - The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - restricting to that range, we ensure that we can convert to and from - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - - # Examples - - Example 1: Compute Timestamp from POSIX `time()`. - - Timestamp timestamp; - timestamp.set_seconds(time(NULL)); - timestamp.set_nanos(0); - - Example 2: Compute Timestamp from POSIX `gettimeofday()`. - - struct timeval tv; - gettimeofday(&tv, NULL); - - Timestamp timestamp; - timestamp.set_seconds(tv.tv_sec); - timestamp.set_nanos(tv.tv_usec * 1000); - - Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - - FILETIME ft; - GetSystemTimeAsFileTime(&ft); - UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - - // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - Timestamp timestamp; - timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - - Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - - long millis = System.currentTimeMillis(); - - Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - .setNanos((int) ((millis % 1000) * 1000000)).build(); - - Example 5: Compute Timestamp from Java `Instant.now()`. - - Instant now = Instant.now(); - - Timestamp timestamp = - Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - .setNanos(now.getNano()).build(); - - Example 6: Compute Timestamp from current time in Python. - - timestamp = Timestamp() - timestamp.GetCurrentTime() - - # JSON Mapping - - In JSON format, the Timestamp type is encoded as a string in the - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - zero-padded to two digits each. The fractional seconds, which can go up to 9 - digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - serializer should always use UTC (as indicated by "Z") when printing the - Timestamp type and a proto3 JSON parser should be able to accept both UTC and - other timezones (as indicated by an offset). - - For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - January 15, 2017. - - In JavaScript, one can convert a Date object to this format using the standard - [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - method. In Python, a standard `datetime.datetime` object can be converted to - this format using - [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - Joda Time's - [`ISODateTimeFormat.dateTime()`]() - to obtain a formatter capable of generating timestamps in this format. - """ + """Time when the status was last updated.""" version: Optional[str] = None diff --git a/src/gitpod/types/runner_update_params.py b/src/gitpod/types/runner_update_params.py index 975f069..4bef0fe 100644 --- a/src/gitpod/types/runner_update_params.py +++ b/src/gitpod/types/runner_update_params.py @@ -6,10 +6,11 @@ from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo +from .log_level import LogLevel from .runner_phase import RunnerPhase from .runner_release_channel import RunnerReleaseChannel -__all__ = ["RunnerUpdateParams", "Spec", "SpecConfiguration"] +__all__ = ["RunnerUpdateParams", "Spec", "SpecConfiguration", "SpecConfigurationMetrics"] class RunnerUpdateParams(TypedDict, total=False): @@ -25,10 +26,36 @@ class RunnerUpdateParams(TypedDict, total=False): spec: Optional[Spec] +class SpecConfigurationMetrics(TypedDict, total=False): + enabled: Optional[bool] + """enabled indicates whether the runner should collect metrics""" + + password: Optional[str] + """password is the password to use for the metrics collector""" + + url: Optional[str] + """url is the URL of the metrics collector""" + + username: Optional[str] + """username is the username to use for the metrics collector""" + + class SpecConfiguration(TypedDict, total=False): auto_update: Annotated[Optional[bool], PropertyInfo(alias="autoUpdate")] """auto_update indicates whether the runner should automatically update itself.""" + devcontainer_image_cache_enabled: Annotated[Optional[bool], PropertyInfo(alias="devcontainerImageCacheEnabled")] + """ + devcontainer_image_cache_enabled controls whether the shared devcontainer build + cache is enabled for this runner. + """ + + log_level: Annotated[Optional[LogLevel], PropertyInfo(alias="logLevel")] + """log_level is the log level for the runner""" + + metrics: Optional[SpecConfigurationMetrics] + """metrics contains configuration for the runner's metrics collection""" + release_channel: Annotated[Optional[RunnerReleaseChannel], PropertyInfo(alias="releaseChannel")] """The release channel the runner is on""" @@ -37,4 +64,14 @@ class Spec(TypedDict, total=False): configuration: Optional[SpecConfiguration] desired_phase: Annotated[Optional[RunnerPhase], PropertyInfo(alias="desiredPhase")] - """RunnerPhase represents the phase a runner is in""" + """ + desired_phase can currently only be updated on local-configuration runners, to + toggle whether local runners are allowed for running environments in the + organization. Set to: + + - ACTIVE to enable local runners. + - INACTIVE to disable all local runners. Existing local runners and their + environments will stop, and cannot be started again until the desired_phase is + set to ACTIVE. Use this carefully, as it will affect all users in the + organization who use local runners. + """ diff --git a/src/gitpod/types/runners/configuration_validate_params.py b/src/gitpod/types/runners/configuration_validate_params.py index df2d65e..8afdbe5 100644 --- a/src/gitpod/types/runners/configuration_validate_params.py +++ b/src/gitpod/types/runners/configuration_validate_params.py @@ -27,6 +27,12 @@ class ScmIntegration(TypedDict, total=False): host: str + issuer_url: Annotated[Optional[str], PropertyInfo(alias="issuerUrl")] + """ + issuer_url can be set to override the authentication provider URL, if it doesn't + match the SCM host. + """ + oauth_client_id: Annotated[Optional[str], PropertyInfo(alias="oauthClientId")] """ oauth_client_id is the OAuth app's client ID, if OAuth is configured. If 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 3d9900d..143bdbb 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,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from ...._models import BaseModel from .host_authentication_token import HostAuthenticationToken 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 4f348a0..ee629a1 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,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from ...._models import BaseModel from .host_authentication_token import HostAuthenticationToken diff --git a/src/gitpod/types/runners/configurations/runner_configuration_schema.py b/src/gitpod/types/runners/configurations/runner_configuration_schema.py index fff9b91..caeccd7 100644 --- a/src/gitpod/types/runners/configurations/runner_configuration_schema.py +++ b/src/gitpod/types/runners/configurations/runner_configuration_schema.py @@ -13,12 +13,16 @@ "EnvironmentClassBool", "EnvironmentClassDisplay", "EnvironmentClassEnum", + "EnvironmentClassEnumDefaultValue", + "EnvironmentClassEnumPossibleValue", "EnvironmentClassInt", "EnvironmentClassString", "RunnerConfig", "RunnerConfigBool", "RunnerConfigDisplay", "RunnerConfigEnum", + "RunnerConfigEnumDefaultValue", + "RunnerConfigEnumPossibleValue", "RunnerConfigInt", "RunnerConfigString", "Scm", @@ -35,10 +39,32 @@ class EnvironmentClassDisplay(BaseModel): default: Optional[str] = None +class EnvironmentClassEnumDefaultValue(BaseModel): + detail: Optional[str] = None + + subtitle: Optional[str] = None + + title: Optional[str] = None + + +class EnvironmentClassEnumPossibleValue(BaseModel): + detail: Optional[str] = None + + subtitle: Optional[str] = None + + title: Optional[str] = None + + class EnvironmentClassEnum(BaseModel): default: Optional[str] = None + """deprecated, will be removed, use default_value instead""" + + default_value: Optional[EnvironmentClassEnumDefaultValue] = FieldInfo(alias="defaultValue", default=None) + + possible_values: Optional[List[EnvironmentClassEnumPossibleValue]] = FieldInfo(alias="possibleValues", default=None) values: Optional[List[str]] = None + """deprecated, will be removed, use possible_values instead""" class EnvironmentClassInt(BaseModel): @@ -85,10 +111,32 @@ class RunnerConfigDisplay(BaseModel): default: Optional[str] = None +class RunnerConfigEnumDefaultValue(BaseModel): + detail: Optional[str] = None + + subtitle: Optional[str] = None + + title: Optional[str] = None + + +class RunnerConfigEnumPossibleValue(BaseModel): + detail: Optional[str] = None + + subtitle: Optional[str] = None + + title: Optional[str] = None + + class RunnerConfigEnum(BaseModel): default: Optional[str] = None + """deprecated, will be removed, use default_value instead""" + + default_value: Optional[RunnerConfigEnumDefaultValue] = FieldInfo(alias="defaultValue", default=None) + + possible_values: Optional[List[RunnerConfigEnumPossibleValue]] = FieldInfo(alias="possibleValues", default=None) values: Optional[List[str]] = None + """deprecated, will be removed, use possible_values instead""" class RunnerConfigInt(BaseModel): 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 9713c07..8cbddf0 100644 --- a/src/gitpod/types/runners/configurations/scm_integration_create_params.py +++ b/src/gitpod/types/runners/configurations/scm_integration_create_params.py @@ -13,6 +13,12 @@ class ScmIntegrationCreateParams(TypedDict, total=False): host: str + issuer_url: Annotated[Optional[str], PropertyInfo(alias="issuerUrl")] + """ + issuer_url can be set to override the authentication provider URL, if it doesn't + match the SCM host. + """ + oauth_client_id: Annotated[Optional[str], PropertyInfo(alias="oauthClientId")] """ oauth_client_id is the OAuth app's client ID, if OAuth is configured. If diff --git a/src/gitpod/types/runners/configurations/scm_integration_oauth_config.py b/src/gitpod/types/runners/configurations/scm_integration_oauth_config.py index bda03c2..f113775 100644 --- a/src/gitpod/types/runners/configurations/scm_integration_oauth_config.py +++ b/src/gitpod/types/runners/configurations/scm_integration_oauth_config.py @@ -18,3 +18,11 @@ class ScmIntegrationOAuthConfig(BaseModel): encrypted_client_secret is the OAuth app's secret encrypted with the runner's public key. """ + + issuer_url: Optional[str] = FieldInfo(alias="issuerUrl", default=None) + """ + issuer_url is used to override the authentication provider URL, if it doesn't + match the SCM host. + + +optional if not set, this account is owned by the installation. + """ 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 94e14e0..706496d 100644 --- a/src/gitpod/types/runners/configurations/scm_integration_update_params.py +++ b/src/gitpod/types/runners/configurations/scm_integration_update_params.py @@ -13,6 +13,12 @@ class ScmIntegrationUpdateParams(TypedDict, total=False): id: str + issuer_url: Annotated[Optional[str], PropertyInfo(alias="issuerUrl")] + """ + issuer_url can be set to override the authentication provider URL, if it doesn't + match the SCM host. + """ + 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 diff --git a/src/gitpod/types/runners/policy_create_response.py b/src/gitpod/types/runners/policy_create_response.py index d97d8e1..946e4c8 100644 --- a/src/gitpod/types/runners/policy_create_response.py +++ b/src/gitpod/types/runners/policy_create_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from ..._models import BaseModel from .runner_policy import RunnerPolicy diff --git a/src/gitpod/types/runners/policy_update_response.py b/src/gitpod/types/runners/policy_update_response.py index 5f441dc..7d2094c 100644 --- a/src/gitpod/types/runners/policy_update_response.py +++ b/src/gitpod/types/runners/policy_update_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from ..._models import BaseModel from .runner_policy import RunnerPolicy diff --git a/src/gitpod/types/scope.py b/src/gitpod/types/scope.py deleted file mode 100644 index 0f1bd71..0000000 --- a/src/gitpod/types/scope.py +++ /dev/null @@ -1,7 +0,0 @@ -# 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 index e994fa7..f7bdd15 100644 --- a/src/gitpod/types/secret.py +++ b/src/gitpod/types/secret.py @@ -6,6 +6,7 @@ from pydantic import Field as FieldInfo from .._models import BaseModel +from .secret_scope import SecretScope from .shared.subject import Subject __all__ = ["Secret"] @@ -125,7 +126,9 @@ class Secret(BaseModel): """Name of the secret for humans.""" project_id: Optional[str] = FieldInfo(alias="projectId", default=None) - """The Project ID this Secret belongs to""" + """The Project ID this Secret belongs to Deprecated: use scope instead""" + + scope: Optional[SecretScope] = None updated_at: Optional[datetime] = FieldInfo(alias="updatedAt", default=None) """ diff --git a/src/gitpod/types/secret_create_params.py b/src/gitpod/types/secret_create_params.py index e59b270..61487b0 100644 --- a/src/gitpod/types/secret_create_params.py +++ b/src/gitpod/types/secret_create_params.py @@ -5,6 +5,7 @@ from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo +from .secret_scope_param import SecretScopeParam __all__ = ["SecretCreateParams"] @@ -35,7 +36,12 @@ class SecretCreateParams(TypedDict, total=False): name: str project_id: Annotated[str, PropertyInfo(alias="projectId")] - """project_id is the ProjectID this Secret belongs to""" + """ + project_id is the ProjectID this Secret belongs to Deprecated: use scope instead + """ + + scope: SecretScopeParam + """scope is the scope of the secret""" value: str """value is the plaintext value of the secret""" diff --git a/src/gitpod/types/secret_list_params.py b/src/gitpod/types/secret_list_params.py index a0d7593..44ab4bd 100644 --- a/src/gitpod/types/secret_list_params.py +++ b/src/gitpod/types/secret_list_params.py @@ -6,6 +6,7 @@ from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo +from .secret_scope_param import SecretScopeParam __all__ = ["SecretListParams", "Filter", "Pagination"] @@ -23,7 +24,13 @@ class SecretListParams(TypedDict, total=False): class Filter(TypedDict, total=False): project_ids: Annotated[List[str], PropertyInfo(alias="projectIds")] - """project_ids filters the response to only Secrets used by these Project IDs""" + """ + project_ids filters the response to only Secrets used by these Project IDs + Deprecated: use scope instead. Values in project_ids will be ignored. + """ + + scope: SecretScopeParam + """scope is the scope of the secrets to list""" class Pagination(TypedDict, total=False): diff --git a/src/gitpod/types/secret_scope.py b/src/gitpod/types/secret_scope.py new file mode 100644 index 0000000..0c5bc66 --- /dev/null +++ b/src/gitpod/types/secret_scope.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__ = ["SecretScope"] + + +class SecretScope(BaseModel): + project_id: Optional[str] = FieldInfo(alias="projectId", default=None) + """project_id is the Project ID this Secret belongs to""" + + user_id: Optional[str] = FieldInfo(alias="userId", default=None) + """user_id is the User ID this Secret belongs to""" diff --git a/src/gitpod/types/secret_scope_param.py b/src/gitpod/types/secret_scope_param.py new file mode 100644 index 0000000..85ee9a4 --- /dev/null +++ b/src/gitpod/types/secret_scope_param.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__ = ["SecretScopeParam"] + + +class SecretScopeParam(TypedDict, total=False): + project_id: Annotated[str, PropertyInfo(alias="projectId")] + """project_id is the Project ID this Secret belongs to""" + + user_id: Annotated[str, PropertyInfo(alias="userId")] + """user_id is the User ID this Secret belongs to""" diff --git a/src/gitpod/types/shared/__init__.py b/src/gitpod/types/shared/__init__.py index f4f3788..4a5d70a 100644 --- a/src/gitpod/types/shared/__init__.py +++ b/src/gitpod/types/shared/__init__.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .task import Task as Task +from .gateway import Gateway as Gateway from .runs_on import RunsOn as RunsOn from .subject import Subject as Subject from .principal import Principal as Principal diff --git a/src/gitpod/types/shared/gateway.py b/src/gitpod/types/shared/gateway.py new file mode 100644 index 0000000..cae2976 --- /dev/null +++ b/src/gitpod/types/shared/gateway.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["Gateway"] + + +class Gateway(BaseModel): + name: str + """name is the human-readable name of the gateway. + + name is unique across all gateways. + """ + + url: str + """url of the gateway""" + + region: Optional[str] = None + """region is the geographical region where the gateway is located""" diff --git a/src/gitpod/types/shared/principal.py b/src/gitpod/types/shared/principal.py index bd0a3b9..5300b52 100644 --- a/src/gitpod/types/shared/principal.py +++ b/src/gitpod/types/shared/principal.py @@ -11,4 +11,5 @@ "PRINCIPAL_RUNNER", "PRINCIPAL_ENVIRONMENT", "PRINCIPAL_SERVICE_ACCOUNT", + "PRINCIPAL_RUNNER_MANAGER", ] diff --git a/src/gitpod/types/shared/task_execution_metadata.py b/src/gitpod/types/shared/task_execution_metadata.py index b0e28c9..8e72321 100644 --- a/src/gitpod/types/shared/task_execution_metadata.py +++ b/src/gitpod/types/shared/task_execution_metadata.py @@ -13,188 +13,10 @@ class TaskExecutionMetadata(BaseModel): completed_at: Optional[datetime] = FieldInfo(alias="completedAt", default=None) - """ - A Timestamp represents a point in time independent of any time zone or local - calendar, encoded as a count of seconds and fractions of seconds at nanosecond - resolution. The count is relative to an epoch at UTC midnight on January 1, - 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - backwards to year one. - - All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - second table is needed for interpretation, using a - [24-hour linear smear](https://developers.google.com/time/smear). - - The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - restricting to that range, we ensure that we can convert to and from - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - - # Examples - - Example 1: Compute Timestamp from POSIX `time()`. - - Timestamp timestamp; - timestamp.set_seconds(time(NULL)); - timestamp.set_nanos(0); - - Example 2: Compute Timestamp from POSIX `gettimeofday()`. - - struct timeval tv; - gettimeofday(&tv, NULL); - - Timestamp timestamp; - timestamp.set_seconds(tv.tv_sec); - timestamp.set_nanos(tv.tv_usec * 1000); - - Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - - FILETIME ft; - GetSystemTimeAsFileTime(&ft); - UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - - // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - Timestamp timestamp; - timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - - Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - - long millis = System.currentTimeMillis(); - - Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - .setNanos((int) ((millis % 1000) * 1000000)).build(); - - Example 5: Compute Timestamp from Java `Instant.now()`. - - Instant now = Instant.now(); - - Timestamp timestamp = - Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - .setNanos(now.getNano()).build(); - - Example 6: Compute Timestamp from current time in Python. - - timestamp = Timestamp() - timestamp.GetCurrentTime() - - # JSON Mapping - - In JSON format, the Timestamp type is encoded as a string in the - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - zero-padded to two digits each. The fractional seconds, which can go up to 9 - digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - serializer should always use UTC (as indicated by "Z") when printing the - Timestamp type and a proto3 JSON parser should be able to accept both UTC and - other timezones (as indicated by an offset). - - For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - January 15, 2017. - - In JavaScript, one can convert a Date object to this format using the standard - [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - method. In Python, a standard `datetime.datetime` object can be converted to - this format using - [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - Joda Time's - [`ISODateTimeFormat.dateTime()`]() - to obtain a formatter capable of generating timestamps in this format. - """ + """completed_at is the time the task execution was done.""" created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) - """ - A Timestamp represents a point in time independent of any time zone or local - calendar, encoded as a count of seconds and fractions of seconds at nanosecond - resolution. The count is relative to an epoch at UTC midnight on January 1, - 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - backwards to year one. - - All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - second table is needed for interpretation, using a - [24-hour linear smear](https://developers.google.com/time/smear). - - The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - restricting to that range, we ensure that we can convert to and from - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - - # Examples - - Example 1: Compute Timestamp from POSIX `time()`. - - Timestamp timestamp; - timestamp.set_seconds(time(NULL)); - timestamp.set_nanos(0); - - Example 2: Compute Timestamp from POSIX `gettimeofday()`. - - struct timeval tv; - gettimeofday(&tv, NULL); - - Timestamp timestamp; - timestamp.set_seconds(tv.tv_sec); - timestamp.set_nanos(tv.tv_usec * 1000); - - Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - - FILETIME ft; - GetSystemTimeAsFileTime(&ft); - UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - - // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - Timestamp timestamp; - timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - - Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - - long millis = System.currentTimeMillis(); - - Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - .setNanos((int) ((millis % 1000) * 1000000)).build(); - - Example 5: Compute Timestamp from Java `Instant.now()`. - - Instant now = Instant.now(); - - Timestamp timestamp = - Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - .setNanos(now.getNano()).build(); - - Example 6: Compute Timestamp from current time in Python. - - timestamp = Timestamp() - timestamp.GetCurrentTime() - - # JSON Mapping - - In JSON format, the Timestamp type is encoded as a string in the - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - zero-padded to two digits each. The fractional seconds, which can go up to 9 - digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - serializer should always use UTC (as indicated by "Z") when printing the - Timestamp type and a proto3 JSON parser should be able to accept both UTC and - other timezones (as indicated by an offset). - - For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - January 15, 2017. - - In JavaScript, one can convert a Date object to this format using the standard - [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - method. In Python, a standard `datetime.datetime` object can be converted to - this format using - [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - Joda Time's - [`ISODateTimeFormat.dateTime()`]() - to obtain a formatter capable of generating timestamps in this format. - """ + """created_at is the time the task was created.""" creator: Optional[Subject] = None """creator describes the principal who created/started the task run.""" @@ -203,96 +25,7 @@ class TaskExecutionMetadata(BaseModel): """environment_id is the ID of the environment in which the task run is executed.""" started_at: Optional[datetime] = FieldInfo(alias="startedAt", default=None) - """ - A Timestamp represents a point in time independent of any time zone or local - calendar, encoded as a count of seconds and fractions of seconds at nanosecond - resolution. The count is relative to an epoch at UTC midnight on January 1, - 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - backwards to year one. - - All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - second table is needed for interpretation, using a - [24-hour linear smear](https://developers.google.com/time/smear). - - The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - restricting to that range, we ensure that we can convert to and from - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - - # Examples - - Example 1: Compute Timestamp from POSIX `time()`. - - Timestamp timestamp; - timestamp.set_seconds(time(NULL)); - timestamp.set_nanos(0); - - Example 2: Compute Timestamp from POSIX `gettimeofday()`. - - struct timeval tv; - gettimeofday(&tv, NULL); - - Timestamp timestamp; - timestamp.set_seconds(tv.tv_sec); - timestamp.set_nanos(tv.tv_usec * 1000); - - Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - - FILETIME ft; - GetSystemTimeAsFileTime(&ft); - UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - - // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - Timestamp timestamp; - timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - - Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - - long millis = System.currentTimeMillis(); - - Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - .setNanos((int) ((millis % 1000) * 1000000)).build(); - - Example 5: Compute Timestamp from Java `Instant.now()`. - - Instant now = Instant.now(); - - Timestamp timestamp = - Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - .setNanos(now.getNano()).build(); - - Example 6: Compute Timestamp from current time in Python. - - timestamp = Timestamp() - timestamp.GetCurrentTime() - - # JSON Mapping - - In JSON format, the Timestamp type is encoded as a string in the - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - zero-padded to two digits each. The fractional seconds, which can go up to 9 - digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - serializer should always use UTC (as indicated by "Z") when printing the - Timestamp type and a proto3 JSON parser should be able to accept both UTC and - other timezones (as indicated by an offset). - - For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - January 15, 2017. - - In JavaScript, one can convert a Date object to this format using the standard - [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - method. In Python, a standard `datetime.datetime` object can be converted to - this format using - [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - Joda Time's - [`ISODateTimeFormat.dateTime()`]() - to obtain a formatter capable of generating timestamps in this format. - """ + """started_at is the time the task execution actually started to run.""" started_by: Optional[str] = FieldInfo(alias="startedBy", default=None) """started_by describes the trigger that started the task execution.""" diff --git a/src/gitpod/types/shared/task_execution_status.py b/src/gitpod/types/shared/task_execution_status.py index b5ab03a..2a4765a 100644 --- a/src/gitpod/types/shared/task_execution_status.py +++ b/src/gitpod/types/shared/task_execution_status.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from pydantic import Field as FieldInfo @@ -21,6 +21,12 @@ class Step(BaseModel): to a failed state. """ + output: Optional[Dict[str, str]] = None + """ + output contains the output of the task execution. setting an output field to + empty string will unset it. + """ + phase: Optional[TaskExecutionPhase] = None """phase is the current phase of the execution step""" diff --git a/src/gitpod/types/shared/task_metadata.py b/src/gitpod/types/shared/task_metadata.py index 23e6c2c..6a34633 100644 --- a/src/gitpod/types/shared/task_metadata.py +++ b/src/gitpod/types/shared/task_metadata.py @@ -14,96 +14,7 @@ class TaskMetadata(BaseModel): created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) - """ - A Timestamp represents a point in time independent of any time zone or local - calendar, encoded as a count of seconds and fractions of seconds at nanosecond - resolution. The count is relative to an epoch at UTC midnight on January 1, - 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - backwards to year one. - - All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - second table is needed for interpretation, using a - [24-hour linear smear](https://developers.google.com/time/smear). - - The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - restricting to that range, we ensure that we can convert to and from - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - - # Examples - - Example 1: Compute Timestamp from POSIX `time()`. - - Timestamp timestamp; - timestamp.set_seconds(time(NULL)); - timestamp.set_nanos(0); - - Example 2: Compute Timestamp from POSIX `gettimeofday()`. - - struct timeval tv; - gettimeofday(&tv, NULL); - - Timestamp timestamp; - timestamp.set_seconds(tv.tv_sec); - timestamp.set_nanos(tv.tv_usec * 1000); - - Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - - FILETIME ft; - GetSystemTimeAsFileTime(&ft); - UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - - // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - Timestamp timestamp; - timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - - Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - - long millis = System.currentTimeMillis(); - - Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - .setNanos((int) ((millis % 1000) * 1000000)).build(); - - Example 5: Compute Timestamp from Java `Instant.now()`. - - Instant now = Instant.now(); - - Timestamp timestamp = - Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - .setNanos(now.getNano()).build(); - - Example 6: Compute Timestamp from current time in Python. - - timestamp = Timestamp() - timestamp.GetCurrentTime() - - # JSON Mapping - - In JSON format, the Timestamp type is encoded as a string in the - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - zero-padded to two digits each. The fractional seconds, which can go up to 9 - digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - serializer should always use UTC (as indicated by "Z") when printing the - Timestamp type and a proto3 JSON parser should be able to accept both UTC and - other timezones (as indicated by an offset). - - For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - January 15, 2017. - - In JavaScript, one can convert a Date object to this format using the standard - [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - method. In Python, a standard `datetime.datetime` object can be converted to - this format using - [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - Joda Time's - [`ISODateTimeFormat.dateTime()`]() - to obtain a formatter capable of generating timestamps in this format. - """ + """created_at is the time the task was created.""" creator: Optional[Subject] = None """creator describes the principal who created the task.""" diff --git a/src/gitpod/types/shared_params/principal.py b/src/gitpod/types/shared_params/principal.py index 1f2e22e..3cefcfa 100644 --- a/src/gitpod/types/shared_params/principal.py +++ b/src/gitpod/types/shared_params/principal.py @@ -13,4 +13,5 @@ "PRINCIPAL_RUNNER", "PRINCIPAL_ENVIRONMENT", "PRINCIPAL_SERVICE_ACCOUNT", + "PRINCIPAL_RUNNER_MANAGER", ] diff --git a/src/gitpod/types/shared_params/task_metadata.py b/src/gitpod/types/shared_params/task_metadata.py index 50ffda7..2523ba6 100644 --- a/src/gitpod/types/shared_params/task_metadata.py +++ b/src/gitpod/types/shared_params/task_metadata.py @@ -15,96 +15,7 @@ class TaskMetadata(TypedDict, total=False): created_at: Annotated[Union[str, datetime], PropertyInfo(alias="createdAt", format="iso8601")] - """ - A Timestamp represents a point in time independent of any time zone or local - calendar, encoded as a count of seconds and fractions of seconds at nanosecond - resolution. The count is relative to an epoch at UTC midnight on January 1, - 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - backwards to year one. - - All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - second table is needed for interpretation, using a - [24-hour linear smear](https://developers.google.com/time/smear). - - The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - restricting to that range, we ensure that we can convert to and from - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - - # Examples - - Example 1: Compute Timestamp from POSIX `time()`. - - Timestamp timestamp; - timestamp.set_seconds(time(NULL)); - timestamp.set_nanos(0); - - Example 2: Compute Timestamp from POSIX `gettimeofday()`. - - struct timeval tv; - gettimeofday(&tv, NULL); - - Timestamp timestamp; - timestamp.set_seconds(tv.tv_sec); - timestamp.set_nanos(tv.tv_usec * 1000); - - Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - - FILETIME ft; - GetSystemTimeAsFileTime(&ft); - UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - - // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - Timestamp timestamp; - timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - - Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - - long millis = System.currentTimeMillis(); - - Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - .setNanos((int) ((millis % 1000) * 1000000)).build(); - - Example 5: Compute Timestamp from Java `Instant.now()`. - - Instant now = Instant.now(); - - Timestamp timestamp = - Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - .setNanos(now.getNano()).build(); - - Example 6: Compute Timestamp from current time in Python. - - timestamp = Timestamp() - timestamp.GetCurrentTime() - - # JSON Mapping - - In JSON format, the Timestamp type is encoded as a string in the - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - zero-padded to two digits each. The fractional seconds, which can go up to 9 - digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - serializer should always use UTC (as indicated by "Z") when printing the - Timestamp type and a proto3 JSON parser should be able to accept both UTC and - other timezones (as indicated by an offset). - - For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - January 15, 2017. - - In JavaScript, one can convert a Date object to this format using the standard - [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - method. In Python, a standard `datetime.datetime` object can be converted to - this format using - [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - Joda Time's - [`ISODateTimeFormat.dateTime()`]() - to obtain a formatter capable of generating timestamps in this format. - """ + """created_at is the time the task was created.""" creator: Subject """creator describes the principal who created the task.""" diff --git a/src/gitpod/types/usage_list_environment_runtime_records_params.py b/src/gitpod/types/usage_list_environment_runtime_records_params.py new file mode 100644 index 0000000..3f97243 --- /dev/null +++ b/src/gitpod/types/usage_list_environment_runtime_records_params.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 Union +from datetime import datetime +from typing_extensions import Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["UsageListEnvironmentRuntimeRecordsParams", "Filter", "FilterDateRange", "Pagination"] + + +class UsageListEnvironmentRuntimeRecordsParams(TypedDict, total=False): + token: str + + page_size: Annotated[int, PropertyInfo(alias="pageSize")] + + filter: Filter + """Filter options.""" + + pagination: Pagination + """Pagination options.""" + + +class FilterDateRange(TypedDict, total=False): + end_time: Required[Annotated[Union[str, datetime], PropertyInfo(alias="endTime", format="iso8601")]] + """End time of the date range (exclusive).""" + + start_time: Required[Annotated[Union[str, datetime], PropertyInfo(alias="startTime", format="iso8601")]] + """Start time of the date range (inclusive).""" + + +class Filter(TypedDict, total=False): + date_range: Required[Annotated[FilterDateRange, PropertyInfo(alias="dateRange")]] + """Date range to query runtime records within.""" + + project_id: Annotated[str, PropertyInfo(alias="projectId")] + """Optional project ID to filter runtime records by.""" + + +class Pagination(TypedDict, total=False): + token: str + """ + Token for the next set of results that was returned as next_token of a + PaginationResponse + """ + + page_size: Annotated[int, PropertyInfo(alias="pageSize")] + """Page size is the maximum number of results to retrieve per page. Defaults to 25. + + Maximum 100. + """ diff --git a/src/gitpod/types/user.py b/src/gitpod/types/user.py index f6c16cb..a8ce63f 100644 --- a/src/gitpod/types/user.py +++ b/src/gitpod/types/user.py @@ -19,96 +19,7 @@ class User(BaseModel): """avatar_url is a link to the user avatar""" created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) - """ - A Timestamp represents a point in time independent of any time zone or local - calendar, encoded as a count of seconds and fractions of seconds at nanosecond - resolution. The count is relative to an epoch at UTC midnight on January 1, - 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - backwards to year one. - - All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - second table is needed for interpretation, using a - [24-hour linear smear](https://developers.google.com/time/smear). - - The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - restricting to that range, we ensure that we can convert to and from - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - - # Examples - - Example 1: Compute Timestamp from POSIX `time()`. - - Timestamp timestamp; - timestamp.set_seconds(time(NULL)); - timestamp.set_nanos(0); - - Example 2: Compute Timestamp from POSIX `gettimeofday()`. - - struct timeval tv; - gettimeofday(&tv, NULL); - - Timestamp timestamp; - timestamp.set_seconds(tv.tv_sec); - timestamp.set_nanos(tv.tv_usec * 1000); - - Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - - FILETIME ft; - GetSystemTimeAsFileTime(&ft); - UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - - // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - Timestamp timestamp; - timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - - Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - - long millis = System.currentTimeMillis(); - - Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - .setNanos((int) ((millis % 1000) * 1000000)).build(); - - Example 5: Compute Timestamp from Java `Instant.now()`. - - Instant now = Instant.now(); - - Timestamp timestamp = - Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - .setNanos(now.getNano()).build(); - - Example 6: Compute Timestamp from current time in Python. - - timestamp = Timestamp() - timestamp.GetCurrentTime() - - # JSON Mapping - - In JSON format, the Timestamp type is encoded as a string in the - [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - zero-padded to two digits each. The fractional seconds, which can go up to 9 - digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - serializer should always use UTC (as indicated by "Z") when printing the - Timestamp type and a proto3 JSON parser should be able to accept both UTC and - other timezones (as indicated by an offset). - - For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - January 15, 2017. - - In JavaScript, one can convert a Date object to this format using the standard - [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - method. In Python, a standard `datetime.datetime` object can be converted to - this format using - [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - Joda Time's - [`ISODateTimeFormat.dateTime()`]() - to obtain a formatter capable of generating timestamps in this format. - """ + """created_at is the creation time""" name: Optional[str] = None """name is the full name of the user""" diff --git a/src/gitpod/types/user_get_authenticated_user_response.py b/src/gitpod/types/user_get_authenticated_user_response.py index d4e06c6..8610b45 100644 --- a/src/gitpod/types/user_get_authenticated_user_response.py +++ b/src/gitpod/types/user_get_authenticated_user_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from .user import User from .._models import BaseModel diff --git a/src/gitpod/types/users/__init__.py b/src/gitpod/types/users/__init__.py index b54651e..8145891 100644 --- a/src/gitpod/types/users/__init__.py +++ b/src/gitpod/types/users/__init__.py @@ -6,4 +6,8 @@ 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 .dotfile_get_params import DotfileGetParams as DotfileGetParams +from .dotfile_set_params import DotfileSetParams as DotfileSetParams +from .dotfile_get_response import DotfileGetResponse as DotfileGetResponse from .personal_access_token import PersonalAccessToken as PersonalAccessToken +from .dotfiles_configuration import DotfilesConfiguration as DotfilesConfiguration diff --git a/src/gitpod/types/users/dotfile_get_params.py b/src/gitpod/types/users/dotfile_get_params.py new file mode 100644 index 0000000..f9272c3 --- /dev/null +++ b/src/gitpod/types/users/dotfile_get_params.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 TypedDict + +__all__ = ["DotfileGetParams"] + + +class DotfileGetParams(TypedDict, total=False): + empty: bool diff --git a/src/gitpod/types/users/dotfile_get_response.py b/src/gitpod/types/users/dotfile_get_response.py new file mode 100644 index 0000000..4cb5e02 --- /dev/null +++ b/src/gitpod/types/users/dotfile_get_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel +from .dotfiles_configuration import DotfilesConfiguration + +__all__ = ["DotfileGetResponse"] + + +class DotfileGetResponse(BaseModel): + dotfiles_configuration: DotfilesConfiguration = FieldInfo(alias="dotfilesConfiguration") diff --git a/src/gitpod/types/users/dotfile_set_params.py b/src/gitpod/types/users/dotfile_set_params.py new file mode 100644 index 0000000..21d63bd --- /dev/null +++ b/src/gitpod/types/users/dotfile_set_params.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 TypedDict + +__all__ = ["DotfileSetParams"] + + +class DotfileSetParams(TypedDict, total=False): + repository: str diff --git a/src/gitpod/types/users/dotfiles_configuration.py b/src/gitpod/types/users/dotfiles_configuration.py new file mode 100644 index 0000000..c5595be --- /dev/null +++ b/src/gitpod/types/users/dotfiles_configuration.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["DotfilesConfiguration"] + + +class DotfilesConfiguration(BaseModel): + repository: Optional[str] = None + """The URL of a dotfiles repository.""" diff --git a/src/gitpod/types/users/pat_get_response.py b/src/gitpod/types/users/pat_get_response.py index 54933a4..5c0b2a0 100644 --- a/src/gitpod/types/users/pat_get_response.py +++ b/src/gitpod/types/users/pat_get_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from ..._models import BaseModel from .personal_access_token import PersonalAccessToken diff --git a/tests/api_resources/environments/automations/tasks/test_executions.py b/tests/api_resources/environments/automations/tasks/test_executions.py index 722a618..1adffcc 100644 --- a/tests/api_resources/environments/automations/tasks/test_executions.py +++ b/tests/api_resources/environments/automations/tasks/test_executions.py @@ -71,7 +71,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: page_size=0, filter={ "environment_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - "phases": ["TASK_EXECUTION_PHASE_UNSPECIFIED", "TASK_EXECUTION_PHASE_PENDING"], + "phases": ["TASK_EXECUTION_PHASE_RUNNING", "TASK_EXECUTION_PHASE_FAILED"], "task_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], "task_references": ["string"], }, @@ -196,7 +196,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N page_size=0, filter={ "environment_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - "phases": ["TASK_EXECUTION_PHASE_UNSPECIFIED", "TASK_EXECUTION_PHASE_PENDING"], + "phases": ["TASK_EXECUTION_PHASE_RUNNING", "TASK_EXECUTION_PHASE_FAILED"], "task_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], "task_references": ["string"], }, diff --git a/tests/api_resources/environments/automations/test_services.py b/tests/api_resources/environments/automations/test_services.py index ea60aba..c64d577 100644 --- a/tests/api_resources/environments/automations/test_services.py +++ b/tests/api_resources/environments/automations/test_services.py @@ -168,6 +168,7 @@ def test_method_update_with_all_params(self, client: Gitpod) -> None: status={ "failure_message": "failureMessage", "log_url": "logUrl", + "output": {"foo": "string"}, "phase": "SERVICE_PHASE_UNSPECIFIED", "session": "session", }, @@ -500,6 +501,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> status={ "failure_message": "failureMessage", "log_url": "logUrl", + "output": {"foo": "string"}, "phase": "SERVICE_PHASE_UNSPECIFIED", "session": "session", }, diff --git a/tests/api_resources/environments/test_automations.py b/tests/api_resources/environments/test_automations.py index 52ebff8..5d9cff1 100644 --- a/tests/api_resources/environments/test_automations.py +++ b/tests/api_resources/environments/test_automations.py @@ -43,7 +43,7 @@ def test_method_upsert_with_all_params(self, client: Gitpod) -> None: "image": "x", } }, - "triggered_by": ["manual"], + "triggered_by": ["postDevcontainerStart"], } }, "tasks": { @@ -58,7 +58,7 @@ def test_method_upsert_with_all_params(self, client: Gitpod) -> None: "image": "x", } }, - "triggered_by": ["manual"], + "triggered_by": ["postEnvironmentStart"], } }, }, @@ -118,7 +118,7 @@ async def test_method_upsert_with_all_params(self, async_client: AsyncGitpod) -> "image": "x", } }, - "triggered_by": ["manual"], + "triggered_by": ["postDevcontainerStart"], } }, "tasks": { @@ -133,7 +133,7 @@ async def test_method_upsert_with_all_params(self, async_client: AsyncGitpod) -> "image": "x", } }, - "triggered_by": ["manual"], + "triggered_by": ["postEnvironmentStart"], } }, }, diff --git a/tests/api_resources/organizations/test_policies.py b/tests/api_resources/organizations/test_policies.py new file mode 100644 index 0000000..6d7709f --- /dev/null +++ b/tests/api_resources/organizations/test_policies.py @@ -0,0 +1,194 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gitpod import Gitpod, AsyncGitpod +from tests.utils import assert_matches_type +from gitpod.types.organizations import PolicyRetrieveResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestPolicies: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + def test_method_retrieve(self, client: Gitpod) -> None: + policy = client.organizations.policies.retrieve( + organization_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", + ) + assert_matches_type(PolicyRetrieveResponse, policy, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_retrieve(self, client: Gitpod) -> None: + response = client.organizations.policies.with_raw_response.retrieve( + organization_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert_matches_type(PolicyRetrieveResponse, policy, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_retrieve(self, client: Gitpod) -> None: + with client.organizations.policies.with_streaming_response.retrieve( + organization_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert_matches_type(PolicyRetrieveResponse, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_method_update(self, client: Gitpod) -> None: + policy = client.organizations.policies.update( + organization_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", + ) + assert_matches_type(object, policy, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_update_with_all_params(self, client: Gitpod) -> None: + policy = client.organizations.policies.update( + organization_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", + allowed_editor_ids=["string"], + allow_local_runners=True, + default_editor_id="defaultEditorId", + default_environment_image="defaultEnvironmentImage", + maximum_environments_per_user="20", + maximum_environment_timeout="3600s", + maximum_running_environments_per_user="5", + members_create_projects=True, + members_require_projects=True, + port_sharing_disabled=True, + ) + assert_matches_type(object, policy, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_update(self, client: Gitpod) -> None: + response = client.organizations.policies.with_raw_response.update( + organization_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert_matches_type(object, policy, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_update(self, client: Gitpod) -> None: + with client.organizations.policies.with_streaming_response.update( + organization_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert_matches_type(object, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncPolicies: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + async def test_method_retrieve(self, async_client: AsyncGitpod) -> None: + policy = await async_client.organizations.policies.retrieve( + organization_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", + ) + assert_matches_type(PolicyRetrieveResponse, policy, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncGitpod) -> None: + response = await async_client.organizations.policies.with_raw_response.retrieve( + organization_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert_matches_type(PolicyRetrieveResponse, policy, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncGitpod) -> None: + async with async_client.organizations.policies.with_streaming_response.retrieve( + organization_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert_matches_type(PolicyRetrieveResponse, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_method_update(self, async_client: AsyncGitpod) -> None: + policy = await async_client.organizations.policies.update( + organization_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", + ) + assert_matches_type(object, policy, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> None: + policy = await async_client.organizations.policies.update( + organization_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", + allowed_editor_ids=["string"], + allow_local_runners=True, + default_editor_id="defaultEditorId", + default_environment_image="defaultEnvironmentImage", + maximum_environments_per_user="20", + maximum_environment_timeout="3600s", + maximum_running_environments_per_user="5", + members_create_projects=True, + members_require_projects=True, + port_sharing_disabled=True, + ) + assert_matches_type(object, policy, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_update(self, async_client: AsyncGitpod) -> None: + response = await async_client.organizations.policies.with_raw_response.update( + organization_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert_matches_type(object, policy, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGitpod) -> None: + async with async_client.organizations.policies.with_streaming_response.update( + organization_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert_matches_type(object, policy, 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 cf0a4f4..ff81a48 100644 --- a/tests/api_resources/projects/test_policies.py +++ b/tests/api_resources/projects/test_policies.py @@ -32,9 +32,9 @@ def test_method_create(self, client: Gitpod) -> None: @parametrize def test_method_create_with_all_params(self, client: Gitpod) -> None: policy = client.projects.policies.create( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - role="PROJECT_ROLE_UNSPECIFIED", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", + role="PROJECT_ROLE_ADMIN", ) assert_matches_type(PolicyCreateResponse, policy, path=["response"]) @@ -70,9 +70,9 @@ def test_method_update(self, client: Gitpod) -> None: @parametrize def test_method_update_with_all_params(self, client: Gitpod) -> None: policy = client.projects.policies.update( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - role="PROJECT_ROLE_UNSPECIFIED", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", + role="PROJECT_ROLE_EDITOR", ) assert_matches_type(PolicyUpdateResponse, policy, path=["response"]) @@ -112,9 +112,9 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: page_size=0, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", ) assert_matches_type(SyncPoliciesPage[ProjectPolicy], policy, path=["response"]) @@ -150,8 +150,8 @@ def test_method_delete(self, client: Gitpod) -> None: @parametrize def test_method_delete_with_all_params(self, client: Gitpod) -> None: policy = client.projects.policies.delete( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", ) assert_matches_type(object, policy, path=["response"]) @@ -191,9 +191,9 @@ async def test_method_create(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> None: policy = await async_client.projects.policies.create( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - role="PROJECT_ROLE_UNSPECIFIED", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", + role="PROJECT_ROLE_ADMIN", ) assert_matches_type(PolicyCreateResponse, policy, path=["response"]) @@ -229,9 +229,9 @@ async def test_method_update(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> None: policy = await async_client.projects.policies.update( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - role="PROJECT_ROLE_UNSPECIFIED", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", + role="PROJECT_ROLE_EDITOR", ) assert_matches_type(PolicyUpdateResponse, policy, path=["response"]) @@ -271,9 +271,9 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N page_size=0, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", ) assert_matches_type(AsyncPoliciesPage[ProjectPolicy], policy, path=["response"]) @@ -309,8 +309,8 @@ async def test_method_delete(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_delete_with_all_params(self, async_client: AsyncGitpod) -> None: policy = await async_client.projects.policies.delete( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", ) assert_matches_type(object, policy, path=["response"]) diff --git a/tests/api_resources/runners/configurations/test_environment_classes.py b/tests/api_resources/runners/configurations/test_environment_classes.py index 0c47b39..1668612 100644 --- a/tests/api_resources/runners/configurations/test_environment_classes.py +++ b/tests/api_resources/runners/configurations/test_environment_classes.py @@ -34,13 +34,17 @@ def test_method_create_with_all_params(self, client: Gitpod) -> None: environment_class = client.runners.configurations.environment_classes.create( configuration=[ { - "key": "key", - "value": "value", - } + "key": "cpu", + "value": "8", + }, + { + "key": "memory", + "value": "16384", + }, ], - description="xxx", - display_name="xxx", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + description="8 CPU, 16GB RAM", + display_name="Large Instance", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(EnvironmentClassCreateResponse, environment_class, path=["response"]) @@ -76,7 +80,7 @@ def test_method_retrieve(self, client: Gitpod) -> None: @parametrize def test_method_retrieve_with_all_params(self, client: Gitpod) -> None: environment_class = client.runners.configurations.environment_classes.retrieve( - environment_class_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + environment_class_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(EnvironmentClassRetrieveResponse, environment_class, path=["response"]) @@ -112,10 +116,10 @@ def test_method_update(self, client: Gitpod) -> None: @parametrize def test_method_update_with_all_params(self, client: Gitpod) -> None: environment_class = client.runners.configurations.environment_classes.update( - description="xxx", - display_name="xxx", + description="16 CPU, 32GB RAM", + display_name="Updated Large Instance", enabled=True, - environment_class_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + environment_class_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(object, environment_class, path=["response"]) @@ -162,7 +166,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: }, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(SyncEnvironmentClassesPage[EnvironmentClass], environment_class, path=["response"]) @@ -205,13 +209,17 @@ async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> environment_class = await async_client.runners.configurations.environment_classes.create( configuration=[ { - "key": "key", - "value": "value", - } + "key": "cpu", + "value": "8", + }, + { + "key": "memory", + "value": "16384", + }, ], - description="xxx", - display_name="xxx", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + description="8 CPU, 16GB RAM", + display_name="Large Instance", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(EnvironmentClassCreateResponse, environment_class, path=["response"]) @@ -247,7 +255,7 @@ async def test_method_retrieve(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncGitpod) -> None: environment_class = await async_client.runners.configurations.environment_classes.retrieve( - environment_class_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + environment_class_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(EnvironmentClassRetrieveResponse, environment_class, path=["response"]) @@ -285,10 +293,10 @@ async def test_method_update(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> None: environment_class = await async_client.runners.configurations.environment_classes.update( - description="xxx", - display_name="xxx", + description="16 CPU, 32GB RAM", + display_name="Updated Large Instance", enabled=True, - environment_class_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + environment_class_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(object, environment_class, path=["response"]) @@ -335,7 +343,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N }, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(AsyncEnvironmentClassesPage[EnvironmentClass], environment_class, path=["response"]) diff --git a/tests/api_resources/runners/configurations/test_host_authentication_tokens.py b/tests/api_resources/runners/configurations/test_host_authentication_tokens.py index 27694ae..7667d3c 100644 --- a/tests/api_resources/runners/configurations/test_host_authentication_tokens.py +++ b/tests/api_resources/runners/configurations/test_host_authentication_tokens.py @@ -33,13 +33,13 @@ def test_method_create(self, client: Gitpod) -> None: @parametrize def test_method_create_with_all_params(self, client: Gitpod) -> None: host_authentication_token = client.runners.configurations.host_authentication_tokens.create( - token="x", - expires_at=parse_datetime("2019-12-27T18:11:19.117Z"), - host="x", - refresh_token="refreshToken", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - source="HOST_AUTHENTICATION_TOKEN_SOURCE_UNSPECIFIED", - user_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + token="gho_xxxxxxxxxxxx", + expires_at=parse_datetime("2024-12-31T23:59:59Z"), + host="github.com", + refresh_token="ghr_xxxxxxxxxxxx", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", + source="HOST_AUTHENTICATION_TOKEN_SOURCE_OAUTH", + user_id="f53d2330-3795-4c5d-a1f3-453121af9c60", ) assert_matches_type(HostAuthenticationTokenCreateResponse, host_authentication_token, path=["response"]) @@ -75,7 +75,7 @@ def test_method_retrieve(self, client: Gitpod) -> None: @parametrize def test_method_retrieve_with_all_params(self, client: Gitpod) -> None: host_authentication_token = client.runners.configurations.host_authentication_tokens.retrieve( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(HostAuthenticationTokenRetrieveResponse, host_authentication_token, path=["response"]) @@ -111,10 +111,10 @@ def test_method_update(self, client: Gitpod) -> None: @parametrize def test_method_update_with_all_params(self, client: Gitpod) -> None: host_authentication_token = client.runners.configurations.host_authentication_tokens.update( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - token="x", - expires_at=parse_datetime("2019-12-27T18:11:19.117Z"), - refresh_token="refreshToken", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", + token="gho_xxxxxxxxxxxx", + expires_at=parse_datetime("2024-12-31T23:59:59Z"), + refresh_token="ghr_xxxxxxxxxxxx", ) assert_matches_type(object, host_authentication_token, path=["response"]) @@ -153,12 +153,12 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: token="token", page_size=0, filter={ - "runner_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "runner_id": "d2c94c27-3b76-4a42-b88c-95a85e392c68", "user_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", }, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(SyncTokensPage[HostAuthenticationToken], host_authentication_token, path=["response"]) @@ -195,7 +195,7 @@ def test_method_delete(self, client: Gitpod) -> None: @parametrize def test_method_delete_with_all_params(self, client: Gitpod) -> None: host_authentication_token = client.runners.configurations.host_authentication_tokens.delete( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(object, host_authentication_token, path=["response"]) @@ -235,13 +235,13 @@ async def test_method_create(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> None: host_authentication_token = await async_client.runners.configurations.host_authentication_tokens.create( - token="x", - expires_at=parse_datetime("2019-12-27T18:11:19.117Z"), - host="x", - refresh_token="refreshToken", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - source="HOST_AUTHENTICATION_TOKEN_SOURCE_UNSPECIFIED", - user_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + token="gho_xxxxxxxxxxxx", + expires_at=parse_datetime("2024-12-31T23:59:59Z"), + host="github.com", + refresh_token="ghr_xxxxxxxxxxxx", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", + source="HOST_AUTHENTICATION_TOKEN_SOURCE_OAUTH", + user_id="f53d2330-3795-4c5d-a1f3-453121af9c60", ) assert_matches_type(HostAuthenticationTokenCreateResponse, host_authentication_token, path=["response"]) @@ -279,7 +279,7 @@ async def test_method_retrieve(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncGitpod) -> None: host_authentication_token = await async_client.runners.configurations.host_authentication_tokens.retrieve( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(HostAuthenticationTokenRetrieveResponse, host_authentication_token, path=["response"]) @@ -317,10 +317,10 @@ async def test_method_update(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> None: host_authentication_token = await async_client.runners.configurations.host_authentication_tokens.update( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - token="x", - expires_at=parse_datetime("2019-12-27T18:11:19.117Z"), - refresh_token="refreshToken", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", + token="gho_xxxxxxxxxxxx", + expires_at=parse_datetime("2024-12-31T23:59:59Z"), + refresh_token="ghr_xxxxxxxxxxxx", ) assert_matches_type(object, host_authentication_token, path=["response"]) @@ -361,12 +361,12 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N token="token", page_size=0, filter={ - "runner_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "runner_id": "d2c94c27-3b76-4a42-b88c-95a85e392c68", "user_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", }, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(AsyncTokensPage[HostAuthenticationToken], host_authentication_token, path=["response"]) @@ -405,7 +405,7 @@ async def test_method_delete(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_delete_with_all_params(self, async_client: AsyncGitpod) -> None: host_authentication_token = await async_client.runners.configurations.host_authentication_tokens.delete( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(object, host_authentication_token, path=["response"]) diff --git a/tests/api_resources/runners/configurations/test_schema.py b/tests/api_resources/runners/configurations/test_schema.py index 3fce8e3..9d50725 100644 --- a/tests/api_resources/runners/configurations/test_schema.py +++ b/tests/api_resources/runners/configurations/test_schema.py @@ -27,7 +27,7 @@ def test_method_retrieve(self, client: Gitpod) -> None: @parametrize def test_method_retrieve_with_all_params(self, client: Gitpod) -> None: schema = client.runners.configurations.schema.retrieve( - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(SchemaRetrieveResponse, schema, path=["response"]) @@ -67,7 +67,7 @@ async def test_method_retrieve(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncGitpod) -> None: schema = await async_client.runners.configurations.schema.retrieve( - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(SchemaRetrieveResponse, schema, path=["response"]) diff --git a/tests/api_resources/runners/configurations/test_scm_integrations.py b/tests/api_resources/runners/configurations/test_scm_integrations.py index 41ee4a5..a168584 100644 --- a/tests/api_resources/runners/configurations/test_scm_integrations.py +++ b/tests/api_resources/runners/configurations/test_scm_integrations.py @@ -32,12 +32,13 @@ def test_method_create(self, client: Gitpod) -> None: @parametrize def test_method_create_with_all_params(self, client: Gitpod) -> None: scm_integration = client.runners.configurations.scm_integrations.create( - host="host", - oauth_client_id="oauthClientId", - oauth_plaintext_client_secret="oauthPlaintextClientSecret", + host="github.com", + issuer_url="issuerUrl", + oauth_client_id="client_id", + oauth_plaintext_client_secret="client_secret", pat=True, - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - scm_id="scmId", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", + scm_id="github", ) assert_matches_type(ScmIntegrationCreateResponse, scm_integration, path=["response"]) @@ -73,7 +74,7 @@ def test_method_retrieve(self, client: Gitpod) -> None: @parametrize def test_method_retrieve_with_all_params(self, client: Gitpod) -> None: scm_integration = client.runners.configurations.scm_integrations.retrieve( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(ScmIntegrationRetrieveResponse, scm_integration, path=["response"]) @@ -109,9 +110,10 @@ def test_method_update(self, client: Gitpod) -> None: @parametrize def test_method_update_with_all_params(self, client: Gitpod) -> None: scm_integration = client.runners.configurations.scm_integrations.update( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - oauth_client_id="oauthClientId", - oauth_plaintext_client_secret="oauthPlaintextClientSecret", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", + issuer_url="issuerUrl", + oauth_client_id="new_client_id", + oauth_plaintext_client_secret="new_client_secret", pat=True, ) assert_matches_type(object, scm_integration, path=["response"]) @@ -150,10 +152,10 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: scm_integration = client.runners.configurations.scm_integrations.list( token="token", page_size=0, - filter={"runner_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"]}, + filter={"runner_ids": ["d2c94c27-3b76-4a42-b88c-95a85e392c68"]}, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(SyncIntegrationsPage[ScmIntegration], scm_integration, path=["response"]) @@ -190,7 +192,7 @@ def test_method_delete(self, client: Gitpod) -> None: @parametrize def test_method_delete_with_all_params(self, client: Gitpod) -> None: scm_integration = client.runners.configurations.scm_integrations.delete( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(object, scm_integration, path=["response"]) @@ -230,12 +232,13 @@ async def test_method_create(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> None: scm_integration = await async_client.runners.configurations.scm_integrations.create( - host="host", - oauth_client_id="oauthClientId", - oauth_plaintext_client_secret="oauthPlaintextClientSecret", + host="github.com", + issuer_url="issuerUrl", + oauth_client_id="client_id", + oauth_plaintext_client_secret="client_secret", pat=True, - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - scm_id="scmId", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", + scm_id="github", ) assert_matches_type(ScmIntegrationCreateResponse, scm_integration, path=["response"]) @@ -271,7 +274,7 @@ async def test_method_retrieve(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncGitpod) -> None: scm_integration = await async_client.runners.configurations.scm_integrations.retrieve( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(ScmIntegrationRetrieveResponse, scm_integration, path=["response"]) @@ -307,9 +310,10 @@ async def test_method_update(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> None: scm_integration = await async_client.runners.configurations.scm_integrations.update( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - oauth_client_id="oauthClientId", - oauth_plaintext_client_secret="oauthPlaintextClientSecret", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", + issuer_url="issuerUrl", + oauth_client_id="new_client_id", + oauth_plaintext_client_secret="new_client_secret", pat=True, ) assert_matches_type(object, scm_integration, path=["response"]) @@ -348,10 +352,10 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N scm_integration = await async_client.runners.configurations.scm_integrations.list( token="token", page_size=0, - filter={"runner_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"]}, + filter={"runner_ids": ["d2c94c27-3b76-4a42-b88c-95a85e392c68"]}, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(AsyncIntegrationsPage[ScmIntegration], scm_integration, path=["response"]) @@ -388,7 +392,7 @@ async def test_method_delete(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_delete_with_all_params(self, async_client: AsyncGitpod) -> None: scm_integration = await async_client.runners.configurations.scm_integrations.delete( - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(object, scm_integration, path=["response"]) diff --git a/tests/api_resources/runners/test_configurations.py b/tests/api_resources/runners/test_configurations.py index 7184caf..8732d18 100644 --- a/tests/api_resources/runners/test_configurations.py +++ b/tests/api_resources/runners/test_configurations.py @@ -40,15 +40,16 @@ def test_method_validate_with_all_params(self, client: Gitpod) -> None: "display_name": "xxx", "enabled": True, }, - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", scm_integration={ - "id": "id", - "host": "host", - "oauth_client_id": "oauthClientId", + "id": "integration-id", + "host": "github.com", + "issuer_url": "issuerUrl", + "oauth_client_id": "client_id", "oauth_encrypted_client_secret": "U3RhaW5sZXNzIHJvY2tz", - "oauth_plaintext_client_secret": "oauthPlaintextClientSecret", + "oauth_plaintext_client_secret": "client_secret", "pat": True, - "scm_id": "scmId", + "scm_id": "github", }, ) assert_matches_type(ConfigurationValidateResponse, configuration, path=["response"]) @@ -102,15 +103,16 @@ async def test_method_validate_with_all_params(self, async_client: AsyncGitpod) "display_name": "xxx", "enabled": True, }, - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", scm_integration={ - "id": "id", - "host": "host", - "oauth_client_id": "oauthClientId", + "id": "integration-id", + "host": "github.com", + "issuer_url": "issuerUrl", + "oauth_client_id": "client_id", "oauth_encrypted_client_secret": "U3RhaW5sZXNzIHJvY2tz", - "oauth_plaintext_client_secret": "oauthPlaintextClientSecret", + "oauth_plaintext_client_secret": "client_secret", "pat": True, - "scm_id": "scmId", + "scm_id": "github", }, ) assert_matches_type(ConfigurationValidateResponse, configuration, path=["response"]) diff --git a/tests/api_resources/runners/test_policies.py b/tests/api_resources/runners/test_policies.py index f0bcafa..b94c9ff 100644 --- a/tests/api_resources/runners/test_policies.py +++ b/tests/api_resources/runners/test_policies.py @@ -32,9 +32,9 @@ def test_method_create(self, client: Gitpod) -> None: @parametrize def test_method_create_with_all_params(self, client: Gitpod) -> None: policy = client.runners.policies.create( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - role="RUNNER_ROLE_UNSPECIFIED", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", + role="RUNNER_ROLE_ADMIN", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(PolicyCreateResponse, policy, path=["response"]) @@ -70,9 +70,9 @@ def test_method_update(self, client: Gitpod) -> None: @parametrize def test_method_update_with_all_params(self, client: Gitpod) -> None: policy = client.runners.policies.update( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - role="RUNNER_ROLE_UNSPECIFIED", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", + role="RUNNER_ROLE_USER", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(PolicyUpdateResponse, policy, path=["response"]) @@ -112,9 +112,9 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: page_size=0, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(SyncPoliciesPage[RunnerPolicy], policy, path=["response"]) @@ -150,8 +150,8 @@ def test_method_delete(self, client: Gitpod) -> None: @parametrize def test_method_delete_with_all_params(self, client: Gitpod) -> None: policy = client.runners.policies.delete( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(object, policy, path=["response"]) @@ -191,9 +191,9 @@ async def test_method_create(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> None: policy = await async_client.runners.policies.create( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - role="RUNNER_ROLE_UNSPECIFIED", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", + role="RUNNER_ROLE_ADMIN", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(PolicyCreateResponse, policy, path=["response"]) @@ -229,9 +229,9 @@ async def test_method_update(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> None: policy = await async_client.runners.policies.update( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - role="RUNNER_ROLE_UNSPECIFIED", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", + role="RUNNER_ROLE_USER", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(PolicyUpdateResponse, policy, path=["response"]) @@ -271,9 +271,9 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N page_size=0, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(AsyncPoliciesPage[RunnerPolicy], policy, path=["response"]) @@ -309,8 +309,8 @@ async def test_method_delete(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_delete_with_all_params(self, async_client: AsyncGitpod) -> None: policy = await async_client.runners.policies.delete( - group_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + group_id="f53d2330-3795-4c5d-a1f3-453121af9c60", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(object, policy, path=["response"]) diff --git a/tests/api_resources/test_accounts.py b/tests/api_resources/test_accounts.py index 7aee8ed..2cf8e69 100644 --- a/tests/api_resources/test_accounts.py +++ b/tests/api_resources/test_accounts.py @@ -13,6 +13,7 @@ LoginProvider, AccountRetrieveResponse, AccountGetSSOLoginURLResponse, + AccountListJoinableOrganizationsResponse, ) from gitpod.pagination import SyncLoginProvidersPage, AsyncLoginProvidersPage @@ -135,6 +136,44 @@ def test_streaming_response_get_sso_login_url(self, client: Gitpod) -> None: assert cast(Any, response.is_closed) is True + @pytest.mark.skip() + @parametrize + def test_method_list_joinable_organizations(self, client: Gitpod) -> None: + account = client.accounts.list_joinable_organizations() + assert_matches_type(AccountListJoinableOrganizationsResponse, account, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_list_joinable_organizations_with_all_params(self, client: Gitpod) -> None: + account = client.accounts.list_joinable_organizations( + token="token", + page_size=0, + empty=True, + ) + assert_matches_type(AccountListJoinableOrganizationsResponse, account, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_list_joinable_organizations(self, client: Gitpod) -> None: + response = client.accounts.with_raw_response.list_joinable_organizations() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + account = response.parse() + assert_matches_type(AccountListJoinableOrganizationsResponse, account, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_list_joinable_organizations(self, client: Gitpod) -> None: + with client.accounts.with_streaming_response.list_joinable_organizations() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + account = response.parse() + assert_matches_type(AccountListJoinableOrganizationsResponse, account, path=["response"]) + + assert cast(Any, response.is_closed) is True + @pytest.mark.skip() @parametrize def test_method_list_login_providers(self, client: Gitpod) -> None: @@ -294,6 +333,44 @@ async def test_streaming_response_get_sso_login_url(self, async_client: AsyncGit assert cast(Any, response.is_closed) is True + @pytest.mark.skip() + @parametrize + async def test_method_list_joinable_organizations(self, async_client: AsyncGitpod) -> None: + account = await async_client.accounts.list_joinable_organizations() + assert_matches_type(AccountListJoinableOrganizationsResponse, account, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_list_joinable_organizations_with_all_params(self, async_client: AsyncGitpod) -> None: + account = await async_client.accounts.list_joinable_organizations( + token="token", + page_size=0, + empty=True, + ) + assert_matches_type(AccountListJoinableOrganizationsResponse, account, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_list_joinable_organizations(self, async_client: AsyncGitpod) -> None: + response = await async_client.accounts.with_raw_response.list_joinable_organizations() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + account = await response.parse() + assert_matches_type(AccountListJoinableOrganizationsResponse, account, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_list_joinable_organizations(self, async_client: AsyncGitpod) -> None: + async with async_client.accounts.with_streaming_response.list_joinable_organizations() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + account = await response.parse() + assert_matches_type(AccountListJoinableOrganizationsResponse, account, path=["response"]) + + assert cast(Any, response.is_closed) is True + @pytest.mark.skip() @parametrize async def test_method_list_login_providers(self, async_client: AsyncGitpod) -> None: diff --git a/tests/api_resources/test_editors.py b/tests/api_resources/test_editors.py index ecf5819..4c77d22 100644 --- a/tests/api_resources/test_editors.py +++ b/tests/api_resources/test_editors.py @@ -68,6 +68,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: editor = client.editors.list( token="token", page_size=0, + filter={"allowed_by_policy": True}, pagination={ "token": "token", "page_size": 20, @@ -187,6 +188,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N editor = await async_client.editors.list( token="token", page_size=0, + filter={"allowed_by_policy": True}, pagination={ "token": "token", "page_size": 20, diff --git a/tests/api_resources/test_environments.py b/tests/api_resources/test_environments.py index 9733680..979e659 100644 --- a/tests/api_resources/test_environments.py +++ b/tests/api_resources/test_environments.py @@ -15,6 +15,7 @@ EnvironmentRetrieveResponse, EnvironmentCreateLogsTokenResponse, EnvironmentCreateFromProjectResponse, + EnvironmentCreateEnvironmentTokenResponse, ) from gitpod._utils import parse_datetime from gitpod.pagination import SyncEnvironmentsPage, AsyncEnvironmentsPage @@ -62,12 +63,9 @@ def test_method_create_with_all_params(self, client: Gitpod) -> None: }, "desired_phase": "ENVIRONMENT_PHASE_UNSPECIFIED", "devcontainer": { + "default_devcontainer_image": "defaultDevcontainerImage", "devcontainer_file_path": "devcontainerFilePath", - "dotfiles": { - "repository": "https://example.com", - "install_command": "installCommand", - "target_path": "targetPath", - }, + "dotfiles": {"repository": "https://example.com"}, "session": "session", }, "machine": { @@ -83,6 +81,7 @@ def test_method_create_with_all_params(self, client: Gitpod) -> None: ], "secrets": [ { + "id": "id", "container_registry_basic_auth_host": "containerRegistryBasicAuthHost", "environment_variable": "environmentVariable", "file_path": "filePath", @@ -172,7 +171,7 @@ def test_method_update(self, client: Gitpod) -> None: def test_method_update_with_all_params(self, client: Gitpod) -> None: environment = client.environments.update( environment_id="07e03a28-65a5-4d98-b532-8ea67b188048", - metadata={}, + metadata={"name": "name"}, spec={ "automations_file": { "automations_file_path": "automationsFilePath", @@ -254,6 +253,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: token="token", page_size=0, filter={ + "archival_status": "ARCHIVAL_STATUS_UNSPECIFIED", "creator_ids": ["f53d2330-3795-4c5d-a1f3-453121af9c60"], "project_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], "runner_ids": ["e6aa9c54-89d3-42c1-ac31-bd8d8f1concentrate"], @@ -326,6 +326,40 @@ def test_streaming_response_delete(self, client: Gitpod) -> None: assert cast(Any, response.is_closed) is True + @pytest.mark.skip() + @parametrize + def test_method_create_environment_token(self, client: Gitpod) -> None: + environment = client.environments.create_environment_token( + environment_id="07e03a28-65a5-4d98-b532-8ea67b188048", + ) + assert_matches_type(EnvironmentCreateEnvironmentTokenResponse, environment, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_create_environment_token(self, client: Gitpod) -> None: + response = client.environments.with_raw_response.create_environment_token( + environment_id="07e03a28-65a5-4d98-b532-8ea67b188048", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + environment = response.parse() + assert_matches_type(EnvironmentCreateEnvironmentTokenResponse, environment, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_create_environment_token(self, client: Gitpod) -> None: + with client.environments.with_streaming_response.create_environment_token( + environment_id="07e03a28-65a5-4d98-b532-8ea67b188048", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + environment = response.parse() + assert_matches_type(EnvironmentCreateEnvironmentTokenResponse, environment, path=["response"]) + + assert cast(Any, response.is_closed) is True + @pytest.mark.skip() @parametrize def test_method_create_from_project(self, client: Gitpod) -> None: @@ -364,12 +398,9 @@ def test_method_create_from_project_with_all_params(self, client: Gitpod) -> Non }, "desired_phase": "ENVIRONMENT_PHASE_UNSPECIFIED", "devcontainer": { + "default_devcontainer_image": "defaultDevcontainerImage", "devcontainer_file_path": "devcontainerFilePath", - "dotfiles": { - "repository": "https://example.com", - "install_command": "installCommand", - "target_path": "targetPath", - }, + "dotfiles": {"repository": "https://example.com"}, "session": "session", }, "machine": { @@ -385,6 +416,7 @@ def test_method_create_from_project_with_all_params(self, client: Gitpod) -> Non ], "secrets": [ { + "id": "id", "container_registry_basic_auth_host": "containerRegistryBasicAuthHost", "environment_variable": "environmentVariable", "file_path": "filePath", @@ -577,6 +609,42 @@ def test_streaming_response_stop(self, client: Gitpod) -> None: assert cast(Any, response.is_closed) is True + @pytest.mark.skip() + @parametrize + def test_method_unarchive(self, client: Gitpod) -> None: + environment = client.environments.unarchive() + assert_matches_type(object, environment, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_unarchive_with_all_params(self, client: Gitpod) -> None: + environment = client.environments.unarchive( + environment_id="07e03a28-65a5-4d98-b532-8ea67b188048", + ) + assert_matches_type(object, environment, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_unarchive(self, client: Gitpod) -> None: + response = client.environments.with_raw_response.unarchive() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + environment = response.parse() + assert_matches_type(object, environment, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_unarchive(self, client: Gitpod) -> None: + with client.environments.with_streaming_response.unarchive() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + environment = response.parse() + assert_matches_type(object, environment, path=["response"]) + + assert cast(Any, response.is_closed) is True + class TestAsyncEnvironments: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @@ -618,12 +686,9 @@ async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> }, "desired_phase": "ENVIRONMENT_PHASE_UNSPECIFIED", "devcontainer": { + "default_devcontainer_image": "defaultDevcontainerImage", "devcontainer_file_path": "devcontainerFilePath", - "dotfiles": { - "repository": "https://example.com", - "install_command": "installCommand", - "target_path": "targetPath", - }, + "dotfiles": {"repository": "https://example.com"}, "session": "session", }, "machine": { @@ -639,6 +704,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> ], "secrets": [ { + "id": "id", "container_registry_basic_auth_host": "containerRegistryBasicAuthHost", "environment_variable": "environmentVariable", "file_path": "filePath", @@ -728,7 +794,7 @@ async def test_method_update(self, async_client: AsyncGitpod) -> None: async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> None: environment = await async_client.environments.update( environment_id="07e03a28-65a5-4d98-b532-8ea67b188048", - metadata={}, + metadata={"name": "name"}, spec={ "automations_file": { "automations_file_path": "automationsFilePath", @@ -810,6 +876,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N token="token", page_size=0, filter={ + "archival_status": "ARCHIVAL_STATUS_UNSPECIFIED", "creator_ids": ["f53d2330-3795-4c5d-a1f3-453121af9c60"], "project_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], "runner_ids": ["e6aa9c54-89d3-42c1-ac31-bd8d8f1concentrate"], @@ -882,6 +949,40 @@ async def test_streaming_response_delete(self, async_client: AsyncGitpod) -> Non assert cast(Any, response.is_closed) is True + @pytest.mark.skip() + @parametrize + async def test_method_create_environment_token(self, async_client: AsyncGitpod) -> None: + environment = await async_client.environments.create_environment_token( + environment_id="07e03a28-65a5-4d98-b532-8ea67b188048", + ) + assert_matches_type(EnvironmentCreateEnvironmentTokenResponse, environment, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_create_environment_token(self, async_client: AsyncGitpod) -> None: + response = await async_client.environments.with_raw_response.create_environment_token( + environment_id="07e03a28-65a5-4d98-b532-8ea67b188048", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + environment = await response.parse() + assert_matches_type(EnvironmentCreateEnvironmentTokenResponse, environment, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_create_environment_token(self, async_client: AsyncGitpod) -> None: + async with async_client.environments.with_streaming_response.create_environment_token( + environment_id="07e03a28-65a5-4d98-b532-8ea67b188048", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + environment = await response.parse() + assert_matches_type(EnvironmentCreateEnvironmentTokenResponse, environment, path=["response"]) + + assert cast(Any, response.is_closed) is True + @pytest.mark.skip() @parametrize async def test_method_create_from_project(self, async_client: AsyncGitpod) -> None: @@ -920,12 +1021,9 @@ async def test_method_create_from_project_with_all_params(self, async_client: As }, "desired_phase": "ENVIRONMENT_PHASE_UNSPECIFIED", "devcontainer": { + "default_devcontainer_image": "defaultDevcontainerImage", "devcontainer_file_path": "devcontainerFilePath", - "dotfiles": { - "repository": "https://example.com", - "install_command": "installCommand", - "target_path": "targetPath", - }, + "dotfiles": {"repository": "https://example.com"}, "session": "session", }, "machine": { @@ -941,6 +1039,7 @@ async def test_method_create_from_project_with_all_params(self, async_client: As ], "secrets": [ { + "id": "id", "container_registry_basic_auth_host": "containerRegistryBasicAuthHost", "environment_variable": "environmentVariable", "file_path": "filePath", @@ -1132,3 +1231,39 @@ async def test_streaming_response_stop(self, async_client: AsyncGitpod) -> None: assert_matches_type(object, environment, path=["response"]) assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_method_unarchive(self, async_client: AsyncGitpod) -> None: + environment = await async_client.environments.unarchive() + assert_matches_type(object, environment, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_unarchive_with_all_params(self, async_client: AsyncGitpod) -> None: + environment = await async_client.environments.unarchive( + environment_id="07e03a28-65a5-4d98-b532-8ea67b188048", + ) + assert_matches_type(object, environment, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_unarchive(self, async_client: AsyncGitpod) -> None: + response = await async_client.environments.with_raw_response.unarchive() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + environment = await response.parse() + assert_matches_type(object, environment, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_unarchive(self, async_client: AsyncGitpod) -> None: + async with async_client.environments.with_streaming_response.unarchive() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + environment = await response.parse() + assert_matches_type(object, environment, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_events.py b/tests/api_resources/test_events.py index 11a2ab9..fa926d8 100644 --- a/tests/api_resources/test_events.py +++ b/tests/api_resources/test_events.py @@ -32,14 +32,14 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: token="token", page_size=0, filter={ - "actor_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - "actor_principals": ["PRINCIPAL_UNSPECIFIED"], + "actor_ids": ["d2c94c27-3b76-4a42-b88c-95a85e392c68"], + "actor_principals": ["PRINCIPAL_USER"], "subject_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], "subject_types": ["RESOURCE_TYPE_UNSPECIFIED"], }, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(SyncEntriesPage[EventListResponse], event, path=["response"]) @@ -69,27 +69,26 @@ def test_streaming_response_list(self, client: Gitpod) -> None: @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize def test_method_watch(self, client: Gitpod) -> None: - event = client.events.watch() - assert_matches_type(JSONLDecoder[EventWatchResponse], event, path=["response"]) + event_stream = client.events.watch() + assert_matches_type(JSONLDecoder[EventWatchResponse], event_stream, path=["response"]) @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize def test_method_watch_with_all_params(self, client: Gitpod) -> None: - event = client.events.watch( + event_stream = client.events.watch( environment_id="environmentId", organization=True, ) - assert_matches_type(JSONLDecoder[EventWatchResponse], event, path=["response"]) + assert_matches_type(JSONLDecoder[EventWatchResponse], event_stream, path=["response"]) @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize def test_raw_response_watch(self, client: Gitpod) -> None: response = client.events.with_raw_response.watch() - assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = response.parse() - assert_matches_type(JSONLDecoder[EventWatchResponse], event, path=["response"]) + stream = response.parse() + stream.close() @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize @@ -98,8 +97,8 @@ def test_streaming_response_watch(self, client: Gitpod) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = response.parse() - assert_matches_type(JSONLDecoder[EventWatchResponse], event, path=["response"]) + stream = response.parse() + stream.close() assert cast(Any, response.is_closed) is True @@ -120,14 +119,14 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N token="token", page_size=0, filter={ - "actor_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - "actor_principals": ["PRINCIPAL_UNSPECIFIED"], + "actor_ids": ["d2c94c27-3b76-4a42-b88c-95a85e392c68"], + "actor_principals": ["PRINCIPAL_USER"], "subject_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], "subject_types": ["RESOURCE_TYPE_UNSPECIFIED"], }, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(AsyncEntriesPage[EventListResponse], event, path=["response"]) @@ -157,27 +156,26 @@ async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None: @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize async def test_method_watch(self, async_client: AsyncGitpod) -> None: - event = await async_client.events.watch() - assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event, path=["response"]) + event_stream = await async_client.events.watch() + assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event_stream, path=["response"]) @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize async def test_method_watch_with_all_params(self, async_client: AsyncGitpod) -> None: - event = await async_client.events.watch( + event_stream = await async_client.events.watch( environment_id="environmentId", organization=True, ) - assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event, path=["response"]) + assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event_stream, path=["response"]) @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize async def test_raw_response_watch(self, async_client: AsyncGitpod) -> None: response = await async_client.events.with_raw_response.watch() - assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = await response.parse() - assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event, path=["response"]) + stream = await response.parse() + await stream.close() @pytest.mark.skip(reason="Prism doesn't support JSONL responses yet") @parametrize @@ -186,7 +184,7 @@ async def test_streaming_response_watch(self, async_client: AsyncGitpod) -> None assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = await response.parse() - assert_matches_type(AsyncJSONLDecoder[EventWatchResponse], event, path=["response"]) + stream = await response.parse() + await stream.close() assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_gateways.py b/tests/api_resources/test_gateways.py new file mode 100644 index 0000000..c41f7fb --- /dev/null +++ b/tests/api_resources/test_gateways.py @@ -0,0 +1,105 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gitpod import Gitpod, AsyncGitpod +from tests.utils import assert_matches_type +from gitpod.pagination import SyncGatewaysPage, AsyncGatewaysPage +from gitpod.types.shared import Gateway + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestGateways: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + def test_method_list(self, client: Gitpod) -> None: + gateway = client.gateways.list() + assert_matches_type(SyncGatewaysPage[Gateway], gateway, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_list_with_all_params(self, client: Gitpod) -> None: + gateway = client.gateways.list( + token="token", + page_size=0, + pagination={ + "token": "token", + "page_size": 100, + }, + ) + assert_matches_type(SyncGatewaysPage[Gateway], gateway, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_list(self, client: Gitpod) -> None: + response = client.gateways.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gateway = response.parse() + assert_matches_type(SyncGatewaysPage[Gateway], gateway, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_list(self, client: Gitpod) -> None: + with client.gateways.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gateway = response.parse() + assert_matches_type(SyncGatewaysPage[Gateway], gateway, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncGateways: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + async def test_method_list(self, async_client: AsyncGitpod) -> None: + gateway = await async_client.gateways.list() + assert_matches_type(AsyncGatewaysPage[Gateway], gateway, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> None: + gateway = await async_client.gateways.list( + token="token", + page_size=0, + pagination={ + "token": "token", + "page_size": 100, + }, + ) + assert_matches_type(AsyncGatewaysPage[Gateway], gateway, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_list(self, async_client: AsyncGitpod) -> None: + response = await async_client.gateways.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gateway = await response.parse() + assert_matches_type(AsyncGatewaysPage[Gateway], gateway, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None: + async with async_client.gateways.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gateway = await response.parse() + assert_matches_type(AsyncGatewaysPage[Gateway], gateway, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_groups.py b/tests/api_resources/test_groups.py index 00bfe68..ed1c038 100644 --- a/tests/api_resources/test_groups.py +++ b/tests/api_resources/test_groups.py @@ -32,7 +32,7 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: page_size=0, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(SyncGroupsPage[Group], group, path=["response"]) @@ -77,7 +77,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N page_size=0, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(AsyncGroupsPage[Group], group, path=["response"]) diff --git a/tests/api_resources/test_identity.py b/tests/api_resources/test_identity.py index 46cfd41..bcc639d 100644 --- a/tests/api_resources/test_identity.py +++ b/tests/api_resources/test_identity.py @@ -104,6 +104,7 @@ def test_method_get_id_token(self, client: Gitpod) -> None: def test_method_get_id_token_with_all_params(self, client: Gitpod) -> None: identity = client.identity.get_id_token( audience=["https://api.gitpod.io", "https://ws.gitpod.io"], + version="ID_TOKEN_VERSION_UNSPECIFIED", ) assert_matches_type(IdentityGetIDTokenResponse, identity, path=["response"]) @@ -216,6 +217,7 @@ async def test_method_get_id_token(self, async_client: AsyncGitpod) -> None: async def test_method_get_id_token_with_all_params(self, async_client: AsyncGitpod) -> None: identity = await async_client.identity.get_id_token( audience=["https://api.gitpod.io", "https://ws.gitpod.io"], + version="ID_TOKEN_VERSION_UNSPECIFIED", ) assert_matches_type(IdentityGetIDTokenResponse, identity, path=["response"]) diff --git a/tests/api_resources/test_organizations.py b/tests/api_resources/test_organizations.py index 62a5503..da165e0 100644 --- a/tests/api_resources/test_organizations.py +++ b/tests/api_resources/test_organizations.py @@ -10,14 +10,13 @@ from gitpod import Gitpod, AsyncGitpod from tests.utils import assert_matches_type from gitpod.types import ( - Organization, OrganizationMember, OrganizationJoinResponse, OrganizationCreateResponse, OrganizationUpdateResponse, OrganizationRetrieveResponse, ) -from gitpod.pagination import SyncMembersPage, AsyncMembersPage, SyncOrganizationsPage, AsyncOrganizationsPage +from gitpod.pagination import SyncMembersPage, AsyncMembersPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -147,48 +146,6 @@ def test_streaming_response_update(self, client: Gitpod) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip() - @parametrize - def test_method_list(self, client: Gitpod) -> None: - organization = client.organizations.list() - assert_matches_type(SyncOrganizationsPage[Organization], organization, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_list_with_all_params(self, client: Gitpod) -> None: - organization = client.organizations.list( - token="token", - page_size=0, - pagination={ - "token": "token", - "page_size": 50, - }, - scope="SCOPE_UNSPECIFIED", - ) - assert_matches_type(SyncOrganizationsPage[Organization], organization, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_list(self, client: Gitpod) -> None: - response = client.organizations.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - organization = response.parse() - assert_matches_type(SyncOrganizationsPage[Organization], organization, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_list(self, client: Gitpod) -> None: - with client.organizations.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - organization = response.parse() - assert_matches_type(SyncOrganizationsPage[Organization], organization, path=["response"]) - - assert cast(Any, response.is_closed) is True - @pytest.mark.skip() @parametrize def test_method_delete(self, client: Gitpod) -> None: @@ -357,7 +314,7 @@ def test_method_set_role_with_all_params(self, client: Gitpod) -> None: organization = client.organizations.set_role( organization_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", user_id="f53d2330-3795-4c5d-a1f3-453121af9c60", - role="ORGANIZATION_ROLE_UNSPECIFIED", + role="ORGANIZATION_ROLE_MEMBER", ) assert_matches_type(object, organization, path=["response"]) @@ -515,48 +472,6 @@ async def test_streaming_response_update(self, async_client: AsyncGitpod) -> Non assert cast(Any, response.is_closed) is True - @pytest.mark.skip() - @parametrize - async def test_method_list(self, async_client: AsyncGitpod) -> None: - organization = await async_client.organizations.list() - assert_matches_type(AsyncOrganizationsPage[Organization], organization, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> None: - organization = await async_client.organizations.list( - token="token", - page_size=0, - pagination={ - "token": "token", - "page_size": 50, - }, - scope="SCOPE_UNSPECIFIED", - ) - assert_matches_type(AsyncOrganizationsPage[Organization], organization, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_list(self, async_client: AsyncGitpod) -> None: - response = await async_client.organizations.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - organization = await response.parse() - assert_matches_type(AsyncOrganizationsPage[Organization], organization, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_list(self, async_client: AsyncGitpod) -> None: - async with async_client.organizations.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - organization = await response.parse() - assert_matches_type(AsyncOrganizationsPage[Organization], organization, path=["response"]) - - assert cast(Any, response.is_closed) is True - @pytest.mark.skip() @parametrize async def test_method_delete(self, async_client: AsyncGitpod) -> None: @@ -725,7 +640,7 @@ async def test_method_set_role_with_all_params(self, async_client: AsyncGitpod) organization = await async_client.organizations.set_role( organization_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", user_id="f53d2330-3795-4c5d-a1f3-453121af9c60", - role="ORGANIZATION_ROLE_UNSPECIFIED", + role="ORGANIZATION_ROLE_MEMBER", ) assert_matches_type(object, organization, path=["response"]) diff --git a/tests/api_resources/test_projects.py b/tests/api_resources/test_projects.py index 4a57297..f33816b 100644 --- a/tests/api_resources/test_projects.py +++ b/tests/api_resources/test_projects.py @@ -38,7 +38,7 @@ def test_method_create(self, client: Gitpod) -> None: def test_method_create_with_all_params(self, client: Gitpod) -> None: project = client.projects.create( environment_class={ - "environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "environment_class_id": "d2c94c27-3b76-4a42-b88c-95a85e392c68", "local_runner": True, }, initializer={ @@ -48,7 +48,7 @@ def test_method_create_with_all_params(self, client: Gitpod) -> None: "git": { "checkout_location": "checkoutLocation", "clone_target": "cloneTarget", - "remote_uri": "remoteUri", + "remote_uri": "https://github.com/org/repo", "target_mode": "CLONE_TARGET_MODE_UNSPECIFIED", "upstream_remote_uri": "upstreamRemoteUri", }, @@ -57,7 +57,8 @@ def test_method_create_with_all_params(self, client: Gitpod) -> None: }, automations_file_path="automationsFilePath", devcontainer_file_path="devcontainerFilePath", - name="x", + name="Web Application", + technical_description="technicalDescription", ) assert_matches_type(ProjectCreateResponse, project, path=["response"]) @@ -99,7 +100,7 @@ def test_method_retrieve(self, client: Gitpod) -> None: @parametrize def test_method_retrieve_with_all_params(self, client: Gitpod) -> None: project = client.projects.retrieve( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", ) assert_matches_type(ProjectRetrieveResponse, project, path=["response"]) @@ -138,7 +139,7 @@ def test_method_update_with_all_params(self, client: Gitpod) -> None: automations_file_path="automationsFilePath", devcontainer_file_path="devcontainerFilePath", environment_class={ - "environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "environment_class_id": "d2c94c27-3b76-4a42-b88c-95a85e392c68", "local_runner": True, }, initializer={ @@ -156,7 +157,8 @@ def test_method_update_with_all_params(self, client: Gitpod) -> None: ] }, name="x", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", + technical_description="technicalDescription", ) assert_matches_type(ProjectUpdateResponse, project, path=["response"]) @@ -194,9 +196,10 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: project = client.projects.list( token="token", page_size=0, + filter={"project_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"]}, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(SyncProjectsPage[Project], project, path=["response"]) @@ -233,7 +236,7 @@ def test_method_delete(self, client: Gitpod) -> None: @parametrize def test_method_delete_with_all_params(self, client: Gitpod) -> None: project = client.projects.delete( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", ) assert_matches_type(object, project, path=["response"]) @@ -269,8 +272,8 @@ def test_method_create_from_environment(self, client: Gitpod) -> None: @parametrize def test_method_create_from_environment_with_all_params(self, client: Gitpod) -> None: project = client.projects.create_from_environment( - environment_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - name="x", + environment_id="07e03a28-65a5-4d98-b532-8ea67b188048", + name="Frontend Project", ) assert_matches_type(ProjectCreateFromEnvironmentResponse, project, path=["response"]) @@ -314,7 +317,7 @@ async def test_method_create(self, async_client: AsyncGitpod) -> None: async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> None: project = await async_client.projects.create( environment_class={ - "environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "environment_class_id": "d2c94c27-3b76-4a42-b88c-95a85e392c68", "local_runner": True, }, initializer={ @@ -324,7 +327,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> "git": { "checkout_location": "checkoutLocation", "clone_target": "cloneTarget", - "remote_uri": "remoteUri", + "remote_uri": "https://github.com/org/repo", "target_mode": "CLONE_TARGET_MODE_UNSPECIFIED", "upstream_remote_uri": "upstreamRemoteUri", }, @@ -333,7 +336,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> }, automations_file_path="automationsFilePath", devcontainer_file_path="devcontainerFilePath", - name="x", + name="Web Application", + technical_description="technicalDescription", ) assert_matches_type(ProjectCreateResponse, project, path=["response"]) @@ -375,7 +379,7 @@ async def test_method_retrieve(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncGitpod) -> None: project = await async_client.projects.retrieve( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", ) assert_matches_type(ProjectRetrieveResponse, project, path=["response"]) @@ -414,7 +418,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> automations_file_path="automationsFilePath", devcontainer_file_path="devcontainerFilePath", environment_class={ - "environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "environment_class_id": "d2c94c27-3b76-4a42-b88c-95a85e392c68", "local_runner": True, }, initializer={ @@ -432,7 +436,8 @@ async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> ] }, name="x", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", + technical_description="technicalDescription", ) assert_matches_type(ProjectUpdateResponse, project, path=["response"]) @@ -470,9 +475,10 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N project = await async_client.projects.list( token="token", page_size=0, + filter={"project_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"]}, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(AsyncProjectsPage[Project], project, path=["response"]) @@ -509,7 +515,7 @@ async def test_method_delete(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_delete_with_all_params(self, async_client: AsyncGitpod) -> None: project = await async_client.projects.delete( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", ) assert_matches_type(object, project, path=["response"]) @@ -545,8 +551,8 @@ async def test_method_create_from_environment(self, async_client: AsyncGitpod) - @parametrize async def test_method_create_from_environment_with_all_params(self, async_client: AsyncGitpod) -> None: project = await async_client.projects.create_from_environment( - environment_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - name="x", + environment_id="07e03a28-65a5-4d98-b532-8ea67b188048", + name="Frontend Project", ) assert_matches_type(ProjectCreateFromEnvironmentResponse, project, path=["response"]) diff --git a/tests/api_resources/test_runners.py b/tests/api_resources/test_runners.py index 3829f7d..f20cf48 100644 --- a/tests/api_resources/test_runners.py +++ b/tests/api_resources/test_runners.py @@ -36,15 +36,24 @@ def test_method_create(self, client: Gitpod) -> None: def test_method_create_with_all_params(self, client: Gitpod) -> None: runner = client.runners.create( kind="RUNNER_KIND_UNSPECIFIED", - name="xxx", - provider="RUNNER_PROVIDER_UNSPECIFIED", + name="Production Runner", + provider="RUNNER_PROVIDER_AWS_EC2", + runner_manager_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", spec={ "configuration": { "auto_update": True, - "region": "region", - "release_channel": "RUNNER_RELEASE_CHANNEL_UNSPECIFIED", + "devcontainer_image_cache_enabled": True, + "log_level": "LOG_LEVEL_UNSPECIFIED", + "metrics": { + "enabled": True, + "password": "password", + "url": "url", + "username": "username", + }, + "region": "us-west", + "release_channel": "RUNNER_RELEASE_CHANNEL_STABLE", }, - "desired_phase": "RUNNER_PHASE_UNSPECIFIED", + "desired_phase": "RUNNER_PHASE_ACTIVE", }, ) assert_matches_type(RunnerCreateResponse, runner, path=["response"]) @@ -81,7 +90,7 @@ def test_method_retrieve(self, client: Gitpod) -> None: @parametrize def test_method_retrieve_with_all_params(self, client: Gitpod) -> None: runner = client.runners.retrieve( - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(RunnerRetrieveResponse, runner, path=["response"]) @@ -117,12 +126,20 @@ def test_method_update(self, client: Gitpod) -> None: @parametrize def test_method_update_with_all_params(self, client: Gitpod) -> None: runner = client.runners.update( - name="xxx", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + name="Updated Runner Name", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", spec={ "configuration": { "auto_update": True, - "release_channel": "RUNNER_RELEASE_CHANNEL_UNSPECIFIED", + "devcontainer_image_cache_enabled": True, + "log_level": "LOG_LEVEL_UNSPECIFIED", + "metrics": { + "enabled": True, + "password": "password", + "url": "url", + "username": "username", + }, + "release_channel": "RUNNER_RELEASE_CHANNEL_LATEST", }, "desired_phase": "RUNNER_PHASE_UNSPECIFIED", }, @@ -166,11 +183,11 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: filter={ "creator_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], "kinds": ["RUNNER_KIND_UNSPECIFIED"], - "providers": ["RUNNER_PROVIDER_UNSPECIFIED"], + "providers": ["RUNNER_PROVIDER_AWS_EC2"], }, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(SyncRunnersPage[Runner], runner, path=["response"]) @@ -208,7 +225,7 @@ def test_method_delete(self, client: Gitpod) -> None: def test_method_delete_with_all_params(self, client: Gitpod) -> None: runner = client.runners.delete( force=True, - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(object, runner, path=["response"]) @@ -244,7 +261,7 @@ def test_method_check_authentication_for_host(self, client: Gitpod) -> None: @parametrize def test_method_check_authentication_for_host_with_all_params(self, client: Gitpod) -> None: runner = client.runners.check_authentication_for_host( - host="host", + host="github.com", runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) assert_matches_type(RunnerCheckAuthenticationForHostResponse, runner, path=["response"]) @@ -281,7 +298,7 @@ def test_method_create_runner_token(self, client: Gitpod) -> None: @parametrize def test_method_create_runner_token_with_all_params(self, client: Gitpod) -> None: runner = client.runners.create_runner_token( - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(RunnerCreateRunnerTokenResponse, runner, path=["response"]) @@ -317,7 +334,7 @@ def test_method_parse_context_url(self, client: Gitpod) -> None: @parametrize def test_method_parse_context_url_with_all_params(self, client: Gitpod) -> None: runner = client.runners.parse_context_url( - context_url="https://example.com", + context_url="https://github.com/org/repo/tree/main", runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) assert_matches_type(RunnerParseContextURLResponse, runner, path=["response"]) @@ -359,15 +376,24 @@ async def test_method_create(self, async_client: AsyncGitpod) -> None: async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> None: runner = await async_client.runners.create( kind="RUNNER_KIND_UNSPECIFIED", - name="xxx", - provider="RUNNER_PROVIDER_UNSPECIFIED", + name="Production Runner", + provider="RUNNER_PROVIDER_AWS_EC2", + runner_manager_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", spec={ "configuration": { "auto_update": True, - "region": "region", - "release_channel": "RUNNER_RELEASE_CHANNEL_UNSPECIFIED", + "devcontainer_image_cache_enabled": True, + "log_level": "LOG_LEVEL_UNSPECIFIED", + "metrics": { + "enabled": True, + "password": "password", + "url": "url", + "username": "username", + }, + "region": "us-west", + "release_channel": "RUNNER_RELEASE_CHANNEL_STABLE", }, - "desired_phase": "RUNNER_PHASE_UNSPECIFIED", + "desired_phase": "RUNNER_PHASE_ACTIVE", }, ) assert_matches_type(RunnerCreateResponse, runner, path=["response"]) @@ -404,7 +430,7 @@ async def test_method_retrieve(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncGitpod) -> None: runner = await async_client.runners.retrieve( - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(RunnerRetrieveResponse, runner, path=["response"]) @@ -440,12 +466,20 @@ async def test_method_update(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> None: runner = await async_client.runners.update( - name="xxx", - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + name="Updated Runner Name", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", spec={ "configuration": { "auto_update": True, - "release_channel": "RUNNER_RELEASE_CHANNEL_UNSPECIFIED", + "devcontainer_image_cache_enabled": True, + "log_level": "LOG_LEVEL_UNSPECIFIED", + "metrics": { + "enabled": True, + "password": "password", + "url": "url", + "username": "username", + }, + "release_channel": "RUNNER_RELEASE_CHANNEL_LATEST", }, "desired_phase": "RUNNER_PHASE_UNSPECIFIED", }, @@ -489,11 +523,11 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N filter={ "creator_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], "kinds": ["RUNNER_KIND_UNSPECIFIED"], - "providers": ["RUNNER_PROVIDER_UNSPECIFIED"], + "providers": ["RUNNER_PROVIDER_AWS_EC2"], }, pagination={ "token": "token", - "page_size": 100, + "page_size": 20, }, ) assert_matches_type(AsyncRunnersPage[Runner], runner, path=["response"]) @@ -531,7 +565,7 @@ async def test_method_delete(self, async_client: AsyncGitpod) -> None: async def test_method_delete_with_all_params(self, async_client: AsyncGitpod) -> None: runner = await async_client.runners.delete( force=True, - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(object, runner, path=["response"]) @@ -567,7 +601,7 @@ async def test_method_check_authentication_for_host(self, async_client: AsyncGit @parametrize async def test_method_check_authentication_for_host_with_all_params(self, async_client: AsyncGitpod) -> None: runner = await async_client.runners.check_authentication_for_host( - host="host", + host="github.com", runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) assert_matches_type(RunnerCheckAuthenticationForHostResponse, runner, path=["response"]) @@ -604,7 +638,7 @@ async def test_method_create_runner_token(self, async_client: AsyncGitpod) -> No @parametrize async def test_method_create_runner_token_with_all_params(self, async_client: AsyncGitpod) -> None: runner = await async_client.runners.create_runner_token( - runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + runner_id="d2c94c27-3b76-4a42-b88c-95a85e392c68", ) assert_matches_type(RunnerCreateRunnerTokenResponse, runner, path=["response"]) @@ -640,7 +674,7 @@ async def test_method_parse_context_url(self, async_client: AsyncGitpod) -> None @parametrize async def test_method_parse_context_url_with_all_params(self, async_client: AsyncGitpod) -> None: runner = await async_client.runners.parse_context_url( - context_url="https://example.com", + context_url="https://github.com/org/repo/tree/main", runner_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) assert_matches_type(RunnerParseContextURLResponse, runner, path=["response"]) diff --git a/tests/api_resources/test_secrets.py b/tests/api_resources/test_secrets.py index 414aab0..02a4766 100644 --- a/tests/api_resources/test_secrets.py +++ b/tests/api_resources/test_secrets.py @@ -32,11 +32,15 @@ def test_method_create(self, client: Gitpod) -> None: @parametrize def test_method_create_with_all_params(self, client: Gitpod) -> None: secret = client.secrets.create( - container_registry_basic_auth_host="https://example.com", + container_registry_basic_auth_host="containerRegistryBasicAuthHost", environment_variable=True, file_path="filePath", name="DATABASE_URL", project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", + scope={ + "project_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "user_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + }, value="postgresql://user:pass@localhost:5432/db", ) assert_matches_type(SecretCreateResponse, secret, path=["response"]) @@ -75,7 +79,13 @@ def test_method_list_with_all_params(self, client: Gitpod) -> None: secret = client.secrets.list( token="token", page_size=0, - filter={"project_ids": ["b0e12f6c-4c67-429d-a4a6-d9838b5da047"]}, + filter={ + "project_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + "scope": { + "project_id": "b0e12f6c-4c67-429d-a4a6-d9838b5da047", + "user_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + }, + }, pagination={ "token": "token", "page_size": 20, @@ -228,11 +238,15 @@ async def test_method_create(self, async_client: AsyncGitpod) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGitpod) -> None: secret = await async_client.secrets.create( - container_registry_basic_auth_host="https://example.com", + container_registry_basic_auth_host="containerRegistryBasicAuthHost", environment_variable=True, file_path="filePath", name="DATABASE_URL", project_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047", + scope={ + "project_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "user_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + }, value="postgresql://user:pass@localhost:5432/db", ) assert_matches_type(SecretCreateResponse, secret, path=["response"]) @@ -271,7 +285,13 @@ async def test_method_list_with_all_params(self, async_client: AsyncGitpod) -> N secret = await async_client.secrets.list( token="token", page_size=0, - filter={"project_ids": ["b0e12f6c-4c67-429d-a4a6-d9838b5da047"]}, + filter={ + "project_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + "scope": { + "project_id": "b0e12f6c-4c67-429d-a4a6-d9838b5da047", + "user_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + }, + }, pagination={ "token": "token", "page_size": 20, diff --git a/tests/api_resources/test_usage.py b/tests/api_resources/test_usage.py new file mode 100644 index 0000000..9a005f9 --- /dev/null +++ b/tests/api_resources/test_usage.py @@ -0,0 +1,120 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gitpod import Gitpod, AsyncGitpod +from tests.utils import assert_matches_type +from gitpod.types import EnvironmentUsageRecord +from gitpod._utils import parse_datetime +from gitpod.pagination import SyncRecordsPage, AsyncRecordsPage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestUsage: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + def test_method_list_environment_runtime_records(self, client: Gitpod) -> None: + usage = client.usage.list_environment_runtime_records() + assert_matches_type(SyncRecordsPage[EnvironmentUsageRecord], usage, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_list_environment_runtime_records_with_all_params(self, client: Gitpod) -> None: + usage = client.usage.list_environment_runtime_records( + token="token", + page_size=0, + filter={ + "date_range": { + "end_time": parse_datetime("2024-01-02T00:00:00Z"), + "start_time": parse_datetime("2024-01-01T00:00:00Z"), + }, + "project_id": "d2c94c27-3b76-4a42-b88c-95a85e392c68", + }, + pagination={ + "token": "token", + "page_size": 100, + }, + ) + assert_matches_type(SyncRecordsPage[EnvironmentUsageRecord], usage, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_list_environment_runtime_records(self, client: Gitpod) -> None: + response = client.usage.with_raw_response.list_environment_runtime_records() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + usage = response.parse() + assert_matches_type(SyncRecordsPage[EnvironmentUsageRecord], usage, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_list_environment_runtime_records(self, client: Gitpod) -> None: + with client.usage.with_streaming_response.list_environment_runtime_records() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + usage = response.parse() + assert_matches_type(SyncRecordsPage[EnvironmentUsageRecord], usage, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncUsage: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + async def test_method_list_environment_runtime_records(self, async_client: AsyncGitpod) -> None: + usage = await async_client.usage.list_environment_runtime_records() + assert_matches_type(AsyncRecordsPage[EnvironmentUsageRecord], usage, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_list_environment_runtime_records_with_all_params(self, async_client: AsyncGitpod) -> None: + usage = await async_client.usage.list_environment_runtime_records( + token="token", + page_size=0, + filter={ + "date_range": { + "end_time": parse_datetime("2024-01-02T00:00:00Z"), + "start_time": parse_datetime("2024-01-01T00:00:00Z"), + }, + "project_id": "d2c94c27-3b76-4a42-b88c-95a85e392c68", + }, + pagination={ + "token": "token", + "page_size": 100, + }, + ) + assert_matches_type(AsyncRecordsPage[EnvironmentUsageRecord], usage, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_list_environment_runtime_records(self, async_client: AsyncGitpod) -> None: + response = await async_client.usage.with_raw_response.list_environment_runtime_records() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + usage = await response.parse() + assert_matches_type(AsyncRecordsPage[EnvironmentUsageRecord], usage, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_list_environment_runtime_records(self, async_client: AsyncGitpod) -> None: + async with async_client.usage.with_streaming_response.list_environment_runtime_records() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + usage = await response.parse() + assert_matches_type(AsyncRecordsPage[EnvironmentUsageRecord], usage, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/users/test_dotfiles.py b/tests/api_resources/users/test_dotfiles.py new file mode 100644 index 0000000..ff40da7 --- /dev/null +++ b/tests/api_resources/users/test_dotfiles.py @@ -0,0 +1,166 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gitpod import Gitpod, AsyncGitpod +from tests.utils import assert_matches_type +from gitpod.types.users import DotfileGetResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestDotfiles: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + def test_method_get(self, client: Gitpod) -> None: + dotfile = client.users.dotfiles.get() + assert_matches_type(DotfileGetResponse, dotfile, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_get_with_all_params(self, client: Gitpod) -> None: + dotfile = client.users.dotfiles.get( + empty=True, + ) + assert_matches_type(DotfileGetResponse, dotfile, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_get(self, client: Gitpod) -> None: + response = client.users.dotfiles.with_raw_response.get() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dotfile = response.parse() + assert_matches_type(DotfileGetResponse, dotfile, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_get(self, client: Gitpod) -> None: + with client.users.dotfiles.with_streaming_response.get() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dotfile = response.parse() + assert_matches_type(DotfileGetResponse, dotfile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_method_set(self, client: Gitpod) -> None: + dotfile = client.users.dotfiles.set() + assert_matches_type(object, dotfile, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_set_with_all_params(self, client: Gitpod) -> None: + dotfile = client.users.dotfiles.set( + repository="https://example.com", + ) + assert_matches_type(object, dotfile, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_set(self, client: Gitpod) -> None: + response = client.users.dotfiles.with_raw_response.set() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dotfile = response.parse() + assert_matches_type(object, dotfile, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_set(self, client: Gitpod) -> None: + with client.users.dotfiles.with_streaming_response.set() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dotfile = response.parse() + assert_matches_type(object, dotfile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncDotfiles: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + async def test_method_get(self, async_client: AsyncGitpod) -> None: + dotfile = await async_client.users.dotfiles.get() + assert_matches_type(DotfileGetResponse, dotfile, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_get_with_all_params(self, async_client: AsyncGitpod) -> None: + dotfile = await async_client.users.dotfiles.get( + empty=True, + ) + assert_matches_type(DotfileGetResponse, dotfile, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_get(self, async_client: AsyncGitpod) -> None: + response = await async_client.users.dotfiles.with_raw_response.get() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dotfile = await response.parse() + assert_matches_type(DotfileGetResponse, dotfile, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGitpod) -> None: + async with async_client.users.dotfiles.with_streaming_response.get() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dotfile = await response.parse() + assert_matches_type(DotfileGetResponse, dotfile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_method_set(self, async_client: AsyncGitpod) -> None: + dotfile = await async_client.users.dotfiles.set() + assert_matches_type(object, dotfile, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_set_with_all_params(self, async_client: AsyncGitpod) -> None: + dotfile = await async_client.users.dotfiles.set( + repository="https://example.com", + ) + assert_matches_type(object, dotfile, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_set(self, async_client: AsyncGitpod) -> None: + response = await async_client.users.dotfiles.with_raw_response.set() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dotfile = await response.parse() + assert_matches_type(object, dotfile, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_set(self, async_client: AsyncGitpod) -> None: + async with async_client.users.dotfiles.with_streaming_response.set() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dotfile = await response.parse() + assert_matches_type(object, dotfile, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/conftest.py b/tests/conftest.py index d7bb7fa..2dc77cd 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -10,7 +10,7 @@ from gitpod import Gitpod, AsyncGitpod if TYPE_CHECKING: - from _pytest.fixtures import FixtureRequest + from _pytest.fixtures import FixtureRequest # pyright: ignore[reportPrivateImportUsage] pytest.register_assert_rewrite("tests.utils") diff --git a/tests/test_client.py b/tests/test_client.py index c3fd3ca..a2433c9 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -847,6 +847,33 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: assert response.http_request.headers.get("x-stainless-retry-count") == "42" + @pytest.mark.respx(base_url=base_url) + def test_follow_redirects(self, respx_mock: MockRouter) -> None: + # Test that the default follow_redirects=True allows following redirects + respx_mock.post("/redirect").mock( + return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) + ) + respx_mock.get("/redirected").mock(return_value=httpx.Response(200, json={"status": "ok"})) + + response = self.client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) + assert response.status_code == 200 + assert response.json() == {"status": "ok"} + + @pytest.mark.respx(base_url=base_url) + def test_follow_redirects_disabled(self, respx_mock: MockRouter) -> None: + # Test that follow_redirects=False prevents following redirects + respx_mock.post("/redirect").mock( + return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) + ) + + with pytest.raises(APIStatusError) as exc_info: + self.client.post( + "/redirect", body={"key": "value"}, options={"follow_redirects": False}, cast_to=httpx.Response + ) + + assert exc_info.value.response.status_code == 302 + assert exc_info.value.response.headers["Location"] == f"{base_url}/redirected" + class TestAsyncGitpod: client = AsyncGitpod(base_url=base_url, bearer_token=bearer_token, _strict_response_validation=True) @@ -1662,7 +1689,7 @@ def test_get_platform(self) -> None: import threading from gitpod._utils import asyncify - from gitpod._base_client import get_platform + from gitpod._base_client import get_platform async def test_main() -> None: result = await asyncify(get_platform)() @@ -1694,3 +1721,30 @@ async def test_main() -> None: raise AssertionError("calling get_platform using asyncify resulted in a hung process") time.sleep(0.1) + + @pytest.mark.respx(base_url=base_url) + async def test_follow_redirects(self, respx_mock: MockRouter) -> None: + # Test that the default follow_redirects=True allows following redirects + respx_mock.post("/redirect").mock( + return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) + ) + respx_mock.get("/redirected").mock(return_value=httpx.Response(200, json={"status": "ok"})) + + response = await self.client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) + assert response.status_code == 200 + assert response.json() == {"status": "ok"} + + @pytest.mark.respx(base_url=base_url) + async def test_follow_redirects_disabled(self, respx_mock: MockRouter) -> None: + # Test that follow_redirects=False prevents following redirects + respx_mock.post("/redirect").mock( + return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) + ) + + with pytest.raises(APIStatusError) as exc_info: + await self.client.post( + "/redirect", body={"key": "value"}, options={"follow_redirects": False}, cast_to=httpx.Response + ) + + assert exc_info.value.response.status_code == 302 + assert exc_info.value.response.headers["Location"] == f"{base_url}/redirected" diff --git a/tests/test_models.py b/tests/test_models.py index c581777..7813b82 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -492,12 +492,15 @@ class Model(BaseModel): resource_id: Optional[str] = None m = Model.construct() + assert m.resource_id is None assert "resource_id" not in m.model_fields_set m = Model.construct(resource_id=None) + assert m.resource_id is None assert "resource_id" in m.model_fields_set m = Model.construct(resource_id="foo") + assert m.resource_id == "foo" assert "resource_id" in m.model_fields_set @@ -832,7 +835,7 @@ class B(BaseModel): @pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1") def test_type_alias_type() -> None: - Alias = TypeAliasType("Alias", str) + Alias = TypeAliasType("Alias", str) # pyright: ignore class Model(BaseModel): alias: Alias @@ -854,3 +857,35 @@ class Model(BaseModel): m = construct_type(value={"cls": "foo"}, type_=Model) assert isinstance(m, Model) assert isinstance(m.cls, str) + + +def test_discriminated_union_case() -> None: + class A(BaseModel): + type: Literal["a"] + + data: bool + + class B(BaseModel): + type: Literal["b"] + + data: List[Union[A, object]] + + class ModelA(BaseModel): + type: Literal["modelA"] + + data: int + + class ModelB(BaseModel): + type: Literal["modelB"] + + required: str + + data: Union[A, B] + + # when constructing ModelA | ModelB, value data doesn't match ModelB exactly - missing `required` + m = construct_type( + value={"type": "modelB", "data": {"type": "a", "data": True}}, + type_=cast(Any, Annotated[Union[ModelA, ModelB], PropertyInfo(discriminator="type")]), + ) + + assert isinstance(m, ModelB) diff --git a/tests/test_transform.py b/tests/test_transform.py index 816139f..2a74ad4 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -8,7 +8,7 @@ import pytest -from gitpod._types import Base64FileInput +from gitpod._types import NOT_GIVEN, Base64FileInput from gitpod._utils import ( PropertyInfo, transform as _transform, @@ -432,3 +432,22 @@ async def test_base64_file_input(use_async: bool) -> None: assert await transform({"foo": io.BytesIO(b"Hello, world!")}, TypedDictBase64Input, use_async) == { "foo": "SGVsbG8sIHdvcmxkIQ==" } # type: ignore[comparison-overlap] + + +@parametrize +@pytest.mark.asyncio +async def test_transform_skipping(use_async: bool) -> None: + # lists of ints are left as-is + data = [1, 2, 3] + assert await transform(data, List[int], use_async) is data + + # iterables of ints are converted to a list + data = iter([1, 2, 3]) + assert await transform(data, Iterable[int], use_async) == [1, 2, 3] + + +@parametrize +@pytest.mark.asyncio +async def test_strips_notgiven(use_async: bool) -> None: + assert await transform({"foo_bar": "bar"}, Foo1, use_async) == {"fooBar": "bar"} + assert await transform({"foo_bar": NOT_GIVEN}, Foo1, use_async) == {} diff --git a/tests/test_utils/test_proxy.py b/tests/test_utils/test_proxy.py index a646569..ec41af2 100644 --- a/tests/test_utils/test_proxy.py +++ b/tests/test_utils/test_proxy.py @@ -21,3 +21,14 @@ def test_recursive_proxy() -> None: assert dir(proxy) == [] assert type(proxy).__name__ == "RecursiveLazyProxy" assert type(operator.attrgetter("name.foo.bar.baz")(proxy)).__name__ == "RecursiveLazyProxy" + + +def test_isinstance_does_not_error() -> None: + class AlwaysErrorProxy(LazyProxy[Any]): + @override + def __load__(self) -> Any: + raise RuntimeError("Mocking missing dependency") + + proxy = AlwaysErrorProxy() + assert not isinstance(proxy, dict) + assert isinstance(proxy, LazyProxy)