1
0
Fork 0
mirror of https://github.com/ansible-collections/hetzner.hcloud.git synced 2026-02-04 08:01:49 +00:00

chore(deps): update dependency hcloud to v2.13.0 (#776)

This PR contains the following updates:

| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [hcloud](https://redirect.github.com/hetznercloud/hcloud-python)
([changelog](https://redirect.github.com/hetznercloud/hcloud-python/blob/main/CHANGELOG.md))
| `2.12.0` -> `2.13.0` |
![age](https://developer.mend.io/api/mc/badges/age/pypi/hcloud/2.13.0?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/hcloud/2.12.0/2.13.0?slim=true)
|

---

### Release Notes

<details>
<summary>hetznercloud/hcloud-python (hcloud)</summary>

###
[`v2.13.0`](https://redirect.github.com/hetznercloud/hcloud-python/blob/HEAD/CHANGELOG.md#v2130)

[Compare
Source](https://redirect.github.com/hetznercloud/hcloud-python/compare/v2.12.0...v2.13.0)

##### Features

- add per primary ip actions list operations
([#&#8203;608](https://redirect.github.com/hetznercloud/hcloud-python/issues/608))
- deprecate datacenter in `primary ips` and `servers`
([#&#8203;609](https://redirect.github.com/hetznercloud/hcloud-python/issues/609))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/ansible-collections/hetzner.hcloud).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi41OS4wIiwidXBkYXRlZEluVmVyIjoiNDIuNTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: jo <ljonas@riseup.net>
This commit is contained in:
renovate[bot] 2025-12-19 19:50:01 +01:00 committed by GitHub
parent f204b21ee0
commit af3e9f4bf2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
63 changed files with 1487 additions and 895 deletions

View file

@ -3,7 +3,14 @@ from __future__ import annotations
import warnings
from typing import TYPE_CHECKING, Any, NamedTuple
from ..actions import ActionsPageResult, BoundAction, ResourceActionsClient
from ..actions import (
ActionSort,
ActionsPageResult,
ActionStatus,
BoundAction,
ResourceActionsClient,
)
from ..actions.client import ResourceClientBaseActionsMixin
from ..core import BoundModelBase, Meta, ResourceClientBase
from .domain import Image
@ -11,12 +18,23 @@ if TYPE_CHECKING:
from .._client import Client
class BoundImage(BoundModelBase, Image):
__all__ = [
"BoundImage",
"ImagesPageResult",
"ImagesClient",
]
class BoundImage(BoundModelBase[Image], Image):
_client: ImagesClient
model = Image
def __init__(self, client: ImagesClient, data: dict):
def __init__(
self,
client: ImagesClient,
data: dict[str, Any],
):
# pylint: disable=import-outside-toplevel
from ..servers import BoundServer
@ -35,22 +53,18 @@ class BoundImage(BoundModelBase, Image):
def get_actions_list(
self,
sort: list[str] | None = None,
status: list[ActionStatus] | None = None,
sort: list[ActionSort] | None = None,
page: int | None = None,
per_page: int | None = None,
status: list[str] | None = None,
) -> ActionsPageResult:
"""Returns a list of action objects for the image.
"""
Returns a paginated list of Actions for a Image.
:param status: List[str] (optional)
Response will have only actions with specified statuses. Choices: `running` `success` `error`
:param sort: List[str] (optional)
Specify how the results are sorted. Choices: `id` `id:asc` `id:desc` `command` `command:asc` `command:desc` `status` `status:asc` `status:desc` `progress` `progress:asc` `progress:desc` `started` `started:asc` `started:desc` `finished` `finished:asc` `finished:desc`
:param page: int (optional)
Specifies the page to fetch
:param per_page: int (optional)
Specifies how many results are returned by page
:return: (List[:class:`BoundAction <hcloud.actions.client.BoundAction>`], :class:`Meta <hcloud.core.domain.Meta>`)
:param status: Filter the Actions by status.
:param sort: Sort Actions by field and direction.
:param page: Page number to get.
:param per_page: Maximum number of Actions returned per page.
"""
return self._client.get_actions_list(
self,
@ -62,16 +76,14 @@ class BoundImage(BoundModelBase, Image):
def get_actions(
self,
sort: list[str] | None = None,
status: list[str] | None = None,
status: list[ActionStatus] | None = None,
sort: list[ActionSort] | None = None,
) -> list[BoundAction]:
"""Returns all action objects for the image.
"""
Returns all Actions for a Image.
:param status: List[str] (optional)
Response will have only actions with specified statuses. Choices: `running` `success` `error`
:param sort: List[str] (optional)
Specify how the results are sorted. Choices: `id` `id:asc` `id:desc` `command` `command:asc` `command:desc` `status` `status:asc` `status:desc` `progress` `progress:asc` `progress:desc` `started` `started:asc` `started:desc` `finished` `finished:asc` `finished:desc`
:return: List[:class:`BoundAction <hcloud.actions.client.BoundAction>`]
:param status: Filter the Actions by status.
:param sort: Sort Actions by field and direction.
"""
return self._client.get_actions(
self,
@ -122,7 +134,10 @@ class ImagesPageResult(NamedTuple):
meta: Meta
class ImagesClient(ResourceClientBase):
class ImagesClient(
ResourceClientBaseActionsMixin,
ResourceClientBase,
):
_base_url = "/images"
actions: ResourceActionsClient
@ -138,64 +153,46 @@ class ImagesClient(ResourceClientBase):
def get_actions_list(
self,
image: Image | BoundImage,
sort: list[str] | None = None,
status: list[ActionStatus] | None = None,
sort: list[ActionSort] | None = None,
page: int | None = None,
per_page: int | None = None,
status: list[str] | None = None,
) -> ActionsPageResult:
"""Returns a list of action objects for an image.
:param image: :class:`BoundImage <hcloud.images.client.BoundImage>` or :class:`Image <hcloud.images.domain.Image>`
:param status: List[str] (optional)
Response will have only actions with specified statuses. Choices: `running` `success` `error`
:param sort: List[str] (optional)
Specify how the results are sorted. Choices: `id` `id:asc` `id:desc` `command` `command:asc` `command:desc` `status` `status:asc` `status:desc` `progress` `progress:asc` `progress:desc` `started` `started:asc` `started:desc` `finished` `finished:asc` `finished:desc`
:param page: int (optional)
Specifies the page to fetch
:param per_page: int (optional)
Specifies how many results are returned by page
:return: (List[:class:`BoundAction <hcloud.actions.client.BoundAction>`], :class:`Meta <hcloud.core.domain.Meta>`)
"""
params: dict[str, Any] = {}
if sort is not None:
params["sort"] = sort
if status is not None:
params["status"] = status
if page is not None:
params["page"] = page
if per_page is not None:
params["per_page"] = per_page
response = self._client.request(
url=f"{self._base_url}/{image.id}/actions",
method="GET",
params=params,
Returns a paginated list of Actions for a Image.
:param image: Image to get the Actions for.
:param status: Filter the Actions by status.
:param sort: Sort Actions by field and direction.
:param page: Page number to get.
:param per_page: Maximum number of Actions returned per page.
"""
return self._get_actions_list(
f"{self._base_url}/{image.id}",
status=status,
sort=sort,
page=page,
per_page=per_page,
)
actions = [
BoundAction(self._parent.actions, action_data)
for action_data in response["actions"]
]
return ActionsPageResult(actions, Meta.parse_meta(response))
def get_actions(
self,
image: Image | BoundImage,
sort: list[str] | None = None,
status: list[str] | None = None,
status: list[ActionStatus] | None = None,
sort: list[ActionSort] | None = None,
) -> list[BoundAction]:
"""Returns all action objects for an image.
"""
Returns all Actions for a Image.
:param image: :class:`BoundImage <hcloud.images.client.BoundImage>` or :class:`Image <hcloud.images.domain.Image>`
:param status: List[str] (optional)
Response will have only actions with specified statuses. Choices: `running` `success` `error`
:param sort: List[str] (optional)
Specify how the results are sorted. Choices: `id` `command` `status` `progress` `started` `finished` . You can add one of ":asc", ":desc" to modify sort order. ( ":asc" is default)
:return: List[:class:`BoundAction <hcloud.actions.client.BoundAction>`]
:param image: Image to get the Actions for.
:param status: Filter the Actions by status.
:param sort: Sort Actions by field and direction.
"""
return self._iter_pages(
self.get_actions_list,
image,
sort=sort,
status=status,
sort=sort,
)
def get_by_id(self, id: int) -> BoundImage: