Skip to content

Commit 844d3be

Browse files
authored
[Dev center] Regenerate with sync stack enabled (Azure#36823)
1 parent ba566ab commit 844d3be

File tree

13 files changed

+3328
-277
lines changed

13 files changed

+3328
-277
lines changed

sdk/devcenter/azure-developer-devcenter/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
</developers>
3939
<properties>
4040
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
41-
<jacoco.min.linecoverage>0.25</jacoco.min.linecoverage>
42-
<jacoco.min.branchcoverage>0.15</jacoco.min.branchcoverage>
41+
<jacoco.min.linecoverage>0.18</jacoco.min.linecoverage>
42+
<jacoco.min.branchcoverage>0.11</jacoco.min.branchcoverage>
4343
</properties>
4444
<dependencies>
4545
<dependency>

sdk/devcenter/azure-developer-devcenter/src/main/java/com/azure/developer/devcenter/DevBoxesClient.java

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,22 @@
1717
import com.azure.core.http.rest.Response;
1818
import com.azure.core.util.BinaryData;
1919
import com.azure.core.util.polling.SyncPoller;
20+
import com.azure.developer.devcenter.implementation.DevBoxesImpl;
2021
import java.time.OffsetDateTime;
2122

2223
/** Initializes a new instance of the synchronous DevCenterClient type. */
2324
@ServiceClient(builder = DevBoxesClientBuilder.class)
2425
public final class DevBoxesClient {
25-
@Generated private final DevBoxesAsyncClient client;
26+
@Generated private final DevBoxesImpl serviceClient;
2627

2728
/**
2829
* Initializes an instance of DevBoxesClient class.
2930
*
30-
* @param client the async client.
31+
* @param serviceClient the service client implementation.
3132
*/
3233
@Generated
33-
DevBoxesClient(DevBoxesAsyncClient client) {
34-
this.client = client;
34+
DevBoxesClient(DevBoxesImpl serviceClient) {
35+
this.serviceClient = serviceClient;
3536
}
3637

3738
/**
@@ -88,7 +89,7 @@ public final class DevBoxesClient {
8889
@Generated
8990
@ServiceMethod(returns = ReturnType.COLLECTION)
9091
public PagedIterable<BinaryData> listPools(String projectName, RequestOptions requestOptions) {
91-
return new PagedIterable<>(this.client.listPools(projectName, requestOptions));
92+
return this.serviceClient.listPools(projectName, requestOptions);
9293
}
9394

9495
/**
@@ -136,7 +137,7 @@ public PagedIterable<BinaryData> listPools(String projectName, RequestOptions re
136137
@ServiceMethod(returns = ReturnType.SINGLE)
137138
public Response<BinaryData> getPoolWithResponse(
138139
String poolName, String projectName, RequestOptions requestOptions) {
139-
return this.client.getPoolWithResponse(poolName, projectName, requestOptions).block();
140+
return this.serviceClient.getPoolWithResponse(poolName, projectName, requestOptions);
140141
}
141142

142143
/**
@@ -178,7 +179,7 @@ public Response<BinaryData> getPoolWithResponse(
178179
@ServiceMethod(returns = ReturnType.COLLECTION)
179180
public PagedIterable<BinaryData> listSchedulesByPool(
180181
String projectName, String poolName, RequestOptions requestOptions) {
181-
return new PagedIterable<>(this.client.listSchedulesByPool(projectName, poolName, requestOptions));
182+
return this.serviceClient.listSchedulesByPool(projectName, poolName, requestOptions);
182183
}
183184

184185
/**
@@ -210,7 +211,7 @@ public PagedIterable<BinaryData> listSchedulesByPool(
210211
@ServiceMethod(returns = ReturnType.SINGLE)
211212
public Response<BinaryData> getScheduleByPoolWithResponse(
212213
String projectName, String poolName, String scheduleName, RequestOptions requestOptions) {
213-
return this.client.getScheduleByPoolWithResponse(projectName, poolName, scheduleName, requestOptions).block();
214+
return this.serviceClient.getScheduleByPoolWithResponse(projectName, poolName, scheduleName, requestOptions);
214215
}
215216

216217
/**
@@ -282,7 +283,7 @@ public Response<BinaryData> getScheduleByPoolWithResponse(
282283
@ServiceMethod(returns = ReturnType.COLLECTION)
283284
public PagedIterable<BinaryData> listDevBoxesByUser(
284285
String projectName, String userId, RequestOptions requestOptions) {
285-
return new PagedIterable<>(this.client.listDevBoxesByUser(projectName, userId, requestOptions));
286+
return this.serviceClient.listDevBoxesByUser(projectName, userId, requestOptions);
286287
}
287288

288289
/**
@@ -344,7 +345,7 @@ public PagedIterable<BinaryData> listDevBoxesByUser(
344345
@ServiceMethod(returns = ReturnType.SINGLE)
345346
public Response<BinaryData> getDevBoxByUserWithResponse(
346347
String projectName, String userId, String devBoxName, RequestOptions requestOptions) {
347-
return this.client.getDevBoxByUserWithResponse(projectName, userId, devBoxName, requestOptions).block();
348+
return this.serviceClient.getDevBoxByUserWithResponse(projectName, userId, devBoxName, requestOptions);
348349
}
349350

350351
/**
@@ -448,7 +449,7 @@ public Response<BinaryData> getDevBoxByUserWithResponse(
448449
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
449450
public SyncPoller<BinaryData, BinaryData> beginCreateDevBox(
450451
String projectName, String userId, String devBoxName, BinaryData body, RequestOptions requestOptions) {
451-
return this.client.beginCreateDevBox(projectName, userId, devBoxName, body, requestOptions).getSyncPoller();
452+
return this.serviceClient.beginCreateDevBox(projectName, userId, devBoxName, body, requestOptions);
452453
}
453454

454455
/**
@@ -469,7 +470,7 @@ public SyncPoller<BinaryData, BinaryData> beginCreateDevBox(
469470
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
470471
public SyncPoller<BinaryData, Void> beginDeleteDevBox(
471472
String projectName, String userId, String devBoxName, RequestOptions requestOptions) {
472-
return this.client.beginDeleteDevBox(projectName, userId, devBoxName, requestOptions).getSyncPoller();
473+
return this.serviceClient.beginDeleteDevBox(projectName, userId, devBoxName, requestOptions);
473474
}
474475

475476
/**
@@ -490,7 +491,7 @@ public SyncPoller<BinaryData, Void> beginDeleteDevBox(
490491
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
491492
public SyncPoller<BinaryData, BinaryData> beginStartDevBox(
492493
String projectName, String userId, String devBoxName, RequestOptions requestOptions) {
493-
return this.client.beginStartDevBox(projectName, userId, devBoxName, requestOptions).getSyncPoller();
494+
return this.serviceClient.beginStartDevBox(projectName, userId, devBoxName, requestOptions);
494495
}
495496

496497
/**
@@ -521,7 +522,7 @@ public SyncPoller<BinaryData, BinaryData> beginStartDevBox(
521522
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
522523
public SyncPoller<BinaryData, BinaryData> beginStopDevBox(
523524
String projectName, String userId, String devBoxName, RequestOptions requestOptions) {
524-
return this.client.beginStopDevBox(projectName, userId, devBoxName, requestOptions).getSyncPoller();
525+
return this.serviceClient.beginStopDevBox(projectName, userId, devBoxName, requestOptions);
525526
}
526527

527528
/**
@@ -551,7 +552,7 @@ public SyncPoller<BinaryData, BinaryData> beginStopDevBox(
551552
@ServiceMethod(returns = ReturnType.SINGLE)
552553
public Response<BinaryData> getRemoteConnectionWithResponse(
553554
String projectName, String userId, String devBoxName, RequestOptions requestOptions) {
554-
return this.client.getRemoteConnectionWithResponse(projectName, userId, devBoxName, requestOptions).block();
555+
return this.serviceClient.getRemoteConnectionWithResponse(projectName, userId, devBoxName, requestOptions);
555556
}
556557

557558
/**
@@ -585,7 +586,7 @@ public Response<BinaryData> getRemoteConnectionWithResponse(
585586
@ServiceMethod(returns = ReturnType.COLLECTION)
586587
public PagedIterable<BinaryData> listUpcomingActions(
587588
String projectName, String userId, String devBoxName, RequestOptions requestOptions) {
588-
return new PagedIterable<>(this.client.listUpcomingActions(projectName, userId, devBoxName, requestOptions));
589+
return this.serviceClient.listUpcomingActions(projectName, userId, devBoxName, requestOptions);
589590
}
590591

591592
/**
@@ -624,9 +625,8 @@ public Response<BinaryData> getUpcomingActionWithResponse(
624625
String devBoxName,
625626
String upcomingActionId,
626627
RequestOptions requestOptions) {
627-
return this.client
628-
.getUpcomingActionWithResponse(projectName, userId, devBoxName, upcomingActionId, requestOptions)
629-
.block();
628+
return this.serviceClient.getUpcomingActionWithResponse(
629+
projectName, userId, devBoxName, upcomingActionId, requestOptions);
630630
}
631631

632632
/**
@@ -652,9 +652,8 @@ public Response<Void> skipUpcomingActionWithResponse(
652652
String devBoxName,
653653
String upcomingActionId,
654654
RequestOptions requestOptions) {
655-
return this.client
656-
.skipUpcomingActionWithResponse(projectName, userId, devBoxName, upcomingActionId, requestOptions)
657-
.block();
655+
return this.serviceClient.skipUpcomingActionWithResponse(
656+
projectName, userId, devBoxName, upcomingActionId, requestOptions);
658657
}
659658

660659
/**
@@ -695,9 +694,7 @@ public Response<BinaryData> delayUpcomingActionWithResponse(
695694
String upcomingActionId,
696695
OffsetDateTime delayUntil,
697696
RequestOptions requestOptions) {
698-
return this.client
699-
.delayUpcomingActionWithResponse(
700-
projectName, userId, devBoxName, upcomingActionId, delayUntil, requestOptions)
701-
.block();
697+
return this.serviceClient.delayUpcomingActionWithResponse(
698+
projectName, userId, devBoxName, upcomingActionId, delayUntil, requestOptions);
702699
}
703700
}

sdk/devcenter/azure-developer-devcenter/src/main/java/com/azure/developer/devcenter/DevBoxesClientBuilder.java

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import com.azure.core.http.policy.AddHeadersFromContextPolicy;
2121
import com.azure.core.http.policy.AddHeadersPolicy;
2222
import com.azure.core.http.policy.BearerTokenAuthenticationPolicy;
23-
import com.azure.core.http.policy.CookiePolicy;
2423
import com.azure.core.http.policy.HttpLogOptions;
2524
import com.azure.core.http.policy.HttpLoggingPolicy;
2625
import com.azure.core.http.policy.HttpPipelinePolicy;
@@ -33,13 +32,13 @@
3332
import com.azure.core.util.Configuration;
3433
import com.azure.core.util.CoreUtils;
3534
import com.azure.core.util.builder.ClientBuilderUtil;
35+
import com.azure.core.util.logging.ClientLogger;
3636
import com.azure.core.util.serializer.JacksonAdapter;
3737
import com.azure.developer.devcenter.implementation.DevCenterClientImpl;
3838
import java.util.ArrayList;
3939
import java.util.List;
4040
import java.util.Map;
4141
import java.util.Objects;
42-
import java.util.stream.Collectors;
4342

4443
/** A builder for creating a new instance of the DevBoxesClient type. */
4544
@ServiceClientBuilder(serviceClients = {DevBoxesClient.class, DevBoxesAsyncClient.class})
@@ -75,6 +74,9 @@ public DevBoxesClientBuilder() {
7574
@Generated
7675
@Override
7776
public DevBoxesClientBuilder pipeline(HttpPipeline pipeline) {
77+
if (this.pipeline != null && pipeline == null) {
78+
LOGGER.info("HttpPipeline is being set to 'null' when it was previously configured.");
79+
}
7880
this.pipeline = pipeline;
7981
return this;
8082
}
@@ -225,7 +227,10 @@ private DevCenterClientImpl buildInnerClient() {
225227
(serviceVersion != null) ? serviceVersion : DevCenterServiceVersion.getLatest();
226228
DevCenterClientImpl client =
227229
new DevCenterClientImpl(
228-
localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, localServiceVersion);
230+
localPipeline,
231+
JacksonAdapter.createDefaultSerializerAdapter(),
232+
this.endpoint,
233+
localServiceVersion);
229234
return client;
230235
}
231236

@@ -247,21 +252,18 @@ private HttpPipeline createHttpPipeline() {
247252
if (headers.getSize() > 0) {
248253
policies.add(new AddHeadersPolicy(headers));
249254
}
250-
policies.addAll(
251-
this.pipelinePolicies.stream()
252-
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
253-
.collect(Collectors.toList()));
255+
this.pipelinePolicies.stream()
256+
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
257+
.forEach(p -> policies.add(p));
254258
HttpPolicyProviders.addBeforeRetryPolicies(policies);
255259
policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy()));
256260
policies.add(new AddDatePolicy());
257-
policies.add(new CookiePolicy());
258261
if (tokenCredential != null) {
259262
policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES));
260263
}
261-
policies.addAll(
262-
this.pipelinePolicies.stream()
263-
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
264-
.collect(Collectors.toList()));
264+
this.pipelinePolicies.stream()
265+
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
266+
.forEach(p -> policies.add(p));
265267
HttpPolicyProviders.addAfterRetryPolicies(policies);
266268
policies.add(new HttpLoggingPolicy(httpLogOptions));
267269
HttpPipeline httpPipeline =
@@ -290,6 +292,8 @@ public DevBoxesAsyncClient buildAsyncClient() {
290292
*/
291293
@Generated
292294
public DevBoxesClient buildClient() {
293-
return new DevBoxesClient(new DevBoxesAsyncClient(buildInnerClient().getDevBoxes()));
295+
return new DevBoxesClient(buildInnerClient().getDevBoxes());
294296
}
297+
298+
private static final ClientLogger LOGGER = new ClientLogger(DevBoxesClientBuilder.class);
295299
}

