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

add stats

This commit is contained in:
jo 2025-12-03 12:18:20 +01:00
parent 845daf0ecd
commit 4c75cfc7e5
No known key found for this signature in database
GPG key ID: B2FEC9B22722B984
5 changed files with 51 additions and 3 deletions

View file

@ -24,4 +24,9 @@ def prepare_result(o: BoundStorageBox):
"server": o.server,
"system": o.system,
"status": o.status,
"stats": {
"size": o.stats.size,
"size_data": o.stats.size_data,
"size_snapshots": o.stats.size_snapshots,
},
}

View file

@ -219,9 +219,27 @@ hcloud_storage_box:
returned: always
type: str
sample: active
stats:
description: Statistics of the Storage Box.
returned: always
type: dict
contains:
size:
description: Current disk usage in bytes.
returned: always
type: int
sample: 10485760
size_data:
description: Current disk usage for data in bytes.
returned: always
type: int
sample: 10485760
size_snapshots:
description: Current disk usage for snapshots in bytes.
returned: always
type: int
sample: 10485760
"""
# TODO: stats
from ansible.module_utils.basic import AnsibleModule

View file

@ -159,8 +159,27 @@ hcloud_storage_box_info:
returned: always
type: str
sample: active
stats:
description: Statistics of the Storage Box.
returned: always
type: dict
contains:
size:
description: Current disk usage in bytes.
returned: always
type: int
sample: 10485760
size_data:
description: Current disk usage for data in bytes.
returned: always
type: int
sample: 10485760
size_snapshots:
description: Current disk usage for snapshots in bytes.
returned: always
type: int
sample: 10485760
"""
# TODO: stats
from ansible.module_utils.basic import AnsibleModule

View file

@ -61,6 +61,9 @@
- result.hcloud_storage_box.server is not none
- result.hcloud_storage_box.system is not none
- result.hcloud_storage_box.username is not none
- result.hcloud_storage_box.stats.size >= 0
- result.hcloud_storage_box.stats.size_data >= 0
- result.hcloud_storage_box.stats.size_snapshots >= 0
- name: Test create idempotency
hetzner.hcloud.storage_box:

View file

@ -50,6 +50,9 @@
- result.hcloud_storage_box_info[0].server is not none
- result.hcloud_storage_box_info[0].system is not none
- result.hcloud_storage_box_info[0].username is not none
- result.hcloud_storage_box_info[0].stats.size >= 0
- result.hcloud_storage_box_info[0].stats.size_data >= 0
- result.hcloud_storage_box_info[0].stats.size_snapshots >= 0
- name: Gather hcloud_storage_box_info with wrong id
hetzner.hcloud.storage_box_info: