deps: update dependency hcloud to v1.28.0 (#306)

* deps: update dependency hcloud to v1.28.0

* chore: update vendored files

---------

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] 2023-08-17 15:02:50 +02:00 committed by GitHub
parent 4bb2bb80fa
commit 7d2300f1ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 210 additions and 21 deletions

View file

@ -1,3 +1,3 @@
from __future__ import annotations
VERSION = "1.27.2" # x-release-please-version
VERSION = "1.28.0" # x-release-please-version

View file

@ -1,6 +1,11 @@
from __future__ import annotations
from .client import ActionsClient, ActionsPageResult, BoundAction # noqa: F401
from .client import ( # noqa: F401
ActionsClient,
ActionsPageResult,
BoundAction,
ResourceActionsClient,
)
from .domain import ( # noqa: F401
Action,
ActionException,

View file

@ -1,6 +1,7 @@
from __future__ import annotations
import time
import warnings
from typing import TYPE_CHECKING, Any, NamedTuple
from ..core import BoundModelBase, ClientEntityBase, Meta
@ -40,8 +41,12 @@ class ActionsPageResult(NamedTuple):
meta: Meta | None
class ActionsClient(ClientEntityBase):
_client: Client
class ResourceActionsClient(ClientEntityBase):
_resource: str
def __init__(self, client: Client, resource: str | None):
super().__init__(client)
self._resource = resource or ""
def get_by_id(self, id: int) -> BoundAction:
"""Get a specific action by its ID.
@ -49,9 +54,11 @@ class ActionsClient(ClientEntityBase):
:param id: int
:return: :class:`BoundAction <hcloud.actions.client.BoundAction>`
"""
response = self._client.request(url=f"/actions/{id}", method="GET")
return BoundAction(self, response["action"])
response = self._client.request(
url=f"{self._resource}/actions/{id}",
method="GET",
)
return BoundAction(self._client.actions, response["action"])
def get_list(
self,
@ -60,7 +67,7 @@ class ActionsClient(ClientEntityBase):
page: int | None = None,
per_page: int | None = None,
) -> ActionsPageResult:
"""Get a list of actions from this account
"""Get a list of actions.
:param status: List[str] (optional)
Response will have only actions with specified statuses. Choices: `running` `success` `error`
@ -82,9 +89,14 @@ class ActionsClient(ClientEntityBase):
if per_page is not None:
params["per_page"] = per_page
response = self._client.request(url="/actions", method="GET", params=params)
response = self._client.request(
url=f"{self._resource}/actions",
method="GET",
params=params,
)
actions = [
BoundAction(self, action_data) for action_data in response["actions"]
BoundAction(self._client.actions, action_data)
for action_data in response["actions"]
]
return ActionsPageResult(actions, Meta.parse_meta(response))
@ -93,7 +105,7 @@ class ActionsClient(ClientEntityBase):
status: list[str] | None = None,
sort: list[str] | None = None,
) -> list[BoundAction]:
"""Get all actions of the account
"""Get all actions.
:param status: List[str] (optional)
Response will have only actions with specified statuses. Choices: `running` `success` `error`
@ -102,3 +114,52 @@ class ActionsClient(ClientEntityBase):
:return: List[:class:`BoundAction <hcloud.actions.client.BoundAction>`]
"""
return self._iter_pages(self.get_list, status=status, sort=sort)
class ActionsClient(ResourceActionsClient):
def __init__(self, client: Client):
super().__init__(client, None)
def get_list(
self,
status: list[str] | None = None,
sort: list[str] | None = None,
page: int | None = None,
per_page: int | None = None,
) -> ActionsPageResult:
"""
.. deprecated:: 1.28
Use :func:`client.<resource>.actions.get_list` instead,
e.g. using :attr:`hcloud.certificates.client.CertificatesClient.actions`.
`Starting 1 October 2023, it will no longer be available. <https://docs.hetzner.cloud/changelog#2023-07-20-actions-list-endpoint-is-deprecated>`_
"""
warnings.warn(
"The 'client.actions.get_list' method is deprecated, please use the "
"'client.<resource>.actions.get_list' method instead (e.g. "
"'client.certificates.actions.get_list').",
DeprecationWarning,
stacklevel=2,
)
return super().get_list(status=status, sort=sort, page=page, per_page=per_page)
def get_all(
self,
status: list[str] | None = None,
sort: list[str] | None = None,
) -> list[BoundAction]:
"""
.. deprecated:: 1.28
Use :func:`client.<resource>.actions.get_all` instead,
e.g. using :attr:`hcloud.certificates.client.CertificatesClient.actions`.
`Starting 1 October 2023, it will no longer be available. <https://docs.hetzner.cloud/changelog#2023-07-20-actions-list-endpoint-is-deprecated>`_
"""
warnings.warn(
"The 'client.actions.get_all' method is deprecated, please use the "
"'client.<resource>.actions.get_all' method instead (e.g. "
"'client.certificates.actions.get_all').",
DeprecationWarning,
stacklevel=2,
)
return super().get_all(status=status, sort=sort)

View file

@ -2,7 +2,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any, NamedTuple
from ..actions import ActionsPageResult, BoundAction
from ..actions import ActionsPageResult, BoundAction, ResourceActionsClient
from ..core import BoundModelBase, ClientEntityBase, Meta
from .domain import (
Certificate,
@ -106,6 +106,16 @@ class CertificatesPageResult(NamedTuple):
class CertificatesClient(ClientEntityBase):
_client: Client
actions: ResourceActionsClient
"""Certificates scoped actions client
:type: :class:`ResourceActionsClient <hcloud.actions.client.ResourceActionsClient>`
"""
def __init__(self, client: Client):
super().__init__(client)
self.actions = ResourceActionsClient(client, "/certificates")
def get_by_id(self, id: int) -> BoundCertificate:
"""Get a specific certificate by its ID.

