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: add new WithPollOpts client option #493

Merged
merged 1 commit into from
Jul 24, 2024
Merged

feat: add new WithPollOpts client option #493

merged 1 commit into from
Jul 24, 2024

Conversation

jooola
Copy link
Member

@jooola jooola commented Jul 23, 2024

  • Improve consistency with the pattern used with WithRetryOpts,
  • Use the PollOpts struct, which is more future-proof than function arguments (properties can be added without breaking),
  • Update docs to use the latest WithPollOpts instead of the deprecated alternative.

Since we already changed the way to configure the retry options, I think it is a good time to also change the pattern for the poll opts, even if this does not really bring a new feature.

@jooola jooola requested a review from a team as a code owner July 23, 2024 14:38
Copy link

codecov bot commented Jul 23, 2024

Codecov Report

Attention: Patch coverage is 25.00000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 71.47%. Comparing base (cf9fdaf) to head (d3b3b05).

Files Patch % Lines
hcloud/client.go 25.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #493      +/-   ##
==========================================
- Coverage   71.53%   71.47%   -0.06%     
==========================================
  Files          46       46              
  Lines        3910     3916       +6     
==========================================
+ Hits         2797     2799       +2     
- Misses        699      704       +5     
+ Partials      414      413       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jooola jooola merged commit 2c1a2d6 into main Jul 24, 2024
4 checks passed
@jooola jooola deleted the new-with-poll-opts branch July 24, 2024 12:00
apricote added a commit that referenced this pull request Jul 25, 2024
🤖 I have created a release *beep* *boop*
---


##
[2.12.0](v2.11.0...v2.12.0)
(2024-07-25)


### Features

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

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Julian Tölle <[email protected]>
apricote pushed a commit to hetznercloud/fleeting-plugin-hetzner that referenced this pull request Sep 12, 2024
…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-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants