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: support resource-specific Action endpoints #295

Merged
merged 2 commits into from
Aug 24, 2023

Conversation

apricote
Copy link
Member

@apricote apricote commented Jul 21, 2023

Related to https://docs.hetzner.cloud/changelog#2023-06-29-resource-action-endpoints

The existing ActionClient has two purposes:

  • Expose the GET /v1/actions & GET /v1/actions/:id endpoints
  • Provider helper methods for waiting on running actions

The new resource-specific endpoints do not need the helper methods, so I have refactored the code for the endpoints into the ResourceActionClient. This client is exposed by all resources that have actions as client.Server.Action. In addition, I have replaced the implementation of the two endpoints in ActionClient by forwarding them to an instance of ResourceActionClient.

@apricote apricote self-assigned this Jul 21, 2023
@apricote apricote marked this pull request as ready for review August 24, 2023 11:07
@apricote apricote requested a review from a team as a code owner August 24, 2023 11:07
@apricote apricote added Feature backport release-1.x Open PR against release-1.x with these changes after the PR is merged. labels Aug 24, 2023
@apricote apricote merged commit ddc2ac4 into main Aug 24, 2023
5 checks passed
@apricote apricote deleted the product-specific-actions branch August 24, 2023 12:46
@github-actions
Copy link
Contributor

The backport to release-1.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-release-1.x release-1.x
# Navigate to the new working tree
cd .worktrees/backport-release-1.x
# Create a new branch
git switch --create backport-295-to-release-1.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 ddc2ac45489c48a7563806c425222236ab1f8aa0
# Push it to GitHub
git push --set-upstream origin backport-295-to-release-1.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-release-1.x

Then, create a pull request where the base branch is release-1.x and the compare/head branch is backport-295-to-release-1.x.

apricote added a commit that referenced this pull request Aug 24, 2023
Related to https://docs.hetzner.cloud/changelog#2023-06-29-resource-action-endpoints

The existing ActionClient has two purposes:

- Expose the GET /v1/actions & GET /v1/actions/:id endpoints
- Provider helper methods for waiting on running actions

The new resource-specific endpoints do not need the helper methods, so I have refactored the code for the endpoints into the ResourceActionClient. This client is exposed by all resources that have actions as client.Server.Action. In addition, I have replaced the implementation of the two endpoints in ActionClient by forwarding them to an instance of ResourceActionClient.

(cherry picked from commit ddc2ac4)
apricote added a commit that referenced this pull request Aug 24, 2023
Related to https://docs.hetzner.cloud/changelog#2023-06-29-resource-action-endpoints

The existing ActionClient has two purposes:

- Expose the GET /v1/actions & GET /v1/actions/:id endpoints
- Provider helper methods for waiting on running actions

The new resource-specific endpoints do not need the helper methods, so I have refactored the code for the endpoints into the ResourceActionClient. This client is exposed by all resources that have actions as client.Server.Action. In addition, I have replaced the implementation of the two endpoints in ActionClient by forwarding them to an instance of ResourceActionClient.

(cherry picked from commit ddc2ac4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport release-1.x Open PR against release-1.x with these changes after the PR is merged. Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants