Skip to content

Commit

Permalink
feat: add created field to server and server_info modules (#381)
Browse files Browse the repository at this point in the history
##### SUMMARY
Add missing "created" field to ansible result

based on documentation
https://docs.hetzner.cloud/#servers-get-all-servers

```
created
string required
Point in time when the Resource was created (in ISO-8601 format)
```

##### ISSUE TYPE
- Feature Pull Request

##### COMPONENT NAME
hcloud_server_info
hcloud_server

Co-authored-by: Pawel Urbanek <[email protected]>
  • Loading branch information
urbanekpj and Pawel Urbanek authored Nov 6, 2023
1 parent 084e04d commit c3e4c0e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/add_created_to_server_info.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- hcloud_server_info - Add `created` field
- hcloud_server - Add `created` field
6 changes: 6 additions & 0 deletions plugins/modules/hcloud_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@
returned: always
type: str
sample: my-server
created:
description: Point in time when the Server was created (in ISO-8601 format)
returned: always
type: str
sample: "2023-11-06T13:36:56+00:00"
status:
description: Status of the server
returned: always
Expand Down Expand Up @@ -366,6 +371,7 @@ def _prepare_result(self):
return {
"id": to_native(self.hcloud_server.id),
"name": to_native(self.hcloud_server.name),
"created": to_native(self.hcloud_server.created.isoformat()),
"ipv4_address": ipv4_address,
"ipv6": ipv6,
"private_networks": [to_native(net.network.name) for net in self.hcloud_server.private_net],
Expand Down
6 changes: 6 additions & 0 deletions plugins/modules/hcloud_server_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@
returned: always
type: str
sample: my-server
created:
description: Point in time when the Server was created (in ISO-8601 format)
returned: always
type: str
sample: "2023-11-06T13:36:56+00:00"
status:
description: Status of the server
returned: always
Expand Down Expand Up @@ -167,6 +172,7 @@ def _prepare_result(self):
{
"id": to_native(server.id),
"name": to_native(server.name),
"created": to_native(server.created.isoformat()),
"ipv4_address": ipv4_address,
"ipv6": ipv6,
"private_networks": [to_native(net.network.name) for net in server.private_net],
Expand Down

0 comments on commit c3e4c0e

Please sign in to comment.