client.go 700 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package amazon
  2. import (
  3. "github.com/aws/aws-sdk-go/aws"
  4. "github.com/aws/aws-sdk-go/aws/session"
  5. "github.com/docker/ecs-plugin/pkg/compose"
  6. )
  7. const (
  8. ProjectTag = "com.docker.compose.project"
  9. NetworkTag = "com.docker.compose.network"
  10. )
  11. func NewClient(profile string, cluster string, region string) (compose.API, error) {
  12. sess, err := session.NewSessionWithOptions(session.Options{
  13. Profile: profile,
  14. Config: aws.Config{
  15. Region: aws.String(region),
  16. },
  17. })
  18. if err != nil {
  19. return nil, err
  20. }
  21. return &client{
  22. Cluster: cluster,
  23. Region: region,
  24. api: NewAPI(sess),
  25. }, nil
  26. }
  27. type client struct {
  28. Cluster string
  29. Region string
  30. api API
  31. }
  32. var _ compose.API = &client{}