mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-03-22 05:09:12 +00:00
t is for typing, and typing is what we did
Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
This commit is contained in:
parent
b4c79ffb53
commit
17197e844a
1 changed files with 12 additions and 4 deletions
|
|
@ -68,12 +68,20 @@ secrets:
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
contains:
|
contains:
|
||||||
... describe the fields inside the dictionaries here ...
|
name:
|
||||||
|
description: The name of the secret.
|
||||||
|
type: str
|
||||||
|
created_at:
|
||||||
|
description: The date and time when the secret was created.
|
||||||
|
type: str
|
||||||
|
updated_at:
|
||||||
|
description: The date and time when the secret was last updated.
|
||||||
|
type: str
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
from http import HTTPStatus
|
|
||||||
import typing as t
|
import typing as t
|
||||||
|
from http import HTTPStatus
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.urls import fetch_url
|
from ansible.module_utils.urls import fetch_url
|
||||||
|
|
@ -98,7 +106,7 @@ def list_secrets(
|
||||||
|
|
||||||
if info["status"] == HTTPStatus.OK:
|
if info["status"] == HTTPStatus.OK:
|
||||||
body = resp.read()
|
body = resp.read()
|
||||||
return json.loads(body).get("secrets", [])
|
return {"secrets": json.loads(body).get("secrets", [])}
|
||||||
elif info["status"] == HTTPStatus.NOT_FOUND:
|
elif info["status"] == HTTPStatus.NOT_FOUND:
|
||||||
return {
|
return {
|
||||||
"secrets": [],
|
"secrets": [],
|
||||||
|
|
@ -132,7 +140,7 @@ def main() -> None:
|
||||||
api_url: str = module.params["api_url"]
|
api_url: str = module.params["api_url"]
|
||||||
token: str = module.params["token"]
|
token: str = module.params["token"]
|
||||||
|
|
||||||
result: dict[str, Any] = {}
|
result: dict[str, t.Any] = {}
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
"Accept": "application/vnd.github+json",
|
"Accept": "application/vnd.github+json",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue