From 88c62c51b908135fde0505f9582075ec0ab03fc8 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Mon, 4 Jul 2022 17:02:00 +0200 Subject: [PATCH] Rename cloudwatch metrics_alarm (#1304) Rename cloudwatch metrics_alarm SUMMARY In line with the new naming guidelines rename ec2_metric_alarm to cloudwatch_metric_alarm ISSUE TYPE Feature Pull Request COMPONENT NAME plugins/modules/cloudwatch_metric_alarm.py plugins/modules/ec2_metric_alarm.py ADDITIONAL INFORMATION Reviewed-by: Alina Buzachis --- README.md | 2 +- .../fragments/1304-rename_cloudwatch.yml | 2 ++ ...ty.aws.cloudwatch_metric_alarm_module.rst} | 19 +++++++-------- meta/runtime.yml | 4 ++++ ...ic_alarm.py => cloudwatch_metric_alarm.py} | 23 ++++++++++--------- .../aliases | 0 .../defaults/main.yml | 0 .../meta/main.yml | 0 .../tasks/env_cleanup.yml | 0 .../tasks/env_setup.yml | 0 .../tasks/main.yml | 0 .../vars/main.yml | 0 12 files changed, 29 insertions(+), 21 deletions(-) create mode 100644 changelogs/fragments/1304-rename_cloudwatch.yml rename docs/{community.aws.ec2_metric_alarm_module.rst => community.aws.cloudwatch_metric_alarm_module.rst} (97%) rename plugins/modules/{ec2_metric_alarm.py => cloudwatch_metric_alarm.py} (96%) rename tests/integration/targets/{ec2_metric_alarm => cloudwatch_metric_alarm}/aliases (100%) rename tests/integration/targets/{ec2_metric_alarm => cloudwatch_metric_alarm}/defaults/main.yml (100%) rename tests/integration/targets/{ec2_metric_alarm => cloudwatch_metric_alarm}/meta/main.yml (100%) rename tests/integration/targets/{ec2_metric_alarm => cloudwatch_metric_alarm}/tasks/env_cleanup.yml (100%) rename tests/integration/targets/{ec2_metric_alarm => cloudwatch_metric_alarm}/tasks/env_setup.yml (100%) rename tests/integration/targets/{ec2_metric_alarm => cloudwatch_metric_alarm}/tasks/main.yml (100%) rename tests/integration/targets/{ec2_metric_alarm => cloudwatch_metric_alarm}/vars/main.yml (100%) diff --git a/README.md b/README.md index 934a6821833..322ba920ca4 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ Name | Description [community.aws.cloudfront_origin_access_identity](https://github.com/ansible-collections/community.aws/blob/main/docs/community.aws.cloudfront_origin_access_identity_module.rst)|Create, update and delete origin access identities for a CloudFront distribution [community.aws.cloudfront_response_headers_policy](https://github.com/ansible-collections/community.aws/blob/main/docs/community.aws.cloudfront_response_headers_policy_module.rst)|Create, update and delete response headers policies to be used in a Cloudfront distribution [community.aws.cloudtrail](https://github.com/ansible-collections/community.aws/blob/main/docs/community.aws.cloudtrail_module.rst)|manage CloudTrail create, delete, update +[community.aws.cloudwatch_metric_alarm](https://github.com/ansible-collections/community.aws/blob/main/docs/community.aws.cloudwatch_metric_alarm_module.rst)|Create/update or delete AWS CloudWatch 'metric alarms' [community.aws.cloudwatchevent_rule](https://github.com/ansible-collections/community.aws/blob/main/docs/community.aws.cloudwatchevent_rule_module.rst)|Manage CloudWatch Event rules and targets [community.aws.cloudwatchlogs_log_group](https://github.com/ansible-collections/community.aws/blob/main/docs/community.aws.cloudwatchlogs_log_group_module.rst)|create or delete log_group in CloudWatchLogs [community.aws.cloudwatchlogs_log_group_info](https://github.com/ansible-collections/community.aws/blob/main/docs/community.aws.cloudwatchlogs_log_group_info_module.rst)|Get information about log_group in CloudWatchLogs @@ -95,7 +96,6 @@ Name | Description [community.aws.ec2_eip](https://github.com/ansible-collections/community.aws/blob/main/docs/community.aws.ec2_eip_module.rst)|manages EC2 elastic IP (EIP) addresses. [community.aws.ec2_eip_info](https://github.com/ansible-collections/community.aws/blob/main/docs/community.aws.ec2_eip_info_module.rst)|List EC2 EIP details [community.aws.ec2_launch_template](https://github.com/ansible-collections/community.aws/blob/main/docs/community.aws.ec2_launch_template_module.rst)|Manage EC2 launch templates -[community.aws.ec2_metric_alarm](https://github.com/ansible-collections/community.aws/blob/main/docs/community.aws.ec2_metric_alarm_module.rst)|Create/update or delete AWS Cloudwatch 'metric alarms' [community.aws.ec2_placement_group](https://github.com/ansible-collections/community.aws/blob/main/docs/community.aws.ec2_placement_group_module.rst)|Create or delete an EC2 Placement Group [community.aws.ec2_placement_group_info](https://github.com/ansible-collections/community.aws/blob/main/docs/community.aws.ec2_placement_group_info_module.rst)|List EC2 Placement Group(s) details [community.aws.ec2_snapshot_copy](https://github.com/ansible-collections/community.aws/blob/main/docs/community.aws.ec2_snapshot_copy_module.rst)|Copies an EC2 snapshot and returns the new Snapshot ID diff --git a/changelogs/fragments/1304-rename_cloudwatch.yml b/changelogs/fragments/1304-rename_cloudwatch.yml new file mode 100644 index 00000000000..7763cca4cef --- /dev/null +++ b/changelogs/fragments/1304-rename_cloudwatch.yml @@ -0,0 +1,2 @@ +minor_changes: +- ec2_metric_alarm - the ``ec2_metric_alarm`` module has been renamed to ``cloudwatch_metric_alarm``, ``ec2_metric_alarm`` remains as an alias (https://github.com/ansible-collections/community.aws/pull/1304). diff --git a/docs/community.aws.ec2_metric_alarm_module.rst b/docs/community.aws.cloudwatch_metric_alarm_module.rst similarity index 97% rename from docs/community.aws.ec2_metric_alarm_module.rst rename to docs/community.aws.cloudwatch_metric_alarm_module.rst index 03b1ad382cc..19b461dfd59 100644 --- a/docs/community.aws.ec2_metric_alarm_module.rst +++ b/docs/community.aws.cloudwatch_metric_alarm_module.rst @@ -1,11 +1,11 @@ -.. _community.aws.ec2_metric_alarm_module: +.. _community.aws.cloudwatch_metric_alarm_module: -****************************** -community.aws.ec2_metric_alarm -****************************** +************************************* +community.aws.cloudwatch_metric_alarm +************************************* -**Create/update or delete AWS Cloudwatch 'metric alarms'** +**Create/update or delete AWS CloudWatch 'metric alarms'** Version added: 1.0.0 @@ -17,8 +17,9 @@ Version added: 1.0.0 Synopsis -------- -- Can create or delete AWS metric alarms. +- Can create or delete AWS CloudWatch metric alarms. - Metrics you wish to alarm on must already exist. +- Prior to release 5.0.0 this module was called ``community.aws.ec2_metric_alarm``. The usage did not change. @@ -287,7 +288,7 @@ Parameters -
Name of the appropriate namespace (AWS/EC2, System/Linux, etc.), which determines the category it will appear under in cloudwatch.
+
Name of the appropriate namespace (AWS/EC2, System/Linux, etc.), which determines the category it will appear under in CloudWatch.
@@ -532,7 +533,7 @@ Examples .. code-block:: yaml - name: create alarm - community.aws.ec2_metric_alarm: + community.aws.cloudwatch_metric_alarm: state: present region: ap-southeast-2 name: "cpu-low" @@ -549,7 +550,7 @@ Examples alarm_actions: ["action1","action2"] - name: Create an alarm to recover a failed instance - community.aws.ec2_metric_alarm: + community.aws.cloudwatch_metric_alarm: state: present region: us-west-1 name: "recover-instance" diff --git a/meta/runtime.yml b/meta/runtime.yml index dbb6bf7bbee..41bc042c3eb 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -72,6 +72,7 @@ action_groups: - cloudfront_origin_access_identity - cloudfront_response_headers_policy - cloudtrail + - cloudwatch_metric_alarm - cloudwatchevent_rule - cloudwatchlogs_log_group - cloudwatchlogs_log_group_info @@ -343,6 +344,9 @@ plugin_routing: redirect: community.aws.autoscaling_scheduled_action ec2_elb: redirect: community.aws.elb_instance + ec2_metric_alarm: + # Deprecation for this alias should not *start* prior to 2024-09-01 + redirect: community.aws.cloudwatch_metric_alarm ec2_instance: redirect: amazon.aws.ec2_instance ec2_instance_info: diff --git a/plugins/modules/ec2_metric_alarm.py b/plugins/modules/cloudwatch_metric_alarm.py similarity index 96% rename from plugins/modules/ec2_metric_alarm.py rename to plugins/modules/cloudwatch_metric_alarm.py index 8c30909907e..dbe6bf43f94 100644 --- a/plugins/modules/ec2_metric_alarm.py +++ b/plugins/modules/cloudwatch_metric_alarm.py @@ -19,13 +19,16 @@ DOCUMENTATION = r''' -module: ec2_metric_alarm -short_description: "Create/update or delete AWS Cloudwatch 'metric alarms'" +module: cloudwatch_metric_alarm +short_description: "Create/update or delete AWS CloudWatch 'metric alarms'" version_added: 1.0.0 description: - - Can create or delete AWS metric alarms. + - Can create or delete AWS CloudWatch metric alarms. - Metrics you wish to alarm on must already exist. -author: "Zacharie Eakin (@Zeekin)" + - Prior to release 5.0.0 this module was called C(community.aws.ec2_metric_alarm). + The usage did not change. +author: + - "Zacharie Eakin (@Zeekin)" options: state: description: @@ -46,7 +49,7 @@ type: str namespace: description: - - Name of the appropriate namespace (C(AWS/EC2), C(System/Linux), etc.), which determines the category it will appear under in cloudwatch. + - Name of the appropriate namespace (C(AWS/EC2), C(System/Linux), etc.), which determines the category it will appear under in CloudWatch. required: false type: str statistic: @@ -156,14 +159,13 @@ - 'missing' default: 'missing' extends_documentation_fragment: -- amazon.aws.aws -- amazon.aws.ec2 - + - amazon.aws.aws + - amazon.aws.ec2 ''' EXAMPLES = r''' - name: create alarm - community.aws.ec2_metric_alarm: + community.aws.cloudwatch_metric_alarm: state: present region: ap-southeast-2 name: "cpu-low" @@ -180,7 +182,7 @@ alarm_actions: ["action1","action2"] - name: Create an alarm to recover a failed instance - community.aws.ec2_metric_alarm: + community.aws.cloudwatch_metric_alarm: state: present region: us-west-1 name: "recover-instance" @@ -195,7 +197,6 @@ description: "This will recover an instance when it fails" dimensions: {"InstanceId":'i-XXX'} alarm_actions: ["arn:aws:automate:us-west-1:ec2:recover"] - ''' try: diff --git a/tests/integration/targets/ec2_metric_alarm/aliases b/tests/integration/targets/cloudwatch_metric_alarm/aliases similarity index 100% rename from tests/integration/targets/ec2_metric_alarm/aliases rename to tests/integration/targets/cloudwatch_metric_alarm/aliases diff --git a/tests/integration/targets/ec2_metric_alarm/defaults/main.yml b/tests/integration/targets/cloudwatch_metric_alarm/defaults/main.yml similarity index 100% rename from tests/integration/targets/ec2_metric_alarm/defaults/main.yml rename to tests/integration/targets/cloudwatch_metric_alarm/defaults/main.yml diff --git a/tests/integration/targets/ec2_metric_alarm/meta/main.yml b/tests/integration/targets/cloudwatch_metric_alarm/meta/main.yml similarity index 100% rename from tests/integration/targets/ec2_metric_alarm/meta/main.yml rename to tests/integration/targets/cloudwatch_metric_alarm/meta/main.yml diff --git a/tests/integration/targets/ec2_metric_alarm/tasks/env_cleanup.yml b/tests/integration/targets/cloudwatch_metric_alarm/tasks/env_cleanup.yml similarity index 100% rename from tests/integration/targets/ec2_metric_alarm/tasks/env_cleanup.yml rename to tests/integration/targets/cloudwatch_metric_alarm/tasks/env_cleanup.yml diff --git a/tests/integration/targets/ec2_metric_alarm/tasks/env_setup.yml b/tests/integration/targets/cloudwatch_metric_alarm/tasks/env_setup.yml similarity index 100% rename from tests/integration/targets/ec2_metric_alarm/tasks/env_setup.yml rename to tests/integration/targets/cloudwatch_metric_alarm/tasks/env_setup.yml diff --git a/tests/integration/targets/ec2_metric_alarm/tasks/main.yml b/tests/integration/targets/cloudwatch_metric_alarm/tasks/main.yml similarity index 100% rename from tests/integration/targets/ec2_metric_alarm/tasks/main.yml rename to tests/integration/targets/cloudwatch_metric_alarm/tasks/main.yml diff --git a/tests/integration/targets/ec2_metric_alarm/vars/main.yml b/tests/integration/targets/cloudwatch_metric_alarm/vars/main.yml similarity index 100% rename from tests/integration/targets/ec2_metric_alarm/vars/main.yml rename to tests/integration/targets/cloudwatch_metric_alarm/vars/main.yml