mirror of
https://github.com/ansible-collections/hetzner.hcloud.git
synced 2026-02-04 08:01:49 +00:00
refactor: mark module_utils modules as private (#782)
##### SUMMARY All `module_utils` are now marked as **private**. None of the modules were intended for public use. Similar to https://togithub.com/ansible-collections/community.general/issues/11312
This commit is contained in:
parent
0f23e6c58c
commit
cfa0d181f7
152 changed files with 283 additions and 239 deletions
|
|
@ -1,44 +0,0 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from ..module_utils.vendor.hcloud.storage_boxes import (
|
||||
BoundStorageBox,
|
||||
BoundStorageBoxSubaccount,
|
||||
)
|
||||
|
||||
NAME_LABEL_KEY = "ansible-name"
|
||||
|
||||
|
||||
def get_by_name(storage_box: BoundStorageBox, name: str):
|
||||
if not name:
|
||||
raise ValueError(f"invalid storage box subaccount name: '{name}'")
|
||||
|
||||
result = storage_box.get_subaccount_list(
|
||||
label_selector=f"{NAME_LABEL_KEY}={name}",
|
||||
)
|
||||
if len(result.subaccounts) == 0:
|
||||
return None
|
||||
if len(result.subaccounts) == 1:
|
||||
return result.subaccounts[0]
|
||||
|
||||
raise ValueError(f"found multiple storage box subaccount with the same name: {name}")
|
||||
|
||||
|
||||
def prepare_result(o: BoundStorageBoxSubaccount, name: str):
|
||||
return {
|
||||
"storage_box": o.storage_box.id,
|
||||
"id": o.id,
|
||||
"name": name,
|
||||
"description": o.description,
|
||||
"username": o.username,
|
||||
"home_directory": o.home_directory,
|
||||
"server": o.server,
|
||||
"access_settings": {
|
||||
"reachable_externally": o.access_settings.reachable_externally,
|
||||
"samba_enabled": o.access_settings.samba_enabled,
|
||||
"ssh_enabled": o.access_settings.ssh_enabled,
|
||||
"webdav_enabled": o.access_settings.webdav_enabled,
|
||||
"readonly": o.access_settings.readonly,
|
||||
},
|
||||
"labels": o.labels,
|
||||
"created": o.created.isoformat(),
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue