Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpubsub 2021-10-01 #24760

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions sdk/webpubsub/azure-messaging-webpubsub/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@
<version>1.3.7</version> <!-- {x-version-update;com.azure:azure-identity;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.32</version> <!-- {x-version-update;org.slf4j:slf4j-simple;external_dependency} -->
<scope>test</scope>
</dependency>

<dependency>
<groupId>javax.websocket</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,12 @@ Mono<Response<BinaryData>> generateClientTokenWithResponse(RequestOptions reques
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> sendToAllWithResponse(
BinaryData message, WebPubSubContentType contentType, long contentLength, RequestOptions requestOptions) {
return this.serviceClient.sendToAllWithResponseAsync(hub, contentType.toString(), message, contentLength, requestOptions);
if (requestOptions == null) {
requestOptions = new RequestOptions();
}
requestOptions.addHeader("contentType", contentType.toString());
requestOptions.addHeader("contentLength", String.valueOf(contentLength));
return this.serviceClient.sendToAllWithResponseAsync(hub, message, requestOptions);
}

/**
Expand Down Expand Up @@ -187,7 +192,7 @@ public Mono<Response<Boolean>> connectionExistsWithResponse(
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> closeConnectionWithResponse(
String connectionId, RequestOptions requestOptions) {
return this.serviceClient.closeClientConnectionWithResponseAsync(hub, connectionId, requestOptions);
return this.serviceClient.closeConnectionWithResponseAsync(hub, connectionId, requestOptions);
}

/**
Expand All @@ -209,8 +214,13 @@ public Mono<Response<Void>> sendToConnectionWithResponse(
WebPubSubContentType contentType,
long contentLength,
RequestOptions requestOptions) {
if (requestOptions == null) {
requestOptions = new RequestOptions();
}
requestOptions.addHeader("contentType", contentType.toString());
requestOptions.addHeader("contentLength", String.valueOf(contentLength));
return this.serviceClient.sendToConnectionWithResponseAsync(
hub, connectionId, contentType.toString(), message, contentLength, requestOptions);
hub, connectionId, message, requestOptions);
}

/**
Expand Down Expand Up @@ -280,8 +290,13 @@ public Mono<Response<Void>> sendToGroupWithResponse(
WebPubSubContentType contentType,
long contentLength,
RequestOptions requestOptions) {
if (requestOptions == null) {
requestOptions = new RequestOptions();
}
requestOptions.addHeader("contentType", contentType.toString());
requestOptions.addHeader("contentLength", String.valueOf(contentLength));
return this.serviceClient.sendToGroupWithResponseAsync(
hub, group, contentType.toString(), message, contentLength, requestOptions);
hub, group, message, requestOptions);
}

/**
Expand Down Expand Up @@ -382,8 +397,13 @@ public Mono<Response<Void>> sendToUserWithResponse(
WebPubSubContentType contentType,
long contentLength,
RequestOptions requestOptions) {
if (requestOptions == null) {
requestOptions = new RequestOptions();
}
requestOptions.addHeader("contentType", contentType.toString());
requestOptions.addHeader("contentLength", String.valueOf(contentLength));
return this.serviceClient.sendToUserWithResponseAsync(
hub, userId, contentType.toString(), message, contentLength, requestOptions);
hub, userId, message, requestOptions);
}

/**
Expand Down Expand Up @@ -513,4 +533,83 @@ public Mono<Response<Boolean>> checkPermissionWithResponse(
String permission, String connectionId, RequestOptions requestOptions) {
return this.serviceClient.checkPermissionWithResponseAsync(hub, permission, connectionId, requestOptions);
}

/**
* Close the connections in the hub.
*
* <p><strong>Query Parameters</strong>
*
* <table border="1">
* <caption>Query Parameters</caption>
* <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
* <tr><td>excluded</td><td>String</td><td>No</td><td>Exclude these connectionIds when closing the connections in the hub.</td></tr>
* <tr><td>reason</td><td>String</td><td>No</td><td>The reason closing the client connection.</td></tr>
* <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
* </table>
*
* @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 status code is 400 or above, if throwOnError in requestOptions is not
* false.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> closeAllConnectionsWithResponse(String hub, RequestOptions requestOptions) {
return this.serviceClient.closeAllConnectionsWithResponseAsync(hub, requestOptions);
}

/**
* Close connections in the specific group.
*
* <p><strong>Query Parameters</strong>
*
* <table border="1">
* <caption>Query Parameters</caption>
* <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
* <tr><td>excluded</td><td>String</td><td>No</td><td>Exclude these connectionIds when closing the connections in the group.</td></tr>
* <tr><td>reason</td><td>String</td><td>No</td><td>The reason closing the client connection.</td></tr>
* <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
* </table>
*
* @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 status code is 400 or above, if throwOnError in requestOptions is not
* false.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> closeGroupConnectionsWithResponse(
String hub, String group, RequestOptions requestOptions) {
return this.serviceClient.closeGroupConnectionsWithResponseAsync(hub, group, requestOptions);
}

/**
* Close connections for the specific user.
*
* <p><strong>Query Parameters</strong>
*
* <table border="1">
* <caption>Query Parameters</caption>
* <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
* <tr><td>excluded</td><td>String</td><td>No</td><td>Exclude these connectionIds when closing the connections for the user.</td></tr>
* <tr><td>reason</td><td>String</td><td>No</td><td>The reason closing the client connection.</td></tr>
* <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
* </table>
*
* @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 status code is 400 or above, if throwOnError in requestOptions is not
* false.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> closeUserConnectionsWithResponse(
String hub, String userId, RequestOptions requestOptions) {
return this.serviceClient.closeUserConnectionsWithResponseAsync(hub, userId, requestOptions);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,13 @@ public Response<Void> sendToAllWithResponse(
long contentLength,
RequestOptions requestOptions,
Context context) {
if (requestOptions == null) {
requestOptions = new RequestOptions();
}
requestOptions.addHeader("contentType", contentType.toString());
requestOptions.addHeader("contentLength", String.valueOf(contentLength));
return this.serviceClient.sendToAllWithResponse(
hub, contentType.toString(), message, contentLength, requestOptions, context);
hub, message, requestOptions, context);
}

/**
Expand Down Expand Up @@ -192,7 +197,7 @@ public Response<Boolean> connectionExistsWithResponse(
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<Void> closeConnectionWithResponse(
String connectionId, RequestOptions requestOptions, Context context) {
return this.serviceClient.closeClientConnectionWithResponse(hub, connectionId, requestOptions, context);
return this.serviceClient.closeConnectionWithResponse(hub, connectionId, requestOptions, context);
}

/**
Expand All @@ -216,8 +221,13 @@ public Response<Void> sendToConnectionWithResponse(
long contentLength,
RequestOptions requestOptions,
Context context) {
if (requestOptions == null) {
requestOptions = new RequestOptions();
}
requestOptions.addHeader("contentType", contentType.toString());
requestOptions.addHeader("contentLength", String.valueOf(contentLength));
return this.serviceClient.sendToConnectionWithResponse(
hub, connectionId, contentType.toString(), message, contentLength, requestOptions, context);
hub, connectionId, message, requestOptions, context);
}

/**
Expand Down Expand Up @@ -291,8 +301,13 @@ public Response<Void> sendToGroupWithResponse(
long contentLength,
RequestOptions requestOptions,
Context context) {
if (requestOptions == null) {
requestOptions = new RequestOptions();
}
requestOptions.addHeader("contentType", contentType.toString());
requestOptions.addHeader("contentLength", String.valueOf(contentLength));
return this.serviceClient.sendToGroupWithResponse(
hub, group, contentType.toString(), message, contentLength, requestOptions, context);
hub, group, message, requestOptions, context);
}

/**
Expand Down Expand Up @@ -399,8 +414,13 @@ public Response<Void> sendToUserWithResponse(
long contentLength,
RequestOptions requestOptions,
Context context) {
if (requestOptions == null) {
requestOptions = new RequestOptions();
}
requestOptions.addHeader("contentType", contentType.toString());
requestOptions.addHeader("contentLength", String.valueOf(contentLength));
return this.serviceClient.sendToUserWithResponse(
hub, userId, contentType.toString(), message, contentLength, requestOptions, context);
hub, userId, message, requestOptions, context);
}

/**
Expand Down Expand Up @@ -535,4 +555,86 @@ public Response<Boolean> checkPermissionWithResponse(
String permission, String connectionId, RequestOptions requestOptions, Context context) {
return this.serviceClient.checkPermissionWithResponse(hub, permission, connectionId, requestOptions, context);
}

/**
* Close the connections in the hub.
*
* <p><strong>Query Parameters</strong>
*
* <table border="1">
* <caption>Query Parameters</caption>
* <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
* <tr><td>excluded</td><td>String</td><td>No</td><td>Exclude these connectionIds when closing the connections in the hub.</td></tr>
* <tr><td>reason</td><td>String</td><td>No</td><td>The reason closing the client connection.</td></tr>
* <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
* </table>
*
* @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 status code is 400 or above, if throwOnError in requestOptions is not
* false.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<Void> closeAllConnectionsWithResponse(String hub, RequestOptions requestOptions, Context context) {
return this.serviceClient.closeAllConnectionsWithResponse(hub, requestOptions, context);
}

/**
* Close connections in the specific group.
*
* <p><strong>Query Parameters</strong>
*
* <table border="1">
* <caption>Query Parameters</caption>
* <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
* <tr><td>excluded</td><td>String</td><td>No</td><td>Exclude these connectionIds when closing the connections in the group.</td></tr>
* <tr><td>reason</td><td>String</td><td>No</td><td>The reason closing the client connection.</td></tr>
* <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
* </table>
*
* @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 status code is 400 or above, if throwOnError in requestOptions is not
* false.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<Void> closeGroupConnectionsWithResponse(
String hub, String group, RequestOptions requestOptions, Context context) {
return this.serviceClient.closeGroupConnectionsWithResponse(hub, group, requestOptions, context);
}

/**
* Close connections for the specific user.
*
* <p><strong>Query Parameters</strong>
*
* <table border="1">
* <caption>Query Parameters</caption>
* <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
* <tr><td>excluded</td><td>String</td><td>No</td><td>Exclude these connectionIds when closing the connections for the user.</td></tr>
* <tr><td>reason</td><td>String</td><td>No</td><td>The reason closing the client connection.</td></tr>
* <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
* </table>
*
* @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 status code is 400 or above, if throwOnError in requestOptions is not
* false.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<Void> closeUserConnectionsWithResponse(
String hub, String userId, RequestOptions requestOptions, Context context) {
return this.serviceClient.closeUserConnectionsWithResponse(hub, userId, requestOptions, context);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ private AzureWebPubSubServiceRestAPIImpl buildInnerClient() {


if (pipeline != null) {
return new AzureWebPubSubServiceRestAPIImpl(pipeline, endpoint, serviceVersion.toString());
return new AzureWebPubSubServiceRestAPIImpl(pipeline, endpoint, serviceVersion);
}

// Global Env configuration store
Expand Down Expand Up @@ -396,7 +396,7 @@ private AzureWebPubSubServiceRestAPIImpl buildInnerClient() {
.policies(policies.toArray(new HttpPipelinePolicy[0]))
.httpClient(httpClient)
.build();
return new AzureWebPubSubServiceRestAPIImpl(buildPipeline, endpoint, serviceVersion.toString());
return new AzureWebPubSubServiceRestAPIImpl(buildPipeline, endpoint, serviceVersion);
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.messaging.webpubsub;

import com.azure.core.util.ServiceVersion;

/**
* The versions of Azure Web Pub Sub Service supported by this client library.
*/
/** Service version of WebPubSubService. */
public enum WebPubSubServiceVersion implements ServiceVersion {
/** Enum value 2021-05-01-preview. */
V2021_05_01_PREVIEW("2021-05-01-preview"),
V2021_08_01_PREVIEW("2021-08-01-preview");

/** Enum value 2021-08-01-preview. */
V2021_08_01_PREVIEW("2021-08-01-preview"),

/** Enum value 2021-10-01. */
V2021_10_01("2021-10-01");

private final String version;

WebPubSubServiceVersion(final String version) {
WebPubSubServiceVersion(String version) {
this.version = version;
}

Expand All @@ -24,11 +29,11 @@ public String getVersion() {
}

/**
* Gets the latest service version supported by this client library
* Gets the latest service version supported by this client library.
*
* @return the latest {@code WebPubSubServiceVersion}
* @return The latest {@link WebPubSubServiceVersion}.
*/
public static WebPubSubServiceVersion getLatest() {
return V2021_08_01_PREVIEW;
return V2021_10_01;
}
}
Loading