Skip to content

Commit

Permalink
Rename cloudwatch metrics_alarm (ansible-collections#1304)
Browse files Browse the repository at this point in the history
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 <None>
  • Loading branch information
tremble authored Jul 4, 2022
1 parent 1eb379a commit 88c62c5
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions changelogs/fragments/1304-rename_cloudwatch.yml
Original file line number Diff line number Diff line change
@@ -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).
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.



Expand Down Expand Up @@ -287,7 +288,7 @@ Parameters
<td>
</td>
<td>
<div>Name of the appropriate namespace (<code>AWS/EC2</code>, <code>System/Linux</code>, etc.), which determines the category it will appear under in cloudwatch.</div>
<div>Name of the appropriate namespace (<code>AWS/EC2</code>, <code>System/Linux</code>, etc.), which determines the category it will appear under in CloudWatch.</div>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions meta/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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:
Expand Down

0 comments on commit 88c62c5

Please sign in to comment.