Skip to content

Commit 8032bd0

Browse files
authored
[Automation] Generate Fluent Lite from cognitiveservices#package-2022-03 (Azure#29556)
1 parent 54d1b5f commit 8032bd0

35 files changed

+207
-162
lines changed

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
# Release History
22

3-
## 1.0.0-beta.5 (Unreleased)
3+
## 1.0.0-beta.5 (2022-06-20)
4+
5+
- Azure Resource Manager CognitiveServices client library for Java. This package contains Microsoft Azure SDK for CognitiveServices Management SDK. Cognitive Services Management Client. Package tag package-2022-03. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).
46

57
### Features Added
68

7-
### Breaking Changes
9+
#### `models.Deployment` was modified
10+
11+
* `resourceGroupName()` was added
12+
13+
#### `models.Account` was modified
814

9-
### Bugs Fixed
15+
* `resourceGroupName()` was added
16+
17+
#### `models.CommitmentPlan` was modified
18+
19+
* `resourceGroupName()` was added
20+
21+
#### `models.PrivateEndpointConnection` was modified
1022

11-
### Other Changes
23+
* `resourceGroupName()` was added
1224

1325
## 1.0.0-beta.4 (2022-04-11)
1426

sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/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-cognitiveservices</artifactId>
35-
<version>1.0.0-beta.4</version>
35+
<version>1.0.0-beta.5</version>
3636
</dependency>
3737
```
3838
[//]: # ({x-version-update-end})

sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/CognitiveServicesManager.java

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public CognitiveServicesManager authenticate(TokenCredential credential, AzurePr
239239
.append("-")
240240
.append("com.azure.resourcemanager.cognitiveservices")
241241
.append("/")
242-
.append("1.0.0-beta.4");
242+
.append("1.0.0-beta.5");
243243
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
244244
userAgentBuilder
245245
.append(" (")
@@ -296,55 +296,83 @@ public CognitiveServicesManager authenticate(TokenCredential credential, AzurePr
296296
}
297297
}
298298

299-
/** @return Resource collection API of Accounts. */
299+
/**
300+
* Gets the resource collection API of Accounts. It manages Account.
301+
*
302+
* @return Resource collection API of Accounts.
303+
*/
300304
public Accounts accounts() {
301305
if (this.accounts == null) {
302306
this.accounts = new AccountsImpl(clientObject.getAccounts(), this);
303307
}
304308
return accounts;
305309
}
306310

307-
/** @return Resource collection API of DeletedAccounts. */
311+
/**
312+
* Gets the resource collection API of DeletedAccounts.
313+
*
314+
* @return Resource collection API of DeletedAccounts.
315+
*/
308316
public DeletedAccounts deletedAccounts() {
309317
if (this.deletedAccounts == null) {
310318
this.deletedAccounts = new DeletedAccountsImpl(clientObject.getDeletedAccounts(), this);
311319
}
312320
return deletedAccounts;
313321
}
314322

315-
/** @return Resource collection API of ResourceSkus. */
323+
/**
324+
* Gets the resource collection API of ResourceSkus.
325+
*
326+
* @return Resource collection API of ResourceSkus.
327+
*/
316328
public ResourceSkus resourceSkus() {
317329
if (this.resourceSkus == null) {
318330
this.resourceSkus = new ResourceSkusImpl(clientObject.getResourceSkus(), this);
319331
}
320332
return resourceSkus;
321333
}
322334

323-
/** @return Resource collection API of Operations. */
335+
/**
336+
* Gets the resource collection API of Operations.
337+
*
338+
* @return Resource collection API of Operations.
339+
*/
324340
public Operations operations() {
325341
if (this.operations == null) {
326342
this.operations = new OperationsImpl(clientObject.getOperations(), this);
327343
}
328344
return operations;
329345
}
330346

331-
/** @return Resource collection API of ResourceProviders. */
347+
/**
348+
* Gets the resource collection API of ResourceProviders.
349+
*
350+
* @return Resource collection API of ResourceProviders.
351+
*/
332352
public ResourceProviders resourceProviders() {
333353
if (this.resourceProviders == null) {
334354
this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this);
335355
}
336356
return resourceProviders;
337357
}
338358

339-
/** @return Resource collection API of CommitmentTiers. */
359+
/**
360+
* Gets the resource collection API of CommitmentTiers.
361+
*
362+
* @return Resource collection API of CommitmentTiers.
363+
*/
340364
public CommitmentTiers commitmentTiers() {
341365
if (this.commitmentTiers == null) {
342366
this.commitmentTiers = new CommitmentTiersImpl(clientObject.getCommitmentTiers(), this);
343367
}
344368
return commitmentTiers;
345369
}
346370

347-
/** @return Resource collection API of PrivateEndpointConnections. */
371+
/**
372+
* Gets the resource collection API of PrivateEndpointConnections. It manages PrivateEndpointConnection.
373+
*
374+
* @return Resource collection API of PrivateEndpointConnections.
375+
*/
348376
public PrivateEndpointConnections privateEndpointConnections() {
349377
if (this.privateEndpointConnections == null) {
350378
this.privateEndpointConnections =
@@ -353,23 +381,35 @@ public PrivateEndpointConnections privateEndpointConnections() {
353381
return privateEndpointConnections;
354382
}
355383

356-
/** @return Resource collection API of PrivateLinkResources. */
384+
/**
385+
* Gets the resource collection API of PrivateLinkResources.
386+
*
387+
* @return Resource collection API of PrivateLinkResources.
388+
*/
357389
public PrivateLinkResources privateLinkResources() {
358390
if (this.privateLinkResources == null) {
359391
this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this);
360392
}
361393
return privateLinkResources;
362394
}
363395

364-
/** @return Resource collection API of Deployments. */
396+
/**
397+
* Gets the resource collection API of Deployments. It manages Deployment.
398+
*
399+
* @return Resource collection API of Deployments.
400+
*/
365401
public Deployments deployments() {
366402
if (this.deployments == null) {
367403
this.deployments = new DeploymentsImpl(clientObject.getDeployments(), this);
368404
}
369405
return deployments;
370406
}
371407

372-
/** @return Resource collection API of CommitmentPlans. */
408+
/**
409+
* Gets the resource collection API of CommitmentPlans. It manages CommitmentPlan.
410+
*
411+
* @return Resource collection API of CommitmentPlans.
412+
*/
373413
public CommitmentPlans commitmentPlans() {
374414
if (this.commitmentPlans == null) {
375415
this.commitmentPlans = new CommitmentPlansImpl(clientObject.getCommitmentPlans(), this);

sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/AccountImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ public String regionName() {
8080
return this.location();
8181
}
8282

83+
public String resourceGroupName() {
84+
return resourceGroupName;
85+
}
86+
8387
public AccountInner innerModel() {
8488
return this.innerObject;
8589
}

sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/AccountsClientImpl.java

Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,14 +1151,7 @@ private Mono<Response<AccountInner>> getByResourceGroupWithResponseAsync(
11511151
@ServiceMethod(returns = ReturnType.SINGLE)
11521152
private Mono<AccountInner> getByResourceGroupAsync(String resourceGroupName, String accountName) {
11531153
return getByResourceGroupWithResponseAsync(resourceGroupName, accountName)
1154-
.flatMap(
1155-
(Response<AccountInner> res) -> {
1156-
if (res.getValue() != null) {
1157-
return Mono.just(res.getValue());
1158-
} else {
1159-
return Mono.empty();
1160-
}
1161-
});
1154+
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
11621155
}
11631156

11641157
/**
@@ -1614,14 +1607,7 @@ private Mono<Response<ApiKeysInner>> listKeysWithResponseAsync(
16141607
@ServiceMethod(returns = ReturnType.SINGLE)
16151608
private Mono<ApiKeysInner> listKeysAsync(String resourceGroupName, String accountName) {
16161609
return listKeysWithResponseAsync(resourceGroupName, accountName)
1617-
.flatMap(
1618-
(Response<ApiKeysInner> res) -> {
1619-
if (res.getValue() != null) {
1620-
return Mono.just(res.getValue());
1621-
} else {
1622-
return Mono.empty();
1623-
}
1624-
});
1610+
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
16251611
}
16261612

16271613
/**
@@ -1780,14 +1766,7 @@ private Mono<Response<ApiKeysInner>> regenerateKeyWithResponseAsync(
17801766
private Mono<ApiKeysInner> regenerateKeyAsync(
17811767
String resourceGroupName, String accountName, RegenerateKeyParameters parameters) {
17821768
return regenerateKeyWithResponseAsync(resourceGroupName, accountName, parameters)
1783-
.flatMap(
1784-
(Response<ApiKeysInner> res) -> {
1785-
if (res.getValue() != null) {
1786-
return Mono.just(res.getValue());
1787-
} else {
1788-
return Mono.empty();
1789-
}
1790-
});
1769+
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
17911770
}
17921771

17931772
/**
@@ -1934,14 +1913,7 @@ private Mono<Response<AccountSkuListResultInner>> listSkusWithResponseAsync(
19341913
@ServiceMethod(returns = ReturnType.SINGLE)
19351914
private Mono<AccountSkuListResultInner> listSkusAsync(String resourceGroupName, String accountName) {
19361915
return listSkusWithResponseAsync(resourceGroupName, accountName)
1937-
.flatMap(
1938-
(Response<AccountSkuListResultInner> res) -> {
1939-
if (res.getValue() != null) {
1940-
return Mono.just(res.getValue());
1941-
} else {
1942-
return Mono.empty();
1943-
}
1944-
});
1916+
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
19451917
}
19461918

19471919
/**
@@ -2093,14 +2065,7 @@ private Mono<Response<UsageListResultInner>> listUsagesWithResponseAsync(
20932065
@ServiceMethod(returns = ReturnType.SINGLE)
20942066
private Mono<UsageListResultInner> listUsagesAsync(String resourceGroupName, String accountName, String filter) {
20952067
return listUsagesWithResponseAsync(resourceGroupName, accountName, filter)
2096-
.flatMap(
2097-
(Response<UsageListResultInner> res) -> {
2098-
if (res.getValue() != null) {
2099-
return Mono.just(res.getValue());
2100-
} else {
2101-
return Mono.empty();
2102-
}
2103-
});
2068+
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
21042069
}
21052070

21062071
/**
@@ -2117,14 +2082,7 @@ private Mono<UsageListResultInner> listUsagesAsync(String resourceGroupName, Str
21172082
private Mono<UsageListResultInner> listUsagesAsync(String resourceGroupName, String accountName) {
21182083
final String filter = null;
21192084
return listUsagesWithResponseAsync(resourceGroupName, accountName, filter)
2120-
.flatMap(
2121-
(Response<UsageListResultInner> res) -> {
2122-
if (res.getValue() != null) {
2123-
return Mono.just(res.getValue());
2124-
} else {
2125-
return Mono.empty();
2126-
}
2127-
});
2085+
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
21282086
}
21292087

21302088
/**

sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesManagementClientBuilder.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,6 @@ public CognitiveServicesManagementClientBuilder serializerAdapter(SerializerAdap
119119
* @return an instance of CognitiveServicesManagementClientImpl.
120120
*/
121121
public CognitiveServicesManagementClientImpl buildClient() {
122-
if (pipeline == null) {
123-
this.pipeline = new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build();
124-
}
125122
if (endpoint == null) {
126123
this.endpoint = "https://management.azure.com";
127124
}

sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesManagementClientImpl.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import com.azure.core.management.polling.PollResult;
1616
import com.azure.core.management.polling.PollerFactory;
1717
import com.azure.core.util.Context;
18+
import com.azure.core.util.CoreUtils;
1819
import com.azure.core.util.logging.ClientLogger;
1920
import com.azure.core.util.polling.AsyncPollResponse;
2021
import com.azure.core.util.polling.LongRunningOperationStatus;
@@ -38,7 +39,6 @@
3839
import java.nio.charset.Charset;
3940
import java.nio.charset.StandardCharsets;
4041
import java.time.Duration;
41-
import java.util.Map;
4242
import reactor.core.publisher.Flux;
4343
import reactor.core.publisher.Mono;
4444

@@ -288,10 +288,7 @@ public Context getContext() {
288288
* @return the merged context.
289289
*/
290290
public Context mergeContext(Context context) {
291-
for (Map.Entry<Object, Object> entry : this.getContext().getValues().entrySet()) {
292-
context = context.addData(entry.getKey(), entry.getValue());
293-
}
294-
return context;
291+
return CoreUtils.mergeContexts(this.getContext(), context);
295292
}
296293

297294
/**

sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CommitmentPlanImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ public CommitmentPlanProperties properties() {
3939
return this.innerModel().properties();
4040
}
4141

42+
public String resourceGroupName() {
43+
return resourceGroupName;
44+
}
45+
4246
public CommitmentPlanInner innerModel() {
4347
return this.innerObject;
4448
}

sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CommitmentPlansClientImpl.java

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -445,14 +445,7 @@ private Mono<Response<CommitmentPlanInner>> getWithResponseAsync(
445445
private Mono<CommitmentPlanInner> getAsync(
446446
String resourceGroupName, String accountName, String commitmentPlanName) {
447447
return getWithResponseAsync(resourceGroupName, accountName, commitmentPlanName)
448-
.flatMap(
449-
(Response<CommitmentPlanInner> res) -> {
450-
if (res.getValue() != null) {
451-
return Mono.just(res.getValue());
452-
} else {
453-
return Mono.empty();
454-
}
455-
});
448+
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
456449
}
457450

458451
/**
@@ -631,14 +624,7 @@ private Mono<Response<CommitmentPlanInner>> createOrUpdateWithResponseAsync(
631624
private Mono<CommitmentPlanInner> createOrUpdateAsync(
632625
String resourceGroupName, String accountName, String commitmentPlanName, CommitmentPlanInner commitmentPlan) {
633626
return createOrUpdateWithResponseAsync(resourceGroupName, accountName, commitmentPlanName, commitmentPlan)
634-
.flatMap(
635-
(Response<CommitmentPlanInner> res) -> {
636-
if (res.getValue() != null) {
637-
return Mono.just(res.getValue());
638-
} else {
639-
return Mono.empty();
640-
}
641-
});
627+
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
642628
}
643629

644630
/**

sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/DeletedAccountsClientImpl.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,7 @@ private Mono<Response<AccountInner>> getWithResponseAsync(
237237
@ServiceMethod(returns = ReturnType.SINGLE)
238238
private Mono<AccountInner> getAsync(String location, String resourceGroupName, String accountName) {
239239
return getWithResponseAsync(location, resourceGroupName, accountName)
240-
.flatMap(
241-
(Response<AccountInner> res) -> {
242-
if (res.getValue() != null) {
243-
return Mono.just(res.getValue());
244-
} else {
245-
return Mono.empty();
246-
}
247-
});
240+
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
248241
}
249242

250243
/**

0 commit comments

Comments
 (0)