Skip to content

Commit 4a5a6b8

Browse files
authored
SE updates from latest sha (Azure#45794)
1 parent aeb51ea commit 4a5a6b8

File tree

52 files changed

+575
-677
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+575
-677
lines changed

sdk/eventgrid/azure-messaging-eventgrid-systemevents/customization/src/main/java/EventGridSystemEventsCustomization.java

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import com.azure.autorest.customization.ClassCustomization;
55
import com.azure.autorest.customization.Customization;
6-
import com.azure.autorest.customization.Editor;
76
import com.azure.autorest.customization.LibraryCustomization;
87
import com.azure.autorest.customization.PackageCustomization;
98
import com.github.javaparser.ast.CompilationUnit;
@@ -14,9 +13,8 @@
1413
import com.github.javaparser.ast.nodeTypes.NodeWithJavadoc;
1514
import com.github.javaparser.ast.stmt.BlockStmt;
1615
import com.github.javaparser.javadoc.Javadoc;
17-
import org.slf4j.Logger;
18-
1916
import java.time.Duration;
17+
import java.time.OffsetDateTime;
2018
import java.util.ArrayList;
2119
import java.util.Arrays;
2220
import java.util.Collections;
@@ -26,6 +24,7 @@
2624
import java.util.concurrent.atomic.AtomicReference;
2725
import java.util.function.Function;
2826
import java.util.stream.Collectors;
27+
import org.slf4j.Logger;
2928

3029
import static com.github.javaparser.StaticJavaParser.parseBlock;
3130
import static com.github.javaparser.StaticJavaParser.parseExpression;
@@ -160,6 +159,45 @@ public void customize(LibraryCustomization customization, Logger logger) {
160159
customizeAcsRecordingFileStatusUpdatedEventDataDuration(systemEvent);
161160
customizeStorageDirectoryDeletedEventData(systemEvent);
162161
customizeAcsMessageEventDataAndInheritingClasses(systemEvent);
162+
customizeIothubEventData(systemEvent);
163+
customizeEventGridMQTTClientEventData(systemEvent);
164+
}
165+
166+
public void customizeEventGridMQTTClientEventData(PackageCustomization customization) {
167+
customization.getClass("EventGridMqttClientEventData").customizeAst(ast ->
168+
ast.getClassByName("EventGridMqttClientEventData")
169+
.ifPresent(clazz -> clazz.getMethodsByName("setClientName")
170+
.forEach(method -> method.setModifiers(Modifier.Keyword.PRIVATE))));
171+
172+
//// For inherited classes, remove the getClientName method entirely to avoid override conflicts
173+
//List<String> inheritedClassNames = Arrays.asList("EventGridMqttClientCreatedOrUpdatedEventData",
174+
// "EventGridMqttClientDeletedEventData", "EventGridMqttClientSessionConnectedEventData",
175+
// "EventGridMqttClientSessionDisconnectedEventData");
176+
//
177+
//for (String className : inheritedClassNames) {
178+
// customization.getClass(className).customizeAst(ast -> {
179+
// ast.getClassByName(className).ifPresent(clazz -> {
180+
// // Remove the getClientName method from inherited classes
181+
// clazz.getMethodsByName("getClientName")
182+
// .forEach(method -> clazz.remove(method));
183+
// });
184+
// });
185+
//}
186+
}
187+
188+
public void customizeIothubEventData(PackageCustomization customization) {
189+
customization.getClass("DeviceTwinMetadata").customizeAst(ast -> ast.getClassByName("DeviceTwinMetadata")
190+
.ifPresent(clazz -> clazz.getMethodsByName("getLastUpdated").forEach(m -> m.setType(OffsetDateTime.class)
191+
.setBody(parseBlock("{ return lastUpdated == null ? null : OffsetDateTime.parse(lastUpdated); }")))));
192+
193+
customization.getClass("DeviceTwinInfo").customizeAst(ast -> ast.getClassByName("DeviceTwinInfo")
194+
.ifPresent(clazz -> clazz.getMethodsByName("getLastActivityTime").forEach(m -> m.setType(OffsetDateTime.class)
195+
.setBody(parseBlock("{ return lastActivityTime == null ? null : OffsetDateTime.parse" +
196+
"(lastActivityTime); }")))));
197+
198+
customization.getClass("DeviceTwinInfo").customizeAst(ast -> ast.getClassByName("DeviceTwinInfo")
199+
.ifPresent(clazz -> clazz.getMethodsByName("getStatusUpdateTime").forEach(m -> m.setType(OffsetDateTime.class)
200+
.setBody(parseBlock("{ return statusUpdateTime == null ? null : OffsetDateTime.parse(statusUpdateTime); }")))));
163201
}
164202

165203
public void customizeAcsRouterEvents(PackageCustomization customization) {

sdk/eventgrid/azure-messaging-eventgrid-systemevents/src/main/java/com/azure/messaging/eventgrid/systemevents/models/ApiManagementApiCreatedEventData.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public final class ApiManagementApiCreatedEventData implements JsonSerializable<
2424
* ResourceType>/<ResourceName>`
2525
*/
2626
@Generated
27-
private String resourceUri;
27+
private String resourceUrl;
2828

2929
/**
3030
* Creates an instance of ApiManagementApiCreatedEventData class.
@@ -34,15 +34,15 @@ private ApiManagementApiCreatedEventData() {
3434
}
3535

3636
/**
37-
* Get the resourceUri property: The fully qualified ID of the resource that the compliance state change is for,
37+
* Get the resourceUrl property: The fully qualified ID of the resource that the compliance state change is for,
3838
* including the resource name and resource type. Uses the format,
3939
* `/subscriptions/&lt;SubscriptionID&gt;/resourceGroups/&lt;ResourceGroup&gt;/Microsoft.ApiManagement/service/&lt;ServiceName&gt;/&lt;ResourceType&gt;/&lt;ResourceName&gt;`.
4040
*
41-
* @return the resourceUri value.
41+
* @return the resourceUrl value.
4242
*/
4343
@Generated
44-
public String getResourceUri() {
45-
return this.resourceUri;
44+
public String getResourceUrl() {
45+
return this.resourceUrl;
4646
}
4747

4848
/**
@@ -52,7 +52,7 @@ public String getResourceUri() {
5252
@Override
5353
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
5454
jsonWriter.writeStartObject();
55-
jsonWriter.writeStringField("resourceUri", this.resourceUri);
55+
jsonWriter.writeStringField("resourceUri", this.resourceUrl);
5656
return jsonWriter.writeEndObject();
5757
}
5858

@@ -73,7 +73,7 @@ public static ApiManagementApiCreatedEventData fromJson(JsonReader jsonReader) t
7373
String fieldName = reader.getFieldName();
7474
reader.nextToken();
7575
if ("resourceUri".equals(fieldName)) {
76-
deserializedApiManagementApiCreatedEventData.resourceUri = reader.getString();
76+
deserializedApiManagementApiCreatedEventData.resourceUrl = reader.getString();
7777
} else {
7878
reader.skipChildren();
7979
}

sdk/eventgrid/azure-messaging-eventgrid-systemevents/src/main/java/com/azure/messaging/eventgrid/systemevents/models/ApiManagementApiDeletedEventData.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public final class ApiManagementApiDeletedEventData implements JsonSerializable<
2424
* ResourceType>/<ResourceName>`
2525
*/
2626
@Generated
27-
private String resourceUri;
27+
private String resourceUrl;
2828

2929
/**
3030
* Creates an instance of ApiManagementApiDeletedEventData class.
@@ -34,15 +34,15 @@ private ApiManagementApiDeletedEventData() {
3434
}
3535

3636
/**
37-
* Get the resourceUri property: The fully qualified ID of the resource that the compliance state change is for,
37+
* Get the resourceUrl property: The fully qualified ID of the resource that the compliance state change is for,
3838
* including the resource name and resource type. Uses the format,
3939
* `/subscriptions/&lt;SubscriptionID&gt;/resourceGroups/&lt;ResourceGroup&gt;/Microsoft.ApiManagement/service/&lt;ServiceName&gt;/&lt;ResourceType&gt;/&lt;ResourceName&gt;`.
4040
*
41-
* @return the resourceUri value.
41+
* @return the resourceUrl value.
4242
*/
4343
@Generated
44-
public String getResourceUri() {
45-
return this.resourceUri;
44+
public String getResourceUrl() {
45+
return this.resourceUrl;
4646
}
4747

4848
/**
@@ -52,7 +52,7 @@ public String getResourceUri() {
5252
@Override
5353
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
5454
jsonWriter.writeStartObject();
55-
jsonWriter.writeStringField("resourceUri", this.resourceUri);
55+
jsonWriter.writeStringField("resourceUri", this.resourceUrl);
5656
return jsonWriter.writeEndObject();
5757
}
5858

@@ -73,7 +73,7 @@ public static ApiManagementApiDeletedEventData fromJson(JsonReader jsonReader) t
7373
String fieldName = reader.getFieldName();
7474
reader.nextToken();
7575
if ("resourceUri".equals(fieldName)) {
76-
deserializedApiManagementApiDeletedEventData.resourceUri = reader.getString();
76+
deserializedApiManagementApiDeletedEventData.resourceUrl = reader.getString();
7777
} else {
7878
reader.skipChildren();
7979
}

sdk/eventgrid/azure-messaging-eventgrid-systemevents/src/main/java/com/azure/messaging/eventgrid/systemevents/models/ApiManagementApiReleaseCreatedEventData.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public final class ApiManagementApiReleaseCreatedEventData
2525
* ResourceType>/<ResourceName>`
2626
*/
2727
@Generated
28-
private String resourceUri;
28+
private String resourceUrl;
2929

3030
/**
3131
* Creates an instance of ApiManagementApiReleaseCreatedEventData class.
@@ -35,15 +35,15 @@ private ApiManagementApiReleaseCreatedEventData() {
3535
}
3636

3737
/**
38-
* Get the resourceUri property: The fully qualified ID of the resource that the compliance state change is for,
38+
* Get the resourceUrl property: The fully qualified ID of the resource that the compliance state change is for,
3939
* including the resource name and resource type. Uses the format,
4040
* `/subscriptions/&lt;SubscriptionID&gt;/resourceGroups/&lt;ResourceGroup&gt;/Microsoft.ApiManagement/service/&lt;ServiceName&gt;/&lt;ResourceType&gt;/&lt;ResourceName&gt;`.
4141
*
42-
* @return the resourceUri value.
42+
* @return the resourceUrl value.
4343
*/
4444
@Generated
45-
public String getResourceUri() {
46-
return this.resourceUri;
45+
public String getResourceUrl() {
46+
return this.resourceUrl;
4747
}
4848

4949
/**
@@ -53,7 +53,7 @@ public String getResourceUri() {
5353
@Override
5454
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
5555
jsonWriter.writeStartObject();
56-
jsonWriter.writeStringField("resourceUri", this.resourceUri);
56+
jsonWriter.writeStringField("resourceUri", this.resourceUrl);
5757
return jsonWriter.writeEndObject();
5858
}
5959

@@ -74,7 +74,7 @@ public static ApiManagementApiReleaseCreatedEventData fromJson(JsonReader jsonRe
7474
String fieldName = reader.getFieldName();
7575
reader.nextToken();
7676
if ("resourceUri".equals(fieldName)) {
77-
deserializedApiManagementApiReleaseCreatedEventData.resourceUri = reader.getString();
77+
deserializedApiManagementApiReleaseCreatedEventData.resourceUrl = reader.getString();
7878
} else {
7979
reader.skipChildren();
8080
}

sdk/eventgrid/azure-messaging-eventgrid-systemevents/src/main/java/com/azure/messaging/eventgrid/systemevents/models/ApiManagementApiReleaseDeletedEventData.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public final class ApiManagementApiReleaseDeletedEventData
2525
* ResourceType>/<ResourceName>`
2626
*/
2727
@Generated
28-
private String resourceUri;
28+
private String resourceUrl;
2929

3030
/**
3131
* Creates an instance of ApiManagementApiReleaseDeletedEventData class.
@@ -35,15 +35,15 @@ private ApiManagementApiReleaseDeletedEventData() {
3535
}
3636

3737
/**
38-
* Get the resourceUri property: The fully qualified ID of the resource that the compliance state change is for,
38+
* Get the resourceUrl property: The fully qualified ID of the resource that the compliance state change is for,
3939
* including the resource name and resource type. Uses the format,
4040
* `/subscriptions/&lt;SubscriptionID&gt;/resourceGroups/&lt;ResourceGroup&gt;/Microsoft.ApiManagement/service/&lt;ServiceName&gt;/&lt;ResourceType&gt;/&lt;ResourceName&gt;`.
4141
*
42-
* @return the resourceUri value.
42+
* @return the resourceUrl value.
4343
*/
4444
@Generated
45-
public String getResourceUri() {
46-
return this.resourceUri;
45+
public String getResourceUrl() {
46+
return this.resourceUrl;
4747
}
4848

4949
/**
@@ -53,7 +53,7 @@ public String getResourceUri() {
5353
@Override
5454
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
5555
jsonWriter.writeStartObject();
56-
jsonWriter.writeStringField("resourceUri", this.resourceUri);
56+
jsonWriter.writeStringField("resourceUri", this.resourceUrl);
5757
return jsonWriter.writeEndObject();
5858
}
5959

@@ -74,7 +74,7 @@ public static ApiManagementApiReleaseDeletedEventData fromJson(JsonReader jsonRe
7474
String fieldName = reader.getFieldName();
7575
reader.nextToken();
7676
if ("resourceUri".equals(fieldName)) {
77-
deserializedApiManagementApiReleaseDeletedEventData.resourceUri = reader.getString();
77+
deserializedApiManagementApiReleaseDeletedEventData.resourceUrl = reader.getString();
7878
} else {
7979
reader.skipChildren();
8080
}

sdk/eventgrid/azure-messaging-eventgrid-systemevents/src/main/java/com/azure/messaging/eventgrid/systemevents/models/ApiManagementApiReleaseUpdatedEventData.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public final class ApiManagementApiReleaseUpdatedEventData
2525
* ResourceType>/<ResourceName>`
2626
*/
2727
@Generated
28-
private String resourceUri;
28+
private String resourceUrl;
2929

3030
/**
3131
* Creates an instance of ApiManagementApiReleaseUpdatedEventData class.
@@ -35,15 +35,15 @@ private ApiManagementApiReleaseUpdatedEventData() {
3535
}
3636

3737
/**
38-
* Get the resourceUri property: The fully qualified ID of the resource that the compliance state change is for,
38+
* Get the resourceUrl property: The fully qualified ID of the resource that the compliance state change is for,
3939
* including the resource name and resource type. Uses the format,
4040
* `/subscriptions/&lt;SubscriptionID&gt;/resourceGroups/&lt;ResourceGroup&gt;/Microsoft.ApiManagement/service/&lt;ServiceName&gt;/&lt;ResourceType&gt;/&lt;ResourceName&gt;`.
4141
*
42-
* @return the resourceUri value.
42+
* @return the resourceUrl value.
4343
*/
4444
@Generated
45-
public String getResourceUri() {
46-
return this.resourceUri;
45+
public String getResourceUrl() {
46+
return this.resourceUrl;
4747
}
4848

4949
/**
@@ -53,7 +53,7 @@ public String getResourceUri() {
5353
@Override
5454
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
5555
jsonWriter.writeStartObject();
56-
jsonWriter.writeStringField("resourceUri", this.resourceUri);
56+
jsonWriter.writeStringField("resourceUri", this.resourceUrl);
5757
return jsonWriter.writeEndObject();
5858
}
5959

@@ -74,7 +74,7 @@ public static ApiManagementApiReleaseUpdatedEventData fromJson(JsonReader jsonRe
7474
String fieldName = reader.getFieldName();
7575
reader.nextToken();
7676
if ("resourceUri".equals(fieldName)) {
77-
deserializedApiManagementApiReleaseUpdatedEventData.resourceUri = reader.getString();
77+
deserializedApiManagementApiReleaseUpdatedEventData.resourceUrl = reader.getString();
7878
} else {
7979
reader.skipChildren();
8080
}

sdk/eventgrid/azure-messaging-eventgrid-systemevents/src/main/java/com/azure/messaging/eventgrid/systemevents/models/ApiManagementApiUpdatedEventData.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public final class ApiManagementApiUpdatedEventData implements JsonSerializable<
2424
* ResourceType>/<ResourceName>`
2525
*/
2626
@Generated
27-
private String resourceUri;
27+
private String resourceUrl;
2828

2929
/**
3030
* Creates an instance of ApiManagementApiUpdatedEventData class.
@@ -34,15 +34,15 @@ private ApiManagementApiUpdatedEventData() {
3434
}
3535

3636
/**
37-
* Get the resourceUri property: The fully qualified ID of the resource that the compliance state change is for,
37+
* Get the resourceUrl property: The fully qualified ID of the resource that the compliance state change is for,
3838
* including the resource name and resource type. Uses the format,
3939
* `/subscriptions/&lt;SubscriptionID&gt;/resourceGroups/&lt;ResourceGroup&gt;/Microsoft.ApiManagement/service/&lt;ServiceName&gt;/&lt;ResourceType&gt;/&lt;ResourceName&gt;`.
4040
*
41-
* @return the resourceUri value.
41+
* @return the resourceUrl value.
4242
*/
4343
@Generated
44-
public String getResourceUri() {
45-
return this.resourceUri;
44+
public String getResourceUrl() {
45+
return this.resourceUrl;
4646
}
4747

4848
/**
@@ -52,7 +52,7 @@ public String getResourceUri() {
5252
@Override
5353
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
5454
jsonWriter.writeStartObject();
55-
jsonWriter.writeStringField("resourceUri", this.resourceUri);
55+
jsonWriter.writeStringField("resourceUri", this.resourceUrl);
5656
return jsonWriter.writeEndObject();
5757
}
5858

@@ -73,7 +73,7 @@ public static ApiManagementApiUpdatedEventData fromJson(JsonReader jsonReader) t
7373
String fieldName = reader.getFieldName();
7474
reader.nextToken();
7575
if ("resourceUri".equals(fieldName)) {
76-
deserializedApiManagementApiUpdatedEventData.resourceUri = reader.getString();
76+
deserializedApiManagementApiUpdatedEventData.resourceUrl = reader.getString();
7777
} else {
7878
reader.skipChildren();
7979
}

0 commit comments

Comments
 (0)