You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Migrate from AWS SDK for Go v1 to v2
This commit completes the migration from AWS SDK for Go v1 to v2 across
the entire codebase, modernizing the AWS integration and improving
performance and maintainability.
Major changes:
- Updated go.mod dependencies from aws-sdk-go v1.55.5 to aws-sdk-go-v2
- Migrated core AWS client infrastructure from session-based to config-based initialization
- Updated all service implementations (RDS, VPC, EC2, Route53, ElastiCache, IAM, MSK)
- Converted pagination patterns from callback-based to paginator/iterator patterns
- Updated error handling from awserr to smithy error patterns
- Fixed type system changes (pointer vs direct values, Int64 vs Int32)
- Updated all test files to use new SDK v2 types and mock interfaces
- Regenerated mock clients to match new interface definitions
Technical details:
- Session management replaced with aws.Config throughout
- Method signatures updated (removed WithContext suffixes)
- Import paths changed to aws-sdk-go-v2 namespace
- Type references updated to service-specific type packages
- Field access patterns fixed for pointer handling changes
- All tests now pass with SDK v2 types and patterns
- Fixed RDS AllocatedStorage metric integer overflow caused by int32 type change
The AllocatedStorage field changed from *int64 to *int32 in SDK v2, causing
overflow when calculating storage in bytes. Fixed by casting to int64 before
multiplication to prevent negative values like -2.147483648e+09
The application maintains full backward compatibility in terms of
functionality while benefiting from improved performance, better
context handling, and enhanced type safety provided by SDK v2.
🤖 Generated with Claude Code
Assisted-by: Claude <[email protected]>
Signed-off-by: Rafa Porres Molina <[email protected]>
* Improve pagination patterns to use AWS SDK v2 paginators consistently
Updated IAM and Route53 services to use proper AWS SDK v2 paginator
patterns through awsclient interface methods for better consistency
and performance.
Changes:
- Added ListRolesAll() method to awsclient interface using iam.NewListRolesPaginator
- Added ListHostedZonesAll() method to awsclient interface using route53.NewListHostedZonesPaginator
- Updated getIAMRoleCount() to use ListRolesAll() instead of manual pagination
- Updated getAllHostedZones() to use ListHostedZonesAll() instead of manual pagination
- Regenerated mock clients to include new paginator methods
- Updated IAM tests to use new ListRolesAll method expectations
- Cleaned up unused imports
All existing "All" methods in awsclient already used proper paginators:
- DescribeDBLogFilesAll, DescribeDBInstancesAll, DescribePendingMaintenanceActionsAll
- DescribeCacheClustersAll, ListClustersAll
Now all pagination follows consistent AWS SDK v2 paginator patterns,
improving performance and reducing code complexity.
🤖 Generated with Claude Code
Assisted-by: Claude <[email protected]>
Signed-off-by: Rafa Porres Molina <[email protected]>
* Count iam roles without getting all into memory
Signed-off-by: Rafa Porres Molina <[email protected]>
* Di's refactor
* remove unused aws client methods
* use count instead of full object when only count needed
* use aws account summary api for iam roles metrics
* call AwsExporterMetrics.IncrementErrors() in usage side only to avoid double
increment
Co-authored-by: Di Wang <[email protected]>
Signed-off-by: Rafa Porres Molina <[email protected]>
---------
Signed-off-by: Rafa Porres Molina <[email protected]>
0 commit comments