-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set necessary headers when authenticating via Azure CLI #136
Set necessary headers when authenticating via Azure CLI #136
Conversation
LOG.debug("Not including service management token in headers", e); | ||
mgmtTokenSource = null; | ||
} | ||
CliTokenSource finalMgmtTokenSource = mgmtTokenSource; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is final about it? Seems like the alias is not necessary below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Java compiler doesn't allow capturing non-final variables in closures. https://www.baeldung.com/java-lambda-effectively-final-local-variables#capturing-lambdas
* Added support for `dbutils.secrets` ([#132](#132)). * Added retry in `w.clusters().ensureClusterIsRunning(id)` when cluster is simultaneously started by two different processes ([#134](#134)). * Set necessary headers when authenticating via Azure CLI ([#136](#136)). New Services: * Added `workspaceClient.artifactAllowlists()` service. * Added `workspaceClient.securableTags()` service. * Added `workspaceClient.subentityTags()` service. * Added `com.databricks.sdk.service.catalog.ArtifactAllowlistInfo` class. * Added `com.databricks.sdk.service.catalog.ArtifactMatcher` class. * Added `com.databricks.sdk.service.catalog.ArtifactType` class. * Added `com.databricks.sdk.service.catalog.GetArtifactAllowlistRequest` class. * Added `com.databricks.sdk.service.catalog.ListSecurableTagsRequest` class. * Added `com.databricks.sdk.service.catalog.ListSecurableType` class. * Added `com.databricks.sdk.service.catalog.ListSubentityTagsRequest` class. * Added `com.databricks.sdk.service.catalog.MatchType` class. * Added `com.databricks.sdk.service.catalog.SetArtifactAllowlist` class. * Added `com.databricks.sdk.service.catalog.TagChanges` class. * Added `com.databricks.sdk.service.catalog.TagKeyValuePair` class. * Added `com.databricks.sdk.service.catalog.TagSecurable` class. * Added `com.databricks.sdk.service.catalog.TagSecurableAssignment` class. * Added `com.databricks.sdk.service.catalog.TagSecurableAssignmentsList` class. * Added `com.databricks.sdk.service.catalog.TagSubentity` class. * Added `com.databricks.sdk.service.catalog.TagSubentityAssignmentsList` class. * Added `com.databricks.sdk.service.catalog.TagsSubentityAssignment` class. * Added `com.databricks.sdk.service.catalog.UpdateSecurableType` class. * Added `com.databricks.sdk.service.catalog.UpdateTags` class. New APIs: * Added `deleteRuns()` method for `workspaceClient.experiments()` service. * Added `restoreRuns()` method for `workspaceClient.experiments()` service. * Added `com.databricks.sdk.service.ml.DeleteRuns` class. * Added `com.databricks.sdk.service.ml.DeleteRunsResponse` class. * Added `com.databricks.sdk.service.ml.RestoreRuns` class. * Added `com.databricks.sdk.service.ml.RestoreRunsResponse` class. * Added `getSecret()` method for `workspaceClient.secrets()` service. * Added `com.databricks.sdk.service.workspace.GetSecretRequest` class. * Added `com.databricks.sdk.service.workspace.GetSecretResponse` class. API Renames: * Renamed `effectiveAutoMaintenanceFlag` field to `effectivePredictiveOptimizationFlag` field for `com.databricks.sdk.service.catalog.CatalogInfo`. * Renamed `enableAutoMaintenance` field to `enablePredictiveOptimization` field for `com.databricks.sdk.service.catalog.CatalogInfo`. * Renamed `com.databricks.sdk.service.catalog.EffectiveAutoMaintenanceFlag` class to `com.databricks.sdk.service.catalog.EffectivePredictiveOptimizationFlag` class. * Renamed `com.databricks.sdk.service.catalog.EffectiveAutoMaintenanceFlagInheritedFromType` class to `com.databricks.sdk.service.catalog.EffectivePredictiveOptimizationFlagInheritedFromType`. * Renamed `com.databricks.sdk.service.catalog.EnableAutoMaintenance` class to `com.databricks.sdk.service.catalog.EnablePredictiveOptimization`. * Renamed `effectiveAutoMaintenanceFlag` field to `effectivePredictiveOptimizationFlag` field for `com.databricks.sdk.service.catalog.SchemaInfo`. * Renamed `enableAutoMaintenance` field to `enablePredictiveOptimization` field for `com.databricks.sdk.service.catalog.SchemaInfo`. * Renamed `effectiveAutoMaintenanceFlag` field to `effectivePredictiveOptimizationFlag` field for `com.databricks.sdk.service.catalog.TableInfo`. * Renamed `enableAutoMaintenance` field to `enablePredictiveOptimization` field for `com.databricks.sdk.service.catalog.TableInfo`. OpenAPI SHA: beff621d7b3e1d59244e2e34fc53a496f310e130, Date: 2023-08-17
* Added support for `dbutils.secrets` ([#132](#132)). * Added retry in `w.clusters().ensureClusterIsRunning(id)` when cluster is simultaneously started by two different processes ([#134](#134)). * Set necessary headers when authenticating via Azure CLI ([#136](#136)). New Services: * Added `workspaceClient.artifactAllowlists()` service. * Added `workspaceClient.securableTags()` service. * Added `workspaceClient.subentityTags()` service. * Added `com.databricks.sdk.service.catalog.ArtifactAllowlistInfo` class. * Added `com.databricks.sdk.service.catalog.ArtifactMatcher` class. * Added `com.databricks.sdk.service.catalog.ArtifactType` class. * Added `com.databricks.sdk.service.catalog.GetArtifactAllowlistRequest` class. * Added `com.databricks.sdk.service.catalog.ListSecurableTagsRequest` class. * Added `com.databricks.sdk.service.catalog.ListSecurableType` class. * Added `com.databricks.sdk.service.catalog.ListSubentityTagsRequest` class. * Added `com.databricks.sdk.service.catalog.MatchType` class. * Added `com.databricks.sdk.service.catalog.SetArtifactAllowlist` class. * Added `com.databricks.sdk.service.catalog.TagChanges` class. * Added `com.databricks.sdk.service.catalog.TagKeyValuePair` class. * Added `com.databricks.sdk.service.catalog.TagSecurable` class. * Added `com.databricks.sdk.service.catalog.TagSecurableAssignment` class. * Added `com.databricks.sdk.service.catalog.TagSecurableAssignmentsList` class. * Added `com.databricks.sdk.service.catalog.TagSubentity` class. * Added `com.databricks.sdk.service.catalog.TagSubentityAssignmentsList` class. * Added `com.databricks.sdk.service.catalog.TagsSubentityAssignment` class. * Added `com.databricks.sdk.service.catalog.UpdateSecurableType` class. * Added `com.databricks.sdk.service.catalog.UpdateTags` class. New APIs: * Added `deleteRuns()` method for `workspaceClient.experiments()` service. * Added `restoreRuns()` method for `workspaceClient.experiments()` service. * Added `com.databricks.sdk.service.ml.DeleteRuns` class. * Added `com.databricks.sdk.service.ml.DeleteRunsResponse` class. * Added `com.databricks.sdk.service.ml.RestoreRuns` class. * Added `com.databricks.sdk.service.ml.RestoreRunsResponse` class. * Added `getSecret()` method for `workspaceClient.secrets()` service. * Added `com.databricks.sdk.service.workspace.GetSecretRequest` class. * Added `com.databricks.sdk.service.workspace.GetSecretResponse` class. API Renames: * Renamed `effectiveAutoMaintenanceFlag` field to `effectivePredictiveOptimizationFlag` field for `com.databricks.sdk.service.catalog.CatalogInfo`. * Renamed `enableAutoMaintenance` field to `enablePredictiveOptimization` field for `com.databricks.sdk.service.catalog.CatalogInfo`. * Renamed `com.databricks.sdk.service.catalog.EffectiveAutoMaintenanceFlag` class to `com.databricks.sdk.service.catalog.EffectivePredictiveOptimizationFlag` class. * Renamed `com.databricks.sdk.service.catalog.EffectiveAutoMaintenanceFlagInheritedFromType` class to `com.databricks.sdk.service.catalog.EffectivePredictiveOptimizationFlagInheritedFromType`. * Renamed `com.databricks.sdk.service.catalog.EnableAutoMaintenance` class to `com.databricks.sdk.service.catalog.EnablePredictiveOptimization`. * Renamed `effectiveAutoMaintenanceFlag` field to `effectivePredictiveOptimizationFlag` field for `com.databricks.sdk.service.catalog.SchemaInfo`. * Renamed `enableAutoMaintenance` field to `enablePredictiveOptimization` field for `com.databricks.sdk.service.catalog.SchemaInfo`. * Renamed `effectiveAutoMaintenanceFlag` field to `effectivePredictiveOptimizationFlag` field for `com.databricks.sdk.service.catalog.TableInfo`. * Renamed `enableAutoMaintenance` field to `enablePredictiveOptimization` field for `com.databricks.sdk.service.catalog.TableInfo`. OpenAPI SHA: beff621d7b3e1d59244e2e34fc53a496f310e130, Date: 2023-08-17
Changes
The Java SDK request authentication logic is inconsistent between the Azure login types: for service principal auth, the SDK correctly adds the X-Databricks-Azure-Workspace-Resource-Id when configured, but this is missed for Azure CLI auth. Additionally, when logging in via Azure CLI using a service principal, the service management token must also be fetched from the CLI.
This PR fixes this by defining the logic to attach these header in a common function that is used by all Azure-specific authentication types.
See databricks/databricks-sdk-go#584 for the same change in the Go SDK.
See databricks/databricks-sdk-py#290 for the same changes in the Python SDK.
Tests