Skip to content

Conversation

@jooola
Copy link
Member

@jooola jooola commented Dec 16, 2025

  • Adds client.<resource_client>.Action.ListFor(ctx, resource, opts) method to list actions for a resource.
  • Adds client.<resource_client>.Action.AllFor(ctx, resource, opts) method to list all actions for a resource.

ResourceActionClient now has a generic type parameter

The ResourceActionClient struct now has a generic type parameter. The type parameter is used to describe the API resource of the Actions client.

The IResourceActionClient interface that is generated from the ResourceActionClient struct, is also affected by this change.

The API was never intended to be used directly and we did not find any usage of it in public code. So while potentially breaking, the benefits of this change out weighted the risks of doing it.

@jooola jooola requested a review from a team as a code owner December 16, 2025 11:28
@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

❌ Patch coverage is 48.00000% with 39 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.42%. Comparing base (ff50def) to head (b09f1ea).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
hcloud/certificate.go 0.00% 4 Missing ⚠️
hcloud/firewall.go 0.00% 4 Missing ⚠️
hcloud/floating_ip.go 0.00% 4 Missing ⚠️
hcloud/image.go 0.00% 4 Missing ⚠️
hcloud/load_balancer.go 0.00% 4 Missing ⚠️
hcloud/network.go 0.00% 4 Missing ⚠️
hcloud/server.go 0.00% 4 Missing ⚠️
hcloud/storage_box.go 0.00% 4 Missing ⚠️
hcloud/volume.go 0.00% 4 Missing ⚠️
hcloud/action.go 85.71% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #791      +/-   ##
==========================================
- Coverage   80.01%   79.42%   -0.60%     
==========================================
  Files          60       60              
  Lines        4494     4553      +59     
==========================================
+ Hits         3596     3616      +20     
- Misses        596      634      +38     
- Partials      302      303       +1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@lukasmetzner lukasmetzner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍 You can ignore the comment

@phm07
Copy link
Contributor

phm07 commented Dec 18, 2025

Is there maybe a way to ensure that resources implement the ResourceWithPathID interface? I could see this being accidentally missed for future resources.

@jooola
Copy link
Member Author

jooola commented Dec 18, 2025

Is there maybe a way to ensure that resources implement the ResourceWithPathID interface? I could see this being accidentally missed for future resources.

We can have a check that the resource implements the interface. Tests would be the best way to check this.

@jooola jooola force-pushed the actions-list-for-resource branch from af24d1f to c1e2083 Compare December 19, 2025 15:30
@jooola jooola force-pushed the actions-list-for-resource branch from c1e2083 to c29ea99 Compare December 29, 2025 15:42
@apricote apricote force-pushed the actions-list-for-resource branch from c29ea99 to 06abfbb Compare January 7, 2026 11:03
@apricote
Copy link
Member

apricote commented Jan 7, 2026

I think the benefits of adding a generic type parameter to ResourceActionClient outweigh the actual impact of it. I did not find any project outside of the CLI that would need to be updated in my search on Sourcegraph and GitHub.

We should still highlight this in the release notes. The usage of the private interface as a constraint for the type parameter should be evaluated in the CLI.

@jooola jooola force-pushed the actions-list-for-resource branch from ef5060a to 5f14cb0 Compare January 7, 2026 11:37
@jooola jooola requested review from apricote and lukasmetzner and removed request for apricote January 7, 2026 11:44
@jooola
Copy link
Member Author

jooola commented Jan 7, 2026

Just tried this branch in the CLI project, and no change are required to make this work.

jooola and others added 10 commits January 7, 2026 15:55
- Adds `client.<resource_client>.Action.ListFor(ctx, id, opts)` method to list actions for a resource identified with the given id.
- Adds `client.<resource_client>.Action.AllFor(ctx, id, opts)` method to list all actions for a resource identified with the given id.
@jooola jooola force-pushed the actions-list-for-resource branch from 8d29ed5 to b09f1ea Compare January 7, 2026 14:56
@jooola jooola merged commit 2f1b2b6 into main Jan 7, 2026
4 checks passed
@jooola jooola deleted the actions-list-for-resource branch January 7, 2026 15:00
jooola pushed a commit that referenced this pull request Jan 8, 2026
<!-- section-start changelog -->
### `ResourceActionClient` now has a generic type parameter

