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

feat(table): add aws_rds_db_maintenance_action #2430

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

Conversation

fyqtian
Copy link

@fyqtian fyqtian commented Feb 25, 2025

Integration test logs

Logs
Add passing integration test logs here

Example query results

Results
 resource_identifier                                                                 | action        | opt_in_status | auto_applied_after_date | current_apply_date | description                                     | forced_apply_date | tags   | title                             >
+-------------------------------------------------------------------------------------+---------------+---------------+-------------------------+--------------------+-------------------------------------------------+-------------------+--------+----------------------------------->
| arn:aws:rds:us-west-2:000000000000:cluster:cluster1                                 | system-update | <null>        | <null>                  | <null>             | Upgrade to Aurora PostgreSQL 15.5.6             | <null>            | <null> | arn:aws:rds:us-west-2:000000000000>
| arn:aws:rds:us-west-2:000000000000:db:db1                                           | system-update | <null>        | <null>                  | <null>             | New Operating System patch is available         | <null>            | <null> | arn:aws:rds:us-west-2:000000000000>
| arn:aws:rds:us-west-2:000000000000:cluster:cluster1                                 | os-upgrade    | <null>        | <null>                  | <null>             | New Operating System patch is available         | <null>            | <null> | arn:aws:rds:us-west-2:000000000000>
| arn:aws:rds:us-west-2:000000000000:db:db2                                           | system-update | <null>        | <null>                  | <null>             | New Operating System patch is available         | <null>            | <null> | arn:aws:rds:us-west-2:000000000000>
| arn:aws:rds:us-west-2:000000000000:db:db3                                           | db-upgrade    | <null>        | <null>                  | <null>             | New engine patch version is available: 13.15.R3 | <null>            | <null> | arn:aws:rds:us-west-2:000000000000>
| arn:aws:rds:us-west-2:000000000000:cluster:cluster1                                 | system-update | <null>        | <null>                  | <null>             | Upgrade to Aurora PostgreSQL 14.11.4            | <null>            | <null> | arn:aws:rds:us-west-2:000000000000

@misraved misraved requested a review from ParthaI February 25, 2025 05:44
Copy link
Contributor

@ParthaI ParthaI left a comment

Choose a reason for hiding this comment

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

Hello @fyqtian, I’ve added a few initial review comments. When you get a chance, could you please take a look?

Additionally, it would be great to include more example queries in the documentation.

Comment on lines 31 to 36
{
Name: "arn",
Description: "The Amazon Resource Name (ARN) of the resource that the pending maintenance action applies to.",
Type: proto.ColumnType_STRING,
Transform: transform.FromField("ResourceIdentifier"),
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{
Name: "arn",
Description: "The Amazon Resource Name (ARN) of the resource that the pending maintenance action applies to.",
Type: proto.ColumnType_STRING,
Transform: transform.FromField("ResourceIdentifier"),
},
{
Name: "resource_identifier",
Description: "The ARN of the resource that has pending maintenance actions.",
Type: proto.ColumnType_STRING,
},

The aws_rds_db_maintenance_action table is designed to display pending actions for clusters.

As per table development standards, if maintenance_action follows a standard ARN format, we should include an ARN column. Otherwise, the column name should align with the API response.

plugin.Logger(ctx).Error("aws_rds_db_maintenance_action.listMaintenanceAction", "connection_error", err)
return nil, err
}
var maxItems = calculateMaxLimit[int32](100, d)
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that these changes will help optimize the code and make it reusable for tables with a minimum limit of 1 per page.

I also noticed that the minimum value for this is 20. You can find more details here: AWS Documentation.

To maintain consistency across tables, could you please follow the standards used in other tables?

Comment on lines 83 to 88
type result struct {
Name string
ResourceIdentifier string
IsCluster bool
types.PendingMaintenanceAction
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
type result struct {
Name string
ResourceIdentifier string
IsCluster bool
types.PendingMaintenanceAction
}
type result struct {
ResourceIdentifier string
types.PendingMaintenanceAction
}

Since we don't include columns for attributes that are not directly part of the API response, it would be best to avoid adding them.

Additionally, could we move the custom struct from the function scope to the table scope? This would make it reusable for fetching hydrate data in any child tables if needed.

IsCluster: splitIdentifier[n-2] == "cluster",
PendingMaintenanceAction: detail,
}
d.StreamListItem(ctx, r)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add the context cancellation logic here to ensure that if the context is canceled, the loop terminates immediately.

For example: https://github.com/turbot/steampipe-plugin-aws/blob/main/aws/table_aws_rds_db_cluster.go#L523

@ParthaI ParthaI linked an issue Feb 25, 2025 that may be closed by this pull request
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.

Add table aws_rds_db_maintenance_actions
2 participants