1
0
Fork 0
mirror of https://github.com/ansible-collections/hetzner.hcloud.git synced 2026-02-03 23:51:48 +00:00
hetzner.hcloud/plugins/module_utils/vendor/hcloud/volumes/domain.py
renovate[bot] af3e9f4bf2
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>
2025-12-19 19:50:01 +01:00

120 lines
3.6 KiB
Python

from __future__ import annotations
from typing import TYPE_CHECKING, TypedDict
from ..core import BaseDomain, DomainIdentityMixin
if TYPE_CHECKING:
from ..actions import BoundAction
from ..locations import BoundLocation, Location
from ..servers import BoundServer, Server
from .client import BoundVolume
__all__ = [
"Volume",
"VolumeProtection",
"CreateVolumeResponse",
]
class Volume(BaseDomain, DomainIdentityMixin):
"""Volume Domain
:param id: int
ID of the Volume
:param name: str
Name of the Volume
:param server: :class:`BoundServer <hcloud.servers.client.BoundServer>`, None
Server the Volume is attached to, None if it is not attached at all.
:param created: datetime
Point in time when the Volume was created
:param location: :class:`BoundLocation <hcloud.locations.client.BoundLocation>`
Location of the Volume. Volume can only be attached to Servers in the same location.
:param size: int
Size in GB of the Volume
:param linux_device: str
Device path on the file system for the Volume
:param protection: dict
Protection configuration for the Volume
:param labels: dict
User-defined labels (key-value pairs)
:param status: str
Current status of the volume Choices: `creating`, `available`
:param format: str, None
Filesystem of the volume if formatted on creation, None if not formatted on creation.
"""
STATUS_CREATING = "creating"
"""Volume Status creating"""
STATUS_AVAILABLE = "available"
"""Volume Status available"""
__api_properties__ = (
"id",
"name",
"server",
"location",
"size",
"linux_device",
"format",
"protection",
"labels",
"status",
"created",
)
__slots__ = __api_properties__
def __init__(
self,
id: int,
name: str | None = None,
server: Server | BoundServer | None = None,
created: str | None = None,
location: Location | BoundLocation | None = None,
size: int | None = None,
linux_device: str | None = None,
format: str | None = None,
protection: VolumeProtection | None = None,
labels: dict[str, str] | None = None,
status: str | None = None,
):
self.id = id
self.name = name
self.server = server
self.created = self._parse_datetime(created)
self.location = location
self.size = size
self.linux_device = linux_device
self.format = format
self.protection = protection
self.labels = labels
self.status = status
class VolumeProtection(TypedDict):
delete: bool
class CreateVolumeResponse(BaseDomain):
"""Create Volume Response Domain
:param volume: :class:`BoundVolume <hcloud.volumes.client.BoundVolume>`
The created volume
:param action: :class:`BoundAction <hcloud.actions.client.BoundAction>`
The action that shows the progress of the Volume Creation
:param next_actions: List[:class:`BoundAction <hcloud.actions.client.BoundAction>`]
List of actions that are performed after the creation, like attaching to a server
"""
__api_properties__ = ("volume", "action", "next_actions")
__slots__ = __api_properties__
def __init__(
self,
volume: BoundVolume,
action: BoundAction,
next_actions: list[BoundAction],
):
self.volume = volume
self.action = action
self.next_actions = next_actions