feat(compute): generate resource_name with sidekick#4826
Closed
haphungw wants to merge 3 commits intogoogleapis:mainfrom
Closed
feat(compute): generate resource_name with sidekick#4826haphungw wants to merge 3 commits intogoogleapis:mainfrom
haphungw wants to merge 3 commits intogoogleapis:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4826 +/- ##
==========================================
- Coverage 95.02% 95.01% -0.02%
==========================================
Files 204 204
Lines 7877 7877
==========================================
- Hits 7485 7484 -1
- Misses 392 393 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
haphungw
added a commit
to googleapis/librarian
that referenced
this pull request
Feb 25, 2026
When generating the `Template` for resource names, the parser was incorrectly capturing preceding elements in the HTTP URL (e.g., `/v1`).
Adding `firstIndex` tracking allows the parser to identify when the valid `collection/id` chain begin.
The next PRs will add the necessary blocks in `transport.rs.mustache`.
The generated Rust snippets should look like something below:
```
#[cfg(google_cloud_unstable_resource_name)]
let options = if let Some(resource_name) = (|| {
Some(format!(
"//compute.googleapis.com/projects/{}/zones/{}/acceleratorTypes/{}",
Some(&req)
.map(|m| &m.project)
.map(|s| s.as_str())
.filter(|s| !s.is_empty())?,
Some(&req)
.map(|m| &m.zone)
.map(|s| s.as_str())
.filter(|s| !s.is_empty())?,
Some(&req)
.map(|m| &m.accelerator_type)
.map(|s| s.as_str())
.filter(|s| !s.is_empty())?,
))
})() {
use google_cloud_gax::options::internal::{RequestOptionsExt, ResourceName};
options.insert_extension(ResourceName(resource_name))
} else {
options
};
```
Staged at: googleapis/google-cloud-rust#4826
For #4018
coryan
reviewed
Feb 27, 2026
Contributor
coryan
left a comment
There was a problem hiding this comment.
nit: the PR title is wrong, and you may want to try DNS first, it would be easier to review.
c44b709 to
388343a
Compare
388343a to
2836b8c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is a demo of the generated Rust code for resource_name within
google-cloud-compute-v1.