Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(servertype): add field for included traffic #259

Merged
merged 1 commit into from
May 11, 2023
Merged
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 hcloud/certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func (o CertificateCreateOpts) validateUploaded() error {
return nil
}

// Create creates a new certificate uploaded certificate.
// Create creates a new uploaded certificate.
//
// Create returns an error for certificates of any other type. Use
// CreateCertificate to create such certificates.
Expand Down
19 changes: 10 additions & 9 deletions hcloud/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,16 @@ func ServerPrivateNetFromSchema(s schema.ServerPrivateNet) ServerPrivateNet {
// ServerTypeFromSchema converts a schema.ServerType to a ServerType.
func ServerTypeFromSchema(s schema.ServerType) *ServerType {
st := &ServerType{
ID: s.ID,
Name: s.Name,
Description: s.Description,
Cores: s.Cores,
Memory: s.Memory,
Disk: s.Disk,
StorageType: StorageType(s.StorageType),
CPUType: CPUType(s.CPUType),
Architecture: Architecture(s.Architecture),
ID: s.ID,
Name: s.Name,
Description: s.Description,
Cores: s.Cores,
Memory: s.Memory,
Disk: s.Disk,
StorageType: StorageType(s.StorageType),
CPUType: CPUType(s.CPUType),
Architecture: Architecture(s.Architecture),
IncludedTraffic: s.IncludedTraffic,
}
for _, price := range s.Prices {
st.Pricings = append(st.Pricings, ServerTypeLocationPricing{
Expand Down
21 changes: 11 additions & 10 deletions hcloud/schema/server_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ package schema

// ServerType defines the schema of a server type.
type ServerType struct {
ID int `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Cores int `json:"cores"`
Memory float32 `json:"memory"`
Disk int `json:"disk"`
StorageType string `json:"storage_type"`
CPUType string `json:"cpu_type"`
Architecture string `json:"architecture"`
Prices []PricingServerTypePrice `json:"prices"`
ID int `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Cores int `json:"cores"`
Memory float32 `json:"memory"`
Disk int `json:"disk"`
StorageType string `json:"storage_type"`
CPUType string `json:"cpu_type"`
Architecture string `json:"architecture"`
IncludedTraffic int `json:"included_traffic"`
Prices []PricingServerTypePrice `json:"prices"`
}

// ServerTypeListResponse defines the schema of the response when
Expand Down
4 changes: 3 additions & 1 deletion hcloud/server_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ type ServerType struct {
StorageType StorageType
CPUType CPUType
Architecture Architecture
Pricings []ServerTypeLocationPricing
// IncludedTraffic is the free traffic per month in bytes
IncludedTraffic int
Pricings []ServerTypeLocationPricing
}

// StorageType specifies the type of storage.
Expand Down