Skip to content

Commit

Permalink
Added note in documentation that Parent/Child support may not yet be …
Browse files Browse the repository at this point in the history
…generally available (#529)

* Added support for optional module-level descriptions in info and list module base classes and updated docs for child_account_info and child_account_list

* Fix lint
  • Loading branch information
ezilber-akamai authored Jun 26, 2024
1 parent 7ad2dc0 commit 64258b2
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 7 deletions.
2 changes: 2 additions & 0 deletions docs/modules/child_account_info.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Get info about a Linode Child Account.

NOTE: Parent/Child related features may not be generally available.

- [Minimum Required Fields](#minimum-required-fields)
- [Examples](#examples)
- [Parameters](#parameters)
Expand Down
2 changes: 2 additions & 0 deletions docs/modules/child_account_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

List and filter on Child Account.

NOTE: Parent/Child related features may not be generally available.

- [Minimum Required Fields](#minimum-required-fields)
- [Examples](#examples)
- [Parameters](#parameters)
Expand Down
10 changes: 6 additions & 4 deletions plugins/module_utils/linode_common_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,17 @@ def __init__(
params: List[InfoModuleParam] = None,
attributes: List[InfoModuleAttr] = None,
examples: List[str] = None,
description: List[str] = None,
requires_beta: bool = False,
) -> None:
self.primary_result = primary_result
self.secondary_results = secondary_results or []
self.params = params or []
self.attributes = attributes or []
self.examples = examples or []
self.description = description or [
f"Get info about a Linode {self.primary_result.display_name}."
]
self.requires_beta = requires_beta

self.module_arg_spec = self.spec.ansible_spec
Expand Down Expand Up @@ -198,11 +202,9 @@ def spec(self):
for v in [self.primary_result] + self.secondary_results
}

description = [
f"Get info about a Linode {self.primary_result.display_name}."
]
description = self.description

if self.requires_beta:
if self.requires_beta and BETA_DISCLAIMER not in description:
description.append(BETA_DISCLAIMER)

return SpecDocMeta(
Expand Down
8 changes: 6 additions & 2 deletions plugins/module_utils/linode_common_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def __init__(
result_docs_url: str = "",
params: List[ListModuleParam] = None,
examples: List[str] = None,
description: List[str] = None,
result_samples: List[str] = None,
requires_beta: bool = False,
) -> None:
Expand All @@ -63,6 +64,9 @@ def __init__(
self.result_docs_url = result_docs_url
self.params = params or []
self.examples = examples or []
self.description = description or [
f"List and filter on {self.result_display_name}."
]
self.result_samples = result_samples or []
self.requires_beta = requires_beta

Expand Down Expand Up @@ -156,9 +160,9 @@ def spec(self):
required=True,
)

description = [f"List and filter on {self.result_display_name}."]
description = self.description

if self.requires_beta:
if self.requires_beta and BETA_DISCLAIMER not in description:
description.append(BETA_DISCLAIMER)

return SpecDocMeta(
Expand Down
4 changes: 4 additions & 0 deletions plugins/modules/child_account_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
),
],
examples=docs.specdoc_examples,
description=[
"Get info about a Linode Child Account.",
"NOTE: Parent/Child related features may not be generally available.",
],
)

SPECDOC_META = module.spec
Expand Down
8 changes: 7 additions & 1 deletion plugins/modules/child_account_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@
ListModule,
)

RESULT_DISPLAY_NAME = "Child Account"

module = ListModule(
result_display_name="Child Account",
result_display_name=RESULT_DISPLAY_NAME,
result_field_name="child_accounts",
endpoint_template="/account/child-accounts",
result_docs_url="",
examples=docs.specdoc_examples,
result_samples=docs.result_child_accounts_samples,
description=[
f"List and filter on {RESULT_DISPLAY_NAME}.",
"NOTE: Parent/Child related features may not be generally available.",
],
)

SPECDOC_META = module.spec
Expand Down

0 comments on commit 64258b2

Please sign in to comment.