Skip to content

Commit

Permalink
fix after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
tinnywang committed Dec 10, 2024
1 parent f714ca0 commit 1c2d4b8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions ecs-agent/ec2/ec2_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/aws/aws-sdk-go-v2/config"
ec2sdk "github.com/aws/aws-sdk-go-v2/service/ec2"
"github.com/aws/aws-sdk-go-v2/service/ec2/types"
ecstypes "github.com/aws/aws-sdk-go-v2/service/ecs/types"
)

const (
Expand All @@ -41,7 +42,7 @@ const (

type Client interface {
CreateTags(input *ec2sdk.CreateTagsInput) (*ec2sdk.CreateTagsOutput, error)
DescribeECSTagsForInstance(instanceID string) ([]types.Tag, error)
DescribeECSTagsForInstance(instanceID string) ([]ecstypes.Tag, error)
}

type ClientSDK interface {
Expand Down Expand Up @@ -82,7 +83,7 @@ func (c *ClientImpl) SetClientSDK(sdk ClientSDK) {

// DescribeECSTagsForInstance calls DescribeTags API to get the EC2 tags of the
// instance id, and return it back as ECS tags
func (c *ClientImpl) DescribeECSTagsForInstance(instanceID string) ([]types.Tag, error) {
func (c *ClientImpl) DescribeECSTagsForInstance(instanceID string) ([]ecstypes.Tag, error) {
describeTagsInput := ec2sdk.DescribeTagsInput{
Filters: []types.Filter{
{
Expand All @@ -103,13 +104,13 @@ func (c *ClientImpl) DescribeECSTagsForInstance(instanceID string) ([]types.Tag,
return nil, err
}

var tags []types.Tag
var tags []ecstypes.Tag
// Convert ec2 tags to ecs tags
for _, ec2Tag := range res.Tags {
// Filter out all tags "aws:" prefix
if !strings.HasPrefix(strings.ToLower(aws.ToString(ec2Tag.Key)), awsTagPrefix) &&
!strings.HasPrefix(strings.ToLower(aws.ToString(ec2Tag.Value)), awsTagPrefix) {
tags = append(tags, types.Tag{
tags = append(tags, ecstypes.Tag{
Key: ec2Tag.Key,
Value: ec2Tag.Value,
})
Expand Down
2 changes: 1 addition & 1 deletion ecs-agent/ec2/mocks/ec2_mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1c2d4b8

Please sign in to comment.