diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/CHANGELOG.md b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/CHANGELOG.md
index ae3531700c92..371355bbb8fb 100644
--- a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/CHANGELOG.md
+++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/CHANGELOG.md
@@ -1,6 +1,8 @@
# Release History
-## 1.0.0-beta.5 (Unreleased)
+## 1.0.0-beta.1 (2022-06-07)
+
+- 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).
### Features Added
diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/README.md b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/README.md
index 46edaeafaa87..2977e22f8f08 100644
--- a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/README.md
+++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/README.md
@@ -32,7 +32,7 @@ Various documentation is available to help you get started
com.azure.resourcemanager
azure-resourcemanager-cognitiveservices
- 1.0.0-beta.4
+ 1.0.0-beta.5
```
[//]: # ({x-version-update-end})
diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/CognitiveServicesManager.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/CognitiveServicesManager.java
index d3e2e9bf6de9..43282a529a1c 100644
--- a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/CognitiveServicesManager.java
+++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/CognitiveServicesManager.java
@@ -239,7 +239,7 @@ public CognitiveServicesManager authenticate(TokenCredential credential, AzurePr
.append("-")
.append("com.azure.resourcemanager.cognitiveservices")
.append("/")
- .append("1.0.0-beta.4");
+ .append("1.0.0-beta.1");
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
userAgentBuilder
.append(" (")
@@ -296,7 +296,11 @@ public CognitiveServicesManager authenticate(TokenCredential credential, AzurePr
}
}
- /** @return Resource collection API of Accounts. */
+ /**
+ * Gets the resource collection API of Accounts. It manages Account.
+ *
+ * @return Resource collection API of Accounts.
+ */
public Accounts accounts() {
if (this.accounts == null) {
this.accounts = new AccountsImpl(clientObject.getAccounts(), this);
@@ -304,7 +308,11 @@ public Accounts accounts() {
return accounts;
}
- /** @return Resource collection API of DeletedAccounts. */
+ /**
+ * Gets the resource collection API of DeletedAccounts.
+ *
+ * @return Resource collection API of DeletedAccounts.
+ */
public DeletedAccounts deletedAccounts() {
if (this.deletedAccounts == null) {
this.deletedAccounts = new DeletedAccountsImpl(clientObject.getDeletedAccounts(), this);
@@ -312,7 +320,11 @@ public DeletedAccounts deletedAccounts() {
return deletedAccounts;
}
- /** @return Resource collection API of ResourceSkus. */
+ /**
+ * Gets the resource collection API of ResourceSkus.
+ *
+ * @return Resource collection API of ResourceSkus.
+ */
public ResourceSkus resourceSkus() {
if (this.resourceSkus == null) {
this.resourceSkus = new ResourceSkusImpl(clientObject.getResourceSkus(), this);
@@ -320,7 +332,11 @@ public ResourceSkus resourceSkus() {
return resourceSkus;
}
- /** @return Resource collection API of Operations. */
+ /**
+ * Gets the resource collection API of Operations.
+ *
+ * @return Resource collection API of Operations.
+ */
public Operations operations() {
if (this.operations == null) {
this.operations = new OperationsImpl(clientObject.getOperations(), this);
@@ -328,7 +344,11 @@ public Operations operations() {
return operations;
}
- /** @return Resource collection API of ResourceProviders. */
+ /**
+ * Gets the resource collection API of ResourceProviders.
+ *
+ * @return Resource collection API of ResourceProviders.
+ */
public ResourceProviders resourceProviders() {
if (this.resourceProviders == null) {
this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this);
@@ -336,7 +356,11 @@ public ResourceProviders resourceProviders() {
return resourceProviders;
}
- /** @return Resource collection API of CommitmentTiers. */
+ /**
+ * Gets the resource collection API of CommitmentTiers.
+ *
+ * @return Resource collection API of CommitmentTiers.
+ */
public CommitmentTiers commitmentTiers() {
if (this.commitmentTiers == null) {
this.commitmentTiers = new CommitmentTiersImpl(clientObject.getCommitmentTiers(), this);
@@ -344,7 +368,11 @@ public CommitmentTiers commitmentTiers() {
return commitmentTiers;
}
- /** @return Resource collection API of PrivateEndpointConnections. */
+ /**
+ * Gets the resource collection API of PrivateEndpointConnections. It manages PrivateEndpointConnection.
+ *
+ * @return Resource collection API of PrivateEndpointConnections.
+ */
public PrivateEndpointConnections privateEndpointConnections() {
if (this.privateEndpointConnections == null) {
this.privateEndpointConnections =
@@ -353,7 +381,11 @@ public PrivateEndpointConnections privateEndpointConnections() {
return privateEndpointConnections;
}
- /** @return Resource collection API of PrivateLinkResources. */
+ /**
+ * Gets the resource collection API of PrivateLinkResources.
+ *
+ * @return Resource collection API of PrivateLinkResources.
+ */
public PrivateLinkResources privateLinkResources() {
if (this.privateLinkResources == null) {
this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this);
@@ -361,7 +393,11 @@ public PrivateLinkResources privateLinkResources() {
return privateLinkResources;
}
- /** @return Resource collection API of Deployments. */
+ /**
+ * Gets the resource collection API of Deployments. It manages Deployment.
+ *
+ * @return Resource collection API of Deployments.
+ */
public Deployments deployments() {
if (this.deployments == null) {
this.deployments = new DeploymentsImpl(clientObject.getDeployments(), this);
@@ -369,7 +405,11 @@ public Deployments deployments() {
return deployments;
}
- /** @return Resource collection API of CommitmentPlans. */
+ /**
+ * Gets the resource collection API of CommitmentPlans. It manages CommitmentPlan.
+ *
+ * @return Resource collection API of CommitmentPlans.
+ */
public CommitmentPlans commitmentPlans() {
if (this.commitmentPlans == null) {
this.commitmentPlans = new CommitmentPlansImpl(clientObject.getCommitmentPlans(), this);
diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/AccountImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/AccountImpl.java
index 340449c1495f..3b92b264a140 100644
--- a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/AccountImpl.java
+++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/AccountImpl.java
@@ -80,6 +80,10 @@ public String regionName() {
return this.location();
}
+ public String resourceGroupName() {
+ return resourceGroupName;
+ }
+
public AccountInner innerModel() {
return this.innerObject;
}
diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/AccountsClientImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/AccountsClientImpl.java
index e7b31e729983..5f8ca0e42cb9 100644
--- a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/AccountsClientImpl.java
+++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/AccountsClientImpl.java
@@ -1151,14 +1151,7 @@ private Mono> getByResourceGroupWithResponseAsync(
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono getByResourceGroupAsync(String resourceGroupName, String accountName) {
return getByResourceGroupWithResponseAsync(resourceGroupName, accountName)
- .flatMap(
- (Response res) -> {
- if (res.getValue() != null) {
- return Mono.just(res.getValue());
- } else {
- return Mono.empty();
- }
- });
+ .flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
@@ -1614,14 +1607,7 @@ private Mono> listKeysWithResponseAsync(
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono listKeysAsync(String resourceGroupName, String accountName) {
return listKeysWithResponseAsync(resourceGroupName, accountName)
- .flatMap(
- (Response res) -> {
- if (res.getValue() != null) {
- return Mono.just(res.getValue());
- } else {
- return Mono.empty();
- }
- });
+ .flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
@@ -1780,14 +1766,7 @@ private Mono> regenerateKeyWithResponseAsync(
private Mono regenerateKeyAsync(
String resourceGroupName, String accountName, RegenerateKeyParameters parameters) {
return regenerateKeyWithResponseAsync(resourceGroupName, accountName, parameters)
- .flatMap(
- (Response res) -> {
- if (res.getValue() != null) {
- return Mono.just(res.getValue());
- } else {
- return Mono.empty();
- }
- });
+ .flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
@@ -1934,14 +1913,7 @@ private Mono> listSkusWithResponseAsync(
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono listSkusAsync(String resourceGroupName, String accountName) {
return listSkusWithResponseAsync(resourceGroupName, accountName)
- .flatMap(
- (Response res) -> {
- if (res.getValue() != null) {
- return Mono.just(res.getValue());
- } else {
- return Mono.empty();
- }
- });
+ .flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
@@ -2093,14 +2065,7 @@ private Mono> listUsagesWithResponseAsync(
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono listUsagesAsync(String resourceGroupName, String accountName, String filter) {
return listUsagesWithResponseAsync(resourceGroupName, accountName, filter)
- .flatMap(
- (Response res) -> {
- if (res.getValue() != null) {
- return Mono.just(res.getValue());
- } else {
- return Mono.empty();
- }
- });
+ .flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
@@ -2117,14 +2082,7 @@ private Mono listUsagesAsync(String resourceGroupName, Str
private Mono listUsagesAsync(String resourceGroupName, String accountName) {
final String filter = null;
return listUsagesWithResponseAsync(resourceGroupName, accountName, filter)
- .flatMap(
- (Response res) -> {
- if (res.getValue() != null) {
- return Mono.just(res.getValue());
- } else {
- return Mono.empty();
- }
- });
+ .flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesManagementClientBuilder.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesManagementClientBuilder.java
index 1091bb654998..91530f88bdb4 100644
--- a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesManagementClientBuilder.java
+++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesManagementClientBuilder.java
@@ -119,9 +119,6 @@ public CognitiveServicesManagementClientBuilder serializerAdapter(SerializerAdap
* @return an instance of CognitiveServicesManagementClientImpl.
*/
public CognitiveServicesManagementClientImpl buildClient() {
- if (pipeline == null) {
- this.pipeline = new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build();
- }
if (endpoint == null) {
this.endpoint = "https://management.azure.com";
}
diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesManagementClientImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesManagementClientImpl.java
index 51b24a60de14..d05de0dbf8f0 100644
--- a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesManagementClientImpl.java
+++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesManagementClientImpl.java
@@ -15,6 +15,7 @@
import com.azure.core.management.polling.PollResult;
import com.azure.core.management.polling.PollerFactory;
import com.azure.core.util.Context;
+import com.azure.core.util.CoreUtils;
import com.azure.core.util.logging.ClientLogger;
import com.azure.core.util.polling.AsyncPollResponse;
import com.azure.core.util.polling.LongRunningOperationStatus;
@@ -38,7 +39,6 @@
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
-import java.util.Map;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -288,10 +288,7 @@ public Context getContext() {
* @return the merged context.
*/
public Context mergeContext(Context context) {
- for (Map.Entry