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/_last_sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
880d3221a1560a48172008865530ea224f5905a4
0f44212e3b048dba62be17565dfd55b4b69d7b9c
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Version changelog

## Release v0.160.0 (2026-10-03)

### API Changes
* Add `accountClient.privateNetworkGateways()` service.
* Add `projectEnvironment` field for `com.databricks.sdk.service.compute.Environment`.

## Release v0.159.0 (2026-10-02)

### API Changes
Expand Down
2 changes: 1 addition & 1 deletion databricks-sdk-java/lockfile.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"artifactId": "databricks-sdk-java",
"groupId": "com.databricks",
"version": "0.159.0",
"version": "0.160.0",
"lockFileVersion": 1,
"dependencies": [
{
Expand Down
2 changes: 1 addition & 1 deletion databricks-sdk-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.databricks</groupId>
<artifactId>databricks-sdk-parent</artifactId>
<version>0.159.0</version>
<version>0.160.0</version>
</parent>
<artifactId>databricks-sdk-java</artifactId>
<name>Databricks SDK for Java</name>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public String getValue() {
// TODO: check if reading from
// /META-INF/maven/com.databricks/databrics-sdk-java/pom.properties
// or getClass().getPackage().getImplementationVersion() is enough.
private static final String version = "0.159.0";
private static final String version = "0.160.0";

public static void withProduct(String product, String productVersion) {
UserAgent.product = product;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
package com.databricks.sdk.service.networking;

import com.databricks.sdk.core.DatabricksException;
import com.databricks.sdk.core.logging.Logger;
import com.databricks.sdk.core.logging.LoggerFactory;
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;

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

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

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

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

/**
* Wait for the operation to complete and return the resulting PrivateNetworkGateway.
*
* @param options the options for configuring the wait behavior, can be empty for defaults
* @return the created PrivateNetworkGateway
* @throws TimeoutException if the operation doesn't complete within the timeout
* @throws DatabricksException if the operation fails
*/
public PrivateNetworkGateway 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, PrivateNetworkGateway.class);
} catch (JsonProcessingException e) {
throw new DatabricksException(
"Failed to unmarshal privateNetworkGateway 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 PrivateNetworkGatewayOperationMetadata getMetadata() {
if (operation.getMetadata() == null) {
return null;
}

try {
JsonNode metadataJson = objectMapper.valueToTree(operation.getMetadata());
return objectMapper.treeToValue(metadataJson, PrivateNetworkGatewayOperationMetadata.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.getPrivateNetworkGatewayOperation(
new GetOperationRequest().setName(operation.getName()));
}
}
Loading
Loading