Skip to content

Commit 7a4d004

Browse files
authored
[Automation] Generate SDK based on TypeSpec 0.30.1 (Azure#45272)
1 parent dbc1627 commit 7a4d004

File tree

194 files changed

+41809
-26904
lines changed

Some content is hidden

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

194 files changed

+41809
-26904
lines changed

eng/emitter-package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eng/emitter-package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"main": "dist/src/index.js",
33
"dependencies": {
4-
"@azure-tools/typespec-java": "0.30.0"
4+
"@azure-tools/typespec-java": "0.30.1"
55
},
66
"devDependencies": {
77
"@azure-tools/typespec-autorest": "0.56.0",

sdk/arizeaiobservabilityeval/azure-resourcemanager-arizeaiobservabilityeval/src/main/java/com/azure/resourcemanager/arizeaiobservabilityeval/implementation/ArizeAIObservabilityEvalMgmtClientImpl.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@
1515
import com.azure.core.management.exception.ManagementException;
1616
import com.azure.core.management.polling.PollResult;
1717
import com.azure.core.management.polling.PollerFactory;
18+
import com.azure.core.management.polling.SyncPollerFactory;
19+
import com.azure.core.util.BinaryData;
1820
import com.azure.core.util.Context;
1921
import com.azure.core.util.CoreUtils;
2022
import com.azure.core.util.logging.ClientLogger;
2123
import com.azure.core.util.polling.AsyncPollResponse;
2224
import com.azure.core.util.polling.LongRunningOperationStatus;
2325
import com.azure.core.util.polling.PollerFlux;
26+
import com.azure.core.util.polling.SyncPoller;
2427
import com.azure.core.util.serializer.SerializerAdapter;
2528
import com.azure.core.util.serializer.SerializerEncoding;
2629
import com.azure.resourcemanager.arizeaiobservabilityeval.fluent.ArizeAIObservabilityEvalMgmtClient;
@@ -211,6 +214,23 @@ public <T, U> PollerFlux<PollResult<T>, U> getLroResult(Mono<Response<Flux<ByteB
211214
defaultPollInterval, activationResponse, context);
212215
}
213216

217+
/**
218+
* Gets long running operation result.
219+
*
220+
* @param activationResponse the response of activation operation.
221+
* @param pollResultType type of poll result.
222+
* @param finalResultType type of final result.
223+
* @param context the context shared by all requests.
224+
* @param <T> type of poll result.
225+
* @param <U> type of final result.
226+
* @return SyncPoller for poll result and final result.
227+
*/
228+
public <T, U> SyncPoller<PollResult<T>, U> getLroResult(Response<BinaryData> activationResponse,
229+
Type pollResultType, Type finalResultType, Context context) {
230+
return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType,
231+
defaultPollInterval, () -> activationResponse, context);
232+
}
233+
214234
/**
215235
* Gets the final result, or an error, based on last async poll response.
216236
*

sdk/arizeaiobservabilityeval/azure-resourcemanager-arizeaiobservabilityeval/src/main/java/com/azure/resourcemanager/arizeaiobservabilityeval/implementation/OperationsClientImpl.java

Lines changed: 87 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.azure.core.management.exception.ManagementException;
2626
import com.azure.core.util.Context;
2727
import com.azure.core.util.FluxUtil;
28+
import com.azure.core.util.logging.ClientLogger;
2829
import com.azure.resourcemanager.arizeaiobservabilityeval.fluent.OperationsClient;
2930
import com.azure.resourcemanager.arizeaiobservabilityeval.fluent.models.OperationInner;
3031
import com.azure.resourcemanager.arizeaiobservabilityeval.implementation.models.OperationListResult;
@@ -69,12 +70,26 @@ public interface OperationsService {
6970
Mono<Response<OperationListResult>> list(@HostParam("endpoint") String endpoint,
7071
@QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);
7172

73+
@Headers({ "Content-Type: application/json" })
74+
@Get("/providers/ArizeAi.ObservabilityEval/operations")
75+
@ExpectedResponses({ 200 })
76+
@UnexpectedResponseExceptionType(ManagementException.class)
77+
Response<OperationListResult> listSync(@HostParam("endpoint") String endpoint,
78+
@QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);
79+
7280
@Headers({ "Content-Type: application/json" })
7381
@Get("{nextLink}")
7482
@ExpectedResponses({ 200 })
7583
@UnexpectedResponseExceptionType(ManagementException.class)
7684
Mono<Response<OperationListResult>> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink,
7785
@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context);
86+
87+
@Headers({ "Content-Type: application/json" })
88+
@Get("{nextLink}")
89+
@ExpectedResponses({ 200 })
90+
@UnexpectedResponseExceptionType(ManagementException.class)
91+
Response<OperationListResult> listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink,
92+
@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context);
7893
}
7994

8095
/**
@@ -103,37 +118,35 @@ private Mono<PagedResponse<OperationInner>> listSinglePageAsync() {
103118
/**
104119
* List the operations for the provider.
105120
*
106-
* @param context The context to associate with this operation.
107-
* @throws IllegalArgumentException thrown if parameters fail the validation.
108121
* @throws ManagementException thrown if the request is rejected by server.
109122
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
110-
* @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on
111-
* successful completion of {@link Mono}.
123+
* @return a list of REST API operations supported by an Azure Resource Provider as paginated response with
124+
* {@link PagedFlux}.
112125
*/
113-
@ServiceMethod(returns = ReturnType.SINGLE)
114-
private Mono<PagedResponse<OperationInner>> listSinglePageAsync(Context context) {
115-
if (this.client.getEndpoint() == null) {
116-
return Mono.error(
117-
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
118-
}
119-
final String accept = "application/json";
120-
context = this.client.mergeContext(context);
121-
return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)
122-
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
123-
res.getValue().value(), res.getValue().nextLink(), null));
126+
@ServiceMethod(returns = ReturnType.COLLECTION)
127+
private PagedFlux<OperationInner> listAsync() {
128+
return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink));
124129
}
125130

