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

[Internal] Add support for asynchronous data plane token refreshes #1142

Merged
merged 5 commits into from
Feb 7, 2025

Conversation

renaudhartert-db
Copy link
Contributor

@renaudhartert-db renaudhartert-db commented Feb 6, 2025

DO NOT MERGE: api.go and impl.go are here to help with review and will be removed before merge. These are supposed to be added later on via code generation.

What changes are proposed in this pull request?

This PR is a step towards enabling asynchronous refreshes of data plane tokens.

The PR introduces a new interface dataplane.EndpointTokenSource which returns data plane tokens for a given endpoint and authorization detail. The default implementation relies on auth.NewCachedTokenSource to wrap the underlying TokenSources.

Note: async refreshes are disabled at the moment and will be enabled in a follow-up PR.

About Config.GetTokenSource():

My first attempt to implement GetTokenSource() returned an error if the TokenSource could not be built (e.g. because of config initialization errors). This didn't work because:

  1. service constructors do not return errors and thus had to panic;
  2. service constructors are called systematically as soon as the WorkspaceClient is created — sometimes with a config that is not compatible with GetTokenSource().

Returning a TokenSource provider instead of a TokenSource would have solved the problem but did not feel right. The current solution (i.e. return an ever-failing token source) is the cleanest solution I could think off.

How is this tested?

Complete unit test coverage of the new package.

Verified

This commit was signed with the committer’s verified signature.
renaudhartert-db Renaud Hartert
fmt

Verified

This commit was signed with the committer’s verified signature.
renaudhartert-db Renaud Hartert

Verified

This commit was signed with the committer’s verified signature.
renaudhartert-db Renaud Hartert

Verified

This commit was signed with the committer’s verified signature.
renaudhartert-db Renaud Hartert
@renaudhartert-db renaudhartert-db changed the title [Internal] New Dataplane Access [Internal] Add support for asynchronous data plane refreshes. Feb 7, 2025
@renaudhartert-db renaudhartert-db changed the title [Internal] Add support for asynchronous data plane refreshes. [Internal] Add support for asynchronous data plane token refreshes Feb 7, 2025

Verified

This commit was signed with the committer’s verified signature.
renaudhartert-db Renaud Hartert
Copy link

github-actions bot commented Feb 7, 2025

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-go

Inputs:

  • PR number: 1142
  • Commit SHA: 2a236927e1b4c64e30125245c00d858f40a407f4

Checks will be approved automatically on success.

@renaudhartert-db renaudhartert-db added this pull request to the merge queue Feb 7, 2025
Merged via the queue into main with commit 815cace Feb 7, 2025
15 checks passed
@renaudhartert-db renaudhartert-db deleted the renaud.hartert/dpts branch February 7, 2025 12:47
hectorcast-db added a commit that referenced this pull request Feb 11, 2025

Verified

This commit was signed with the committer’s verified signature.
### New Features and Improvements

 * Enable async refreshes for OAuth tokens ([#1143](#1143)).

### Internal Changes

 * Add support for asynchronous data plane token refreshes ([#1142](#1142)).
 * Introduce new TokenSource interface that takes a `context.Context` ([#1141](#1141)).

### API Changes:

 * Added `GetMessageQueryResultByAttachment` method for [w.Genie](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/dashboards#GenieAPI) workspace-level service.
 * Added `Id` field for [apps.App](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/apps#App).
 * Added `LimitConfig` field for [billing.UpdateBudgetPolicyRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/billing#UpdateBudgetPolicyRequest).
 * Added `Volumes` field for [compute.ClusterLogConf](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/compute#ClusterLogConf).
 * Added .
 * Removed `ReviewState`, `Reviews` and `RunnerCollaborators` fields for [cleanrooms.CleanRoomAssetNotebook](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/cleanrooms#CleanRoomAssetNotebook).

OpenAPI SHA: 99f644e72261ef5ecf8d74db20f4b7a1e09723cc, Date: 2025-02-11
hectorcast-db added a commit that referenced this pull request Feb 11, 2025

Verified

This commit was signed with the committer’s verified signature.
 * Enable async refreshes for OAuth tokens ([#1143](#1143)).

 * Add support for asynchronous data plane token refreshes ([#1142](#1142)).
 * Introduce new TokenSource interface that takes a `context.Context` ([#1141](#1141)).

 * Added `GetMessageQueryResultByAttachment` method for [w.Genie](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/dashboards#GenieAPI) workspace-level service.
 * Added `Id` field for [apps.App](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/apps#App).
 * Added `LimitConfig` field for [billing.UpdateBudgetPolicyRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/billing#UpdateBudgetPolicyRequest).
 * Added `Volumes` field for [compute.ClusterLogConf](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/compute#ClusterLogConf).
 * Added .
 * Removed `ReviewState`, `Reviews` and `RunnerCollaborators` fields for [cleanrooms.CleanRoomAssetNotebook](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/cleanrooms#CleanRoomAssetNotebook).

OpenAPI SHA: 99f644e72261ef5ecf8d74db20f4b7a1e09723cc, Date: 2025-02-11
github-merge-queue bot pushed a commit that referenced this pull request Feb 11, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
### New Features and Improvements

* Enable async refreshes for OAuth tokens
([#1143](#1143)).


### Internal Changes

* Add support for asynchronous data plane token refreshes
([#1142](#1142)).
* Introduce new TokenSource interface that takes a `context.Context`
([#1141](#1141)).


### API Changes:

* Added `GetMessageQueryResultByAttachment` method for
[w.Genie](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/dashboards#GenieAPI)
workspace-level service.
* Added `Id` field for
[apps.App](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/apps#App).
* Added `LimitConfig` field for
[billing.UpdateBudgetPolicyRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/billing#UpdateBudgetPolicyRequest).
* Added `Volumes` field for
[compute.ClusterLogConf](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/compute#ClusterLogConf).
* [Breaking] Removed `ReviewState`, `Reviews` and `RunnerCollaborators`
fields for
[cleanrooms.CleanRoomAssetNotebook](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/cleanrooms#CleanRoomAssetNotebook).

OpenAPI SHA: 99f644e72261ef5ecf8d74db20f4b7a1e09723cc, Date: 2025-02-11
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.

None yet

2 participants