Skip to content

Commit

Permalink
*: amend code
Browse files Browse the repository at this point in the history
Signed-off-by: BornChanger <[email protected]>
  • Loading branch information
BornChanger committed Jun 29, 2023
1 parent 2900fb9 commit 4da5228
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions pkg/backup/util/aws_ebs.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,27 +155,28 @@ func (e *EC2Session) AddTags(resourcesTags map[string]TagMap) error {

eg := new(errgroup.Group)
for resourceID := range resourcesTags {
id := resourceID
tagMap := resourcesTags[resourceID]
var tags []*ec2.Tag
for tag := range tagMap {
value := tagMap[tag]
tags = append(tags, &ec2.Tag{Key: &tag, Value: &value})
}

// Create the input for adding the tag
input := &ec2.CreateTagsInput{
Resources: []*string{aws.String(resourceID)},
Tags: tags,
}

eg.Go(func() error {
_, err := e.EC2.CreateTags(input)
if err != nil {
klog.Errorf("failed to create tags for resource id=%s", resourceID, err)
return err
}
return nil
})
// Create the input for adding the tag
input := &ec2.CreateTagsInput{
Resources: []*string{aws.String(id)},
Tags: tags,
}

eg.Go(func() error {
_, err := e.EC2.CreateTags(input)
if err != nil {
klog.Errorf("failed to create tags for resource id=%s", id, err)
return err
}
return nil
})
}

if err := eg.Wait(); err != nil {
Expand Down

0 comments on commit 4da5228

Please sign in to comment.