sdk/devcenter/azure-developer-devcenter/src/main/java/com/azure/developer/devcenter/DevCenterClient.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,21 @@
1616
import com.azure.core.http.rest.RequestOptions;
1717
import com.azure.core.http.rest.Response;
1818
import com.azure.core.util.BinaryData;
19+
import com.azure.developer.devcenter.implementation.DevCentersImpl;
1920

2021
/** Initializes a new instance of the synchronous DevCenterClient type. */
2122
@ServiceClient(builder = DevCenterClientBuilder.class)
2223
public final class DevCenterClient {
23-
@Generated private final DevCenterAsyncClient client;
24+
@Generated private final DevCentersImpl serviceClient;
2425

2526
/**
2627
* Initializes an instance of DevCenterClient class.
2728
*
28-
* @param client the async client.
29+
* @param serviceClient the service client implementation.
2930
*/
3031
@Generated
31-
DevCenterClient(DevCenterAsyncClient client) {
32-
this.client = client;
32+
DevCenterClient(DevCentersImpl serviceClient) {
33+
this.serviceClient = serviceClient;
3334
}
3435

3536
/**
@@ -65,7 +66,7 @@ public final class DevCenterClient {
6566
@Generated
6667
@ServiceMethod(returns = ReturnType.COLLECTION)
6768
public PagedIterable<BinaryData> listProjects(RequestOptions requestOptions) {
68-
return new PagedIterable<>(this.client.listProjects(requestOptions));
69+
return this.serviceClient.listProjects(requestOptions);
6970
}
7071

7172
/**
@@ -91,7 +92,7 @@ public PagedIterable<BinaryData> listProjects(RequestOptions requestOptions) {
9192
@Generated
9293
@ServiceMethod(returns = ReturnType.SINGLE)
9394
public Response<BinaryData> getProjectWithResponse(String projectName, RequestOptions requestOptions) {
94-
return this.client.getProjectWithResponse(projectName, requestOptions).block();
95+
return this.serviceClient.getProjectWithResponse(projectName, requestOptions);
9596
}
9697

9798
/**
@@ -159,7 +160,7 @@ public Response<BinaryData> getProjectWithResponse(String projectName, RequestOp
159160
@Generated
160161
@ServiceMethod(returns = ReturnType.COLLECTION)
161162
public PagedIterable<BinaryData> listAllDevBoxes(RequestOptions requestOptions) {
162-
return new PagedIterable<>(this.client.listAllDevBoxes(requestOptions));
163+
return this.serviceClient.listAllDevBoxes(requestOptions);
163164
}
164165

165166
/**
@@ -229,6 +230,6 @@ public PagedIterable<BinaryData> listAllDevBoxes(RequestOptions requestOptions)
229230
@Generated
230231
@ServiceMethod(returns = ReturnType.COLLECTION)
231232
public PagedIterable<BinaryData> listAllDevBoxesByUser(String userId, RequestOptions requestOptions) {
232-
return new PagedIterable<>(this.client.listAllDevBoxesByUser(userId, requestOptions));
233+
return this.serviceClient.listAllDevBoxesByUser(userId, requestOptions);
233234
}
234235
}

0 commit comments

Comments
 (0)