Skip to content

Commit

Permalink
Merge branch 'dash-consistency' into plan-cloud-server-create
Browse files Browse the repository at this point in the history
  • Loading branch information
dwburke committed Feb 28, 2020
2 parents c8985f9 + 11a72b7 commit c7e1113
Show file tree
Hide file tree
Showing 57 changed files with 263 additions and 265 deletions.
8 changes: 4 additions & 4 deletions cmd/cloudBackupDetails.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ import (

"github.com/spf13/cobra"

"github.com/liquidweb/liquidweb-cli/types/api"
apiTypes "github.com/liquidweb/liquidweb-cli/types/api"
)

var cloudBackupDetailsCmd = &cobra.Command{
Use: "details",
Short: "Get details of a Cloud Backup",
Long: `Get details of a Cloud Backup`,
Run: func(cmd *cobra.Command, args []string) {
backupIdFlag, _ := cmd.Flags().GetInt64("backup_id")
backupIdFlag, _ := cmd.Flags().GetInt64("backup-id")

apiArgs := map[string]interface{}{"id": backupIdFlag}

Expand All @@ -45,7 +45,7 @@ var cloudBackupDetailsCmd = &cobra.Command{
func init() {
cloudBackupCmd.AddCommand(cloudBackupDetailsCmd)

cloudBackupDetailsCmd.Flags().Int64("backup_id", -1,
cloudBackupDetailsCmd.Flags().Int64("backup-id", -1,
"id number of the backup (see 'cloud backup list')")
cloudBackupDetailsCmd.MarkFlagRequired("backup_id")
cloudBackupDetailsCmd.MarkFlagRequired("backup-id")
}
6 changes: 3 additions & 3 deletions cmd/cloudBackupList.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/spf13/cobra"

"github.com/liquidweb/liquidweb-cli/instance"
"github.com/liquidweb/liquidweb-cli/types/api"
apiTypes "github.com/liquidweb/liquidweb-cli/types/api"
"github.com/liquidweb/liquidweb-cli/validate"
)

Expand All @@ -32,7 +32,7 @@ var cloudBackupListCmd = &cobra.Command{
Long: `List Cloud Backups on your account`,
Run: func(cmd *cobra.Command, args []string) {
jsonFlag, _ := cmd.Flags().GetBool("json")
uniqIdFlag, _ := cmd.Flags().GetString("uniq_id")
uniqIdFlag, _ := cmd.Flags().GetString("uniq-id")

if uniqIdFlag != "" {
validateFields := map[interface{}]interface{}{
Expand Down Expand Up @@ -83,5 +83,5 @@ func init() {
cloudBackupCmd.AddCommand(cloudBackupListCmd)

cloudBackupListCmd.Flags().Bool("json", false, "output in json format")
cloudBackupListCmd.Flags().String("uniq_id", "", "only fetch backups made from this uniq_id")
cloudBackupListCmd.Flags().String("uniq-id", "", "only fetch backups made from this uniq-id")
}
16 changes: 8 additions & 8 deletions cmd/cloudBackupRestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"github.com/spf13/cobra"

"github.com/liquidweb/liquidweb-cli/types/api"
apiTypes "github.com/liquidweb/liquidweb-cli/types/api"
"github.com/liquidweb/liquidweb-cli/validate"
)

Expand All @@ -29,9 +29,9 @@ var cloudBackupRestoreCmd = &cobra.Command{
Short: "Restore a Cloud Backup on a Cloud Server",
Long: `Restore a Cloud Backup on a Cloud Server.`,
Run: func(cmd *cobra.Command, args []string) {
uniqIdFlag, _ := cmd.Flags().GetString("uniq_id")
uniqIdFlag, _ := cmd.Flags().GetString("uniq-id")
rebuildFsFlag, _ := cmd.Flags().GetBool("rebuild-fs")
backupIdFlag, _ := cmd.Flags().GetInt64("backup_id")
backupIdFlag, _ := cmd.Flags().GetInt64("backup-id")

validateFields := map[interface{}]interface{}{
uniqIdFlag: "UniqId",
Expand All @@ -53,17 +53,17 @@ var cloudBackupRestoreCmd = &cobra.Command{
}

fmt.Printf("Restoring backup! %+v\n", details)
fmt.Printf("\tcheck progress with 'cloud server status --uniq_id %s'\n", uniqIdFlag)
fmt.Printf("\tcheck progress with 'cloud server status --uniq-id %s'\n", uniqIdFlag)
},
}

func init() {
cloudBackupCmd.AddCommand(cloudBackupRestoreCmd)

cloudBackupRestoreCmd.Flags().String("uniq_id", "", "uniq_id of Cloud Server")
cloudBackupRestoreCmd.Flags().Int64("backup_id", -1, "id of the Cloud Backup")
cloudBackupRestoreCmd.Flags().String("uniq-id", "", "uniq-id of Cloud Server")
cloudBackupRestoreCmd.Flags().Int64("backup-id", -1, "id of the Cloud Backup")
cloudBackupRestoreCmd.Flags().Bool("rebuild-fs", false, "rebuild filesystem before restoring")

cloudBackupRestoreCmd.MarkFlagRequired("uniq_id")
cloudBackupRestoreCmd.MarkFlagRequired("backup_id")
cloudBackupRestoreCmd.MarkFlagRequired("uniq-id")
cloudBackupRestoreCmd.MarkFlagRequired("backup-id")
}
8 changes: 4 additions & 4 deletions cmd/cloudImageCreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"github.com/spf13/cobra"

"github.com/liquidweb/liquidweb-cli/types/api"
apiTypes "github.com/liquidweb/liquidweb-cli/types/api"
"github.com/liquidweb/liquidweb-cli/validate"
)

Expand All @@ -29,7 +29,7 @@ var cloudImageCreateCmd = &cobra.Command{
Short: "Create a Cloud Image",
Long: `Create a Cloud Image.`,
Run: func(cmd *cobra.Command, args []string) {
uniqIdFlag, _ := cmd.Flags().GetString("uniq_id")
uniqIdFlag, _ := cmd.Flags().GetString("uniq-id")
nameFlag, _ := cmd.Flags().GetString("name")

validateFields := map[interface{}]interface{}{
Expand All @@ -56,9 +56,9 @@ var cloudImageCreateCmd = &cobra.Command{
func init() {
cloudImageCmd.AddCommand(cloudImageCreateCmd)

cloudImageCreateCmd.Flags().String("uniq_id", "", "uniq_id of Cloud Server")
cloudImageCreateCmd.Flags().String("uniq-id", "", "uniq-id of Cloud Server")
cloudImageCreateCmd.Flags().String("name", "", "name for the Cloud Image")

cloudImageCreateCmd.MarkFlagRequired("uniq_id")
cloudImageCreateCmd.MarkFlagRequired("uniq-id")
cloudImageCreateCmd.MarkFlagRequired("name")
}
8 changes: 4 additions & 4 deletions cmd/cloudImageDelete.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ import (

"github.com/spf13/cobra"

"github.com/liquidweb/liquidweb-cli/types/api"
apiTypes "github.com/liquidweb/liquidweb-cli/types/api"
)

var cloudImageDeleteCmd = &cobra.Command{
Use: "delete",
Short: "Delete a Cloud Image",
Long: `Delete a Cloud Image`,
Run: func(cmd *cobra.Command, args []string) {
imageIdFlag, _ := cmd.Flags().GetInt64("image_id")
imageIdFlag, _ := cmd.Flags().GetInt64("image-id")
forceFlag, _ := cmd.Flags().GetBool("force")

// if force flag wasn't passed
Expand All @@ -55,8 +55,8 @@ var cloudImageDeleteCmd = &cobra.Command{
func init() {
cloudImageCmd.AddCommand(cloudImageDeleteCmd)

cloudImageDeleteCmd.Flags().Int64("image_id", -1,
cloudImageDeleteCmd.Flags().Int64("image-id", -1,
"id number of the image (see 'cloud image list')")
cloudImageDeleteCmd.Flags().Bool("force", false, "bypass dialog confirmation")
cloudImageDeleteCmd.MarkFlagRequired("image_id")
cloudImageDeleteCmd.MarkFlagRequired("image-id")
}
8 changes: 4 additions & 4 deletions cmd/cloudImageDetails.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ import (

"github.com/spf13/cobra"

"github.com/liquidweb/liquidweb-cli/types/api"
apiTypes "github.com/liquidweb/liquidweb-cli/types/api"
)

var cloudImageDetailsCmd = &cobra.Command{
Use: "details",
Short: "Get details of a Cloud Image",
Long: `Get details of a Cloud Image`,
Run: func(cmd *cobra.Command, args []string) {
imageIdFlag, _ := cmd.Flags().GetInt64("image_id")
imageIdFlag, _ := cmd.Flags().GetInt64("image-id")

apiArgs := map[string]interface{}{"id": imageIdFlag}

Expand All @@ -45,7 +45,7 @@ var cloudImageDetailsCmd = &cobra.Command{
func init() {
cloudImageCmd.AddCommand(cloudImageDetailsCmd)

cloudImageDetailsCmd.Flags().Int64("image_id", -1,
cloudImageDetailsCmd.Flags().Int64("image-id", -1,
"id number of the image (see 'cloud image list')")
cloudImageDetailsCmd.MarkFlagRequired("image_id")
cloudImageDetailsCmd.MarkFlagRequired("image-id")
}
9 changes: 4 additions & 5 deletions cmd/cloudImageRename.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@ package cmd
import (
"fmt"

apiTypes "github.com/liquidweb/liquidweb-cli/types/api"
"github.com/spf13/cobra"

"github.com/liquidweb/liquidweb-cli/types/api"
)

var cloudImageRenameCmd = &cobra.Command{
Use: "rename",
Short: "Renames a Cloud Image",
Long: `Renames a Cloud Image.`,
Run: func(cmd *cobra.Command, args []string) {
imageIdFlag, _ := cmd.Flags().GetInt64("image_id")
imageIdFlag, _ := cmd.Flags().GetInt64("image-id")
nameFlag, _ := cmd.Flags().GetString("name")

apiArgs := map[string]interface{}{"id": imageIdFlag, "name": nameFlag}
Expand All @@ -46,10 +45,10 @@ var cloudImageRenameCmd = &cobra.Command{
func init() {
cloudImageCmd.AddCommand(cloudImageRenameCmd)

cloudImageRenameCmd.Flags().Int64("image_id", -1,
cloudImageRenameCmd.Flags().Int64("image-id", -1,
"id number of the image (see 'cloud image list')")
cloudImageRenameCmd.Flags().String("name", "", "new name for the Cloud Image")

cloudImageRenameCmd.MarkFlagRequired("image_id")
cloudImageRenameCmd.MarkFlagRequired("image-id")
cloudImageRenameCmd.MarkFlagRequired("name")
}
16 changes: 8 additions & 8 deletions cmd/cloudImageRestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"github.com/spf13/cobra"

"github.com/liquidweb/liquidweb-cli/types/api"
apiTypes "github.com/liquidweb/liquidweb-cli/types/api"
"github.com/liquidweb/liquidweb-cli/validate"
)

Expand All @@ -29,9 +29,9 @@ var cloudImageRestoreCmd = &cobra.Command{
Short: "Restore a Cloud Image on a Cloud Server",
Long: `Restore a Cloud Image on a Cloud Server.`,
Run: func(cmd *cobra.Command, args []string) {
uniqIdFlag, _ := cmd.Flags().GetString("uniq_id")
uniqIdFlag, _ := cmd.Flags().GetString("uniq-id")
rebuildFsFlag, _ := cmd.Flags().GetBool("rebuild-fs")
imageIdFlag, _ := cmd.Flags().GetInt64("image_id")
imageIdFlag, _ := cmd.Flags().GetInt64("image-id")

validateFields := map[interface{}]interface{}{
uniqIdFlag: "UniqId",
Expand All @@ -53,17 +53,17 @@ var cloudImageRestoreCmd = &cobra.Command{
}

fmt.Printf("Restoring image! %+v\n", details)
fmt.Printf("\tcheck progress with 'cloud server status --uniq_id %s'\n", uniqIdFlag)
fmt.Printf("\tcheck progress with 'cloud server status --uniq-id %s'\n", uniqIdFlag)
},
}

func init() {
cloudImageCmd.AddCommand(cloudImageRestoreCmd)

cloudImageRestoreCmd.Flags().String("uniq_id", "", "uniq_id of Cloud Server")
cloudImageRestoreCmd.Flags().Int64("image_id", -1, "id of the Cloud Image")
cloudImageRestoreCmd.Flags().String("uniq-id", "", "uniq-id of Cloud Server")
cloudImageRestoreCmd.Flags().Int64("image-id", -1, "id of the Cloud Image")
cloudImageRestoreCmd.Flags().Bool("rebuild-fs", false, "rebuild filesystem before restoring")

cloudImageRestoreCmd.MarkFlagRequired("uniq_id")
cloudImageRestoreCmd.MarkFlagRequired("image_id")
cloudImageRestoreCmd.MarkFlagRequired("uniq-id")
cloudImageRestoreCmd.MarkFlagRequired("image-id")
}
10 changes: 5 additions & 5 deletions cmd/cloudNetworkPrivateAttach.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"github.com/spf13/cobra"

"github.com/liquidweb/liquidweb-cli/types/api"
apiTypes "github.com/liquidweb/liquidweb-cli/types/api"
"github.com/liquidweb/liquidweb-cli/validate"
)

Expand All @@ -39,7 +39,7 @@ Applications that communicate internally will frequently use this for both secur
and cost-savings.
`,
Run: func(cmd *cobra.Command, args []string) {
uniqIdFlag, _ := cmd.Flags().GetString("uniq_id")
uniqIdFlag, _ := cmd.Flags().GetString("uniq-id")

validateFields := map[interface{}]interface{}{
uniqIdFlag: "UniqId",
Expand All @@ -66,12 +66,12 @@ and cost-savings.
}

fmt.Printf("Attaching %s to private network\n", details.Attached)
fmt.Printf("\n\nYou can check progress with 'cloud server status --uniq_id %s'\n", uniqIdFlag)
fmt.Printf("\n\nYou can check progress with 'cloud server status --uniq-id %s'\n", uniqIdFlag)
},
}

func init() {
cloudNetworkPrivateCmd.AddCommand(cloudNetworkPrivateAttachCmd)
cloudNetworkPrivateAttachCmd.Flags().String("uniq_id", "", "uniq_id of the Cloud Server")
cloudNetworkPrivateAttachCmd.MarkFlagRequired("uniq_id")
cloudNetworkPrivateAttachCmd.Flags().String("uniq-id", "", "uniq-id of the Cloud Server")
cloudNetworkPrivateAttachCmd.MarkFlagRequired("uniq-id")
}
10 changes: 5 additions & 5 deletions cmd/cloudNetworkPrivateDetach.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"github.com/spf13/cobra"

"github.com/liquidweb/liquidweb-cli/types/api"
apiTypes "github.com/liquidweb/liquidweb-cli/types/api"
"github.com/liquidweb/liquidweb-cli/validate"
)

Expand All @@ -39,7 +39,7 @@ Applications that communicate internally will frequently use this for both secur
and cost-savings.
`,
Run: func(cmd *cobra.Command, args []string) {
uniqIdFlag, _ := cmd.Flags().GetString("uniq_id")
uniqIdFlag, _ := cmd.Flags().GetString("uniq-id")

validateFields := map[interface{}]interface{}{
uniqIdFlag: "UniqId",
Expand All @@ -66,12 +66,12 @@ and cost-savings.
}

fmt.Printf("Detaching %s from private network\n", details.Detached)
fmt.Printf("\n\nYou can check progress with 'cloud server status --uniq_id %s'\n\n", uniqIdFlag)
fmt.Printf("\n\nYou can check progress with 'cloud server status --uniq-id %s'\n\n", uniqIdFlag)
},
}

func init() {
cloudNetworkPrivateCmd.AddCommand(cloudNetworkPrivateDetachCmd)
cloudNetworkPrivateDetachCmd.Flags().String("uniq_id", "", "uniq_id of the Cloud Server")
cloudNetworkPrivateDetachCmd.MarkFlagRequired("uniq_id")
cloudNetworkPrivateDetachCmd.Flags().String("uniq-id", "", "uniq-id of the Cloud Server")
cloudNetworkPrivateDetachCmd.MarkFlagRequired("uniq-id")
}
8 changes: 4 additions & 4 deletions cmd/cloudNetworkPrivateDetails.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"github.com/spf13/cobra"

"github.com/liquidweb/liquidweb-cli/types/api"
apiTypes "github.com/liquidweb/liquidweb-cli/types/api"
"github.com/liquidweb/liquidweb-cli/validate"
)

Expand All @@ -39,7 +39,7 @@ Applications that communicate internally will frequently use this for both secur
and cost-savings.
`,
Run: func(cmd *cobra.Command, args []string) {
uniqIdFlag, _ := cmd.Flags().GetString("uniq_id")
uniqIdFlag, _ := cmd.Flags().GetString("uniq-id")

validateFields := map[interface{}]interface{}{
uniqIdFlag: "UniqId",
Expand Down Expand Up @@ -68,6 +68,6 @@ and cost-savings.

func init() {
cloudNetworkPrivateCmd.AddCommand(cloudNetworkPrivateDetailsCmd)
cloudNetworkPrivateDetailsCmd.Flags().String("uniq_id", "", "uniq_id of the Cloud Server")
cloudNetworkPrivateDetailsCmd.MarkFlagRequired("uniq_id")
cloudNetworkPrivateDetailsCmd.Flags().String("uniq-id", "", "uniq-id of the Cloud Server")
cloudNetworkPrivateDetailsCmd.MarkFlagRequired("uniq-id")
}
8 changes: 4 additions & 4 deletions cmd/cloudNetworkPublicAdd.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"github.com/spf13/cobra"

"github.com/liquidweb/liquidweb-cli/types/api"
apiTypes "github.com/liquidweb/liquidweb-cli/types/api"
"github.com/liquidweb/liquidweb-cli/validate"
)

Expand All @@ -38,7 +38,7 @@ When the reboot flag is not passed, the IP will be assigned to the server, but i
will be up to the administrator to configure the IP address(es) within the server.
`,
Run: func(cmd *cobra.Command, args []string) {
uniqIdFlag, _ := cmd.Flags().GetString("uniq_id")
uniqIdFlag, _ := cmd.Flags().GetString("uniq-id")
rebootFlag, _ := cmd.Flags().GetBool("reboot")
newIpsFlag, _ := cmd.Flags().GetInt64("new-ips")

Expand Down Expand Up @@ -93,12 +93,12 @@ will be up to the administrator to configure the IP address(es) within the serve

func init() {
cloudNetworkPublicCmd.AddCommand(cloudNetworkPublicAddCmd)
cloudNetworkPublicAddCmd.Flags().String("uniq_id", "", "uniq_id of the Cloud Server")
cloudNetworkPublicAddCmd.Flags().String("uniq-id", "", "uniq-id of the Cloud Server")
cloudNetworkPublicAddCmd.Flags().Bool("reboot", false,
"wheter or not to automatically configure the new IP address(es) in the server (requires reboot)")
cloudNetworkPublicAddCmd.Flags().Int64("new-ips", 0, "amount of new ips to (randomly) grab")
cloudNetworkPublicAddCmd.Flags().StringSliceVar(&cloudNetworkPublicAddCmdPoolIpsFlag, "pool-ips", []string{},
"ips from your IP Pool separated by ',' to assign to the Cloud Server")

cloudNetworkPublicAddCmd.MarkFlagRequired("uniq_id")
cloudNetworkPublicAddCmd.MarkFlagRequired("uniq-id")
}
Loading

0 comments on commit c7e1113

Please sign in to comment.