The
[`ResourceActionClient`](https://pkg.go.dev/github.com/hetznercloud/hcloud-go/v2/hcloud#ResourceActionClient)
struct now has a generic type parameter. The type parameter is used to
describe the API resource of the Actions client.

The
[`IResourceActionClient`](https://pkg.go.dev/github.com/hetznercloud/hcloud-go/v2/hcloud#IResourceActionClient)
interface that is generated from the
[`ResourceActionClient`](https://pkg.go.dev/github.com/hetznercloud/hcloud-go/v2/hcloud#ResourceActionClient)
struct, is also affected by this change.

This API was never intended to be used directly and we did not find any
usage of it in public code. So while potentially breaking, the benefits
of this change out weighted the risks of doing it.

### Features

- retry request on API `timeout` error (#797)
- list actions for a given resource (#791)

<!-- section-end changelog -->

---

<details>
<summary><h4>PR by <a
href="https://github.com/apricote/releaser-pleaser">releaser-pleaser</a>
🤖</h4></summary>

If you want to modify the proposed release, add you overrides here. You
can learn more about the options in the docs.

## Release Notes

### Prefix / Start

This will be added to the start of the release notes.

~~~~rp-prefix
### `ResourceActionClient` now has a generic type parameter

The
[`ResourceActionClient`](https://pkg.go.dev/github.com/hetznercloud/hcloud-go/v2/hcloud#ResourceActionClient)
struct now has a generic type parameter. The type parameter is used to
describe the API resource of the Actions client.

The
[`IResourceActionClient`](https://pkg.go.dev/github.com/hetznercloud/hcloud-go/v2/hcloud#IResourceActionClient)
interface that is generated from the
[`ResourceActionClient`](https://pkg.go.dev/github.com/hetznercloud/hcloud-go/v2/hcloud#ResourceActionClient)
struct, is also affected by this change.

This API was never intended to be used directly and we did not find any
usage of it in public code. So while potentially breaking, the benefits
of this change out weighted the risks of doing it.
~~~~

### Suffix / End

This will be added to the end of the release notes.

~~~~rp-suffix
~~~~

</details>

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
apricote pushed a commit to hetznercloud/fleeting-plugin-hetzner that referenced this pull request Jan 8, 2026
…4.0 (hetznercloud/fleeting-plugin-hetzner!330)

This MR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [github.com/hetznercloud/hcloud-go/v2](https://github.com/hetznercloud/hcloud-go) | `v2.33.0` → `v2.34.0` | ![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fhetznercloud%2fhcloud-go%2fv2/v2.34.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fhetznercloud%2fhcloud-go%2fv2/v2.33.0/v2.34.0?slim=true) |

---

### Release Notes

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

### [`v2.34.0`](https://github.com/hetznercloud/hcloud-go/blob/HEAD/CHANGELOG.md#v2340)

[Compare Source](hetznercloud/hcloud-go@v2.33.0...v2.34.0)

##### `ResourceActionClient` now has a generic type parameter

The [`ResourceActionClient`](https://pkg.go.dev/github.com/hetznercloud/hcloud-go/v2/hcloud#ResourceActionClient) struct now has a generic type parameter. The type parameter is used to describe the API resource of the Actions client.

The [`IResourceActionClient`](https://pkg.go.dev/github.com/hetznercloud/hcloud-go/v2/hcloud#IResourceActionClient) interface that is generated from the [`ResourceActionClient`](https://pkg.go.dev/github.com/hetznercloud/hcloud-go/v2/hcloud#ResourceActionClient) struct, is also affected by this change.

This API was never intended to be used directly and we did not find any usage of it in public code. So while potentially breaking, the benefits of this change out weighted the risks of doing it.

##### Features

- retry request on API `timeout` error ([#&#8203;797](hetznercloud/hcloud-go#797))
- list actions for a given resource ([#&#8203;791](hetznercloud/hcloud-go#791))

</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 is behind base branch, 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:eyJjcmVhdGVkSW5WZXIiOiI0Mi43NC4zIiwidXBkYXRlZEluVmVyIjoiNDIuNzQuMyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
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.

5 participants