Skip to content

Commit c5fd387

Browse files
Update SDK to dd5d5a92df7b95ce21ee1c3ac2564c7b29e4b792
1 parent 8a4a789 commit c5fd387

22 files changed

+1153
-6
lines changed

.codegen/_openapi_sha

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
62870287fa7d3f2ba570333dd2645e86cb8e1a82
1+
dd5d5a92df7b95ce21ee1c3ac2564c7b29e4b792

.gitattributes

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2082,10 +2082,14 @@
20822082
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/CreateEndpointRequest.java linguist-generated=true
20832083
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/CreateProjectOperation.java linguist-generated=true
20842084
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/CreateProjectRequest.java linguist-generated=true
2085+
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/CreateRoleOperation.java linguist-generated=true
2086+
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/CreateRoleRequest.java linguist-generated=true
20852087
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/DatabricksServiceExceptionWithDetailsProto.java linguist-generated=true
20862088
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/DeleteBranchRequest.java linguist-generated=true
20872089
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/DeleteEndpointRequest.java linguist-generated=true
20882090
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/DeleteProjectRequest.java linguist-generated=true
2091+
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/DeleteRoleOperation.java linguist-generated=true
2092+
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/DeleteRoleRequest.java linguist-generated=true
20892093
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/Endpoint.java linguist-generated=true
20902094
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/EndpointOperationMetadata.java linguist-generated=true
20912095
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/EndpointPoolerMode.java linguist-generated=true
@@ -2099,12 +2103,15 @@
20992103
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/GetEndpointRequest.java linguist-generated=true
21002104
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/GetOperationRequest.java linguist-generated=true
21012105
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/GetProjectRequest.java linguist-generated=true
2106+
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/GetRoleRequest.java linguist-generated=true
21022107
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/ListBranchesRequest.java linguist-generated=true
21032108
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/ListBranchesResponse.java linguist-generated=true
21042109
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/ListEndpointsRequest.java linguist-generated=true
21052110
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/ListEndpointsResponse.java linguist-generated=true
21062111
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/ListProjectsRequest.java linguist-generated=true
21072112
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/ListProjectsResponse.java linguist-generated=true
2113+
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/ListRolesRequest.java linguist-generated=true
2114+
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/ListRolesResponse.java linguist-generated=true
21082115
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/Operation.java linguist-generated=true
21092116
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/PostgresAPI.java linguist-generated=true
21102117
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/PostgresImpl.java linguist-generated=true
@@ -2115,6 +2122,12 @@
21152122
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/ProjectSettings.java linguist-generated=true
21162123
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/ProjectSpec.java linguist-generated=true
21172124
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/ProjectStatus.java linguist-generated=true
2125+
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/Role.java linguist-generated=true
2126+
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/RoleAuthMethod.java linguist-generated=true
2127+
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/RoleIdentityType.java linguist-generated=true
2128+
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/RoleOperationMetadata.java linguist-generated=true
2129+
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/RoleRoleSpec.java linguist-generated=true
2130+
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/RoleRoleStatus.java linguist-generated=true
21182131
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/UpdateBranchOperation.java linguist-generated=true
21192132
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/UpdateBranchRequest.java linguist-generated=true
21202133
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/UpdateEndpointOperation.java linguist-generated=true

