From 6217dca30477002ad0b92785db16e6132f482187 Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Wed, 12 Jan 2022 08:02:37 +0000 Subject: [PATCH 1/6] docker codegen --- eng/versioning/version_client.txt | 1 + .../azure-messaging-newwebpubsub/CHANGELOG.md | 13 + .../azure-messaging-newwebpubsub/README.md | 63 + .../azure-messaging-newwebpubsub/pom.xml | 76 + .../newwebpubsub/HealthApiAsyncClient.java | 52 + .../newwebpubsub/HealthApiClient.java | 51 + .../newwebpubsub/WebPubSubAsyncClient.java | 642 +++++ .../newwebpubsub/WebPubSubClient.java | 638 +++++ .../newwebpubsub/WebPubSubClientBuilder.java | 334 +++ .../newwebpubsub/WebPubSubServiceVersion.java | 33 + .../implementation/HealthApisImpl.java | 125 + .../implementation/WebPubSubClientImpl.java | 137 + .../implementation/WebPubSubsImpl.java | 2346 +++++++++++++++++ .../messaging/newwebpubsub/package-info.java | 6 + .../src/main/java/module-info.java | 9 + .../azure-messaging-newwebpubsub.properties | 2 + .../messaging/newwebpubsub/ReadmeSamples.java | 12 + .../messaging/newwebpubsub/ClientTests.java | 47 + .../swagger/README_SPEC.md | 27 + sdk/webpubsub/ci.yml | 3 + sdk/webpubsub/pom.xml | 1 + 21 files changed, 4618 insertions(+) create mode 100644 sdk/webpubsub/azure-messaging-newwebpubsub/CHANGELOG.md create mode 100644 sdk/webpubsub/azure-messaging-newwebpubsub/README.md create mode 100644 sdk/webpubsub/azure-messaging-newwebpubsub/pom.xml create mode 100644 sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/HealthApiAsyncClient.java create mode 100644 sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/HealthApiClient.java create mode 100644 sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/WebPubSubAsyncClient.java create mode 100644 sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/WebPubSubClient.java create mode 100644 sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/WebPubSubClientBuilder.java create mode 100644 sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/WebPubSubServiceVersion.java create mode 100644 sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/implementation/HealthApisImpl.java create mode 100644 sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/implementation/WebPubSubClientImpl.java create mode 100644 sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/implementation/WebPubSubsImpl.java create mode 100644 sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/package-info.java create mode 100644 sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/module-info.java create mode 100644 sdk/webpubsub/azure-messaging-newwebpubsub/src/main/resources/azure-messaging-newwebpubsub.properties create mode 100644 sdk/webpubsub/azure-messaging-newwebpubsub/src/samples/java/com/azure/messaging/newwebpubsub/ReadmeSamples.java create mode 100644 sdk/webpubsub/azure-messaging-newwebpubsub/src/test/java/com/azure/messaging/newwebpubsub/ClientTests.java create mode 100644 sdk/webpubsub/azure-messaging-newwebpubsub/swagger/README_SPEC.md diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 284e10240fff7..03bfc796779b0 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -141,6 +141,7 @@ com.azure:azure-template-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-media-videoanalyzer-edge;1.0.0-beta.4;1.0.0-beta.5 com.azure:azure-verticals-agrifood-farming;1.0.0-beta.2;1.0.0-beta.3 com.azure:perf-test-core;1.0.0-beta.1;1.0.0-beta.1 +com.azure:azure-messaging-newwebpubsub;1.0.0-beta.1;1.0.0-beta.1 com.microsoft.azure:spring-cloud-azure-appconfiguration-config-web;1.3.0;1.4.0-beta.1 com.microsoft.azure:spring-cloud-azure-appconfiguration-config;1.3.0;1.4.0-beta.1 com.microsoft.azure:spring-cloud-azure-feature-management-web;1.3.0;1.4.0-beta.1 diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/CHANGELOG.md b/sdk/webpubsub/azure-messaging-newwebpubsub/CHANGELOG.md new file mode 100644 index 0000000000000..3e1e73e4412e5 --- /dev/null +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/CHANGELOG.md @@ -0,0 +1,13 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +- Azure WebPubSubClient client library for Java. This package contains Microsoft Azure WebPubSubClient client library. + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/README.md b/sdk/webpubsub/azure-messaging-newwebpubsub/README.md new file mode 100644 index 0000000000000..884e26095b0ea --- /dev/null +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/README.md @@ -0,0 +1,63 @@ +# Azure WebPubSubClient client library for Java + +Azure WebPubSubClient client library for Java. + +This package contains Microsoft Azure WebPubSubClient client library. + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] +- [Product documentation][product_documentation] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure:azure-messaging-newwebpubsub;current}) +```xml + + com.azure + azure-messaging-newwebpubsub + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Authentication + +[Azure Identity][azure_identity] package provides the default implementation for authenticating the client. + +## Key concepts + +## Examples + +```java com.azure.messaging.newwebpubsub.readme +``` + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +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 + + +[product_documentation]: https://azure.microsoft.com/services/ +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/pom.xml b/sdk/webpubsub/azure-messaging-newwebpubsub/pom.xml new file mode 100644 index 0000000000000..00b29336a3292 --- /dev/null +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/pom.xml @@ -0,0 +1,76 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure + azure-messaging-newwebpubsub + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for WebPubSubClient Management + This package contains Microsoft Azure WebPubSubClient client library. + 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 + true + false + + + + + + com.azure + azure-core + 1.24.1 + + + com.azure + azure-core-http-netty + 1.11.6 + + + org.junit.jupiter + junit-jupiter-engine + 5.8.1 + test + + + com.azure + azure-core-test + 1.7.7 + test + + + com.azure + azure-identity + 1.4.2 + test + + + diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/HealthApiAsyncClient.java b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/HealthApiAsyncClient.java new file mode 100644 index 0000000000000..6b9348f741c29 --- /dev/null +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/HealthApiAsyncClient.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.messaging.newwebpubsub; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.messaging.newwebpubsub.implementation.HealthApisImpl; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the asynchronous WebPubSubClient type. */ +@ServiceClient(builder = WebPubSubClientBuilder.class, isAsync = true) +public final class HealthApiAsyncClient { + @Generated private final HealthApisImpl serviceClient; + + /** + * Initializes an instance of HealthApis client. + * + * @param serviceClient the service client implementation. + */ + @Generated + HealthApiAsyncClient(HealthApisImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get service health status. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return service health status. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getServiceStatusWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getServiceStatusWithResponseAsync(requestOptions); + } +} diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/HealthApiClient.java b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/HealthApiClient.java new file mode 100644 index 0000000000000..b6f71cdea4d14 --- /dev/null +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/HealthApiClient.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.messaging.newwebpubsub; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.messaging.newwebpubsub.implementation.HealthApisImpl; + +/** Initializes a new instance of the synchronous WebPubSubClient type. */ +@ServiceClient(builder = WebPubSubClientBuilder.class) +public final class HealthApiClient { + @Generated private final HealthApisImpl serviceClient; + + /** + * Initializes an instance of HealthApis client. + * + * @param serviceClient the service client implementation. + */ + @Generated + HealthApiClient(HealthApisImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get service health status. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return service health status. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getServiceStatusWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getServiceStatusWithResponse(requestOptions); + } +} diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/WebPubSubAsyncClient.java b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/WebPubSubAsyncClient.java new file mode 100644 index 0000000000000..a7dbe445e3ad9 --- /dev/null +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/WebPubSubAsyncClient.java @@ -0,0 +1,642 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.messaging.newwebpubsub; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.messaging.newwebpubsub.implementation.WebPubSubsImpl; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the asynchronous WebPubSubClient type. */ +@ServiceClient(builder = WebPubSubClientBuilder.class, isAsync = true) +public final class WebPubSubAsyncClient { + @Generated private final WebPubSubsImpl serviceClient; + + /** + * Initializes an instance of WebPubSubs client. + * + * @param serviceClient the service client implementation. + */ + @Generated + WebPubSubAsyncClient(WebPubSubsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Generate token for the client to connect Azure Web PubSub service. + * + *

Query Parameters + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userIdStringNoUser Id.
roleStringNoRoles that the connection with the generated token will have.
minutesToExpireStringNoThe expire time of the generated token.
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     token: String
+     * }
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response object containing the token for the client. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> generateClientTokenWithResponse(String hub, RequestOptions requestOptions) { + return this.serviceClient.generateClientTokenWithResponseAsync(hub, requestOptions); + } + + /** + * Close the connections in the hub. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExclude these connectionIds when closing the connections in the hub.
reasonStringNoThe reason closing the client connection.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> closeAllConnectionsWithResponse(String hub, RequestOptions requestOptions) { + return this.serviceClient.closeAllConnectionsWithResponseAsync(hub, requestOptions); + } + + /** + * Broadcast content inside request body to all the connected client connections. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExcluded connection Ids.
apiVersionStringYesApi Version
+ * + *

Header Parameters + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
contentTypeStringYesUpload file type
contentLengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param message The payload body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendToAllWithResponse(String hub, BinaryData message, RequestOptions requestOptions) { + return this.serviceClient.sendToAllWithResponseAsync(hub, message, requestOptions); + } + + /** + * Check if the connection with the given connectionId exists. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * boolean
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param connectionId The connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return whether resource exists. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> connectionExistsWithResponse( + String hub, String connectionId, RequestOptions requestOptions) { + return this.serviceClient.connectionExistsWithResponseAsync(hub, connectionId, requestOptions); + } + + /** + * Close the client connection. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
reasonStringNoThe reason closing the client connection.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> closeConnectionWithResponse( + String hub, String connectionId, RequestOptions requestOptions) { + return this.serviceClient.closeConnectionWithResponseAsync(hub, connectionId, requestOptions); + } + + /** + * Send content inside request body to the specific connection. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Header Parameters + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
contentTypeStringYesUpload file type
contentLengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param connectionId The connection Id. + * @param message The payload body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendToConnectionWithResponse( + String hub, String connectionId, BinaryData message, RequestOptions requestOptions) { + return this.serviceClient.sendToConnectionWithResponseAsync(hub, connectionId, message, requestOptions); + } + + /** + * Check if there are any client connections inside the given group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * boolean
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return whether resource exists. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> groupExistsWithResponse(String hub, String group, RequestOptions requestOptions) { + return this.serviceClient.groupExistsWithResponseAsync(hub, group, requestOptions); + } + + /** + * Close connections in the specific group. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExclude these connectionIds when closing the connections in the group.
reasonStringNoThe reason closing the client connection.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> closeGroupConnectionsWithResponse( + String hub, String group, RequestOptions requestOptions) { + return this.serviceClient.closeGroupConnectionsWithResponseAsync(hub, group, requestOptions); + } + + /** + * Send content inside request body to a group of connections. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExcluded connection Ids
apiVersionStringYesApi Version
+ * + *

Header Parameters + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
contentTypeStringYesUpload file type
contentLengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param message The payload body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendToGroupWithResponse( + String hub, String group, BinaryData message, RequestOptions requestOptions) { + return this.serviceClient.sendToGroupWithResponseAsync(hub, group, message, requestOptions); + } + + /** + * Add a connection to the target group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addConnectionToGroupWithResponse( + String hub, String group, String connectionId, RequestOptions requestOptions) { + return this.serviceClient.addConnectionToGroupWithResponseAsync(hub, group, connectionId, requestOptions); + } + + /** + * Remove a connection from the target group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> removeConnectionFromGroupWithResponse( + String hub, String group, String connectionId, RequestOptions requestOptions) { + return this.serviceClient.removeConnectionFromGroupWithResponseAsync(hub, group, connectionId, requestOptions); + } + + /** + * Check if there are any client connections connected for the given user. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * boolean
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param userId Target user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return whether resource exists. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> userExistsWithResponse(String hub, String userId, RequestOptions requestOptions) { + return this.serviceClient.userExistsWithResponseAsync(hub, userId, requestOptions); + } + + /** + * Close connections for the specific user. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExclude these connectionIds when closing the connections for the user.
reasonStringNoThe reason closing the client connection.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param userId The user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> closeUserConnectionsWithResponse( + String hub, String userId, RequestOptions requestOptions) { + return this.serviceClient.closeUserConnectionsWithResponseAsync(hub, userId, requestOptions); + } + + /** + * Send content inside request body to the specific user. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Header Parameters + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
contentTypeStringYesUpload file type
contentLengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param userId The user Id. + * @param message The payload body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendToUserWithResponse( + String hub, String userId, BinaryData message, RequestOptions requestOptions) { + return this.serviceClient.sendToUserWithResponseAsync(hub, userId, message, requestOptions); + } + + /** + * Add a user to the target group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param userId Target user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addUserToGroupWithResponse( + String hub, String group, String userId, RequestOptions requestOptions) { + return this.serviceClient.addUserToGroupWithResponseAsync(hub, group, userId, requestOptions); + } + + /** + * Remove a user from the target group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param userId Target user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> removeUserFromGroupWithResponse( + String hub, String group, String userId, RequestOptions requestOptions) { + return this.serviceClient.removeUserFromGroupWithResponseAsync(hub, group, userId, requestOptions); + } + + /** + * Remove a user from all groups. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param userId Target user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> removeUserFromAllGroupsWithResponse( + String hub, String userId, RequestOptions requestOptions) { + return this.serviceClient.removeUserFromAllGroupsWithResponseAsync(hub, userId, requestOptions); + } + + /** + * Grant permission to the connection. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
targetNameStringNoThe meaning of the target depends on the specific permission. For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param permission The permission: current supported actions are joinLeaveGroup and sendToGroup. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> grantPermissionWithResponse( + String hub, String permission, String connectionId, RequestOptions requestOptions) { + return this.serviceClient.grantPermissionWithResponseAsync(hub, permission, connectionId, requestOptions); + } + + /** + * Revoke permission for the connection. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
targetNameStringNoThe meaning of the target depends on the specific permission. For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param permission The permission: current supported actions are joinLeaveGroup and sendToGroup. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> revokePermissionWithResponse( + String hub, String permission, String connectionId, RequestOptions requestOptions) { + return this.serviceClient.revokePermissionWithResponseAsync(hub, permission, connectionId, requestOptions); + } + + /** + * Check if a connection has permission to the specified action. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
targetNameStringNoThe meaning of the target depends on the specific permission. For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * boolean
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param permission The permission: current supported actions are joinLeaveGroup and sendToGroup. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return whether resource exists. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> checkPermissionWithResponse( + String hub, String permission, String connectionId, RequestOptions requestOptions) { + return this.serviceClient.checkPermissionWithResponseAsync(hub, permission, connectionId, requestOptions); + } +} diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/WebPubSubClient.java b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/WebPubSubClient.java new file mode 100644 index 0000000000000..f8b6581f6f44f --- /dev/null +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/WebPubSubClient.java @@ -0,0 +1,638 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.messaging.newwebpubsub; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.messaging.newwebpubsub.implementation.WebPubSubsImpl; + +/** Initializes a new instance of the synchronous WebPubSubClient type. */ +@ServiceClient(builder = WebPubSubClientBuilder.class) +public final class WebPubSubClient { + @Generated private final WebPubSubsImpl serviceClient; + + /** + * Initializes an instance of WebPubSubs client. + * + * @param serviceClient the service client implementation. + */ + @Generated + WebPubSubClient(WebPubSubsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Generate token for the client to connect Azure Web PubSub service. + * + *

Query Parameters + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userIdStringNoUser Id.
roleStringNoRoles that the connection with the generated token will have.
minutesToExpireStringNoThe expire time of the generated token.
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     token: String
+     * }
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response object containing the token for the client. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response generateClientTokenWithResponse(String hub, RequestOptions requestOptions) { + return this.serviceClient.generateClientTokenWithResponse(hub, requestOptions); + } + + /** + * Close the connections in the hub. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExclude these connectionIds when closing the connections in the hub.
reasonStringNoThe reason closing the client connection.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response closeAllConnectionsWithResponse(String hub, RequestOptions requestOptions) { + return this.serviceClient.closeAllConnectionsWithResponse(hub, requestOptions); + } + + /** + * Broadcast content inside request body to all the connected client connections. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExcluded connection Ids.
apiVersionStringYesApi Version
+ * + *

Header Parameters + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
contentTypeStringYesUpload file type
contentLengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param message The payload body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendToAllWithResponse(String hub, BinaryData message, RequestOptions requestOptions) { + return this.serviceClient.sendToAllWithResponse(hub, message, requestOptions); + } + + /** + * Check if the connection with the given connectionId exists. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * boolean
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param connectionId The connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response connectionExistsWithResponse( + String hub, String connectionId, RequestOptions requestOptions) { + return this.serviceClient.connectionExistsWithResponse(hub, connectionId, requestOptions); + } + + /** + * Close the client connection. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
reasonStringNoThe reason closing the client connection.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response closeConnectionWithResponse(String hub, String connectionId, RequestOptions requestOptions) { + return this.serviceClient.closeConnectionWithResponse(hub, connectionId, requestOptions); + } + + /** + * Send content inside request body to the specific connection. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Header Parameters + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
contentTypeStringYesUpload file type
contentLengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param connectionId The connection Id. + * @param message The payload body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendToConnectionWithResponse( + String hub, String connectionId, BinaryData message, RequestOptions requestOptions) { + return this.serviceClient.sendToConnectionWithResponse(hub, connectionId, message, requestOptions); + } + + /** + * Check if there are any client connections inside the given group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * boolean
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response groupExistsWithResponse(String hub, String group, RequestOptions requestOptions) { + return this.serviceClient.groupExistsWithResponse(hub, group, requestOptions); + } + + /** + * Close connections in the specific group. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExclude these connectionIds when closing the connections in the group.
reasonStringNoThe reason closing the client connection.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response closeGroupConnectionsWithResponse(String hub, String group, RequestOptions requestOptions) { + return this.serviceClient.closeGroupConnectionsWithResponse(hub, group, requestOptions); + } + + /** + * Send content inside request body to a group of connections. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExcluded connection Ids
apiVersionStringYesApi Version
+ * + *

Header Parameters + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
contentTypeStringYesUpload file type
contentLengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param message The payload body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendToGroupWithResponse( + String hub, String group, BinaryData message, RequestOptions requestOptions) { + return this.serviceClient.sendToGroupWithResponse(hub, group, message, requestOptions); + } + + /** + * Add a connection to the target group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addConnectionToGroupWithResponse( + String hub, String group, String connectionId, RequestOptions requestOptions) { + return this.serviceClient.addConnectionToGroupWithResponse(hub, group, connectionId, requestOptions); + } + + /** + * Remove a connection from the target group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response removeConnectionFromGroupWithResponse( + String hub, String group, String connectionId, RequestOptions requestOptions) { + return this.serviceClient.removeConnectionFromGroupWithResponse(hub, group, connectionId, requestOptions); + } + + /** + * Check if there are any client connections connected for the given user. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * boolean
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param userId Target user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response userExistsWithResponse(String hub, String userId, RequestOptions requestOptions) { + return this.serviceClient.userExistsWithResponse(hub, userId, requestOptions); + } + + /** + * Close connections for the specific user. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExclude these connectionIds when closing the connections for the user.
reasonStringNoThe reason closing the client connection.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param userId The user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response closeUserConnectionsWithResponse(String hub, String userId, RequestOptions requestOptions) { + return this.serviceClient.closeUserConnectionsWithResponse(hub, userId, requestOptions); + } + + /** + * Send content inside request body to the specific user. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Header Parameters + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
contentTypeStringYesUpload file type
contentLengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param userId The user Id. + * @param message The payload body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendToUserWithResponse( + String hub, String userId, BinaryData message, RequestOptions requestOptions) { + return this.serviceClient.sendToUserWithResponse(hub, userId, message, requestOptions); + } + + /** + * Add a user to the target group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param userId Target user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addUserToGroupWithResponse( + String hub, String group, String userId, RequestOptions requestOptions) { + return this.serviceClient.addUserToGroupWithResponse(hub, group, userId, requestOptions); + } + + /** + * Remove a user from the target group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param userId Target user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response removeUserFromGroupWithResponse( + String hub, String group, String userId, RequestOptions requestOptions) { + return this.serviceClient.removeUserFromGroupWithResponse(hub, group, userId, requestOptions); + } + + /** + * Remove a user from all groups. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param userId Target user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response removeUserFromAllGroupsWithResponse( + String hub, String userId, RequestOptions requestOptions) { + return this.serviceClient.removeUserFromAllGroupsWithResponse(hub, userId, requestOptions); + } + + /** + * Grant permission to the connection. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
targetNameStringNoThe meaning of the target depends on the specific permission. For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param permission The permission: current supported actions are joinLeaveGroup and sendToGroup. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response grantPermissionWithResponse( + String hub, String permission, String connectionId, RequestOptions requestOptions) { + return this.serviceClient.grantPermissionWithResponse(hub, permission, connectionId, requestOptions); + } + + /** + * Revoke permission for the connection. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
targetNameStringNoThe meaning of the target depends on the specific permission. For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param permission The permission: current supported actions are joinLeaveGroup and sendToGroup. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response revokePermissionWithResponse( + String hub, String permission, String connectionId, RequestOptions requestOptions) { + return this.serviceClient.revokePermissionWithResponse(hub, permission, connectionId, requestOptions); + } + + /** + * Check if a connection has permission to the specified action. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
targetNameStringNoThe meaning of the target depends on the specific permission. For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * boolean
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param permission The permission: current supported actions are joinLeaveGroup and sendToGroup. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkPermissionWithResponse( + String hub, String permission, String connectionId, RequestOptions requestOptions) { + return this.serviceClient.checkPermissionWithResponse(hub, permission, connectionId, requestOptions); + } +} diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/WebPubSubClientBuilder.java b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/WebPubSubClientBuilder.java new file mode 100644 index 0000000000000..af6560947749b --- /dev/null +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/WebPubSubClientBuilder.java @@ -0,0 +1,334 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.messaging.newwebpubsub; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.CookiePolicy; +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.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.messaging.newwebpubsub.implementation.WebPubSubClientImpl; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** A builder for creating a new instance of the WebPubSubClient type. */ +@ServiceClientBuilder( + serviceClients = { + HealthApiClient.class, + WebPubSubClient.class, + HealthApiAsyncClient.class, + WebPubSubAsyncClient.class + }) +public final class WebPubSubClientBuilder { + @Generated private static final String SDK_NAME = "name"; + + @Generated private static final String SDK_VERSION = "version"; + + @Generated static final String[] DEFAULT_SCOPES = new String[] {"https://webpubsub.azure.com/.default"}; + + @Generated + private final Map properties = CoreUtils.getProperties("azure-messaging-newwebpubsub.properties"); + + /** Create an instance of the WebPubSubClientBuilder. */ + @Generated + public WebPubSubClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * HTTP or HTTPS endpoint for the Web PubSub service instance. + */ + @Generated private String endpoint; + + /** + * Sets HTTP or HTTPS endpoint for the Web PubSub service instance. + * + * @param endpoint the endpoint value. + * @return the WebPubSubClientBuilder. + */ + @Generated + public WebPubSubClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated private WebPubSubServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the WebPubSubClientBuilder. + */ + @Generated + public WebPubSubClientBuilder serviceVersion(WebPubSubServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + @Generated private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the WebPubSubClientBuilder. + */ + @Generated + public WebPubSubClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The HTTP client used to send the request. + */ + @Generated private HttpClient httpClient; + + /** + * Sets The HTTP client used to send the request. + * + * @param httpClient the httpClient value. + * @return the WebPubSubClientBuilder. + */ + @Generated + public WebPubSubClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The configuration store that is used during construction of the service + * client. + */ + @Generated private Configuration configuration; + + /** + * Sets The configuration store that is used during construction of the service client. + * + * @param configuration the configuration value. + * @return the WebPubSubClientBuilder. + */ + @Generated + public WebPubSubClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The TokenCredential used for authentication. + */ + @Generated private TokenCredential tokenCredential; + + /** + * Sets The TokenCredential used for authentication. + * + * @param tokenCredential the tokenCredential value. + * @return the WebPubSubClientBuilder. + */ + @Generated + public WebPubSubClientBuilder credential(TokenCredential tokenCredential) { + this.tokenCredential = tokenCredential; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated private HttpLogOptions httpLogOptions; + + /** + * Sets The logging configuration for HTTP requests and responses. + * + * @param httpLogOptions the httpLogOptions value. + * @return the WebPubSubClientBuilder. + */ + @Generated + public WebPubSubClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if + * applicable. + */ + @Generated private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the WebPubSubClientBuilder. + */ + @Generated + public WebPubSubClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /* + * The list of Http pipeline policies to add. + */ + @Generated private final List pipelinePolicies; + + /* + * The client options such as application ID and custom headers to set on a + * request. + */ + @Generated private ClientOptions clientOptions; + + /** + * Sets The client options such as application ID and custom headers to set on a request. + * + * @param clientOptions the clientOptions value. + * @return the WebPubSubClientBuilder. + */ + @Generated + public WebPubSubClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /** + * Adds a custom Http pipeline policy. + * + * @param customPolicy The custom Http pipeline policy to add. + * @return the WebPubSubClientBuilder. + */ + @Generated + public WebPubSubClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + pipelinePolicies.add(customPolicy); + return this; + } + + /** + * Builds an instance of WebPubSubClientImpl with the provided parameters. + * + * @return an instance of WebPubSubClientImpl. + */ + @Generated + private WebPubSubClientImpl buildInnerClient() { + if (serviceVersion == null) { + this.serviceVersion = WebPubSubServiceVersion.getLatest(); + } + if (pipeline == null) { + this.pipeline = createHttpPipeline(); + } + WebPubSubClientImpl client = + new WebPubSubClientImpl( + pipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + return client; + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration = + (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + if (httpLogOptions == null) { + httpLogOptions = new HttpLogOptions(); + } + if (clientOptions == null) { + clientOptions = new ClientOptions(); + } + List policies = new ArrayList<>(); + String clientName = properties.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = properties.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(clientOptions, httpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + HttpHeaders headers = new HttpHeaders(); + clientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue())); + if (headers.getSize() > 0) { + policies.add(new AddHeadersPolicy(headers)); + } + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy == null ? new RetryPolicy() : retryPolicy); + policies.add(new CookiePolicy()); + if (tokenCredential != null) { + policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES)); + } + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(clientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of HealthApiAsyncClient async client. + * + * @return an instance of HealthApiAsyncClient. + */ + @Generated + public HealthApiAsyncClient buildHealthApiAsyncClient() { + return new HealthApiAsyncClient(buildInnerClient().getHealthApis()); + } + + /** + * Builds an instance of WebPubSubAsyncClient async client. + * + * @return an instance of WebPubSubAsyncClient. + */ + @Generated + public WebPubSubAsyncClient buildWebPubSubAsyncClient() { + return new WebPubSubAsyncClient(buildInnerClient().getWebPubSubs()); + } + + /** + * Builds an instance of HealthApiClient sync client. + * + * @return an instance of HealthApiClient. + */ + @Generated + public HealthApiClient buildHealthApiClient() { + return new HealthApiClient(buildInnerClient().getHealthApis()); + } + + /** + * Builds an instance of WebPubSubClient sync client. + * + * @return an instance of WebPubSubClient. + */ + @Generated + public WebPubSubClient buildWebPubSubClient() { + return new WebPubSubClient(buildInnerClient().getWebPubSubs()); + } +} diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/WebPubSubServiceVersion.java b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/WebPubSubServiceVersion.java new file mode 100644 index 0000000000000..7a1bb3cccb911 --- /dev/null +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/WebPubSubServiceVersion.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.messaging.newwebpubsub; + +import com.azure.core.util.ServiceVersion; + +/** Service version of WebPubSubClient. */ +public enum WebPubSubServiceVersion implements ServiceVersion { + /** Enum value 2021-10-01. */ + V2021_10_01("2021-10-01"); + + private final String version; + + WebPubSubServiceVersion(String version) { + this.version = version; + } + + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link WebPubSubServiceVersion}. + */ + public static WebPubSubServiceVersion getLatest() { + return V2021_10_01; + } +} diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/implementation/HealthApisImpl.java b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/implementation/HealthApisImpl.java new file mode 100644 index 0000000000000..a9edc34847320 --- /dev/null +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/implementation/HealthApisImpl.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.messaging.newwebpubsub.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Head; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.exception.HttpResponseException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in HealthApis. */ +public final class HealthApisImpl { + /** The proxy service used to perform REST calls. */ + private final HealthApisService service; + + /** The service client containing this operation class. */ + private final WebPubSubClientImpl client; + + /** + * Initializes an instance of HealthApisImpl. + * + * @param client the instance of the service client containing this operation class. + */ + HealthApisImpl(WebPubSubClientImpl client) { + this.service = + RestProxy.create(HealthApisService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for WebPubSubClientHealthApis to be used by the proxy service to perform + * REST calls. + */ + @Host("{Endpoint}") + @ServiceInterface(name = "WebPubSubClientHealt") + private interface HealthApisService { + @Head("/api/health") + @ExpectedResponses({200}) + Mono> getServiceStatus( + @HostParam("Endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + RequestOptions requestOptions, + Context context); + } + + /** + * Get service health status. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return service health status. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getServiceStatusWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.getServiceStatus( + this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), + requestOptions, + context)); + } + + /** + * Get service health status. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return service health status. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getServiceStatusWithResponseAsync(RequestOptions requestOptions, Context context) { + return service.getServiceStatus( + this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), requestOptions, context); + } + + /** + * Get service health status. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return service health status. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getServiceStatusWithResponse(RequestOptions requestOptions) { + return getServiceStatusWithResponseAsync(requestOptions).block(); + } +} diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/implementation/WebPubSubClientImpl.java b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/implementation/WebPubSubClientImpl.java new file mode 100644 index 0000000000000..0aeb9828aefa0 --- /dev/null +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/implementation/WebPubSubClientImpl.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.messaging.newwebpubsub.implementation; + +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.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.messaging.newwebpubsub.WebPubSubServiceVersion; + +/** Initializes a new instance of the WebPubSubClient type. */ +public final class WebPubSubClientImpl { + /** HTTP or HTTPS endpoint for the Web PubSub service instance. */ + private final String endpoint; + + /** + * Gets HTTP or HTTPS endpoint for the Web PubSub service instance. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Service version. */ + private final WebPubSubServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public WebPubSubServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** 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. + */ + public SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The HealthApisImpl object to access its operations. */ + private final HealthApisImpl healthApis; + + /** + * Gets the HealthApisImpl object to access its operations. + * + * @return the HealthApisImpl object. + */ + public HealthApisImpl getHealthApis() { + return this.healthApis; + } + + /** The WebPubSubsImpl object to access its operations. */ + private final WebPubSubsImpl webPubSubs; + + /** + * Gets the WebPubSubsImpl object to access its operations. + * + * @return the WebPubSubsImpl object. + */ + public WebPubSubsImpl getWebPubSubs() { + return this.webPubSubs; + } + + /** + * Initializes an instance of WebPubSubClient client. + * + * @param endpoint HTTP or HTTPS endpoint for the Web PubSub service instance. + * @param serviceVersion Service version. + */ + public WebPubSubClientImpl(String endpoint, WebPubSubServiceVersion serviceVersion) { + this( + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(), + JacksonAdapter.createDefaultSerializerAdapter(), + endpoint, + serviceVersion); + } + + /** + * Initializes an instance of WebPubSubClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint HTTP or HTTPS endpoint for the Web PubSub service instance. + * @param serviceVersion Service version. + */ + public WebPubSubClientImpl(HttpPipeline httpPipeline, String endpoint, WebPubSubServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of WebPubSubClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint HTTP or HTTPS endpoint for the Web PubSub service instance. + * @param serviceVersion Service version. + */ + public WebPubSubClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + String endpoint, + WebPubSubServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.healthApis = new HealthApisImpl(this); + this.webPubSubs = new WebPubSubsImpl(this); + } +} diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/implementation/WebPubSubsImpl.java b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/implementation/WebPubSubsImpl.java new file mode 100644 index 0000000000000..414023ea66762 --- /dev/null +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/implementation/WebPubSubsImpl.java @@ -0,0 +1,2346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.messaging.newwebpubsub.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Head; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.exception.HttpResponseException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in WebPubSubs. */ +public final class WebPubSubsImpl { + /** The proxy service used to perform REST calls. */ + private final WebPubSubsService service; + + /** The service client containing this operation class. */ + private final WebPubSubClientImpl client; + + /** + * Initializes an instance of WebPubSubsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WebPubSubsImpl(WebPubSubClientImpl client) { + this.service = + RestProxy.create(WebPubSubsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for WebPubSubClientWebPubSubs to be used by the proxy service to perform + * REST calls. + */ + @Host("{Endpoint}") + @ServiceInterface(name = "WebPubSubClientWebPu") + private interface WebPubSubsService { + @Post("/api/hubs/{hub}/:generateToken") + @ExpectedResponses({200}) + Mono> generateClientToken( + @HostParam("Endpoint") String endpoint, + @PathParam("hub") String hub, + @QueryParam("api-version") String apiVersion, + RequestOptions requestOptions, + Context context); + + @Post("/api/hubs/{hub}/:closeConnections") + @ExpectedResponses({204}) + Mono> closeAllConnections( + @HostParam("Endpoint") String endpoint, + @PathParam("hub") String hub, + @QueryParam("api-version") String apiVersion, + RequestOptions requestOptions, + Context context); + + @Post("/api/hubs/{hub}/:send") + @ExpectedResponses({202}) + Mono> sendToAll( + @HostParam("Endpoint") String endpoint, + @PathParam("hub") String hub, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/octet-stream") BinaryData message, + RequestOptions requestOptions, + Context context); + + @Head("/api/hubs/{hub}/connections/{connectionId}") + @ExpectedResponses({200, 404}) + Mono> connectionExists( + @HostParam("Endpoint") String endpoint, + @PathParam("hub") String hub, + @PathParam("connectionId") String connectionId, + @QueryParam("api-version") String apiVersion, + RequestOptions requestOptions, + Context context); + + @Delete("/api/hubs/{hub}/connections/{connectionId}") + @ExpectedResponses({204}) + Mono> closeConnection( + @HostParam("Endpoint") String endpoint, + @PathParam("hub") String hub, + @PathParam("connectionId") String connectionId, + @QueryParam("api-version") String apiVersion, + RequestOptions requestOptions, + Context context); + + @Post("/api/hubs/{hub}/connections/{connectionId}/:send") + @ExpectedResponses({202}) + Mono> sendToConnection( + @HostParam("Endpoint") String endpoint, + @PathParam("hub") String hub, + @PathParam("connectionId") String connectionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/octet-stream") BinaryData message, + RequestOptions requestOptions, + Context context); + + @Head("/api/hubs/{hub}/groups/{group}") + @ExpectedResponses({200, 404}) + Mono> groupExists( + @HostParam("Endpoint") String endpoint, + @PathParam("hub") String hub, + @PathParam("group") String group, + @QueryParam("api-version") String apiVersion, + RequestOptions requestOptions, + Context context); + + @Post("/api/hubs/{hub}/groups/{group}/:closeConnections") + @ExpectedResponses({204}) + Mono> closeGroupConnections( + @HostParam("Endpoint") String endpoint, + @PathParam("hub") String hub, + @PathParam("group") String group, + @QueryParam("api-version") String apiVersion, + RequestOptions requestOptions, + Context context); + + @Post("/api/hubs/{hub}/groups/{group}/:send") + @ExpectedResponses({202}) + Mono> sendToGroup( + @HostParam("Endpoint") String endpoint, + @PathParam("hub") String hub, + @PathParam("group") String group, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/octet-stream") BinaryData message, + RequestOptions requestOptions, + Context context); + + @Put("/api/hubs/{hub}/groups/{group}/connections/{connectionId}") + @ExpectedResponses({200}) + Mono> addConnectionToGroup( + @HostParam("Endpoint") String endpoint, + @PathParam("hub") String hub, + @PathParam("group") String group, + @PathParam("connectionId") String connectionId, + @QueryParam("api-version") String apiVersion, + RequestOptions requestOptions, + Context context); + + @Delete("/api/hubs/{hub}/groups/{group}/connections/{connectionId}") + @ExpectedResponses({204}) + Mono> removeConnectionFromGroup( + @HostParam("Endpoint") String endpoint, + @PathParam("hub") String hub, + @PathParam("group") String group, + @PathParam("connectionId") String connectionId, + @QueryParam("api-version") String apiVersion, + RequestOptions requestOptions, + Context context); + + @Head("/api/hubs/{hub}/users/{userId}") + @ExpectedResponses({200, 404}) + Mono> userExists( + @HostParam("Endpoint") String endpoint, + @PathParam("hub") String hub, + @PathParam("userId") String userId, + @QueryParam("api-version") String apiVersion, + RequestOptions requestOptions, + Context context); + + @Post("/api/hubs/{hub}/users/{userId}/:closeConnections") + @ExpectedResponses({204}) + Mono> closeUserConnections( + @HostParam("Endpoint") String endpoint, + @PathParam("hub") String hub, + @PathParam("userId") String userId, + @QueryParam("api-version") String apiVersion, + RequestOptions requestOptions, + Context context); + + @Post("/api/hubs/{hub}/users/{userId}/:send") + @ExpectedResponses({202}) + Mono> sendToUser( + @HostParam("Endpoint") String endpoint, + @PathParam("hub") String hub, + @PathParam("userId") String userId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/octet-stream") BinaryData message, + RequestOptions requestOptions, + Context context); + + @Put("/api/hubs/{hub}/users/{userId}/groups/{group}") + @ExpectedResponses({200}) + Mono> addUserToGroup( + @HostParam("Endpoint") String endpoint, + @PathParam("hub") String hub, + @PathParam("group") String group, + @PathParam("userId") String userId, + @QueryParam("api-version") String apiVersion, + RequestOptions requestOptions, + Context context); + + @Delete("/api/hubs/{hub}/users/{userId}/groups/{group}") + @ExpectedResponses({204}) + Mono> removeUserFromGroup( + @HostParam("Endpoint") String endpoint, + @PathParam("hub") String hub, + @PathParam("group") String group, + @PathParam("userId") String userId, + @QueryParam("api-version") String apiVersion, + RequestOptions requestOptions, + Context context); + + @Delete("/api/hubs/{hub}/users/{userId}/groups") + @ExpectedResponses({204}) + Mono> removeUserFromAllGroups( + @HostParam("Endpoint") String endpoint, + @PathParam("hub") String hub, + @PathParam("userId") String userId, + @QueryParam("api-version") String apiVersion, + RequestOptions requestOptions, + Context context); + + @Put("/api/hubs/{hub}/permissions/{permission}/connections/{connectionId}") + @ExpectedResponses({200}) + Mono> grantPermission( + @HostParam("Endpoint") String endpoint, + @PathParam("hub") String hub, + @PathParam("permission") String permission, + @PathParam("connectionId") String connectionId, + @QueryParam("api-version") String apiVersion, + RequestOptions requestOptions, + Context context); + + @Delete("/api/hubs/{hub}/permissions/{permission}/connections/{connectionId}") + @ExpectedResponses({204}) + Mono> revokePermission( + @HostParam("Endpoint") String endpoint, + @PathParam("hub") String hub, + @PathParam("permission") String permission, + @PathParam("connectionId") String connectionId, + @QueryParam("api-version") String apiVersion, + RequestOptions requestOptions, + Context context); + + @Head("/api/hubs/{hub}/permissions/{permission}/connections/{connectionId}") + @ExpectedResponses({200, 404}) + Mono> checkPermission( + @HostParam("Endpoint") String endpoint, + @PathParam("hub") String hub, + @PathParam("permission") String permission, + @PathParam("connectionId") String connectionId, + @QueryParam("api-version") String apiVersion, + RequestOptions requestOptions, + Context context); + } + + /** + * Generate token for the client to connect Azure Web PubSub service. + * + *

Query Parameters + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userIdStringNoUser Id.
roleStringNoRoles that the connection with the generated token will have.
minutesToExpireStringNoThe expire time of the generated token.
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     token: String
+     * }
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response object containing the token for the client. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> generateClientTokenWithResponseAsync(String hub, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.generateClientToken( + this.client.getEndpoint(), + hub, + this.client.getServiceVersion().getVersion(), + requestOptions, + context)); + } + + /** + * Generate token for the client to connect Azure Web PubSub service. + * + *

Query Parameters + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userIdStringNoUser Id.
roleStringNoRoles that the connection with the generated token will have.
minutesToExpireStringNoThe expire time of the generated token.
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     token: String
+     * }
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response object containing the token for the client. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> generateClientTokenWithResponseAsync( + String hub, RequestOptions requestOptions, Context context) { + return service.generateClientToken( + this.client.getEndpoint(), hub, this.client.getServiceVersion().getVersion(), requestOptions, context); + } + + /** + * Generate token for the client to connect Azure Web PubSub service. + * + *

Query Parameters + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userIdStringNoUser Id.
roleStringNoRoles that the connection with the generated token will have.
minutesToExpireStringNoThe expire time of the generated token.
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     token: String
+     * }
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response object containing the token for the client. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response generateClientTokenWithResponse(String hub, RequestOptions requestOptions) { + return generateClientTokenWithResponseAsync(hub, requestOptions).block(); + } + + /** + * Close the connections in the hub. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExclude these connectionIds when closing the connections in the hub.
reasonStringNoThe reason closing the client connection.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> closeAllConnectionsWithResponseAsync(String hub, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.closeAllConnections( + this.client.getEndpoint(), + hub, + this.client.getServiceVersion().getVersion(), + requestOptions, + context)); + } + + /** + * Close the connections in the hub. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExclude these connectionIds when closing the connections in the hub.
reasonStringNoThe reason closing the client connection.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> closeAllConnectionsWithResponseAsync( + String hub, RequestOptions requestOptions, Context context) { + return service.closeAllConnections( + this.client.getEndpoint(), hub, this.client.getServiceVersion().getVersion(), requestOptions, context); + } + + /** + * Close the connections in the hub. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExclude these connectionIds when closing the connections in the hub.
reasonStringNoThe reason closing the client connection.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response closeAllConnectionsWithResponse(String hub, RequestOptions requestOptions) { + return closeAllConnectionsWithResponseAsync(hub, requestOptions).block(); + } + + /** + * Broadcast content inside request body to all the connected client connections. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExcluded connection Ids.
apiVersionStringYesApi Version
+ * + *

Header Parameters + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
contentTypeStringYesUpload file type
contentLengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param message The payload body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendToAllWithResponseAsync( + String hub, BinaryData message, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.sendToAll( + this.client.getEndpoint(), + hub, + this.client.getServiceVersion().getVersion(), + message, + requestOptions, + context)); + } + + /** + * Broadcast content inside request body to all the connected client connections. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExcluded connection Ids.
apiVersionStringYesApi Version
+ * + *

Header Parameters + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
contentTypeStringYesUpload file type
contentLengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param message The payload body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendToAllWithResponseAsync( + String hub, BinaryData message, RequestOptions requestOptions, Context context) { + return service.sendToAll( + this.client.getEndpoint(), + hub, + this.client.getServiceVersion().getVersion(), + message, + requestOptions, + context); + } + + /** + * Broadcast content inside request body to all the connected client connections. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExcluded connection Ids.
apiVersionStringYesApi Version
+ * + *

Header Parameters + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
contentTypeStringYesUpload file type
contentLengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param message The payload body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendToAllWithResponse(String hub, BinaryData message, RequestOptions requestOptions) { + return sendToAllWithResponseAsync(hub, message, requestOptions).block(); + } + + /** + * Check if the connection with the given connectionId exists. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * boolean
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param connectionId The connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> connectionExistsWithResponseAsync( + String hub, String connectionId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.connectionExists( + this.client.getEndpoint(), + hub, + connectionId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context)); + } + + /** + * Check if the connection with the given connectionId exists. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * boolean
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param connectionId The connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> connectionExistsWithResponseAsync( + String hub, String connectionId, RequestOptions requestOptions, Context context) { + return service.connectionExists( + this.client.getEndpoint(), + hub, + connectionId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context); + } + + /** + * Check if the connection with the given connectionId exists. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * boolean
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param connectionId The connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response connectionExistsWithResponse( + String hub, String connectionId, RequestOptions requestOptions) { + return connectionExistsWithResponseAsync(hub, connectionId, requestOptions).block(); + } + + /** + * Close the client connection. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
reasonStringNoThe reason closing the client connection.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> closeConnectionWithResponseAsync( + String hub, String connectionId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.closeConnection( + this.client.getEndpoint(), + hub, + connectionId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context)); + } + + /** + * Close the client connection. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
reasonStringNoThe reason closing the client connection.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> closeConnectionWithResponseAsync( + String hub, String connectionId, RequestOptions requestOptions, Context context) { + return service.closeConnection( + this.client.getEndpoint(), + hub, + connectionId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context); + } + + /** + * Close the client connection. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
reasonStringNoThe reason closing the client connection.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response closeConnectionWithResponse(String hub, String connectionId, RequestOptions requestOptions) { + return closeConnectionWithResponseAsync(hub, connectionId, requestOptions).block(); + } + + /** + * Send content inside request body to the specific connection. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Header Parameters + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
contentTypeStringYesUpload file type
contentLengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param connectionId The connection Id. + * @param message The payload body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendToConnectionWithResponseAsync( + String hub, String connectionId, BinaryData message, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.sendToConnection( + this.client.getEndpoint(), + hub, + connectionId, + this.client.getServiceVersion().getVersion(), + message, + requestOptions, + context)); + } + + /** + * Send content inside request body to the specific connection. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Header Parameters + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
contentTypeStringYesUpload file type
contentLengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param connectionId The connection Id. + * @param message The payload body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendToConnectionWithResponseAsync( + String hub, String connectionId, BinaryData message, RequestOptions requestOptions, Context context) { + return service.sendToConnection( + this.client.getEndpoint(), + hub, + connectionId, + this.client.getServiceVersion().getVersion(), + message, + requestOptions, + context); + } + + /** + * Send content inside request body to the specific connection. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Header Parameters + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
contentTypeStringYesUpload file type
contentLengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param connectionId The connection Id. + * @param message The payload body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendToConnectionWithResponse( + String hub, String connectionId, BinaryData message, RequestOptions requestOptions) { + return sendToConnectionWithResponseAsync(hub, connectionId, message, requestOptions).block(); + } + + /** + * Check if there are any client connections inside the given group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * boolean
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> groupExistsWithResponseAsync( + String hub, String group, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.groupExists( + this.client.getEndpoint(), + hub, + group, + this.client.getServiceVersion().getVersion(), + requestOptions, + context)); + } + + /** + * Check if there are any client connections inside the given group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * boolean
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> groupExistsWithResponseAsync( + String hub, String group, RequestOptions requestOptions, Context context) { + return service.groupExists( + this.client.getEndpoint(), + hub, + group, + this.client.getServiceVersion().getVersion(), + requestOptions, + context); + } + + /** + * Check if there are any client connections inside the given group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * boolean
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response groupExistsWithResponse(String hub, String group, RequestOptions requestOptions) { + return groupExistsWithResponseAsync(hub, group, requestOptions).block(); + } + + /** + * Close connections in the specific group. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExclude these connectionIds when closing the connections in the group.
reasonStringNoThe reason closing the client connection.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> closeGroupConnectionsWithResponseAsync( + String hub, String group, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.closeGroupConnections( + this.client.getEndpoint(), + hub, + group, + this.client.getServiceVersion().getVersion(), + requestOptions, + context)); + } + + /** + * Close connections in the specific group. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExclude these connectionIds when closing the connections in the group.
reasonStringNoThe reason closing the client connection.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> closeGroupConnectionsWithResponseAsync( + String hub, String group, RequestOptions requestOptions, Context context) { + return service.closeGroupConnections( + this.client.getEndpoint(), + hub, + group, + this.client.getServiceVersion().getVersion(), + requestOptions, + context); + } + + /** + * Close connections in the specific group. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExclude these connectionIds when closing the connections in the group.
reasonStringNoThe reason closing the client connection.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response closeGroupConnectionsWithResponse(String hub, String group, RequestOptions requestOptions) { + return closeGroupConnectionsWithResponseAsync(hub, group, requestOptions).block(); + } + + /** + * Send content inside request body to a group of connections. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExcluded connection Ids
apiVersionStringYesApi Version
+ * + *

Header Parameters + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
contentTypeStringYesUpload file type
contentLengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param message The payload body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendToGroupWithResponseAsync( + String hub, String group, BinaryData message, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.sendToGroup( + this.client.getEndpoint(), + hub, + group, + this.client.getServiceVersion().getVersion(), + message, + requestOptions, + context)); + } + + /** + * Send content inside request body to a group of connections. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExcluded connection Ids
apiVersionStringYesApi Version
+ * + *

Header Parameters + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
contentTypeStringYesUpload file type
contentLengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param message The payload body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendToGroupWithResponseAsync( + String hub, String group, BinaryData message, RequestOptions requestOptions, Context context) { + return service.sendToGroup( + this.client.getEndpoint(), + hub, + group, + this.client.getServiceVersion().getVersion(), + message, + requestOptions, + context); + } + + /** + * Send content inside request body to a group of connections. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExcluded connection Ids
apiVersionStringYesApi Version
+ * + *

Header Parameters + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
contentTypeStringYesUpload file type
contentLengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param message The payload body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendToGroupWithResponse( + String hub, String group, BinaryData message, RequestOptions requestOptions) { + return sendToGroupWithResponseAsync(hub, group, message, requestOptions).block(); + } + + /** + * Add a connection to the target group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addConnectionToGroupWithResponseAsync( + String hub, String group, String connectionId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.addConnectionToGroup( + this.client.getEndpoint(), + hub, + group, + connectionId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context)); + } + + /** + * Add a connection to the target group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addConnectionToGroupWithResponseAsync( + String hub, String group, String connectionId, RequestOptions requestOptions, Context context) { + return service.addConnectionToGroup( + this.client.getEndpoint(), + hub, + group, + connectionId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context); + } + + /** + * Add a connection to the target group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addConnectionToGroupWithResponse( + String hub, String group, String connectionId, RequestOptions requestOptions) { + return addConnectionToGroupWithResponseAsync(hub, group, connectionId, requestOptions).block(); + } + + /** + * Remove a connection from the target group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> removeConnectionFromGroupWithResponseAsync( + String hub, String group, String connectionId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.removeConnectionFromGroup( + this.client.getEndpoint(), + hub, + group, + connectionId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context)); + } + + /** + * Remove a connection from the target group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> removeConnectionFromGroupWithResponseAsync( + String hub, String group, String connectionId, RequestOptions requestOptions, Context context) { + return service.removeConnectionFromGroup( + this.client.getEndpoint(), + hub, + group, + connectionId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context); + } + + /** + * Remove a connection from the target group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response removeConnectionFromGroupWithResponse( + String hub, String group, String connectionId, RequestOptions requestOptions) { + return removeConnectionFromGroupWithResponseAsync(hub, group, connectionId, requestOptions).block(); + } + + /** + * Check if there are any client connections connected for the given user. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * boolean
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param userId Target user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> userExistsWithResponseAsync( + String hub, String userId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.userExists( + this.client.getEndpoint(), + hub, + userId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context)); + } + + /** + * Check if there are any client connections connected for the given user. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * boolean
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param userId Target user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> userExistsWithResponseAsync( + String hub, String userId, RequestOptions requestOptions, Context context) { + return service.userExists( + this.client.getEndpoint(), + hub, + userId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context); + } + + /** + * Check if there are any client connections connected for the given user. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * boolean
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param userId Target user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response userExistsWithResponse(String hub, String userId, RequestOptions requestOptions) { + return userExistsWithResponseAsync(hub, userId, requestOptions).block(); + } + + /** + * Close connections for the specific user. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExclude these connectionIds when closing the connections for the user.
reasonStringNoThe reason closing the client connection.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param userId The user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> closeUserConnectionsWithResponseAsync( + String hub, String userId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.closeUserConnections( + this.client.getEndpoint(), + hub, + userId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context)); + } + + /** + * Close connections for the specific user. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExclude these connectionIds when closing the connections for the user.
reasonStringNoThe reason closing the client connection.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param userId The user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> closeUserConnectionsWithResponseAsync( + String hub, String userId, RequestOptions requestOptions, Context context) { + return service.closeUserConnections( + this.client.getEndpoint(), + hub, + userId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context); + } + + /** + * Close connections for the specific user. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
excludedStringNoExclude these connectionIds when closing the connections for the user.
reasonStringNoThe reason closing the client connection.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param userId The user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response closeUserConnectionsWithResponse(String hub, String userId, RequestOptions requestOptions) { + return closeUserConnectionsWithResponseAsync(hub, userId, requestOptions).block(); + } + + /** + * Send content inside request body to the specific user. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Header Parameters + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
contentTypeStringYesUpload file type
contentLengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param userId The user Id. + * @param message The payload body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendToUserWithResponseAsync( + String hub, String userId, BinaryData message, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.sendToUser( + this.client.getEndpoint(), + hub, + userId, + this.client.getServiceVersion().getVersion(), + message, + requestOptions, + context)); + } + + /** + * Send content inside request body to the specific user. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Header Parameters + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
contentTypeStringYesUpload file type
contentLengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param userId The user Id. + * @param message The payload body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendToUserWithResponseAsync( + String hub, String userId, BinaryData message, RequestOptions requestOptions, Context context) { + return service.sendToUser( + this.client.getEndpoint(), + hub, + userId, + this.client.getServiceVersion().getVersion(), + message, + requestOptions, + context); + } + + /** + * Send content inside request body to the specific user. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + *

Header Parameters + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
contentTypeStringYesUpload file type
contentLengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param userId The user Id. + * @param message The payload body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendToUserWithResponse( + String hub, String userId, BinaryData message, RequestOptions requestOptions) { + return sendToUserWithResponseAsync(hub, userId, message, requestOptions).block(); + } + + /** + * Add a user to the target group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param userId Target user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addUserToGroupWithResponseAsync( + String hub, String group, String userId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.addUserToGroup( + this.client.getEndpoint(), + hub, + group, + userId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context)); + } + + /** + * Add a user to the target group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param userId Target user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addUserToGroupWithResponseAsync( + String hub, String group, String userId, RequestOptions requestOptions, Context context) { + return service.addUserToGroup( + this.client.getEndpoint(), + hub, + group, + userId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context); + } + + /** + * Add a user to the target group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param userId Target user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addUserToGroupWithResponse( + String hub, String group, String userId, RequestOptions requestOptions) { + return addUserToGroupWithResponseAsync(hub, group, userId, requestOptions).block(); + } + + /** + * Remove a user from the target group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param userId Target user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> removeUserFromGroupWithResponseAsync( + String hub, String group, String userId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.removeUserFromGroup( + this.client.getEndpoint(), + hub, + group, + userId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context)); + } + + /** + * Remove a user from the target group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param userId Target user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> removeUserFromGroupWithResponseAsync( + String hub, String group, String userId, RequestOptions requestOptions, Context context) { + return service.removeUserFromGroup( + this.client.getEndpoint(), + hub, + group, + userId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context); + } + + /** + * Remove a user from the target group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param group Target group name, which length should be greater than 0 and less than 1025. + * @param userId Target user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response removeUserFromGroupWithResponse( + String hub, String group, String userId, RequestOptions requestOptions) { + return removeUserFromGroupWithResponseAsync(hub, group, userId, requestOptions).block(); + } + + /** + * Remove a user from all groups. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param userId Target user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> removeUserFromAllGroupsWithResponseAsync( + String hub, String userId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.removeUserFromAllGroups( + this.client.getEndpoint(), + hub, + userId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context)); + } + + /** + * Remove a user from all groups. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param userId Target user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> removeUserFromAllGroupsWithResponseAsync( + String hub, String userId, RequestOptions requestOptions, Context context) { + return service.removeUserFromAllGroups( + this.client.getEndpoint(), + hub, + userId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context); + } + + /** + * Remove a user from all groups. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param userId Target user Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response removeUserFromAllGroupsWithResponse( + String hub, String userId, RequestOptions requestOptions) { + return removeUserFromAllGroupsWithResponseAsync(hub, userId, requestOptions).block(); + } + + /** + * Grant permission to the connection. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
targetNameStringNoThe meaning of the target depends on the specific permission. For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param permission The permission: current supported actions are joinLeaveGroup and sendToGroup. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> grantPermissionWithResponseAsync( + String hub, String permission, String connectionId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.grantPermission( + this.client.getEndpoint(), + hub, + permission, + connectionId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context)); + } + + /** + * Grant permission to the connection. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
targetNameStringNoThe meaning of the target depends on the specific permission. For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param permission The permission: current supported actions are joinLeaveGroup and sendToGroup. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> grantPermissionWithResponseAsync( + String hub, String permission, String connectionId, RequestOptions requestOptions, Context context) { + return service.grantPermission( + this.client.getEndpoint(), + hub, + permission, + connectionId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context); + } + + /** + * Grant permission to the connection. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
targetNameStringNoThe meaning of the target depends on the specific permission. For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param permission The permission: current supported actions are joinLeaveGroup and sendToGroup. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response grantPermissionWithResponse( + String hub, String permission, String connectionId, RequestOptions requestOptions) { + return grantPermissionWithResponseAsync(hub, permission, connectionId, requestOptions).block(); + } + + /** + * Revoke permission for the connection. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
targetNameStringNoThe meaning of the target depends on the specific permission. For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param permission The permission: current supported actions are joinLeaveGroup and sendToGroup. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> revokePermissionWithResponseAsync( + String hub, String permission, String connectionId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.revokePermission( + this.client.getEndpoint(), + hub, + permission, + connectionId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context)); + } + + /** + * Revoke permission for the connection. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
targetNameStringNoThe meaning of the target depends on the specific permission. For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param permission The permission: current supported actions are joinLeaveGroup and sendToGroup. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> revokePermissionWithResponseAsync( + String hub, String permission, String connectionId, RequestOptions requestOptions, Context context) { + return service.revokePermission( + this.client.getEndpoint(), + hub, + permission, + connectionId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context); + } + + /** + * Revoke permission for the connection. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
targetNameStringNoThe meaning of the target depends on the specific permission. For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.
apiVersionStringYesApi Version
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param permission The permission: current supported actions are joinLeaveGroup and sendToGroup. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response revokePermissionWithResponse( + String hub, String permission, String connectionId, RequestOptions requestOptions) { + return revokePermissionWithResponseAsync(hub, permission, connectionId, requestOptions).block(); + } + + /** + * Check if a connection has permission to the specified action. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
targetNameStringNoThe meaning of the target depends on the specific permission. For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * boolean
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param permission The permission: current supported actions are joinLeaveGroup and sendToGroup. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> checkPermissionWithResponseAsync( + String hub, String permission, String connectionId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.checkPermission( + this.client.getEndpoint(), + hub, + permission, + connectionId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context)); + } + + /** + * Check if a connection has permission to the specified action. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
targetNameStringNoThe meaning of the target depends on the specific permission. For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * boolean
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param permission The permission: current supported actions are joinLeaveGroup and sendToGroup. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> checkPermissionWithResponseAsync( + String hub, String permission, String connectionId, RequestOptions requestOptions, Context context) { + return service.checkPermission( + this.client.getEndpoint(), + hub, + permission, + connectionId, + this.client.getServiceVersion().getVersion(), + requestOptions, + context); + } + + /** + * Check if a connection has permission to the specified action. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
targetNameStringNoThe meaning of the target depends on the specific permission. For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.
apiVersionStringYesApi Version
+ * + *

Response Body Schema + * + *

{@code
+     * boolean
+     * }
+ * + * @param hub Target hub name, which should start with alphabetic characters and only contain alpha-numeric + * characters or underscore. + * @param permission The permission: current supported actions are joinLeaveGroup and sendToGroup. + * @param connectionId Target connection Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkPermissionWithResponse( + String hub, String permission, String connectionId, RequestOptions requestOptions) { + return checkPermissionWithResponseAsync(hub, permission, connectionId, requestOptions).block(); + } +} diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/package-info.java b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/package-info.java new file mode 100644 index 0000000000000..7aad024e3289f --- /dev/null +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/com/azure/messaging/newwebpubsub/package-info.java @@ -0,0 +1,6 @@ +// 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 WebPubSubClient. null. */ +package com.azure.messaging.newwebpubsub; diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/module-info.java b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/module-info.java new file mode 100644 index 0000000000000..0e384fa81b193 --- /dev/null +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/java/module-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.messaging.newwebpubsub { + requires transitive com.azure.core; + + exports com.azure.messaging.newwebpubsub; +} diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/resources/azure-messaging-newwebpubsub.properties b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/resources/azure-messaging-newwebpubsub.properties new file mode 100644 index 0000000000000..ca812989b4f27 --- /dev/null +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/src/main/resources/azure-messaging-newwebpubsub.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/src/samples/java/com/azure/messaging/newwebpubsub/ReadmeSamples.java b/sdk/webpubsub/azure-messaging-newwebpubsub/src/samples/java/com/azure/messaging/newwebpubsub/ReadmeSamples.java new file mode 100644 index 0000000000000..f34361696765c --- /dev/null +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/src/samples/java/com/azure/messaging/newwebpubsub/ReadmeSamples.java @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.messaging.newwebpubsub; + +public final class ReadmeSamples { + public void readmeSamples() { + // BEGIN: com.azure.messaging.newwebpubsub.readme + // END: com.azure.messaging.newwebpubsub.readme + } +} diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/src/test/java/com/azure/messaging/newwebpubsub/ClientTests.java b/sdk/webpubsub/azure-messaging-newwebpubsub/src/test/java/com/azure/messaging/newwebpubsub/ClientTests.java new file mode 100644 index 0000000000000..711c6f3802f6a --- /dev/null +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/src/test/java/com/azure/messaging/newwebpubsub/ClientTests.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.messaging.newwebpubsub; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestBase; +import com.azure.core.test.TestMode; +import com.azure.core.test.annotation.DoNotRecord; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ClientTests extends TestBase { + private WebPubSubClientBuilder builder; + + @BeforeEach + public void setup() { + builder = + new WebPubSubClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .httpClient(HttpClient.createDefault()) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)); + if (getTestMode() == TestMode.PLAYBACK) { + builder.httpClient(interceptorManager.getPlaybackClient()) + .credential(request -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX))); + } else if (getTestMode() == TestMode.RECORD) { + builder.addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else if (getTestMode() == TestMode.LIVE) { + builder.credential(new DefaultAzureCredentialBuilder().build()); + } + } + + @Test + @DoNotRecord(skipInPlayback = true) + public void testClient() { + // use the builder to create client + } +} diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/swagger/README_SPEC.md b/sdk/webpubsub/azure-messaging-newwebpubsub/swagger/README_SPEC.md new file mode 100644 index 0000000000000..8bcc2e8fabb8d --- /dev/null +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/swagger/README_SPEC.md @@ -0,0 +1,27 @@ +## Generate autorest code + +```yaml +input-file: + - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/webpubsub/data-plane/WebPubSub/stable/2021-10-01/webpubsub.json +java: true +output-folder: ../ +partial-update: true +regenerate-pom: false +title: WebPubSubClient +generate-sync-async-clients: true +generate-client-as-impl: true +generate-client-interfaces: false +add-context-parameter: true +artifact-id: azure-messaging-newwebpubsub +low-level-client: true +sync-methods: all +generate-samples: true +license-header: MICROSOFT_MIT_SMALL +namespace: com.azure.messaging.newwebpubsub +context-client-method-parameter: true +azure-arm: false +credential-types: tokencredential +credential-scopes: https://webpubsub.azure.com/.default +service-versions: + - '2021-10-01' +``` diff --git a/sdk/webpubsub/ci.yml b/sdk/webpubsub/ci.yml index 8bcbed88736e2..a4de24d5c5005 100644 --- a/sdk/webpubsub/ci.yml +++ b/sdk/webpubsub/ci.yml @@ -40,3 +40,6 @@ extends: - name: azure-resourcemanager-webpubsub groupId: com.azure.resourcemanager safeName: azureresourcemanagerwebpubsub + - name: azure-messaging-newwebpubsub + groupId: com.azure + safeName: azuremessagingnewwebpubsub diff --git a/sdk/webpubsub/pom.xml b/sdk/webpubsub/pom.xml index 20790aafca6c9..81dec25e77b85 100644 --- a/sdk/webpubsub/pom.xml +++ b/sdk/webpubsub/pom.xml @@ -51,6 +51,7 @@ true + azure-messaging-newwebpubsub azure-messaging-webpubsub azure-resourcemanager-webpubsub From 0286aa0a78d4c1ac4b4e7110ea2518bceb324a7b Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Wed, 12 Jan 2022 09:08:27 +0000 Subject: [PATCH 2/6] update readme --- sdk/webpubsub/azure-messaging-newwebpubsub/README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/README.md b/sdk/webpubsub/azure-messaging-newwebpubsub/README.md index 884e26095b0ea..017f23ff53004 100644 --- a/sdk/webpubsub/azure-messaging-newwebpubsub/README.md +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/README.md @@ -1,8 +1,6 @@ -# Azure WebPubSubClient client library for Java +# Azure Web PubSub service client library for Java -Azure WebPubSubClient client library for Java. - -This package contains Microsoft Azure WebPubSubClient client library. +Azure Web PubSub service is an Azure-managed service that helps developers easily build web applications with real-time features and publish-subscribe pattern. Any scenario that requires real-time publish-subscribe messaging between server and clients or among clients can use Azure Web PubSub service. Traditional real-time features that often require polling from server or submitting HTTP requests can also use Azure Web PubSub service. ## Documentation From a66ecb66b0d7e6a58fff3904c820dfeb85518555 Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Thu, 13 Jan 2022 04:38:02 +0000 Subject: [PATCH 3/6] update test --- .../java/com/azure/messaging/newwebpubsub/ClientTests.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/src/test/java/com/azure/messaging/newwebpubsub/ClientTests.java b/sdk/webpubsub/azure-messaging-newwebpubsub/src/test/java/com/azure/messaging/newwebpubsub/ClientTests.java index 711c6f3802f6a..e243ac5578d55 100644 --- a/sdk/webpubsub/azure-messaging-newwebpubsub/src/test/java/com/azure/messaging/newwebpubsub/ClientTests.java +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/src/test/java/com/azure/messaging/newwebpubsub/ClientTests.java @@ -16,6 +16,7 @@ import java.time.OffsetDateTime; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Assertions; import reactor.core.publisher.Mono; public final class ClientTests extends TestBase { @@ -42,6 +43,7 @@ public void setup() { @Test @DoNotRecord(skipInPlayback = true) public void testClient() { - // use the builder to create client + boolean userExists = builder.buildWebPubSubClient().userExistsWithResponse("hub", "user_id", null).getValue(); + Assertions.assertFalse(userExists); } } From 9f5c1d5849456c84eac29850829b16ce464b2af4 Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Thu, 13 Jan 2022 04:52:29 +0000 Subject: [PATCH 4/6] add sample --- sdk/webpubsub/azure-messaging-newwebpubsub/README.md | 4 ++++ .../com/azure/messaging/newwebpubsub/ReadmeSamples.java | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/README.md b/sdk/webpubsub/azure-messaging-newwebpubsub/README.md index 017f23ff53004..63e9b890871c1 100644 --- a/sdk/webpubsub/azure-messaging-newwebpubsub/README.md +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/README.md @@ -37,6 +37,10 @@ Various documentation is available to help you get started ## Examples ```java com.azure.messaging.newwebpubsub.readme +WebPubSubClient client = new WebPubSubClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildWebPubSubClient(); +boolean userExists = client.userExistsWithResponse("hub", "user_id", null).getValue(); ``` ## Troubleshooting diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/src/samples/java/com/azure/messaging/newwebpubsub/ReadmeSamples.java b/sdk/webpubsub/azure-messaging-newwebpubsub/src/samples/java/com/azure/messaging/newwebpubsub/ReadmeSamples.java index f34361696765c..668bbf45706c7 100644 --- a/sdk/webpubsub/azure-messaging-newwebpubsub/src/samples/java/com/azure/messaging/newwebpubsub/ReadmeSamples.java +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/src/samples/java/com/azure/messaging/newwebpubsub/ReadmeSamples.java @@ -4,9 +4,15 @@ package com.azure.messaging.newwebpubsub; +import com.azure.core.util.Configuration; + public final class ReadmeSamples { public void readmeSamples() { // BEGIN: com.azure.messaging.newwebpubsub.readme + WebPubSubClient client = new WebPubSubClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildWebPubSubClient(); + boolean userExists = client.userExistsWithResponse("hub", "user_id", null).getValue(); // END: com.azure.messaging.newwebpubsub.readme } } From 405fa99b91980d056a9803e101ee2c75e417105b Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Thu, 13 Jan 2022 04:56:26 +0000 Subject: [PATCH 5/6] python eng/versioning/update_versions.py --ut library --bt client --sr --- sdk/webpubsub/azure-messaging-newwebpubsub/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/pom.xml b/sdk/webpubsub/azure-messaging-newwebpubsub/pom.xml index 00b29336a3292..fccc8b892298e 100644 --- a/sdk/webpubsub/azure-messaging-newwebpubsub/pom.xml +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/pom.xml @@ -69,7 +69,7 @@ com.azure azure-identity - 1.4.2 + 1.4.3 test From 5f25383dd01ae40f57ded9a57b71aa2a29632025 Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Thu, 13 Jan 2022 05:09:23 +0000 Subject: [PATCH 6/6] python3 eng/versioning/update_versions.py --ut external_dependency --bt client --sr --- sdk/webpubsub/azure-messaging-newwebpubsub/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/webpubsub/azure-messaging-newwebpubsub/pom.xml b/sdk/webpubsub/azure-messaging-newwebpubsub/pom.xml index fccc8b892298e..104366f529800 100644 --- a/sdk/webpubsub/azure-messaging-newwebpubsub/pom.xml +++ b/sdk/webpubsub/azure-messaging-newwebpubsub/pom.xml @@ -57,7 +57,7 @@ org.junit.jupiter junit-jupiter-engine - 5.8.1 + 5.8.2 test