Skip to content

direct: refactor permissions objectIDRef into helper with if-elseif-else#5007

Open
janniklasrose wants to merge 3 commits intomainfrom
janniklasrose/direct-resources-prefix-ifelse
Open

direct: refactor permissions objectIDRef into helper with if-elseif-else#5007
janniklasrose wants to merge 3 commits intomainfrom
janniklasrose/direct-resources-prefix-ifelse

Conversation

@janniklasrose
Copy link
Copy Markdown
Contributor

Summary

  • Extracts the objectIDRef helper from PreparePermissionsInputConfig to consolidate three sequential independent if strings.HasPrefix reassignments into a single if-elseif-else chain.
  • No behaviour change; the logic is identical.

Test plan

  • Existing unit tests pass (make test)

This pull request and its description were written by Isaac.

func objectIDRef(prefix, baseNode string) string {
// Model serving endpoints use an internal numeric ID for permissions (not the name used in CRUD APIs).
if strings.HasPrefix(baseNode, "resources.model_serving_endpoints.") {
return prefix + "${" + baseNode + ".endpoint_id}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be a map perhaps? model_serving_endpoints -> endpoint_id, etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants