Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2020-04-27 09:46:13 +02:00 committed by Nicolas De loof
parent 52c6177ff7
commit 3d8d982d4a
4 changed files with 18 additions and 17 deletions

View File

@ -30,7 +30,7 @@ func NewClient(profile string, cluster string, region string) (compose.API, erro
type client struct { type client struct {
Cluster string Cluster string
Region string Region string
api API api API
} }
var _ compose.API = &client{} var _ compose.API = &client{}

View File

@ -82,6 +82,7 @@ func (c client) Convert(project *compose.Project, loadBalancerArn *string) (*clo
} }
const ECSTaskExecutionPolicy = "arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy" const ECSTaskExecutionPolicy = "arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy"
var defaultTaskExecutionRole string var defaultTaskExecutionRole string
// GetEcsTaskExecutionRole retrieve the role ARN to apply for task execution // GetEcsTaskExecutionRole retrieve the role ARN to apply for task execution
@ -111,4 +112,4 @@ func (c client) GetEcsTaskExecutionRole(spec types.ServiceConfig) (string, error
} }
defaultTaskExecutionRole = arn defaultTaskExecutionRole = arn
return arn, nil return arn, nil
} }

View File

@ -42,4 +42,4 @@ func Test_down_delete_cluster(t *testing.T) {
c.ComposeDown(&compose.Project{ c.ComposeDown(&compose.Project{
Name: "test_project", Name: "test_project",
}, false, true) }, false, true)
} }

View File

@ -21,23 +21,23 @@ import (
) )
type sdk struct { type sdk struct {
sess *session.Session sess *session.Session
ECS ecsiface.ECSAPI ECS ecsiface.ECSAPI
EC2 ec2iface.EC2API EC2 ec2iface.EC2API
ELB elbv2iface.ELBV2API ELB elbv2iface.ELBV2API
CW cloudwatchlogsiface.CloudWatchLogsAPI CW cloudwatchlogsiface.CloudWatchLogsAPI
IAM iamiface.IAMAPI IAM iamiface.IAMAPI
CF cloudformationiface.CloudFormationAPI CF cloudformationiface.CloudFormationAPI
} }
func NewAPI(sess *session.Session) API { func NewAPI(sess *session.Session) API {
return sdk{ return sdk{
ECS: ecs.New(sess), ECS: ecs.New(sess),
EC2: ec2.New(sess), EC2: ec2.New(sess),
ELB: elbv2.New(sess), ELB: elbv2.New(sess),
CW: cloudwatchlogs.New(sess), CW: cloudwatchlogs.New(sess),
IAM: iam.New(sess), IAM: iam.New(sess),
CF: cloudformation.New(sess), CF: cloudformation.New(sess),
} }
} }
@ -99,7 +99,7 @@ func (s sdk) GetSubNets(vpc string) ([]string, error) {
Filters: []*ec2.Filter{ Filters: []*ec2.Filter{
{ {
Name: aws.String("vpc-id"), Name: aws.String("vpc-id"),
Values: []*string{ aws.String(vpc)}, Values: []*string{aws.String(vpc)},
}, },
{ {
Name: aws.String("default-for-az"), Name: aws.String("default-for-az"),