diff --git a/cmd/deploy.go b/cmd/deploy.go new file mode 100644 index 0000000..e35943a --- /dev/null +++ b/cmd/deploy.go @@ -0,0 +1,22 @@ +package cmd + +import ( + "fmt" + + "github.com/paastech-cloud/cli/pkg/deployment" + "github.com/spf13/cobra" +) + +var deployCmd = &cobra.Command{ + GroupID: "deployment", + Use: "deploy", + Short: "Deploy a project", + RunE: func(cmd *cobra.Command, args []string) error { + fmt.Print("Deploying project") + return deployment.Deploy() + }, +} + +func init() { + rootCmd.AddCommand(deployCmd) +} diff --git a/cmd/destroy.go b/cmd/destroy.go new file mode 100644 index 0000000..e7486f5 --- /dev/null +++ b/cmd/destroy.go @@ -0,0 +1,22 @@ +package cmd + +import ( + "fmt" + + "github.com/paastech-cloud/cli/pkg/deployment" + "github.com/spf13/cobra" +) + +var destroyCmd = &cobra.Command{ + GroupID: "deployment", + Use: "destroy", + Short: "Destroy a deployment", + RunE: func(cmd *cobra.Command, args []string) error { + fmt.Print("Destroying deployment") + return deployment.Destroy() + }, +} + +func init() { + rootCmd.AddCommand(destroyCmd) +} diff --git a/cmd/restart.go b/cmd/restart.go new file mode 100644 index 0000000..ae71a58 --- /dev/null +++ b/cmd/restart.go @@ -0,0 +1,22 @@ +package cmd + +import ( + "fmt" + + "github.com/paastech-cloud/cli/pkg/deployment" + "github.com/spf13/cobra" +) + +var restartCmd = &cobra.Command{ + GroupID: "deployment", + Use: "restart", + Short: "Restart a deployment", + RunE: func(cmd *cobra.Command, args []string) error { + fmt.Print("Restarting deployment") + return deployment.Restart() + }, +} + +func init() { + rootCmd.AddCommand(restartCmd) +} diff --git a/cmd/root.go b/cmd/root.go index ac273bc..a49777e 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -28,4 +28,5 @@ func Execute() { func init() { rootCmd.AddGroup(&cobra.Group{ID: "account", Title: "Account Commands:"}) rootCmd.AddGroup(&cobra.Group{ID: "project", Title: "Project Commands:"}) + rootCmd.AddGroup(&cobra.Group{ID: "deployment", Title: "Deployment Commands:"}) } diff --git a/cmd/scale.go b/cmd/scale.go new file mode 100644 index 0000000..42784cd --- /dev/null +++ b/cmd/scale.go @@ -0,0 +1,27 @@ +package cmd + +import ( + "errors" + "strconv" + + "github.com/paastech-cloud/cli/pkg/deployment" + "github.com/spf13/cobra" +) + +var scaleCmd = &cobra.Command{ + GroupID: "deployment", + Use: "scale [number]", + Short: "Scale a project deployment", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + replicas, err := strconv.Atoi(args[0]) + if err != nil { + return errors.New("not a correct number") + } + return deployment.Scale(replicas) + }, +} + +func init() { + rootCmd.AddCommand(scaleCmd) +} diff --git a/cmd/status.go b/cmd/status.go new file mode 100644 index 0000000..adff1c9 --- /dev/null +++ b/cmd/status.go @@ -0,0 +1,26 @@ +package cmd + +import ( + "fmt" + + "github.com/paastech-cloud/cli/pkg/deployment" + "github.com/spf13/cobra" +) + +var statusCmd = &cobra.Command{ + GroupID: "deployment", + Use: "status", + Short: "List deployments for current project", + RunE: func(cmd *cobra.Command, args []string) error { + status, err := deployment.Status() + if err != nil { + return err + } + fmt.Print(status) + return nil + }, +} + +func init() { + rootCmd.AddCommand(statusCmd) +} diff --git a/pkg/deployment/deployment.go b/pkg/deployment/deployment.go new file mode 100644 index 0000000..146c8db --- /dev/null +++ b/pkg/deployment/deployment.go @@ -0,0 +1,26 @@ +package deployment + +func Deploy() error { + // TODO: to implement + return nil +} + +func Status() (string, error) { + // TODO: to implement + return "", nil +} + +func Destroy() error { + // TODO: to implement + return nil +} + +func Restart() error { + // TODO: to implement + return nil +} + +func Scale(replicas int) error { + // TODO: to implement + return nil +}