Skip to content

Commit

Permalink
Integrate ecs api interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
Richa Gangwar authored and RichaGangwar committed Oct 31, 2023
1 parent d082d4f commit 9bc4f08
Show file tree
Hide file tree
Showing 19 changed files with 741 additions and 341 deletions.
4 changes: 2 additions & 2 deletions agent/handlers/agentapi/taskprotection/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/aws/amazon-ecs-agent/agent/version"
"github.com/aws/amazon-ecs-agent/ecs-agent/httpclient"

"github.com/aws/amazon-ecs-agent/ecs-agent/api"
ecsapi "github.com/aws/amazon-ecs-agent/ecs-agent/api/ecs"
"github.com/aws/amazon-ecs-agent/ecs-agent/api/ecs/model/ecs"
"github.com/aws/amazon-ecs-agent/ecs-agent/credentials"

Expand All @@ -37,7 +37,7 @@ type TaskProtectionClientFactory struct {
// Helper function for retrieving credential from credentials manager and create ecs client
func (factory TaskProtectionClientFactory) NewTaskProtectionClient(
taskRoleCredential credentials.TaskIAMRoleCredentials,
) api.ECSTaskProtectionSDK {
) ecsapi.ECSTaskProtectionSDK {
taskCredential := taskRoleCredential.GetIAMRoleCredentials()
cfg := aws.NewConfig().
WithCredentials(awscreds.NewStaticCredentials(taskCredential.AccessKeyID,
Expand Down
4 changes: 2 additions & 2 deletions agent/handlers/agentapi/taskprotection/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package taskprotection
import (
"testing"

"github.com/aws/amazon-ecs-agent/ecs-agent/api"
"github.com/aws/amazon-ecs-agent/ecs-agent/api/ecs"
"github.com/aws/amazon-ecs-agent/ecs-agent/credentials"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -52,7 +52,7 @@ func TestGetECSClientHappyCase(t *testing.T) {
defer ctrl.Finish()

ret := factory.NewTaskProtectionClient(testIAMRoleCredentials)
_, ok := ret.(api.ECSTaskProtectionSDK)
_, ok := ret.(ecs.ECSTaskProtectionSDK)

// Assert response
assert.True(t, ok)
Expand Down
2 changes: 1 addition & 1 deletion agent/handlers/task_server_setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ import (
v3 "github.com/aws/amazon-ecs-agent/agent/handlers/v3"
mock_stats "github.com/aws/amazon-ecs-agent/agent/stats/mock"
apicontainerstatus "github.com/aws/amazon-ecs-agent/ecs-agent/api/container/status"
mock_taskprotection "github.com/aws/amazon-ecs-agent/ecs-agent/api/ecs/mocks"
"github.com/aws/amazon-ecs-agent/ecs-agent/api/ecs/model/ecs"
mock_taskprotection "github.com/aws/amazon-ecs-agent/ecs-agent/api/mocks"
apitaskstatus "github.com/aws/amazon-ecs-agent/ecs-agent/api/task/status"
"github.com/aws/amazon-ecs-agent/ecs-agent/credentials"
mock_credentials "github.com/aws/amazon-ecs-agent/ecs-agent/credentials/mocks"
Expand Down

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

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

Loading

0 comments on commit 9bc4f08

Please sign in to comment.