Skip to content

Commit

Permalink
aws-dump: Include qualifier when parsing ARNs
Browse files Browse the repository at this point in the history
  • Loading branch information
hamstah committed Aug 4, 2019
1 parent 71314f4 commit afa9192
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions aws/dump/resources/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,20 @@ func (r *Resource) UniqueID() string {
return r.ARN
}

func NewResource(arn string, metadata interface{}) (*Resource, error) {
parsed, err := common.ParseARN(arn)
func NewResource(arnstr string, metadata interface{}) (*Resource, error) {
parsed, err := common.ParseARN(arnstr)
if err != nil {
return nil, err
}

id := parsed.Resource
if len(parsed.Qualifier) != 0 {
id = fmt.Sprintf("%s/%s", id, parsed.Qualifier)
}

return &Resource{
ID: parsed.Resource,
ARN: arn,
ID: id,
ARN: arnstr,
Service: parsed.Service,
Type: parsed.ResourceType,
AccountID: parsed.AccountID,
Expand Down

0 comments on commit afa9192

Please sign in to comment.