Skip to content

Update to latest version 2023-10-31 #45151

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

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
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 eng/versioning/version_client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ com.azure:azure-data-tables;12.5.3;12.6.0-beta.1
com.azure:azure-data-tables-perf;1.0.0-beta.1;1.0.0-beta.1
com.azure:azure-developer-devcenter;1.0.8;1.1.0-beta.1
com.azure:azure-developer-loadtesting;1.0.22;1.1.0-beta.1
com.azure:azure-digitaltwins-core;1.4.2;1.5.0-beta.1
com.azure:azure-digitaltwins-core;1.5.0-beta.1;1.6.0
Copy link
Member

Choose a reason for hiding this comment

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

Is 2023-10-31 a preview API version? If not, the corresponding SDK should be a GA SDK. Let's make the current version 1.5.0, and the next version 1.6.0-beta.1

Copy link
Author

@Vidyashreebn Vidyashreebn May 7, 2025

Choose a reason for hiding this comment

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

Hmm I don't understand. Isn't the below convention we follow?

com.azure:azure-digitaltwins-core;< previous version > < current version >

2023-10-31 is not a preview version. The existing version is 1.5.0-beta.1 and as per https://azure.github.io/azure-sdk/java_introduction.html#versioning, I just increased minor version i.e., 1.6.0 Isn't that's what we want to do?

com.azure:azure-e2e;1.0.0-beta.1;1.0.0-beta.1
com.azure:azure-health-deidentification;1.0.0;1.1.0-beta.1
com.azure:azure-health-insights-clinicalmatching;1.0.0-beta.1;1.0.0-beta.2
Expand Down
7 changes: 6 additions & 1 deletion sdk/digitaltwins/azure-digitaltwins-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Release History

## 1.5.0-beta.1 (Unreleased)
## 1.6.0 (2025-05-01)

### Features Added
- Updated service API version to use API version 2023-10-31 by default.

## 1.5.0-beta.1 (2025-05-01)

### Features Added

Expand Down
2 changes: 1 addition & 1 deletion sdk/digitaltwins/azure-digitaltwins-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ add the direct dependency to your project as follows.
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-digitaltwins-core</artifactId>
<version>1.5.0-beta.1</version>
<version>1.6.0</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion sdk/digitaltwins/azure-digitaltwins-core/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "java",
"TagPrefix": "java/digitaltwins/azure-digitaltwins-core",
"Tag": "java/digitaltwins/azure-digitaltwins-core_c749c6b93c"
"Tag": "java/digitaltwins/azure-digitaltwins-core_4921a5c433"
}
2 changes: 1 addition & 1 deletion sdk/digitaltwins/azure-digitaltwins-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<groupId>com.azure</groupId>
<artifactId>azure-digitaltwins-core</artifactId>
<version>1.5.0-beta.1</version> <!-- {x-version-update;com.azure:azure-digitaltwins-core;current} -->
<version>1.6.0</version> <!-- {x-version-update;com.azure:azure-digitaltwins-core;current} -->

<name>Microsoft Azure client library for Digital Twins</name>
<description>This package contains the Microsoft Azure DigitalTwins client library.</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,17 @@
import com.azure.digitaltwins.core.models.UpdateComponentOptions;
import com.azure.digitaltwins.core.models.UpdateDigitalTwinOptions;
import com.azure.digitaltwins.core.models.UpdateRelationshipOptions;
import com.azure.json.JsonProviders;
import com.azure.json.JsonReader;
import com.azure.json.JsonWriter;
import reactor.core.publisher.Mono;

import java.io.IOException;
import java.io.StringWriter;
import java.io.UncheckedIOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -1541,7 +1546,23 @@ <T> Mono<PagedResponse<T>> queryNextPage(String nextLink, Class<T> clazz, QueryO
context = Context.NONE;
}

QuerySpecification querySpecification = new QuerySpecification().setContinuationToken(nextLink);
// The nextLink continuation token is a stringified JSON object. Attempt to deserialize the nextLink into any
// Object and inspect whether is what a stringified JSON value (List = array, Map = object, String = string).
// If it was a stringified value, use nextLink as-is. If not, serialize the nextLink into a JSON string.
String nextLinkToUse;
try (JsonReader jsonReader = JsonProviders.createReader(nextLink)) {
Object untyped = jsonReader.readUntyped();

if (untyped instanceof List || untyped instanceof Map || untyped instanceof String) {
nextLinkToUse = nextLink;
} else {
nextLinkToUse = serializeNextLink(nextLink);
}
} catch (IOException ex) {
nextLinkToUse = serializeNextLink(nextLink);
}

QuerySpecification querySpecification = new QuerySpecification().setContinuationToken(nextLinkToUse);

