Skip to content

Add table aws_cloudwatch_event_rule #2487

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

ParthaI
Copy link
Contributor

@ParthaI ParthaI commented May 5, 2025

Integration test logs

Logs
Add passing integration test logs here

Example query results

Results
> select
  name,
  cd ->> 'Id' as target_id,
  cd ->> 'Arn' as target_arn,
  cd ->> 'RoleArn' as role_arn
from
  aws_cloudwatch_event_rule,
  jsonb_array_elements(targets) as cd;
+--------------------------------------------------------------+----------------------------------------+--------------------------------------------------------------------+----------+
| name                                                         | target_id                              | target_arn                                                         | role_arn |
+--------------------------------------------------------------+----------------------------------------+--------------------------------------------------------------------+----------+
| turbot_aws_api_events_iam                                    | turbot_event_handlers                  | arn:aws:sns:ap-south-1:123456789012:turbot_aws_api_handler         | <null>   |
| turbot_aws_api_events_ssm                                    | turbot_event_handlers                  | arn:aws:sns:ap-south-1:123456789012:turbot_aws_api_handler         | <null>   |
| turbot_aws_api_events_lambda                                 | turbot_event_handlers                  | arn:aws:sns:eu-west-2:123456789012:turbot_aws_api_handler          | <null>   |
| turbot_aws_api_events_ecs                                    | turbot_event_handlers                  | arn:aws:sns:eu-west-2:123456789012:turbot_aws_api_handler          | <null>   |
| turbot_aws_api_events_billingconsole                         | turbot_event_handlers                  | arn:aws:sns:eu-west-2:123456789012:turbot_aws_api_handler          | <null>   |
| turbot_aws_api_events_iam                                    | turbot_event_handlers                  | arn:aws:sns:eu-west-2:123456789012:turbot_aws_api_handler          | <null>   |
| turbot_aws_api_events_rds                                    | turbot_event_handlers                  | arn:aws:sns:eu-west-2:123456789012:turbot_aws_api_handler          | <null>   |
| turbot_aws_api_events_cloudtrail                             | turbot_event_handlers                  | arn:aws:sns:ap-south-1:123456789012:turbot_aws_api_handler         | <null>   |
| turbot_aws_api_events_logs                                   | turbot_event_handlers                  | arn:aws:sns:eu-west-2:123456789012:turbot_aws_api_handler          | <null>   |
| turbot_aws_api_events_iam                                    | turbot_event_handlers                  | arn:aws:sns:ap-southeast-1:123456789012:turbot_aws_api_handler     | <null>   |
| turbot_aws_api_events_ssm                                    | turbot_event_handlers                  | arn:aws:sns:eu-west-2:123456789012:turbot_aws_api_handler          | <null>   |
| turbot_aws_api_events_ecs                                    | turbot_event_handlers                  | arn:aws:sns:eu-west-1:123456789012:turbot_aws_api_handler          | <null>   |
| turbot_aws_api_events_lambda                                 | turbot_event_handlers                  | arn:aws:sns:eu-west-1:123456789012:turbot_aws_api_handler          | <null>   |
| turbot_aws_api_events_iam                                    | turbot_event_handlers                  | arn:aws:sns:eu-west-1:123456789012:turbot_aws_api_handler          | <null>   |
| turbot_aws_api_events_cloudtrail                             | turbot_event_handlers                  | arn:aws:sns:eu-west-1:123456789012:turbot_aws_api_handler          | <null>   |
| turbot_aws_api_events_ssm                                    | turbot_event_handlers                  | arn:aws:sns:eu-west-1:123456789012:turbot_aws_api_handler          | <null>   |
| turbot_aws_api_events_config                                 | turbot_event_handlers                  | arn:aws:sns:eu-west-1:123456789012:turbot_aws_api_handler          | <null>   |
| turbot_aws_api_events_eks                                    | turbot_event_handlers                  | arn:aws:sns:eu-west-1:123456789012:turbot_aws_api_handler          | <null>   |
| turbot_aws_api_events                                        | turbot_event_handlers                  | arn:aws:sns:eu-west-1:123456789012:turbot_aws_api_handler          | <null>   |
| turbot_aws_api_events_logs                                   | turbot_event_handlers                  | arn:aws:sns:eu-west-1:123456789012:turbot_aws_api_handler          | <null>   |
> select
  r.name as rule_name,
  t ->> 'Id' as target_id,
  t ->> 'Arn' as lambda_arn
from
  aws_cloudwatch_event_rule as r,
  jsonb_array_elements(r.targets) as t
where
  t ->> 'Arn' like 'arn:aws:lambda:%';
+-------------------------+----------------------------------------+--------------------------------------------------------------------+
| rule_name               | target_id                              | lambda_arn                                                         |
+-------------------------+----------------------------------------+--------------------------------------------------------------------+
| SecurityHubFindingsToS3 | Id6e10ad65-e69c-4e55-b545-2056bd7d45bc | arn:aws:lambda:us-east-2:123456789012:function:securityhub-finding |
+-------------------------+----------------------------------------+--------------------------------------------------------------------+

@ParthaI ParthaI requested a review from misraved May 5, 2025 15:14
@ParthaI ParthaI requested a review from Copilot May 7, 2025 05:42
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new Steampipe table for querying AWS CloudWatch Event Rules, including documentation updates and corresponding table implementation in Go.

  • Introduces the aws_cloudwatch_event_rule table documentation in Markdown.
  • Implements table logic, listing, hydration, and transformation functions in Go.
  • Registers the new table within the AWS plugin.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
docs/tables/aws_cloudwatch_event_rule.md Adds documentation and examples for querying CloudWatch Event Rules.
aws/table_aws_cloudwatch_event_rule.go Implements the table definition, list, get, hydrate, and transform functions for the new table.
aws/plugin.go Registers the new aws_cloudwatch_event_rule table.

@ParthaI ParthaI self-assigned this May 7, 2025
Copy link
Contributor

@misraved misraved left a comment

Choose a reason for hiding this comment

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

Please take a look at the minor review comment!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants