Skip to content

Commit a3b92fc

Browse files
[Automation] Generate Fluent Lite from TypeSpec computefleet (#41244)
* [Automation] External Change * [Automation] Generate Fluent Lite from TypeSpec computefleet * Update CHANGELOG.md * Update CHANGELOG.md --------- Co-authored-by: Haoling Dong <[email protected]>
1 parent 880ef3f commit a3b92fc

File tree

15 files changed

+367
-273
lines changed

15 files changed

+367
-273
lines changed

sdk/computefleet/azure-resourcemanager-computefleet/CHANGELOG.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
# Release History
22

3-
## 1.0.0-beta.2 (Unreleased)
3+
## 1.0.0-beta.2 (2024-07-23)
44

5-
### Features Added
5+
- Azure Resource Manager Compute Fleet client library for Java. This package contains Microsoft Azure SDK for Compute Fleet Management SDK. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).
66

77
### Breaking Changes
88

9-
### Bugs Fixed
10-
11-
### Other Changes
9+
* Change `listVirtualMachineScaleSets` to pageable operation (as there is a bug fix in spec).
1210

1311
## 1.0.0-beta.1 (2024-07-22)
1412

sdk/computefleet/azure-resourcemanager-computefleet/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Various documentation is available to help you get started
3232
<dependency>
3333
<groupId>com.azure.resourcemanager</groupId>
3434
<artifactId>azure-resourcemanager-computefleet</artifactId>
35-
<version>1.0.0-beta.1</version>
35+
<version>1.0.0-beta.2</version>
3636
</dependency>
3737
```
3838
[//]: # ({x-version-update-end})

sdk/computefleet/azure-resourcemanager-computefleet/SAMPLE.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,8 +517,7 @@ public final class FleetsListVirtualMachineScaleSetsSamples {
517517
*/
518518
public static void
519519
fleetsListVirtualMachineScaleSets(com.azure.resourcemanager.computefleet.ComputeFleetManager manager) {
520-
manager.fleets()
521-
.listVirtualMachineScaleSetsWithResponse("rgazurefleet", "myFleet", com.azure.core.util.Context.NONE);
520+
manager.fleets().listVirtualMachineScaleSets("rgazurefleet", "myFleet", com.azure.core.util.Context.NONE);
522521
}
523522
}
524523
```

sdk/computefleet/azure-resourcemanager-computefleet/src/main/java/com/azure/resourcemanager/computefleet/fluent/FleetsClient.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import com.azure.core.util.Context;
1313
import com.azure.core.util.polling.SyncPoller;
1414
import com.azure.resourcemanager.computefleet.fluent.models.FleetInner;
15-
import com.azure.resourcemanager.computefleet.fluent.models.VirtualMachineScaleSetListResultInner;
15+
import com.azure.resourcemanager.computefleet.fluent.models.VirtualMachineScaleSetInner;
1616
import com.azure.resourcemanager.computefleet.models.FleetUpdate;
1717

1818
/**
@@ -270,26 +270,26 @@ SyncPoller<PollResult<FleetInner>, FleetInner> beginUpdate(String resourceGroupN
270270
*
271271
* @param resourceGroupName The name of the resource group. The name is case insensitive.
272272
* @param name The name of the Fleet.
273-
* @param context The context to associate with this operation.
274273
* @throws IllegalArgumentException thrown if parameters fail the validation.
275274
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
276275
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
277-
* @return the response of a VirtualMachineScaleSet list operation along with {@link Response}.
276+
* @return the response of a VirtualMachineScaleSet list operation as paginated response with {@link PagedIterable}.
278277
*/
279-
@ServiceMethod(returns = ReturnType.SINGLE)
280-
Response<VirtualMachineScaleSetListResultInner> listVirtualMachineScaleSetsWithResponse(String resourceGroupName,
281-
String name, Context context);
278+
@ServiceMethod(returns = ReturnType.COLLECTION)
279+
PagedIterable<VirtualMachineScaleSetInner> listVirtualMachineScaleSets(String resourceGroupName, String name);
282280

