mirror of https://github.com/docker/compose.git
rename packages ( amazon to ecs and azure to aci )
Signed-off-by: aiordache <anca.iordache@docker.com>
This commit is contained in:
parent
2471e51b39
commit
87245ef727
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch",
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "auto",
|
||||
"program": "${workspaceRoot}/cli/main.go",
|
||||
"env": {},
|
||||
"cwd": "${workspaceRoot}/test/",
|
||||
//"args": ["context", "create", "aws", "ecs", --profile", "sandbox.devtools.developer", "--region", "eu-west-3", "--description", "My ECS account"]
|
||||
"args":["compose", "up"]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -14,7 +14,7 @@
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package azure
|
||||
package aci
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
@ -33,8 +33,8 @@ import (
|
|||
"github.com/morikuni/aec"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/docker/api/azure/convert"
|
||||
"github.com/docker/api/azure/login"
|
||||
"github.com/docker/api/aci/convert"
|
||||
"github.com/docker/api/aci/login"
|
||||
"github.com/docker/api/containers"
|
||||
"github.com/docker/api/context/store"
|
||||
"github.com/docker/api/progress"
|
|
@ -1,4 +1,4 @@
|
|||
package azure
|
||||
package aci
|
||||
|
||||
import (
|
||||
"testing"
|
|
@ -14,7 +14,7 @@
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package azure
|
||||
package aci
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
@ -30,8 +30,8 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/docker/api/azure/convert"
|
||||
"github.com/docker/api/azure/login"
|
||||
"github.com/docker/api/aci/convert"
|
||||
"github.com/docker/api/aci/login"
|
||||
"github.com/docker/api/backend"
|
||||
"github.com/docker/api/compose"
|
||||
"github.com/docker/api/containers"
|
||||
|
@ -41,6 +41,8 @@ import (
|
|||
"github.com/docker/api/errdefs"
|
||||
)
|
||||
|
||||
const backendType = store.AciContextType
|
||||
|
||||
const (
|
||||
singleContainerTag = "docker-single-container"
|
||||
composeContainerTag = "docker-compose-application"
|
||||
|
@ -65,7 +67,7 @@ type LoginParams struct {
|
|||
}
|
||||
|
||||
func init() {
|
||||
backend.Register("aci", "aci", service, getCloudService)
|
||||
backend.Register(backendType, backendType, service, getCloudService)
|
||||
}
|
||||
|
||||
func service(ctx context.Context) (backend.Service, error) {
|
|
@ -14,7 +14,7 @@
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package azure
|
||||
package aci
|
||||
|
||||
import (
|
||||
"context"
|
|
@ -14,7 +14,7 @@
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package azure
|
||||
package aci
|
||||
|
||||
import (
|
||||
"context"
|
|
@ -14,7 +14,7 @@
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package azure
|
||||
package aci
|
||||
|
||||
import (
|
||||
"context"
|
|
@ -14,7 +14,7 @@
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package azure
|
||||
package aci
|
||||
|
||||
import (
|
||||
"context"
|
|
@ -1 +0,0 @@
|
|||
package amazon
|
|
@ -76,7 +76,6 @@ $ docker context create my-context --description "some description" --docker "ho
|
|||
}
|
||||
|
||||
cmd.AddCommand(
|
||||
createAciCommand(),
|
||||
createLocalCommand(),
|
||||
createExampleCommand(),
|
||||
)
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/docker/api/azure"
|
||||
"github.com/docker/api/aci"
|
||||
"github.com/docker/api/client"
|
||||
"github.com/docker/api/context/store"
|
||||
"github.com/docker/api/errdefs"
|
||||
|
@ -38,7 +38,7 @@ $ docker context create aci CONTEXT [flags]
|
|||
}
|
||||
|
||||
func createAciCommand() *cobra.Command {
|
||||
var opts azure.ContextParams
|
||||
var opts aci.ContextParams
|
||||
cmd := &cobra.Command{
|
||||
Use: "aci CONTEXT [flags]",
|
||||
Short: "Create a context for Azure Container Instances",
|
||||
|
@ -56,7 +56,7 @@ func createAciCommand() *cobra.Command {
|
|||
return cmd
|
||||
}
|
||||
|
||||
func runCreateAci(ctx context.Context, contextName string, opts azure.ContextParams) error {
|
||||
func runCreateAci(ctx context.Context, contextName string, opts aci.ContextParams) error {
|
||||
if contextExists(ctx, contextName) {
|
||||
return errors.Wrapf(errdefs.ErrAlreadyExists, "context %s", contextName)
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ func runCreateAci(ctx context.Context, contextName string, opts azure.ContextPar
|
|||
|
||||
}
|
||||
|
||||
func getAciContextData(ctx context.Context, opts azure.ContextParams) (interface{}, string, error) {
|
||||
func getAciContextData(ctx context.Context, opts aci.ContextParams) (interface{}, string, error) {
|
||||
cs, err := client.GetCloudService(ctx, store.AciContextType)
|
||||
if err != nil {
|
||||
return nil, "", errors.Wrap(err, "cannot connect to ACI backend")
|
|
@ -24,9 +24,9 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/docker/api/amazon"
|
||||
"github.com/docker/api/client"
|
||||
"github.com/docker/api/context/store"
|
||||
"github.com/docker/api/ecs"
|
||||
"github.com/docker/api/errdefs"
|
||||
)
|
||||
|
||||
|
@ -40,7 +40,7 @@ $ docker context create ecs CONTEXT [flags]
|
|||
}
|
||||
|
||||
func createEcsCommand() *cobra.Command {
|
||||
var opts amazon.ContextParams
|
||||
var opts ecs.ContextParams
|
||||
cmd := &cobra.Command{
|
||||
Use: "ecs CONTEXT [flags]",
|
||||
Short: "Create a context for Amazon ECS",
|
||||
|
@ -58,9 +58,9 @@ func createEcsCommand() *cobra.Command {
|
|||
return cmd
|
||||
}
|
||||
|
||||
func runCreateEcs(ctx context.Context, contextName string, opts amazon.ContextParams) error {
|
||||
func runCreateEcs(ctx context.Context, contextName string, opts ecs.ContextParams) error {
|
||||
if contextExists(ctx, contextName) {
|
||||
return errors.Wrapf(errdefs.ErrAlreadyExists, "context %s", contextName)
|
||||
return errors.Wrapf(errdefs.ErrAlreadyExists, "context %q", contextName)
|
||||
}
|
||||
contextData, description, err := getEcsContextData(ctx, opts)
|
||||
if err != nil {
|
||||
|
@ -70,7 +70,7 @@ func runCreateEcs(ctx context.Context, contextName string, opts amazon.ContextPa
|
|||
|
||||
}
|
||||
|
||||
func getEcsContextData(ctx context.Context, opts amazon.ContextParams) (interface{}, string, error) {
|
||||
func getEcsContextData(ctx context.Context, opts ecs.ContextParams) (interface{}, string, error) {
|
||||
cs, err := client.GetCloudService(ctx, store.EcsContextType)
|
||||
if err != nil {
|
||||
return nil, "", errors.Wrap(err, "cannot connect to AWS backend")
|
|
@ -3,12 +3,12 @@ package login
|
|||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/docker/api/azure"
|
||||
"github.com/docker/api/aci"
|
||||
)
|
||||
|
||||
// AzureLoginCommand returns the azure login command
|
||||
func AzureLoginCommand() *cobra.Command {
|
||||
opts := azure.LoginParams{}
|
||||
opts := aci.LoginParams{}
|
||||
cmd := &cobra.Command{
|
||||
Use: "azure",
|
||||
Short: "Log in to azure",
|
||||
|
|
|
@ -36,8 +36,8 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
|
||||
// Backend registrations
|
||||
_ "github.com/docker/api/amazon"
|
||||
_ "github.com/docker/api/azure"
|
||||
_ "github.com/docker/api/aci"
|
||||
_ "github.com/docker/api/ecs"
|
||||
_ "github.com/docker/api/example"
|
||||
_ "github.com/docker/api/local"
|
||||
"github.com/docker/api/metrics"
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
// +build !ecs
|
||||
|
||||
package mobycli
|
||||
|
||||
import "github.com/docker/api/context/store"
|
||||
|
||||
func init() {
|
||||
delegatedContextTypes = append(delegatedContextTypes, store.AwsContextType, store.EcsContextType)
|
||||
}
|
|
@ -29,6 +29,8 @@ import (
|
|||
"github.com/docker/api/context/store"
|
||||
)
|
||||
|
||||
var delegatedContextTypes = []string{store.DefaultContextType}
|
||||
|
||||
// ComDockerCli name of the classic cli binary
|
||||
const ComDockerCli = "com.docker.cli"
|
||||
|
||||
|
@ -46,7 +48,12 @@ func ExecIfDefaultCtxType(ctx context.Context) {
|
|||
}
|
||||
|
||||
func mustDelegateToMoby(ctxType string) bool {
|
||||
return ctxType == store.DefaultContextType
|
||||
for _, ctype := range delegatedContextTypes {
|
||||
if ctxType == ctype {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Exec delegates to com.docker.cli if on moby context
|
||||
|
|
|
@ -55,6 +55,9 @@ type EcsContext struct {
|
|||
Region string `json:",omitempty"`
|
||||
}
|
||||
|
||||
// AwsContext is the context for the ecs plugin
|
||||
type AwsContext EcsContext
|
||||
|
||||
// LocalContext is the context for the local backend
|
||||
type LocalContext struct{}
|
||||
|
||||
|
|
|
@ -36,7 +36,13 @@ const (
|
|||
DefaultContextName = "default"
|
||||
// DefaultContextType is the type for all moby contexts (not associated with cli backend)
|
||||
DefaultContextType = "moby"
|
||||
// EcsContextType is the type for ecs contexts (currently a CLI plugin, not associated with cli backend)
|
||||
|
||||
// AwsContextType is the type for aws contexts (currently a CLI plugin, not associated with cli backend)
|
||||
// to be removed with the cli plugin
|
||||
AwsContextType = "aws"
|
||||
|
||||
// EcsContextType is the endpoint key in the context endpoints for an ECS
|
||||
// backend
|
||||
EcsContextType = "ecs"
|
||||
// AciContextType is the endpoint key in the context endpoints for an ACI
|
||||
// backend
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package amazon
|
||||
package ecs
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
@ -25,7 +25,7 @@ import (
|
|||
"github.com/docker/api/context/cloud"
|
||||
"github.com/docker/api/context/store"
|
||||
"github.com/docker/api/errdefs"
|
||||
ecs "github.com/docker/ecs-plugin/pkg/amazon/backend"
|
||||
ecsplugin "github.com/docker/ecs-plugin/pkg/amazon/backend"
|
||||
)
|
||||
|
||||
const backendType = store.EcsContextType
|
||||
|
@ -57,7 +57,7 @@ func service(ctx context.Context) (backend.Service, error) {
|
|||
}
|
||||
|
||||
func getEcsAPIService(ecsCtx store.EcsContext) (*ecsAPIService, error) {
|
||||
backend, err := ecs.NewBackend(ecsCtx.Profile, ecsCtx.Region)
|
||||
backend, err := ecsplugin.NewBackend(ecsCtx.Profile, ecsCtx.Region)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ func getEcsAPIService(ecsCtx store.EcsContext) (*ecsAPIService, error) {
|
|||
|
||||
type ecsAPIService struct {
|
||||
ctx store.EcsContext
|
||||
composeBackend *ecs.Backend
|
||||
composeBackend *ecsplugin.Backend
|
||||
}
|
||||
|
||||
func (a *ecsAPIService) ContainerService() containers.Service {
|
|
@ -13,7 +13,7 @@
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package amazon
|
||||
package ecs
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
@ -26,9 +26,10 @@ import (
|
|||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
"github.com/aws/aws-sdk-go/aws/credentials"
|
||||
"github.com/aws/aws-sdk-go/aws/defaults"
|
||||
"gopkg.in/ini.v1"
|
||||
|
||||
"github.com/docker/api/context/store"
|
||||
"github.com/docker/api/prompt"
|
||||
"gopkg.in/ini.v1"
|
||||
)
|
||||
|
||||
type contextCreateAWSHelper struct {
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
Copyright 2020 Docker, Inc.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package ecs
|
|
@ -1,3 +1,16 @@
|
|||
/*
|
||||
Copyright 2020 Docker, Inc.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package prompt
|
||||
|
||||
import (
|
||||
|
|
|
@ -37,8 +37,8 @@ import (
|
|||
log "github.com/sirupsen/logrus"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/docker/api/azure"
|
||||
"github.com/docker/api/azure/login"
|
||||
azure "github.com/docker/api/aci"
|
||||
"github.com/docker/api/aci/login"
|
||||
"github.com/docker/api/context/store"
|
||||
"github.com/docker/api/tests/aci-e2e/storage"
|
||||
. "github.com/docker/api/tests/framework"
|
||||
|
|
|
@ -24,7 +24,7 @@ import (
|
|||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/to"
|
||||
|
||||
"github.com/docker/api/azure/login"
|
||||
"github.com/docker/api/aci/login"
|
||||
"github.com/docker/api/context/store"
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue