diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/CHANGELOG.md b/sdk/healthbot/azure-resourcemanager-healthbot/CHANGELOG.md
index 6ab298003134..1cf8d1bd81c5 100644
--- a/sdk/healthbot/azure-resourcemanager-healthbot/CHANGELOG.md
+++ b/sdk/healthbot/azure-resourcemanager-healthbot/CHANGELOG.md
@@ -1,5 +1,9 @@
# Release History
+## 1.0.0-beta.1 (2021-07-12)
+
+- Azure Resource Manager Healthbot client library for Java. This package contains Microsoft Azure SDK for Healthbot Management SDK. Microsoft Healthcare Bot is a cloud platform that empowers developers in Healthcare organizations to build and deploy their compliant, AI-powered virtual health assistants and health bots, that help them improve processes and reduce costs. Package tag package-2020-12-08. 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.2 (2021-02-09)
diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/README.md b/sdk/healthbot/azure-resourcemanager-healthbot/README.md
index 3b982e52b9d1..89dab4484c32 100644
--- a/sdk/healthbot/azure-resourcemanager-healthbot/README.md
+++ b/sdk/healthbot/azure-resourcemanager-healthbot/README.md
@@ -4,6 +4,20 @@ Azure Resource Manager Healthbot client library for Java.
This package contains Microsoft Azure SDK for Healthbot Management SDK. Microsoft Healthcare Bot is a cloud platform that empowers developers in Healthcare organizations to build and deploy their compliant, AI-powered virtual health assistants and health bots, that help them improve processes and reduce costs. Package tag package-2020-12-08. 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 Healthbot Management SDK. Microsof
com.azure.resourcemanager
azure-resourcemanager-healthbot
- 1.0.0-beta.1
+ 1.0.0-beta.2
```
[//]: # ({x-version-update-end})
@@ -60,6 +74,8 @@ See [API design][design] for general introduction on design and key concepts on
## Examples
+
+
## Troubleshooting
## Next steps
@@ -75,6 +91,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/main/sdk/identity/azure-identity
diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/pom.xml b/sdk/healthbot/azure-resourcemanager-healthbot/pom.xml
index ea37b61008b3..c5d0fd228cfc 100644
--- a/sdk/healthbot/azure-resourcemanager-healthbot/pom.xml
+++ b/sdk/healthbot/azure-resourcemanager-healthbot/pom.xml
@@ -1,62 +1,86 @@
- 4.0.0
-
- com.azure
- azure-client-sdk-parent
- 1.7.0
- ../../parents/azure-client-sdk-parent
-
+ 4.0.0
+
+ com.azure
+ azure-client-sdk-parent
+ 1.7.0
+ ../../parents/azure-client-sdk-parent
+
- com.azure.resourcemanager
- azure-resourcemanager-healthbot
- 1.0.0-beta.2
- jar
+ com.azure.resourcemanager
+ azure-resourcemanager-healthbot
+ 1.0.0-beta.2
+ jar
- Microsoft Azure SDK for Healthbot Management
- This package contains Microsoft Azure SDK for Healthbot Management SDK. Microsoft Healthcare Bot is a cloud platform that empowers developers in Healthcare organizations to build and deploy their compliant, AI-powered virtual health assistants and health bots, that help them improve processes and reduce costs. Package tag package-2020-12-08. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt
- https://github.com/Azure/azure-sdk-for-java
+ Microsoft Azure SDK for Healthbot Management
+ This package contains Microsoft Azure SDK for Healthbot Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Microsoft Healthcare Bot is a cloud platform that empowers developers in Healthcare organizations to build and deploy their compliant, AI-powered virtual health assistants and health bots, that help them improve processes and reduce costs. Package tag package-2020-12-08.
+ https://github.com/Azure/azure-sdk-for-java
-
-
- The MIT License (MIT)
- http://opensource.org/licenses/MIT
- repo
-
-
+
+
+ The MIT License (MIT)
+ http://opensource.org/licenses/MIT
+ repo
+
+
-
- https://github.com/Azure/azure-sdk-for-java
- scm:git:git@github.com:Azure/azure-sdk-for-java.git
- scm:git:git@github.com:Azure/azure-sdk-for-java.git
- HEAD
-
-
-
- microsoft
- Microsoft
-
-
-
- UTF-8
-
-
-
-
- com.azure
- azure-core-management
- 1.3.1
-
-
-
-
-
- org.jacoco
- jacoco-maven-plugin
- 0.8.5
-
- true
-
-
-
-
+
+ https://github.com/Azure/azure-sdk-for-java
+ scm:git:git@github.com:Azure/azure-sdk-for-java.git
+ scm:git:git@github.com:Azure/azure-sdk-for-java.git
+ HEAD
+
+
+
+ microsoft
+ Microsoft
+
+
+
+ UTF-8
+
+
+
+
+ com.azure
+ azure-core
+ 1.18.0
+
+
+ com.azure
+ azure-core-management
+ 1.3.1
+
+
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.8.5
+
+ true
+
+
+
+ org.revapi
+ revapi-maven-plugin
+ 0.11.2
+
+
+
+ -
+
java.method.addedToInterface
+
+ -
+ true
+
.*
+ com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)*
+
+
+
+
+
+
+
diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/HealthbotManager.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/HealthbotManager.java
index 483026bec231..d5793f84d26d 100644
--- a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/HealthbotManager.java
+++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/HealthbotManager.java
@@ -9,7 +9,6 @@
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.HttpPipelineBuilder;
import com.azure.core.http.policy.AddDatePolicy;
-import com.azure.core.http.policy.BearerTokenAuthenticationPolicy;
import com.azure.core.http.policy.HttpLogOptions;
import com.azure.core.http.policy.HttpLoggingPolicy;
import com.azure.core.http.policy.HttpPipelinePolicy;
@@ -17,6 +16,7 @@
import com.azure.core.http.policy.RequestIdPolicy;
import com.azure.core.http.policy.RetryPolicy;
import com.azure.core.http.policy.UserAgentPolicy;
+import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy;
import com.azure.core.management.profile.AzureProfile;
import com.azure.core.util.Configuration;
import com.azure.core.util.logging.ClientLogger;
@@ -85,6 +85,7 @@ public static final class Configurable {
private HttpClient httpClient;
private HttpLogOptions httpLogOptions;
private final List policies = new ArrayList<>();
+ private final List scopes = new ArrayList<>();
private RetryPolicy retryPolicy;
private Duration defaultPollInterval;
@@ -124,6 +125,17 @@ public Configurable withPolicy(HttpPipelinePolicy policy) {
return this;
}
+ /**
+ * Adds the scope to permission sets.
+ *
+ * @param scope the scope.
+ * @return the configurable object itself.
+ */
+ public Configurable withScope(String scope) {
+ this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null."));
+ return this;
+ }
+
/**
* Sets the retry policy to the HTTP pipeline.
*
@@ -160,25 +172,40 @@ public HealthbotManager 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.healthbot")
+ .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 (scopes.isEmpty()) {
+ scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default");
+ }
if (retryPolicy == null) {
retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
}
List policies = new ArrayList<>();
- policies
- .add(
- new UserAgentPolicy(
- null,
- "com.azure.resourcemanager.healthbot",
- "1.0.0-beta.1",
- Configuration.getGlobalConfiguration()));
+ policies.add(new UserAgentPolicy(userAgentBuilder.toString()));
policies.add(new RequestIdPolicy());
HttpPolicyProviders.addBeforeRetryPolicies(policies);
policies.add(retryPolicy);
policies.add(new AddDatePolicy());
- policies
- .add(
- new BearerTokenAuthenticationPolicy(
- credential, profile.getEnvironment().getManagementEndpoint() + "/.default"));
+ policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0])));
+ policies.addAll(this.policies);
HttpPolicyProviders.addAfterRetryPolicies(policies);
policies.add(new HttpLoggingPolicy(httpLogOptions));
HttpPipeline httpPipeline =
diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/BotsClientImpl.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/BotsClientImpl.java
index 8564037ef467..5300fa62be4c 100644
--- a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/BotsClientImpl.java
+++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/BotsClientImpl.java
@@ -228,7 +228,7 @@ private Mono>> createWithResponseAsync(
parameters,
accept,
context))
- .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
@@ -480,7 +480,7 @@ private Mono> getByResourceGroupWithResponseAsync(
this.client.getApiVersion(),
accept,
context))
- .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
@@ -636,7 +636,7 @@ private Mono> updateWithResponseAsync(
parameters,
accept,
context))
- .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
@@ -795,7 +795,7 @@ private Mono>> deleteWithResponseAsync(String resource
this.client.getApiVersion(),
accept,
context))
- .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
@@ -1024,7 +1024,7 @@ private Mono> listByResourceGroupSinglePageAsync(S
res.getValue().value(),
res.getValue().nextLink(),
null))
- .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
@@ -1180,7 +1180,7 @@ private Mono> listSinglePageAsync() {
res.getValue().value(),
res.getValue().nextLink(),
null))
- .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
@@ -1312,7 +1312,7 @@ private Mono> listByResourceGroupNextSinglePageAsy
res.getValue().value(),
res.getValue().nextLink(),
null))
- .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
@@ -1384,7 +1384,7 @@ private Mono> listNextSinglePageAsync(String nextL
res.getValue().value(),
res.getValue().nextLink(),
null))
- .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/BotsImpl.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/BotsImpl.java
index 83dbe3ea1802..7a454609d141 100644
--- a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/BotsImpl.java
+++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/BotsImpl.java
@@ -9,7 +9,6 @@
import com.azure.core.http.rest.SimpleResponse;
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
-import com.azure.resourcemanager.healthbot.HealthbotManager;
import com.azure.resourcemanager.healthbot.fluent.BotsClient;
import com.azure.resourcemanager.healthbot.fluent.models.HealthBotInner;
import com.azure.resourcemanager.healthbot.models.Bots;
@@ -21,9 +20,9 @@ public final class BotsImpl implements Bots {
private final BotsClient innerClient;
- private final HealthbotManager serviceManager;
+ private final com.azure.resourcemanager.healthbot.HealthbotManager serviceManager;
- public BotsImpl(BotsClient innerClient, HealthbotManager serviceManager) {
+ public BotsImpl(BotsClient innerClient, com.azure.resourcemanager.healthbot.HealthbotManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
@@ -62,22 +61,22 @@ public void delete(String resourceGroupName, String botName, Context context) {
public PagedIterable listByResourceGroup(String resourceGroupName) {
PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName);
- return inner.mapPage(inner1 -> new HealthBotImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new HealthBotImpl(inner1, this.manager()));
}
public PagedIterable listByResourceGroup(String resourceGroupName, Context context) {
PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context);
- return inner.mapPage(inner1 -> new HealthBotImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new HealthBotImpl(inner1, this.manager()));
}
public PagedIterable list() {
PagedIterable inner = this.serviceClient().list();
- return inner.mapPage(inner1 -> new HealthBotImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new HealthBotImpl(inner1, this.manager()));
}
public PagedIterable list(Context context) {
PagedIterable inner = this.serviceClient().list(context);
- return inner.mapPage(inner1 -> new HealthBotImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new HealthBotImpl(inner1, this.manager()));
}
public HealthBot getById(String id) {
@@ -160,7 +159,7 @@ private BotsClient serviceClient() {
return this.innerClient;
}
- private HealthbotManager manager() {
+ private com.azure.resourcemanager.healthbot.HealthbotManager manager() {
return this.serviceManager;
}
diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/HealthBotImpl.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/HealthBotImpl.java
index 70344df49af8..ffb4b9baf4bb 100644
--- a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/HealthBotImpl.java
+++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/HealthBotImpl.java
@@ -6,7 +6,6 @@
import com.azure.core.management.Region;
import com.azure.core.util.Context;
-import com.azure.resourcemanager.healthbot.HealthbotManager;
import com.azure.resourcemanager.healthbot.fluent.models.HealthBotInner;
import com.azure.resourcemanager.healthbot.models.HealthBot;
import com.azure.resourcemanager.healthbot.models.HealthBotProperties;
@@ -18,7 +17,7 @@
public final class HealthBotImpl implements HealthBot, HealthBot.Definition, HealthBot.Update {
private HealthBotInner innerObject;
- private final HealthbotManager serviceManager;
+ private final com.azure.resourcemanager.healthbot.HealthbotManager serviceManager;
public String id() {
return this.innerModel().id();
@@ -65,7 +64,7 @@ public HealthBotInner innerModel() {
return this.innerObject;
}
- private HealthbotManager manager() {
+ private com.azure.resourcemanager.healthbot.HealthbotManager manager() {
return this.serviceManager;
}
@@ -95,7 +94,7 @@ public HealthBot create(Context context) {
return this;
}
- HealthBotImpl(String name, HealthbotManager serviceManager) {
+ HealthBotImpl(String name, com.azure.resourcemanager.healthbot.HealthbotManager serviceManager) {
this.innerObject = new HealthBotInner();
this.serviceManager = serviceManager;
this.botName = name;
@@ -126,7 +125,7 @@ public HealthBot apply(Context context) {
return this;
}
- HealthBotImpl(HealthBotInner innerObject, HealthbotManager serviceManager) {
+ HealthBotImpl(HealthBotInner innerObject, com.azure.resourcemanager.healthbot.HealthbotManager serviceManager) {
this.innerObject = innerObject;
this.serviceManager = serviceManager;
this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups");
diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/HealthbotClientImpl.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/HealthbotClientImpl.java
index 52486036b233..38de41d25e9f 100644
--- a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/HealthbotClientImpl.java
+++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/HealthbotClientImpl.java
@@ -244,7 +244,7 @@ public Mono getLroFinalResultOrError(AsyncPollResponse,
if (managementError.getCode() == null || managementError.getMessage() == null) {
managementError = null;
}
- } catch (IOException ioe) {
+ } catch (IOException | RuntimeException ioe) {
logger.logThrowableAsWarning(ioe);
}
}
@@ -273,7 +273,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/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/OperationDetailImpl.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/OperationDetailImpl.java
index 877ca542a4d5..5cc7a8d40bef 100644
--- a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/OperationDetailImpl.java
+++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/OperationDetailImpl.java
@@ -4,7 +4,6 @@
package com.azure.resourcemanager.healthbot.implementation;
-import com.azure.resourcemanager.healthbot.HealthbotManager;
import com.azure.resourcemanager.healthbot.fluent.models.OperationDetailInner;
import com.azure.resourcemanager.healthbot.models.OperationDetail;
import com.azure.resourcemanager.healthbot.models.OperationDisplay;
@@ -12,9 +11,10 @@
public final class OperationDetailImpl implements OperationDetail {
private OperationDetailInner innerObject;
- private final HealthbotManager serviceManager;
+ private final com.azure.resourcemanager.healthbot.HealthbotManager serviceManager;
- OperationDetailImpl(OperationDetailInner innerObject, HealthbotManager serviceManager) {
+ OperationDetailImpl(
+ OperationDetailInner innerObject, com.azure.resourcemanager.healthbot.HealthbotManager serviceManager) {
this.innerObject = innerObject;
this.serviceManager = serviceManager;
}
@@ -43,7 +43,7 @@ public OperationDetailInner innerModel() {
return this.innerObject;
}
- private HealthbotManager manager() {
+ private com.azure.resourcemanager.healthbot.HealthbotManager manager() {
return this.serviceManager;
}
}
diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/OperationsClientImpl.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/OperationsClientImpl.java
index 74568aa0459e..018cd15112d1 100644
--- a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/OperationsClientImpl.java
+++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/OperationsClientImpl.java
@@ -108,7 +108,7 @@ private Mono> listSinglePageAsync() {
res.getValue().value(),
res.getValue().nextLink(),
null))
- .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
@@ -228,7 +228,7 @@ private Mono> listNextSinglePageAsync(String
res.getValue().value(),
res.getValue().nextLink(),
null))
- .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/OperationsImpl.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/OperationsImpl.java
index 05bd0f14e232..7c6e8bca43c8 100644
--- a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/OperationsImpl.java
+++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/OperationsImpl.java
@@ -7,7 +7,6 @@
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
-import com.azure.resourcemanager.healthbot.HealthbotManager;
import com.azure.resourcemanager.healthbot.fluent.OperationsClient;
import com.azure.resourcemanager.healthbot.fluent.models.OperationDetailInner;
import com.azure.resourcemanager.healthbot.models.OperationDetail;
@@ -19,28 +18,29 @@ public final class OperationsImpl implements Operations {
private final OperationsClient innerClient;
- private final HealthbotManager serviceManager;
+ private final com.azure.resourcemanager.healthbot.HealthbotManager serviceManager;
- public OperationsImpl(OperationsClient innerClient, HealthbotManager serviceManager) {
+ public OperationsImpl(
+ OperationsClient innerClient, com.azure.resourcemanager.healthbot.HealthbotManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
public PagedIterable list() {
PagedIterable inner = this.serviceClient().list();
- return inner.mapPage(inner1 -> new OperationDetailImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new OperationDetailImpl(inner1, this.manager()));
}
public PagedIterable list(Context context) {
PagedIterable inner = this.serviceClient().list(context);
- return inner.mapPage(inner1 -> new OperationDetailImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new OperationDetailImpl(inner1, this.manager()));
}
private OperationsClient serviceClient() {
return this.innerClient;
}
- private HealthbotManager manager() {
+ private com.azure.resourcemanager.healthbot.HealthbotManager manager() {
return this.serviceManager;
}
}
diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/Utils.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/Utils.java
index bbe96c315d48..d92f83363a7b 100644
--- a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/Utils.java
+++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/Utils.java
@@ -4,12 +4,20 @@
package com.azure.resourcemanager.healthbot.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.Flux;
final class Utils {
static String getValueFromIdByName(String id, String name) {
@@ -64,4 +72,133 @@ 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 pagedIterable;
+ private final Function mapper;
+ private final Function, PagedResponse> pageMapper;
+
+ private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) {
+ super(
+ PagedFlux
+ .create(
+ () ->
+ (continuationToken, pageSize) ->
+ Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper)))));
+ this.pagedIterable = pagedIterable;
+ this.mapper = mapper;
+ this.pageMapper = getPageMapper(mapper);
+ }
+
+ private static Function, PagedResponse> getPageMapper(Function mapper) {
+ return 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 pagedIterable.stream().map(mapper);
+ }
+
+ @Override
+ public Stream> streamByPage() {
+ return pagedIterable.streamByPage().map(pageMapper);
+ }
+
+ @Override
+ public Stream> streamByPage(String continuationToken) {
+ return pagedIterable.streamByPage(continuationToken).map(pageMapper);
+ }
+
+ @Override
+ public Stream> streamByPage(int preferredPageSize) {
+ return pagedIterable.streamByPage(preferredPageSize).map(pageMapper);
+ }
+
+ @Override
+ public Stream> streamByPage(String continuationToken, int preferredPageSize) {
+ return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper);
+ }
+
+ @Override
+ public Iterator iterator() {
+ return new IteratorImpl(pagedIterable.iterator(), mapper);
+ }
+
+ @Override
+ public Iterable> iterableByPage() {
+ return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper);
+ }
+
+ @Override
+ public Iterable> iterableByPage(String continuationToken) {
+ return new IterableImpl, PagedResponse>(
+ pagedIterable.iterableByPage(continuationToken), pageMapper);
+ }
+
+ @Override
+ public Iterable> iterableByPage(int preferredPageSize) {
+ return new IterableImpl, PagedResponse>(
+ pagedIterable.iterableByPage(preferredPageSize), pageMapper);
+ }
+
+ @Override
+ public Iterable> iterableByPage(String continuationToken, int preferredPageSize) {
+ return new IterableImpl, PagedResponse>(
+ pagedIterable.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/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/ErrorAdditionalInfo.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/ErrorAdditionalInfo.java
deleted file mode 100644
index 025b7ca8a681..000000000000
--- a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/ErrorAdditionalInfo.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-// Code generated by Microsoft (R) AutoRest Code Generator.
-
-package com.azure.resourcemanager.healthbot.models;
-
-import com.azure.core.annotation.Immutable;
-import com.azure.core.util.logging.ClientLogger;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/** The resource management error additional info. */
-@Immutable
-public final class ErrorAdditionalInfo {
- @JsonIgnore private final ClientLogger logger = new ClientLogger(ErrorAdditionalInfo.class);
-
- /*
- * The additional info type.
- */
- @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY)
- private String type;
-
- /*
- * The additional info.
- */
- @JsonProperty(value = "info", access = JsonProperty.Access.WRITE_ONLY)
- private Object info;
-
- /**
- * Get the type property: The additional info type.
- *
- * @return the type value.
- */
- public String type() {
- return this.type;
- }
-
- /**
- * Get the info property: The additional info.
- *
- * @return the info value.
- */
- public Object info() {
- return this.info;
- }
-
- /**
- * Validates the instance.
- *
- * @throws IllegalArgumentException thrown if the instance is not valid.
- */
- public void validate() {
- }
-}
diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/IdentityType.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/IdentityType.java
deleted file mode 100644
index 4765e0b24f9e..000000000000
--- a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/IdentityType.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-// Code generated by Microsoft (R) AutoRest Code Generator.
-
-package com.azure.resourcemanager.healthbot.models;
-
-import com.azure.core.util.ExpandableStringEnum;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import java.util.Collection;
-
-/** Defines values for IdentityType. */
-public final class IdentityType extends ExpandableStringEnum {
- /** Static value User for IdentityType. */
- public static final IdentityType USER = fromString("User");
-
- /** Static value Application for IdentityType. */
- public static final IdentityType APPLICATION = fromString("Application");
-
- /** Static value ManagedIdentity for IdentityType. */
- public static final IdentityType MANAGED_IDENTITY = fromString("ManagedIdentity");
-
- /** Static value Key for IdentityType. */
- public static final IdentityType KEY = fromString("Key");
-
- /**
- * Creates or finds a IdentityType from its string representation.
- *
- * @param name a name to look for.
- * @return the corresponding IdentityType.
- */
- @JsonCreator
- public static IdentityType fromString(String name) {
- return fromString(name, IdentityType.class);
- }
-
- /** @return known IdentityType values. */
- public static Collection values() {
- return values(IdentityType.class);
- }
-}
diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/SystemData.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/SystemData.java
deleted file mode 100644
index f8e0c4fe8f9a..000000000000
--- a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/SystemData.java
+++ /dev/null
@@ -1,181 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-// Code generated by Microsoft (R) AutoRest Code Generator.
-
-package com.azure.resourcemanager.healthbot.models;
-
-import com.azure.core.annotation.Fluent;
-import com.azure.core.util.logging.ClientLogger;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.time.OffsetDateTime;
-
-/** Read only system data. */
-@Fluent
-public final class SystemData {
- @JsonIgnore private final ClientLogger logger = new ClientLogger(SystemData.class);
-
- /*
- * The identity that created the resource.
- */
- @JsonProperty(value = "createdBy")
- private String createdBy;
-
- /*
- * The type of identity that created the resource
- */
- @JsonProperty(value = "createdByType")
- private IdentityType createdByType;
-
- /*
- * The timestamp of resource creation (UTC)
- */
- @JsonProperty(value = "createdAt")
- private OffsetDateTime createdAt;
-
- /*
- * The identity that last modified the resource.
- */
- @JsonProperty(value = "lastModifiedBy")
- private String lastModifiedBy;
-
- /*
- * The type of identity that last modified the resource
- */
- @JsonProperty(value = "lastModifiedByType")
- private IdentityType lastModifiedByType;
-
- /*
- * The timestamp of resource last modification (UTC)
- */
- @JsonProperty(value = "lastModifiedAt")
- private OffsetDateTime lastModifiedAt;
-
- /**
- * Get the createdBy property: The identity that created the resource.
- *
- * @return the createdBy value.
- */
- public String createdBy() {
- return this.createdBy;
- }
-
- /**
- * Set the createdBy property: The identity that created the resource.
- *
- * @param createdBy the createdBy value to set.
- * @return the SystemData object itself.
- */
- public SystemData withCreatedBy(String createdBy) {
- this.createdBy = createdBy;
- return this;
- }
-
- /**
- * Get the createdByType property: The type of identity that created the resource.
- *
- * @return the createdByType value.
- */
- public IdentityType createdByType() {
- return this.createdByType;
- }
-
- /**
- * Set the createdByType property: The type of identity that created the resource.
- *
- * @param createdByType the createdByType value to set.
- * @return the SystemData object itself.
- */
- public SystemData withCreatedByType(IdentityType createdByType) {
- this.createdByType = createdByType;
- return this;
- }
-
- /**
- * Get the createdAt property: The timestamp of resource creation (UTC).
- *
- * @return the createdAt value.
- */
- public OffsetDateTime createdAt() {
- return this.createdAt;
- }
-
- /**
- * Set the createdAt property: The timestamp of resource creation (UTC).
- *
- * @param createdAt the createdAt value to set.
- * @return the SystemData object itself.
- */
- public SystemData withCreatedAt(OffsetDateTime createdAt) {
- this.createdAt = createdAt;
- return this;
- }
-
- /**
- * Get the lastModifiedBy property: The identity that last modified the resource.
- *
- * @return the lastModifiedBy value.
- */
- public String lastModifiedBy() {
- return this.lastModifiedBy;
- }
-
- /**
- * Set the lastModifiedBy property: The identity that last modified the resource.
- *
- * @param lastModifiedBy the lastModifiedBy value to set.
- * @return the SystemData object itself.
- */
- public SystemData withLastModifiedBy(String lastModifiedBy) {
- this.lastModifiedBy = lastModifiedBy;
- return this;
- }
-
- /**
- * Get the lastModifiedByType property: The type of identity that last modified the resource.
- *
- * @return the lastModifiedByType value.
- */
- public IdentityType lastModifiedByType() {
- return this.lastModifiedByType;
- }
-
- /**
- * Set the lastModifiedByType property: The type of identity that last modified the resource.
- *
- * @param lastModifiedByType the lastModifiedByType value to set.
- * @return the SystemData object itself.
- */
- public SystemData withLastModifiedByType(IdentityType lastModifiedByType) {
- this.lastModifiedByType = lastModifiedByType;
- return this;
- }
-
- /**
- * Get the lastModifiedAt property: The timestamp of resource last modification (UTC).
- *
- * @return the lastModifiedAt value.
- */
- public OffsetDateTime lastModifiedAt() {
- return this.lastModifiedAt;
- }
-
- /**
- * Set the lastModifiedAt property: The timestamp of resource last modification (UTC).
- *
- * @param lastModifiedAt the lastModifiedAt value to set.
- * @return the SystemData object itself.
- */
- public SystemData withLastModifiedAt(OffsetDateTime lastModifiedAt) {
- this.lastModifiedAt = lastModifiedAt;
- return this;
- }
-
- /**
- * Validates the instance.
- *
- * @throws IllegalArgumentException thrown if the instance is not valid.
- */
- public void validate() {
- }
-}