126131
/**
127132
* List the operations for the provider.
128133
*
129134
* @throws ManagementException thrown if the request is rejected by server.
130135
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
131-
* @return a list of REST API operations supported by an Azure Resource Provider as paginated response with
132-
* {@link PagedFlux}.
136+
* @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}.
133137
*/
134-
@ServiceMethod(returns = ReturnType.COLLECTION)
135-
private PagedFlux<OperationInner> listAsync() {
136-
return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink));
138+
@ServiceMethod(returns = ReturnType.SINGLE)
139+
private PagedResponse<OperationInner> listSinglePage() {
140+
if (this.client.getEndpoint() == null) {
141+
throw LOGGER.atError()
142+
.log(new IllegalArgumentException(
143+
"Parameter this.client.getEndpoint() is required and cannot be null."));
144+
}
145+
final String accept = "application/json";
146+
Response<OperationListResult> res
147+
= service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE);
148+
return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(),
149+
res.getValue().nextLink(), null);
137150
}
138151

139152
/**
@@ -143,13 +156,20 @@ private PagedFlux<OperationInner> listAsync() {
143156
* @throws IllegalArgumentException thrown if parameters fail the validation.
144157
* @throws ManagementException thrown if the request is rejected by server.
145158
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
146-
* @return a list of REST API operations supported by an Azure Resource Provider as paginated response with
147-
* {@link PagedFlux}.
159+
* @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}.
148160
*/
149-
@ServiceMethod(returns = ReturnType.COLLECTION)
150-
private PagedFlux<OperationInner> listAsync(Context context) {
151-
return new PagedFlux<>(() -> listSinglePageAsync(context),
152-
nextLink -> listNextSinglePageAsync(nextLink, context));
161+
@ServiceMethod(returns = ReturnType.SINGLE)
162+
private PagedResponse<OperationInner> listSinglePage(Context context) {
163+
if (this.client.getEndpoint() == null) {
164+
throw LOGGER.atError()
165+
.log(new IllegalArgumentException(
166+
"Parameter this.client.getEndpoint() is required and cannot be null."));
167+
}
168+
final String accept = "application/json";
169+
Response<OperationListResult> res
170+
= service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context);
171+
return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(),
172+
res.getValue().nextLink(), null);
153173
}
154174