NEXT_CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,7 @@
3131
* Add `TABLE`, `FUNCTION` and `CONNECTION` enum values for `com.databricks.sdk.service.apps.AppResourceUcSecurableUcSecurableType`.
3232
* [Breaking] Remove `currentState`, `default`, `effectiveDefault`, `effectiveIsProtected`, `effectiveSourceBranch`, `effectiveSourceBranchLsn`, `effectiveSourceBranchTime`, `isProtected`, `logicalSizeBytes`, `pendingState`, `sourceBranch`, `sourceBranchLsn`, `sourceBranchTime` and `stateChangeTime` fields for `com.databricks.sdk.service.postgres.Branch`.
3333
* [Breaking] Remove `autoscalingLimitMaxCu`, `autoscalingLimitMinCu`, `currentState`, `disabled`, `effectiveAutoscalingLimitMaxCu`, `effectiveAutoscalingLimitMinCu`, `effectiveDisabled`, `effectivePoolerMode`, `effectiveSettings`, `effectiveSuspendTimeoutDuration`, `endpointType`, `host`, `lastActiveTime`, `pendingState`, `poolerMode`, `settings`, `startTime`, `suspendTime` and `suspendTimeoutDuration` fields for `com.databricks.sdk.service.postgres.Endpoint`.
34-
* [Breaking] Remove `branchLogicalSizeLimitBytes`, `computeLastActiveTime`, `defaultEndpointSettings`, `displayName`, `effectiveDefaultEndpointSettings`, `effectiveDisplayName`, `effectiveHistoryRetentionDuration`, `effectivePgVersion`, `effectiveSettings`, `historyRetentionDuration`, `pgVersion`, `settings` and `syntheticStorageSizeBytes` fields for `com.databricks.sdk.service.postgres.Project`.
34+
* [Breaking] Remove `branchLogicalSizeLimitBytes`, `computeLastActiveTime`, `defaultEndpointSettings`, `displayName`, `effectiveDefaultEndpointSettings`, `effectiveDisplayName`, `effectiveHistoryRetentionDuration`, `effectivePgVersion`, `effectiveSettings`, `historyRetentionDuration`, `pgVersion`, `settings` and `syntheticStorageSizeBytes` fields for `com.databricks.sdk.service.postgres.Project`.
35+
* Add `createRole()`, `deleteRole()`, `getRole()` and `listRoles()` methods for `workspaceClient.postgres()` service.
36+
* Add `destinationSourceSecurable` field for `com.databricks.sdk.service.catalog.AccessRequestDestinations`.
37+
* Add `accessModes` and `storageLocation` fields for `com.databricks.sdk.service.sharing.Table`.

databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/AccessRequestDestinations.java

