Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/hetznercloud/cli

go 1.25.0
go 1.26.0

toolchain go1.27.1

Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/all/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func TestListAll(t *testing.T) {
Minute: 1,
Hour: 2,
DayOfWeek: hcloud.Ptr(time.Sunday),
DayOfMonth: hcloud.Ptr(4),
DayOfMonth: new(4),
},
Created: time.Now().Add(-3 * time.Hour),
},
Expand Down Expand Up @@ -381,7 +381,7 @@ func TestListAllPaidJSON(t *testing.T) {
Minute: 1,
Hour: 2,
DayOfWeek: hcloud.Ptr(time.Sunday),
DayOfMonth: hcloud.Ptr(4),
DayOfMonth: new(4),
},
Created: time.Date(2024, 4, 2, 10, 0, 0, 0, time.UTC),
},
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/firewall/add_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ func parseRuleFromArgs(flags *pflag.FlagSet) (*hcloud.FirewallRule, error) {
}

if port != "" {
rule.Port = hcloud.Ptr(port)
rule.Port = new(port)
}

if description != "" {
rule.Description = hcloud.Ptr(description)
rule.Description = new(description)
}

switch rule.Protocol {
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/firewall/add_rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ func TestAddRule(t *testing.T) {
SourceIPs: []net.IPNet{{IP: net.IP{0, 0, 0, 0}, Mask: net.IPMask{0, 0, 0, 0}}, {IP: net.IP{127, 0, 0, 1}, Mask: net.IPMask{255, 255, 255, 255}}},
DestinationIPs: []net.IPNet{},
Protocol: hcloud.FirewallRuleProtocolTCP,
Port: hcloud.Ptr("80"),
Description: hcloud.Ptr("http"),
Port: new("80"),
Description: new("http"),
}},
}).
Return([]*hcloud.Action{{ID: 123}, {ID: 321}}, nil, nil)
Expand Down
12 changes: 6 additions & 6 deletions internal/cmd/firewall/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ func TestCreate(t *testing.T) {
},
DestinationIPs: nil,
Protocol: hcloud.FirewallRuleProtocolTCP,
Port: hcloud.Ptr("80"),
Description: hcloud.Ptr("Allow port 80"),
Port: new("80"),
Description: new("Allow port 80"),
},
{
Direction: hcloud.FirewallRuleDirectionIn,
Expand All @@ -56,8 +56,8 @@ func TestCreate(t *testing.T) {
},
DestinationIPs: nil,
Protocol: hcloud.FirewallRuleProtocolTCP,
Port: hcloud.Ptr("443"),
Description: hcloud.Ptr("Allow port 443"),
Port: new("443"),
Description: new("Allow port 443"),
},
{
Direction: hcloud.FirewallRuleDirectionOut,
Expand All @@ -71,7 +71,7 @@ func TestCreate(t *testing.T) {
},
},
Protocol: hcloud.FirewallRuleProtocolTCP,
Port: hcloud.Ptr("80"),
Port: new("80"),
},
},
}).
Expand Down Expand Up @@ -123,7 +123,7 @@ func TestCreateJSON(t *testing.T) {
SourceIPs: []net.IPNet{},
DestinationIPs: []net.IPNet{},
Protocol: "tcp",
Port: hcloud.Ptr("22"),
Port: new("22"),
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/firewall/delete_rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ func TestDeleteRule(t *testing.T) {
SourceIPs: []net.IPNet{{IP: net.IP{0, 0, 0, 0}, Mask: net.IPMask{0, 0, 0, 0}}, {IP: net.IP{127, 0, 0, 1}, Mask: net.IPMask{255, 255, 255, 255}}},
DestinationIPs: []net.IPNet{},
Protocol: hcloud.FirewallRuleProtocolTCP,
Port: hcloud.Ptr("80"),
Description: hcloud.Ptr("http"),
Port: new("80"),
Description: new("http"),
}},
}

Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/firewall/describe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ func TestDescribe(t *testing.T) {
Rules: []hcloud.FirewallRule{
{
Direction: hcloud.FirewallRuleDirectionIn,
Description: hcloud.Ptr("ssh"),
Port: hcloud.Ptr("22"),
Description: new("ssh"),
Port: new("22"),
Protocol: hcloud.FirewallRuleProtocolTCP,
},
},
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/firewall/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func TestListJSON(t *testing.T) {
},
DestinationIPs: []net.IPNet{},
Protocol: hcloud.FirewallRuleProtocolTCP,
Port: hcloud.Ptr("80"),
Port: new("80"),
},
},
AppliedTo: []hcloud.FirewallResource{
Expand Down
10 changes: 5 additions & 5 deletions internal/cmd/firewall/replace_rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ func TestReplaceRules(t *testing.T) {
},
DestinationIPs: nil,
Protocol: hcloud.FirewallRuleProtocolTCP,
Port: hcloud.Ptr("80"),
Description: hcloud.Ptr("Allow port 80"),
Port: new("80"),
Description: new("Allow port 80"),
},
{
Direction: hcloud.FirewallRuleDirectionIn,
Expand All @@ -57,8 +57,8 @@ func TestReplaceRules(t *testing.T) {
},
DestinationIPs: nil,
Protocol: hcloud.FirewallRuleProtocolTCP,
Port: hcloud.Ptr("443"),
Description: hcloud.Ptr("Allow port 443"),
Port: new("443"),
Description: new("Allow port 443"),
},
{
Direction: hcloud.FirewallRuleDirectionOut,
Expand All @@ -72,7 +72,7 @@ func TestReplaceRules(t *testing.T) {
},
},
Protocol: hcloud.FirewallRuleProtocolTCP,
Port: hcloud.Ptr("80"),
Port: new("80"),
},
},
}).
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/floatingip/change_protection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestEnableProtection(t *testing.T) {
Return(&hcloud.FloatingIP{ID: 123}, nil, nil)
fx.Client.FloatingIPClient.EXPECT().
ChangeProtection(gomock.Any(), &hcloud.FloatingIP{ID: 123}, hcloud.FloatingIPChangeProtectionOpts{
Delete: hcloud.Ptr(true),
Delete: new(true),
}).
Return(&hcloud.Action{ID: 123}, nil, nil)
fx.ActionWaiter.EXPECT().
Expand Down Expand Up @@ -52,7 +52,7 @@ func TestDisableProtection(t *testing.T) {
Return(&hcloud.FloatingIP{ID: 123}, nil, nil)
fx.Client.FloatingIPClient.EXPECT().
ChangeProtection(gomock.Any(), &hcloud.FloatingIP{ID: 123}, hcloud.FloatingIPChangeProtectionOpts{
Delete: hcloud.Ptr(false),
Delete: new(false),
}).
Return(&hcloud.Action{ID: 123}, nil, nil)
fx.ActionWaiter.EXPECT().
Expand Down
14 changes: 7 additions & 7 deletions internal/cmd/floatingip/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ func TestCreate(t *testing.T) {

fx.Client.FloatingIPClient.EXPECT().
Create(gomock.Any(), hcloud.FloatingIPCreateOpts{
Name: hcloud.Ptr("myFloatingIP"),
Name: new("myFloatingIP"),
Type: hcloud.FloatingIPTypeIPv4,
HomeLocation: &hcloud.Location{Name: "fsn1"},
Labels: make(map[string]string),
Description: hcloud.Ptr(""),
Description: new(""),
}).
Return(hcloud.FloatingIPCreateResult{
FloatingIP: floatingIP,
Expand Down Expand Up @@ -76,11 +76,11 @@ func TestCreateJSON(t *testing.T) {

fx.Client.FloatingIPClient.EXPECT().
Create(gomock.Any(), hcloud.FloatingIPCreateOpts{
Name: hcloud.Ptr("myFloatingIP"),
Name: new("myFloatingIP"),
Type: hcloud.FloatingIPTypeIPv4,
HomeLocation: &hcloud.Location{Name: "fsn1"},
Labels: make(map[string]string),
Description: hcloud.Ptr(""),
Description: new(""),
}).
Return(hcloud.FloatingIPCreateResult{
FloatingIP: floatingIP,
Expand Down Expand Up @@ -115,11 +115,11 @@ func TestCreateProtection(t *testing.T) {

fx.Client.FloatingIPClient.EXPECT().
Create(gomock.Any(), hcloud.FloatingIPCreateOpts{
Name: hcloud.Ptr("myFloatingIP"),
Name: new("myFloatingIP"),
Type: hcloud.FloatingIPTypeIPv4,
HomeLocation: &hcloud.Location{Name: "fsn1"},
Labels: make(map[string]string),
Description: hcloud.Ptr(""),
Description: new(""),
}).
Return(hcloud.FloatingIPCreateResult{
FloatingIP: floatingIP,
Expand All @@ -131,7 +131,7 @@ func TestCreateProtection(t *testing.T) {

fx.Client.FloatingIPClient.EXPECT().
ChangeProtection(gomock.Any(), floatingIP, hcloud.FloatingIPChangeProtectionOpts{
Delete: hcloud.Ptr(true),
Delete: new(true),
}).
Return(&hcloud.Action{ID: 333}, nil, nil)
fx.ActionWaiter.EXPECT().WaitForActions(gomock.Any(), gomock.Any(), &hcloud.Action{ID: 333}).Return(nil)
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/floatingip/set_rdns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestSetRDNS(t *testing.T) {
Get(gomock.Any(), "test").
Return(floatingIP, nil, nil)
fx.Client.RDNSClient.EXPECT().
ChangeDNSPtr(gomock.Any(), floatingIP, floatingIP.IP, hcloud.Ptr("example.com")).
ChangeDNSPtr(gomock.Any(), floatingIP, floatingIP.IP, new("example.com")).
Return(&hcloud.Action{ID: 123}, nil, nil)
fx.ActionWaiter.EXPECT().
WaitForActions(gomock.Any(), gomock.Any(), &hcloud.Action{ID: 123}).
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/image/change_protection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestEnableProtection(t *testing.T) {

fx.Client.ImageClient.EXPECT().
ChangeProtection(gomock.Any(), &hcloud.Image{ID: 123}, hcloud.ImageChangeProtectionOpts{
Delete: hcloud.Ptr(true),
Delete: new(true),
}).
Return(&hcloud.Action{ID: 123}, nil, nil)
fx.ActionWaiter.EXPECT().
Expand All @@ -46,7 +46,7 @@ func TestDisableProtection(t *testing.T) {

fx.Client.ImageClient.EXPECT().
ChangeProtection(gomock.Any(), &hcloud.Image{ID: 123}, hcloud.ImageChangeProtectionOpts{
Delete: hcloud.Ptr(false),
Delete: new(false),
}).
Return(&hcloud.Action{ID: 123}, nil, nil)
fx.ActionWaiter.EXPECT().
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/image/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var UpdateCmd = base.UpdateCmd[*hcloud.Image]{
},
Update: func(s state.State, _ *cobra.Command, image *hcloud.Image, flags map[string]pflag.Value) error {
updOpts := hcloud.ImageUpdateOpts{
Description: hcloud.Ptr(flags["description"].String()),
Description: new(flags["description"].String()),
Type: hcloud.ImageType(flags["type"].String()),
}
_, _, err := s.Client().Image().Update(s, image, updOpts)
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/image/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestUpdateDescription(t *testing.T) {
Return(&hcloud.Image{ID: 123}, nil, nil)
fx.Client.ImageClient.EXPECT().
Update(gomock.Any(), &hcloud.Image{ID: 123}, hcloud.ImageUpdateOpts{
Description: hcloud.Ptr("new-description"),
Description: new("new-description"),
})

out, errOut, err := fx.Run(cmd, []string{"123", "--description", "new-description"})
Expand All @@ -48,7 +48,7 @@ func TestUpdateType(t *testing.T) {
Return(&hcloud.Image{ID: 123}, nil, nil)
fx.Client.ImageClient.EXPECT().
Update(gomock.Any(), &hcloud.Image{ID: 123}, hcloud.ImageUpdateOpts{
Description: hcloud.Ptr(""),
Description: new(""),
Type: hcloud.ImageTypeSnapshot,
})

Expand Down
34 changes: 17 additions & 17 deletions internal/cmd/loadbalancer/add_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ func TestAddService(t *testing.T) {
fx.Client.LoadBalancerClient.EXPECT().
AddService(gomock.Any(), &hcloud.LoadBalancer{ID: 123}, hcloud.LoadBalancerAddServiceOpts{
Protocol: hcloud.LoadBalancerServiceProtocolHTTP,
ListenPort: hcloud.Ptr(80),
DestinationPort: hcloud.Ptr(8080),
ListenPort: new(80),
DestinationPort: new(8080),
HTTP: &hcloud.LoadBalancerAddServiceOptsHTTP{
StickySessions: hcloud.Ptr(false),
RedirectHTTP: hcloud.Ptr(false),
StickySessions: new(false),
RedirectHTTP: new(false),
TimeoutIdle: hcloud.Ptr(60 * time.Second),
},
Proxyprotocol: hcloud.Ptr(false),
Proxyprotocol: new(false),
}).
Return(&hcloud.Action{ID: 123}, nil, nil)
fx.ActionWaiter.EXPECT().
Expand Down Expand Up @@ -65,28 +65,28 @@ func TestAddServiceWithHealthCheck(t *testing.T) {
fx.Client.LoadBalancerClient.EXPECT().
AddService(gomock.Any(), &hcloud.LoadBalancer{ID: 123}, hcloud.LoadBalancerAddServiceOpts{
Protocol: hcloud.LoadBalancerServiceProtocolHTTP,
ListenPort: hcloud.Ptr(80),
DestinationPort: hcloud.Ptr(8080),
ListenPort: new(80),
DestinationPort: new(8080),
HTTP: &hcloud.LoadBalancerAddServiceOptsHTTP{
StickySessions: hcloud.Ptr(true),
RedirectHTTP: hcloud.Ptr(true),
CookieName: hcloud.Ptr("test"),
StickySessions: new(true),
RedirectHTTP: new(true),
CookieName: new("test"),
Certificates: []*hcloud.Certificate{{ID: 1}},
CookieLifetime: hcloud.Ptr(10 * time.Minute),
},
Proxyprotocol: hcloud.Ptr(false),
Proxyprotocol: new(false),
HealthCheck: &hcloud.LoadBalancerAddServiceOptsHealthCheck{
Protocol: hcloud.LoadBalancerServiceProtocolHTTP,
Port: hcloud.Ptr(80),
Port: new(80),
Interval: hcloud.Ptr(10 * time.Second),
Timeout: hcloud.Ptr(5 * time.Second),
Retries: hcloud.Ptr(2),
Retries: new(2),
HTTP: &hcloud.LoadBalancerAddServiceOptsHealthCheckHTTP{
Domain: hcloud.Ptr("example.com"),
Path: hcloud.Ptr("/health"),
Domain: new("example.com"),
Path: new("/health"),
StatusCodes: []string{"200"},
Response: hcloud.Ptr("OK"),
TLS: hcloud.Ptr(true),
Response: new("OK"),
TLS: new(true),
},
},
}).
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/loadbalancer/add_target_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestAddTargetServer(t *testing.T) {
fx.Client.LoadBalancerClient.EXPECT().
AddServerTarget(gomock.Any(), &hcloud.LoadBalancer{ID: 123}, hcloud.LoadBalancerAddServerTargetOpts{
Server: &hcloud.Server{ID: 321},
UsePrivateIP: hcloud.Ptr(false),
UsePrivateIP: new(false),
}).
Return(&hcloud.Action{ID: 123}, nil, nil)
fx.ActionWaiter.EXPECT().
Expand Down Expand Up @@ -58,7 +58,7 @@ func TestAddTargetLabelSelector(t *testing.T) {
fx.Client.LoadBalancerClient.EXPECT().
AddLabelSelectorTarget(gomock.Any(), &hcloud.LoadBalancer{ID: 123}, hcloud.LoadBalancerAddLabelSelectorTargetOpts{
Selector: "my-label",
UsePrivateIP: hcloud.Ptr(false),
UsePrivateIP: new(false),
}).
Return(&hcloud.Action{ID: 123}, nil, nil)
fx.ActionWaiter.EXPECT().
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/loadbalancer/change_protection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestEnableProtection(t *testing.T) {
Return(&hcloud.LoadBalancer{ID: 123}, nil, nil)
fx.Client.LoadBalancerClient.EXPECT().
ChangeProtection(gomock.Any(), &hcloud.LoadBalancer{ID: 123}, hcloud.LoadBalancerChangeProtectionOpts{
Delete: hcloud.Ptr(true),
Delete: new(true),
}).
Return(&hcloud.Action{ID: 123}, nil, nil)
fx.ActionWaiter.EXPECT().
Expand Down Expand Up @@ -52,7 +52,7 @@ func TestDisableProtection(t *testing.T) {
Return(&hcloud.LoadBalancer{ID: 123}, nil, nil)
fx.Client.LoadBalancerClient.EXPECT().
ChangeProtection(gomock.Any(), &hcloud.LoadBalancer{ID: 123}, hcloud.LoadBalancerChangeProtectionOpts{
Delete: hcloud.Ptr(false),
Delete: new(false),
}).
Return(&hcloud.Action{ID: 123}, nil, nil)
fx.ActionWaiter.EXPECT().
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/loadbalancer/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func TestCreateProtection(t *testing.T) {
Return(loadBalancer, nil, nil)
fx.Client.LoadBalancerClient.EXPECT().
ChangeProtection(gomock.Any(), loadBalancer, hcloud.LoadBalancerChangeProtectionOpts{
Delete: hcloud.Ptr(true),
Delete: new(true),
}).
Return(&hcloud.Action{ID: 333}, nil, nil)
fx.ActionWaiter.EXPECT().WaitForActions(gomock.Any(), gomock.Any(), &hcloud.Action{ID: 333}).Return(nil)
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/loadbalancer/describe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func TestDescribe(t *testing.T) {
ListenPort: 443,
Status: hcloud.LoadBalancerTargetHealthStatusStatusUnhealthy,
Detail: hcloud.Ptr(hcloud.LoadBalancerTargetHealthStatusDetailUnexpectedHTTPStatus),
HTTPStatusCode: hcloud.Ptr(500),
HTTPStatusCode: new(500),
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/loadbalancer/set_rdns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestSetRDNS(t *testing.T) {
Get(gomock.Any(), "test").
Return(loadBalancer, nil, nil)
fx.Client.RDNSClient.EXPECT().
ChangeDNSPtr(gomock.Any(), loadBalancer, loadBalancer.PublicNet.IPv4.IP, hcloud.Ptr("example.com")).
ChangeDNSPtr(gomock.Any(), loadBalancer, loadBalancer.PublicNet.IPv4.IP, new("example.com")).
Return(&hcloud.Action{ID: 123}, nil, nil)
fx.ActionWaiter.EXPECT().
WaitForActions(gomock.Any(), gomock.Any(), &hcloud.Action{ID: 123}).
Expand Down
Loading
Loading