Skip to content

Commit

Permalink
feat: upgrade to hcloud-go v2
Browse files Browse the repository at this point in the history
Ensure continued compatibility on 32-bit platforms.
  • Loading branch information
apricote committed Jul 5, 2023
1 parent 5b7beb1 commit 4635d1f
Show file tree
Hide file tree
Showing 80 changed files with 219 additions and 230 deletions.
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/golang/mock v1.6.0
github.com/google/go-cmp v0.5.9
github.com/guptarohit/asciigraph v0.5.6
github.com/hetznercloud/hcloud-go v1.47.0
github.com/hetznercloud/hcloud-go/v2 v2.0.0
github.com/pelletier/go-toml/v2 v2.0.8
github.com/rjeczalik/interfaces v0.3.0
github.com/spf13/cobra v1.7.0
Expand Down Expand Up @@ -48,3 +48,5 @@ require (
)

go 1.20

replace github.com/hetznercloud/hcloud-go/v2 => github.com/hetznercloud/hcloud-go/v2 id-int64
66 changes: 3 additions & 63 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions internal/cmd/base/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ type LabelCmds struct {
ShortDescriptionRemove string
NameSuggestions func(client hcapi2.Client) func() []string
LabelKeySuggestions func(client hcapi2.Client) func(idOrName string) []string
FetchLabels func(ctx context.Context, client hcapi2.Client, idOrName string) (map[string]string, int, error)
SetLabels func(ctx context.Context, client hcapi2.Client, id int, labels map[string]string) error
FetchLabels func(ctx context.Context, client hcapi2.Client, idOrName string) (map[string]string, int64, error)
SetLabels func(ctx context.Context, client hcapi2.Client, id int64, labels map[string]string) error
}