View file

@ -2,7 +2,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any, NamedTuple
from ..actions import ActionsPageResult, BoundAction
from ..actions import ActionsPageResult, BoundAction, ResourceActionsClient
from ..core import BoundModelBase, ClientEntityBase, Meta
from .domain import (
CreateFirewallResponse,
@ -161,6 +161,16 @@ class FirewallsPageResult(NamedTuple):
class FirewallsClient(ClientEntityBase):
_client: Client
actions: ResourceActionsClient
"""Firewalls scoped actions client
:type: :class:`ResourceActionsClient <hcloud.actions.client.ResourceActionsClient>`
"""
def __init__(self, client: Client):
super().__init__(client)
self.actions = ResourceActionsClient(client, "/firewalls")
def get_actions_list(
self,
firewall: Firewall | BoundFirewall,

View file

@ -2,7 +2,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any, NamedTuple
from ..actions import ActionsPageResult, BoundAction
from ..actions import ActionsPageResult, BoundAction, ResourceActionsClient
from ..core import BoundModelBase, ClientEntityBase, Meta
from ..locations import BoundLocation
from .domain import CreateFloatingIPResponse, FloatingIP
@ -141,6 +141,16 @@ class FloatingIPsPageResult(NamedTuple):
class FloatingIPsClient(ClientEntityBase):
_client: Client
actions: ResourceActionsClient
"""Floating IPs scoped actions client
:type: :class:`ResourceActionsClient <hcloud.actions.client.ResourceActionsClient>`
"""
def __init__(self, client: Client):
super().__init__(client)
self.actions = ResourceActionsClient(client, "/floating_ips")
def get_actions_list(
self,
floating_ip: FloatingIP | BoundFloatingIP,

View file

@ -2,7 +2,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any, NamedTuple
from ..actions import ActionsPageResult, BoundAction
from ..actions import ActionsPageResult, BoundAction, ResourceActionsClient
from ..core import BoundModelBase, ClientEntityBase, Meta
from .domain import Image
@ -113,6 +113,16 @@ class ImagesPageResult(NamedTuple):
class ImagesClient(ClientEntityBase):
_client: Client
actions: ResourceActionsClient
"""Images scoped actions client
:type: :class:`ResourceActionsClient <hcloud.actions.client.ResourceActionsClient>`
"""
def __init__(self, client: Client):
super().__init__(client)
self.actions = ResourceActionsClient(client, "/images")
def get_actions_list(
self,
image: Image | BoundImage,

View file

@ -16,6 +16,7 @@ from .domain import ( # noqa: F401
LoadBalancerService,
LoadBalancerServiceHttp,
LoadBalancerTarget,
LoadBalancerTargetHealthStatus,
LoadBalancerTargetIP,
LoadBalancerTargetLabelSelector,
PrivateNet,

View file

@ -2,7 +2,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any, NamedTuple
from ..actions import ActionsPageResult, BoundAction
from ..actions import ActionsPageResult, BoundAction, ResourceActionsClient
from ..certificates import BoundCertificate
from ..core import BoundModelBase, ClientEntityBase, Meta
from ..load_balancer_types import BoundLoadBalancerType
@ -20,6 +20,7 @@ from .domain import (
LoadBalancerService,
LoadBalancerServiceHttp,
LoadBalancerTarget,
LoadBalancerTargetHealthStatus,
LoadBalancerTargetIP,
LoadBalancerTargetLabelSelector,
PrivateNet,
@ -83,6 +84,17 @@ class BoundLoadBalancer(BoundModelBase):
tmp_target.use_private_ip = target["use_private_ip"]
elif target["type"] == "ip":
tmp_target.ip = LoadBalancerTargetIP(ip=target["ip"]["ip"])
target_health_status = target.get("health_status")
if target_health_status is not None:
tmp_target.health_status = [
LoadBalancerTargetHealthStatus(
listen_port=target_health_status_item["listen_port"],
status=target_health_status_item["status"],
)
for target_health_status_item in target_health_status
]
tmp_targets.append(tmp_target)
data["targets"] = tmp_targets
@ -331,6 +343,16 @@ class LoadBalancersPageResult(NamedTuple):
class LoadBalancersClient(ClientEntityBase):
_client: Client
actions: ResourceActionsClient
"""Load Balancers scoped actions client
:type: :class:`ResourceActionsClient <hcloud.actions.client.ResourceActionsClient>`
"""
def __init__(self, client: Client):
super().__init__(client)
self.actions = ResourceActionsClient(client, "/load_balancers")
def get_by_id(self, id: int) -> BoundLoadBalancer:
"""Get a specific Load Balancer

View file

@ -316,6 +316,8 @@ class LoadBalancerTarget(BaseDomain):
Target IP
:param use_private_ip: bool
use the private IP instead of primary public IP
:param health_status: list
List of health statuses of the services on this target. Only present for target types "server" and "ip".
"""
def __init__(
@ -325,12 +327,14 @@ class LoadBalancerTarget(BaseDomain):
label_selector: LoadBalancerTargetLabelSelector | None = None,
ip: LoadBalancerTargetIP | None = None,
use_private_ip: bool | None = None,
health_status: list[LoadBalancerTargetHealthStatus] | None = None,
):
self.type = type
self.server = server
self.label_selector = label_selector
self.ip = ip
self.use_private_ip = use_private_ip
self.health_status = health_status
def to_payload(self) -> dict[str, Any]:
payload: dict[str, Any] = {
@ -357,6 +361,22 @@ class LoadBalancerTarget(BaseDomain):
return payload
class LoadBalancerTargetHealthStatus(BaseDomain):
"""LoadBalancerTargetHealthStatus Domain
:param listen_port: Load Balancer Target listen port
:param status: Load Balancer Target status. Choices: healthy, unhealthy, unknown
"""
def __init__(
self,
listen_port: int | None = None,
status: str | None = None,
):
self.listen_port = listen_port
self.status = status
class LoadBalancerTargetLabelSelector(BaseDomain):
"""LoadBalancerTargetLabelSelector Domain

View file

@ -2,7 +2,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any, NamedTuple
from ..actions import ActionsPageResult, BoundAction
from ..actions import ActionsPageResult, BoundAction, ResourceActionsClient
from ..core import BoundModelBase, ClientEntityBase, Meta
from .domain import Network, NetworkRoute, NetworkSubnet
@ -168,6 +168,16 @@ class NetworksPageResult(NamedTuple):
class NetworksClient(ClientEntityBase):
_client: Client
actions: ResourceActionsClient
"""Networks scoped actions client
:type: :class:`ResourceActionsClient <hcloud.actions.client.ResourceActionsClient>`
"""
def __init__(self, client: Client):
super().__init__(client)
self.actions = ResourceActionsClient(client, "/networks")
def get_by_id(self, id: int) -> BoundNetwork:
"""Get a specific network

View file

@ -2,7 +2,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any, NamedTuple
from ..actions import BoundAction
from ..actions import BoundAction, ResourceActionsClient
from ..core import BoundModelBase, ClientEntityBase, Meta
from .domain import CreatePrimaryIPResponse, PrimaryIP
@ -99,6 +99,16 @@ class PrimaryIPsPageResult(NamedTuple):
class PrimaryIPsClient(ClientEntityBase):
_client: Client
actions: ResourceActionsClient
"""Primary IPs scoped actions client
:type: :class:`ResourceActionsClient <hcloud.actions.client.ResourceActionsClient>`
"""
def __init__(self, client: Client):
super().__init__(client)
self.actions = ResourceActionsClient(client, "/primary_ips")
def get_by_id(self, id: int) -> BoundPrimaryIP:
"""Returns a specific Primary IP object.

View file

@ -2,7 +2,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any, NamedTuple
from ..actions import ActionsPageResult, BoundAction
from ..actions import ActionsPageResult, BoundAction, ResourceActionsClient
from ..core import BoundModelBase, ClientEntityBase, Meta
from ..datacenters import BoundDatacenter
from ..firewalls import BoundFirewall
@ -448,6 +448,16 @@ class ServersPageResult(NamedTuple):
class ServersClient(ClientEntityBase):
_client: Client
actions: ResourceActionsClient
"""Servers scoped actions client
:type: :class:`ResourceActionsClient <hcloud.actions.client.ResourceActionsClient>`
"""
def __init__(self, client: Client):
super().__init__(client)
self.actions = ResourceActionsClient(client, "/servers")
def get_by_id(self, id: int) -> BoundServer:
"""Get a specific server

View file

@ -2,7 +2,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any, NamedTuple
from ..actions import ActionsPageResult, BoundAction
from ..actions import ActionsPageResult, BoundAction, ResourceActionsClient
from ..core import BoundModelBase, ClientEntityBase, Meta
from ..locations import BoundLocation
from .domain import CreateVolumeResponse, Volume
@ -137,6 +137,16 @@ class VolumesPageResult(NamedTuple):
class VolumesClient(ClientEntityBase):
_client: Client
actions: ResourceActionsClient
"""Volumes scoped actions client
:type: :class:`ResourceActionsClient <hcloud.actions.client.ResourceActionsClient>`
"""
def __init__(self, client: Client):
super().__init__(client)
self.actions = ResourceActionsClient(client, "/volumes")
def get_by_id(self, id: int) -> BoundVolume:
"""Get a specific volume by its id

View file

@ -19,7 +19,7 @@ from textwrap import dedent
logger = logging.getLogger("vendor")
HCLOUD_SOURCE_URL = "https://github.com/hetznercloud/hcloud-python"
HCLOUD_VERSION = "v1.27.2"
HCLOUD_VERSION = "v1.28.0"
HCLOUD_VENDOR_PATH = "plugins/module_utils/vendor/hcloud"