Skip to content

Commit

Permalink
fix: deprecate pricing floating ip field (#523)
Browse files Browse the repository at this point in the history
  • Loading branch information
jooola committed Aug 29, 2024
1 parent 743eabb commit 1089d40
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion hcloud/pricing.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import (

// Pricing specifies pricing information for various resources.
type Pricing struct {
Image ImagePricing
Image ImagePricing
// Deprecated: [Pricing.FloatingIP] is deprecated, use [Pricing.FloatingIPs] instead.
FloatingIP FloatingIPPricing
FloatingIPs []FloatingIPTypePricing
PrimaryIPs []PrimaryIPPricing
Expand Down
7 changes: 4 additions & 3 deletions hcloud/schema/pricing.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package schema

// Pricing defines the schema for pricing information.
type Pricing struct {
Currency string `json:"currency"`
VATRate string `json:"vat_rate"`
Image PricingImage `json:"image"`
Currency string `json:"currency"`
VATRate string `json:"vat_rate"`
Image PricingImage `json:"image"`
// Deprecated: [Pricing.FloatingIP] is deprecated, use [Pricing.FloatingIPs] instead.
FloatingIP PricingFloatingIP `json:"floating_ip"`
FloatingIPs []PricingFloatingIPType `json:"floating_ips"`
PrimaryIPs []PricingPrimaryIP `json:"primary_ips"`
Expand Down
4 changes: 2 additions & 2 deletions hcloud/schema_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,8 @@ func imagePricingFromSchema(s schema.Pricing) ImagePricing {
func floatingIPPricingFromSchema(s schema.Pricing) FloatingIPPricing {
return FloatingIPPricing{
Monthly: Price{
Net: s.FloatingIP.PriceMonthly.Net,
Gross: s.FloatingIP.PriceMonthly.Gross,
Net: s.FloatingIP.PriceMonthly.Net, // nolint:staticcheck // Field is deprecated, but removal is not planned
Gross: s.FloatingIP.PriceMonthly.Gross, // nolint:staticcheck // Field is deprecated, but removal is not planned
Currency: s.Currency,
VATRate: s.VATRate,
},
Expand Down

0 comments on commit 1089d40

Please sign in to comment.