return protocolLayer.getQueries()
.queryTwinsWithResponseAsync(querySpecification, OptionsConverter.toProtocolLayerOptions(options), context)
Expand All @@ -1557,6 +1578,15 @@ <T> Mono<PagedResponse<T>> queryNextPage(String nextLink, Class<T> clazz, QueryO
objectPagedResponse.getDeserializedHeaders()));
}

private static String serializeNextLink(String nextLink) {
try (StringWriter writer = new StringWriter(); JsonWriter jsonWriter = JsonProviders.createWriter(writer)) {
jsonWriter.writeString(nextLink);
return writer.toString();
} catch (IOException ex) {
throw LOGGER.logExceptionAsError(new UncheckedIOException(ex));
}
}

//endregion Query APIs

//region Event Route APIs
Expand Down Expand Up @@ -2056,7 +2086,8 @@ private static DigitalTwinsResponseHeaders createDTResponseHeadersFromResponse(R
: new DigitalTwinsResponseHeaders().setETag(response.getHeaders().getValue(HttpHeaderName.ETAG));
}

private <T> Mono<DigitalTwinsResponse<T>> deserializeHelper(Response<Object> response, Class<T> clazz) {
private <T> Mono<DigitalTwinsResponse<T>> deserializeHelper(Response<Map<String, Object>> response,
Class<T> clazz) {
try {
T genericResponse = DeserializationHelpers.deserializeObject(protocolLayer.getSerializerAdapter(),
response.getValue(), clazz, this.serializer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ public enum DigitalTwinsServiceVersion implements ServiceVersion {
/**
* Service version {@code 2022-05-31}.
*/
V2022_05_31("2022-05-31");
V2022_05_31("2022-05-31"),

/**
* Service version {@code 2022-05-31}.
*/
V2023_10_31("2023-10-31");

private final String version;

Expand All @@ -39,6 +44,6 @@ public String getVersion() {
* @return The latest service API version of Azure Digital Twins that is supported by this client.
*/
public static DigitalTwinsServiceVersion getLatest() {
return V2022_05_31;
return V2023_10_31;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,38 @@
* Initializes a new instance of the AzureDigitalTwinsAPI type.
*/
public final class AzureDigitalTwinsAPIImpl {
/**
* ID for the operation's status monitor. The ID is generated if header was not passed by the client.
*/
private final String operationId;

/**
* Gets ID for the operation's status monitor. The ID is generated if header was not passed by the client.
*
* @return the operationId value.
*/
public String getOperationId() {
return this.operationId;
}

/**
* Desired timeout for the delete job. Once the specified timeout is reached, service will stop any delete
* operations triggered by the current delete job that are in progress, and go to a failed state. Please note that
* this will leave your instance in an unknown state as there won't be any rollback operation.
*/
private final int timeoutInMinutes;

/**
* Gets Desired timeout for the delete job. Once the specified timeout is reached, service will stop any delete
* operations triggered by the current delete job that are in progress, and go to a failed state. Please note that
* this will leave your instance in an unknown state as there won't be any rollback operation.
*
* @return the timeoutInMinutes value.
*/
public int getTimeoutInMinutes() {
return this.timeoutInMinutes;
}

/**
* server parameter.
*/
Expand Down Expand Up @@ -127,45 +159,94 @@ public EventRoutesImpl getEventRoutes() {
return this.eventRoutes;
}

/**
* The ImportJobsImpl object to access its operations.
*/
private final ImportJobsImpl importJobs;

/**
* Gets the ImportJobsImpl object to access its operations.
*
* @return the ImportJobsImpl object.
*/
public ImportJobsImpl getImportJobs() {
return this.importJobs;
}

/**
* The DeleteJobsImpl object to access its operations.
*/
private final DeleteJobsImpl deleteJobs;

/**
* Gets the DeleteJobsImpl object to access its operations.
*
* @return the DeleteJobsImpl object.
*/
public DeleteJobsImpl getDeleteJobs() {
return this.deleteJobs;
}

/**
* Initializes an instance of AzureDigitalTwinsAPI client.
*
* @param operationId ID for the operation's status monitor. The ID is generated if header was not passed by the
* client.
* @param timeoutInMinutes Desired timeout for the delete job. Once the specified timeout is reached, service will
* stop any delete operations triggered by the current delete job that are in progress, and go to a failed state.
* Please note that this will leave your instance in an unknown state as there won't be any rollback operation.
* @param host server parameter.
* @param apiVersion Api Version.
*/
AzureDigitalTwinsAPIImpl(String host, String apiVersion) {
AzureDigitalTwinsAPIImpl(String operationId, int timeoutInMinutes, String host, String apiVersion) {
this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(),
JacksonAdapter.createDefaultSerializerAdapter(), host, apiVersion);
JacksonAdapter.createDefaultSerializerAdapter(), operationId, timeoutInMinutes, host, apiVersion);
}

/**
* Initializes an instance of AzureDigitalTwinsAPI client.
*
* @param httpPipeline The HTTP pipeline to send requests through.
* @param operationId ID for the operation's status monitor. The ID is generated if header was not passed by the
* client.
* @param timeoutInMinutes Desired timeout for the delete job. Once the specified timeout is reached, service will
* stop any delete operations triggered by the current delete job that are in progress, and go to a failed state.
* Please note that this will leave your instance in an unknown state as there won't be any rollback operation.
* @param host server parameter.
* @param apiVersion Api Version.
*/
AzureDigitalTwinsAPIImpl(HttpPipeline httpPipeline, String host, String apiVersion) {
this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), host, apiVersion);
AzureDigitalTwinsAPIImpl(HttpPipeline httpPipeline, String operationId, int timeoutInMinutes, String host,
String apiVersion) {
this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), operationId, timeoutInMinutes, host,
apiVersion);
}

/**
* Initializes an instance of AzureDigitalTwinsAPI client.
*
* @param httpPipeline The HTTP pipeline to send requests through.
* @param serializerAdapter The serializer to serialize an object into a string.
* @param operationId ID for the operation's status monitor. The ID is generated if header was not passed by the
* client.
* @param timeoutInMinutes Desired timeout for the delete job. Once the specified timeout is reached, service will
* stop any delete operations triggered by the current delete job that are in progress, and go to a failed state.
* Please note that this will leave your instance in an unknown state as there won't be any rollback operation.
* @param host server parameter.
* @param apiVersion Api Version.
*/
AzureDigitalTwinsAPIImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String host,
String apiVersion) {
AzureDigitalTwinsAPIImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String operationId,
int timeoutInMinutes, String host, String apiVersion) {
this.httpPipeline = httpPipeline;
this.serializerAdapter = serializerAdapter;
this.operationId = operationId;
this.timeoutInMinutes = timeoutInMinutes;
this.host = host;
this.apiVersion = apiVersion;
this.digitalTwinModels = new DigitalTwinModelsImpl(this);
this.queries = new QueriesImpl(this);
this.digitalTwins = new DigitalTwinsImpl(this);
this.eventRoutes = new EventRoutesImpl(this);
this.importJobs = new ImportJobsImpl(this);
this.deleteJobs = new DeleteJobsImpl(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,46 @@ public AzureDigitalTwinsAPIImplBuilder credential(TokenCredential tokenCredentia
return this;
}

/*
* ID for the operation's status monitor. The ID is generated if header was not passed by the client.
*/
@Generated
private String operationId;

/**
* Sets ID for the operation's status monitor. The ID is generated if header was not passed by the client.
*
* @param operationId the operationId value.
* @return the AzureDigitalTwinsAPIImplBuilder.
*/
@Generated
public AzureDigitalTwinsAPIImplBuilder operationId(String operationId) {
this.operationId = operationId;
return this;
}

/*
* Desired timeout for the delete job. Once the specified timeout is reached, service will stop any delete
* operations triggered by the current delete job that are in progress, and go to a failed state. Please note that
* this will leave your instance in an unknown state as there won't be any rollback operation.
*/
@Generated
private int timeoutInMinutes;

/**
* Sets Desired timeout for the delete job. Once the specified timeout is reached, service will stop any delete
* operations triggered by the current delete job that are in progress, and go to a failed state. Please note that
* this will leave your instance in an unknown state as there won't be any rollback operation.
*
* @param timeoutInMinutes the timeoutInMinutes value.
* @return the AzureDigitalTwinsAPIImplBuilder.
*/
@Generated
public AzureDigitalTwinsAPIImplBuilder timeoutInMinutes(int timeoutInMinutes) {
this.timeoutInMinutes = timeoutInMinutes;
return this;
}

/*
* server parameter
*/
Expand Down Expand Up @@ -270,11 +310,11 @@ public AzureDigitalTwinsAPIImpl buildClient() {
this.validateClient();
HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline();
String localHost = (host != null) ? host : "https://digitaltwins-hostname";
String localApiVersion = (apiVersion != null) ? apiVersion : "2022-05-31";
String localApiVersion = (apiVersion != null) ? apiVersion : "2023-10-31";
SerializerAdapter localSerializerAdapter
= (serializerAdapter != null) ? serializerAdapter : JacksonAdapter.createDefaultSerializerAdapter();
AzureDigitalTwinsAPIImpl client
= new AzureDigitalTwinsAPIImpl(localPipeline, localSerializerAdapter, localHost, localApiVersion);
AzureDigitalTwinsAPIImpl client = new AzureDigitalTwinsAPIImpl(localPipeline, localSerializerAdapter,
this.operationId, this.timeoutInMinutes, localHost, localApiVersion);
return client;
}

Expand Down
Loading
Loading