Add controller API client interface (#1467)

This PR adds an interface for controller API client, it allows us to
implement mock API client for unit testing with ease and we are
able to generate spec file without accessing the real Fission server.
This commit is contained in:
Ta-Ching Chen
2019-12-16 23:14:14 +08:00
committed by GitHub
parent 01bdc5bf89
commit bfbb80efcf
71 changed files with 1021 additions and 1025 deletions
+3 -10
View File
@@ -26,27 +26,20 @@ import (
"github.com/pkg/errors"
uuid "github.com/satori/go.uuid"
"github.com/fission/fission/pkg/controller/client"
"github.com/fission/fission/pkg/fission-cli/cliwrapper/cli"
"github.com/fission/fission/pkg/fission-cli/cmd"
spectypes "github.com/fission/fission/pkg/fission-cli/cmd/spec/types"
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
"github.com/fission/fission/pkg/fission-cli/util"
)
type InitSubCommand struct {
client *client.Client
cmd.CommandActioner
deployConfig *spectypes.DeploymentConfig
}
func Init(input cli.Input) error {
c, err := util.GetServer(input)
if err != nil {
return err
}
opts := InitSubCommand{
client: c,
}
return opts.do(input)
return (&InitSubCommand{}).do(input)
}
func (opts *InitSubCommand) do(input cli.Input) error {