feat: migrate 10 more AWS resources to generic Resource[C] pattern (batch 2)#985
Closed
james00012 wants to merge 1 commit intomasterfrom
Closed
feat: migrate 10 more AWS resources to generic Resource[C] pattern (batch 2)#985james00012 wants to merge 1 commit intomasterfrom
james00012 wants to merge 1 commit intomasterfrom
Conversation
…atch 2)
This PR continues the migration to the generic Resource[C] pattern.
## New Resources Migrated (10)
- CloudTrail
- CloudWatch Alarm (with ClassifyAndNuke for composite/metric alarms)
- DataSync Location
- DataSync Task
- DynamoDB
- ECR
- Elastic Beanstalk
- GuardDuty
- SES Configuration Set
- SQS Queue
## New Pattern: ClassifyAndNuke
Added `ClassifyAndNuke` to batch_deleter.go for resources that need different
deletion strategies for different subtypes. It:
- Takes a classifier function that splits resources into N ordered groups
- Takes N handlers (variadic) - one per group
- Composes with existing handlers (SequentialDeleter, BulkDeleter, etc.)
Example usage (CloudWatch Alarms):
```go
Nuker: resource.ClassifyAndNuke(
classifyCloudWatchAlarms, // [[composite], [metric]]
resource.SequentialDeleter(deleteCompositeAlarm), // Group 0: prep + delete
resource.BulkDeleter(deleteMetricAlarmsBulk), // Group 1: bulk delete
)
```
## Files Deleted (10 *_types.go files consolidated)
- cloudtrail_types.go
- cloudwatch_alarm_types.go
- datasync_location_types.go
- datasync_task_types.go
- dynamodb_types.go
- ecr_types.go
- elastic_beanstalk_types.go
- guardduty_types.go
- ses_configuration_set_types.go
- sqs_types.go
b6334e2 to
4f0d0bf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resource[C]pattern*_types.gofiles (consolidated into main resource files)Resources Migrated
SequentialDeleterandBulkDeleter)CloudWatch Alarms Special Handling
CloudWatch Alarms requires different deletion strategies for composite vs metric alarms:
The custom nuker classifies alarms and delegates to:
resource.SequentialDeleter(deleteCompositeAlarm)for composite alarmsresource.BulkDeleter(deleteMetricAlarmsBulk)for metric alarmsTest plan
go test ./aws/resources/... ./resource/...)go build ./...)