Add ARM poller helper under azure_core::http::poller::resource_manager#4508
Add ARM poller helper under azure_core::http::poller::resource_manager#4508Copilot wants to merge 12 commits into
azure_core::http::poller::resource_manager#4508Conversation
Co-authored-by: heaths <1532486+heaths@users.noreply.github.com>
Co-authored-by: heaths <1532486+heaths@users.noreply.github.com>
azure_core::http::poller::resource_manager
heaths
left a comment
There was a problem hiding this comment.
Also make sure to format and lint code per instructions.
…#4510) Thanks for the feedback on #4508. I've created this new PR, which merges into #4508, to address your comment. I will work on the changes and keep this PR's description up to date as I make progress. Original PR: #4508 Triggering reviews: - #4508 (comment) > @copilot expand on these monikers better, like "async" should mention the `azure-asyncoperation` header. - #4508 (comment) > @copilot since we clone the `initial_request` above as well as its URL, I don't think we need to clone `resource_url` here yet again. Can't we just `initial_request.url().clone()` here? - #4508 (comment) > @copilot make sure we cover all test cases for async, body, and loc directories for `*_test.go` files under https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/azcore/internal/pollers. - #4508 (comment) > @copilot this field shouldn't be necessary. Undo changes related to this `state` field and I'll handle that in a separate PR. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: heaths <1532486+heaths@users.noreply.github.com>
Co-authored-by: heaths <1532486+heaths@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds an ARM-specific long-running-operation (LRO) poller helper under azure_core::http::poller::resource_manager, aiming to centralize ARM polling heuristics (async/body/location) behind a single entrypoint and provide mock-based test coverage.
Changes:
- Introduces
azure_core::http::poller::resource_manager::new_poller(...)implementing ARM header/body heuristics and relative/absolute URL handling. - Adds a new
resource_managermodule to the publichttp::pollernamespace. - Adds mock HTTP tests covering async, body, and location patterns plus some terminal/failure cases.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| sdk/core/azure_core/src/http/poller/resource_manager/mod.rs | New ARM heuristic poller implementation and link-resolution helpers. |
| sdk/core/azure_core/src/http/poller/resource_manager/tests.rs | New mock-based tests for common ARM LRO polling patterns. |
| sdk/core/azure_core/src/http/poller.rs | Exposes the new resource_manager module. |
Co-authored-by: heaths <1532486+heaths@users.noreply.github.com>
@copilot also make sure to format and lint changed code. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: heaths <1532486+heaths@users.noreply.github.com>
Addressed in d2d0b84. I ran |
heaths
left a comment
There was a problem hiding this comment.
"ARM" and "LRO" are not good in customer-facing error messages. Use "resource manager" instead of "ARM" and "poller" or "long-running operation" instead of "LRO" where appropriate i.e., "poller" when referring to the code itself or "long-running operation" when referring to service behavior.
Co-authored-by: heaths <1532486+heaths@users.noreply.github.com>
Co-authored-by: heaths <1532486+heaths@users.noreply.github.com>
Co-authored-by: heaths <1532486+heaths@users.noreply.github.com>
heaths
left a comment
There was a problem hiding this comment.
I'll pull down and finish it myself.
I can’t edit the PR title directly with the tools available here, but this would match the current implementation: Title: Description: |
azure_core::http::poller::resource_managerazure_core::http::poller::resource_manager
Fixed references to "ARM" and "LRO" to be more user-friendly in user-facing errors. Also made sure to always set the `api-version` query parameter which should be universal for all ARM operations.
azure_core::http::poller::resource_managerazure_core::http::poller::resource_manager
|
Discussed offline: I'll create an |
Adds
azure_core::http::poller::resource_manager::new_poller(...)for resource manager long-running operations.The helper selects polling behavior heuristically from
azure-asyncoperation,operation-location,location, or the original resource URL fallback. It also resolves relative and absolute poll/final URLs, avoids deserializing a monitor for empty terminal bodies, and returns explicit errors for failed or canceled terminal states.This change also adds focused mock-based coverage for async, body,
operation-location, andlocationpolling paths insdk/core/azure_core/src/http/poller/resource_manager/tests.rs.Co-authored-by: Heath Stewart heaths@microsoft.com