Skip to content

Commit

Permalink
fix(deps): update module github.com/hetznercloud/hcloud-go/v2 to v2.1…
Browse files Browse the repository at this point in the history
…2.0 (hetznercloud/fleeting-plugin-hetzner!101)

This MR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/hetznercloud/hcloud-go/v2](https://github.com/hetznercloud/hcloud-go) | require | minor | `v2.11.0` -> `v2.12.0` |

---

### Release Notes

<details>
<summary>hetznercloud/hcloud-go (github.com/hetznercloud/hcloud-go/v2)</summary>

### [`v2.12.0`](https://github.com/hetznercloud/hcloud-go/releases/tag/v2.12.0)

[Compare Source](hetznercloud/hcloud-go@v2.11.0...v2.12.0)

##### API Changes for Traffic Prices and Server Type Included Traffic

There will be a breaking change in the API regarding Traffic Prices and Server Type Included Traffic on 2024-08-05. This release marks the affected fields as `Deprecated`. Please check if this affects any of your code and switch to the replacement fields where necessary.

You can learn more about this change in [our changelog](https://docs.hetzner.cloud/changelog#2024-07-25-cloud-api-returns-traffic-information-in-different-format).

##### Upgrading

##### Server Type Included Traffic

If you were using the field `hcloud.ServerType.IncludedTraffic`, you can now get the information through `hcloud.ServerType.Pricings`:

```go
func main() {
// previous
includedTraffic := serverType.IncludedTraffic

    // now
    locationOfInterest := "fsn1"
    var includedTraffic uint64
    for _, price := range serverType.Pricings {
        if price.Location.Name == locationOfInterest {
            includedTraffic = price.IncludedTraffic
            break
        }
    }
}
```

##### Traffic Prices

If you were using the field `hcloud.Pricing.Traffic`, you can now get the information through `hcloud.Pricing.ServerTypes` or `hcloud.Pricing.LoadBalancerTypes`:

```go
func main() {
// previous
trafficPrice := pricing.Traffic

    // now
    serverTypeOfInterest := "cx22"
    locationOfInterest := "fsn1"

    var trafficPrice hcloud.Price
    for _, serverTypePricings := range pricing.ServerTypes {
        if serverTypePricings.ServerType.Name == serverTypeOfInterest {
            for _, price := range serverTypePricings {
               if price.Location.Name == locationOfInterest {
                   trafficPrice = price.PerTBTraffic
                   break
               }
            }
        }
    }
}
```

##### Features

-   add jitter in the client default retry exponential backoff ([#&#8203;492](hetznercloud/hcloud-go#492)) ([6205076](hetznercloud/hcloud-go@6205076))
-   add new `WithPollOpts` client option ([#&#8203;493](hetznercloud/hcloud-go#493)) ([2c1a2d6](hetznercloud/hcloud-go@2c1a2d6))
-   allow checking multiple errors codes in `IsError` ([#&#8203;491](hetznercloud/hcloud-go#491)) ([af59ab8](hetznercloud/hcloud-go@af59ab8))
-   **load-balancer-type:** new traffic price fields ([94e0f44](hetznercloud/hcloud-go@94e0f44))
-   **pricing:** mark traffic field as deprecated ([94e0f44](hetznercloud/hcloud-go@94e0f44))
-   **server-type:** mark included traffic field as deprecated ([94e0f44](hetznercloud/hcloud-go@94e0f44))
-   **server-type:** new traffic price fields ([94e0f44](hetznercloud/hcloud-go@94e0f44))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
  • Loading branch information
Hetzner Cloud Bot authored and jooola committed Jul 25, 2024
1 parent 3c5c68a commit c8b9275
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22
require (
github.com/boumenot/gocover-cobertura v1.2.0
github.com/hashicorp/go-hclog v1.6.3
github.com/hetznercloud/hcloud-go/v2 v2.11.0
github.com/hetznercloud/hcloud-go/v2 v2.12.0
github.com/stretchr/testify v1.9.0
gitlab.com/gitlab-org/fleeting/fleeting v0.0.0-20240723062336-da5f142b3c7d
go.uber.org/mock v0.4.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ github.com/hetznercloud/hcloud-go/v2 v2.10.2 h1:9gyTUPhfNbfbS40Spgij5mV5k37bOZgt
github.com/hetznercloud/hcloud-go/v2 v2.10.2/go.mod h1:xQ+8KhIS62W0D78Dpi57jsufWh844gUw1az5OUvaeq8=
github.com/hetznercloud/hcloud-go/v2 v2.11.0 h1:U1wD58/trMnKO6aHy2i2aguT5USwWbzC2hWj3r2sidE=
github.com/hetznercloud/hcloud-go/v2 v2.11.0/go.mod h1:dhix40Br3fDiBhwaSG/zgaYOFFddpfBm/6R1Zz0IiF0=
github.com/hetznercloud/hcloud-go/v2 v2.12.0 h1:nOgfNTo0gyXZJJdM8mo/XH5MO/e80wAEpldRzdWayhY=
github.com/hetznercloud/hcloud-go/v2 v2.12.0/go.mod h1:dhix40Br3fDiBhwaSG/zgaYOFFddpfBm/6R1Zz0IiF0=
github.com/jcmturner/aescts/v2 v2.0.0 h1:9YKLH6ey7H4eDBXW8khjYslgyqG2xZikXP0EQFKrle8=
github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs=
github.com/jcmturner/dnsutils/v2 v2.0.0 h1:lltnkeZGL0wILNvrNiVCR6Ro5PGU/SeBvVO/8c/iPbo=
Expand Down
2 changes: 1 addition & 1 deletion internal/testutils/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ func MakeTestClient(endpoint string) *hcloud.Client {
opts := []hcloud.ClientOption{
hcloud.WithEndpoint(endpoint),
hcloud.WithRetryOpts(hcloud.RetryOpts{BackoffFunc: hcloud.ConstantBackoff(0), MaxRetries: 3}),
hcloud.WithPollBackoffFunc(hcloud.ConstantBackoff(0)),
hcloud.WithPollOpts(hcloud.PollOpts{BackoffFunc: hcloud.ConstantBackoff(0)}),
}

return hcloud.NewClient(opts...)
Expand Down
12 changes: 7 additions & 5 deletions provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@ func (g *InstanceGroup) Init(ctx context.Context, log hclog.Logger, settings pro
hcloud.WithHTTPClient(&http.Client{
Timeout: 15 * time.Second,
}),
hcloud.WithPollBackoffFunc(hcloud.ExponentialBackoffWithOpts(hcloud.ExponentialBackoffOpts{
Base: time.Second,
Multiplier: 2.0,
Cap: 5 * time.Second,
})),
hcloud.WithPollOpts(hcloud.PollOpts{
BackoffFunc: hcloud.ExponentialBackoffWithOpts(hcloud.ExponentialBackoffOpts{
Base: time.Second,
Multiplier: 2.0,
Cap: 5 * time.Second,
}),
}),
}
if g.Endpoint != "" {
clientOptions = append(clientOptions, hcloud.WithEndpoint(g.Endpoint))
Expand Down

0 comments on commit c8b9275

Please sign in to comment.