155175
/**
@@ -162,7 +182,7 @@ private PagedFlux<OperationInner> listAsync(Context context) {
162182
*/
163183
@ServiceMethod(returns = ReturnType.COLLECTION)
164184
public PagedIterable<OperationInner> list() {
165-
return new PagedIterable<>(listAsync());
185+
return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink));
166186
}
167187

168188
/**
@@ -177,7 +197,7 @@ public PagedIterable<OperationInner> list() {
177197
*/
178198
@ServiceMethod(returns = ReturnType.COLLECTION)
179199
public PagedIterable<OperationInner> list(Context context) {
180-
return new PagedIterable<>(listAsync(context));
200+
return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context));
181201
}
182202

183203
/**
@@ -206,6 +226,33 @@ private Mono<PagedResponse<OperationInner>> listNextSinglePageAsync(String nextL
206226
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
207227
}
208228

229+
/**
230+
* Get the next page of items.
231+
*
232+
* @param nextLink The URL to get the next list of items.
233+
* @throws IllegalArgumentException thrown if parameters fail the validation.
234+
* @throws ManagementException thrown if the request is rejected by server.
235+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
236+
* @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}.
237+
*/
238+
@ServiceMethod(returns = ReturnType.SINGLE)
239+
private PagedResponse<OperationInner> listNextSinglePage(String nextLink) {
240+
if (nextLink == null) {
241+
throw LOGGER.atError()
242+
.log(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
243+
}
244+
if (this.client.getEndpoint() == null) {
245+
throw LOGGER.atError()
246+
.log(new IllegalArgumentException(
247+
"Parameter this.client.getEndpoint() is required and cannot be null."));
248+
}
249+
final String accept = "application/json";
250+
Response<OperationListResult> res
251+
= service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE);
252+
return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(),
253+
res.getValue().nextLink(), null);
254+
}
255+
209256
/**
210257
* Get the next page of items.
211258
*
@@ -214,22 +261,24 @@ private Mono<PagedResponse<OperationInner>> listNextSinglePageAsync(String nextL
214261
* @throws IllegalArgumentException thrown if parameters fail the validation.
215262
* @throws ManagementException thrown if the request is rejected by server.
216263
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
217-
* @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on
218-
* successful completion of {@link Mono}.
264+
* @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}.
219265
*/
220266
@ServiceMethod(returns = ReturnType.SINGLE)
221-
private Mono<PagedResponse<OperationInner>> listNextSinglePageAsync(String nextLink, Context context) {
267+
private PagedResponse<OperationInner> listNextSinglePage(String nextLink, Context context) {
222268
if (nextLink == null) {
223-
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
269+
throw LOGGER.atError()
270+
.log(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
224271
}
225272
if (this.client.getEndpoint() == null) {
226-
return Mono.error(
227-
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
273+
throw LOGGER.atError()
274+
.log(new IllegalArgumentException(
275+
"Parameter this.client.getEndpoint() is required and cannot be null."));
228276
}
229277
final String accept = "application/json";
230-
context = this.client.mergeContext(context);
231-
return service.listNext(nextLink, this.client.getEndpoint(), accept, context)
232-
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
233-
res.getValue().value(), res.getValue().nextLink(), null));
278+
Response<OperationListResult> res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context);
279+
return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(),
280+
res.getValue().nextLink(), null);
234281
}
282+
283+
private static final ClientLogger LOGGER = new ClientLogger(OperationsClientImpl.class);
235284
}

0 commit comments

Comments
 (0)