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

Support partners in SDK #291

Merged
merged 6 commits into from
Jun 7, 2024
Merged

Support partners in SDK #291

merged 6 commits into from
Jun 7, 2024

Conversation

mgyucht
Copy link
Contributor

@mgyucht mgyucht commented May 17, 2024

Changes

This PR is a port of databricks/databricks-sdk-go#925 to the Java SDK.

Partners of Databricks need a mechanism to register themselves in libraries or applications that they write. In this way, requests made by users of those libraries will include sufficient information to link those requests to the original users.

This PR adds a new function withPartner that can be used by a partner to add partner information to the User-Agent header for requests made by the SDK. The new header will have the form partner/<parther id>. The partner identifier is opaque for the SDK, but it must be alphanumeric.

This PR also lifts the requirement that there may only be a single copy of an entry in the user agent. This allows multiple partners to register themselves in the same library or application.

Additionally, this PR adds validation on keys and values of entries in the user agent to match the Go SDK: alphanumeric keys and alphanumeric or semver values.

Tests

Unit tests cover the implementation of the UserAgent class.

@mgyucht mgyucht changed the title Partner integration Support partners in SDK May 17, 2024
@mgyucht mgyucht requested a review from tanmay-db May 17, 2024 15:21
throw new IllegalArgumentException("Invalid alphanumeric string: " + s);
}