// AddCobraCommand creates a command that can be registered with cobra.
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/certificate/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var labelCmds = base.LabelCmds{
ShortDescriptionRemove: "Remove a label from an certificate",
NameSuggestions: func(c hcapi2.Client) func() []string { return c.Certificate().Names },
LabelKeySuggestions: func(c hcapi2.Client) func(idOrName string) []string { return c.Certificate().LabelKeys },
FetchLabels: func(ctx context.Context, client hcapi2.Client, idOrName string) (map[string]string, int, error) {
FetchLabels: func(ctx context.Context, client hcapi2.Client, idOrName string) (map[string]string, int64, error) {
certificate, _, err := client.Certificate().Get(ctx, idOrName)
if err != nil {
return nil, 0, err
Expand All @@ -25,7 +25,7 @@ var labelCmds = base.LabelCmds{
}
return certificate.Labels, certificate.ID, nil
},
SetLabels: func(ctx context.Context, client hcapi2.Client, id int, labels map[string]string) error {
SetLabels: func(ctx context.Context, client hcapi2.Client, id int64, labels map[string]string) error {
opts := hcloud.CertificateUpdateOpts{
Labels: labels,
}
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/firewall/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var labelCmds = base.LabelCmds{
ShortDescriptionRemove: "Remove a label from an firewall",
NameSuggestions: func(c hcapi2.Client) func() []string { return c.Firewall().Names },
LabelKeySuggestions: func(c hcapi2.Client) func(idOrName string) []string { return c.Firewall().LabelKeys },
FetchLabels: func(ctx context.Context, client hcapi2.Client, idOrName string) (map[string]string, int, error) {
FetchLabels: func(ctx context.Context, client hcapi2.Client, idOrName string) (map[string]string, int64, error) {
firewall, _, err := client.Firewall().Get(ctx, idOrName)
if err != nil {
return nil, 0, err
Expand All @@ -25,7 +25,7 @@ var labelCmds = base.LabelCmds{
}
return firewall.Labels, firewall.ID, nil
},
SetLabels: func(ctx context.Context, client hcapi2.Client, id int, labels map[string]string) error {
SetLabels: func(ctx context.Context, client hcapi2.Client, id int64, labels map[string]string) error {
opts := hcloud.FirewallUpdateOpts{
Labels: labels,
}
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/floatingip/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var labelCmds = base.LabelCmds{
ShortDescriptionRemove: "Remove a label from an Floating IP",
NameSuggestions: func(c hcapi2.Client) func() []string { return c.FloatingIP().Names },
LabelKeySuggestions: func(c hcapi2.Client) func(idOrName string) []string { return c.FloatingIP().LabelKeys },
FetchLabels: func(ctx context.Context, client hcapi2.Client, idOrName string) (map[string]string, int, error) {
FetchLabels: func(ctx context.Context, client hcapi2.Client, idOrName string) (map[string]string, int64, error) {
floatingIP, _, err := client.FloatingIP().Get(ctx, idOrName)
if err != nil {
return nil, 0, err
Expand All @@ -25,7 +25,7 @@ var labelCmds = base.LabelCmds{
}
return floatingIP.Labels, floatingIP.ID, nil
},
SetLabels: func(ctx context.Context, client hcapi2.Client, id int, labels map[string]string) error {
SetLabels: func(ctx context.Context, client hcapi2.Client, id int64, labels map[string]string) error {
opts := hcloud.FloatingIPUpdateOpts{
Labels: labels,
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/floatingip/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ var listCmd = base.ListCmd{
})
}
if floatingIP.Server != nil {
floatingIPSchema.Server = hcloud.Int(floatingIP.Server.ID)
floatingIPSchema.Server = hcloud.Ptr(floatingIP.Server.ID)
}
floatingIPSchemas = append(floatingIPSchemas, floatingIPSchema)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/image/disable_protection.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var DisableProtectionCommand = base.Cmd{
}
},
Run: func(ctx context.Context, client hcapi2.Client, waiter state.ActionWaiter, command *cobra.Command, args []string) error {
imageID, err := strconv.Atoi(args[0])
imageID, err := strconv.ParseInt(args[0], 10, 64)
if err != nil {
return errors.New("invalid image ID")
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/image/enable_protection.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var EnableProtectionCommand = base.Cmd{
}
},
Run: func(ctx context.Context, client hcapi2.Client, waiter state.ActionWaiter, command *cobra.Command, args []string) error {
imageID, err := strconv.Atoi(args[0])
imageID, err := strconv.ParseInt(args[0], 10, 64)
if err != nil {
return errors.New("invalid image ID")
}
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/image/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var labelCmds = base.LabelCmds{
ShortDescriptionRemove: "Remove a label from an image",
NameSuggestions: func(c hcapi2.Client) func() []string { return c.Image().Names },
LabelKeySuggestions: func(c hcapi2.Client) func(idOrName string) []string { return c.Image().LabelKeys },
FetchLabels: func(ctx context.Context, client hcapi2.Client, idOrName string) (map[string]string, int, error) {
FetchLabels: func(ctx context.Context, client hcapi2.Client, idOrName string) (map[string]string, int64, error) {
image, _, err := client.Image().Get(ctx, idOrName)
if err != nil {
return nil, 0, err
Expand All @@ -25,7 +25,7 @@ var labelCmds = base.LabelCmds{
}
return image.Labels, image.ID, nil
},
SetLabels: func(ctx context.Context, client hcapi2.Client, id int, labels map[string]string) error {
SetLabels: func(ctx context.Context, client hcapi2.Client, id int64, labels map[string]string) error {
opts := hcloud.ImageUpdateOpts{
Labels: labels,
}
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/loadbalancer/add_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var AddServiceCommand = base.Cmd{
cmd.Flags().Bool("http-sticky-sessions", false, "Enable Sticky Sessions")
cmd.Flags().String("http-cookie-name", "", "Sticky Sessions: Cookie Name we set")
cmd.Flags().Duration("http-cookie-lifetime", 0, "Sticky Sessions: Lifetime of the cookie")
cmd.Flags().IntSlice("http-certificates", []int{}, "ID of Certificates which are attached to this Load Balancer")
cmd.Flags().Int64Slice("http-certificates", []int64{}, "ID of Certificates which are attached to this Load Balancer")
cmd.Flags().Bool("http-redirect-http", false, "Redirect all traffic on port 80 to port 443")

return cmd
Expand All @@ -41,7 +41,7 @@ var AddServiceCommand = base.Cmd{
protocol, _ := cmd.Flags().GetString("protocol")
listenPort, _ := cmd.Flags().GetInt("listen-port")
destinationPort, _ := cmd.Flags().GetInt("destination-port")
httpCertificates, _ := cmd.Flags().GetIntSlice("http-certificates")
httpCertificates, _ := cmd.Flags().GetInt64Slice("http-certificates")

if protocol == "" {
return fmt.Errorf("required flag protocol not set")
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/loadbalancer/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var labelCmds = base.LabelCmds{
ShortDescriptionRemove: "Remove a label from a Load Balancer",
NameSuggestions: func(c hcapi2.Client) func() []string { return c.LoadBalancer().Names },
LabelKeySuggestions: func(c hcapi2.Client) func(idOrName string) []string { return c.LoadBalancer().LabelKeys },
FetchLabels: func(ctx context.Context, client hcapi2.Client, idOrName string) (map[string]string, int, error) {
FetchLabels: func(ctx context.Context, client hcapi2.Client, idOrName string) (map[string]string, int64, error) {
loadBalancer, _, err := client.LoadBalancer().Get(ctx, idOrName)
if err != nil {
return nil, 0, err
Expand All @@ -25,7 +25,7 @@ var labelCmds = base.LabelCmds{
}
return loadBalancer.Labels, loadBalancer.ID, nil
},
SetLabels: func(ctx context.Context, client hcapi2.Client, id int, labels map[string]string) error {
SetLabels: func(ctx context.Context, client hcapi2.Client, id int64, labels map[string]string) error {
opts := hcloud.LoadBalancerUpdateOpts{
Labels: labels,
}
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/loadbalancer/update_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var UpdateServiceCommand = base.Cmd{
cmd.Flags().Bool("http-sticky-sessions", false, "Enable or disable (with --http-sticky-sessions=false) Sticky Sessions")
cmd.Flags().String("http-cookie-name", "", "Sticky Sessions: Cookie Name which will be set")
cmd.Flags().Duration("http-cookie-lifetime", 0, "Sticky Sessions: Lifetime of the cookie")
cmd.Flags().IntSlice("http-certificates", []int{}, "ID of Certificates which are attached to this Load Balancer")
cmd.Flags().Int64Slice("http-certificates", []int64{}, "ID of Certificates which are attached to this Load Balancer")

cmd.Flags().String("health-check-protocol", "", "The protocol the health check is performed over")
cmd.Flags().Int("health-check-port", 0, "The port the health check is performed over")
Expand Down Expand Up @@ -105,7 +105,7 @@ var UpdateServiceCommand = base.Cmd{
opts.HTTP.CookieLifetime = hcloud.Duration(cookieLifetime)
}
if cmd.Flag("http-certificates").Changed {
certificates, _ := cmd.Flags().GetIntSlice("http-certificates")
certificates, _ := cmd.Flags().GetInt64Slice("http-certificates")
for _, certificateID := range certificates {
opts.HTTP.Certificates = append(opts.HTTP.Certificates, &hcloud.Certificate{ID: certificateID})
}
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/network/add_subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ var AddSubnetCommand = base.Cmd{

cmd.Flags().IPNet("ip-range", net.IPNet{}, "Range to allocate IPs from")

cmd.Flags().Int("vswitch-id", 0, "ID of the vSwitch")
cmd.Flags().Int64("vswitch-id", 0, "ID of the vSwitch")
return cmd
},
Run: func(ctx context.Context, client hcapi2.Client, waiter state.ActionWaiter, cmd *cobra.Command, args []string) error {
subnetType, _ := cmd.Flags().GetString("type")
networkZone, _ := cmd.Flags().GetString("network-zone")
ipRange, _ := cmd.Flags().GetIPNet("ip-range")
vSwitchID, _ := cmd.Flags().GetInt("vswitch-id")
vSwitchID, _ := cmd.Flags().GetInt64("vswitch-id")
idOrName := args[0]

network, _, err := client.Network().Get(ctx, idOrName)
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/network/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var labelCmds = base.LabelCmds{
ShortDescriptionRemove: "Remove a label from a Network",
NameSuggestions: func(c hcapi2.Client) func() []string { return c.Network().Names },
LabelKeySuggestions: func(c hcapi2.Client) func(idOrName string) []string { return c.Network().LabelKeys },
FetchLabels: func(ctx context.Context, client hcapi2.Client, idOrName string) (map[string]string, int, error) {
FetchLabels: func(ctx context.Context, client hcapi2.Client, idOrName string) (map[string]string, int64, error) {
network, _, err := client.Network().Get(ctx, idOrName)
if err != nil {
return nil, 0, err
Expand All @@ -25,7 +25,7 @@ var labelCmds = base.LabelCmds{
}
return network.Labels, network.ID, nil
},
SetLabels: func(ctx context.Context, client hcapi2.Client, id int, labels map[string]string) error {
SetLabels: func(ctx context.Context, client hcapi2.Client, id int64, labels map[string]string) error {
opts := hcloud.NetworkUpdateOpts{
Labels: labels,
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/placementgroup/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestDelete(t *testing.T) {
Name: "my Placement Group",
Created: time.Now(),
Labels: map[string]string{"key": "value"},
Servers: []int{4711, 4712},
Servers: []int64{4711, 4712},
Type: hcloud.PlacementGroupTypeSpread,
}

Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/placementgroup/describe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestDescribe(t *testing.T) {
Name: "my Placement Group",
Created: time.Date(2021, 07, 23, 10, 0, 0, 0, time.UTC),
Labels: map[string]string{"key": "value"},
Servers: []int{4711, 4712},
Servers: []int64{4711, 4712},
Type: hcloud.PlacementGroupTypeSpread,
}

Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/placementgroup/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var LabelCmds = base.LabelCmds{
ShortDescriptionRemove: "Remove a label from a placement group",
NameSuggestions: func(c hcapi2.Client) func() []string { return c.PlacementGroup().Names },
LabelKeySuggestions: func(c hcapi2.Client) func(idOrName string) []string { return c.PlacementGroup().LabelKeys },
FetchLabels: func(ctx context.Context, client hcapi2.Client, idOrName string) (map[string]string, int, error) {
FetchLabels: func(ctx context.Context, client hcapi2.Client, idOrName string) (map[string]string, int64, error) {
placementGroup, _, err := client.PlacementGroup().Get(ctx, idOrName)
if err != nil {
return nil, 0, err
Expand All @@ -25,7 +25,7 @@ var LabelCmds = base.LabelCmds{
}
return placementGroup.Labels, placementGroup.ID, nil
},
SetLabels: func(ctx context.Context, client hcapi2.Client, id int, labels map[string]string) error {
SetLabels: func(ctx context.Context, client hcapi2.Client, id int64, labels map[string]string) error {
opts := hcloud.PlacementGroupUpdateOpts{
Labels: labels,
}
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/placementgroup/labels_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestAddLabel(t *testing.T) {
Name: "my Placement Group",
Created: time.Now(),
Labels: map[string]string{"key": "value"},
Servers: []int{4711, 4712},
Servers: []int64{4711, 4712},
Type: hcloud.PlacementGroupTypeSpread,
}

Expand Down Expand Up @@ -62,7 +62,7 @@ func TestRemoveLabel(t *testing.T) {
Name: "my Placement Group",
Created: time.Now(),
Labels: map[string]string{"key": "value"},
Servers: []int{4711, 4712},
Servers: []int64{4711, 4712},
Type: hcloud.PlacementGroupTypeSpread,
}

Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/placementgroup/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestList(t *testing.T) {
ID: 897,
Name: "my Placement Group",
Labels: map[string]string{"key": "value"},
Servers: []int{4711, 4712},
Servers: []int64{4711, 4712},
Type: hcloud.PlacementGroupTypeSpread,
Created: time.Now().Add(-10 * time.Second),
},
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/placementgroup/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestUpdateName(t *testing.T) {
Name: "my Placement Group",
Created: time.Now(),
Labels: map[string]string{"key": "value"},
Servers: []int{4711, 4712},
Servers: []int64{4711, 4712},
Type: hcloud.PlacementGroupTypeSpread,
}

Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/primaryip/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var CreateCmd = base.Cmd{
cmd.Flags().String("name", "", "Name (required)")
cmd.MarkFlagRequired("name")

cmd.Flags().Int("assignee-id", 0, "Assignee (usually a server) to assign Primary IP to")
cmd.Flags().Int64("assignee-id", 0, "Assignee (usually a server) to assign Primary IP to")

cmd.Flags().String("datacenter", "", "Datacenter (ID or name)")
cmd.RegisterFlagCompletionFunc("datacenter", cmpl.SuggestCandidatesF(client.Datacenter().Names))
Expand All @@ -39,7 +39,7 @@ var CreateCmd = base.Cmd{
Run: func(ctx context.Context, client hcapi2.Client, actionWaiter state.ActionWaiter, cmd *cobra.Command, args []string) error {
typ, _ := cmd.Flags().GetString("type")
name, _ := cmd.Flags().GetString("name")
assigneeID, _ := cmd.Flags().GetInt("assignee-id")
assigneeID, _ := cmd.Flags().GetInt64("assignee-id")
datacenter, _ := cmd.Flags().GetString("datacenter")

opts := hcloud.PrimaryIPCreateOpts{
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/primaryip/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var labelCmds = base.LabelCmds{
ShortDescriptionRemove: "Remove a label from a Primary IP",
NameSuggestions: func(c hcapi2.Client) func() []string { return c.PrimaryIP().Names },
LabelKeySuggestions: func(c hcapi2.Client) func(idOrName string) []string { return c.PrimaryIP().LabelKeys },
FetchLabels: func(ctx context.Context, client hcapi2.Client, idOrName string) (map[string]string, int, error) {
FetchLabels: func(ctx context.Context, client hcapi2.Client, idOrName string) (map[string]string, int64, error) {
primaryIP, _, err := client.PrimaryIP().Get(ctx, idOrName)
if err != nil {
return nil, 0, err
Expand All @@ -25,7 +25,7 @@ var labelCmds = base.LabelCmds{
}
return primaryIP.Labels, primaryIP.ID, nil
},
SetLabels: func(ctx context.Context, client hcapi2.Client, id int, labels map[string]string) error {
SetLabels: func(ctx context.Context, client hcapi2.Client, id int64, labels map[string]string) error {
opts := hcloud.PrimaryIPUpdateOpts{
Labels: &labels,
}
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/server/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var labelCmds = base.LabelCmds{
ShortDescriptionRemove: "Remove a label from a server",
NameSuggestions: func(c hcapi2.Client) func() []string { return c.Server().Names },
LabelKeySuggestions: func(c hcapi2.Client) func(idOrName string) []string { return c.Server().LabelKeys },
FetchLabels: func(ctx context.Context, client hcapi2.Client, idOrName string) (map[string]string, int, error) {
FetchLabels: func(ctx context.Context, client hcapi2.Client, idOrName string) (map[string]string, int64, error) {
server, _, err := client.Server().Get(ctx, idOrName)
if err != nil {
return nil, 0, err
Expand All @@ -25,7 +25,7 @@ var labelCmds = base.LabelCmds{
}
return server.Labels, server.ID, nil
},
SetLabels: func(ctx context.Context, client hcapi2.Client, id int, labels map[string]string) error {
SetLabels: func(ctx context.Context, client hcapi2.Client, id int64, labels map[string]string) error {
opts := hcloud.ServerUpdateOpts{
Labels: labels,
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/server/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ var ListCmd = base.ListCmd{
server := obj.(*hcloud.Server)
var volumes []string
for _, volume := range server.Volumes {
volumeID := strconv.Itoa(volume.ID)
volumeID := strconv.FormatInt(volume.ID, 10)
volumes = append(volumes, volumeID)
}
return strings.Join(volumes, ", ")
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/sshkey/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var labelCmds = base.LabelCmds{
ShortDescriptionRemove: "Remove a label from a SSH Key",
NameSuggestions: func(c hcapi2.Client) func() []string { return c.SSHKey().Names },
LabelKeySuggestions: func(c hcapi2.Client) func(idOrName string) []string { return c.SSHKey().LabelKeys },
FetchLabels: func(ctx context.Context, client hcapi2.Client, idOrName string) (map[string]string, int, error) {
FetchLabels: func(ctx context.Context, client hcapi2.Client, idOrName string) (map[string]string, int64, error) {
sshKey, _, err := client.SSHKey().Get(ctx, idOrName)
if err != nil {
return nil, 0, err
Expand All @@ -25,7 +25,7 @@ var labelCmds = base.LabelCmds{
}
return sshKey.Labels, sshKey.ID, nil
},
SetLabels: func(ctx context.Context, client hcapi2.Client, id int, labels map[string]string) error {
SetLabels: func(ctx context.Context, client hcapi2.Client, id int64, labels map[string]string) error {
opts := hcloud.SSHKeyUpdateOpts{
Labels: labels,
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func ImageToSchema(image hcloud.Image) schema.Image {
}
}
if image.BoundTo != nil {
imageSchema.BoundTo = hcloud.Int(image.BoundTo.ID)
imageSchema.BoundTo = hcloud.Ptr(image.BoundTo.ID)
}
return imageSchema
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/volume/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var CreateCommand = base.Cmd{
}

if location != "" {
id, err := strconv.Atoi(location)
id, err := strconv.ParseInt(location, 10, 64)
if err == nil {
opts.Location = &hcloud.Location{ID: id}
} else {
Expand Down
Loading

0 comments on commit 4635d1f

Please sign in to comment.