buildDatabaseFilter builds a CEL filter expression for ListDatabases.
(database, instance, project string)
| 63 | |
| 64 | // buildDatabaseFilter builds a CEL filter expression for ListDatabases. |
| 65 | func buildDatabaseFilter(database, instance, project string) string { |
| 66 | // name.contains does substring matching server-side. |
| 67 | filter := fmt.Sprintf("name.contains(%q)", database) |
| 68 | if instance != "" { |
| 69 | filter += fmt.Sprintf(" && instance == %q", "instances/"+instance) |
| 70 | } |
| 71 | if project != "" { |
| 72 | filter += fmt.Sprintf(" && project == %q", "projects/"+project) |
| 73 | } |
| 74 | return filter |
| 75 | } |
| 76 | |
| 77 | // listDatabases lists databases matching the filter in the user's workspace. |
| 78 | // Uses the workspace ID from the JWT token stored in context. |
no outgoing calls