Skip to content

Commit

Permalink
Add Primary IP Support (#204)
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
  • Loading branch information
LKaemmerling authored Jun 28, 2022
1 parent 8f67d53 commit 4de881b
Show file tree
Hide file tree
Showing 13 changed files with 1,490 additions and 13 deletions.
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

0 comments on commit 4de881b

Please sign in to comment.