Skip to content

Commit d3b012a

Browse files
authored
feat(servertype): add field for included traffic (#259)
1 parent afb8b12 commit d3b012a

File tree

4 files changed

+25
-21
lines changed

4 files changed

+25
-21
lines changed

hcloud/certificate.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ func (o CertificateCreateOpts) validateUploaded() error {
260260
return nil
261261
}
262262

263-
// Create creates a new certificate uploaded certificate.
263+
// Create creates a new uploaded certificate.
264264
//
265265
// Create returns an error for certificates of any other type. Use
266266
// CreateCertificate to create such certificates.

hcloud/schema.go

+10-9
Original file line numberDiff line numberDiff line change
@@ -278,15 +278,16 @@ func ServerPrivateNetFromSchema(s schema.ServerPrivateNet) ServerPrivateNet {
278278
// ServerTypeFromSchema converts a schema.ServerType to a ServerType.
279279
func ServerTypeFromSchema(s schema.ServerType) *ServerType {
280280
st := &ServerType{
281-
ID: s.ID,
282-
Name: s.Name,
283-
Description: s.Description,
284-
Cores: s.Cores,
285-
Memory: s.Memory,
286-
Disk: s.Disk,
287-
StorageType: StorageType(s.StorageType),
288-
CPUType: CPUType(s.CPUType),
289-
Architecture: Architecture(s.Architecture),
281+
ID: s.ID,
282+
Name: s.Name,
283+
Description: s.Description,
284+
Cores: s.Cores,
285+
Memory: s.Memory,
286+
Disk: s.Disk,
287+
StorageType: StorageType(s.StorageType),
288+
CPUType: CPUType(s.CPUType),
289+
Architecture: Architecture(s.Architecture),
290+
IncludedTraffic: s.IncludedTraffic,
290291
}
291292
for _, price := range s.Prices {
292293
st.Pricings = append(st.Pricings, ServerTypeLocationPricing{

hcloud/schema/server_type.go

+11-10
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@ package schema
22

33
// ServerType defines the schema of a server type.
44
type ServerType struct {
5-
ID int `json:"id"`
6-
Name string `json:"name"`
7-
Description string `json:"description"`
8-
Cores int `json:"cores"`
9-
Memory float32 `json:"memory"`
10-
Disk int `json:"disk"`
11-
StorageType string `json:"storage_type"`
12-
CPUType string `json:"cpu_type"`
13-
Architecture string `json:"architecture"`
14-
Prices []PricingServerTypePrice `json:"prices"`
5+
ID int `json:"id"`
6+
Name string `json:"name"`
7+
Description string `json:"description"`
8+
Cores int `json:"cores"`
9+
Memory float32 `json:"memory"`
10+
Disk int `json:"disk"`
11+
StorageType string `json:"storage_type"`
12+
CPUType string `json:"cpu_type"`
13+
Architecture string `json:"architecture"`
14+
IncludedTraffic int `json:"included_traffic"`
15+
Prices []PricingServerTypePrice `json:"prices"`
1516
}
1617

1718
// ServerTypeListResponse defines the schema of the response when

hcloud/server_type.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ type ServerType struct {
2020
StorageType StorageType
2121
CPUType CPUType
2222
Architecture Architecture
23-
Pricings []ServerTypeLocationPricing
23+
// IncludedTraffic is the free traffic per month in bytes
24+
IncludedTraffic int
25+
Pricings []ServerTypeLocationPricing
2426
}
2527

2628
// StorageType specifies the type of storage.

0 commit comments

Comments
 (0)