Skip to content
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

Use same logic as Go SDK for DatabricksConfig.isAzure() #174

Merged
merged 7 commits into from
Oct 25, 2023

Conversation

mgyucht
Copy link
Contributor

@mgyucht mgyucht commented Oct 25, 2023

Changes

The current isAzure() logic only checks if ".azuredatabricks." is contained in the hostname, which fails for workspaces in other Azure environments. This PR copies the logic directly from the Go SDK: https://github.com/databricks/databricks-sdk-go/blob/main/config/config.go#L142

Tests

  • Some unit tests ensuring that isAzure() returns the right values for various hosts, including AWS, Azure public, Azure US Gov, and Azure China.

@mgyucht mgyucht requested a review from tanmay-db October 25, 2023 09:33
@@ -463,7 +463,9 @@ public boolean isAzure() {
if (host == null) {
return false;
}
return host.contains(".azuredatabricks.");
return host.contains(".azuredatabricks.net")
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious -- why do we need to limit it to .net?

Copy link
Contributor Author

@mgyucht mgyucht Oct 25, 2023

Choose a reason for hiding this comment

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

I'm just matching the Go SDK logic here. I don't think we use any other TLDs for public cloud.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see

@mgyucht mgyucht added this pull request to the merge queue Oct 25, 2023
Merged via the queue into main with commit a4f4fdb Oct 25, 2023
9 checks passed
@mgyucht mgyucht deleted the fix-azure-mooncake branch October 25, 2023 10:11
mgyucht added a commit that referenced this pull request Oct 25, 2023
* Adjust token expiry window to 40 seconds because of Azure ([#170](#170)).
* Use same logic as Go SDK for DatabricksConfig.isAzure() ([#174](#174)).

API Changes:

 * Added `attributes`, `count`, `excludedAttributes`, `filter`, `sortBy`, `sortOrder`, and `startIndex` fields for `com.databricks.sdk.service.iam.GetAccountUserRequest` and `com.databricks.sdk.service.iam.GetUserRequest`.
 * Added `schemas` field for `com.databricks.sdk.service.iam.Group`, `com.databricks.sdk.service.iam.ListGroupsResponse`, `com.databricks.sdk.service.iam.ListServicePrincipalResponse`, `com.databricks.sdk.service.iam.ListUsersResponse`, `com.databricks.sdk.service.iam.ServicePrincipal`, and `com.databricks.sdk.service.iam.User`.
 * Added `com.databricks.sdk.service.iam.GetSortOrder`, `com.databricks.sdk.service.iam.GroupSchema`, `com.databricks.sdk.service.iam.ListResponseSchema`, `com.databricks.sdk.service.iam.ServicePrincipalSchema`, and `com.databricks.sdk.service.iam.UserSchema` class.
 * Added `webhookNotifications` field for `com.databricks.sdk.service.jobs.SubmitTask`.
 * Added `workspaceClient.apps()` service and related classes.
 * Added `accountClient.networkPolicy()` service and related classes.

OpenAPI SHA: 5903bb39137fd76ac384b2044e425f9c56840e00, Date: 2023-10-23

Dependency updates:

 * Bump org.junit:junit-bom from 5.9.3 to 5.10.0 ([#124](#124)).
 * Bump org.slf4j:slf4j-api from 2.0.7 to 2.0.9 ([#146](#146)).
 * Bump org.slf4j:slf4j-reload4j from 2.0.7 to 2.0.9 ([#147](#147)).
 * Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.5.0 to 3.6.0 ([#156](#156)).
@mgyucht mgyucht mentioned this pull request Oct 25, 2023
github-merge-queue bot pushed a commit that referenced this pull request Oct 25, 2023
* Adjust token expiry window to 40 seconds because of Azure
([#170](#170)).
* Use same logic as Go SDK for DatabricksConfig.isAzure()
([#174](#174)).

API Changes:

* Added `attributes`, `count`, `excludedAttributes`, `filter`, `sortBy`,
`sortOrder`, and `startIndex` fields for
`com.databricks.sdk.service.iam.GetAccountUserRequest` and
`com.databricks.sdk.service.iam.GetUserRequest`.
* Added `schemas` field for `com.databricks.sdk.service.iam.Group`,
`com.databricks.sdk.service.iam.ListGroupsResponse`,
`com.databricks.sdk.service.iam.ListServicePrincipalResponse`,
`com.databricks.sdk.service.iam.ListUsersResponse`,
`com.databricks.sdk.service.iam.ServicePrincipal`, and
`com.databricks.sdk.service.iam.User`.
* Added `com.databricks.sdk.service.iam.GetSortOrder`,
`com.databricks.sdk.service.iam.GroupSchema`,
`com.databricks.sdk.service.iam.ListResponseSchema`,
`com.databricks.sdk.service.iam.ServicePrincipalSchema`, and
`com.databricks.sdk.service.iam.UserSchema` class.
* Added `webhookNotifications` field for
`com.databricks.sdk.service.jobs.SubmitTask`.
 * Added `workspaceClient.apps()` service and related classes.
 * Added `accountClient.networkPolicy()` service and related classes.

OpenAPI SHA: 5903bb39137fd76ac384b2044e425f9c56840e00, Date: 2023-10-23

Dependency updates:

* Bump org.junit:junit-bom from 5.9.3 to 5.10.0
([#124](#124)).
* Bump org.slf4j:slf4j-api from 2.0.7 to 2.0.9
([#146](#146)).
* Bump org.slf4j:slf4j-reload4j from 2.0.7 to 2.0.9
([#147](#147)).
* Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.5.0 to 3.6.0
([#156](#156)).
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