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

Make new workspace client from account client #218

Merged
merged 5 commits into from
Feb 2, 2024

Conversation

mgyucht
Copy link
Contributor

@mgyucht mgyucht commented Feb 1, 2024

@mgyucht mgyucht requested a review from hectorcast-db February 1, 2024 15:44
@@ -53,28 +53,28 @@ public String getActiveDirectoryEndpoint() {
ENVIRONMENTS.put(
"PUBLIC",
new AzureEnvironment(
"AzurePublicCloud",
"PUBLIC",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These names are not currently referred to anywhere.

@@ -83,9 +83,6 @@ public class DatabricksConfig {
@ConfigAttribute(env = "ARM_ENVIRONMENT")
private String azureEnvironment;

@ConfigAttribute(env = "DATABRICKS_AZURE_LOGIN_APP_ID", auth = "azure")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is now derived from the DatabricksEnvironment.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does this impact existing users which are using the env var?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYI: this is only dev/staging users. All prod users use the same login ID. It shouldn't matter because there is only one correct login app ID to use for your workspace, and it is coupled to the environment you're in.

return headers;
};
}

/**
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved from AzureUtils. This logic only applies to Azure SP auth.

import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

class AzureServicePrincipalCredentialsProviderTest {
private static final String TOKEN = "t-123";
private static final String TOKEN_TYPE = "token-type";
public static final String PUBLIC_MANAGEMENT_ENDPOINT = "https://management.core.windows.net/";

private static RefreshableTokenSource mockTokenSource() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now we mock out the HTTP Client response instead of the tokenSourceFor method.

@mgyucht mgyucht added this pull request to the merge queue Feb 2, 2024
Merged via the queue into main with commit dc07492 Feb 2, 2024
9 checks passed
@mgyucht mgyucht deleted the new-workspace-client-from-account-client branch February 2, 2024 10:39
tanmay-db added a commit that referenced this pull request Feb 8, 2024
* Derive config file name from attribute name ([#216](#216)).
* Fix Databricks OAuth U2M on GCP ([#217](#217)).
* Make new workspace client from account client ([#218](#218)).
* Skip `AccountClientIT` test in GCP / Azure ([#222](#222)).
* Only include request body when the OpenAPI operation indicates that there is a request body ([#223](#223)).
* Generate SDK ([#226](#226)).

API Changes:

 * Added `cancelRefresh()` method for `workspaceClient.lakehouseMonitors()` service.
 * Added `getRefresh()` method for `workspaceClient.lakehouseMonitors()` service.
 * Added `listRefreshes()` method for `workspaceClient.lakehouseMonitors()` service.
 * Added `runRefresh()` method for `workspaceClient.lakehouseMonitors()` service.
 * Removed `name` field for `com.databricks.sdk.service.catalog.UpdateConnection`.
 * Removed `name` field for `com.databricks.sdk.service.catalog.UpdateMetastore`.
 * Removed `name` field for `com.databricks.sdk.service.catalog.UpdateRegisteredModelRequest`.
 * Removed `name` field for `com.databricks.sdk.service.catalog.UpdateSchema`.
 * Removed `name` field for `com.databricks.sdk.service.catalog.UpdateVolumeRequestContent`.
 * Added `com.databricks.sdk.service.catalog.CancelRefreshRequest` class.
 * Added `com.databricks.sdk.service.catalog.GetRefreshRequest` class.
 * Added `com.databricks.sdk.service.catalog.ListRefreshesRequest` class.
 * Added `com.databricks.sdk.service.catalog.MonitorRefreshInfo` class.
 * Added `com.databricks.sdk.service.catalog.MonitorRefreshInfoState` class.
 * Added `com.databricks.sdk.service.catalog.RunRefreshRequest` class.
 * Changed `maxWorkers` field for `com.databricks.sdk.service.compute.AutoScale` to no longer be required.
 * Changed `minWorkers` field for `com.databricks.sdk.service.compute.AutoScale` to no longer be required.
 * Changed `destination` field for `com.databricks.sdk.service.compute.DbfsStorageInfo` to be required.
 * Added `usePreemptibleExecutors` field for `com.databricks.sdk.service.compute.GcpAttributes`.
 * Added `zoneId` field for `com.databricks.sdk.service.compute.GcpAttributes`.
 * Added `abfss` field for `com.databricks.sdk.service.compute.InitScriptInfo`.
 * Added `gcs` field for `com.databricks.sdk.service.compute.InitScriptInfo`.
 * Changed `destination` field for `com.databricks.sdk.service.compute.LocalFileInfo` to be required.
 * Changed `destination` field for `com.databricks.sdk.service.compute.S3StorageInfo` to be required.
 * Changed `destination` field for `com.databricks.sdk.service.compute.VolumesStorageInfo` to be required.
 * Changed `clients` field for `com.databricks.sdk.service.compute.WorkloadType` to be required.
 * Changed `destination` field for `com.databricks.sdk.service.compute.WorkspaceStorageInfo` to be required.
 * Added `com.databricks.sdk.service.compute.Adlsgen2Info` class.
 * Added `com.databricks.sdk.service.compute.GcsStorageInfo` class.
 * Removed `getStatus()` method for `workspaceClient.files()` service.
 * Added `createDirectory()` method for `workspaceClient.files()` service.
 * Added `deleteDirectory()` method for `workspaceClient.files()` service.
 * Added `listDirectoryContents()` method for `workspaceClient.files()` service.
 * Added `com.databricks.sdk.service.files.CreateDirectoryRequest` class.
 * Added `com.databricks.sdk.service.files.DeleteDirectoryRequest` class.
 * Added `com.databricks.sdk.service.files.DirectoryEntry` class.
 * Added `com.databricks.sdk.service.files.ListDirectoryContentsRequest` class.
 * Added `com.databricks.sdk.service.files.ListDirectoryResponse` class.
 * Added `com.databricks.sdk.service.files.PageToken` class.
 * Added `source` field for `com.databricks.sdk.service.jobs.DbtTask`.
 * Added `forEachTask` field for `com.databricks.sdk.service.jobs.RunTask`.
 * Added `source` field for `com.databricks.sdk.service.jobs.SqlTaskFile`.
 * Added `forEachTask` field for `com.databricks.sdk.service.jobs.SubmitTask`.
 * Added `forEachTask` field for `com.databricks.sdk.service.jobs.Task`.
 * Added `com.databricks.sdk.service.jobs.ForEachStats` class.
 * Added `com.databricks.sdk.service.jobs.ForEachTask` class.
 * Added `com.databricks.sdk.service.jobs.ForEachTaskErrorMessageStats` class.
 * Added `com.databricks.sdk.service.jobs.ForEachTaskTaskRunStats` class.
 * Added `com.databricks.sdk.service.jobs.RunForEachTask` class.
 * Removed `reset()` method for `workspaceClient.pipelines()` service.
 * Changed `autoscale` field for `com.databricks.sdk.service.pipelines.PipelineCluster` to `com.databricks.sdk.service.pipelines.PipelineClusterAutoscale` class.
 * Removed `com.databricks.sdk.service.pipelines.ResetRequest` class.
 * Added `com.databricks.sdk.service.pipelines.PipelineClusterAutoscale` class.
 * Added `com.databricks.sdk.service.pipelines.PipelineClusterAutoscaleMode` class.
 * Changed `deletePersonalComputeSetting()` method for `accountClient.settings()` service with new required argument order.
 * Removed `readPersonalComputeSetting()` method for `accountClient.settings()` service.
 * Changed `updatePersonalComputeSetting()` method for `accountClient.settings()` service with new required argument order.
 * Added `getPersonalComputeSetting()` method for `accountClient.settings()` service.
 * Removed `deleteDefaultWorkspaceNamespace()` method for `workspaceClient.settings()` service.
 * Removed `readDefaultWorkspaceNamespace()` method for `workspaceClient.settings()` service.
 * Removed `updateDefaultWorkspaceNamespace()` method for `workspaceClient.settings()` service.
 * Added `deleteDefaultNamespaceSetting()` method for `workspaceClient.settings()` service.
 * Added `deleteRestrictWorkspaceAdminsSetting()` method for `workspaceClient.settings()` service.
 * Added `getDefaultNamespaceSetting()` method for `workspaceClient.settings()` service.
 * Added `getRestrictWorkspaceAdminsSetting()` method for `workspaceClient.settings()` service.
 * Added `updateDefaultNamespaceSetting()` method for `workspaceClient.settings()` service.
 * Added `updateRestrictWorkspaceAdminsSetting()` method for `workspaceClient.settings()` service.
 * Removed `com.databricks.sdk.service.settings.DeleteDefaultWorkspaceNamespaceRequest` class.
 * Removed `com.databricks.sdk.service.settings.DeleteDefaultWorkspaceNamespaceResponse` class.
 * Changed `etag` field for `com.databricks.sdk.service.settings.DeletePersonalComputeSettingRequest` to no longer be required.
 * Removed `com.databricks.sdk.service.settings.ReadDefaultWorkspaceNamespaceRequest` class.
 * Removed `com.databricks.sdk.service.settings.ReadPersonalComputeSettingRequest` class.
 * Removed `com.databricks.sdk.service.settings.UpdateDefaultWorkspaceNamespaceRequest` class.
 * Changed `allowMissing` field for `com.databricks.sdk.service.settings.UpdatePersonalComputeSettingRequest` to be required.
 * Changed `setting` field for `com.databricks.sdk.service.settings.UpdatePersonalComputeSettingRequest` to be required.
 * Added `fieldMask` field for `com.databricks.sdk.service.settings.UpdatePersonalComputeSettingRequest`.
 * Added `com.databricks.sdk.service.settings.DeleteDefaultNamespaceSettingRequest` class.
 * Added `com.databricks.sdk.service.settings.DeleteDefaultNamespaceSettingResponse` class.
 * Added `com.databricks.sdk.service.settings.DeleteRestrictWorkspaceAdminsSettingRequest` class.
 * Added `com.databricks.sdk.service.settings.DeleteRestrictWorkspaceAdminsSettingResponse` class.
 * Added `com.databricks.sdk.service.settings.GetDefaultNamespaceSettingRequest` class.
 * Added `com.databricks.sdk.service.settings.GetPersonalComputeSettingRequest` class.
 * Added `com.databricks.sdk.service.settings.GetRestrictWorkspaceAdminsSettingRequest` class.
 * Added `com.databricks.sdk.service.settings.RestrictWorkspaceAdminsMessage` class.
 * Added `com.databricks.sdk.service.settings.RestrictWorkspaceAdminsMessageStatus` class.
 * Added `com.databricks.sdk.service.settings.RestrictWorkspaceAdminsSetting` class.
 * Added `com.databricks.sdk.service.settings.UpdateDefaultNamespaceSettingRequest` class.
 * Added `com.databricks.sdk.service.settings.UpdateRestrictWorkspaceAdminsSettingRequest` class.
 * Removed `deltaSyncVectorIndexSpec` field for `com.databricks.sdk.service.vectorsearch.CreateVectorIndexRequest`.
 * Added `deltaSyncIndexSpec` field for `com.databricks.sdk.service.vectorsearch.CreateVectorIndexRequest`.
 * Added `fileType` field for `com.databricks.sdk.service.workspace.ExportResponse`.
 * Added `resourceId` field for `com.databricks.sdk.service.workspace.ObjectInfo`.

OpenAPI SHA: 6b897bc95b23abed8b9f5eff0e6b8ec034046180, Date: 2024-02-08

Dependency updates:

 * Bump org.apache.maven.plugins:maven-failsafe-plugin from 3.1.2 to 3.2.5 ([#206](#206)).
@tanmay-db tanmay-db mentioned this pull request Feb 8, 2024
@edwardfeng-db edwardfeng-db mentioned this pull request Feb 8, 2024
github-merge-queue bot pushed a commit that referenced this pull request Feb 9, 2024
## 0.18.0

* Derive config file name from attribute name
([#216](#216)).
* Fix Databricks OAuth U2M on GCP
([#217](#217)).
* Make new workspace client from account client
([#218](#218)).
* Skip `AccountClientIT` test in GCP / Azure
([#222](#222)).
* Only include request body when the OpenAPI operation indicates that
there is a request body
([#223](#223)).
* Generate SDK
([#226](#226)).

API Changes:

Additions:
 * Added the following fields
- Added `usePreemptibleExecutors`, `zoneId` fields for
`com.databricks.sdk.service.compute.GcpAttributes`.
- Added `abfss`, `gcs` fields for
`com.databricks.sdk.service.compute.InitScriptInfo`.
- Added `source` field for `com.databricks.sdk.service.jobs.DbtTask`.
- Added `forEachTask` field for
`com.databricks.sdk.service.jobs.RunTask`.
- Added `source` field for
`com.databricks.sdk.service.jobs.SqlTaskFile`.
- Added `forEachTask` field for
`com.databricks.sdk.service.jobs.SubmitTask`.
- Added `forEachTask` field for `com.databricks.sdk.service.jobs.Task`.
- Added `fieldMask` field for
`com.databricks.sdk.service.settings.UpdatePersonalComputeSettingRequest`.
- Added `deltaSyncIndexSpec` field for
`com.databricks.sdk.service.vectorsearch.CreateVectorIndexRequest`.
- Added `fileType` field for
`com.databricks.sdk.service.workspace.ExportResponse`.
- Added `resourceId` field for
`com.databricks.sdk.service.workspace.ObjectInfo`.
 * Added the following methods
- Added `cancelRefresh()`, `getRefresh()`, `listRefreshes()`,
`runRefresh()` methods for `workspaceClient.lakehouseMonitors()`
service.
- Added `createDirectory()`, `deleteDirectory()`,
`listDirectoryContents()` methods for `workspaceClient.files()` service.
- Added `getPersonalComputeSetting()` method for
`accountClient.settings()` service.
- Added `deleteDefaultNamespaceSetting()`,
`deleteRestrictWorkspaceAdminsSetting()`,
`getDefaultNamespaceSetting()`, `getRestrictWorkspaceAdminsSetting()`,
`updateDefaultNamespaceSetting()`,
`updateRestrictWorkspaceAdminsSetting()` methods for
`workspaceClient.settings()` service.
 * Added the following classes
- Added `com.databricks.sdk.service.catalog.CancelRefreshRequest` class.
   - Added `com.databricks.sdk.service.catalog.GetRefreshRequest` class.
- Added `com.databricks.sdk.service.catalog.ListRefreshesRequest` class.
- Added `com.databricks.sdk.service.catalog.MonitorRefreshInfo` class.
- Added `com.databricks.sdk.service.catalog.MonitorRefreshInfoState`
class.
   - Added `com.databricks.sdk.service.catalog.RunRefreshRequest` class.
   - Added `com.databricks.sdk.service.compute.Adlsgen2Info` class. 
   - Added `com.databricks.sdk.service.compute.GcsStorageInfo` class.
- Added `com.databricks.sdk.service.files.CreateDirectoryRequest` class.
- Added `com.databricks.sdk.service.files.DeleteDirectoryRequest` class.
   - Added `com.databricks.sdk.service.files.DirectoryEntry` class. 
- Added `com.databricks.sdk.service.files.ListDirectoryContentsRequest`
class.
- Added `com.databricks.sdk.service.files.ListDirectoryResponse` class.
   - Added `com.databricks.sdk.service.files.PageToken` class. 
   - Added `com.databricks.sdk.service.jobs.ForEachStats` class. 
   - Added `com.databricks.sdk.service.jobs.ForEachTask` class. 
- Added `com.databricks.sdk.service.jobs.ForEachTaskErrorMessageStats`
class.
- Added `com.databricks.sdk.service.jobs.ForEachTaskTaskRunStats` class.
   - Added `com.databricks.sdk.service.jobs.RunForEachTask` class.
- Added `com.databricks.sdk.service.pipelines.PipelineClusterAutoscale`
class.
- Added
`com.databricks.sdk.service.pipelines.PipelineClusterAutoscaleMode`
class.
- Added
`com.databricks.sdk.service.settings.DeleteDefaultNamespaceSettingRequest`
class.
- Added
`com.databricks.sdk.service.settings.DeleteDefaultNamespaceSettingResponse`
class.
- Added
`com.databricks.sdk.service.settings.DeleteRestrictWorkspaceAdminsSettingRequest`
class.
- Added
`com.databricks.sdk.service.settings.DeleteRestrictWorkspaceAdminsSettingResponse`
class.
- Added
`com.databricks.sdk.service.settings.GetDefaultNamespaceSettingRequest`
class.
- Added
`com.databricks.sdk.service.settings.GetPersonalComputeSettingRequest`
class.
- Added
`com.databricks.sdk.service.settings.GetRestrictWorkspaceAdminsSettingRequest`
class.
- Added
`com.databricks.sdk.service.settings.RestrictWorkspaceAdminsMessage`
class.
- Added
`com.databricks.sdk.service.settings.RestrictWorkspaceAdminsMessageStatus`
class.
- Added
`com.databricks.sdk.service.settings.RestrictWorkspaceAdminsSetting`
class.
- Added
`com.databricks.sdk.service.settings.UpdateDefaultNamespaceSettingRequest`
class.
- Added
`com.databricks.sdk.service.settings.UpdateRestrictWorkspaceAdminsSettingRequest`
class.

Removals:
 * Removed the following fields
- Removed `name` field for
`com.databricks.sdk.service.catalog.UpdateConnection`.
- Removed `name` field for
`com.databricks.sdk.service.catalog.UpdateMetastore`.
- Removed `name` field for
`com.databricks.sdk.service.catalog.UpdateRegisteredModelRequest`.
- Removed `name` field for
`com.databricks.sdk.service.catalog.UpdateSchema`.
- Removed `name` field for
`com.databricks.sdk.service.catalog.UpdateVolumeRequestContent`.
- Removed `deltaSyncVectorIndexSpec` field for
`com.databricks.sdk.service.vectorsearch.CreateVectorIndexRequest`.
 * Removed the following methods
- Removed `getStatus()` method for `workspaceClient.files()` service.
- Removed `reset()` method for `workspaceClient.pipelines()` service.
- Removed `readPersonalComputeSetting()` method for
`accountClient.settings()` service.
- Removed `deleteDefaultWorkspaceNamespace()`,
`readDefaultWorkspaceNamespace()`, `updateDefaultWorkspaceNamespace()`
methods for `workspaceClient.settings()` service.
 * Removed the following classes
   - Removed `com.databricks.sdk.service.pipelines.ResetRequest` class.
- Removed
`com.databricks.sdk.service.settings.DeleteDefaultWorkspaceNamespaceRequest`
class.
- Removed
`com.databricks.sdk.service.settings.DeleteDefaultWorkspaceNamespaceResponse`
class.
- Changed `etag` field for
`com.databricks.sdk.service.settings.DeletePersonalComputeSettingRequest`
to no longer be required.
- Removed
`com.databricks.sdk.service.settings.ReadDefaultWorkspaceNamespaceRequest`
class.
- Removed
`com.databricks.sdk.service.settings.ReadPersonalComputeSettingRequest`
class.
- Removed
`com.databricks.sdk.service.settings.UpdateDefaultWorkspaceNamespaceRequest`
class.




Changes:
 * Changed the following fields
- Changed `maxWorkers`, `minWorkers` fields for
`com.databricks.sdk.service.compute.AutoScale` to no longer be required.
- Changed `destination` field for
`com.databricks.sdk.service.compute.DbfsStorageInfo` to be required.
- Changed `destination` field for
`com.databricks.sdk.service.compute.LocalFileInfo` to be required.
- Changed `destination` field for
`com.databricks.sdk.service.compute.S3StorageInfo` to be required.
- Changed `destination` field for
`com.databricks.sdk.service.compute.VolumesStorageInfo` to be required.
- Changed `clients` field for
`com.databricks.sdk.service.compute.WorkloadType` to be required.
- Changed `destination` field for
`com.databricks.sdk.service.compute.WorkspaceStorageInfo` to be
required.
- Changed `autoscale` field for
`com.databricks.sdk.service.pipelines.PipelineCluster` to
`com.databricks.sdk.service.pipelines.PipelineClusterAutoscale` class.
- Changed `allowMissing`, `setting` fields for
`com.databricks.sdk.service.settings.UpdatePersonalComputeSettingRequest`
to be required.
 * Changed the following methods 
- Changed `deletePersonalComputeSetting()`,
`updatePersonalComputeSetting()` methods for `accountClient.settings()`
service with new required argument order.

OpenAPI SHA: 6b897bc95b23abed8b9f5eff0e6b8ec034046180, Date: 2024-02-08

Dependency updates:

* Bump org.apache.maven.plugins:maven-failsafe-plugin from 3.1.2 to
3.2.5
([#206](#206)).
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