2020-04-14 08:40:52 +02:00
|
|
|
package amazon
|
|
|
|
|
2020-04-14 17:44:00 +02:00
|
|
|
import (
|
|
|
|
"github.com/aws/aws-sdk-go/aws"
|
|
|
|
"github.com/aws/aws-sdk-go/aws/session"
|
|
|
|
"github.com/docker/ecs-plugin/pkg/compose"
|
|
|
|
)
|
2020-04-14 08:40:52 +02:00
|
|
|
|
2020-04-14 17:44:00 +02:00
|
|
|
|
|
|
|
const (
|
|
|
|
ProjectTag = "com.docker.compose.project"
|
|
|
|
)
|
|
|
|
|
|
|
|
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,
|
|
|
|
sess: sess,
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type client struct {
|
|
|
|
Cluster string
|
|
|
|
Region string
|
2020-04-14 08:40:52 +02:00
|
|
|
sess *session.Session
|
|
|
|
}
|
2020-04-14 17:44:00 +02:00
|
|
|
|
|
|
|
var _ compose.API = &client{}
|