compose/ecs/pkg/amazon/client.go
Nicolas De Loof 257f829679
Create service with project and service tags
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2020-08-17 21:25:57 +02:00

39 lines
743 B
Go

package amazon
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/docker/ecs-plugin/pkg/compose"
)
const (
ProjectTag = "com.docker.compose.project"
NetworkTag = "com.docker.compose.network"
ServiceTag = "com.docker.compose.service"
)
func NewClient(profile string, cluster string, region string) (compose.API, error) {
sess, err := session.NewSessionWithOptions(session.Options{
Profile: profile,
Config: aws.Config{
Region: aws.String(region),
},
})
if err != nil {
return nil, err
}
return &client{
Cluster: cluster,
Region: region,
api: NewAPI(sess),
}, nil
}
type client struct {
Cluster string
Region string
api API
}
var _ compose.API = &client{}