osbuild-service-maintenance: clean up all regions

Since we started cloning images to different regions, the maintenance
script should clean up all of these regions.
This commit is contained in:
Sanne Raymaekers 2023-01-16 15:38:34 +01:00
parent dc1a770c0f
commit 2e3dd16220
3 changed files with 67 additions and 40 deletions

View file

@ -596,3 +596,16 @@ func (a *AWS) MarkS3ObjectAsPublic(bucket, objectKey string) error {
return nil
}
func (a *AWS) Regions() ([]string, error) {
out, err := a.ec2.DescribeRegions(&ec2.DescribeRegionsInput{})
if err != nil {
return nil, err
}
result := []string{}
for _, r := range out.Regions {
result = append(result, aws.StringValue(r.RegionName))
}
return result, nil
}