Skip to content

Commit

Permalink
Breakout variable lookup into separate files and tests (#1921)
Browse files Browse the repository at this point in the history
## Changes

While looking into adding variable lookups for notification destinations
([API][API]), I found the codegen approach for different classes of
variable lookups a bit complex. The template had a custom field override
(for service principals), the package had an override for the cluster
lookup, and it didn't produce tests.

The notification destinations API uses a default page size of 20 for
listing. I want to use a larger page size to limit the number of API
calls, so that would imply another customization on the template or a
manual override.

This code being rather mechanical, I used copilot to produce all
instances of the resolvers and their tests (after writing one of them
manually).

[api]: https://docs.databricks.com/api/workspace/notificationdestinations

## Tests

* Unit tests pass
* Manual confirmation that lookups of warehouses still work
  • Loading branch information
pietern authored Nov 21, 2024
1 parent 984c38e commit 14fe03d
Show file tree
Hide file tree
Showing 27 changed files with 885 additions and 426 deletions.
3 changes: 1 addition & 2 deletions .codegen.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
},
"batch": {
".codegen/cmds-workspace.go.tmpl": "cmd/workspace/cmd.go",
".codegen/cmds-account.go.tmpl": "cmd/account/cmd.go",
".codegen/lookup.go.tmpl": "bundle/config/variable/lookup.go"
".codegen/cmds-account.go.tmpl": "cmd/account/cmd.go"
},
"toolchain": {
"required": ["go"],
Expand Down
134 changes: 0 additions & 134 deletions .codegen/lookup.go.tmpl

This file was deleted.

1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
bundle/config/variable/lookup.go linguist-generated=true
cmd/account/access-control/access-control.go linguist-generated=true
cmd/account/billable-usage/billable-usage.go linguist-generated=true
cmd/account/budgets/budgets.go linguist-generated=true
Expand Down
Loading

0 comments on commit 14fe03d

Please sign in to comment.