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` |  |  | --- ### 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 ([#​608](https://redirect.github.com/hetznercloud/hcloud-python/issues/608)) - deprecate datacenter in `primary ips` and `servers` ([#​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:
parent
f204b21ee0
commit
af3e9f4bf2
63 changed files with 1487 additions and 895 deletions
|
|
@ -2,7 +2,14 @@ from __future__ import annotations
|
|||
|
||||
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 (
|
||||
CreateFirewallResponse,
|
||||
|
|
@ -17,12 +24,24 @@ if TYPE_CHECKING:
|
|||
from .._client import Client
|
||||
|
||||
|
||||
class BoundFirewall(BoundModelBase, Firewall):
|
||||
__all__ = [
|
||||
"BoundFirewall",
|
||||
"FirewallsPageResult",
|
||||
"FirewallsClient",
|
||||
]
|
||||
|
||||
|
||||
class BoundFirewall(BoundModelBase[Firewall], Firewall):
|
||||
_client: FirewallsClient
|
||||
|
||||
model = Firewall
|
||||
|
||||
def __init__(self, client: FirewallsClient, data: dict, complete: bool = True):
|
||||
def __init__(
|
||||
self,
|
||||
client: FirewallsClient,
|
||||
data: dict[str, Any],
|
||||
complete: bool = True,
|
||||
):
|
||||
rules = data.get("rules", [])
|
||||
if rules:
|
||||
rules = [
|
||||
|
|
@ -92,22 +111,18 @@ class BoundFirewall(BoundModelBase, Firewall):
|
|||
|
||||
def get_actions_list(
|
||||
self,
|
||||
status: list[str] | None = None,
|
||||
sort: list[str] | None = None,
|
||||
status: list[ActionStatus] | None = None,
|
||||
sort: list[ActionSort] | None = None,
|
||||
page: int | None = None,
|
||||
per_page: int | None = None,
|
||||
) -> ActionsPageResult:
|
||||
"""Returns all action objects for a Firewall.
|
||||
"""
|
||||
Returns a paginated list of Actions for a Firewall.
|
||||
|
||||
: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,
|
||||
|
|
@ -119,17 +134,14 @@ class BoundFirewall(BoundModelBase, Firewall):
|
|||
|
||||
def get_actions(
|
||||
self,
|
||||
status: list[str] | None = None,
|
||||
sort: list[str] | None = None,
|
||||
status: list[ActionStatus] | None = None,
|
||||
sort: list[ActionSort] | None = None,
|
||||
) -> list[BoundAction]:
|
||||
"""Returns all action objects for a Firewall.
|
||||
"""
|
||||
Returns all Actions for a Firewall.
|
||||
|
||||
: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,
|
||||
|
|
@ -193,7 +205,10 @@ class FirewallsPageResult(NamedTuple):
|
|||
meta: Meta
|
||||
|
||||
|
||||
class FirewallsClient(ResourceClientBase):
|
||||
class FirewallsClient(
|
||||
ResourceClientBaseActionsMixin,
|
||||
ResourceClientBase,
|
||||
):
|
||||
_base_url = "/firewalls"
|
||||
|
||||
actions: ResourceActionsClient
|
||||
|
|
@ -209,59 +224,40 @@ class FirewallsClient(ResourceClientBase):
|
|||
def get_actions_list(
|
||||
self,
|
||||
firewall: Firewall | BoundFirewall,
|
||||
status: list[str] | None = None,
|
||||
sort: list[str] | None = None,
|
||||
status: list[ActionStatus] | None = None,
|
||||
sort: list[ActionSort] | None = None,
|
||||
page: int | None = None,
|
||||
per_page: int | None = None,
|
||||
) -> ActionsPageResult:
|
||||
"""Returns all action objects for a Firewall.
|
||||
|
||||
:param firewall: :class:`BoundFirewall <hcloud.firewalls.client.BoundFirewall>` or :class:`Firewall <hcloud.firewalls.domain.Firewall>`
|
||||
: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 status is not None:
|
||||
params["status"] = status
|
||||
if sort is not None:
|
||||
params["sort"] = sort
|
||||
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}/{firewall.id}/actions",
|
||||
method="GET",
|
||||
params=params,
|
||||
Returns a paginated list of Actions for a Firewall.
|
||||
|
||||
:param firewall: Firewall 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}/{firewall.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,
|
||||
firewall: Firewall | BoundFirewall,
|
||||
status: list[str] | None = None,
|
||||
sort: list[str] | None = None,
|
||||
status: list[ActionStatus] | None = None,
|
||||
sort: list[ActionSort] | None = None,
|
||||
) -> list[BoundAction]:
|
||||
"""Returns all action objects for a Firewall.
|
||||
"""
|
||||
Returns all Actions for a Firewall.
|
||||
|
||||
:param firewall: :class:`BoundFirewall <hcloud.firewalls.client.BoundFirewall>` or :class:`Firewall <hcloud.firewalls.domain.Firewall>`
|
||||
: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 firewall: Firewall 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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue