-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Labels
surferIssues related to the surfer project (https://github.com/googleapis/librarian/issues/2375)Issues related to the surfer project (https://github.com/googleapis/librarian/issues/2375)
Milestone
Description
The generator currently only considers the first pattern (Patterns[0]) defined for a resource. Many Google Cloud APIs, such as Cloud Logging, define multiple patterns for a single resource to support different parent hierarchies (e.g., Project, Folder, Organization).
Context & Rationale
- Proto Definition:
google.api.resourceallows multiplepatternstrings.option (google.api.resource) = { type: "logging.googleapis.com/LogSink" pattern: "projects/{project}/sinks/{sink}" pattern: "organizations/{organization}/sinks/{sink}" // ... };
- gcloud Schema: The
multitype_resource_specdefinition allows an argument to resolve against multiple resource collections, generating mutually exclusive parent flags (e.g.,--projectvs--organization). - Current Limitation:
builder.gohardcodes the selection of the first pattern, making it impossible to generate commands that support the full flexibility of the API. - AIP-123 & AIP-124 Provide guidance for pattern uniqueness and conventions.
Implementation Considerations
- Detection: Check if
len(resource.Patterns) > 1. - Mapping: Iterate through all patterns. Each pattern corresponds to a distinct gcloud collection path (e.g.,
logging.projects.sinks,logging.organizations.sinks). - Generation:
- If multiple patterns exist, construct a
multitype_resource_spec. - Populate its
resourceslist with aresource_specfor each pattern. - Ensure attributes (like
project,organization) are correctly derived for each sub-spec.
- If multiple patterns exist, construct a
- Dispatch Pattern Alignment:: Issue refactor(internal/python): replace command mocks and add GitHub action #3365 should be taken into consideration when designing a pattern for this feature.
Relevant files
internal/surfer/gcloud/builder.gogcloud_command_schema.yaml
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
surferIssues related to the surfer project (https://github.com/googleapis/librarian/issues/2375)Issues related to the surfer project (https://github.com/googleapis/librarian/issues/2375)