283281
/**
284282
* List VirtualMachineScaleSet resources by Fleet.
285283
*
286284
* @param resourceGroupName The name of the resource group. The name is case insensitive.
287285
* @param name The name of the Fleet.
286+
* @param context The context to associate with this operation.
288287
* @throws IllegalArgumentException thrown if parameters fail the validation.
289288
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
290289
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
291-
* @return the response of a VirtualMachineScaleSet list operation.
290+
* @return the response of a VirtualMachineScaleSet list operation as paginated response with {@link PagedIterable}.
292291
*/
293-
@ServiceMethod(returns = ReturnType.SINGLE)
294-
VirtualMachineScaleSetListResultInner listVirtualMachineScaleSets(String resourceGroupName, String name);
292+
@ServiceMethod(returns = ReturnType.COLLECTION)
293+
PagedIterable<VirtualMachineScaleSetInner> listVirtualMachineScaleSets(String resourceGroupName, String name,
294+
Context context);
295295
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
// Code generated by Microsoft (R) TypeSpec Code Generator.
4+
5+
package com.azure.resourcemanager.computefleet.fluent.models;
6+
7+
import com.azure.core.annotation.Immutable;
8+
import com.azure.json.JsonReader;
9+
import com.azure.json.JsonSerializable;
10+
import com.azure.json.JsonToken;
11+
import com.azure.json.JsonWriter;
12+
import com.azure.resourcemanager.computefleet.models.ApiError;
13+
import com.azure.resourcemanager.computefleet.models.ProvisioningState;
14+
import java.io.IOException;
15+
16+
/**
17+
* An AzureFleet's virtualMachineScaleSet.
18+
*/
19+
@Immutable
20+
public final class VirtualMachineScaleSetInner implements JsonSerializable<VirtualMachineScaleSetInner> {
21+
/*
22+
* The compute RP resource id of the virtualMachineScaleSet
23+
* "subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}"
24+
*/
25+
private String id;
26+
27+
/*
28+
* Type of the virtualMachineScaleSet
29+
*/
30+
private String type;
31+
32+
/*
33+
* This represents the operationStatus of the VMSS in response to the last operation that was performed on it by
34+
* Azure Fleet resource.
35+
*/
36+
private ProvisioningState operationStatus;
37+
38+
/*
39+
* Error Information when `operationStatus` is `Failed`
40+
*/
41+
private ApiError error;
42+
43+
/**
44+
* Creates an instance of VirtualMachineScaleSetInner class.
45+
*/
46+
private VirtualMachineScaleSetInner() {
47+
}
48+
49+
/**
50+
* Get the id property: The compute RP resource id of the virtualMachineScaleSet
51+
* "subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}".
52+
*
53+
* @return the id value.
54+
*/
55+
public String id() {
56+
return this.id;
57+
}
58+
59+
/**
60+
* Get the type property: Type of the virtualMachineScaleSet.
61+
*
62+
* @return the type value.
63+
*/
64+
public String type() {
65+
return this.type;
66+
}
67+
68+
/**
69+
* Get the operationStatus property: This represents the operationStatus of the VMSS in response to the last
70+
* operation that was performed on it by Azure Fleet resource.
71+
*
72+
* @return the operationStatus value.
73+
*/
74+
public ProvisioningState operationStatus() {
75+
return this.operationStatus;
76+
}
77+
78+
/**
79+
* Get the error property: Error Information when `operationStatus` is `Failed`.
80+
*
81+
* @return the error value.
82+
*/
83+
public ApiError error() {
84+
return this.error;
85+
}
86+
87+
/**
88+
* Validates the instance.
89+
*
90+
* @throws IllegalArgumentException thrown if the instance is not valid.
91+
*/
92+
public void validate() {
93+
if (error() != null) {
94+
error().validate();
95+
}
96+
}
97+
98+
/**
99+
* {@inheritDoc}
100+
*/
101+
@Override
102+
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
103+
jsonWriter.writeStartObject();
104+
return jsonWriter.writeEndObject();
105+
}
106+
107+
/**
108+
* Reads an instance of VirtualMachineScaleSetInner from the JsonReader.
109+
*
110+
* @param jsonReader The JsonReader being read.
111+
* @return An instance of VirtualMachineScaleSetInner if the JsonReader was pointing to an instance of it, or null
112+
* if it was pointing to JSON null.
113+
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
114+
* @throws IOException If an error occurs while reading the VirtualMachineScaleSetInner.
115+
*/
116+
public static VirtualMachineScaleSetInner fromJson(JsonReader jsonReader) throws IOException {
117+
return jsonReader.readObject(reader -> {
118+
VirtualMachineScaleSetInner deserializedVirtualMachineScaleSetInner = new VirtualMachineScaleSetInner();
119+
while (reader.nextToken() != JsonToken.END_OBJECT) {
120+
String fieldName = reader.getFieldName();
121+
reader.nextToken();
122+
123+
if ("id".equals(fieldName)) {
124+
deserializedVirtualMachineScaleSetInner.id = reader.getString();
125+
} else if ("operationStatus".equals(fieldName)) {
126+
deserializedVirtualMachineScaleSetInner.operationStatus
127+
= ProvisioningState.fromString(reader.getString());
128+
} else if ("type".equals(fieldName)) {
129+
deserializedVirtualMachineScaleSetInner.type = reader.getString();
130+
} else if ("error".equals(fieldName)) {
131+
deserializedVirtualMachineScaleSetInner.error = ApiError.fromJson(reader);
132+
} else {
133+
reader.skipChildren();
134+
}
135+
}
136+
137+
return deserializedVirtualMachineScaleSetInner;
138+
});
139+
}
140+
}

0 commit comments

Comments
 (0)