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

Add Primary IP Support #204

Merged
merged 1 commit into from
Jun 28, 2022
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 .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test:golangci-lint:

test:tests:
stage: test
image: golang:1.17
image: golang:1.18
script:
- go test -v -race ./...
except:
Expand Down
2 changes: 2 additions & 0 deletions hcloud/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ type Client struct {
Volume VolumeClient
PlacementGroup PlacementGroupClient
RDNS RDNSClient
PrimaryIP PrimaryIPClient
}

// A ClientOption is used to configure a Client.
Expand Down Expand Up @@ -187,6 +188,7 @@ func NewClient(options ...ClientOption) *Client {
client.Firewall = FirewallClient{client: client}
client.PlacementGroup = PlacementGroupClient{client: client}
client.RDNS = RDNSClient{client: client}
client.PrimaryIP = PrimaryIPClient{client: client}

return client
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/hcloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
package hcloud

// Version is the library's version following Semantic Versioning.
const Version = "1.34.0"
const Version = "1.35.0"
23 changes: 23 additions & 0 deletions hcloud/pricing.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type Pricing struct {
Image ImagePricing
FloatingIP FloatingIPPricing
FloatingIPs []FloatingIPTypePricing
PrimaryIPs []PrimaryIPPricing
Traffic TrafficPricing
ServerBackup ServerBackupPricing
ServerTypes []ServerTypePricing
Expand All @@ -28,6 +29,14 @@ type Price struct {
Gross string
}

// PrimaryIPPrice represents a price. Net amount and gross amount are
// specified as strings and it is the user's responsibility to convert them to
// appropriate types for calculations.
type PrimaryIPPrice struct {
Net string
Gross string
}

// ImagePricing provides pricing information for imaegs.
type ImagePricing struct {
PerGBMonth Price
Expand All @@ -44,6 +53,20 @@ type FloatingIPTypePricing struct {
Pricings []FloatingIPTypeLocationPricing
}

// PrimaryIPTypePricing defines the schema of pricing information for a primary IP
// type at a datacenter.
type PrimaryIPTypePricing struct {
Datacenter string
Hourly PrimaryIPPrice
Monthly PrimaryIPPrice
}

// PrimaryIPTypePricing provides pricing information for PrimaryIPs
type PrimaryIPPricing struct {
Type string
Pricings []PrimaryIPTypePricing
}

// FloatingIPTypeLocationPricing provides pricing information for a Floating IP type
// at a location.
type FloatingIPTypeLocationPricing struct {
Expand Down
Loading