Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: Add deprecation notice to OBJ cluster-related modules & fields #526

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Name | Description |
[linode.cloud.ipv6_range_info](./docs/modules/ipv6_range_info.md)|Get info about a Linode IPv6 range.|
[linode.cloud.lke_cluster_info](./docs/modules/lke_cluster_info.md)|Get info about a Linode LKE cluster.|
[linode.cloud.nodebalancer_info](./docs/modules/nodebalancer_info.md)|Get info about a Linode NodeBalancer.|
[linode.cloud.object_cluster_info](./docs/modules/object_cluster_info.md)|Get info about a Linode Object Storage Cluster.|
[linode.cloud.object_cluster_info](./docs/modules/object_cluster_info.md)|**NOTE: This module has been deprecated because it relies on deprecated API endpoints. Going forward, `region` will be the preferred way to designate where Object Storage resources should be created.**|
[linode.cloud.placement_group_info](./docs/modules/placement_group_info.md)|Get info about a Linode Placement Group.|
[linode.cloud.profile_info](./docs/modules/profile_info.md)|Get info about a Linode Profile.|
[linode.cloud.ssh_key_info](./docs/modules/ssh_key_info.md)|Get info about the Linode SSH public key.|
Expand Down Expand Up @@ -102,7 +102,7 @@ Name | Description |
[linode.cloud.instance_type_list](./docs/modules/instance_type_list.md)|List and filter on Linode Instance Types.|
[linode.cloud.lke_version_list](./docs/modules/lke_version_list.md)|List Kubernetes versions available for deployment to a Kubernetes cluster.|
[linode.cloud.nodebalancer_list](./docs/modules/nodebalancer_list.md)|List and filter on Nodebalancers.|
[linode.cloud.object_cluster_list](./docs/modules/object_cluster_list.md)|List and filter on Object Storage Clusters.|
[linode.cloud.object_cluster_list](./docs/modules/object_cluster_list.md)|**NOTE: This module has been deprecated because it relies on deprecated API endpoints. Going forward, `region` will be the preferred way to designate where Object Storage resources should be created.**|
[linode.cloud.placement_group_list](./docs/modules/placement_group_list.md)|List and filter on Placement Groups.|
[linode.cloud.region_list](./docs/modules/region_list.md)|List and filter on Linode Regions.|
[linode.cloud.ssh_key_list](./docs/modules/ssh_key_list.md)|List and filter on SSH keys in the Linode profile.|
Expand Down
2 changes: 2 additions & 0 deletions docs/modules/object_cluster_info.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# object_cluster_info

**NOTE: This module has been deprecated because it relies on deprecated API endpoints. Going forward, `region` will be the preferred way to designate where Object Storage resources should be created.**

Get info about a Linode Object Storage Cluster.

