Skip to content

Commit

Permalink
Fix for enabling agent level backups
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiol committed Nov 13, 2024
1 parent 7b21400 commit 21df6b3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 16 deletions.
8 changes: 1 addition & 7 deletions cmd/ecloud/ecloud_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ func ecloudInstanceCreateCmd(f factory.ClientFactory) *cobra.Command {
cmd.Flags().String("resource-tier", "", "ID of resource tier to deploy to. A default tier is chosen if not specified")
cmd.Flags().String("ip-address", "", "IP address to allocate for DHCP")
cmd.Flags().Bool("enable-vm-backups", false, "Enable VM-level backups")
cmd.Flags().Bool("enable-agent-backups", false, "Enable agent-level backups, requires a backup gateway")
cmd.Flags().String("backup-gateway-id", "", "Backup gateway ID, for use with agent level backups")
cmd.Flags().String("backup-gateway-id", "", "Backup gateway ID, enables agent-level backups")
cmd.Flags().Bool("wait", false, "Specifies that the command should wait until the instance has been completely created")

return cmd
Expand All @@ -157,7 +156,6 @@ func ecloudInstanceCreate(service ecloud.ECloudService, cmd *cobra.Command, args
createRequest.HostGroupID, _ = cmd.Flags().GetString("host-group")
createRequest.ResourceTierID, _ = cmd.Flags().GetString("resource-tier")
createRequest.BackupEnabled, _ = cmd.Flags().GetBool("enable-vm-backups")
createRequest.BackupAgentEnabled, _ = cmd.Flags().GetBool("enable-agent-backups")
createRequest.BackupGatewayID, _ = cmd.Flags().GetString("backup-gateway-id")
createRequest.Name, _ = cmd.Flags().GetString("name")

Expand All @@ -182,10 +180,6 @@ func ecloudInstanceCreate(service ecloud.ECloudService, cmd *cobra.Command, args

imageFlag, _ := cmd.Flags().GetString("image")

if createRequest.BackupAgentEnabled && createRequest.BackupGatewayID == "" {
return fmt.Errorf("A backup gateway is required to use agent-level backups, please specify a backup gateway ID")
}

if strings.HasPrefix(imageFlag, "img-") {
createRequest.ImageID = imageFlag
} else {
Expand Down
10 changes: 5 additions & 5 deletions cmd/ecloud/ecloud_vpnprofilegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
func ecloudVPNProfileGroupRootCmd(f factory.ClientFactory) *cobra.Command {
cmd := &cobra.Command{
Use: "vpnprofilegroup",
Short: "sub-commands relating to VPN sessions",
Short: "sub-commands relating to VPN profile groups",
}

// Child commands
Expand All @@ -27,8 +27,8 @@ func ecloudVPNProfileGroupRootCmd(f factory.ClientFactory) *cobra.Command {
func ecloudVPNProfileGroupListCmd(f factory.ClientFactory) *cobra.Command {
cmd := &cobra.Command{
Use: "list",
Short: "Lists VPN sessions",
Long: "This command lists VPN sessions",
Short: "Lists VPN profile groups",
Long: "This command lists VPN profile groups",
Example: "ans ecloud vpnprofilegroup list",
RunE: ecloudCobraRunEFunc(f, ecloudVPNProfileGroupList),
}
Expand Down Expand Up @@ -57,8 +57,8 @@ func ecloudVPNProfileGroupList(service ecloud.ECloudService, cmd *cobra.Command,
func ecloudVPNProfileGroupShowCmd(f factory.ClientFactory) *cobra.Command {
return &cobra.Command{
Use: "show <session: id>...",
Short: "Shows a VPN session",
Long: "This command shows one or more VPN sessions",
Short: "Shows a VPN profile group",
Long: "This command shows one or more VPN profile groups",
Example: "ans ecloud vpnprofilegroup show vpns-abcdef12",
Args: func(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22.0
toolchain go1.23.2

require (
github.com/ans-group/sdk-go v1.22.0
github.com/ans-group/sdk-go v1.22.1
github.com/blang/semver v3.5.1+incompatible
github.com/golang/mock v1.6.0
github.com/iancoleman/strcase v0.3.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/ans-group/go-durationstring v1.2.0 h1:UJIuQATkp0t1rBvZsHRwki33YHV9E+Ulro+3NbMB7MM=
github.com/ans-group/go-durationstring v1.2.0/go.mod h1:QGF9Mdpq9058QXaut8r55QWu6lcHX6i/GvF1PZVkV6o=
github.com/ans-group/sdk-go v1.22.0 h1:/eD8CCYkHjqTje+WqfYLNSot2NmjACFrGRqtdMsM5Do=
github.com/ans-group/sdk-go v1.22.0/go.mod h1:Dx34ZUbyHNniHAKsDy/vp8q8hQC5L51ub2sv9We7d8E=
github.com/ans-group/sdk-go v1.22.1 h1:3wfYuWXPldIzKT393+yxQBPjP+O0kPZHzsD1q6zm/+E=
github.com/ans-group/sdk-go v1.22.1/go.mod h1:Dx34ZUbyHNniHAKsDy/vp8q8hQC5L51ub2sv9We7d8E=
github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ=
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
Expand Down
2 changes: 1 addition & 1 deletion test/mocks/mock_ecloudservice.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 21df6b3

Please sign in to comment.