hetznercloud / hcloud-go

A Go library for the Hetzner Cloud API
https://pkg.go.dev/github.com/hetznercloud/hcloud-go/v2/hcloud
MIT License
390 stars 45 forks source link

feat(exp): add `actionutil.AllForResource` #522

Closed jooola closed 11 hours ago

jooola commented 2 months ago

Allow the users to fetch actions related to a specific resource.

This may be used as follows:

actions, err := actionutil.AllForResource(ctx,
    client.Firewall.Action,
    hcloud.ActionListOpts{Status: []hcloud.ActionStatus{hcloud.ActionStatusRunning}},
    hcloud.ActionResourceTypeServer, server.ID,
)
if err != nil {
    return err
}
if err := client.Action.WaitFor(ctx, actions...); err != nil {
    return err
}
codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.

Project coverage is 71.47%. Comparing base (743eabb) to head (824cb91). Report is 24 commits behind head on main.

Files with missing lines Patch % Lines
hcloud/exp/actionutil/actions.go 77.77% 1 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #522 +/- ## ========================================== + Coverage 71.46% 71.47% +0.01% ========================================== Files 46 46 Lines 3935 3944 +9 ========================================== + Hits 2812 2819 +7 - Misses 710 711 +1 - Partials 413 414 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


🚨 Try these New Features:

jooola commented 2 months ago

Here is an example: https://github.com/hetznercloud/packer-plugin-hcloud/compare/main...tmp-use-actionutil.allforresource