100755100644
Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,19 @@ public class AccessRequestDestinations {
1717
@JsonProperty("are_any_destinations_hidden")
1818
private Boolean areAnyDestinationsHidden;
1919

20+
/**
21+
* The source securable from which the destinations are inherited. Either the same value as
22+
* securable (if destination is set directly on the securable) or the nearest parent securable
23+
* with destinations set.
24+
*/
25+
@JsonProperty("destination_source_securable")
26+
private Securable destinationSourceSecurable;
27+
2028
/** The access request destinations for the securable. */
2129
@JsonProperty("destinations")
2230
private Collection<NotificationDestination> destinations;
2331

24-
/** The securable for which the access request destinations are being retrieved. */
32+
/** The securable for which the access request destinations are being modified or read. */
2533
@JsonProperty("securable")
2634
private Securable securable;
2735

@@ -34,6 +42,16 @@ public Boolean getAreAnyDestinationsHidden() {
3442
return areAnyDestinationsHidden;
3543
}
3644

45+
public AccessRequestDestinations setDestinationSourceSecurable(
46+
Securable destinationSourceSecurable) {
47+
this.destinationSourceSecurable = destinationSourceSecurable;
48+
return this;
49+
}
50+
51+
public Securable getDestinationSourceSecurable() {
52+
return destinationSourceSecurable;
53+
}
54+
3755
public AccessRequestDestinations setDestinations(
3856
Collection<NotificationDestination> destinations) {
3957
this.destinations = destinations;
@@ -59,19 +77,22 @@ public boolean equals(Object o) {
5977
if (o == null || getClass() != o.getClass()) return false;
6078
AccessRequestDestinations that = (AccessRequestDestinations) o;
6179
return Objects.equals(areAnyDestinationsHidden, that.areAnyDestinationsHidden)
80+
&& Objects.equals(destinationSourceSecurable, that.destinationSourceSecurable)
6281
&& Objects.equals(destinations, that.destinations)
6382
&& Objects.equals(securable, that.securable);
6483
}
6584

6685
@Override
6786
public int hashCode() {
68-
return Objects.hash(areAnyDestinationsHidden, destinations, securable);
87+
return Objects.hash(
88+
areAnyDestinationsHidden, destinationSourceSecurable, destinations, securable);
6989
}
7090

7191
@Override
7292
public String toString() {
7393
return new ToStringer(AccessRequestDestinations.class)
7494
.add("areAnyDestinationsHidden", areAnyDestinationsHidden)
95+
.add("destinationSourceSecurable", destinationSourceSecurable)
7596
.add("destinations", destinations)
7697
.add("securable", securable)
7798
.toString();

databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/SecurableKind.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import com.databricks.sdk.support.Generated;
66

7-
/** Latest kind: CONNECTION_GOOGLE_ADS_OAUTH_U2M_WITH_DT = 284; Next id:285 */
7+
/** Latest kind: CONNECTION_TIKTOK_ADS_U2M = 285; Next id: 286 */
88
@Generated
99
public enum SecurableKind {
1010
TABLE_DB_STORAGE,
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
2+
package com.databricks.sdk.service.postgres;
3+
4+
import com.databricks.sdk.core.DatabricksException;
5+
import com.databricks.sdk.core.utils.SerDeUtils;
6+
import com.databricks.sdk.service.common.lro.LroOptions;
7+
import com.databricks.sdk.support.Generated;
8+
import com.fasterxml.jackson.core.JsonProcessingException;
9+
import com.fasterxml.jackson.databind.JsonNode;
10+
import com.fasterxml.jackson.databind.ObjectMapper;
11+
import java.time.Duration;
12+
import java.util.Optional;
13+
import java.util.concurrent.TimeoutException;
14+
import org.slf4j.Logger;
15+
import org.slf4j.LoggerFactory;
16+
17+
/**
18+
* Wrapper for interacting with a long-running createRole operation. Provides methods to wait for
19+
* completion, check status, cancel, and access metadata.
20+
*/
21+
@Generated
22+
public class CreateRoleOperation {
23+
private static final Logger LOG = LoggerFactory.getLogger(CreateRoleOperation.class);
24+
25+
private final PostgresService impl;
26+
private Operation operation;
27+
private final ObjectMapper objectMapper;
28+
29+
public CreateRoleOperation(PostgresService impl, Operation operation) {
30+
this.impl = impl;
31+
this.operation = operation;
32+
this.objectMapper = SerDeUtils.createMapper();
33+
}
34+
35+
/**
36+
* Wait for the operation to complete and return the resulting Role. Waits indefinitely if no
37+
* timeout is specified.
38+
*
39+
* @return the created Role
40+
* @throws TimeoutException if the operation doesn't complete within the timeout
41+
* @throws DatabricksException if the operation fails
42+
*/
43+
public Role waitForCompletion() throws TimeoutException {
44+
return waitForCompletion(Optional.empty());
45+
}
46+
47+
/**
48+
* Wait for the operation to complete and return the resulting Role.
49+
*
50+
* @param options the options for configuring the wait behavior, can be empty for defaults
51+
* @return the created Role
52+
* @throws TimeoutException if the operation doesn't complete within the timeout
53+
* @throws DatabricksException if the operation fails
54+
*/
55+
public Role waitForCompletion(Optional<LroOptions> options) throws TimeoutException {
56+
Optional<Duration> timeout = options.flatMap(LroOptions::getTimeout);
57+
long deadline =
58+
timeout.isPresent()
59+
? System.currentTimeMillis() + timeout.get().toMillis()
60+
: Long.MAX_VALUE;
61+
String statusMessage = "polling operation...";
62+
int attempt = 1;
63+
64+
while (System.currentTimeMillis() < deadline) {
65+
// Refresh the operation state
66+
refreshOperation();
67+
68+
if (operation.getDone() != null && operation.getDone()) {
69+
// Operation completed, check for success or failure
70+
if (operation.getError() != null) {
71+
String errorMsg = "unknown error";
72+
if (operation.getError().getMessage() != null
73+
&& !operation.getError().getMessage().isEmpty()) {
74+
errorMsg = operation.getError().getMessage();
75+
}
76+
77+
if (operation.getError().getErrorCode() != null) {
78+
errorMsg = String.format("[%s] %s", operation.getError().getErrorCode(), errorMsg);
79+
}
80+
81+
throw new DatabricksException("Operation failed: " + errorMsg);
82+
}
83+
84+
// Operation completed successfully, unmarshal response
85+
if (operation.getResponse() == null) {
86+
throw new DatabricksException("Operation completed but no response available");
87+
}
88+
89+
try {
90+
JsonNode responseJson = objectMapper.valueToTree(operation.getResponse());
91+
return objectMapper.treeToValue(responseJson, Role.class);
92+
} catch (JsonProcessingException e) {
93+
throw new DatabricksException("Failed to unmarshal role response: " + e.getMessage(), e);
94+
}
95+
}
96+
97+
// Operation still in progress, wait before polling again
98+
String prefix = String.format("operation=%s", operation.getName());
99+
int sleep = Math.min(attempt, 10); // sleep 10s max per attempt
100+
LOG.info("{}: operation in progress (sleeping ~{}s)", prefix, sleep);
101+
102+
try {
103+
Thread.sleep((long) (sleep * 1000L + Math.random() * 1000));
104+
} catch (InterruptedException e) {
105+
Thread.currentThread().interrupt();
106+
throw new DatabricksException("Current thread was interrupted", e);
107+
}
108+
attempt++;
109+
}
110+
111+
String timeoutMessage =
112+
timeout.isPresent()
113+
? String.format("Operation timed out after %s: %s", timeout.get(), statusMessage)
114+
: String.format("Operation timed out: %s", statusMessage);
115+
throw new TimeoutException(timeoutMessage);
116+
}
117+
118+
/**
119+
* Get the operation name.
120+
*
121+
* @return the operation name
122+
*/
123+
public String getName() {
124+
return operation.getName();
125+
}
126+
127+
/**
128+
* Get the operation metadata.
129+
*
130+
* @return the operation metadata, or null if not available
131+
* @throws DatabricksException if the metadata cannot be deserialized
132+
*/
133+
public RoleOperationMetadata getMetadata() {
134+
if (operation.getMetadata() == null) {
135+
return null;
136+
}
137+
138+
try {
139+
JsonNode metadataJson = objectMapper.valueToTree(operation.getMetadata());
140+
return objectMapper.treeToValue(metadataJson, RoleOperationMetadata.class);
141+
} catch (JsonProcessingException e) {
142+
throw new DatabricksException("Failed to unmarshal operation metadata: " + e.getMessage(), e);
143+
}
144+
}
145+
146+
/**
147+
* Check if the operation is done. This method refreshes the operation state before checking.
148+
*
149+
* @return true if the operation is complete, false otherwise
150+
* @throws DatabricksException if the status check fails
151+
*/
152+
public boolean isDone() {
153+
refreshOperation();
154+
return operation.getDone() != null && operation.getDone();
155+
}
156+
157+
/** Refresh the operation state by polling the server. */
158+
private void refreshOperation() {
159+
operation = impl.getOperation(new GetOperationRequest().setName(operation.getName()));
160+
}
161+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
2+
3+
package com.databricks.sdk.service.postgres;
4+
5+
import com.databricks.sdk.support.Generated;
6+
import com.databricks.sdk.support.QueryParam;
7+
import com.databricks.sdk.support.ToStringer;
8+
import com.fasterxml.jackson.annotation.JsonIgnore;
9+
import com.fasterxml.jackson.annotation.JsonProperty;
10+
import java.util.Objects;
11+
12+
@Generated
13+
public class CreateRoleRequest {
14+
/** The Branch where this Role is created. Format: projects/{project_id}/branches/{branch_id} */
15+
@JsonIgnore private String parent;
16+
17+
/** The desired specification of a Role. */
18+
@JsonProperty("role")
19+
private Role role;
20+
21+
/**
22+
* The ID to use for the Role, which will become the final component of the branch's resource
23+
* name. This ID becomes the role in postgres.
24+
*
25+
* <p>This value should be 4-63 characters, and only use characters available in DNS names, as
26+
* defined by RFC-1123
27+
*/
28+
@JsonIgnore
29+
@QueryParam("role_id")
30+
private String roleId;
31+
32+
public CreateRoleRequest setParent(String parent) {
33+
this.parent = parent;
34+
return this;
35+
}
36+
37+
public String getParent() {
38+
return parent;
39+
}
40+
41+
public CreateRoleRequest setRole(Role role) {
42+
this.role = role;
43+
return this;
44+
}
45+
46+
public Role getRole() {
47+
return role;
48+
}
49+
50+
public CreateRoleRequest setRoleId(String roleId) {
51+
this.roleId = roleId;
52+
return this;
53+
}
54+
55+
public String getRoleId() {
56+
return roleId;
57+
}
58+
59+
@Override
60+
public boolean equals(Object o) {
61+
if (this == o) return true;
62+
if (o == null || getClass() != o.getClass()) return false;
63+
CreateRoleRequest that = (CreateRoleRequest) o;
64+
return Objects.equals(parent, that.parent)
65+
&& Objects.equals(role, that.role)
66+
&& Objects.equals(roleId, that.roleId);
67+
}
68+
69+
@Override
70+
public int hashCode() {
71+
return Objects.hash(parent, role, roleId);
72+
}
73+
74+
@Override
75+
public String toString() {
76+
return new ToStringer(CreateRoleRequest.class)
77+
.add("parent", parent)
78+
.add("role", role)
79+
.add("roleId", roleId)
80+
.toString();
81+
}
82+
}

0 commit comments

Comments
 (0)