Skip to content

Commit

Permalink
fix: Separated global data and commented non us regions
Browse files Browse the repository at this point in the history
  • Loading branch information
sauravpanda committed Jan 25, 2024
1 parent 6351aca commit 134823b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 34 deletions.
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ require (
)

require (
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.42.5 // indirect
github.com/aws/aws-sdk-go-v2/service/cloudwatchevents v1.21.6 // indirect
github.com/aws/aws-sdk-go-v2/service/codebuild v1.27.0 // indirect
github.com/aws/aws-sdk-go-v2/service/ecr v1.24.6 // indirect
github.com/aws/aws-sdk-go-v2/service/elasticsearchservice v1.24.6 // indirect
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.42.5
github.com/aws/aws-sdk-go-v2/service/cloudwatchevents v1.21.6
github.com/aws/aws-sdk-go-v2/service/codebuild v1.27.0
github.com/aws/aws-sdk-go-v2/service/ecr v1.24.6
github.com/aws/aws-sdk-go-v2/service/elasticsearchservice v1.24.6
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.8.4 // indirect
github.com/aws/aws-sdk-go-v2/service/kms v1.27.7 // indirect
github.com/aws/aws-sdk-go-v2/service/route53domains v1.20.5 // indirect
github.com/aws/aws-sdk-go-v2/service/kms v1.27.7
github.com/aws/aws-sdk-go-v2/service/route53domains v1.20.5
github.com/jmespath/go-jmespath v0.4.0 // indirect
)

Expand Down
57 changes: 30 additions & 27 deletions services/awshandler/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,31 @@ import (

// A function to get All the AWS regions
func getAWSRegions() []string {
// Currently supports US Only
return []string{
"us-east-2", // US East (Ohio)
"us-east-1", // US East (N. Virginia)
"us-west-1", // US West (N. California)
"us-west-2", // US West (Oregon)
"af-south-1", // Africa (Cape Town)
"ap-east-1", // Asia Pacific (Hong Kong)
"ap-south-1", // Asia Pacific (Mumbai)
"ap-northeast-3", // Asia Pacific (Osaka)
"ap-northeast-2", // Asia Pacific (Seoul)
"ap-southeast-1", // Asia Pacific (Singapore)
"ap-southeast-2", // Asia Pacific (Sydney)
"ap-northeast-1", // Asia Pacific (Tokyo)
"ca-central-1", // Canada (Central)
"cn-north-1", // China (Beijing)
"cn-northwest-1", // China (Ningxia)
"eu-central-1", // Europe (Frankfurt)
"eu-west-1", // Europe (Ireland)
"eu-west-2", // Europe (London)
"eu-south-1", // Europe (Milan)
"eu-west-3", // Europe (Paris)
"eu-north-1", // Europe (Stockholm)
"me-south-1", // Middle East (Bahrain)
"sa-east-1", // South America (São Paulo)
"us-east-2", // US East (Ohio)
"us-east-1", // US East (N. Virginia)
"us-west-1", // US West (N. California)
"us-west-2", // US West (Oregon)
// "af-south-1", // Africa (Cape Town)
// "ap-east-1", // Asia Pacific (Hong Kong)
// "ap-south-1", // Asia Pacific (Mumbai)
// "ap-northeast-3", // Asia Pacific (Osaka)
// "ap-northeast-2", // Asia Pacific (Seoul)
// "ap-southeast-1", // Asia Pacific (Singapore)
// "ap-southeast-2", // Asia Pacific (Sydney)
// "ap-northeast-1", // Asia Pacific (Tokyo)
// "ca-central-1", // Canada (Central)
// "cn-north-1", // China (Beijing)
// "cn-northwest-1", // China (Ningxia)
// "eu-central-1", // Europe (Frankfurt)
// "eu-west-1", // Europe (Ireland)
// "eu-west-2", // Europe (London)
// "eu-south-1", // Europe (Milan)
// "eu-west-3", // Europe (Paris)
// "eu-north-1", // Europe (Stockholm)
// "me-south-1", // Middle East (Bahrain)
// "sa-east-1", // South America (São Paulo)
}
}

Expand Down Expand Up @@ -68,8 +69,12 @@ func StoreAWSData(region string) {
return
}
fmt.Printf("Storing data for region : %s\n", region)
// Get all the S3 bucket data
S3ListBucketss(sdkConfig, parentpath)

// Run this only once as they are global resource
if region == "us-east-1" {
S3ListBucketss(sdkConfig, parentpath)
ListRoute53Func(sdkConfig, parentpath)
}
// Get all the lambda functions
ListLambdaFns(sdkConfig, parentpath)
// Get all dynamodb tables
Expand All @@ -82,8 +87,6 @@ func StoreAWSData(region string) {
IamMetadata(sdkConfig, parentpath)
// Get RDS Instance
ListRDSFunc(sdkConfig, parentpath)
// Get Route53 Info
ListRoute53Func(sdkConfig, parentpath)
// CloudFormation Stack
CloudformationListFn(sdkConfig, parentpath)
// Cloudwatch Data
Expand Down

0 comments on commit 134823b

Please sign in to comment.