Skip to content

Commit

Permalink
Ignore DataPlane Services during generation (#663)
Browse files Browse the repository at this point in the history
## Changes
Ignore DataPlane Services during generation until proper support is
implemented


## Tests
Generated SDK using local universe (which contains DataPlane services)

- [X] `make test` passing
- [X] `make fmt` applied
- [ ] relevant integration tests applied
  • Loading branch information
hectorcast-db authored May 31, 2024
1 parent 7f71835 commit a714146
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 6 additions & 6 deletions .codegen/__init__.py.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ from databricks.sdk.credentials_provider import CredentialsStrategy
from databricks.sdk.mixins.files import DbfsExt
from databricks.sdk.mixins.compute import ClustersExt
from databricks.sdk.mixins.workspace import WorkspaceExt
{{- range .Services}}
from databricks.sdk.service.{{.Package.Name}} import {{.PascalName}}API{{end}}
{{- range .Services}} {{if not .IsDataPlane}}
from databricks.sdk.service.{{.Package.Name}} import {{.PascalName}}API{{end}}{{end}}
from databricks.sdk.service.provisioning import Workspace
from databricks.sdk import azure

Expand Down Expand Up @@ -61,7 +61,7 @@ class WorkspaceClient:
self._dbutils = _make_dbutils(self._config)
self._api_client = client.ApiClient(self._config)

{{- range .Services}}{{if and (not .IsAccounts) (not .HasParent)}}
{{- range .Services}}{{if and (not .IsAccounts) (not .HasParent) (not .IsDataPlane)}}
self._{{.SnakeName}} = {{template "api" .}}(self._api_client){{end -}}{{end}}

@property
Expand All @@ -76,7 +76,7 @@ class WorkspaceClient:
def dbutils(self) -> dbutils.RemoteDbUtils:
return self._dbutils

{{- range .Services}}{{if and (not .IsAccounts) (not .HasParent)}}
{{- range .Services}}{{if and (not .IsAccounts) (not .HasParent) (not .IsDataPlane)}}
@property
def {{.SnakeName}}(self) -> {{template "api" .}}:
{{if .Description}}"""{{.Summary}}"""{{end}}
Expand Down Expand Up @@ -117,7 +117,7 @@ class AccountClient:
self._config = config.copy()
self._api_client = client.ApiClient(self._config)

{{- range .Services}}{{if and .IsAccounts (not .HasParent)}}
{{- range .Services}}{{if and .IsAccounts (not .HasParent) (not .IsDataPlane)}}
self._{{(.TrimPrefix "account").SnakeName}} = {{template "api" .}}(self._api_client){{end -}}{{end}}

@property
Expand All @@ -128,7 +128,7 @@ class AccountClient:
def api_client(self) -> client.ApiClient:
return self._api_client

{{- range .Services}}{{if and .IsAccounts (not .HasParent)}}
{{- range .Services}}{{if and .IsAccounts (not .HasParent) (not .IsDataPlane)}}
@property
def {{(.TrimPrefix "account").SnakeName}}(self) -> {{template "api" .}}:{{if .Description}}
"""{{.Summary}}"""{{end}}
Expand Down
3 changes: 2 additions & 1 deletion .codegen/service.py.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class {{.PascalName}}{{if eq "List" .PascalName}}Request{{end}}:{{if .Descriptio
{{- end -}}
{{- end -}}

{{range .Services}}
{{range .Services}} {{if not .IsDataPlane}}
class {{.PascalName}}API:{{if .Description}}
"""{{.Comment " " 110}}"""
{{end}}
Expand Down Expand Up @@ -195,6 +195,7 @@ class {{.PascalName}}API:{{if .Description}}
return self.{{template "safe-snake-name" .}}({{range $i, $x := .Request.Fields}}{{if $i}}, {{end}}{{template "safe-snake-name" .}}={{template "safe-snake-name" .}}{{end}}).result(timeout=timeout)
{{end}}
{{end -}}
{{end}}
{{- end}}

{{define "method-parameters" -}}
Expand Down

0 comments on commit a714146

Please sign in to comment.