Skip to content

Commit

Permalink
Add beta endpoint disclaimer
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarber-akamai committed Mar 14, 2024
1 parent 2b23481 commit 22c4e26
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 10 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Name | Description |
[linode.cloud.instance](./docs/modules/instance.md)|Manage Linode Instances, Configs, and Disks.|
[linode.cloud.ip_assign](./docs/modules/ip_assign.md)|Assign IPs to Linodes in a given Region.|
[linode.cloud.ip_rdns](./docs/modules/ip_rdns.md)|Manage a Linode IP address's rDNS.|
[linode.cloud.ip_share](./docs/modules/ip_share.md)|Manage the Linode shared IPs.|
[linode.cloud.ip_share](./docs/modules/ip_share.md)|> :warning: **This module makes use of beta endpoints and requires the `api_version` field be explicitly set to `v4beta`.**|
[linode.cloud.lke_cluster](./docs/modules/lke_cluster.md)|Manage Linode LKE clusters.|
[linode.cloud.lke_node_pool](./docs/modules/lke_node_pool.md)|Manage Linode LKE cluster node pools.|
[linode.cloud.nodebalancer](./docs/modules/nodebalancer.md)|Manage a Linode NodeBalancer.|
Expand All @@ -54,7 +54,7 @@ Modules for retrieving information about existing Linode infrastructure.

Name | Description |
--- | ------------ |
[linode.cloud.account_availability_info](./docs/modules/account_availability_info.md)|Get info about a Linode Account Availability.|
[linode.cloud.account_availability_info](./docs/modules/account_availability_info.md)|> :warning: **This module makes use of beta endpoints and requires the `api_version` field be explicitly set to `v4beta`.**|
[linode.cloud.account_info](./docs/modules/account_info.md)|Get info about a Linode Account.|
[linode.cloud.database_mysql_info](./docs/modules/database_mysql_info.md)|Get info about a Linode MySQL Managed Database.|
[linode.cloud.database_postgresql_info](./docs/modules/database_postgresql_info.md)|Get info about a Linode PostgreSQL Managed Database.|
Expand Down Expand Up @@ -86,7 +86,7 @@ Modules for retrieving and filtering on multiple Linode resources.

Name | Description |
--- | ------------ |
[linode.cloud.account_availability_list](./docs/modules/account_availability_list.md)|List and filter on Account Availabilitys.|
[linode.cloud.account_availability_list](./docs/modules/account_availability_list.md)|> :warning: **This module makes use of beta endpoints and requires the `api_version` field be explicitly set to `v4beta`.**|
[linode.cloud.database_engine_list](./docs/modules/database_engine_list.md)|List and filter on Managed Database engine types.|
[linode.cloud.database_list](./docs/modules/database_list.md)|List and filter on Linode Managed Databases.|
[linode.cloud.domain_list](./docs/modules/domain_list.md)|List and filter on Domains.|
Expand Down
3 changes: 3 additions & 0 deletions docs/modules/account_availability_info.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# account_availability_info

> :warning: **This module makes use of beta endpoints and requires the `api_version` field be explicitly set to `v4beta`.**
Get info about a Linode Account Availability.