- [Minimum Required Fields](#minimum-required-fields)
Expand Down
2 changes: 2 additions & 0 deletions docs/modules/object_cluster_list.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# object_cluster_list

**NOTE: This module has been deprecated because it relies on deprecated API endpoints. Going forward, `region` will be the preferred way to designate where Object Storage resources should be created.**

List and filter on Object Storage Clusters.

- [Minimum Required Fields](#minimum-required-fields)
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/object_keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Manage Linode Object Storage Keys.

| Field | Type | Required | Description |
|-----------|------|----------|------------------------------------------------------------------------------|
| `cluster` | <center>`str`</center> | <center>**Required**</center> | The id of the cluster that the provided bucket exists under. |
| `cluster` | <center>`str`</center> | <center>**Required**</center> | The id of the cluster that the provided bucket exists under. **NOTE: This field has been deprecated because it relies on deprecated API endpoints. Going forward, `region` will be the preferred way to designate where Object Storage resources should be created.** |
| `bucket_name` | <center>`str`</center> | <center>**Required**</center> | The name of the bucket to set the key's permissions for. |
| `permissions` | <center>`str`</center> | <center>**Required**</center> | The permissions to give the key. **(Choices: `read_only`, `write_only`, `read_write`)** |

Expand Down
15 changes: 14 additions & 1 deletion plugins/modules/object_cluster_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@
}

SPECDOC_META = SpecDocMeta(
description=["Get info about a Linode Object Storage Cluster."],
description=[
"**NOTE: This module has been deprecated because it "
+ "relies on deprecated API endpoints. Going forward, `region` will "
+ "be the preferred way to designate where Object Storage resources "
+ "should be created.**",
"Get info about a Linode Object Storage Cluster.",
],
requirements=global_requirements,
author=global_authors,
options=linode_object_cluster_info_spec,
Expand Down Expand Up @@ -121,6 +127,13 @@ def _get_matching_clusters(self) -> Optional[List[ObjectStorageCluster]]:
def exec_module(self, **kwargs: Any) -> Optional[dict]:
"""Constructs and calls the Linode Object Storage Clusters module"""

self.warn(
"The linode.cloud.object_cluster_info module has been deprecated because it "
"relies on deprecated API endpoints.\n"
"Going forward, region will be the preferred way to designate where Object "
"Storage resources should be created."
)

clusters = self._get_matching_clusters()

if clusters is None:
Expand Down
15 changes: 14 additions & 1 deletion plugins/modules/object_cluster_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@
}

SPECDOC_META = SpecDocMeta(
description=["List and filter on Object Storage Clusters."],
description=[
"**NOTE: This module has been deprecated because it "
+ "relies on deprecated API endpoints. Going forward, `region` will "
+ "be the preferred way to designate where Object Storage resources "
+ "should be created.**",
"List and filter on Object Storage Clusters.",
],
requirements=global_requirements,
author=global_authors,
options=spec,
Expand Down Expand Up @@ -111,6 +117,13 @@ def __init__(self) -> None:
def exec_module(self, **kwargs: Any) -> Optional[dict]:
"""Entrypoint for object storage cluster list module"""

self.warn(
"The linode.cloud.object_cluster_list has been deprecated because it relies "
"on deprecated API endpoints.\n"
"Going forward, region will be the preferred way to designate where Object "
"Storage resources should be created."
)

filter_dict = construct_api_filter(self.module.params)

self.results["clusters"] = get_all_paginated(
Expand Down
28 changes: 27 additions & 1 deletion plugins/modules/object_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
type=FieldType.string,
required=True,
description=[
"The id of the cluster that the provided bucket exists under."
"The id of the cluster that the provided bucket exists under.",
"**NOTE: This field has been deprecated because it "
+ "relies on deprecated API endpoints. Going forward, `region` will "
+ "be the preferred way to designate where Object Storage resources "
+ "should be created.**",
],
),
"bucket_name": SpecField(
Expand Down Expand Up @@ -164,9 +168,31 @@ def _handle_key_absent(self) -> None:
self._key.delete()
self.register_action("Deleted key {0}".format(label))

def _attempt_warnings(self, **kwargs: Any) -> None:
"""
Raises warnings depending on the user-defined module arguments.
"""

# Logic to warn if the `cluster` field has been specified
access: Optional[List] = kwargs.get("access", None)

# If cluster has been defined for any of the `access` objects,
# raise a deprecation warning
if access is not None and any(
v is not None for v in access if v.get("cluster", None)
):
Comment on lines +179 to +183
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zliang-akamai I think this deprecation will be dependent on TPT-2603, do you mind if I mark this PR as do not merge until that work is done?

self.warn(
"The access.cluster field has been deprecated because it relies "
"on deprecated API endpoints.\n"
"Going forward, region will be the preferred way to designate where Object "
"Storage resources should be created."
)

def exec_module(self, **kwargs: Any) -> Optional[dict]:
"""Constructs and calls the Linode Object Storage Key module"""

self._attempt_warnings(**kwargs)

state = kwargs.pop("state")

if state == "absent":
Expand Down
Loading