Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.
Merged
22 changes: 22 additions & 0 deletions cmd/deploy.go
Original file line number Diff line number Diff line change
@@ -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)
}
22 changes: 22 additions & 0 deletions cmd/destroy.go
Original file line number Diff line number Diff line change
@@ -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)
}
22 changes: 22 additions & 0 deletions cmd/restart.go
Original file line number Diff line number Diff line change
@@ -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)
}
1 change: 1 addition & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:"})
}
27 changes: 27 additions & 0 deletions cmd/scale.go
Original file line number Diff line number Diff line change
@@ -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)
}
26 changes: 26 additions & 0 deletions cmd/status.go
Original file line number Diff line number Diff line change
@@ -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)
}
26 changes: 26 additions & 0 deletions pkg/deployment/deployment.go
Original file line number Diff line number Diff line change
@@ -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
}