- [Examples](#examples)
Expand All @@ -11,6 +13,7 @@ Get info about a Linode Account Availability.
```yaml
- name: Get info about the current Linode account availability
linode.cloud.account_info:
api_version: v4beta
region: us-east

```
Expand Down
5 changes: 4 additions & 1 deletion docs/modules/account_availability_list.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# account_availability_list

> :warning: **This module makes use of beta endpoints and requires the `api_version` field be explicitly set to `v4beta`.**
List and filter on Account Availabilitys.

- [Examples](#examples)
Expand All @@ -10,7 +12,8 @@ List and filter on Account Availabilitys.

```yaml
- name: List all of the region resource availabilities to the account
linode.cloud.account_availability_list: {}
linode.cloud.account_availability_list:
api_version: v4beta
```
Expand Down
3 changes: 3 additions & 0 deletions docs/modules/ip_share.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ip_share

> :warning: **This module makes use of beta endpoints and requires the `api_version` field be explicitly set to `v4beta`.**
Manage the Linode shared IPs.

- [Examples](#examples)
Expand All @@ -11,6 +13,7 @@ Manage the Linode shared IPs.
```yaml
- name: Configure the Linode shared IPs.
linode.cloud.ip_share:
api_version: v4beta
linode_id: 12345
ips: ["192.0.2.1", "2001:db8:3c4d:15::"]
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
specdoc_examples = ['''
- name: Get info about the current Linode account availability
linode.cloud.account_info:
api_version: v4beta
region: us-east
''']
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

specdoc_examples = ['''
- name: List all of the region resource availabilities to the account
linode.cloud.account_availability_list: {}''']
linode.cloud.account_availability_list:
api_version: v4beta''']

result_account_availabilities_samples = ['''[
{
Expand Down
1 change: 1 addition & 0 deletions plugins/module_utils/doc_fragments/ip_share.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
specdoc_examples = ['''
- name: Configure the Linode shared IPs.
linode.cloud.ip_share:
api_version: v4beta
linode_id: 12345
ips: ["192.0.2.1", "2001:db8:3c4d:15::"]''']

Expand Down
14 changes: 11 additions & 3 deletions plugins/module_utils/linode_common_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
LinodeModuleBase,
)
from ansible_collections.linode.cloud.plugins.module_utils.linode_docs import (
beta_disclaimer,
global_authors,
global_requirements,
)
Expand Down Expand Up @@ -95,12 +96,14 @@ def __init__(
params: List[InfoModuleParam] = None,
attributes: List[InfoModuleAttr] = None,
examples: 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.requires_beta = requires_beta

self.module_arg_spec = self.spec.ansible_spec
self.results: Dict[str, Any] = {
Expand Down Expand Up @@ -195,10 +198,15 @@ def spec(self):
for v in [self.primary_result] + self.secondary_results
}

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

if self.requires_beta:
description.insert(0, beta_disclaimer)

return SpecDocMeta(
description=[
f"Get info about a Linode {self.primary_result.display_name}."
],
description=description,
requirements=global_requirements,
author=global_authors,
options=options,
Expand Down
10 changes: 9 additions & 1 deletion plugins/module_utils/linode_common_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
LinodeModuleBase,
)
from ansible_collections.linode.cloud.plugins.module_utils.linode_docs import (
beta_disclaimer,
global_authors,
global_requirements,
)
Expand Down Expand Up @@ -53,6 +54,7 @@ def __init__(
params: List[ListModuleParam] = None,
examples: List[str] = None,
result_samples: List[str] = None,
requires_beta: bool = False,
) -> None:
self.result_display_name = result_display_name
self.result_field_name = result_field_name
Expand All @@ -62,6 +64,7 @@ def __init__(
self.params = params or []
self.examples = examples or []
self.result_samples = result_samples or []
self.requires_beta = requires_beta

self.module_arg_spec = self.spec.ansible_spec
self.results: Dict[str, Any] = {self.result_field_name: []}
Expand Down Expand Up @@ -153,8 +156,13 @@ def spec(self):
required=True,
)

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

if self.requires_beta:
description.insert(0, beta_disclaimer)

return SpecDocMeta(
description=[f"List and filter on {self.result_display_name}s."],
description=description,
requirements=global_requirements,
author=global_authors,
options=options,
Expand Down
5 changes: 5 additions & 0 deletions plugins/module_utils/linode_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@
]

global_requirements = ["python >= 3"]

beta_disclaimer = (
"> :warning: **This module makes use of beta endpoints and requires the `api_version` "
"field be explicitly set to `v4beta`.**"
)
1 change: 1 addition & 0 deletions plugins/modules/account_availability_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
)._raw_json,
),
],
requires_beta=True,
)

SPECDOC_META = module.spec
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/account_availability_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
result_docs_url="TBD",
result_samples=docs.result_account_availabilities_samples,
examples=docs.specdoc_examples,
requires_beta=True,
)

SPECDOC_META = module.spec
Expand Down
6 changes: 5 additions & 1 deletion plugins/modules/ip_share.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
LinodeModuleBase,
)
from ansible_collections.linode.cloud.plugins.module_utils.linode_docs import (
beta_disclaimer,
global_authors,
global_requirements,
)
Expand Down Expand Up @@ -44,7 +45,10 @@
}

SPECDOC_META = SpecDocMeta(
description=["Manage the Linode shared IPs."],
description=[
beta_disclaimer,
"Manage the Linode shared IPs.",
],
requirements=global_requirements,
author=global_authors,
options=ip_share_spec,
Expand Down

0 comments on commit 22c4e26

Please sign in to comment.