Skip to content

Commit 59fbb5e

Browse files
tas50claude
andcommitted
🧹 Address PR review: Redshift region errors, ElastiCache dedup, spell check
- Add IsServiceNotAvailableInRegionError check to 4 new Redshift methods (subnet groups, event subscriptions, scheduled actions, snapshot schedules) - Fetch ElastiCache service updates from single region (global data, not per-region) to eliminate N duplicate copies - Add "xlarge" to spell check expect list Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d918801 commit 59fbb5e

File tree

3 files changed

+46
-62
lines changed

3 files changed

+46
-62
lines changed

‎.github/actions/spelling/expect.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ workdir
335335
WORKSPACESUSER
336336
workspacesweb
337337
Xff
338+
xlarge
338339
xssmatchstatement
339340
yara
340341
zerolog

‎providers/aws/resources/aws_elasticache.go‎

Lines changed: 41 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -624,70 +624,53 @@ func (a *mqlAwsElasticacheUser) id() (string, error) {
624624

625625
func (a *mqlAwsElasticache) serviceUpdates() ([]any, error) {
626626
conn := a.MqlRuntime.Connection.(*connection.AwsConnection)
627-
res := []any{}
628-
poolOfJobs := jobpool.CreatePool(a.getServiceUpdates(conn), 5)
629-
poolOfJobs.Run()
630-
if poolOfJobs.HasErrors() {
631-
return nil, poolOfJobs.GetErrors()
632-
}
633-
for i := range poolOfJobs.Jobs {
634-
if poolOfJobs.Jobs[i].Result != nil {
635-
res = append(res, poolOfJobs.Jobs[i].Result.([]any)...)
636-
}
637-
}
638-
return res, nil
639-
}
640-
641-
func (a *mqlAwsElasticache) getServiceUpdates(conn *connection.AwsConnection) []*jobpool.Job {
642-
tasks := make([]*jobpool.Job, 0)
643627
regions, err := conn.Regions()
644628
if err != nil {
645-
return []*jobpool.Job{{Err: err}}
629+
return nil, err
646630
}
647-
for _, region := range regions {
648-
f := func() (jobpool.JobResult, error) {
649-
svc := conn.Elasticache(region)
650-
ctx := context.Background()
651-
res := []any{}
652-
paginator := elasticache.NewDescribeServiceUpdatesPaginator(svc, &elasticache.DescribeServiceUpdatesInput{})
653-
for paginator.HasMorePages() {
654-
page, err := paginator.NextPage(ctx)
655-
if err != nil {
656-
if Is400AccessDeniedError(err) || IsServiceNotAvailableInRegionError(err) {
657-
log.Warn().Str("region", region).Msg("error accessing region for AWS API")
658-
return res, nil
659-
}
660-
return nil, err
661-
}
662-
for _, su := range page.ServiceUpdates {
663-
mqlSu, err := CreateResource(a.MqlRuntime, ResourceAwsElasticacheServiceUpdate,
664-
map[string]*llx.RawData{
665-
"__id": llx.StringData(fmt.Sprintf("elasticache/serviceupdate/%s/%s", region, convert.ToValue(su.ServiceUpdateName))),
666-
"name": llx.StringDataPtr(su.ServiceUpdateName),
667-
"region": llx.StringData(region),
668-
"description": llx.StringDataPtr(su.ServiceUpdateDescription),
669-
"engine": llx.StringDataPtr(su.Engine),
670-
"engineVersion": llx.StringDataPtr(su.EngineVersion),
671-
"severity": llx.StringData(string(su.ServiceUpdateSeverity)),
672-
"status": llx.StringData(string(su.ServiceUpdateStatus)),
673-
"updateType": llx.StringData(string(su.ServiceUpdateType)),
674-
"releaseDate": llx.TimeDataPtr(su.ServiceUpdateReleaseDate),
675-
"recommendedApplyByDate": llx.TimeDataPtr(su.ServiceUpdateRecommendedApplyByDate),
676-
"endDate": llx.TimeDataPtr(su.ServiceUpdateEndDate),
677-
"estimatedUpdateTime": llx.StringDataPtr(su.EstimatedUpdateTime),
678-
"autoUpdateAfterRecommendedApplyByDate": llx.BoolDataPtr(su.AutoUpdateAfterRecommendedApplyByDate),
679-
})
680-
if err != nil {
681-
return nil, err
682-
}
683-
res = append(res, mqlSu)
684-
}
631+
if len(regions) == 0 {
632+
return nil, nil
633+
}
634+
// Service updates are global; fetch from the first available region.
635+
region := regions[0]
636+
svc := conn.Elasticache(region)
637+
ctx := context.Background()
638+
res := []any{}
639+
paginator := elasticache.NewDescribeServiceUpdatesPaginator(svc, &elasticache.DescribeServiceUpdatesInput{})
640+
for paginator.HasMorePages() {
641+
page, err := paginator.NextPage(ctx)
642+
if err != nil {
643+
if Is400AccessDeniedError(err) || IsServiceNotAvailableInRegionError(err) {
644+
log.Warn().Str("region", region).Msg("error accessing region for AWS API")
645+
return res, nil
685646
}
686-
return jobpool.JobResult(res), nil
647+
return nil, err
648+
}
649+
for _, su := range page.ServiceUpdates {
650+
mqlSu, err := CreateResource(a.MqlRuntime, ResourceAwsElasticacheServiceUpdate,
651+
map[string]*llx.RawData{
652+
"__id": llx.StringData(fmt.Sprintf("elasticache/serviceupdate/%s", convert.ToValue(su.ServiceUpdateName))),
653+
"name": llx.StringDataPtr(su.ServiceUpdateName),
654+
"region": llx.StringData(region),
655+
"description": llx.StringDataPtr(su.ServiceUpdateDescription),
656+
"engine": llx.StringDataPtr(su.Engine),
657+
"engineVersion": llx.StringDataPtr(su.EngineVersion),
658+
"severity": llx.StringData(string(su.ServiceUpdateSeverity)),
659+
"status": llx.StringData(string(su.ServiceUpdateStatus)),
660+
"updateType": llx.StringData(string(su.ServiceUpdateType)),
661+
"releaseDate": llx.TimeDataPtr(su.ServiceUpdateReleaseDate),
662+
"recommendedApplyByDate": llx.TimeDataPtr(su.ServiceUpdateRecommendedApplyByDate),
663+
"endDate": llx.TimeDataPtr(su.ServiceUpdateEndDate),
664+
"estimatedUpdateTime": llx.StringDataPtr(su.EstimatedUpdateTime),
665+
"autoUpdateAfterRecommendedApplyByDate": llx.BoolDataPtr(su.AutoUpdateAfterRecommendedApplyByDate),
666+
})
667+
if err != nil {
668+
return nil, err
669+
}
670+
res = append(res, mqlSu)
687671
}
688-
tasks = append(tasks, jobpool.NewJob(f))
689672
}
690-
return tasks
673+
return res, nil
691674
}
692675

693676
func (a *mqlAwsElasticacheServiceUpdate) id() (string, error) {

‎providers/aws/resources/aws_redshift.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ func (a *mqlAwsRedshift) getSubnetGroups(conn *connection.AwsConnection) []*jobp
401401
for paginator.HasMorePages() {
402402
page, err := paginator.NextPage(ctx)
403403
if err != nil {
404-
if Is400AccessDeniedError(err) {
404+
if Is400AccessDeniedError(err) || IsServiceNotAvailableInRegionError(err) {
405405
log.Warn().Str("region", region).Msg("error accessing region for AWS API")
406406
return res, nil
407407
}
@@ -498,7 +498,7 @@ func (a *mqlAwsRedshift) getEventSubscriptions(conn *connection.AwsConnection) [
498498
for paginator.HasMorePages() {
499499
page, err := paginator.NextPage(ctx)
500500
if err != nil {
501-
if Is400AccessDeniedError(err) {
501+
if Is400AccessDeniedError(err) || IsServiceNotAvailableInRegionError(err) {
502502
log.Warn().Str("region", region).Msg("error accessing region for AWS API")
503503
return res, nil
504504
}
@@ -578,7 +578,7 @@ func (a *mqlAwsRedshift) getScheduledActions(conn *connection.AwsConnection) []*
578578
for paginator.HasMorePages() {
579579
page, err := paginator.NextPage(ctx)
580580
if err != nil {
581-
if Is400AccessDeniedError(err) {
581+
if Is400AccessDeniedError(err) || IsServiceNotAvailableInRegionError(err) {
582582
log.Warn().Str("region", region).Msg("error accessing region for AWS API")
583583
return res, nil
584584
}
@@ -652,7 +652,7 @@ func (a *mqlAwsRedshift) getSnapshotSchedules(conn *connection.AwsConnection) []
652652
for paginator.HasMorePages() {
653653
page, err := paginator.NextPage(ctx)
654654
if err != nil {
655-
if Is400AccessDeniedError(err) {
655+
if Is400AccessDeniedError(err) || IsServiceNotAvailableInRegionError(err) {
656656
log.Warn().Str("region", region).Msg("error accessing region for AWS API")
657657
return res, nil
658658
}

0 commit comments

Comments
 (0)