diff --git a/eng/versioning/external_dependencies.txt b/eng/versioning/external_dependencies.txt index 62906a566feea..464bc9b7cf1a7 100644 --- a/eng/versioning/external_dependencies.txt +++ b/eng/versioning/external_dependencies.txt @@ -110,6 +110,7 @@ org.springframework.kafka:spring-kafka;2.5.7.RELEASE org.springframework.security:spring-security-config;5.3.5.RELEASE org.springframework.security:spring-security-core;5.3.5.RELEASE org.springframework.security:spring-security-oauth2-client;5.3.5.RELEASE +org.springframework.security:spring-security-oauth2-resource-server;5.3.5.RELEASE org.springframework.security:spring-security-oauth2-core;5.3.5.RELEASE org.springframework.security:spring-security-oauth2-jose;5.3.5.RELEASE org.springframework.security:spring-security-web;5.3.5.RELEASE diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index fa2e6238ee364..310c43d0d6a30 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -40,17 +40,22 @@ com.azure:azure-ai-anomalydetector;3.0.0-beta.1;3.0.0-beta.2 com.azure:azure-ai-formrecognizer;3.0.3;3.1.0-beta.2 com.azure:azure-ai-metricsadvisor;1.0.0-beta.2;1.0.0-beta.3 com.azure:azure-ai-textanalytics;5.0.1;5.1.0-beta.4 +com.azure:azure-analytics-synapse-accesscontrol;1.0.0-beta.1;1.0.0-beta.2 +com.azure:azure-analytics-synapse-artifacts;1.0.0-beta.1;1.0.0-beta.2 +com.azure:azure-analytics-synapse-spark;1.0.0-beta.1;1.0.0-beta.2 +com.azure:azure-analytics-synapse-managedprivateendpoints;1.0.0-beta.1;1.0.0-beta.1 +com.azure:azure-analytics-synapse-monitoring;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-communication-chat;1.0.0-beta.3;1.0.0-beta.4 com.azure:azure-communication-common;1.0.0-beta.3;1.0.0-beta.4 com.azure:azure-communication-administration;1.0.0-beta.3;1.0.0-beta.4 com.azure:azure-communication-sms;1.0.0-beta.3;1.0.0-beta.4 -com.azure:azure-core;1.10.0;1.11.0 -com.azure:azure-core-amqp;1.6.0;1.7.0-beta.3 +com.azure:azure-core;1.11.0;1.12.0-beta.1 +com.azure:azure-core-amqp;2.0.0;2.1.0-beta.1 com.azure:azure-core-amqp-experimental;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-core-experimental;1.0.0-beta.8;1.0.0-beta.9 com.azure:azure-core-http-jdk-httpclient;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-core-http-netty;1.6.3;1.7.0 -com.azure:azure-core-http-okhttp;1.3.3;1.4.0 +com.azure:azure-core-http-netty;1.7.0;1.8.0-beta.1 +com.azure:azure-core-http-okhttp;1.4.0;1.5.0-beta.1 com.azure:azure-core-management;1.0.0;1.1.0-beta.1 com.azure:azure-core-serializer-avro-apache;1.0.0-beta.5;1.0.0-beta.6 com.azure:azure-core-serializer-avro-jackson;1.0.0-beta.1;1.0.0-beta.2 @@ -58,7 +63,7 @@ com.azure:azure-core-serializer-json-gson;1.0.3;1.1.0-beta.1 com.azure:azure-core-serializer-json-jackson;1.1.0;1.2.0-beta.1 com.azure:azure-core-test;1.5.1;1.6.0-beta.1 com.azure:azure-core-tracing-opentelemetry;1.0.0-beta.6;1.0.0-beta.7 -com.azure:azure-cosmos;4.8.0;4.9.0-beta.1 +com.azure:azure-cosmos;4.9.0;4.10.0 com.azure:azure-cosmos-benchmark;4.0.1-beta.1;4.0.1-beta.1 com.azure:azure-cosmos-dotnet-benchmark;4.0.1-beta.1;4.0.1-beta.1 com.azure:azure-cosmos-encryption;1.0.0-beta.1;1.0.0-beta.1 @@ -68,12 +73,12 @@ com.azure:azure-data-schemaregistry-avro;1.0.0-beta.4;1.0.0-beta.5 com.azure:azure-data-tables;12.0.0-beta.3;12.0.0-beta.4 com.azure:azure-digitaltwins-core;1.0.1;1.1.0-beta.1 com.azure:azure-e2e;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-identity;1.2.0;1.3.0-beta.1 +com.azure:azure-identity;1.2.0;1.2.1 com.azure:azure-identity-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-eventgrid;2.0.0-beta.3;2.0.0-beta.4 com.azure:azure-messaging-eventhubs;5.3.1;5.4.0-beta.2 com.azure:azure-messaging-eventhubs-checkpointstore-blob;1.3.1;1.4.0-beta.2 -com.azure:azure-messaging-servicebus;7.0.0-beta.7;7.0.0-beta.8 +com.azure:azure-messaging-servicebus;7.0.0;7.1.0-beta.1 com.azure:azure-messaging-servicebus-track1-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-servicebus-track2-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-search-documents;11.1.2;11.2.0-beta.4 @@ -84,19 +89,19 @@ com.azure:azure-security-keyvault-jca;1.0.0-beta.2;1.0.0-beta.3 com.azure:azure-security-keyvault-keys;4.2.3;4.3.0-beta.4 com.azure:azure-security-keyvault-secrets;4.2.3;4.3.0-beta.3 com.azure:azure-sdk-template;1.2.1-beta.2;1.2.1-beta.16 -com.azure:azure-spring-data-cosmos;3.1.0;3.2.0-beta.1 +com.azure:azure-spring-data-cosmos;3.2.0;3.3.0-beta.1 com.azure:azure-spring-data-cosmos-test;3.0.0-beta.1;3.0.0-beta.1 -com.azure:azure-storage-blob;12.9.0;12.10.0-beta.1 -com.azure:azure-storage-blob-batch;12.7.0;12.8.0-beta.1 +com.azure:azure-storage-blob;12.9.0;12.10.0-beta.2 +com.azure:azure-storage-blob-batch;12.7.0;12.8.0-beta.2 com.azure:azure-storage-blob-changefeed;12.0.0-beta.4;12.0.0-beta.5 -com.azure:azure-storage-blob-cryptography;12.9.0;12.10.0-beta.1 +com.azure:azure-storage-blob-cryptography;12.9.0;12.10.0-beta.2 com.azure:azure-storage-blob-nio;12.0.0-beta.2;12.0.0-beta.3 -com.azure:azure-storage-common;12.9.0;12.10.0-beta.1 -com.azure:azure-storage-file-share;12.7.0;12.8.0-beta.1 -com.azure:azure-storage-file-datalake;12.3.0;12.4.0-beta.1 -com.azure:azure-storage-internal-avro;12.0.1;12.1.0-beta.1 +com.azure:azure-storage-common;12.9.0;12.10.0-beta.2 +com.azure:azure-storage-file-share;12.7.0;12.8.0-beta.2 +com.azure:azure-storage-file-datalake;12.3.0;12.4.0-beta.2 +com.azure:azure-storage-internal-avro;12.0.1;12.0.2-beta.2 com.azure:azure-storage-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-storage-queue;12.7.0;12.8.0-beta.1 +com.azure:azure-storage-queue;12.7.0;12.8.0-beta.2 com.azure:perf-test-core;1.0.0-beta.1;1.0.0-beta.1 com.azure.spring:azure-spring-boot-starter-active-directory-b2c;3.0.0-beta.1;3.0.0-beta.2 com.azure.spring:azure-spring-boot-starter-active-directory;3.0.0-beta.1;3.0.0-beta.2 @@ -168,6 +173,7 @@ com.azure.resourcemanager:azure-resourcemanager-sql;2.1.0;2.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-storage;2.1.0;2.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-trafficmanager;2.1.0;2.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-test;2.0.0-beta.1;2.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-healthbot;1.0.0-beta.1;1.0.0-beta.1 com.microsoft:microsoft-opentelemetry-exporter-azuremonitor;1.0.0-beta.1;1.0.0-beta.2 @@ -176,9 +182,7 @@ com.microsoft:microsoft-opentelemetry-exporter-azuremonitor;1.0.0-beta.1;1.0.0-b # Format; # unreleased_:;dependency-version # note: The unreleased dependencies will not be manipulated with the automatic PR creation code. -unreleased_com.azure:azure-core;1.11.0 -unreleased_com.azure:azure-core-amqp;1.7.0-beta.3 -unreleased_com.azure:azure-messaging-servicebus;7.0.0-beta.7 +unreleased_com.azure:azure-messaging-servicebus;7.0.0 # Released Beta dependencies: Copy the entry from above, prepend "beta_", remove the current # version and set the version to the released beta. Released beta dependencies are only valid @@ -188,4 +192,3 @@ unreleased_com.azure:azure-messaging-servicebus;7.0.0-beta.7 # beta_:;dependency-version # note: Released beta versions will not be manipulated with the automatic PR creation code. beta_com.azure:azure-security-keyvault-keys;4.3.0-beta.1 -beta_com.azure:azure-core-amqp;1.7.0-beta.2 diff --git a/eng/versioning/version_data.txt b/eng/versioning/version_data.txt index 61c6a98825dfd..da53965c2792b 100644 --- a/eng/versioning/version_data.txt +++ b/eng/versioning/version_data.txt @@ -34,7 +34,7 @@ com.microsoft.azure:azure-keyvault-cryptography;1.2.4;1.3.0-beta.1 com.microsoft.azure:azure-keyvault-extensions;1.2.4;1.3.0-beta.1 com.microsoft.azure:azure-keyvault-test;1.2.3;1.2.4 com.microsoft.azure:azure-keyvault-webkey;1.2.4;1.3.0-beta.1 -com.microsoft.azure:azure-servicebus;3.5.0;3.5.1 +com.microsoft.azure:azure-servicebus;3.5.1;3.6.0-beta.1 com.microsoft.azure:azure-storage-blob;11.0.2;11.0.2 com.microsoft.azure.msi_auth_token_provider:azure-authentication-msi-token-provider;1.1.0-beta.1;1.1.0-beta.1 com.microsoft.azure:azure-eventgrid;1.4.0-beta.1;1.4.0-beta.1 diff --git a/pom.xml b/pom.xml index d97614e5dba32..e439f0fce4306 100644 --- a/pom.xml +++ b/pom.xml @@ -9,35 +9,37 @@ 1.0.0 common/perf-test-core - eng/jacoco-test-coverage eng/code-quality-reports + eng/jacoco-test-coverage sdk/anomalydetector sdk/appconfiguration sdk/authorization sdk/batch sdk/boms - sdk/core - sdk/cosmos sdk/cognitiveservices sdk/communication + sdk/core + sdk/cosmos sdk/digitaltwins sdk/eventgrid sdk/eventhubs sdk/formrecognizer + sdk/healthbot sdk/identity sdk/keyvault sdk/loganalytics sdk/mediaservices - sdk/monitor sdk/metricsadvisor + sdk/monitor sdk/resourcemanager sdk/schemaregistry sdk/search sdk/servicebus + sdk/spring sdk/storage + sdk/synapse sdk/tables sdk/template sdk/textanalytics - sdk/spring diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/CHANGELOG.md b/sdk/healthbot/azure-resourcemanager-healthbot/CHANGELOG.md new file mode 100644 index 0000000000000..a9778c9b70bba --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2020-12-15) + +- 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). \ No newline at end of file diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/README.md b/sdk/healthbot/azure-resourcemanager-healthbot/README.md new file mode 100644 index 0000000000000..149194568e2e2 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/README.md @@ -0,0 +1,84 @@ +# Azure Resource Manager Healthbot client library for Java + +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). + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +```xml + + com.azure.resourcemanager + azure-resourcemanager-healthbot + 1.0.0-beta.1 + +``` + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-healthbot;current}) +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +HealthbotManager manager = HealthbotManager + .authenticate(credential, profile); +``` +[//]: # ({x-version-update-end}) + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +## Troubleshooting + +## Next steps + +## Contributing + +If you would like to become an active contributor to this project please follow the instructions provided in [Microsoft +Azure Projects Contribution Guidelines](http://azure.github.io/guidelines.html). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[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 +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/pom.xml b/sdk/healthbot/azure-resourcemanager-healthbot/pom.xml new file mode 100644 index 0000000000000..1011f2b848672 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/pom.xml @@ -0,0 +1,62 @@ + + 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.1 + 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 + + + + 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.0.0 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + 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 new file mode 100644 index 0000000000000..1d18f46232db6 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/HealthbotManager.java @@ -0,0 +1,216 @@ +// 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; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +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; +import com.azure.core.http.policy.HttpPolicyProviders; +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.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.healthbot.fluent.Healthbot; +import com.azure.resourcemanager.healthbot.implementation.BotsImpl; +import com.azure.resourcemanager.healthbot.implementation.HealthbotBuilder; +import com.azure.resourcemanager.healthbot.implementation.OperationsImpl; +import com.azure.resourcemanager.healthbot.models.Bots; +import com.azure.resourcemanager.healthbot.models.Operations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * Entry point to HealthbotManager. 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. + */ +public final class HealthbotManager { + private Bots bots; + + private Operations operations; + + private final Healthbot clientObject; + + private HealthbotManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new HealthbotBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Healthbot service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Healthbot service API instance. + */ + public static HealthbotManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create HealthbotManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new HealthbotManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Healthbot service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Healthbot service API instance. + */ + public HealthbotManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + 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 RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new HealthbotManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of Bots. */ + public Bots bots() { + if (this.bots == null) { + this.bots = new BotsImpl(clientObject.getBots(), this); + } + return bots; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * @return Wrapped service client Healthbot providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public Healthbot serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/fluent/BotsClient.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/fluent/BotsClient.java new file mode 100644 index 0000000000000..16775b1d1008e --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/fluent/BotsClient.java @@ -0,0 +1,262 @@ +// 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.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.healthbot.fluent.models.CheckNameAvailabilityResponseBodyInner; +import com.azure.resourcemanager.healthbot.fluent.models.HealthBotInner; +import com.azure.resourcemanager.healthbot.models.CheckNameAvailabilityRequestBody; +import com.azure.resourcemanager.healthbot.models.HealthBotUpdateParameters; + +/** An instance of this class provides access to all the operations defined in BotsClient. */ +public interface BotsClient { + /** + * Check whether a bot name is available. + * + * @param parameters The request body for a request to to check availability of a bot name. + * @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 body returned for a request to check availability of a bot name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameAvailabilityResponseBodyInner checkNameAvailability(CheckNameAvailabilityRequestBody parameters); + + /** + * Check whether a bot name is available. + * + * @param parameters The request body for a request to to check availability of a bot name. + * @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 body returned for a request to check availability of a bot name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequestBody parameters, Context context); + + /** + * Create a new Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param parameters HealthBot resource definition. + * @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 healthBot resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, HealthBotInner> beginCreate( + String resourceGroupName, String botName, HealthBotInner parameters); + + /** + * Create a new Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param parameters HealthBot resource definition. + * @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 healthBot resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, HealthBotInner> beginCreate( + String resourceGroupName, String botName, HealthBotInner parameters, Context context); + + /** + * Create a new Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param parameters HealthBot resource definition. + * @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 healthBot resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HealthBotInner create(String resourceGroupName, String botName, HealthBotInner parameters); + + /** + * Create a new Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param parameters HealthBot resource definition. + * @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 healthBot resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HealthBotInner create(String resourceGroupName, String botName, HealthBotInner parameters, Context context); + + /** + * Get a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @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 a Healthcare Bot. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HealthBotInner getByResourceGroup(String resourceGroupName, String botName); + + /** + * Get a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @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 a Healthcare Bot. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String botName, Context context); + + /** + * Patch a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param parameters Parameters for updating a HealthBot. + * @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 healthBot resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HealthBotInner update(String resourceGroupName, String botName, HealthBotUpdateParameters parameters); + + /** + * Patch a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param parameters Parameters for updating a HealthBot. + * @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 healthBot resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String botName, HealthBotUpdateParameters parameters, Context context); + + /** + * Delete a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String botName); + + /** + * Delete a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String botName, Context context); + + /** + * Delete a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String botName); + + /** + * Delete a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String botName, Context context); + + /** + * Returns all the resources of a particular type belonging to a resource group. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @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 healthcare bot operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Returns all the resources of a particular type belonging to a resource group. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @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 healthcare bot operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Returns all the resources of a particular type belonging to a subscription. + * + * @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 healthcare bot operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Returns all the resources of a particular type belonging to a subscription. + * + * @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 healthcare bot operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/fluent/Healthbot.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/fluent/Healthbot.java new file mode 100644 index 0000000000000..4538c14934fe6 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/fluent/Healthbot.java @@ -0,0 +1,60 @@ +// 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.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for Healthbot class. */ +public interface Healthbot { + /** + * Gets Azure Subscription ID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the BotsClient object to access its operations. + * + * @return the BotsClient object. + */ + BotsClient getBots(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); +} diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/fluent/OperationsClient.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/fluent/OperationsClient.java new file mode 100644 index 0000000000000..10d4170d5bc0a --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// 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.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.healthbot.fluent.models.OperationDetailInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all the available HealthBot operations. + * + * @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 available operations of the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the available HealthBot operations. + * + * @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 available operations of the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/fluent/models/CheckNameAvailabilityResponseBodyInner.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/fluent/models/CheckNameAvailabilityResponseBodyInner.java new file mode 100644 index 0000000000000..3711e6ecb8343 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/fluent/models/CheckNameAvailabilityResponseBodyInner.java @@ -0,0 +1,102 @@ +// 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.fluent.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; + +/** The response body returned for a request to check availability of a bot name. */ +@Fluent +public final class CheckNameAvailabilityResponseBodyInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilityResponseBodyInner.class); + + /* + * indicates if the bot name is valid and available. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /* + * Reason for the result + */ + @JsonProperty(value = "reason") + private String reason; + + /* + * additional message from server + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the nameAvailable property: indicates if the bot name is valid and available. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the nameAvailable property: indicates if the bot name is valid and available. + * + * @param nameAvailable the nameAvailable value to set. + * @return the CheckNameAvailabilityResponseBodyInner object itself. + */ + public CheckNameAvailabilityResponseBodyInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason property: Reason for the result. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: Reason for the result. + * + * @param reason the reason value to set. + * @return the CheckNameAvailabilityResponseBodyInner object itself. + */ + public CheckNameAvailabilityResponseBodyInner withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Get the message property: additional message from server. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: additional message from server. + * + * @param message the message value to set. + * @return the CheckNameAvailabilityResponseBodyInner object itself. + */ + public CheckNameAvailabilityResponseBodyInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * 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/fluent/models/HealthBotInner.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/fluent/models/HealthBotInner.java new file mode 100644 index 0000000000000..89b87711c7b7b --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/fluent/models/HealthBotInner.java @@ -0,0 +1,100 @@ +// 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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.healthbot.models.HealthBotProperties; +import com.azure.resourcemanager.healthbot.models.Sku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** HealthBot resource definition. */ +@Fluent +public final class HealthBotInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HealthBotInner.class); + + /* + * SKU of the HealthBot. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * The set of properties specific to healthcare bot resource. + */ + @JsonProperty(value = "properties") + private HealthBotProperties properties; + + /** + * Get the sku property: SKU of the HealthBot. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: SKU of the HealthBot. + * + * @param sku the sku value to set. + * @return the HealthBotInner object itself. + */ + public HealthBotInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the properties property: The set of properties specific to healthcare bot resource. + * + * @return the properties value. + */ + public HealthBotProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The set of properties specific to healthcare bot resource. + * + * @param properties the properties value to set. + * @return the HealthBotInner object itself. + */ + public HealthBotInner withProperties(HealthBotProperties properties) { + this.properties = properties; + return this; + } + + /** {@inheritDoc} */ + @Override + public HealthBotInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public HealthBotInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/fluent/models/OperationDetailInner.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/fluent/models/OperationDetailInner.java new file mode 100644 index 0000000000000..2faff9ff44546 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/fluent/models/OperationDetailInner.java @@ -0,0 +1,158 @@ +// 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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.healthbot.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Operation detail payload. */ +@Fluent +public final class OperationDetailInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDetailInner.class); + + /* + * Name of the operation + */ + @JsonProperty(value = "name") + private String name; + + /* + * Indicates whether the operation is a data action + */ + @JsonProperty(value = "isDataAction") + private Boolean isDataAction; + + /* + * Display of the operation + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * Origin of the operation + */ + @JsonProperty(value = "origin") + private String origin; + + /* + * Additional properties. + */ + @JsonProperty(value = "properties") + private Object properties; + + /** + * Get the name property: Name of the operation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the operation. + * + * @param name the name value to set. + * @return the OperationDetailInner object itself. + */ + public OperationDetailInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Set the isDataAction property: Indicates whether the operation is a data action. + * + * @param isDataAction the isDataAction value to set. + * @return the OperationDetailInner object itself. + */ + public OperationDetailInner withIsDataAction(Boolean isDataAction) { + this.isDataAction = isDataAction; + return this; + } + + /** + * Get the display property: Display of the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Display of the operation. + * + * @param display the display value to set. + * @return the OperationDetailInner object itself. + */ + public OperationDetailInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: Origin of the operation. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin property: Origin of the operation. + * + * @param origin the origin value to set. + * @return the OperationDetailInner object itself. + */ + public OperationDetailInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get the properties property: Additional properties. + * + * @return the properties value. + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties property: Additional properties. + * + * @param properties the properties value to set. + * @return the OperationDetailInner object itself. + */ + public OperationDetailInner withProperties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/fluent/models/package-info.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/fluent/models/package-info.java new file mode 100644 index 0000000000000..03a821eeb76b9 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/fluent/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for Healthbot. 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 com.azure.resourcemanager.healthbot.fluent.models; diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/fluent/package-info.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/fluent/package-info.java new file mode 100644 index 0000000000000..5f8d3ec23cf9a --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/fluent/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for Healthbot. 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 com.azure.resourcemanager.healthbot.fluent; 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 new file mode 100644 index 0000000000000..f39ad4092a8e2 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/BotsClientImpl.java @@ -0,0 +1,1578 @@ +// 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.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +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; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +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.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.healthbot.fluent.BotsClient; +import com.azure.resourcemanager.healthbot.fluent.models.CheckNameAvailabilityResponseBodyInner; +import com.azure.resourcemanager.healthbot.fluent.models.HealthBotInner; +import com.azure.resourcemanager.healthbot.models.BotResponseList; +import com.azure.resourcemanager.healthbot.models.CheckNameAvailabilityRequestBody; +import com.azure.resourcemanager.healthbot.models.HealthBotUpdateParameters; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in BotsClient. */ +public final class BotsClientImpl implements BotsClient { + private final ClientLogger logger = new ClientLogger(BotsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final BotsService service; + + /** The service client containing this operation class. */ + private final HealthbotImpl client; + + /** + * Initializes an instance of BotsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BotsClientImpl(HealthbotImpl client) { + this.service = RestProxy.create(BotsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for HealthbotBots to be used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "HealthbotBots") + private interface BotsService { + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.HealthBot/checkNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CheckNameAvailabilityRequestBody parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot" + + "/healthBots/{botName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("botName") String botName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") HealthBotInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot" + + "/healthBots/{botName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("botName") String botName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot" + + "/healthBots/{botName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("botName") String botName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") HealthBotUpdateParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot" + + "/healthBots/{botName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("botName") String botName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot" + + "/healthBots") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.HealthBot/healthBots") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Check whether a bot name is available. + * + * @param parameters The request body for a request to to check availability of a bot name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 body returned for a request to check availability of a bot name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + CheckNameAvailabilityRequestBody parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkNameAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Check whether a bot name is available. + * + * @param parameters The request body for a request to to check availability of a bot name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 body returned for a request to check availability of a bot name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + CheckNameAvailabilityRequestBody parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkNameAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Check whether a bot name is available. + * + * @param parameters The request body for a request to to check availability of a bot name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 body returned for a request to check availability of a bot name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync( + CheckNameAvailabilityRequestBody parameters) { + return checkNameAvailabilityWithResponseAsync(parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Check whether a bot name is available. + * + * @param parameters The request body for a request to to check availability of a bot name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 body returned for a request to check availability of a bot name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckNameAvailabilityResponseBodyInner checkNameAvailability(CheckNameAvailabilityRequestBody parameters) { + return checkNameAvailabilityAsync(parameters).block(); + } + + /** + * Check whether a bot name is available. + * + * @param parameters The request body for a request to to check availability of a bot name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 body returned for a request to check availability of a bot name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequestBody parameters, Context context) { + return checkNameAvailabilityWithResponseAsync(parameters, context).block(); + } + + /** + * Create a new Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param parameters HealthBot resource definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return healthBot resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String botName, HealthBotInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (botName == null) { + return Mono.error(new IllegalArgumentException("Parameter botName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + botName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create a new Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param parameters HealthBot resource definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return healthBot resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String botName, HealthBotInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (botName == null) { + return Mono.error(new IllegalArgumentException("Parameter botName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + botName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Create a new Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param parameters HealthBot resource definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return healthBot resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, HealthBotInner> beginCreateAsync( + String resourceGroupName, String botName, HealthBotInner parameters) { + Mono>> mono = createWithResponseAsync(resourceGroupName, botName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), HealthBotInner.class, HealthBotInner.class, Context.NONE); + } + + /** + * Create a new Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param parameters HealthBot resource definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return healthBot resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, HealthBotInner> beginCreateAsync( + String resourceGroupName, String botName, HealthBotInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, botName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), HealthBotInner.class, HealthBotInner.class, context); + } + + /** + * Create a new Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param parameters HealthBot resource definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return healthBot resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, HealthBotInner> beginCreate( + String resourceGroupName, String botName, HealthBotInner parameters) { + return beginCreateAsync(resourceGroupName, botName, parameters).getSyncPoller(); + } + + /** + * Create a new Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param parameters HealthBot resource definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return healthBot resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, HealthBotInner> beginCreate( + String resourceGroupName, String botName, HealthBotInner parameters, Context context) { + return beginCreateAsync(resourceGroupName, botName, parameters, context).getSyncPoller(); + } + + /** + * Create a new Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param parameters HealthBot resource definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return healthBot resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String botName, HealthBotInner parameters) { + return beginCreateAsync(resourceGroupName, botName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a new Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param parameters HealthBot resource definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return healthBot resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String botName, HealthBotInner parameters, Context context) { + return beginCreateAsync(resourceGroupName, botName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a new Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param parameters HealthBot resource definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return healthBot resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HealthBotInner create(String resourceGroupName, String botName, HealthBotInner parameters) { + return createAsync(resourceGroupName, botName, parameters).block(); + } + + /** + * Create a new Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param parameters HealthBot resource definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return healthBot resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HealthBotInner create(String resourceGroupName, String botName, HealthBotInner parameters, Context context) { + return createAsync(resourceGroupName, botName, parameters, context).block(); + } + + /** + * Get a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Healthcare Bot. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String botName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (botName == null) { + return Mono.error(new IllegalArgumentException("Parameter botName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + botName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Healthcare Bot. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String botName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (botName == null) { + return Mono.error(new IllegalArgumentException("Parameter botName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + botName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Healthcare Bot. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String botName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, botName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Healthcare Bot. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HealthBotInner getByResourceGroup(String resourceGroupName, String botName) { + return getByResourceGroupAsync(resourceGroupName, botName).block(); + } + + /** + * Get a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Healthcare Bot. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String botName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, botName, context).block(); + } + + /** + * Patch a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param parameters Parameters for updating a HealthBot. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return healthBot resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String botName, HealthBotUpdateParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (botName == null) { + return Mono.error(new IllegalArgumentException("Parameter botName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + botName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Patch a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param parameters Parameters for updating a HealthBot. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return healthBot resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String botName, HealthBotUpdateParameters parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (botName == null) { + return Mono.error(new IllegalArgumentException("Parameter botName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + botName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Patch a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param parameters Parameters for updating a HealthBot. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return healthBot resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String botName, HealthBotUpdateParameters parameters) { + return updateWithResponseAsync(resourceGroupName, botName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Patch a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param parameters Parameters for updating a HealthBot. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return healthBot resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HealthBotInner update(String resourceGroupName, String botName, HealthBotUpdateParameters parameters) { + return updateAsync(resourceGroupName, botName, parameters).block(); + } + + /** + * Patch a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param parameters Parameters for updating a HealthBot. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return healthBot resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String botName, HealthBotUpdateParameters parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, botName, parameters, context).block(); + } + + /** + * Delete a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String botName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (botName == null) { + return Mono.error(new IllegalArgumentException("Parameter botName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + botName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String botName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (botName == null) { + return Mono.error(new IllegalArgumentException("Parameter botName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + botName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String botName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, botName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Delete a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String botName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, botName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String botName) { + return beginDeleteAsync(resourceGroupName, botName).getSyncPoller(); + } + + /** + * Delete a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String botName, Context context) { + return beginDeleteAsync(resourceGroupName, botName, context).getSyncPoller(); + } + + /** + * Delete a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String botName) { + return beginDeleteAsync(resourceGroupName, botName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String botName, Context context) { + return beginDeleteAsync(resourceGroupName, botName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String botName) { + deleteAsync(resourceGroupName, botName).block(); + } + + /** + * Delete a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String botName, Context context) { + deleteAsync(resourceGroupName, botName, context).block(); + } + + /** + * Returns all the resources of a particular type belonging to a resource group. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 healthcare bot operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Returns all the resources of a particular type belonging to a resource group. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 healthcare bot operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns all the resources of a particular type belonging to a resource group. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 healthcare bot operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Returns all the resources of a particular type belonging to a resource group. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 healthcare bot operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns all the resources of a particular type belonging to a resource group. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 healthcare bot operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Returns all the resources of a particular type belonging to a resource group. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 healthcare bot operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Returns all the resources of a particular type belonging to a subscription. + * + * @throws 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 healthcare bot operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Returns all the resources of a particular type belonging to a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 healthcare bot operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns all the resources of a particular type belonging to a subscription. + * + * @throws 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 healthcare bot operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns all the resources of a particular type belonging to a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 healthcare bot operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns all the resources of a particular type belonging to a subscription. + * + * @throws 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 healthcare bot operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Returns all the resources of a particular type belonging to a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 healthcare bot operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 healthcare bot operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 healthcare bot operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 healthcare bot operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 healthcare bot operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} 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 new file mode 100644 index 0000000000000..b47e6321ed9ce --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/BotsImpl.java @@ -0,0 +1,197 @@ +// 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.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +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.CheckNameAvailabilityResponseBodyInner; +import com.azure.resourcemanager.healthbot.fluent.models.HealthBotInner; +import com.azure.resourcemanager.healthbot.models.Bots; +import com.azure.resourcemanager.healthbot.models.CheckNameAvailabilityRequestBody; +import com.azure.resourcemanager.healthbot.models.CheckNameAvailabilityResponseBody; +import com.azure.resourcemanager.healthbot.models.HealthBot; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class BotsImpl implements Bots { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BotsImpl.class); + + private final BotsClient innerClient; + + private final HealthbotManager serviceManager; + + public BotsImpl(BotsClient innerClient, HealthbotManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public CheckNameAvailabilityResponseBody checkNameAvailability(CheckNameAvailabilityRequestBody parameters) { + CheckNameAvailabilityResponseBodyInner inner = this.serviceClient().checkNameAvailability(parameters); + if (inner != null) { + return new CheckNameAvailabilityResponseBodyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequestBody parameters, Context context) { + Response inner = + this.serviceClient().checkNameAvailabilityWithResponse(parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CheckNameAvailabilityResponseBodyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public HealthBot getByResourceGroup(String resourceGroupName, String botName) { + HealthBotInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, botName); + if (inner != null) { + return new HealthBotImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String botName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, botName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new HealthBotImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String botName) { + this.serviceClient().delete(resourceGroupName, botName); + } + + public void delete(String resourceGroupName, String botName, Context context) { + this.serviceClient().delete(resourceGroupName, botName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return inner.mapPage(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())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(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())); + } + + public HealthBot getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String botName = Utils.getValueFromIdByName(id, "healthBots"); + if (botName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'healthBots'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, botName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String botName = Utils.getValueFromIdByName(id, "healthBots"); + if (botName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'healthBots'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, botName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String botName = Utils.getValueFromIdByName(id, "healthBots"); + if (botName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'healthBots'.", id))); + } + this.delete(resourceGroupName, botName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String botName = Utils.getValueFromIdByName(id, "healthBots"); + if (botName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'healthBots'.", id))); + } + this.delete(resourceGroupName, botName, context); + } + + private BotsClient serviceClient() { + return this.innerClient; + } + + private HealthbotManager manager() { + return this.serviceManager; + } + + public HealthBotImpl define(String name) { + return new HealthBotImpl(name, this.manager()); + } +} diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/CheckNameAvailabilityResponseBodyImpl.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/CheckNameAvailabilityResponseBodyImpl.java new file mode 100644 index 0000000000000..ea796349325a7 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/CheckNameAvailabilityResponseBodyImpl.java @@ -0,0 +1,41 @@ +// 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.implementation; + +import com.azure.resourcemanager.healthbot.HealthbotManager; +import com.azure.resourcemanager.healthbot.fluent.models.CheckNameAvailabilityResponseBodyInner; +import com.azure.resourcemanager.healthbot.models.CheckNameAvailabilityResponseBody; + +public final class CheckNameAvailabilityResponseBodyImpl implements CheckNameAvailabilityResponseBody { + private CheckNameAvailabilityResponseBodyInner innerObject; + + private final HealthbotManager serviceManager; + + public CheckNameAvailabilityResponseBodyImpl( + CheckNameAvailabilityResponseBodyInner innerObject, HealthbotManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public String reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckNameAvailabilityResponseBodyInner innerModel() { + return this.innerObject; + } + + private 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 new file mode 100644 index 0000000000000..34d1f7f78d9f4 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/HealthBotImpl.java @@ -0,0 +1,194 @@ +// 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.implementation; + +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; +import com.azure.resourcemanager.healthbot.models.HealthBotUpdateParameters; +import com.azure.resourcemanager.healthbot.models.Sku; +import java.util.Collections; +import java.util.Map; + +public final class HealthBotImpl implements HealthBot, HealthBot.Definition, HealthBot.Update { + private HealthBotInner innerObject; + + private final HealthbotManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public HealthBotProperties properties() { + return this.innerModel().properties(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public HealthBotInner innerModel() { + return this.innerObject; + } + + private HealthbotManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String botName; + + private HealthBotUpdateParameters updateParameters; + + public HealthBotImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public HealthBot create() { + this.innerObject = + serviceManager + .serviceClient() + .getBots() + .create(resourceGroupName, botName, this.innerModel(), Context.NONE); + return this; + } + + public HealthBot create(Context context) { + this.innerObject = + serviceManager.serviceClient().getBots().create(resourceGroupName, botName, this.innerModel(), context); + return this; + } + + public HealthBotImpl(String name, HealthbotManager serviceManager) { + this.innerObject = new HealthBotInner(); + this.serviceManager = serviceManager; + this.botName = name; + } + + public HealthBotImpl update() { + this.updateParameters = new HealthBotUpdateParameters(); + return this; + } + + public HealthBot apply() { + this.innerObject = + serviceManager + .serviceClient() + .getBots() + .updateWithResponse(resourceGroupName, botName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public HealthBot apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBots() + .updateWithResponse(resourceGroupName, botName, updateParameters, context) + .getValue(); + return this; + } + + public HealthBotImpl(HealthBotInner innerObject, HealthbotManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.botName = Utils.getValueFromIdByName(innerObject.id(), "healthBots"); + } + + public HealthBot refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getBots() + .getByResourceGroupWithResponse(resourceGroupName, botName, Context.NONE) + .getValue(); + return this; + } + + public HealthBot refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBots() + .getByResourceGroupWithResponse(resourceGroupName, botName, context) + .getValue(); + return this; + } + + public HealthBotImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public HealthBotImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public HealthBotImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public HealthBotImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.innerModel().withSku(sku); + return this; + } else { + this.updateParameters.withSku(sku); + return this; + } + } + + public HealthBotImpl withProperties(HealthBotProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/HealthbotBuilder.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/HealthbotBuilder.java new file mode 100644 index 0000000000000..1f45bcabe8657 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/HealthbotBuilder.java @@ -0,0 +1,145 @@ +// 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.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the HealthbotImpl type. */ +@ServiceClientBuilder(serviceClients = {HealthbotImpl.class}) +public final class HealthbotBuilder { + /* + * Azure Subscription ID. + */ + private String subscriptionId; + + /** + * Sets Azure Subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the HealthbotBuilder. + */ + public HealthbotBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the HealthbotBuilder. + */ + public HealthbotBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the HealthbotBuilder. + */ + public HealthbotBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the HealthbotBuilder. + */ + public HealthbotBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the HealthbotBuilder. + */ + public HealthbotBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the HealthbotBuilder. + */ + public HealthbotBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of HealthbotImpl with the provided parameters. + * + * @return an instance of HealthbotImpl. + */ + public HealthbotImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + HealthbotImpl client = + new HealthbotImpl(pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} 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 new file mode 100644 index 0000000000000..c1872140b322a --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/HealthbotImpl.java @@ -0,0 +1,307 @@ +// 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.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.healthbot.fluent.BotsClient; +import com.azure.resourcemanager.healthbot.fluent.Healthbot; +import com.azure.resourcemanager.healthbot.fluent.OperationsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the HealthbotImpl type. */ +@ServiceClient(builder = HealthbotBuilder.class) +public final class HealthbotImpl implements Healthbot { + private final ClientLogger logger = new ClientLogger(HealthbotImpl.class); + + /** Azure Subscription ID. */ + private final String subscriptionId; + + /** + * Gets Azure Subscription ID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The BotsClient object to access its operations. */ + private final BotsClient bots; + + /** + * Gets the BotsClient object to access its operations. + * + * @return the BotsClient object. + */ + public BotsClient getBots() { + return this.bots; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * Initializes an instance of Healthbot client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId Azure Subscription ID. + * @param endpoint server parameter. + */ + HealthbotImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2020-12-08"; + this.bots = new BotsClientImpl(this); + this.operations = new OperationsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} 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 new file mode 100644 index 0000000000000..dc890fadeccde --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/OperationDetailImpl.java @@ -0,0 +1,49 @@ +// 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.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; + +public final class OperationDetailImpl implements OperationDetail { + private OperationDetailInner innerObject; + + private final HealthbotManager serviceManager; + + public OperationDetailImpl(OperationDetailInner innerObject, HealthbotManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public String origin() { + return this.innerModel().origin(); + } + + public Object properties() { + return this.innerModel().properties(); + } + + public OperationDetailInner innerModel() { + return this.innerObject; + } + + private 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 new file mode 100644 index 0000000000000..c3e5889c994f6 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/OperationsClientImpl.java @@ -0,0 +1,269 @@ +// 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.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +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.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.healthbot.fluent.OperationsClient; +import com.azure.resourcemanager.healthbot.fluent.models.OperationDetailInner; +import com.azure.resourcemanager.healthbot.models.AvailableOperations; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final HealthbotImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(HealthbotImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for HealthbotOperations to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "HealthbotOperations") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.HealthBot/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all the available HealthBot operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available operations of the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists all the available HealthBot operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available operations of the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the available HealthBot operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available operations of the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the available HealthBot operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available operations of the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the available HealthBot operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available operations of the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all the available HealthBot operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available operations of the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available operations of the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available operations of the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} 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 new file mode 100644 index 0000000000000..05bd0f14e232a --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/OperationsImpl.java @@ -0,0 +1,46 @@ +// 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.implementation; + +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; +import com.azure.resourcemanager.healthbot.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final HealthbotManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, 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())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new OperationDetailImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private 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 new file mode 100644 index 0000000000000..a2429c95279f9 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/Utils.java @@ -0,0 +1,31 @@ +// 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.implementation; + +import java.util.Arrays; +import java.util.Iterator; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } +} diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/package-info.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/package-info.java new file mode 100644 index 0000000000000..74529eb64a67b --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for Healthbot. 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 com.azure.resourcemanager.healthbot.implementation; diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/AvailableOperations.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/AvailableOperations.java new file mode 100644 index 0000000000000..e5bc06c093fdb --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/AvailableOperations.java @@ -0,0 +1,84 @@ +// 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.azure.resourcemanager.healthbot.fluent.models.OperationDetailInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Available operations of the service. */ +@Fluent +public final class AvailableOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AvailableOperations.class); + + /* + * Collection of available operation details + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL client should use to fetch the next page (per server side paging). + * It's null for now, added for future use. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Collection of available operation details. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Collection of available operation details. + * + * @param value the value value to set. + * @return the AvailableOperations object itself. + */ + public AvailableOperations withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL client should use to fetch the next page (per server side paging). It's null for + * now, added for future use. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URL client should use to fetch the next page (per server side paging). It's null for + * now, added for future use. + * + * @param nextLink the nextLink value to set. + * @return the AvailableOperations object itself. + */ + public AvailableOperations withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/BotResponseList.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/BotResponseList.java new file mode 100644 index 0000000000000..ebcbae0c07a45 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/BotResponseList.java @@ -0,0 +1,59 @@ +// 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.azure.resourcemanager.healthbot.fluent.models.HealthBotInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of healthcare bot operation response. */ +@Immutable +public final class BotResponseList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BotResponseList.class); + + /* + * The link used to get the next page of bot service resources. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /* + * Gets the list of healthcare bot results and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the nextLink property: The link used to get the next page of bot service resources. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the value property: Gets the list of healthcare bot results and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/Bots.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/Bots.java new file mode 100644 index 0000000000000..0c34baede64fb --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/Bots.java @@ -0,0 +1,179 @@ +// 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.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Bots. */ +public interface Bots { + /** + * Check whether a bot name is available. + * + * @param parameters The request body for a request to to check availability of a bot name. + * @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 body returned for a request to check availability of a bot name. + */ + CheckNameAvailabilityResponseBody checkNameAvailability(CheckNameAvailabilityRequestBody parameters); + + /** + * Check whether a bot name is available. + * + * @param parameters The request body for a request to to check availability of a bot name. + * @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 body returned for a request to check availability of a bot name. + */ + Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequestBody parameters, Context context); + + /** + * Get a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @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 a Healthcare Bot. + */ + HealthBot getByResourceGroup(String resourceGroupName, String botName); + + /** + * Get a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @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 a Healthcare Bot. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String botName, Context context); + + /** + * Delete a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @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 delete(String resourceGroupName, String botName); + + /** + * Delete a Healthcare Bot. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @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 delete(String resourceGroupName, String botName, Context context); + + /** + * Returns all the resources of a particular type belonging to a resource group. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @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 healthcare bot operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Returns all the resources of a particular type belonging to a resource group. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @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 healthcare bot operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Returns all the resources of a particular type belonging to a subscription. + * + * @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 healthcare bot operation response. + */ + PagedIterable list(); + + /** + * Returns all the resources of a particular type belonging to a subscription. + * + * @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 healthcare bot operation response. + */ + PagedIterable list(Context context); + + /** + * Get a Healthcare Bot. + * + * @param id the resource ID. + * @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 a Healthcare Bot. + */ + HealthBot getById(String id); + + /** + * Get a Healthcare Bot. + * + * @param id the resource ID. + * @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 a Healthcare Bot. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Healthcare Bot. + * + * @param id the resource ID. + * @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 deleteById(String id); + + /** + * Delete a Healthcare Bot. + * + * @param id the resource ID. + * @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 deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new HealthBot resource. + * + * @param name resource name. + * @return the first stage of the new HealthBot definition. + */ + HealthBot.DefinitionStages.Blank define(String name); +} diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/CheckNameAvailabilityRequestBody.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/CheckNameAvailabilityRequestBody.java new file mode 100644 index 0000000000000..f650eec47de73 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/CheckNameAvailabilityRequestBody.java @@ -0,0 +1,88 @@ +// 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; + +/** The request body for a request to to check availability of a bot name. */ +@Fluent +public final class CheckNameAvailabilityRequestBody { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilityRequestBody.class); + + /* + * the name of the bot for which availability needs to be checked. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * the type of the bot for which availability needs to be checked + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Get the name property: the name of the bot for which availability needs to be checked. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: the name of the bot for which availability needs to be checked. + * + * @param name the name value to set. + * @return the CheckNameAvailabilityRequestBody object itself. + */ + public CheckNameAvailabilityRequestBody withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: the type of the bot for which availability needs to be checked. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: the type of the bot for which availability needs to be checked. + * + * @param type the type value to set. + * @return the CheckNameAvailabilityRequestBody object itself. + */ + public CheckNameAvailabilityRequestBody withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property name in model CheckNameAvailabilityRequestBody")); + } + if (type() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property type in model CheckNameAvailabilityRequestBody")); + } + } +} diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/CheckNameAvailabilityResponseBody.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/CheckNameAvailabilityResponseBody.java new file mode 100644 index 0000000000000..0a21a5c1b86b1 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/CheckNameAvailabilityResponseBody.java @@ -0,0 +1,38 @@ +// 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.resourcemanager.healthbot.fluent.models.CheckNameAvailabilityResponseBodyInner; + +/** An immutable client-side representation of CheckNameAvailabilityResponseBody. */ +public interface CheckNameAvailabilityResponseBody { + /** + * Gets the nameAvailable property: indicates if the bot name is valid and available. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: Reason for the result. + * + * @return the reason value. + */ + String reason(); + + /** + * Gets the message property: additional message from server. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.healthbot.fluent.models.CheckNameAvailabilityResponseBodyInner object. + * + * @return the inner object. + */ + CheckNameAvailabilityResponseBodyInner innerModel(); +} 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 new file mode 100644 index 0000000000000..025b7ca8a6816 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/ErrorAdditionalInfo.java @@ -0,0 +1,54 @@ +// 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/HealthBot.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/HealthBot.java new file mode 100644 index 0000000000000..bd64442ebdd53 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/HealthBot.java @@ -0,0 +1,237 @@ +// 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.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.healthbot.fluent.models.HealthBotInner; +import java.util.Map; + +/** An immutable client-side representation of HealthBot. */ +public interface HealthBot { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the sku property: SKU of the HealthBot. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the properties property: The set of properties specific to healthcare bot resource. + * + * @return the properties value. + */ + HealthBotProperties properties(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.healthbot.fluent.models.HealthBotInner object. + * + * @return the inner object. + */ + HealthBotInner innerModel(); + + /** The entirety of the HealthBot definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The HealthBot definition stages. */ + interface DefinitionStages { + /** The first stage of the HealthBot definition. */ + interface Blank extends WithLocation { + } + /** The stage of the HealthBot definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the HealthBot definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the HealthBot definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithSku, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + HealthBot create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + HealthBot create(Context context); + } + /** The stage of the HealthBot definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the HealthBot definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: SKU of the HealthBot.. + * + * @param sku SKU of the HealthBot. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the HealthBot definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The set of properties specific to healthcare bot resource.. + * + * @param properties The set of properties specific to healthcare bot resource. + * @return the next definition stage. + */ + WithCreate withProperties(HealthBotProperties properties); + } + } + /** + * Begins update for the HealthBot resource. + * + * @return the stage of resource update. + */ + HealthBot.Update update(); + + /** The template for HealthBot update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithSku { + /** + * Executes the update request. + * + * @return the updated resource. + */ + HealthBot apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + HealthBot apply(Context context); + } + /** The HealthBot update stages. */ + interface UpdateStages { + /** The stage of the HealthBot update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Tags for a HealthBot.. + * + * @param tags Tags for a HealthBot. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the HealthBot update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: SKU of the HealthBot.. + * + * @param sku SKU of the HealthBot. + * @return the next definition stage. + */ + Update withSku(Sku sku); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + HealthBot refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + HealthBot refresh(Context context); +} diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/HealthBotProperties.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/HealthBotProperties.java new file mode 100644 index 0000000000000..24e06a921f030 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/HealthBotProperties.java @@ -0,0 +1,58 @@ +// 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 properties of a HealthBot. The Health Bot Service 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. + */ +@Immutable +public final class HealthBotProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HealthBotProperties.class); + + /* + * The provisioning state of the Healthcare bot resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The link. + */ + @JsonProperty(value = "botManagementPortalLink", access = JsonProperty.Access.WRITE_ONLY) + private String botManagementPortalLink; + + /** + * Get the provisioningState property: The provisioning state of the Healthcare bot resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the botManagementPortalLink property: The link. + * + * @return the botManagementPortalLink value. + */ + public String botManagementPortalLink() { + return this.botManagementPortalLink; + } + + /** + * 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/HealthBotUpdateParameters.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/HealthBotUpdateParameters.java new file mode 100644 index 0000000000000..098c1c409ef3b --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/HealthBotUpdateParameters.java @@ -0,0 +1,80 @@ +// 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.util.Map; + +/** Parameters for updating a HealthBot. */ +@Fluent +public final class HealthBotUpdateParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HealthBotUpdateParameters.class); + + /* + * Tags for a HealthBot. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * SKU of the HealthBot. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Get the tags property: Tags for a HealthBot. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Tags for a HealthBot. + * + * @param tags the tags value to set. + * @return the HealthBotUpdateParameters object itself. + */ + public HealthBotUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the sku property: SKU of the HealthBot. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: SKU of the HealthBot. + * + * @param sku the sku value to set. + * @return the HealthBotUpdateParameters object itself. + */ + public HealthBotUpdateParameters withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().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 new file mode 100644 index 0000000000000..4765e0b24f9e3 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/IdentityType.java @@ -0,0 +1,40 @@ +// 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/OperationDetail.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/OperationDetail.java new file mode 100644 index 0000000000000..a989456fa9541 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/OperationDetail.java @@ -0,0 +1,52 @@ +// 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.resourcemanager.healthbot.fluent.models.OperationDetailInner; + +/** An immutable client-side representation of OperationDetail. */ +public interface OperationDetail { + /** + * Gets the name property: Name of the operation. + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Display of the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: Origin of the operation. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the properties property: Additional properties. + * + * @return the properties value. + */ + Object properties(); + + /** + * Gets the inner com.azure.resourcemanager.healthbot.fluent.models.OperationDetailInner object. + * + * @return the inner object. + */ + OperationDetailInner innerModel(); +} diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/OperationDisplay.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/OperationDisplay.java new file mode 100644 index 0000000000000..02bac1e3a6fb3 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/OperationDisplay.java @@ -0,0 +1,128 @@ +// 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; + +/** Operation display payload. */ +@Fluent +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * Resource provider of the operation + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Resource of the operation + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Localized friendly name for the operation + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Localized friendly description for the operation + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Resource provider of the operation. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Resource provider of the operation. + * + * @param provider the provider value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Resource of the operation. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource of the operation. + * + * @param resource the resource value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Localized friendly name for the operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Localized friendly name for the operation. + * + * @param operation the operation value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Localized friendly description for the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Localized friendly description for the operation. + * + * @param description the description value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + + /** + * 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/Operations.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/Operations.java new file mode 100644 index 0000000000000..93f85f208db4f --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/Operations.java @@ -0,0 +1,31 @@ +// 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.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all the available HealthBot operations. + * + * @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 available operations of the service. + */ + PagedIterable list(); + + /** + * Lists all the available HealthBot operations. + * + * @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 available operations of the service. + */ + PagedIterable list(Context context); +} diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/Sku.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/Sku.java new file mode 100644 index 0000000000000..2946eecc28664 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/Sku.java @@ -0,0 +1,171 @@ +// 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; + +/** The resource model definition representing SKU. */ +@Fluent +public final class Sku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Sku.class); + + /* + * The name of the HealthBot SKU + */ + @JsonProperty(value = "name", required = true) + private SkuName name; + + /* + * This field is required to be implemented by the Resource Provider if the + * service has more than one tier, but is not required on a PUT. + */ + @JsonProperty(value = "tier") + private SkuTier tier; + + /* + * The SKU size. When the name field is the combination of tier and some + * other value, this would be the standalone code. + */ + @JsonProperty(value = "size") + private String size; + + /* + * If the service has different generations of hardware, for the same SKU, + * then that can be captured here. + */ + @JsonProperty(value = "family") + private String family; + + /* + * If the SKU supports scale out/in then the capacity integer should be + * included. If scale out/in is not possible for the resource this may be + * omitted. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get the name property: The name of the HealthBot SKU. + * + * @return the name value. + */ + public SkuName name() { + return this.name; + } + + /** + * Set the name property: The name of the HealthBot SKU. + * + * @param name the name value to set. + * @return the Sku object itself. + */ + public Sku withName(SkuName name) { + this.name = name; + return this; + } + + /** + * Get the tier property: This field is required to be implemented by the Resource Provider if the service has more + * than one tier, but is not required on a PUT. + * + * @return the tier value. + */ + public SkuTier tier() { + return this.tier; + } + + /** + * Set the tier property: This field is required to be implemented by the Resource Provider if the service has more + * than one tier, but is not required on a PUT. + * + * @param tier the tier value to set. + * @return the Sku object itself. + */ + public Sku withTier(SkuTier tier) { + this.tier = tier; + return this; + } + + /** + * Get the size property: The SKU size. When the name field is the combination of tier and some other value, this + * would be the standalone code. + * + * @return the size value. + */ + public String size() { + return this.size; + } + + /** + * Set the size property: The SKU size. When the name field is the combination of tier and some other value, this + * would be the standalone code. + * + * @param size the size value to set. + * @return the Sku object itself. + */ + public Sku withSize(String size) { + this.size = size; + return this; + } + + /** + * Get the family property: If the service has different generations of hardware, for the same SKU, then that can be + * captured here. + * + * @return the family value. + */ + public String family() { + return this.family; + } + + /** + * Set the family property: If the service has different generations of hardware, for the same SKU, then that can be + * captured here. + * + * @param family the family value to set. + * @return the Sku object itself. + */ + public Sku withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get the capacity property: If the SKU supports scale out/in then the capacity integer should be included. If + * scale out/in is not possible for the resource this may be omitted. + * + * @return the capacity value. + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the capacity property: If the SKU supports scale out/in then the capacity integer should be included. If + * scale out/in is not possible for the resource this may be omitted. + * + * @param capacity the capacity value to set. + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Sku")); + } + } +} diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/SkuName.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/SkuName.java new file mode 100644 index 0000000000000..02c96b041b692 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/SkuName.java @@ -0,0 +1,50 @@ +// 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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for SkuName. */ +public enum SkuName { + /** Enum value F0. */ + F0("F0"), + + /** Enum value S1. */ + S1("S1"), + + /** Enum value C0. */ + C0("C0"); + + /** The actual serialized value for a SkuName instance. */ + private final String value; + + SkuName(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SkuName instance. + * + * @param value the serialized value to parse. + * @return the parsed SkuName object, or null if unable to parse. + */ + @JsonCreator + public static SkuName fromString(String value) { + SkuName[] items = SkuName.values(); + for (SkuName item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/SkuTier.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/SkuTier.java new file mode 100644 index 0000000000000..a3e878bec5a38 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/SkuTier.java @@ -0,0 +1,47 @@ +// 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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for SkuTier. */ +public enum SkuTier { + /** Enum value Free. */ + FREE("Free"), + + /** Enum value Standard. */ + STANDARD("Standard"); + + /** The actual serialized value for a SkuTier instance. */ + private final String value; + + SkuTier(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SkuTier instance. + * + * @param value the serialized value to parse. + * @return the parsed SkuTier object, or null if unable to parse. + */ + @JsonCreator + public static SkuTier fromString(String value) { + SkuTier[] items = SkuTier.values(); + for (SkuTier item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} 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 new file mode 100644 index 0000000000000..f8e0c4fe8f9a9 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/SystemData.java @@ -0,0 +1,181 @@ +// 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() { + } +} diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/package-info.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/package-info.java new file mode 100644 index 0000000000000..36afced613cac --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for Healthbot. 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 com.azure.resourcemanager.healthbot.models; diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/package-info.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/package-info.java new file mode 100644 index 0000000000000..cf2e44e1bb519 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/com/azure/resourcemanager/healthbot/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for Healthbot. 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 com.azure.resourcemanager.healthbot; diff --git a/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/module-info.java b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/module-info.java new file mode 100644 index 0000000000000..5560ae8946764 --- /dev/null +++ b/sdk/healthbot/azure-resourcemanager-healthbot/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.healthbot { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.healthbot; + exports com.azure.resourcemanager.healthbot.fluent; + exports com.azure.resourcemanager.healthbot.fluent.models; + exports com.azure.resourcemanager.healthbot.models; + + opens com.azure.resourcemanager.healthbot.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.healthbot.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/healthbot/ci.yml b/sdk/healthbot/ci.yml new file mode 100644 index 0000000000000..80dbbeb140f4d --- /dev/null +++ b/sdk/healthbot/ci.yml @@ -0,0 +1,31 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - hotfix/* + - release/* + paths: + include: + - sdk/healthbot/ + +pr: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/healthbot/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: healthbot + Artifacts: + - name: azure-resourcemanager-healthbot + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerhealthbot diff --git a/sdk/healthbot/pom.xml b/sdk/healthbot/pom.xml new file mode 100644 index 0000000000000..c146f3ac57fed --- /dev/null +++ b/sdk/healthbot/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + com.azure + azure-healthbot-service + pom + 1.0.0 + + azure-resourcemanager-healthbot + +