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

[PECO-1542] Add support for proxy #242

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
452aaba
Add support for proxy
vikrantpuppala Feb 27, 2024
f08250a
add support for negotiate kerberos auth for proxy
vikrantpuppala Mar 14, 2024
05c2638
Add basic support for HTTP proxies (#241)
mgyucht Feb 26, 2024
bc4f65e
Added tokei.rs lines of code badge (#243)
nfx Feb 28, 2024
e40a1de
Update SDK to latest OpenAPI spec (#245)
tanmay-db Mar 4, 2024
bfbc121
Release v0.20.0 (#246)
tanmay-db Mar 4, 2024
6447fc7
Release v0.21.0 (#250)
edwardfeng-db Mar 20, 2024
6cea2eb
new class to provide proxy to http client
vikrantpuppala Mar 26, 2024
bbc41ae
remove changes to DatabricksConfig
vikrantpuppala Mar 26, 2024
0a4f113
comments
vikrantpuppala Mar 28, 2024
126bf73
comments
vikrantpuppala Apr 9, 2024
be52b65
fmt
vikrantpuppala Apr 9, 2024
3b79ab4
fix build
vikrantpuppala Apr 9, 2024
480e55e
fmt
vikrantpuppala Apr 9, 2024
243392f
Properly escape multi-segment path parameters (#252)
mgyucht Mar 28, 2024
bb0adcc
Release v0.22.0 (#253)
hectorcast-db Apr 2, 2024
70847f8
Lock around field accessibility changes (#247)
webmakersteve Apr 2, 2024
a21882f
Introduce more specific exceptions, like `NotFound`, `AlreadyExists`,…
nfx Apr 4, 2024
84b9fa2
Fix Changelog (#258)
hectorcast-db Apr 5, 2024
972b304
Support post with no body for APIs (#262)
mgyucht Apr 9, 2024
4ab4fd0
Override INVALID_PARAMETER_VALUE on fetching non-existent job/cluster…
mgyucht Apr 11, 2024
2a57a7b
Release v0.23.0 (#263)
mgyucht Apr 12, 2024
8bdc601
[PECO-1008] Add retry strategy based on idempotency of requests (#264)
vikrantpuppala Apr 12, 2024
c6a0ff7
Fix remaining Java integration tests (#265)
mgyucht Apr 18, 2024
b7fa8df
comments
vikrantpuppala Apr 19, 2024
b41ed29
address comments
vikrantpuppala Mar 20, 2024
610533e
fmt, tests
vikrantpuppala Mar 20, 2024
009a458
fix checks
vikrantpuppala Mar 20, 2024
e927632
address comments
vikrantpuppala Mar 25, 2024
cd86996
fix checks
vikrantpuppala Mar 25, 2024
983526f
add javadoc
vikrantpuppala Apr 19, 2024
3bd1715
fix test
vikrantpuppala Apr 19, 2024
6d6e2ec
change fn name
vikrantpuppala Apr 22, 2024
e2ec646
Fix one-shot list APIs to not return null (#266)
mgyucht Apr 19, 2024
4677878
Remove unnecessary secret from example (#267)
mgyucht Apr 22, 2024
37c161a
Fix one shot pagination (#268)
mgyucht Apr 22, 2024
a2549d9
Update SDK to OpenAPI spec (#269)
tanmay-db Apr 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 6 additions & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@
".codegen/api.java.tmpl": "databricks-sdk-java/src/main/java/com/databricks/sdk/service/{{.Package.Name}}/{{.PascalName}}API.java",
".codegen/impl.java.tmpl": "databricks-sdk-java/src/main/java/com/databricks/sdk/service/{{.Package.Name}}/{{.PascalName}}Impl.java"
},
"exception_types": {
".codegen/exception.java.tmpl": "databricks-sdk-java/src/main/java/com/databricks/sdk/core/error/platform/{{.PascalName}}.java"
},
"batch": {
".codegen/workspace.java.tmpl": "databricks-sdk-java/src/main/java/com/databricks/sdk/WorkspaceClient.java",
".codegen/account.java.tmpl": "databricks-sdk-java/src/main/java/com/databricks/sdk/AccountClient.java"
".codegen/account.java.tmpl": "databricks-sdk-java/src/main/java/com/databricks/sdk/AccountClient.java",
".codegen/error-mapper.java.tmpl": "databricks-sdk-java/src/main/java/com/databricks/sdk/core/error/ErrorMapper.java",
".codegen/error-overrides.java.tmpl": "databricks-sdk-java/src/main/java/com/databricks/sdk/core/error/ErrorOverrides.java"
},
"version": {
"pom.xml": "<artifactId>databricks-sdk-parent</artifactId>\n <version>$VERSION</version>",
Expand Down
2 changes: 1 addition & 1 deletion .codegen/_openapi_sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
23fe1139476cb1a8c7b8ff2ff1fbc0132380f7a5
06d330f43d92c1be864d4638c672cd0723e20a51
76 changes: 42 additions & 34 deletions .codegen/api.java.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -146,47 +146,55 @@ public class {{.PascalName}}API {
{{- end}}

{{define "method-call-paginated" -}}
{{- if .Pagination.MultiRequest -}}
{{- if and .Pagination.Offset (not (eq .Path "/api/2.0/clusters/events")) -}}
request.set{{.Pagination.Offset.PascalName}}(
{{- if eq .Pagination.Increment 1 -}}
1
{{- else if contains .Path "/scim/v2/" -}}
1
{{- else -}}
0
{{- end}}L);{{end -}}
{{if and .Pagination.Limit (contains .Path "/scim/v2/")}}
if (request.get{{.Pagination.Limit.PascalName}}() == null) {
request.set{{.Pagination.Limit.PascalName}}(100L);
}{{end -}}
return new Paginator<>(request, impl::{{template "java-name" .}}, {{template "type" .Response}}::get{{.Pagination.Results.PascalName}}, response -> {
{{if eq .Path "/api/2.0/clusters/events" -}}
return response.getNextPage();
{{- if and .Pagination.Offset (not (eq .Path "/api/2.0/clusters/events")) -}}
request.set{{.Pagination.Offset.PascalName}}(
{{- if eq .Pagination.Increment 1 -}}
1
{{- else if contains .Path "/scim/v2/" -}}
1
{{- else -}}
0
{{- end}}L);{{end -}}
{{if and .Pagination.Limit (contains .Path "/scim/v2/")}}
if (request.get{{.Pagination.Limit.PascalName}}() == null) {
request.set{{.Pagination.Limit.PascalName}}(100L);
}{{end -}}
return new Paginator<>(
{{ if .Request }}request{{ else }}null{{ end }},
{{ if .Request }}impl::{{template "java-name" .}}{{ else }}(Void v) -> impl.{{template "java-name" .}}(){{ end }},
{{template "type" .Response}}::get{{.Pagination.Results.PascalName}},
response ->
{{ if not .Pagination.MultiRequest }}
null
{{- else if eq .Path "/api/2.0/clusters/events" -}}
response.getNextPage()
{{- else if .Pagination.Token -}}
String token = response.get{{.Pagination.Token.Bind.PascalName}}();
if (token == null) {
return null;
{
String token = response.get{{.Pagination.Token.Bind.PascalName}}();
if (token == null) {
return null;
}
return request.set{{.Pagination.Token.PollField.PascalName}}(token);
}
return request.set{{.Pagination.Token.PollField.PascalName}}(token);
{{- else if eq .Pagination.Increment 1 -}}
Long page = request.get{{.Pagination.Offset.PascalName}}();
if (page == null) {
page = 1L; // redash uses 1-based pagination
{
Long page = request.get{{.Pagination.Offset.PascalName}}();
if (page == null) {
page = 1L; // redash uses 1-based pagination
}
return request.set{{.Pagination.Offset.PascalName}}(page+1L);
}
return request.set{{.Pagination.Offset.PascalName}}(page+1L);
{{- else -}}
Long offset = request.get{{.Pagination.Offset.PascalName}}();
if (offset == null) {
offset = 0L;
{
Long offset = request.get{{.Pagination.Offset.PascalName}}();
if (offset == null) {
offset = 0L;
}
offset += response.get{{.Pagination.Results.PascalName}}().size();
return request.set{{.Pagination.Offset.PascalName}}(offset);
}
offset += response.get{{.Pagination.Results.PascalName}}().size();
return request.set{{.Pagination.Offset.PascalName}}(offset);
{{- end}}
}){{if .NeedsOffsetDedupe -}}.withDedupe({{.Pagination.Entity.PascalName}}::get{{.IdentifierField.PascalName}}){{end}};
{{- else -}}
return impl.{{template "java-name" .}}({{if .Request}}request{{end}}){{with .Pagination.Results}}.get{{.PascalName}}(){{end}};
{{- end -}}
){{if .NeedsOffsetDedupe -}}.withDedupe({{.Pagination.Entity.PascalName}}::get{{.IdentifierField.PascalName}}){{end}};
{{- end}}

{{define "method-call-retried" -}}
Expand Down
15 changes: 15 additions & 0 deletions .codegen/error-mapper.java.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.

package com.databricks.sdk.core.error;

import com.databricks.sdk.support.Generated;

@Generated
class ErrorMapper extends AbstractErrorMapper {
public ErrorMapper() {
{{range .ErrorStatusCodeMapping}}statusCode({{.StatusCode}}, com.databricks.sdk.core.error.platform.{{.PascalName}}::new);
{{end}}
{{range .ErrorCodeMapping}}errorCode("{{.ErrorCode}}", com.databricks.sdk.core.error.platform.{{.PascalName}}::new);
{{end}}
}
}
24 changes: 24 additions & 0 deletions .codegen/error-overrides.java.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.

package com.databricks.sdk.core.error;

import java.util.Arrays;
import java.util.List;

import com.databricks.sdk.support.Generated;

@Generated
class ErrorOverrides {
static final List<ErrorOverride<?>> ALL_OVERRIDES = Arrays.asList(
{{- range $i, $x := .ErrorOverrides }}
{{if not (eq $i 0)}}, {{end}}new ErrorOverride<>(
"{{$x.Name}}",
"{{ replaceAll "\\" "\\\\" $x.PathRegex}}",
"{{$x.Verb}}",
"{{ replaceAll "\\" "\\\\" $x.StatusCodeMatcher}}",
"{{ replaceAll "\\" "\\\\" $x.ErrorCodeMatcher}}",
"{{ replaceAll "\\" "\\\\" $x.MessageMatcher}}",
com.databricks.sdk.core.error.platform.{{$x.OverrideErrorCode.PascalName}}.class)
{{- end}}
);
}
25 changes: 25 additions & 0 deletions .codegen/exception.java.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.

package com.databricks.sdk.core.error.platform;

import com.databricks.sdk.core.DatabricksError;
import com.databricks.sdk.core.error.ErrorDetail;
import com.databricks.sdk.support.Generated;

import java.util.List;

/**
{{.Comment " * " 80}}
*/
@Generated
public class {{.PascalName}} extends {{if .Inherit -}}{{.Inherit.PascalName}}{{else}}DatabricksError{{end}} {
public {{.PascalName}}(String message, List<ErrorDetail> details) {
super("{{.Name}}", message, {{if not .Inherit}}{{.StatusCode}}, {{end}}details);
}

{{if not .Inherit}}
public {{.PascalName}}(String errorCode, String message, List<ErrorDetail> details) {
super(errorCode, message, {{.StatusCode}}, details);
}
{{end}}
}
22 changes: 19 additions & 3 deletions .codegen/impl.java.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import java.util.HashMap;

import com.databricks.sdk.core.ApiClient;
import com.databricks.sdk.core.DatabricksException;
import com.databricks.sdk.core.http.Encoding;
import com.databricks.sdk.support.Generated;

{{range .Package.ImportedEntities}}
Expand All @@ -25,9 +26,7 @@ class {{.PascalName}}Impl implements {{.PascalName}}Service {
{{range .Methods}}
@Override
public {{if not .Response.IsEmpty -}}{{template "type" .Response}}{{else}}void{{end}} {{.CamelName}}{{if .IsNameReserved}}Content{{end}}({{if .Request}}{{template "type" .Request}} request{{end}}) {
String path = {{if .PathParts -}}
String.format("{{range .PathParts}}{{.Prefix}}{{if or .Field .IsAccountId}}%s{{end}}{{ end }}"{{ range .PathParts }}{{if .Field}}, request.get{{.Field.PascalName}}(){{ else if .IsAccountId }}, apiClient.configuredAccountID(){{end}}{{ end }})
{{- else}}"{{.Path}}"{{end}};
String path = {{ template "path" . }};
{{ template "headers" . -}}
{{ if .Response.IsEmpty -}}
{{ template "api-call" . }}
Expand All @@ -39,6 +38,23 @@ class {{.PascalName}}Impl implements {{.PascalName}}Service {
{{end}}
}

{{- define "path" -}}
{{- if .PathParts -}}
String.format("{{range .PathParts -}}
{{- .Prefix -}}
{{- if or .Field .IsAccountId -}}%s{{- end -}}
{{- end -}}"
{{- range .PathParts -}}
{{- if and .Field .Field.IsPathMultiSegment -}}, Encoding.encodeMultiSegmentPathParameter(request.get{{.Field.PascalName}}())
{{- else if .Field -}}, request.get{{.Field.PascalName}}()
{{- else if .IsAccountId -}}, apiClient.configuredAccountID()
{{- end -}}
{{- end -}})
{{- else -}}
"{{.Path}}"
{{- end -}}
{{- end -}}

{{ define "api-call" }}
apiClient.{{.Verb}}(path
{{- if .Request}}, {{ template "request-param" .}}{{end}}
Expand Down
Loading