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/confluent/azure-resourcemanager-confluent/CHANGELOG.md b/sdk/confluent/azure-resourcemanager-confluent/CHANGELOG.md
index 414377a51a56..8b1f9fd55ad5 100644
--- a/sdk/confluent/azure-resourcemanager-confluent/CHANGELOG.md
+++ b/sdk/confluent/azure-resourcemanager-confluent/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 Confluent client library for Java. This package contains Microsoft Azure SDK for Confluent Management SDK. Package tag package-2020-03-01. 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 (2021-01-14)
diff --git a/sdk/confluent/azure-resourcemanager-confluent/README.md b/sdk/confluent/azure-resourcemanager-confluent/README.md
index a9a1ee92f0d8..e0fd8e1e56f3 100644
--- a/sdk/confluent/azure-resourcemanager-confluent/README.md
+++ b/sdk/confluent/azure-resourcemanager-confluent/README.md
@@ -4,6 +4,20 @@ Azure Resource Manager Confluent client library for Java.
This package contains Microsoft Azure SDK for Confluent Management SDK. Package tag package-2020-03-01. 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 Confluent Management SDK. Package
com.azure.resourcemanager
azure-resourcemanager-confluent
- 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/confluent/azure-resourcemanager-confluent/pom.xml b/sdk/confluent/azure-resourcemanager-confluent/pom.xml
index 3e0168f80a4b..5014ed6555fa 100644
--- a/sdk/confluent/azure-resourcemanager-confluent/pom.xml
+++ b/sdk/confluent/azure-resourcemanager-confluent/pom.xml
@@ -41,6 +41,11 @@
+
+ com.azure
+ azure-core
+ 1.13.0
+
com.azure
azure-core-management
diff --git a/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/ConfluentManager.java b/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/ConfluentManager.java
index f83ab7100a8a..de2e84612287 100644
--- a/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/ConfluentManager.java
+++ b/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/ConfluentManager.java
@@ -160,17 +160,31 @@ public ConfluentManager authenticate(TokenCredential credential, AzureProfile pr
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.confluent")
+ .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.confluent",
- "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/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/fluent/models/OrganizationResourceInner.java b/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/fluent/models/OrganizationResourceInner.java
index b118fa126b80..c356323a91fd 100644
--- a/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/fluent/models/OrganizationResourceInner.java
+++ b/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/fluent/models/OrganizationResourceInner.java
@@ -31,7 +31,7 @@ public class OrganizationResourceInner extends Resource {
/*
* Provision states for confluent RP
*/
- @JsonProperty(value = "properties.provisioningState")
+ @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY)
private ProvisionState provisioningState;
/*
@@ -76,17 +76,6 @@ public ProvisionState provisioningState() {
return this.provisioningState;
}
- /**
- * Set the provisioningState property: Provision states for confluent RP.
- *
- * @param provisioningState the provisioningState value to set.
- * @return the OrganizationResourceInner object itself.
- */
- public OrganizationResourceInner withProvisioningState(ProvisionState provisioningState) {
- this.provisioningState = provisioningState;
- return this;
- }
-
/**
* Get the organizationId property: Id of the Confluent organization.
*
diff --git a/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/ConfluentManagementClientImpl.java b/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/ConfluentManagementClientImpl.java
index 0f8a5e484733..862786982b7c 100644
--- a/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/ConfluentManagementClientImpl.java
+++ b/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/ConfluentManagementClientImpl.java
@@ -258,7 +258,7 @@ public Mono getLroFinalResultOrError(AsyncPollResponse,
if (managementError.getCode() == null || managementError.getMessage() == null) {
managementError = null;
}
- } catch (IOException ioe) {
+ } catch (IOException | RuntimeException ioe) {
logger.logThrowableAsWarning(ioe);
}
}
@@ -287,7 +287,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/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/MarketplaceAgreementsClientImpl.java b/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/MarketplaceAgreementsClientImpl.java
index 05ec7061f9f2..cf9e00b954fc 100644
--- a/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/MarketplaceAgreementsClientImpl.java
+++ b/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/MarketplaceAgreementsClientImpl.java
@@ -13,6 +13,7 @@
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Put;
+import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
@@ -67,6 +68,7 @@ private interface MarketplaceAgreementsService {
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> list(
@HostParam("$host") String endpoint,
+ @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@HeaderParam("Accept") String accept,
Context context);
@@ -77,6 +79,7 @@ Mono> list(
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> create(
@HostParam("$host") String endpoint,
+ @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") ConfluentAgreementResourceInner body,
@HeaderParam("Accept") String accept,
@@ -117,7 +120,14 @@ private Mono> listSinglePageAsync
final String accept = "application/json";
return FluxUtil
.withContext(
- context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), accept, context))
+ context ->
+ service
+ .list(
+ this.client.getEndpoint(),
+ this.client.getApiVersion(),
+ this.client.getSubscriptionId(),
+ accept,
+ context))
.>map(
res ->
new PagedResponseBase<>(
@@ -156,7 +166,12 @@ private Mono> listSinglePageAsync
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
- .list(this.client.getEndpoint(), this.client.getSubscriptionId(), accept, context)
+ .list(
+ this.client.getEndpoint(),
+ this.client.getApiVersion(),
+ this.client.getSubscriptionId(),
+ accept,
+ context)
.map(
res ->
new PagedResponseBase<>(
@@ -252,7 +267,14 @@ private Mono> createWithResponseAsync(
return FluxUtil
.withContext(
context ->
- service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), body, accept, context))
+ service
+ .create(
+ this.client.getEndpoint(),
+ this.client.getApiVersion(),
+ this.client.getSubscriptionId(),
+ body,
+ accept,
+ context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
@@ -286,7 +308,14 @@ private Mono> createWithResponseAsync(
}
final String accept = "application/json";
context = this.client.mergeContext(context);
- return service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), body, accept, context);
+ return service
+ .create(
+ this.client.getEndpoint(),
+ this.client.getApiVersion(),
+ this.client.getSubscriptionId(),
+ body,
+ accept,
+ context);
}
/**
diff --git a/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/MarketplaceAgreementsImpl.java b/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/MarketplaceAgreementsImpl.java
index e1ca8e98d931..8a452376d10a 100644
--- a/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/MarketplaceAgreementsImpl.java
+++ b/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/MarketplaceAgreementsImpl.java
@@ -30,12 +30,12 @@ public MarketplaceAgreementsImpl(MarketplaceAgreementsClient innerClient, Conflu
public PagedIterable list() {
PagedIterable inner = this.serviceClient().list();
- return inner.mapPage(inner1 -> new ConfluentAgreementResourceImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new ConfluentAgreementResourceImpl(inner1, this.manager()));
}
public PagedIterable list(Context context) {
PagedIterable inner = this.serviceClient().list(context);
- return inner.mapPage(inner1 -> new ConfluentAgreementResourceImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new ConfluentAgreementResourceImpl(inner1, this.manager()));
}
public ConfluentAgreementResource create() {
diff --git a/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/OrganizationOperationsImpl.java b/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/OrganizationOperationsImpl.java
index c5ddf8ab6cfc..2e82c4d3b64e 100644
--- a/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/OrganizationOperationsImpl.java
+++ b/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/OrganizationOperationsImpl.java
@@ -28,12 +28,12 @@ public OrganizationOperationsImpl(OrganizationOperationsClient innerClient, Conf
public PagedIterable list() {
PagedIterable inner = this.serviceClient().list();
- return inner.mapPage(inner1 -> new OperationResultImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new OperationResultImpl(inner1, this.manager()));
}
public PagedIterable list(Context context) {
PagedIterable inner = this.serviceClient().list(context);
- return inner.mapPage(inner1 -> new OperationResultImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new OperationResultImpl(inner1, this.manager()));
}
private OrganizationOperationsClient serviceClient() {
diff --git a/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/OrganizationResourceImpl.java b/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/OrganizationResourceImpl.java
index 6f96eec5e81f..63544c0c90be 100644
--- a/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/OrganizationResourceImpl.java
+++ b/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/OrganizationResourceImpl.java
@@ -195,11 +195,6 @@ public OrganizationResourceImpl withTags(Map tags) {
}
}
- public OrganizationResourceImpl withProvisioningState(ProvisionState provisioningState) {
- this.innerModel().withProvisioningState(provisioningState);
- return this;
- }
-
public OrganizationResourceImpl withOfferDetail(OfferDetail offerDetail) {
this.innerModel().withOfferDetail(offerDetail);
return this;
diff --git a/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/OrganizationsImpl.java b/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/OrganizationsImpl.java
index 1e4a81b684a2..9022095a0006 100644
--- a/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/OrganizationsImpl.java
+++ b/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/OrganizationsImpl.java
@@ -30,23 +30,23 @@ public OrganizationsImpl(OrganizationsClient innerClient, ConfluentManager servi
public PagedIterable list() {
PagedIterable inner = this.serviceClient().list();
- return inner.mapPage(inner1 -> new OrganizationResourceImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new OrganizationResourceImpl(inner1, this.manager()));
}
public PagedIterable list(Context context) {
PagedIterable inner = this.serviceClient().list(context);
- return inner.mapPage(inner1 -> new OrganizationResourceImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new OrganizationResourceImpl(inner1, this.manager()));
}
public PagedIterable listByResourceGroup(String resourceGroupName) {
PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName);
- return inner.mapPage(inner1 -> new OrganizationResourceImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new OrganizationResourceImpl(inner1, this.manager()));
}
public PagedIterable listByResourceGroup(String resourceGroupName, Context context) {
PagedIterable inner =
this.serviceClient().listByResourceGroup(resourceGroupName, context);
- return inner.mapPage(inner1 -> new OrganizationResourceImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new OrganizationResourceImpl(inner1, this.manager()));
}
public OrganizationResource getByResourceGroup(String resourceGroupName, String organizationName) {
diff --git a/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/Utils.java b/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/Utils.java
index a66443cf089f..50fa4ce11cd4 100644
--- a/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/Utils.java
+++ b/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/Utils.java
@@ -4,12 +4,20 @@
package com.azure.resourcemanager.confluent.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/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/models/OrganizationResource.java b/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/models/OrganizationResource.java
index 10be35ce7d80..3eb5cd03f816 100644
--- a/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/models/OrganizationResource.java
+++ b/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/models/OrganizationResource.java
@@ -155,10 +155,7 @@ interface WithResourceGroup {
* resource to be created, but also allows for any other optional properties to be specified.
*/
interface WithCreate
- extends DefinitionStages.WithTags,
- DefinitionStages.WithProvisioningState,
- DefinitionStages.WithOfferDetail,
- DefinitionStages.WithUserDetail {
+ extends DefinitionStages.WithTags, DefinitionStages.WithOfferDetail, DefinitionStages.WithUserDetail {
/**
* Executes the create request.
*
@@ -184,16 +181,6 @@ interface WithTags {
*/
WithCreate withTags(Map tags);
}
- /** The stage of the OrganizationResource definition allowing to specify provisioningState. */
- interface WithProvisioningState {
- /**
- * Specifies the provisioningState property: Provision states for confluent RP.
- *
- * @param provisioningState Provision states for confluent RP.
- * @return the next definition stage.
- */
- WithCreate withProvisioningState(ProvisionState provisioningState);
- }
/** The stage of the OrganizationResource definition allowing to specify offerDetail. */
interface WithOfferDetail {
/**
diff --git a/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/models/OrganizationResourceProperties.java b/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/models/OrganizationResourceProperties.java
index b25f6c0eddb8..8af21686833a 100644
--- a/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/models/OrganizationResourceProperties.java
+++ b/sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/models/OrganizationResourceProperties.java
@@ -24,7 +24,7 @@ public class OrganizationResourceProperties {
/*
* Provision states for confluent RP
*/
- @JsonProperty(value = "provisioningState")
+ @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
private ProvisionState provisioningState;
/*
@@ -69,17 +69,6 @@ public ProvisionState provisioningState() {
return this.provisioningState;
}
- /**
- * Set the provisioningState property: Provision states for confluent RP.
- *
- * @param provisioningState the provisioningState value to set.
- * @return the OrganizationResourceProperties object itself.
- */
- public OrganizationResourceProperties withProvisioningState(ProvisionState provisioningState) {
- this.provisioningState = provisioningState;
- return this;
- }
-
/**
* Get the organizationId property: Id of the Confluent organization.
*
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 |