diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 10f3091..59acac4 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.2.0" + ".": "0.27.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index a7f151b..15f75e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [0.27.0](https://github.com/kernel/hypeman-python/compare/v0.2.0...v0.27.0) (2026-08-31) + + +### Features + +* Allow skipping graceful shutdown on instance delete ([cfc7ca8](https://github.com/kernel/hypeman-python/commit/cfc7ca84d29e364889896f01c6e10cedd3ec0541)) + + +### Chores + +* align release version ([918cac7](https://github.com/kernel/hypeman-python/commit/918cac7aea641e285791de9d2377fc245b696da7)) + ## [0.2.0](https://github.com/kernel/hypeman-python/compare/v0.1.0...v0.2.0) (2026-08-21) diff --git a/api.md b/api.md index 9b4aea6..501bfe7 100644 --- a/api.md +++ b/api.md @@ -87,7 +87,7 @@ Methods: - client.instances.create(\*\*params) -> Instance - client.instances.update(id, \*\*params) -> Instance - client.instances.list(\*\*params) -> InstanceListResponse -- client.instances.delete(id) -> None +- client.instances.delete(id, \*\*params) -> None - client.instances.fork(id, \*\*params) -> Instance - client.instances.get(id) -> Instance - client.instances.logs(id, \*\*params) -> str diff --git a/pyproject.toml b/pyproject.toml index e4edf07..f9656f1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "hypeman" -version = "0.2.0" +version = "0.27.0" description = "The official Python library for the hypeman API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/hypeman/_version.py b/src/hypeman/_version.py index b6e2188..fdd589f 100644 --- a/src/hypeman/_version.py +++ b/src/hypeman/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "hypeman" -__version__ = "0.2.0" # x-release-please-version +__version__ = "0.27.0" # x-release-please-version diff --git a/src/hypeman/resources/instances/instances.py b/src/hypeman/resources/instances/instances.py index 5e5a97a..513e422 100644 --- a/src/hypeman/resources/instances/instances.py +++ b/src/hypeman/resources/instances/instances.py @@ -16,6 +16,7 @@ instance_wait_params, instance_start_params, instance_create_params, + instance_delete_params, instance_update_params, instance_standby_params, ) @@ -404,6 +405,7 @@ def delete( self, id: str, *, + graceful_shutdown: bool | Omit = omit, # 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, @@ -415,6 +417,8 @@ def delete( Stop and delete instance Args: + graceful_shutdown: Whether to attempt graceful guest shutdown before deleting the instance + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -429,7 +433,13 @@ def delete( return self._delete( path_template("/instances/{id}", id=id), options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"graceful_shutdown": graceful_shutdown}, instance_delete_params.InstanceDeleteParams + ), ), cast_to=NoneType, ) @@ -1217,6 +1227,7 @@ async def delete( self, id: str, *, + graceful_shutdown: bool | Omit = omit, # 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, @@ -1228,6 +1239,8 @@ async def delete( Stop and delete instance Args: + graceful_shutdown: Whether to attempt graceful guest shutdown before deleting the instance + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1242,7 +1255,13 @@ async def delete( return await self._delete( path_template("/instances/{id}", id=id), options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"graceful_shutdown": graceful_shutdown}, instance_delete_params.InstanceDeleteParams + ), ), cast_to=NoneType, ) diff --git a/src/hypeman/types/__init__.py b/src/hypeman/types/__init__.py index 68d83c5..ca69a64 100644 --- a/src/hypeman/types/__init__.py +++ b/src/hypeman/types/__init__.py @@ -90,6 +90,7 @@ from .snapshot_policy_param import SnapshotPolicyParam as SnapshotPolicyParam from .health_check_tcp_param import HealthCheckTcpParam as HealthCheckTcpParam from .instance_create_params import InstanceCreateParams as InstanceCreateParams +from .instance_delete_params import InstanceDeleteParams as InstanceDeleteParams from .instance_health_status import InstanceHealthStatus as InstanceHealthStatus from .instance_list_response import InstanceListResponse as InstanceListResponse from .instance_logs_response import InstanceLogsResponse as InstanceLogsResponse diff --git a/src/hypeman/types/instance_delete_params.py b/src/hypeman/types/instance_delete_params.py new file mode 100644 index 0000000..a564d6d --- /dev/null +++ b/src/hypeman/types/instance_delete_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["InstanceDeleteParams"] + + +class InstanceDeleteParams(TypedDict, total=False): + graceful_shutdown: bool + """Whether to attempt graceful guest shutdown before deleting the instance""" diff --git a/tests/api_resources/test_instances.py b/tests/api_resources/test_instances.py index 8682689..8f8a731 100644 --- a/tests/api_resources/test_instances.py +++ b/tests/api_resources/test_instances.py @@ -292,7 +292,16 @@ def test_streaming_response_list(self, client: Hypeman) -> None: @parametrize def test_method_delete(self, client: Hypeman) -> None: instance = client.instances.delete( - "id", + id="id", + ) + assert instance is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_delete_with_all_params(self, client: Hypeman) -> None: + instance = client.instances.delete( + id="id", + graceful_shutdown=True, ) assert instance is None @@ -300,7 +309,7 @@ def test_method_delete(self, client: Hypeman) -> None: @parametrize def test_raw_response_delete(self, client: Hypeman) -> None: response = client.instances.with_raw_response.delete( - "id", + id="id", ) assert response.is_closed is True @@ -312,7 +321,7 @@ def test_raw_response_delete(self, client: Hypeman) -> None: @parametrize def test_streaming_response_delete(self, client: Hypeman) -> None: with client.instances.with_streaming_response.delete( - "id", + id="id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -327,7 +336,7 @@ def test_streaming_response_delete(self, client: Hypeman) -> None: def test_path_params_delete(self, client: Hypeman) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.instances.with_raw_response.delete( - "", + id="", ) @pytest.mark.skip(reason="Mock server tests are disabled") @@ -1101,7 +1110,16 @@ async def test_streaming_response_list(self, async_client: AsyncHypeman) -> None @parametrize async def test_method_delete(self, async_client: AsyncHypeman) -> None: instance = await async_client.instances.delete( - "id", + id="id", + ) + assert instance is None + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_delete_with_all_params(self, async_client: AsyncHypeman) -> None: + instance = await async_client.instances.delete( + id="id", + graceful_shutdown=True, ) assert instance is None @@ -1109,7 +1127,7 @@ async def test_method_delete(self, async_client: AsyncHypeman) -> None: @parametrize async def test_raw_response_delete(self, async_client: AsyncHypeman) -> None: response = await async_client.instances.with_raw_response.delete( - "id", + id="id", ) assert response.is_closed is True @@ -1121,7 +1139,7 @@ async def test_raw_response_delete(self, async_client: AsyncHypeman) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncHypeman) -> None: async with async_client.instances.with_streaming_response.delete( - "id", + id="id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1136,7 +1154,7 @@ async def test_streaming_response_delete(self, async_client: AsyncHypeman) -> No async def test_path_params_delete(self, async_client: AsyncHypeman) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.instances.with_raw_response.delete( - "", + id="", ) @pytest.mark.skip(reason="Mock server tests are disabled")