This file contains 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
package main | |
import ( | |
"fmt" | |
"github.com/aws/aws-sdk-go/aws" | |
"github.com/aws/aws-sdk-go/aws/session" | |
"github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi" | |
"github.com/olekukonko/tablewriter" | |
"os" | |
"strings" |
This file contains 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
// GetServiceFromArn removes the arn:aws: component string of | |
// the name and returns the first keyword that appears, svc | |
func ServiceNameFromARN(arn *string) *string { | |
shortArn := strings.Replace(*arn, "arn:aws:", "", -1) | |
sliced := strings.Split(shortArn, ":") | |
return &sliced[0] | |
} | |
// Short ARN removes the unnecessary info from the ARN we already | |
// know at this point like region, account id and the service name. |