public static boolean matchAlphanumOrSemVer(String s) throws IllegalArgumentException {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Might be better to use above 2 methods here and throw their respective errors for clearer error message on what is invalid (alphanumeric or semver).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can't use the two methods above as-is; that would only work if we needed to validate that something was both alphanumeric or semver.

@mgyucht mgyucht enabled auto-merge June 7, 2024 15:07
@mgyucht mgyucht added this pull request to the merge queue Jun 7, 2024
Merged via the queue into main with commit 0122ba7 Jun 7, 2024
9 checks passed
@mgyucht mgyucht deleted the partner-integration branch June 7, 2024 15:12
hectorcast-db added a commit that referenced this pull request Jun 25, 2024
### Improvements

 * Support partners in headers for SDK ([#291](#291)).
 * Add `serverless_compute_id` field to the config ([#299](#299)).

### Internal Changes

 * Ignore DataPlane Services during generation ([#296](#296)).
 * Update OpenAPI spec ([#297](#297)).
 * Retry failed integration tests ([#298](#298)).

### API Changes:

 * Changed `list()` method for `accountClient.storageCredentials()` service to return `com.databricks.sdk.service.catalog.ListAccountStorageCredentialsResponse` class.
 * Changed `isolationMode` field for `com.databricks.sdk.service.catalog.CatalogInfo` to `com.databricks.sdk.service.catalog.CatalogIsolationMode` class.
 * Added `isolationMode` field for `com.databricks.sdk.service.catalog.ExternalLocationInfo`.
 * Added `maxResults` and `pageToken` fields for `com.databricks.sdk.service.catalog.ListCatalogsRequest`.
 * Added `nextPageToken` field for `com.databricks.sdk.service.catalog.ListCatalogsResponse`.
 * Added `tableServingUrl` field for `com.databricks.sdk.service.catalog.OnlineTable`.
 * Added `isolationMode` field for `com.databricks.sdk.service.catalog.StorageCredentialInfo`.
 * Changed `isolationMode` field for `com.databricks.sdk.service.catalog.UpdateCatalog` to `com.databricks.sdk.service.catalog.CatalogIsolationMode` class.
 * Added `isolationMode` field for `com.databricks.sdk.service.catalog.UpdateExternalLocation`.
 * Added `isolationMode` field for `com.databricks.sdk.service.catalog.UpdateStorageCredential`.
 * Added `com.databricks.sdk.service.catalog.CatalogIsolationMode` and `com.databricks.sdk.service.catalog.ListAccountStorageCredentialsResponse` class.es
 * Added `createSchedule()`, `createSubscription()`, `deleteSchedule()`, `deleteSubscription()`, `getSchedule()`, `getSubscription()`, `list()`, `listSchedules()`, `listSubscriptions()` and `updateSchedule()` methods for `workspaceClient.lakeview()` service.
 * Added `com.databricks.sdk.service.dashboards.CreateScheduleRequest`, `com.databricks.sdk.service.dashboards.CreateSubscriptionRequest`, `com.databricks.sdk.service.dashboards.CronSchedule`, `com.databricks.sdk.service.dashboards.DashboardView`, `com.databricks.sdk.service.dashboards.DeleteScheduleRequest`, `com.databricks.sdk.service.dashboards.DeleteSubscriptionRequest`, `com.databricks.sdk.service.dashboards.GetScheduleRequest`, `com.databricks.sdk.service.dashboards.GetSubscriptionRequest`, `com.databricks.sdk.service.dashboards.ListDashboardsRequest`, `com.databricks.sdk.service.dashboards.ListDashboardsResponse`,`com.databricks.sdk.service.dashboards.ListSchedulesRequest`, `com.databricks.sdk.service.dashboards.ListSchedulesResponse`, `com.databricks.sdk.service.dashboards.ListSubscriptionsRequest`, `com.databricks.sdk.service.dashboards.ListSubscriptionsResponse`, `com.databricks.sdk.service.dashboards.Schedule`, `com.databricks.sdk.service.dashboards.SchedulePauseStatus`, `com.databricks.sdk.service.dashboards.Subscriber`, `com.databricks.sdk.service.dashboards.Subscription`, `com.databricks.sdk.service.dashboards.SubscriptionSubscriberDestination`, `com.databricks.sdk.service.dashboards.SubscriptionSubscriberUser`and `com.databricks.sdk.service.dashboards.UpdateScheduleRequest` classes.
 * Added `terminationCategory` field for `com.databricks.sdk.service.jobs.ForEachTaskErrorMessageStats`.
 * Added `onStreamingBacklogExceeded` field for `com.databricks.sdk.service.jobs.JobEmailNotifications`.
 * Added `environmentKey` field for `com.databricks.sdk.service.jobs.RunTask`.
 * Removed `conditionTask`, `dbtTask`, `notebookTask`, `pipelineTask`, `pythonWheelTask`, `runJobTask`, `sparkJarTask`, `sparkPythonTask`, `sparkSubmitTask` and `sqlTask` fields for `com.databricks.sdk.service.jobs.SubmitRun`.
 * Added `environments` field for `com.databricks.sdk.service.jobs.SubmitRun`.
 * Added `dbtTask` field for `com.databricks.sdk.service.jobs.SubmitTask`.
 * Added `environmentKey` field for `com.databricks.sdk.service.jobs.SubmitTask`.
 * Added `onStreamingBacklogExceeded` field for `com.databricks.sdk.service.jobs.TaskEmailNotifications`.
 * Added `periodic` field for `com.databricks.sdk.service.jobs.TriggerSettings`.
 * Added `onStreamingBacklogExceeded` field for `com.databricks.sdk.service.jobs.WebhookNotifications`.
 * Added `com.databricks.sdk.service.jobs.PeriodicTriggerConfiguration` and `com.databricks.sdk.service.jobs.PeriodicTriggerConfigurationTimeUnit` classes.
 * Added `batchGet()` method for `workspaceClient.consumerListings()` service.
 * Added `batchGet()` method for `workspaceClient.consumerProviders()` service.
 * Added `providerSummary` field for `com.databricks.sdk.service.marketplace.Listing`.
 * Added `com.databricks.sdk.service.marketplace.BatchGetListingsRequest`, `com.databricks.sdk.service.marketplace.BatchGetListingsResponse`, `com.databricks.sdk.service.marketplace.BatchGetProvidersRequest`, `com.databricks.sdk.service.marketplace.BatchGetProvidersResponse`, `com.databricks.sdk.service.marketplace.ProviderIconFile`, `com.databricks.sdk.service.marketplace.ProviderIconType`, `com.databricks.sdk.service.marketplace.ProviderListingSummaryInfo` and `com.databricks.sdk.service.oauth2.DataPlaneInfo` classes.
 * Removed `createDeployment()` method for `workspaceClient.apps()` service.
 * Added `deploy()` and `start()` methods for `workspaceClient.apps()` service.
 * Added `workspaceClient.servingEndpointsDataPlane()` service.
 * Added `servicePrincipalId` field for `com.databricks.sdk.service.serving.App`.
 * Added `servicePrincipalName` field for `com.databricks.sdk.service.serving.App`.
 * Added `mode` field for `com.databricks.sdk.service.serving.AppDeployment`.
 * Added `mode` field for `com.databricks.sdk.service.serving.CreateAppDeploymentRequest`.
 * Added `dataPlaneInfo` field for `com.databricks.sdk.service.serving.ServingEndpointDetailed`.
 * Added `com.databricks.sdk.service.serving.AppDeploymentMode` class.
 * Added `com.databricks.sdk.service.serving.ModelDataPlaneInfo` class.
 * Added `com.databricks.sdk.service.serving.StartAppRequest` class.
 * Added `queryNextPage()` method for `workspaceClient.vectorSearchIndexes()` service.
 * Added `queryType` field for `com.databricks.sdk.service.vectorsearch.QueryVectorIndexRequest`.
 * Added `nextPageToken` field for `com.databricks.sdk.service.vectorsearch.QueryVectorIndexResponse`.
 * Added `com.databricks.sdk.service.vectorsearch.QueryVectorIndexNextPageRequest` class.

OpenAPI SHA: 7437dabb9dadee402c1fc060df4c1ce8cc5369f0, Date: 2024-06-24
@hectorcast-db hectorcast-db mentioned this pull request Jun 25, 2024
github-merge-queue bot pushed a commit that referenced this pull request Jun 25, 2024
### Improvements
 
* Support partners in headers for SDK
([#291](#291)).
* Add `serverless_compute_id` field to the config
([#299](#299)).


### Internal Changes
 
* Ignore DataPlane Services during generation
([#296](#296)).
* Update OpenAPI spec
([#297](#297)).
* Retry failed integration tests
([#298](#298)).


### API Changes:

* Changed `list()` method for `accountClient.storageCredentials()`
service to return
`com.databricks.sdk.service.catalog.ListAccountStorageCredentialsResponse`
class.
* Changed `isolationMode` field for
`com.databricks.sdk.service.catalog.CatalogInfo` to
`com.databricks.sdk.service.catalog.CatalogIsolationMode` class.
* Added `isolationMode` field for
`com.databricks.sdk.service.catalog.ExternalLocationInfo`.
* Added `maxResults` and `pageToken` fields for
`com.databricks.sdk.service.catalog.ListCatalogsRequest`.
* Added `nextPageToken` field for
`com.databricks.sdk.service.catalog.ListCatalogsResponse`.
* Added `tableServingUrl` field for
`com.databricks.sdk.service.catalog.OnlineTable`.
* Added `isolationMode` field for
`com.databricks.sdk.service.catalog.StorageCredentialInfo`.
* Changed `isolationMode` field for
`com.databricks.sdk.service.catalog.UpdateCatalog` to
`com.databricks.sdk.service.catalog.CatalogIsolationMode` class.
* Added `isolationMode` field for
`com.databricks.sdk.service.catalog.UpdateExternalLocation`.
* Added `isolationMode` field for
`com.databricks.sdk.service.catalog.UpdateStorageCredential`.
* Added `com.databricks.sdk.service.catalog.CatalogIsolationMode` and
`com.databricks.sdk.service.catalog.ListAccountStorageCredentialsResponse`
class.es
* Added `createSchedule()`, `createSubscription()`, `deleteSchedule()`,
`deleteSubscription()`, `getSchedule()`, `getSubscription()`, `list()`,
`listSchedules()`, `listSubscriptions()` and `updateSchedule()` methods
for `workspaceClient.lakeview()` service.
* Added `com.databricks.sdk.service.dashboards.CreateScheduleRequest`,
`com.databricks.sdk.service.dashboards.CreateSubscriptionRequest`,
`com.databricks.sdk.service.dashboards.CronSchedule`,
`com.databricks.sdk.service.dashboards.DashboardView`,
`com.databricks.sdk.service.dashboards.DeleteScheduleRequest`,
`com.databricks.sdk.service.dashboards.DeleteSubscriptionRequest`,
`com.databricks.sdk.service.dashboards.GetScheduleRequest`,
`com.databricks.sdk.service.dashboards.GetSubscriptionRequest`,
`com.databricks.sdk.service.dashboards.ListDashboardsRequest`,
`com.databricks.sdk.service.dashboards.ListDashboardsResponse`,`com.databricks.sdk.service.dashboards.ListSchedulesRequest`,
`com.databricks.sdk.service.dashboards.ListSchedulesResponse`,
`com.databricks.sdk.service.dashboards.ListSubscriptionsRequest`,
`com.databricks.sdk.service.dashboards.ListSubscriptionsResponse`,
`com.databricks.sdk.service.dashboards.Schedule`,
`com.databricks.sdk.service.dashboards.SchedulePauseStatus`,
`com.databricks.sdk.service.dashboards.Subscriber`,
`com.databricks.sdk.service.dashboards.Subscription`,
`com.databricks.sdk.service.dashboards.SubscriptionSubscriberDestination`,
`com.databricks.sdk.service.dashboards.SubscriptionSubscriberUser`and
`com.databricks.sdk.service.dashboards.UpdateScheduleRequest` classes.
* Added `terminationCategory` field for
`com.databricks.sdk.service.jobs.ForEachTaskErrorMessageStats`.
* Added `onStreamingBacklogExceeded` field for
`com.databricks.sdk.service.jobs.JobEmailNotifications`.
* Added `environmentKey` field for
`com.databricks.sdk.service.jobs.RunTask`.
* Removed `conditionTask`, `dbtTask`, `notebookTask`, `pipelineTask`,
`pythonWheelTask`, `runJobTask`, `sparkJarTask`, `sparkPythonTask`,
`sparkSubmitTask` and `sqlTask` fields for
`com.databricks.sdk.service.jobs.SubmitRun`.
* Added `environments` field for
`com.databricks.sdk.service.jobs.SubmitRun`.
* Added `dbtTask` field for
`com.databricks.sdk.service.jobs.SubmitTask`.
* Added `environmentKey` field for
`com.databricks.sdk.service.jobs.SubmitTask`.
* Added `onStreamingBacklogExceeded` field for
`com.databricks.sdk.service.jobs.TaskEmailNotifications`.
* Added `periodic` field for
`com.databricks.sdk.service.jobs.TriggerSettings`.
* Added `onStreamingBacklogExceeded` field for
`com.databricks.sdk.service.jobs.WebhookNotifications`.
* Added `com.databricks.sdk.service.jobs.PeriodicTriggerConfiguration`
and
`com.databricks.sdk.service.jobs.PeriodicTriggerConfigurationTimeUnit`
classes.
* Added `batchGet()` method for `workspaceClient.consumerListings()`
service.
* Added `batchGet()` method for `workspaceClient.consumerProviders()`
service.
* Added `providerSummary` field for
`com.databricks.sdk.service.marketplace.Listing`.
* Added
`com.databricks.sdk.service.marketplace.BatchGetListingsRequest`,
`com.databricks.sdk.service.marketplace.BatchGetListingsResponse`,
`com.databricks.sdk.service.marketplace.BatchGetProvidersRequest`,
`com.databricks.sdk.service.marketplace.BatchGetProvidersResponse`,
`com.databricks.sdk.service.marketplace.ProviderIconFile`,
`com.databricks.sdk.service.marketplace.ProviderIconType`,
`com.databricks.sdk.service.marketplace.ProviderListingSummaryInfo` and
`com.databricks.sdk.service.oauth2.DataPlaneInfo` classes.
* Removed `createDeployment()` method for `workspaceClient.apps()`
service.
* Added `deploy()` and `start()` methods for `workspaceClient.apps()`
service.
 * Added `workspaceClient.servingEndpointsDataPlane()` service.
* Added `servicePrincipalId` field for
`com.databricks.sdk.service.serving.App`.
* Added `servicePrincipalName` field for
`com.databricks.sdk.service.serving.App`.
* Added `mode` field for
`com.databricks.sdk.service.serving.AppDeployment`.
* Added `mode` field for
`com.databricks.sdk.service.serving.CreateAppDeploymentRequest`.
* Added `dataPlaneInfo` field for
`com.databricks.sdk.service.serving.ServingEndpointDetailed`.
 * Added `com.databricks.sdk.service.serving.AppDeploymentMode` class.
 * Added `com.databricks.sdk.service.serving.ModelDataPlaneInfo` class.
 * Added `com.databricks.sdk.service.serving.StartAppRequest` class.
* Added `queryNextPage()` method for
`workspaceClient.vectorSearchIndexes()` service.
* Added `queryType` field for
`com.databricks.sdk.service.vectorsearch.QueryVectorIndexRequest`.
* Added `nextPageToken` field for
`com.databricks.sdk.service.vectorsearch.QueryVectorIndexResponse`.
* Added
`com.databricks.sdk.service.vectorsearch.QueryVectorIndexNextPageRequest`
class.

OpenAPI SHA: 7437dabb9dadee402c1fc060df4c1ce8cc5369f0, Date: 2024-06-24
github-merge-queue bot pushed a commit that referenced this pull request Jul 9, 2024
## Changes
Improve Changelog by grouping changes

## Tests
Recreated latest release Changelog:
```
Release v0.27.0

### Other Changes

 * Add `serverless_compute_id` field to the config ([#299](#299)).
 * Ignore DataPlane Services during generation ([#296](#296)).
 * Release v0.27.0 ([#301](#301)).
 * Retry failed integration tests ([#298](#298)).
 * Support partners in SDK ([#291](#291)).
 * Test parsing of error messages with `int` error codes ([#303](#303)).
 * Update OpenAPI spec ([#297](#297)).


### API Changes:

 * Added `workspaceClient.servingEndpointsDataPlane()` service.
 * Added `deploy()` and `start()` methods for `workspaceClient.apps()` service.
 * Added `batchGet()` method for `workspaceClient.consumerListings()` service.
 * Added `batchGet()` method for `workspaceClient.consumerProviders()` service.
 * Added `createSchedule()`, `createSubscription()`, `deleteSchedule()`, `deleteSubscription()`, `getSchedule()`, `getSubscription()`, `list()`, `listSchedules()`, `listSubscriptions()` and `updateSchedule()` methods for `workspaceClient.lakeview()` service.
 * Added `queryNextPage()` method for `workspaceClient.vectorSearchIndexes()` service.
 * Added `com.databricks.sdk.service.serving.AppDeploymentMode`, `com.databricks.sdk.service.serving.ModelDataPlaneInfo` and `com.databricks.sdk.service.serving.StartAppRequest` classes.
 * Added `com.databricks.sdk.service.catalog.CatalogIsolationMode` and `com.databricks.sdk.service.catalog.ListAccountStorageCredentialsResponse` classes.
 * Added `com.databricks.sdk.service.dashboards.CreateScheduleRequest`, `com.databricks.sdk.service.dashboards.CreateSubscriptionRequest`, `com.databricks.sdk.service.dashboards.CronSchedule`, `com.databricks.sdk.service.dashboards.DashboardView`, `com.databricks.sdk.service.dashboards.DeleteScheduleRequest`, `Object`, `com.databricks.sdk.service.dashboards.DeleteSubscriptionRequest`, `Object`, `com.databricks.sdk.service.dashboards.GetScheduleRequest`, `com.databricks.sdk.service.dashboards.GetSubscriptionRequest`, `com.databricks.sdk.service.dashboards.ListDashboardsRequest`, `com.databricks.sdk.service.dashboards.ListDashboardsResponse`, `com.databricks.sdk.service.dashboards.ListSchedulesRequest`, `com.databricks.sdk.service.dashboards.ListSchedulesResponse`, `com.databricks.sdk.service.dashboards.ListSubscriptionsRequest`, `com.databricks.sdk.service.dashboards.ListSubscriptionsResponse`, `com.databricks.sdk.service.dashboards.Schedule`, `com.databricks.sdk.service.dashboards.SchedulePauseStatus`, `com.databricks.sdk.service.dashboards.Subscriber`, `com.databricks.sdk.service.dashboards.Subscription`, `com.databricks.sdk.service.dashboards.SubscriptionSubscriberDestination`, `com.databricks.sdk.service.dashboards.SubscriptionSubscriberUser` and `com.databricks.sdk.service.dashboards.UpdateScheduleRequest` classes.
 * Added `com.databricks.sdk.service.jobs.PeriodicTriggerConfiguration` and `com.databricks.sdk.service.jobs.PeriodicTriggerConfigurationTimeUnit` classes.
 * Added `com.databricks.sdk.service.marketplace.BatchGetListingsRequest`, `com.databricks.sdk.service.marketplace.BatchGetListingsResponse`, `com.databricks.sdk.service.marketplace.BatchGetProvidersRequest`, `com.databricks.sdk.service.marketplace.BatchGetProvidersResponse`, `com.databricks.sdk.service.marketplace.ProviderIconFile`, `com.databricks.sdk.service.marketplace.ProviderIconType` and `com.databricks.sdk.service.marketplace.ProviderListingSummaryInfo` classes.
 * Added `com.databricks.sdk.service.oauth2.DataPlaneInfo` class.
 * Added `com.databricks.sdk.service.vectorsearch.QueryVectorIndexNextPageRequest` class.
 * Added `isolationMode` field for `com.databricks.sdk.service.catalog.ExternalLocationInfo`.
 * Added `maxResults` and `pageToken` fields for `com.databricks.sdk.service.catalog.ListCatalogsRequest`.
 * Added `nextPageToken` field for `com.databricks.sdk.service.catalog.ListCatalogsResponse`.
 * Added `tableServingUrl` field for `com.databricks.sdk.service.catalog.OnlineTable`.
```
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