|
@@ -2,6 +2,7 @@ package backend
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
"context"
|
|
"context"
|
|
|
|
|
+ "fmt"
|
|
|
|
|
|
|
|
"github.com/docker/ecs-plugin/pkg/docker"
|
|
"github.com/docker/ecs-plugin/pkg/docker"
|
|
|
)
|
|
)
|
|
@@ -12,13 +13,21 @@ const (
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
func (b *Backend) CreateContextData(ctx context.Context, params map[string]string) (contextData interface{}, description string, err error) {
|
|
func (b *Backend) CreateContextData(ctx context.Context, params map[string]string) (contextData interface{}, description string, err error) {
|
|
|
- err = b.api.CheckRequirements(ctx)
|
|
|
|
|
|
|
+ region, ok := params[ContextParamRegion]
|
|
|
|
|
+ if !ok {
|
|
|
|
|
+ return nil, "", fmt.Errorf("%q parameter is required", ContextParamRegion)
|
|
|
|
|
+ }
|
|
|
|
|
+ profile, ok := params[ContextParamProfile]
|
|
|
|
|
+ if !ok {
|
|
|
|
|
+ return nil, "", fmt.Errorf("%q parameter is required", ContextParamProfile)
|
|
|
|
|
+ }
|
|
|
|
|
+ err = b.api.CheckRequirements(ctx, region)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return "", "", err
|
|
return "", "", err
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return docker.AwsContext{
|
|
return docker.AwsContext{
|
|
|
- Profile: params[ContextParamProfile],
|
|
|
|
|
- Region: params[ContextParamRegion],
|
|
|
|
|
|
|
+ Profile: profile,
|
|
|
|
|
+ Region: region,
|
|
|
}, "Amazon ECS context", nil
|
|
}, "Amazon ECS context", nil
|
|
|
}
|
|
}
|