diff --git a/eng/versioning/external_dependencies.txt b/eng/versioning/external_dependencies.txt
index 89f9243f9a00..1502121e62df 100644
--- a/eng/versioning/external_dependencies.txt
+++ b/eng/versioning/external_dependencies.txt
@@ -132,6 +132,7 @@ org.springframework:spring-messaging;5.2.10.RELEASE
org.springframework:spring-tx;5.2.10.RELEASE
org.springframework:spring-web;5.2.10.RELEASE
org.springframework:spring-webmvc;5.2.10.RELEASE
+org.springframework:spring-webflux;5.2.10.RELEASE
# spring-boot-starter-parent is not managed by spring-boot-dependencies or spring-cloud-dependencies.
org.springframework.boot:spring-boot-starter-parent;2.3.7.RELEASE
diff --git a/sdk/kusto/azure-resourcemanager-kusto/CHANGELOG.md b/sdk/kusto/azure-resourcemanager-kusto/CHANGELOG.md
index ff301aaadbde..fc62d8dc6411 100644
--- a/sdk/kusto/azure-resourcemanager-kusto/CHANGELOG.md
+++ b/sdk/kusto/azure-resourcemanager-kusto/CHANGELOG.md
@@ -1,7 +1,8 @@
# Release History
-## 1.0.0-beta.2 (Unreleased)
+## 1.0.0-beta.1 (2021-02-26)
+- Azure Resource Manager Kusto client library for Java. This package contains Microsoft Azure SDK for Kusto Management SDK. The Azure Kusto management API provides a RESTful set of web services that interact with Azure Kusto services to manage your clusters and databases. The API enables you to create, update, and delete clusters and databases. Package tag package-2020-09-18. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).
## 1.0.0-beta.1 (2020-12-18)
diff --git a/sdk/kusto/azure-resourcemanager-kusto/README.md b/sdk/kusto/azure-resourcemanager-kusto/README.md
index 1c4f49078b3e..699a29f67083 100644
--- a/sdk/kusto/azure-resourcemanager-kusto/README.md
+++ b/sdk/kusto/azure-resourcemanager-kusto/README.md
@@ -4,6 +4,20 @@ Azure Resource Manager Kusto client library for Java.
This package contains Microsoft Azure SDK for Kusto Management SDK. The Azure Kusto management API provides a RESTful set of web services that interact with Azure Kusto services to manage your clusters and databases. The API enables you to create, update, and delete clusters and databases. Package tag package-2020-09-18. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).
+## We'd love to hear your feedback
+
+We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better.
+
+If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together.
+
+Thank you in advance for your collaboration. We really appreciate your time!
+
+## Documentation
+
+Various documentation is available to help you get started
+
+- [API reference documentation][docs]
+
## Getting started
### Prerequisites
@@ -18,7 +32,7 @@ This package contains Microsoft Azure SDK for Kusto Management SDK. The Azure Ku
com.azure.resourcemanager
azure-resourcemanager-kusto
- 1.0.0-beta.1
+ 1.0.0-beta.2
```
[//]: # ({x-version-update-end})
@@ -75,6 +89,8 @@ For details on contributing to this repository, see the [contributing guide](htt
1. Create new Pull Request
+[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS
+[docs]: https://azure.github.io/azure-sdk-for-java/
[jdk]: https://docs.microsoft.com/java/azure/jdk/
[azure_subscription]: https://azure.microsoft.com/free/
[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity
diff --git a/sdk/kusto/azure-resourcemanager-kusto/pom.xml b/sdk/kusto/azure-resourcemanager-kusto/pom.xml
index f6cdef2ad56b..ae37871518f5 100644
--- a/sdk/kusto/azure-resourcemanager-kusto/pom.xml
+++ b/sdk/kusto/azure-resourcemanager-kusto/pom.xml
@@ -41,6 +41,11 @@
+
+ com.azure
+ azure-core
+ 1.13.0
+
com.azure
azure-core-management
diff --git a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/KustoManager.java b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/KustoManager.java
index e35bcd166bdd..3005908bd061 100644
--- a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/KustoManager.java
+++ b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/KustoManager.java
@@ -180,17 +180,31 @@ public KustoManager authenticate(TokenCredential credential, AzureProfile profil
Objects.requireNonNull(credential, "'credential' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
+ StringBuilder userAgentBuilder = new StringBuilder();
+ userAgentBuilder
+ .append("azsdk-java")
+ .append("-")
+ .append("com.azure.resourcemanager.kusto")
+ .append("/")
+ .append("1.0.0-beta.1");
+ if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
+ userAgentBuilder
+ .append(" (")
+ .append(Configuration.getGlobalConfiguration().get("java.version"))
+ .append("; ")
+ .append(Configuration.getGlobalConfiguration().get("os.name"))
+ .append("; ")
+ .append(Configuration.getGlobalConfiguration().get("os.version"))
+ .append("; auto-generated)");
+ } else {
+ userAgentBuilder.append(" (auto-generated)");
+ }
+
if (retryPolicy == null) {
retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
}
List policies = new ArrayList<>();
- policies
- .add(
- new UserAgentPolicy(
- null,
- "com.azure.resourcemanager.kusto",
- "1.0.0-beta.1",
- Configuration.getGlobalConfiguration()));
+ policies.add(new UserAgentPolicy(userAgentBuilder.toString()));
policies.add(new RequestIdPolicy());
HttpPolicyProviders.addBeforeRetryPolicies(policies);
policies.add(retryPolicy);
diff --git a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/AttachedDatabaseConfigurationsImpl.java b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/AttachedDatabaseConfigurationsImpl.java
index 41909d2a27aa..69a53ec333e2 100644
--- a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/AttachedDatabaseConfigurationsImpl.java
+++ b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/AttachedDatabaseConfigurationsImpl.java
@@ -32,14 +32,14 @@ public AttachedDatabaseConfigurationsImpl(
public PagedIterable listByCluster(String resourceGroupName, String clusterName) {
PagedIterable inner =
this.serviceClient().listByCluster(resourceGroupName, clusterName);
- return inner.mapPage(inner1 -> new AttachedDatabaseConfigurationImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new AttachedDatabaseConfigurationImpl(inner1, this.manager()));
}
public PagedIterable listByCluster(
String resourceGroupName, String clusterName, Context context) {
PagedIterable inner =
this.serviceClient().listByCluster(resourceGroupName, clusterName, context);
- return inner.mapPage(inner1 -> new AttachedDatabaseConfigurationImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new AttachedDatabaseConfigurationImpl(inner1, this.manager()));
}
public AttachedDatabaseConfiguration get(
diff --git a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/ClusterImpl.java b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/ClusterImpl.java
index ba154061dd4b..9e4558995472 100644
--- a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/ClusterImpl.java
+++ b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/ClusterImpl.java
@@ -4,16 +4,21 @@
package com.azure.resourcemanager.kusto.implementation;
+import com.azure.core.http.rest.PagedIterable;
import com.azure.core.management.Region;
import com.azure.core.util.Context;
import com.azure.resourcemanager.kusto.KustoManager;
import com.azure.resourcemanager.kusto.fluent.models.ClusterInner;
+import com.azure.resourcemanager.kusto.fluent.models.FollowerDatabaseDefinitionInner;
import com.azure.resourcemanager.kusto.models.AzureSku;
import com.azure.resourcemanager.kusto.models.Cluster;
import com.azure.resourcemanager.kusto.models.ClusterUpdate;
+import com.azure.resourcemanager.kusto.models.DiagnoseVirtualNetworkResult;
import com.azure.resourcemanager.kusto.models.EngineType;
+import com.azure.resourcemanager.kusto.models.FollowerDatabaseDefinition;
import com.azure.resourcemanager.kusto.models.Identity;
import com.azure.resourcemanager.kusto.models.KeyVaultProperties;
+import com.azure.resourcemanager.kusto.models.LanguageExtension;
import com.azure.resourcemanager.kusto.models.LanguageExtensionsList;
import com.azure.resourcemanager.kusto.models.OptimizedAutoscale;
import com.azure.resourcemanager.kusto.models.ProvisioningState;
@@ -237,6 +242,76 @@ public Cluster refresh(Context context) {
return this;
}
+ public void stop() {
+ serviceManager.clusters().stop(resourceGroupName, clusterName);
+ }
+
+ public void stop(Context context) {
+ serviceManager.clusters().stop(resourceGroupName, clusterName, context);
+ }
+
+ public void start() {
+ serviceManager.clusters().start(resourceGroupName, clusterName);
+ }
+
+ public void start(Context context) {
+ serviceManager.clusters().start(resourceGroupName, clusterName, context);
+ }
+
+ public PagedIterable listFollowerDatabases() {
+ return serviceManager.clusters().listFollowerDatabases(resourceGroupName, clusterName);
+ }
+
+ public PagedIterable listFollowerDatabases(Context context) {
+ return serviceManager.clusters().listFollowerDatabases(resourceGroupName, clusterName, context);
+ }
+
+ public void detachFollowerDatabases(FollowerDatabaseDefinitionInner followerDatabaseToRemove) {
+ serviceManager.clusters().detachFollowerDatabases(resourceGroupName, clusterName, followerDatabaseToRemove);
+ }
+
+ public void detachFollowerDatabases(FollowerDatabaseDefinitionInner followerDatabaseToRemove, Context context) {
+ serviceManager
+ .clusters()
+ .detachFollowerDatabases(resourceGroupName, clusterName, followerDatabaseToRemove, context);
+ }
+
+ public DiagnoseVirtualNetworkResult diagnoseVirtualNetwork() {
+ return serviceManager.clusters().diagnoseVirtualNetwork(resourceGroupName, clusterName);
+ }
+
+ public DiagnoseVirtualNetworkResult diagnoseVirtualNetwork(Context context) {
+ return serviceManager.clusters().diagnoseVirtualNetwork(resourceGroupName, clusterName, context);
+ }
+
+ public PagedIterable listLanguageExtensions() {
+ return serviceManager.clusters().listLanguageExtensions(resourceGroupName, clusterName);
+ }
+
+ public PagedIterable listLanguageExtensions(Context context) {
+ return serviceManager.clusters().listLanguageExtensions(resourceGroupName, clusterName, context);
+ }
+
+ public void addLanguageExtensions(LanguageExtensionsList languageExtensionsToAdd) {
+ serviceManager.clusters().addLanguageExtensions(resourceGroupName, clusterName, languageExtensionsToAdd);
+ }
+
+ public void addLanguageExtensions(LanguageExtensionsList languageExtensionsToAdd, Context context) {
+ serviceManager
+ .clusters()
+ .addLanguageExtensions(resourceGroupName, clusterName, languageExtensionsToAdd, context);
+ }
+
+ public void removeLanguageExtensions(LanguageExtensionsList languageExtensionsToRemove) {
+ serviceManager.clusters().removeLanguageExtensions(resourceGroupName, clusterName, languageExtensionsToRemove);
+ }
+
+ public void removeLanguageExtensions(LanguageExtensionsList languageExtensionsToRemove, Context context) {
+ serviceManager
+ .clusters()
+ .removeLanguageExtensions(resourceGroupName, clusterName, languageExtensionsToRemove, context);
+ }
+
public ClusterImpl withRegion(Region location) {
this.innerModel().withLocation(location.toString());
return this;
diff --git a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/ClusterPrincipalAssignmentsImpl.java b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/ClusterPrincipalAssignmentsImpl.java
index 9074c340fdf2..aee1eda168fa 100644
--- a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/ClusterPrincipalAssignmentsImpl.java
+++ b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/ClusterPrincipalAssignmentsImpl.java
@@ -101,14 +101,14 @@ public void delete(String resourceGroupName, String clusterName, String principa
public PagedIterable list(String resourceGroupName, String clusterName) {
PagedIterable inner =
this.serviceClient().list(resourceGroupName, clusterName);
- return inner.mapPage(inner1 -> new ClusterPrincipalAssignmentImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new ClusterPrincipalAssignmentImpl(inner1, this.manager()));
}
public PagedIterable list(
String resourceGroupName, String clusterName, Context context) {
PagedIterable inner =
this.serviceClient().list(resourceGroupName, clusterName, context);
- return inner.mapPage(inner1 -> new ClusterPrincipalAssignmentImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new ClusterPrincipalAssignmentImpl(inner1, this.manager()));
}
public ClusterPrincipalAssignment getById(String id) {
diff --git a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/ClustersImpl.java b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/ClustersImpl.java
index 150184605c9e..3b1fa952f5a6 100644
--- a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/ClustersImpl.java
+++ b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/ClustersImpl.java
@@ -94,14 +94,14 @@ public PagedIterable listFollowerDatabases(
String resourceGroupName, String clusterName) {
PagedIterable inner =
this.serviceClient().listFollowerDatabases(resourceGroupName, clusterName);
- return inner.mapPage(inner1 -> new FollowerDatabaseDefinitionImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new FollowerDatabaseDefinitionImpl(inner1, this.manager()));
}
public PagedIterable listFollowerDatabases(
String resourceGroupName, String clusterName, Context context) {
PagedIterable inner =
this.serviceClient().listFollowerDatabases(resourceGroupName, clusterName, context);
- return inner.mapPage(inner1 -> new FollowerDatabaseDefinitionImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new FollowerDatabaseDefinitionImpl(inner1, this.manager()));
}
public void detachFollowerDatabases(
@@ -140,32 +140,32 @@ public DiagnoseVirtualNetworkResult diagnoseVirtualNetwork(
public PagedIterable listByResourceGroup(String resourceGroupName) {
PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName);
- return inner.mapPage(inner1 -> new ClusterImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new ClusterImpl(inner1, this.manager()));
}
public PagedIterable listByResourceGroup(String resourceGroupName, Context context) {
PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context);
- return inner.mapPage(inner1 -> new ClusterImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new ClusterImpl(inner1, this.manager()));
}
public PagedIterable list() {
PagedIterable inner = this.serviceClient().list();
- return inner.mapPage(inner1 -> new ClusterImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new ClusterImpl(inner1, this.manager()));
}
public PagedIterable list(Context context) {
PagedIterable inner = this.serviceClient().list(context);
- return inner.mapPage(inner1 -> new ClusterImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new ClusterImpl(inner1, this.manager()));
}
public PagedIterable listSkus() {
PagedIterable inner = this.serviceClient().listSkus();
- return inner.mapPage(inner1 -> new SkuDescriptionImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new SkuDescriptionImpl(inner1, this.manager()));
}
public PagedIterable listSkus(Context context) {
PagedIterable inner = this.serviceClient().listSkus(context);
- return inner.mapPage(inner1 -> new SkuDescriptionImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new SkuDescriptionImpl(inner1, this.manager()));
}
public CheckNameResult checkNameAvailability(String location, ClusterCheckNameRequest clusterName) {
@@ -195,27 +195,27 @@ public Response checkNameAvailabilityWithResponse(
public PagedIterable listSkusByResource(String resourceGroupName, String clusterName) {
PagedIterable inner =
this.serviceClient().listSkusByResource(resourceGroupName, clusterName);
- return inner.mapPage(inner1 -> new AzureResourceSkuImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new AzureResourceSkuImpl(inner1, this.manager()));
}
public PagedIterable listSkusByResource(
String resourceGroupName, String clusterName, Context context) {
PagedIterable inner =
this.serviceClient().listSkusByResource(resourceGroupName, clusterName, context);
- return inner.mapPage(inner1 -> new AzureResourceSkuImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new AzureResourceSkuImpl(inner1, this.manager()));
}
public PagedIterable listLanguageExtensions(String resourceGroupName, String clusterName) {
PagedIterable inner =
this.serviceClient().listLanguageExtensions(resourceGroupName, clusterName);
- return inner.mapPage(inner1 -> new LanguageExtensionImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new LanguageExtensionImpl(inner1, this.manager()));
}
public PagedIterable listLanguageExtensions(
String resourceGroupName, String clusterName, Context context) {
PagedIterable inner =
this.serviceClient().listLanguageExtensions(resourceGroupName, clusterName, context);
- return inner.mapPage(inner1 -> new LanguageExtensionImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new LanguageExtensionImpl(inner1, this.manager()));
}
public void addLanguageExtensions(
diff --git a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/DataConnectionsImpl.java b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/DataConnectionsImpl.java
index 15d6b180da3b..2dc381c07ae2 100644
--- a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/DataConnectionsImpl.java
+++ b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/DataConnectionsImpl.java
@@ -38,14 +38,14 @@ public PagedIterable listByDatabase(
String resourceGroupName, String clusterName, String databaseName) {
PagedIterable inner =
this.serviceClient().listByDatabase(resourceGroupName, clusterName, databaseName);
- return inner.mapPage(inner1 -> new DataConnectionImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new DataConnectionImpl(inner1, this.manager()));
}
public PagedIterable listByDatabase(
String resourceGroupName, String clusterName, String databaseName, Context context) {
PagedIterable inner =
this.serviceClient().listByDatabase(resourceGroupName, clusterName, databaseName, context);
- return inner.mapPage(inner1 -> new DataConnectionImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new DataConnectionImpl(inner1, this.manager()));
}
public DataConnectionValidationListResult dataConnectionValidation(
diff --git a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/DatabasePrincipalAssignmentsImpl.java b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/DatabasePrincipalAssignmentsImpl.java
index 55c5c04c735c..db92d0e02b32 100644
--- a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/DatabasePrincipalAssignmentsImpl.java
+++ b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/DatabasePrincipalAssignmentsImpl.java
@@ -120,14 +120,14 @@ public PagedIterable list(
String resourceGroupName, String clusterName, String databaseName) {
PagedIterable inner =
this.serviceClient().list(resourceGroupName, clusterName, databaseName);
- return inner.mapPage(inner1 -> new DatabasePrincipalAssignmentImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new DatabasePrincipalAssignmentImpl(inner1, this.manager()));
}
public PagedIterable list(
String resourceGroupName, String clusterName, String databaseName, Context context) {
PagedIterable inner =
this.serviceClient().list(resourceGroupName, clusterName, databaseName, context);
- return inner.mapPage(inner1 -> new DatabasePrincipalAssignmentImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new DatabasePrincipalAssignmentImpl(inner1, this.manager()));
}
public DatabasePrincipalAssignment getById(String id) {
diff --git a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/DatabasesImpl.java b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/DatabasesImpl.java
index b961c2ace1b6..970fc1042b1f 100644
--- a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/DatabasesImpl.java
+++ b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/DatabasesImpl.java
@@ -66,13 +66,13 @@ public Response checkNameAvailabilityWithResponse(
public PagedIterable listByCluster(String resourceGroupName, String clusterName) {
PagedIterable inner = this.serviceClient().listByCluster(resourceGroupName, clusterName);
- return inner.mapPage(inner1 -> new DatabaseImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new DatabaseImpl(inner1, this.manager()));
}
public PagedIterable listByCluster(String resourceGroupName, String clusterName, Context context) {
PagedIterable inner =
this.serviceClient().listByCluster(resourceGroupName, clusterName, context);
- return inner.mapPage(inner1 -> new DatabaseImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new DatabaseImpl(inner1, this.manager()));
}
public Database get(String resourceGroupName, String clusterName, String databaseName) {
@@ -154,14 +154,14 @@ public PagedIterable listPrincipals(
String resourceGroupName, String clusterName, String databaseName) {
PagedIterable inner =
this.serviceClient().listPrincipals(resourceGroupName, clusterName, databaseName);
- return inner.mapPage(inner1 -> new DatabasePrincipalImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new DatabasePrincipalImpl(inner1, this.manager()));
}
public PagedIterable listPrincipals(
String resourceGroupName, String clusterName, String databaseName, Context context) {
PagedIterable inner =
this.serviceClient().listPrincipals(resourceGroupName, clusterName, databaseName, context);
- return inner.mapPage(inner1 -> new DatabasePrincipalImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new DatabasePrincipalImpl(inner1, this.manager()));
}
public DatabasePrincipalListResult addPrincipals(
diff --git a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/KustoManagementClientImpl.java b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/KustoManagementClientImpl.java
index cf1e8404ad1e..12fc58e81f75 100644
--- a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/KustoManagementClientImpl.java
+++ b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/KustoManagementClientImpl.java
@@ -319,7 +319,7 @@ public Mono getLroFinalResultOrError(AsyncPollResponse,
if (managementError.getCode() == null || managementError.getMessage() == null) {
managementError = null;
}
- } catch (IOException ioe) {
+ } catch (IOException | RuntimeException ioe) {
logger.logThrowableAsWarning(ioe);
}
}
@@ -348,7 +348,7 @@ private static final class HttpResponseImpl extends HttpResponse {
super(null);
this.statusCode = statusCode;
this.httpHeaders = httpHeaders;
- this.responseBody = responseBody.getBytes(StandardCharsets.UTF_8);
+ this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8);
}
public int getStatusCode() {
diff --git a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/OperationsImpl.java b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/OperationsImpl.java
index b51bd4a31330..4a1f09e71f1a 100644
--- a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/OperationsImpl.java
+++ b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/OperationsImpl.java
@@ -28,12 +28,12 @@ public OperationsImpl(OperationsClient innerClient, KustoManager serviceManager)
public PagedIterable list() {
PagedIterable inner = this.serviceClient().list();
- return inner.mapPage(inner1 -> new OperationImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager()));
}
public PagedIterable list(Context context) {
PagedIterable inner = this.serviceClient().list(context);
- return inner.mapPage(inner1 -> new OperationImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager()));
}
private OperationsClient serviceClient() {
diff --git a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/Utils.java b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/Utils.java
index 457814f522a1..5865dd53469f 100644
--- a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/Utils.java
+++ b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/implementation/Utils.java
@@ -4,12 +4,20 @@
package com.azure.resourcemanager.kusto.implementation;
+import com.azure.core.http.rest.PagedFlux;
+import com.azure.core.http.rest.PagedIterable;
+import com.azure.core.http.rest.PagedResponse;
+import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.util.CoreUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import reactor.core.publisher.Mono;
final class Utils {
static String getValueFromIdByName(String id, String name) {
@@ -64,4 +72,125 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri
}
return null;
}
+
+ static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) {
+ return new PagedIterableImpl(pageIterable, mapper);
+ }
+
+ private static final class PagedIterableImpl extends PagedIterable {
+
+ private final PagedIterable pageIterable;
+ private final Function mapper;
+ private final Function, PagedResponse> pageMapper;
+
+ private PagedIterableImpl(PagedIterable pageIterable, Function mapper) {
+ super(new PagedFlux(Mono::empty));
+ this.pageIterable = pageIterable;
+ this.mapper = mapper;
+ this.pageMapper =
+ page ->
+ new PagedResponseBase(
+ page.getRequest(),
+ page.getStatusCode(),
+ page.getHeaders(),
+ page.getElements().stream().map(mapper).collect(Collectors.toList()),
+ page.getContinuationToken(),
+ null);
+ }
+
+ @Override
+ public Stream stream() {
+ return pageIterable.stream().map(mapper);
+ }
+
+ @Override
+ public Stream> streamByPage() {
+ return pageIterable.streamByPage().map(pageMapper);
+ }
+
+ @Override
+ public Stream> streamByPage(String continuationToken) {
+ return pageIterable.streamByPage(continuationToken).map(pageMapper);
+ }
+
+ @Override
+ public Stream> streamByPage(int preferredPageSize) {
+ return pageIterable.streamByPage(preferredPageSize).map(pageMapper);
+ }
+
+ @Override
+ public Stream> streamByPage(String continuationToken, int preferredPageSize) {
+ return pageIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper);
+ }
+
+ @Override
+ public Iterator iterator() {
+ return new IteratorImpl(pageIterable.iterator(), mapper);
+ }
+
+ @Override
+ public Iterable> iterableByPage() {
+ return new IterableImpl, PagedResponse>(pageIterable.iterableByPage(), pageMapper);
+ }
+
+ @Override
+ public Iterable> iterableByPage(String continuationToken) {
+ return new IterableImpl, PagedResponse>(
+ pageIterable.iterableByPage(continuationToken), pageMapper);
+ }
+
+ @Override
+ public Iterable> iterableByPage(int preferredPageSize) {
+ return new IterableImpl, PagedResponse>(
+ pageIterable.iterableByPage(preferredPageSize), pageMapper);
+ }
+
+ @Override
+ public Iterable> iterableByPage(String continuationToken, int preferredPageSize) {
+ return new IterableImpl, PagedResponse>(
+ pageIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper);
+ }
+ }
+
+ private static final class IteratorImpl implements Iterator {
+
+ private final Iterator iterator;
+ private final Function mapper;
+
+ private IteratorImpl(Iterator iterator, Function mapper) {
+ this.iterator = iterator;
+ this.mapper = mapper;
+ }
+
+ @Override
+ public boolean hasNext() {
+ return iterator.hasNext();
+ }
+
+ @Override
+ public S next() {
+ return mapper.apply(iterator.next());
+ }
+
+ @Override
+ public void remove() {
+ iterator.remove();
+ }
+ }
+
+ private static final class IterableImpl implements Iterable {
+
+ private final Iterable iterable;
+ private final Function mapper;
+
+ private IterableImpl(Iterable iterable, Function mapper) {
+ this.iterable = iterable;
+ this.mapper = mapper;
+ }
+
+ @Override
+ public Iterator iterator() {
+ return new IteratorImpl(iterable.iterator(), mapper);
+ }
+ }
}
diff --git a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/models/Cluster.java b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/models/Cluster.java
index b547f4c0c56e..82bbebbaa429 100644
--- a/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/models/Cluster.java
+++ b/sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/models/Cluster.java
@@ -4,9 +4,11 @@
package com.azure.resourcemanager.kusto.models;
+import com.azure.core.http.rest.PagedIterable;
import com.azure.core.management.Region;
import com.azure.core.util.Context;
import com.azure.resourcemanager.kusto.fluent.models.ClusterInner;
+import com.azure.resourcemanager.kusto.fluent.models.FollowerDatabaseDefinitionInner;
import java.util.List;
import java.util.Map;
@@ -577,4 +579,163 @@ interface WithEngineType {
* @return the refreshed resource.
*/
Cluster refresh(Context context);
+
+ /**
+ * Stops a Kusto cluster.
+ *
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ */
+ void stop();
+
+ /**
+ * Stops a Kusto cluster.
+ *
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ */
+ void stop(Context context);
+
+ /**
+ * Starts a Kusto cluster.
+ *
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ */
+ void start();
+
+ /**
+ * Starts a Kusto cluster.
+ *
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ */
+ void start(Context context);
+
+ /**
+ * Returns a list of databases that are owned by this cluster and were followed by another cluster.
+ *
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the list Kusto database principals operation response.
+ */
+ PagedIterable listFollowerDatabases();
+
+ /**
+ * Returns a list of databases that are owned by this cluster and were followed by another cluster.
+ *
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the list Kusto database principals operation response.
+ */
+ PagedIterable listFollowerDatabases(Context context);
+
+ /**
+ * Detaches all followers of a database owned by this cluster.
+ *
+ * @param followerDatabaseToRemove The follower databases properties to remove.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ */
+ void detachFollowerDatabases(FollowerDatabaseDefinitionInner followerDatabaseToRemove);
+
+ /**
+ * Detaches all followers of a database owned by this cluster.
+ *
+ * @param followerDatabaseToRemove The follower databases properties to remove.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ */
+ void detachFollowerDatabases(FollowerDatabaseDefinitionInner followerDatabaseToRemove, Context context);
+
+ /**
+ * Diagnoses network connectivity status for external resources on which the service is dependent on.
+ *
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the response.
+ */
+ DiagnoseVirtualNetworkResult diagnoseVirtualNetwork();
+
+ /**
+ * Diagnoses network connectivity status for external resources on which the service is dependent on.
+ *
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the response.
+ */
+ DiagnoseVirtualNetworkResult diagnoseVirtualNetwork(Context context);
+
+ /**
+ * Returns a list of language extensions that can run within KQL queries.
+ *
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the list of language extension objects.
+ */
+ PagedIterable listLanguageExtensions();
+
+ /**
+ * Returns a list of language extensions that can run within KQL queries.
+ *
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the list of language extension objects.
+ */
+ PagedIterable listLanguageExtensions(Context context);
+
+ /**
+ * Add a list of language extensions that can run within KQL queries.
+ *
+ * @param languageExtensionsToAdd The language extensions to add.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ */
+ void addLanguageExtensions(LanguageExtensionsList languageExtensionsToAdd);
+
+ /**
+ * Add a list of language extensions that can run within KQL queries.
+ *
+ * @param languageExtensionsToAdd The language extensions to add.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ */
+ void addLanguageExtensions(LanguageExtensionsList languageExtensionsToAdd, Context context);
+
+ /**
+ * Remove a list of language extensions that can run within KQL queries.
+ *
+ * @param languageExtensionsToRemove The language extensions to remove.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ */
+ void removeLanguageExtensions(LanguageExtensionsList languageExtensionsToRemove);
+
+ /**
+ * Remove a list of language extensions that can run within KQL queries.
+ *
+ * @param languageExtensionsToRemove The language extensions to remove.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ */
+ void removeLanguageExtensions(LanguageExtensionsList languageExtensionsToRemove, Context context);
}
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-obo/src/main/java/com/azure/spring/sample/aad/configuration/AADSampleConfiguration.java b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-obo/src/main/java/com/azure/spring/sample/aad/configuration/AADSampleConfiguration.java
index c1f5d8b283bc..41ff9abd115e 100644
--- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-obo/src/main/java/com/azure/spring/sample/aad/configuration/AADSampleConfiguration.java
+++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-obo/src/main/java/com/azure/spring/sample/aad/configuration/AADSampleConfiguration.java
@@ -15,25 +15,13 @@
public class AADSampleConfiguration {
@Bean
- public OAuth2AuthorizedClientManager authorizedClientManager(
- ClientRegistrationRepository clientRegistrationRepository,
- OAuth2AuthorizedClientRepository authorizedClientRepository) {
- OAuth2AuthorizedClientProvider authorizedClientProvider =
- OAuth2AuthorizedClientProviderBuilder.builder()
- .refreshToken()
- .build();
- DefaultOAuth2AuthorizedClientManager authorizedClientManager =
- new DefaultOAuth2AuthorizedClientManager(clientRegistrationRepository, authorizedClientRepository);
- authorizedClientManager.setAuthorizedClientProvider(authorizedClientProvider);
- return authorizedClientManager;
- }
-
- @Bean
- public WebClient webClient(OAuth2AuthorizedClientManager authorizedClientManager) {
- ServletOAuth2AuthorizedClientExchangeFilterFunction oauth2Client =
- new ServletOAuth2AuthorizedClientExchangeFilterFunction(authorizedClientManager);
+ public static WebClient webClient(ClientRegistrationRepository clientRegistrationRepository,
+ OAuth2AuthorizedClientRepository authorizedClientRepository) {
+ ServletOAuth2AuthorizedClientExchangeFilterFunction function =
+ new ServletOAuth2AuthorizedClientExchangeFilterFunction(clientRegistrationRepository,
+ authorizedClientRepository);
return WebClient.builder()
- .apply(oauth2Client.oauth2Configuration())
+ .apply(function.oauth2Configuration())
.build();
}
}
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-obo/src/main/java/com/azure/spring/sample/aad/controller/SampleController.java b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-obo/src/main/java/com/azure/spring/sample/aad/controller/SampleController.java
index 0ca6afc267e1..4c90780e4101 100644
--- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-obo/src/main/java/com/azure/spring/sample/aad/controller/SampleController.java
+++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-obo/src/main/java/com/azure/spring/sample/aad/controller/SampleController.java
@@ -28,7 +28,7 @@ public class SampleController {
private static final String GRAPH_ME_ENDPOINT = "https://graph.microsoft.com/v1.0/me";
- private static final String CUSTOM_LOCAL_FILE_ENDPOINT = "http://localhost:8080/file";
+ private static final String CUSTOM_LOCAL_FILE_ENDPOINT = "http://localhost:8082/file";
@Autowired
private WebClient webClient;
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server/src/main/resources/application.yml b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server/src/main/resources/application.yml
index e0beedb9ab07..bb6453e448e4 100644
--- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server/src/main/resources/application.yml
+++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server/src/main/resources/application.yml
@@ -2,6 +2,9 @@
# In v2.0 tokens, this is always the client ID of the API, while in v1.0 tokens it can be the client ID or the resource URI used in the request.
# If you are using v1.0 tokens, configure both to properly complete the audience validation.
+server:
+ port: 8082
+
#azure:
# activedirectory:
# client-id:
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/src/main/java/com/azure/spring/sample/aad/config/WebClientConfig.java b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/src/main/java/com/azure/spring/sample/aad/config/WebClientConfig.java
new file mode 100644
index 000000000000..846c28b5c15c
--- /dev/null
+++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/src/main/java/com/azure/spring/sample/aad/config/WebClientConfig.java
@@ -0,0 +1,27 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.spring.sample.aad.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository;
+import org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository;
+import org.springframework.security.oauth2.client.web.reactive.function.client.ServletOAuth2AuthorizedClientExchangeFilterFunction;
+import org.springframework.web.reactive.function.client.WebClient;
+
+
+@Configuration
+public class WebClientConfig {
+
+ @Bean
+ public static WebClient webClient(ClientRegistrationRepository clientRegistrationRepository,
+ OAuth2AuthorizedClientRepository authorizedClientRepository) {
+ ServletOAuth2AuthorizedClientExchangeFilterFunction function =
+ new ServletOAuth2AuthorizedClientExchangeFilterFunction(clientRegistrationRepository,
+ authorizedClientRepository);
+ return WebClient.builder()
+ .apply(function.oauth2Configuration())
+ .build();
+ }
+}
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/src/main/java/com/azure/spring/sample/aad/controller/CallOboServerController.java b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/src/main/java/com/azure/spring/sample/aad/controller/CallOboServerController.java
new file mode 100644
index 000000000000..1a5f1564fd19
--- /dev/null
+++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/src/main/java/com/azure/spring/sample/aad/controller/CallOboServerController.java
@@ -0,0 +1,60 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.spring.sample.aad.controller;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.oauth2.client.OAuth2AuthorizedClient;
+import org.springframework.security.oauth2.client.annotation.RegisteredOAuth2AuthorizedClient;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.reactive.function.client.WebClient;
+
+
+import static org.springframework.security.oauth2.client.web.reactive.function.client.ServletOAuth2AuthorizedClientExchangeFilterFunction.oauth2AuthorizedClient;
+
+@Controller
+public class CallOboServerController {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(CallOboServerController.class);
+
+ private static final String CUSTOM_LOCAL_FILE_ENDPOINT = "http://localhost:8081/call-custom";
+
+ @Autowired
+ private WebClient webClient;
+
+ /**
+ * Call obo server, combine all the response and return.
+ * @param obo authorized client for Custom
+ * @return Response Graph and Custom data.
+ */
+ @GetMapping("/obo")
+ @ResponseBody
+ public String callOboServer(@RegisteredOAuth2AuthorizedClient("obo") OAuth2AuthorizedClient obo) {
+ return callOboEndpoint(obo);
+ }
+
+ /**
+ * Call obo local file endpoint
+ * @param obo Authorized Client
+ * @return Response string data.
+ */
+ private String callOboEndpoint(OAuth2AuthorizedClient obo) {
+ if (null != obo) {
+ String body = webClient
+ .get()
+ .uri(CUSTOM_LOCAL_FILE_ENDPOINT)
+ .attributes(oauth2AuthorizedClient(obo))
+ .retrieve()
+ .bodyToMono(String.class)
+ .block();
+ LOGGER.info("Response from obo server: {}", body);
+ return "Obo server response " + (null != body ? "success." : "failed.");
+ } else {
+ return "Obo server response failed.";
+ }
+ }
+}
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/src/main/resources/templates/index.html b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/src/main/resources/templates/index.html
index 7fe764b65dcd..edacd62d1799 100644
--- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/src/main/resources/templates/index.html
+++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/src/main/resources/templates/index.html
@@ -34,6 +34,7 @@ Azure Active Directory OAuth 2.0 Login with Spring Security
Group2 Message |
Graph Client |
Arm Client |
+ Obo Client |