Skip to content

Commit c8a28d0

Browse files
authored
feat: add missing properties (#349)
Multiple properties were missing, even though they are documented in the API docs. This PR needs #343 to be merged first. Continuation of #347
1 parent 6feda4d commit c8a28d0

8 files changed

+101
-49
lines changed

hcloud/datacenter.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ type Datacenter struct {
2020

2121
// DatacenterServerTypes represents the server types available and supported in a datacenter.
2222
type DatacenterServerTypes struct {
23-
Supported []*ServerType
24-
Available []*ServerType
23+
Supported []*ServerType
24+
AvailableForMigration []*ServerType
25+
Available []*ServerType
2526
}
2627

2728
// DatacenterClient is a client for the datacenter API.

hcloud/load_balancer_type.go

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type LoadBalancerType struct {
1919
MaxTargets int
2020
MaxAssignedCertificates int
2121
Pricings []LoadBalancerTypeLocationPricing
22+
Deprecated *string
2223
}
2324

2425
// LoadBalancerTypeClient is a client for the Load Balancer types API.

hcloud/schema/datacenter.go

+12-8
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@ package schema
22

33
// Datacenter defines the schema of a datacenter.
44
type Datacenter struct {
5-
ID int64 `json:"id"`
6-
Name string `json:"name"`
7-
Description string `json:"description"`
8-
Location Location `json:"location"`
9-
ServerTypes struct {
10-
Supported []int64 `json:"supported"`
11-
Available []int64 `json:"available"`
12-
} `json:"server_types"`
5+
ID int64 `json:"id"`
6+
Name string `json:"name"`
7+
Description string `json:"description"`
8+
Location Location `json:"location"`
9+
ServerTypes DatacenterServerTypes `json:"server_types"`
10+
}
11+
12+
// DatacenterServerTypes defines the schema of the server types available in a datacenter.
13+
type DatacenterServerTypes struct {
14+
Supported []int64 `json:"supported"`
15+
AvailableForMigration []int64 `json:"available_for_migration"`
16+
Available []int64 `json:"available"`
1317
}
1418

1519
// DatacenterGetResponse defines the schema of the response when retrieving a single datacenter.

hcloud/schema/load_balancer_type.go

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ type LoadBalancerType struct {
1010
MaxTargets int `json:"max_targets"`
1111
MaxAssignedCertificates int `json:"max_assigned_certificates"`
1212
Prices []PricingLoadBalancerTypePrice `json:"prices"`
13+
Deprecated *string `json:"deprecated"`
1314
}
1415

1516
// LoadBalancerTypeListResponse defines the schema of the response when

hcloud/schema/server.go

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ type Server struct {
2525
Volumes []int64 `json:"volumes"`
2626
PrimaryDiskSize int `json:"primary_disk_size"`
2727
PlacementGroup *PlacementGroup `json:"placement_group"`
28+
LoadBalancers []int64 `json:"load_balancers"`
2829
}
2930

3031
// ServerProtection defines the schema of a server's resource protection.

hcloud/schema_gen.go

+10
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ You can find a documentation of goverter here: https://goverter.jmattheis.de/
4646
// goverter:extend int64FromServer
4747
// goverter:extend networkFromInt64
4848
// goverter:extend int64FromNetwork
49+
// goverter:extend loadBalancerFromInt64
50+
// goverter:extend int64FromLoadBalancer
4951
// goverter:extend volumeFromInt64
5052
// goverter:extend int64FromVolume
5153
// goverter:extend certificateFromInt64
@@ -389,6 +391,14 @@ func int64FromNetwork(network Network) int64 {
389391
return network.ID
390392
}
391393

394+
func loadBalancerFromInt64(id int64) LoadBalancer {
395+
return LoadBalancer{ID: id}
396+
}
397+
398+
func int64FromLoadBalancer(lb LoadBalancer) int64 {
399+
return lb.ID
400+
}
401+
392402
func volumeFromInt64(id int64) *Volume {
393403
return &Volume{ID: id}
394404
}

hcloud/server.go

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type Server struct {
3838
Volumes []*Volume
3939
PrimaryDiskSize int
4040
PlacementGroup *PlacementGroup
41+
LoadBalancers []*LoadBalancer
4142
}
4243

4344
// ServerProtection represents the protection level of a server.

hcloud/zz_schema.go

+72-39
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)