Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codegen/_openapi_sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
62870287fa7d3f2ba570333dd2645e86cb8e1a82
dd5d5a92df7b95ce21ee1c3ac2564c7b29e4b792
13 changes: 13 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2082,10 +2082,14 @@
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/CreateEndpointRequest.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/CreateProjectOperation.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/CreateProjectRequest.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/CreateRoleOperation.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/CreateRoleRequest.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/DatabricksServiceExceptionWithDetailsProto.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/DeleteBranchRequest.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/DeleteEndpointRequest.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/DeleteProjectRequest.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/DeleteRoleOperation.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/DeleteRoleRequest.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/Endpoint.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/EndpointOperationMetadata.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/EndpointPoolerMode.java linguist-generated=true
Expand All @@ -2099,12 +2103,15 @@
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/GetEndpointRequest.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/GetOperationRequest.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/GetProjectRequest.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/GetRoleRequest.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/ListBranchesRequest.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/ListBranchesResponse.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/ListEndpointsRequest.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/ListEndpointsResponse.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/ListProjectsRequest.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/ListProjectsResponse.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/ListRolesRequest.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/ListRolesResponse.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/Operation.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/PostgresAPI.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/PostgresImpl.java linguist-generated=true
Expand All @@ -2115,6 +2122,12 @@
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/ProjectSettings.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/ProjectSpec.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/ProjectStatus.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/Role.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/RoleAuthMethod.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/RoleIdentityType.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/RoleOperationMetadata.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/RoleRoleSpec.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/RoleRoleStatus.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/UpdateBranchOperation.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/UpdateBranchRequest.java linguist-generated=true
/home/ubuntu/workspace/databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/UpdateEndpointOperation.java linguist-generated=true
Expand Down
5 changes: 4 additions & 1 deletion NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@
* Add `TABLE`, `FUNCTION` and `CONNECTION` enum values for `com.databricks.sdk.service.apps.AppResourceUcSecurableUcSecurableType`.
* [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`.
* [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`.
* [Breaking] Remove `branchLogicalSizeLimitBytes`, `computeLastActiveTime`, `defaultEndpointSettings`, `displayName`, `effectiveDefaultEndpointSettings`, `effectiveDisplayName`, `effectiveHistoryRetentionDuration`, `effectivePgVersion`, `effectiveSettings`, `historyRetentionDuration`, `pgVersion`, `settings` and `syntheticStorageSizeBytes` fields for `com.databricks.sdk.service.postgres.Project`.
* [Breaking] Remove `branchLogicalSizeLimitBytes`, `computeLastActiveTime`, `defaultEndpointSettings`, `displayName`, `effectiveDefaultEndpointSettings`, `effectiveDisplayName`, `effectiveHistoryRetentionDuration`, `effectivePgVersion`, `effectiveSettings`, `historyRetentionDuration`, `pgVersion`, `settings` and `syntheticStorageSizeBytes` fields for `com.databricks.sdk.service.postgres.Project`.
* Add `createRole()`, `deleteRole()`, `getRole()` and `listRoles()` methods for `workspaceClient.postgres()` service.
* Add `destinationSourceSecurable` field for `com.databricks.sdk.service.catalog.AccessRequestDestinations`.
* Add `accessModes` and `storageLocation` fields for `com.databricks.sdk.service.sharing.Table`.
25 changes: 23 additions & 2 deletions ...-sdk-java/src/main/java/com/databricks/sdk/service/catalog/AccessRequestDestinations.java
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,19 @@ public class AccessRequestDestinations {
@JsonProperty("are_any_destinations_hidden")
private Boolean areAnyDestinationsHidden;

/**
* The source securable from which the destinations are inherited. Either the same value as
* securable (if destination is set directly on the securable) or the nearest parent securable
* with destinations set.
*/
@JsonProperty("destination_source_securable")
private Securable destinationSourceSecurable;

/** The access request destinations for the securable. */
@JsonProperty("destinations")
private Collection<NotificationDestination> destinations;

/** The securable for which the access request destinations are being retrieved. */
/** The securable for which the access request destinations are being modified or read. */
@JsonProperty("securable")
private Securable securable;

Expand All @@ -34,6 +42,16 @@ public Boolean getAreAnyDestinationsHidden() {
return areAnyDestinationsHidden;
}

public AccessRequestDestinations setDestinationSourceSecurable(
Securable destinationSourceSecurable) {
this.destinationSourceSecurable = destinationSourceSecurable;
return this;
}

public Securable getDestinationSourceSecurable() {
return destinationSourceSecurable;
}

public AccessRequestDestinations setDestinations(
Collection<NotificationDestination> destinations) {
this.destinations = destinations;
Expand All @@ -59,19 +77,22 @@ public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) return false;
AccessRequestDestinations that = (AccessRequestDestinations) o;
return Objects.equals(areAnyDestinationsHidden, that.areAnyDestinationsHidden)
&& Objects.equals(destinationSourceSecurable, that.destinationSourceSecurable)
&& Objects.equals(destinations, that.destinations)
&& Objects.equals(securable, that.securable);
}

@Override
public int hashCode() {
return Objects.hash(areAnyDestinationsHidden, destinations, securable);
return Objects.hash(
areAnyDestinationsHidden, destinationSourceSecurable, destinations, securable);
}

@Override
public String toString() {
return new ToStringer(AccessRequestDestinations.class)
.add("areAnyDestinationsHidden", areAnyDestinationsHidden)
.add("destinationSourceSecurable", destinationSourceSecurable)
.add("destinations", destinations)
.add("securable", securable)
.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import com.databricks.sdk.support.Generated;

/** Latest kind: CONNECTION_GOOGLE_ADS_OAUTH_U2M_WITH_DT = 284; Next id:285 */
/** Latest kind: CONNECTION_TIKTOK_ADS_U2M = 285; Next id: 286 */
@Generated
public enum SecurableKind {
TABLE_DB_STORAGE,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
package com.databricks.sdk.service.postgres;

import com.databricks.sdk.core.DatabricksException;
import com.databricks.sdk.core.utils.SerDeUtils;
import com.databricks.sdk.service.common.lro.LroOptions;
import com.databricks.sdk.support.Generated;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.time.Duration;
import java.util.Optional;
import java.util.concurrent.TimeoutException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Wrapper for interacting with a long-running createRole operation. Provides methods to wait for
* completion, check status, cancel, and access metadata.
*/
@Generated
public class CreateRoleOperation {
private static final Logger LOG = LoggerFactory.getLogger(CreateRoleOperation.class);

private final PostgresService impl;
private Operation operation;
private final ObjectMapper objectMapper;

public CreateRoleOperation(PostgresService impl, Operation operation) {
this.impl = impl;
this.operation = operation;
this.objectMapper = SerDeUtils.createMapper();
}

/**
* Wait for the operation to complete and return the resulting Role. Waits indefinitely if no
* timeout is specified.
*
* @return the created Role
* @throws TimeoutException if the operation doesn't complete within the timeout
* @throws DatabricksException if the operation fails
*/
public Role waitForCompletion() throws TimeoutException {
return waitForCompletion(Optional.empty());
}

/**
* Wait for the operation to complete and return the resulting Role.
*
* @param options the options for configuring the wait behavior, can be empty for defaults
* @return the created Role
* @throws TimeoutException if the operation doesn't complete within the timeout
* @throws DatabricksException if the operation fails
*/
public Role waitForCompletion(Optional<LroOptions> options) throws TimeoutException {
Optional<Duration> timeout = options.flatMap(LroOptions::getTimeout);
long deadline =
timeout.isPresent()
? System.currentTimeMillis() + timeout.get().toMillis()
: Long.MAX_VALUE;
String statusMessage = "polling operation...";
int attempt = 1;

while (System.currentTimeMillis() < deadline) {
// Refresh the operation state
refreshOperation();

if (operation.getDone() != null && operation.getDone()) {
// Operation completed, check for success or failure
if (operation.getError() != null) {
String errorMsg = "unknown error";
if (operation.getError().getMessage() != null
&& !operation.getError().getMessage().isEmpty()) {
errorMsg = operation.getError().getMessage();
}

if (operation.getError().getErrorCode() != null) {
errorMsg = String.format("[%s] %s", operation.getError().getErrorCode(), errorMsg);
}

throw new DatabricksException("Operation failed: " + errorMsg);
}

// Operation completed successfully, unmarshal response
if (operation.getResponse() == null) {
throw new DatabricksException("Operation completed but no response available");
}

try {
JsonNode responseJson = objectMapper.valueToTree(operation.getResponse());
return objectMapper.treeToValue(responseJson, Role.class);
} catch (JsonProcessingException e) {
throw new DatabricksException("Failed to unmarshal role response: " + e.getMessage(), e);
}
}

// Operation still in progress, wait before polling again
String prefix = String.format("operation=%s", operation.getName());
int sleep = Math.min(attempt, 10); // sleep 10s max per attempt
LOG.info("{}: operation in progress (sleeping ~{}s)", prefix, sleep);

try {
Thread.sleep((long) (sleep * 1000L + Math.random() * 1000));
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new DatabricksException("Current thread was interrupted", e);
}
attempt++;
}

String timeoutMessage =
timeout.isPresent()
? String.format("Operation timed out after %s: %s", timeout.get(), statusMessage)
: String.format("Operation timed out: %s", statusMessage);
throw new TimeoutException(timeoutMessage);
}

/**
* Get the operation name.
*
* @return the operation name
*/
public String getName() {
return operation.getName();
}

/**
* Get the operation metadata.
*
* @return the operation metadata, or null if not available
* @throws DatabricksException if the metadata cannot be deserialized
*/
public RoleOperationMetadata getMetadata() {
if (operation.getMetadata() == null) {
return null;
}

try {
JsonNode metadataJson = objectMapper.valueToTree(operation.getMetadata());
return objectMapper.treeToValue(metadataJson, RoleOperationMetadata.class);
} catch (JsonProcessingException e) {
throw new DatabricksException("Failed to unmarshal operation metadata: " + e.getMessage(), e);
}
}

/**
* Check if the operation is done. This method refreshes the operation state before checking.
*
* @return true if the operation is complete, false otherwise
* @throws DatabricksException if the status check fails
*/
public boolean isDone() {
refreshOperation();
return operation.getDone() != null && operation.getDone();
}

/** Refresh the operation state by polling the server. */
private void refreshOperation() {
operation = impl.getOperation(new GetOperationRequest().setName(operation.getName()));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.

package com.databricks.sdk.service.postgres;

import com.databricks.sdk.support.Generated;
import com.databricks.sdk.support.QueryParam;
import com.databricks.sdk.support.ToStringer;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;

@Generated
public class CreateRoleRequest {
/** The Branch where this Role is created. Format: projects/{project_id}/branches/{branch_id} */
@JsonIgnore private String parent;

/** The desired specification of a Role. */
@JsonProperty("role")
private Role role;

/**
* The ID to use for the Role, which will become the final component of the branch's resource
* name. This ID becomes the role in postgres.
*
* <p>This value should be 4-63 characters, and only use characters available in DNS names, as
* defined by RFC-1123
*/
@JsonIgnore
@QueryParam("role_id")
private String roleId;

public CreateRoleRequest setParent(String parent) {
this.parent = parent;
return this;
}

public String getParent() {
return parent;
}

public CreateRoleRequest setRole(Role role) {
this.role = role;
return this;
}

public Role getRole() {
return role;
}

public CreateRoleRequest setRoleId(String roleId) {
this.roleId = roleId;
return this;
}

public String getRoleId() {
return roleId;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CreateRoleRequest that = (CreateRoleRequest) o;
return Objects.equals(parent, that.parent)
&& Objects.equals(role, that.role)
&& Objects.equals(roleId, that.roleId);
}

@Override
public int hashCode() {
return Objects.hash(parent, role, roleId);
}

@Override
public String toString() {
return new ToStringer(CreateRoleRequest.class)
.add("parent", parent)
.add("role", role)
.add("roleId", roleId)
.toString();
}
}
Loading
Loading