
com.azure.resourcemanager.eventgrid.implementation.TopicsClientImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-eventgrid Show documentation
Show all versions of azure-resourcemanager-eventgrid Show documentation
This package contains Microsoft Azure SDK for EventGrid Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure EventGrid Management Client. Package tag package-2021-10-preview.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.eventgrid.implementation;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.Delete;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.Patch;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Post;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.exception.ManagementException;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.polling.PollerFlux;
import com.azure.core.util.polling.SyncPoller;
import com.azure.resourcemanager.eventgrid.fluent.TopicsClient;
import com.azure.resourcemanager.eventgrid.fluent.models.EventTypeInner;
import com.azure.resourcemanager.eventgrid.fluent.models.TopicInner;
import com.azure.resourcemanager.eventgrid.fluent.models.TopicSharedAccessKeysInner;
import com.azure.resourcemanager.eventgrid.models.EventTypesListResult;
import com.azure.resourcemanager.eventgrid.models.TopicRegenerateKeyRequest;
import com.azure.resourcemanager.eventgrid.models.TopicsListResult;
import com.azure.resourcemanager.eventgrid.models.TopicUpdateParameters;
import java.nio.ByteBuffer;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
/**
* An instance of this class provides access to all the operations defined in TopicsClient.
*/
public final class TopicsClientImpl implements TopicsClient {
/**
* The proxy service used to perform REST calls.
*/
private final TopicsService service;
/**
* The service client containing this operation class.
*/
private final EventGridManagementClientImpl client;
/**
* Initializes an instance of TopicsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
TopicsClientImpl(EventGridManagementClientImpl client) {
this.service = RestProxy.create(TopicsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for EventGridManagementClientTopics to be used by the proxy service to
* perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "EventGridManagementC")
public interface TopicsService {
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> getByResourceGroup(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("topicName") String topicName,
@QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}")
@ExpectedResponses({ 201 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> createOrUpdate(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("topicName") String topicName,
@QueryParam("api-version") String apiVersion, @BodyParam("application/json") TopicInner topicInfo,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" })
@Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}")
@ExpectedResponses({ 202, 204 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> delete(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("topicName") String topicName,
@QueryParam("api-version") String apiVersion, Context context);
@Headers({ "Content-Type: application/json" })
@Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}")
@ExpectedResponses({ 200, 201 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> update(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("topicName") String topicName,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") TopicUpdateParameters topicUpdateParameters,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> list(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion,
@QueryParam("$filter") String filter, @QueryParam("$top") Integer top, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByResourceGroup(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion,
@QueryParam("$filter") String filter, @QueryParam("$top") Integer top, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/listKeys")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listSharedAccessKeys(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("topicName") String topicName,
@QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/regenerateKey")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> regenerateKey(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("topicName") String topicName,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") TopicRegenerateKeyRequest regenerateKeyRequest,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventTypes")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listEventTypes(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("providerNamespace") String providerNamespace,
@PathParam("resourceTypeName") String resourceTypeName, @PathParam("resourceName") String resourceName,
@QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listBySubscriptionNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByResourceGroupNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept, Context context);
}
/**
* Get a topic.
*
* Get properties of a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return properties of a topic along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, String topicName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (topicName == null) {
return Mono.error(new IllegalArgumentException("Parameter topicName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, topicName, this.client.getApiVersion(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get a topic.
*
* Get properties of a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return properties of a topic along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, String topicName,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (topicName == null) {
return Mono.error(new IllegalArgumentException("Parameter topicName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
topicName, this.client.getApiVersion(), accept, context);
}
/**
* Get a topic.
*
* Get properties of a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return properties of a topic on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono getByResourceGroupAsync(String resourceGroupName, String topicName) {
return getByResourceGroupWithResponseAsync(resourceGroupName, topicName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Get a topic.
*
* Get properties of a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return properties of a topic along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getByResourceGroupWithResponse(String resourceGroupName, String topicName,
Context context) {
return getByResourceGroupWithResponseAsync(resourceGroupName, topicName, context).block();
}
/**
* Get a topic.
*
* Get properties of a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return properties of a topic.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public TopicInner getByResourceGroup(String resourceGroupName, String topicName) {
return getByResourceGroupWithResponse(resourceGroupName, topicName, Context.NONE).getValue();
}
/**
* Create a topic.
*
* Asynchronously creates a new topic with the specified parameters.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param topicInfo Topic information.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return eventGrid Topic along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String topicName,
TopicInner topicInfo) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (topicName == null) {
return Mono.error(new IllegalArgumentException("Parameter topicName is required and cannot be null."));
}
if (topicInfo == null) {
return Mono.error(new IllegalArgumentException("Parameter topicInfo is required and cannot be null."));
} else {
topicInfo.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, topicName, this.client.getApiVersion(), topicInfo, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Create a topic.
*
* Asynchronously creates a new topic with the specified parameters.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param topicInfo Topic information.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return eventGrid Topic along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String topicName,
TopicInner topicInfo, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (topicName == null) {
return Mono.error(new IllegalArgumentException("Parameter topicName is required and cannot be null."));
}
if (topicInfo == null) {
return Mono.error(new IllegalArgumentException("Parameter topicInfo is required and cannot be null."));
} else {
topicInfo.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
topicName, this.client.getApiVersion(), topicInfo, accept, context);
}
/**
* Create a topic.
*
* Asynchronously creates a new topic with the specified parameters.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param topicInfo Topic information.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of eventGrid Topic.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, TopicInner> beginCreateOrUpdateAsync(String resourceGroupName,
String topicName, TopicInner topicInfo) {
Mono>> mono
= createOrUpdateWithResponseAsync(resourceGroupName, topicName, topicInfo);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), TopicInner.class,
TopicInner.class, this.client.getContext());
}
/**
* Create a topic.
*
* Asynchronously creates a new topic with the specified parameters.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param topicInfo Topic information.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of eventGrid Topic.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, TopicInner> beginCreateOrUpdateAsync(String resourceGroupName,
String topicName, TopicInner topicInfo, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= createOrUpdateWithResponseAsync(resourceGroupName, topicName, topicInfo, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), TopicInner.class,
TopicInner.class, context);
}
/**
* Create a topic.
*
* Asynchronously creates a new topic with the specified parameters.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param topicInfo Topic information.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of eventGrid Topic.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, TopicInner> beginCreateOrUpdate(String resourceGroupName,
String topicName, TopicInner topicInfo) {
return this.beginCreateOrUpdateAsync(resourceGroupName, topicName, topicInfo).getSyncPoller();
}
/**
* Create a topic.
*
* Asynchronously creates a new topic with the specified parameters.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param topicInfo Topic information.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of eventGrid Topic.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, TopicInner> beginCreateOrUpdate(String resourceGroupName,
String topicName, TopicInner topicInfo, Context context) {
return this.beginCreateOrUpdateAsync(resourceGroupName, topicName, topicInfo, context).getSyncPoller();
}
/**
* Create a topic.
*
* Asynchronously creates a new topic with the specified parameters.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param topicInfo Topic information.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return eventGrid Topic on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createOrUpdateAsync(String resourceGroupName, String topicName, TopicInner topicInfo) {
return beginCreateOrUpdateAsync(resourceGroupName, topicName, topicInfo).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Create a topic.
*
* Asynchronously creates a new topic with the specified parameters.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param topicInfo Topic information.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return eventGrid Topic on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createOrUpdateAsync(String resourceGroupName, String topicName, TopicInner topicInfo,
Context context) {
return beginCreateOrUpdateAsync(resourceGroupName, topicName, topicInfo, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Create a topic.
*
* Asynchronously creates a new topic with the specified parameters.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param topicInfo Topic information.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return eventGrid Topic.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public TopicInner createOrUpdate(String resourceGroupName, String topicName, TopicInner topicInfo) {
return createOrUpdateAsync(resourceGroupName, topicName, topicInfo).block();
}
/**
* Create a topic.
*
* Asynchronously creates a new topic with the specified parameters.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param topicInfo Topic information.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return eventGrid Topic.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public TopicInner createOrUpdate(String resourceGroupName, String topicName, TopicInner topicInfo,
Context context) {
return createOrUpdateAsync(resourceGroupName, topicName, topicInfo, context).block();
}
/**
* Delete a topic.
*
* Delete existing topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> deleteWithResponseAsync(String resourceGroupName, String topicName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (topicName == null) {
return Mono.error(new IllegalArgumentException("Parameter topicName is required and cannot be null."));
}
return FluxUtil
.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, topicName, this.client.getApiVersion(), context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Delete a topic.
*
* Delete existing topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> deleteWithResponseAsync(String resourceGroupName, String topicName,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (topicName == null) {
return Mono.error(new IllegalArgumentException("Parameter topicName is required and cannot be null."));
}
context = this.client.mergeContext(context);
return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, topicName,
this.client.getApiVersion(), context);
}
/**
* Delete a topic.
*
* Delete existing topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String topicName) {
Mono>> mono = deleteWithResponseAsync(resourceGroupName, topicName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Delete a topic.
*
* Delete existing topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String topicName,
Context context) {
context = this.client.mergeContext(context);
Mono>> mono = deleteWithResponseAsync(resourceGroupName, topicName, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Delete a topic.
*
* Delete existing topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginDelete(String resourceGroupName, String topicName) {
return this.beginDeleteAsync(resourceGroupName, topicName).getSyncPoller();
}
/**
* Delete a topic.
*
* Delete existing topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginDelete(String resourceGroupName, String topicName, Context context) {
return this.beginDeleteAsync(resourceGroupName, topicName, context).getSyncPoller();
}
/**
* Delete a topic.
*
* Delete existing topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono deleteAsync(String resourceGroupName, String topicName) {
return beginDeleteAsync(resourceGroupName, topicName).last().flatMap(this.client::getLroFinalResultOrError);
}
/**
* Delete a topic.
*
* Delete existing topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono deleteAsync(String resourceGroupName, String topicName, Context context) {
return beginDeleteAsync(resourceGroupName, topicName, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Delete a topic.
*
* Delete existing topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String topicName) {
deleteAsync(resourceGroupName, topicName).block();
}
/**
* Delete a topic.
*
* Delete existing topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String topicName, Context context) {
deleteAsync(resourceGroupName, topicName, context).block();
}
/**
* Update a topic.
*
* Asynchronously updates a topic with the specified parameters.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param topicUpdateParameters Topic update information.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> updateWithResponseAsync(String resourceGroupName, String topicName,
TopicUpdateParameters topicUpdateParameters) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (topicName == null) {
return Mono.error(new IllegalArgumentException("Parameter topicName is required and cannot be null."));
}
if (topicUpdateParameters == null) {
return Mono
.error(new IllegalArgumentException("Parameter topicUpdateParameters is required and cannot be null."));
} else {
topicUpdateParameters.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.update(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, topicName, this.client.getApiVersion(), topicUpdateParameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Update a topic.
*
* Asynchronously updates a topic with the specified parameters.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param topicUpdateParameters Topic update information.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> updateWithResponseAsync(String resourceGroupName, String topicName,
TopicUpdateParameters topicUpdateParameters, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (topicName == null) {
return Mono.error(new IllegalArgumentException("Parameter topicName is required and cannot be null."));
}
if (topicUpdateParameters == null) {
return Mono
.error(new IllegalArgumentException("Parameter topicUpdateParameters is required and cannot be null."));
} else {
topicUpdateParameters.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, topicName,
this.client.getApiVersion(), topicUpdateParameters, accept, context);
}
/**
* Update a topic.
*
* Asynchronously updates a topic with the specified parameters.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param topicUpdateParameters Topic update information.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, TopicInner> beginUpdateAsync(String resourceGroupName, String topicName,
TopicUpdateParameters topicUpdateParameters) {
Mono>> mono
= updateWithResponseAsync(resourceGroupName, topicName, topicUpdateParameters);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), TopicInner.class,
TopicInner.class, this.client.getContext());
}
/**
* Update a topic.
*
* Asynchronously updates a topic with the specified parameters.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param topicUpdateParameters Topic update information.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, TopicInner> beginUpdateAsync(String resourceGroupName, String topicName,
TopicUpdateParameters topicUpdateParameters, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= updateWithResponseAsync(resourceGroupName, topicName, topicUpdateParameters, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), TopicInner.class,
TopicInner.class, context);
}
/**
* Update a topic.
*
* Asynchronously updates a topic with the specified parameters.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param topicUpdateParameters Topic update information.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, TopicInner> beginUpdate(String resourceGroupName, String topicName,
TopicUpdateParameters topicUpdateParameters) {
return this.beginUpdateAsync(resourceGroupName, topicName, topicUpdateParameters).getSyncPoller();
}
/**
* Update a topic.
*
* Asynchronously updates a topic with the specified parameters.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param topicUpdateParameters Topic update information.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, TopicInner> beginUpdate(String resourceGroupName, String topicName,
TopicUpdateParameters topicUpdateParameters, Context context) {
return this.beginUpdateAsync(resourceGroupName, topicName, topicUpdateParameters, context).getSyncPoller();
}
/**
* Update a topic.
*
* Asynchronously updates a topic with the specified parameters.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param topicUpdateParameters Topic update information.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono updateAsync(String resourceGroupName, String topicName,
TopicUpdateParameters topicUpdateParameters) {
return beginUpdateAsync(resourceGroupName, topicName, topicUpdateParameters).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Update a topic.
*
* Asynchronously updates a topic with the specified parameters.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param topicUpdateParameters Topic update information.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono updateAsync(String resourceGroupName, String topicName,
TopicUpdateParameters topicUpdateParameters, Context context) {
return beginUpdateAsync(resourceGroupName, topicName, topicUpdateParameters, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Update a topic.
*
* Asynchronously updates a topic with the specified parameters.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param topicUpdateParameters Topic update information.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public TopicInner update(String resourceGroupName, String topicName, TopicUpdateParameters topicUpdateParameters) {
return updateAsync(resourceGroupName, topicName, topicUpdateParameters).block();
}
/**
* Update a topic.
*
* Asynchronously updates a topic with the specified parameters.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param topicUpdateParameters Topic update information.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public TopicInner update(String resourceGroupName, String topicName, TopicUpdateParameters topicUpdateParameters,
Context context) {
return updateAsync(resourceGroupName, topicName, topicUpdateParameters, context).block();
}
/**
* List topics under an Azure subscription.
*
* List all the topics under an Azure subscription.
*
* @param filter The query used to filter the search results using OData syntax. Filtering is permitted on the
* 'name' property only and with limited number of OData operations. These operations are: the 'contains' function
* as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic
* operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne
* 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'.
* @param top The number of results to return per page for the list operation. Valid range for top parameter is 1 to
* 100. If not specified, the default number of results to be returned is 20 items per page.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Topics operation along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(String filter, Integer top) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(),
this.client.getApiVersion(), filter, top, accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(),
res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* List topics under an Azure subscription.
*
* List all the topics under an Azure subscription.
*
* @param filter The query used to filter the search results using OData syntax. Filtering is permitted on the
* 'name' property only and with limited number of OData operations. These operations are: the 'contains' function
* as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic
* operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne
* 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'.
* @param top The number of results to return per page for the list operation. Valid range for top parameter is 1 to
* 100. If not specified, the default number of results to be returned is 20 items per page.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Topics operation along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(String filter, Integer top, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.list(this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), filter, top,
accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* List topics under an Azure subscription.
*
* List all the topics under an Azure subscription.
*
* @param filter The query used to filter the search results using OData syntax. Filtering is permitted on the
* 'name' property only and with limited number of OData operations. These operations are: the 'contains' function
* as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic
* operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne
* 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'.
* @param top The number of results to return per page for the list operation. Valid range for top parameter is 1 to
* 100. If not specified, the default number of results to be returned is 20 items per page.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Topics operation as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync(String filter, Integer top) {
return new PagedFlux<>(() -> listSinglePageAsync(filter, top),
nextLink -> listBySubscriptionNextSinglePageAsync(nextLink));
}
/**
* List topics under an Azure subscription.
*
* List all the topics under an Azure subscription.
*
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Topics operation as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync() {
final String filter = null;
final Integer top = null;
return new PagedFlux<>(() -> listSinglePageAsync(filter, top),
nextLink -> listBySubscriptionNextSinglePageAsync(nextLink));
}
/**
* List topics under an Azure subscription.
*
* List all the topics under an Azure subscription.
*
* @param filter The query used to filter the search results using OData syntax. Filtering is permitted on the
* 'name' property only and with limited number of OData operations. These operations are: the 'contains' function
* as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic
* operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne
* 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'.
* @param top The number of results to return per page for the list operation. Valid range for top parameter is 1 to
* 100. If not specified, the default number of results to be returned is 20 items per page.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Topics operation as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync(String filter, Integer top, Context context) {
return new PagedFlux<>(() -> listSinglePageAsync(filter, top, context),
nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context));
}
/**
* List topics under an Azure subscription.
*
* List all the topics under an Azure subscription.
*
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Topics operation as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list() {
final String filter = null;
final Integer top = null;
return new PagedIterable<>(listAsync(filter, top));
}
/**
* List topics under an Azure subscription.
*
* List all the topics under an Azure subscription.
*
* @param filter The query used to filter the search results using OData syntax. Filtering is permitted on the
* 'name' property only and with limited number of OData operations. These operations are: the 'contains' function
* as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic
* operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne
* 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'.
* @param top The number of results to return per page for the list operation. Valid range for top parameter is 1 to
* 100. If not specified, the default number of results to be returned is 20 items per page.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Topics operation as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(String filter, Integer top, Context context) {
return new PagedIterable<>(listAsync(filter, top, context));
}
/**
* List topics under a resource group.
*
* List all the topics under a resource group.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param filter The query used to filter the search results using OData syntax. Filtering is permitted on the
* 'name' property only and with limited number of OData operations. These operations are: the 'contains' function
* as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic
* operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne
* 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'.
* @param top The number of results to return per page for the list operation. Valid range for top parameter is 1 to
* 100. If not specified, the default number of results to be returned is 20 items per page.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Topics operation along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, String filter,
Integer top) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, this.client.getApiVersion(), filter, top, accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(),
res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* List topics under a resource group.
*
* List all the topics under a resource group.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param filter The query used to filter the search results using OData syntax. Filtering is permitted on the
* 'name' property only and with limited number of OData operations. These operations are: the 'contains' function
* as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic
* operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne
* 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'.
* @param top The number of results to return per page for the list operation. Valid range for top parameter is 1 to
* 100. If not specified, the default number of results to be returned is 20 items per page.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Topics operation along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, String filter,
Integer top, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.listByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
this.client.getApiVersion(), filter, top, accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* List topics under a resource group.
*
* List all the topics under a resource group.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param filter The query used to filter the search results using OData syntax. Filtering is permitted on the
* 'name' property only and with limited number of OData operations. These operations are: the 'contains' function
* as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic
* operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne
* 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'.
* @param top The number of results to return per page for the list operation. Valid range for top parameter is 1 to
* 100. If not specified, the default number of results to be returned is 20 items per page.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Topics operation as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByResourceGroupAsync(String resourceGroupName, String filter, Integer top) {
return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, filter, top),
nextLink -> listByResourceGroupNextSinglePageAsync(nextLink));
}
/**
* List topics under a resource group.
*
* List all the topics under a resource group.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Topics operation as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByResourceGroupAsync(String resourceGroupName) {
final String filter = null;
final Integer top = null;
return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, filter, top),
nextLink -> listByResourceGroupNextSinglePageAsync(nextLink));
}
/**
* List topics under a resource group.
*
* List all the topics under a resource group.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param filter The query used to filter the search results using OData syntax. Filtering is permitted on the
* 'name' property only and with limited number of OData operations. These operations are: the 'contains' function
* as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic
* operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne
* 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'.
* @param top The number of results to return per page for the list operation. Valid range for top parameter is 1 to
* 100. If not specified, the default number of results to be returned is 20 items per page.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Topics operation as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByResourceGroupAsync(String resourceGroupName, String filter, Integer top,
Context context) {
return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, filter, top, context),
nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context));
}
/**
* List topics under a resource group.
*
* List all the topics under a resource group.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Topics operation as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByResourceGroup(String resourceGroupName) {
final String filter = null;
final Integer top = null;
return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter, top));
}
/**
* List topics under a resource group.
*
* List all the topics under a resource group.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param filter The query used to filter the search results using OData syntax. Filtering is permitted on the
* 'name' property only and with limited number of OData operations. These operations are: the 'contains' function
* as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic
* operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne
* 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'.
* @param top The number of results to return per page for the list operation. Valid range for top parameter is 1 to
* 100. If not specified, the default number of results to be returned is 20 items per page.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Topics operation as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByResourceGroup(String resourceGroupName, String filter, Integer top,
Context context) {
return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter, top, context));
}
/**
* List keys for a topic.
*
* List the two keys used to publish to a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return shared access keys of the Topic along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSharedAccessKeysWithResponseAsync(String resourceGroupName,
String topicName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (topicName == null) {
return Mono.error(new IllegalArgumentException("Parameter topicName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.listSharedAccessKeys(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, topicName, this.client.getApiVersion(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* List keys for a topic.
*
* List the two keys used to publish to a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return shared access keys of the Topic along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSharedAccessKeysWithResponseAsync(String resourceGroupName,
String topicName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (topicName == null) {
return Mono.error(new IllegalArgumentException("Parameter topicName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.listSharedAccessKeys(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, topicName, this.client.getApiVersion(), accept, context);
}
/**
* List keys for a topic.
*
* List the two keys used to publish to a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return shared access keys of the Topic on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono listSharedAccessKeysAsync(String resourceGroupName, String topicName) {
return listSharedAccessKeysWithResponseAsync(resourceGroupName, topicName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* List keys for a topic.
*
* List the two keys used to publish to a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return shared access keys of the Topic along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response listSharedAccessKeysWithResponse(String resourceGroupName,
String topicName, Context context) {
return listSharedAccessKeysWithResponseAsync(resourceGroupName, topicName, context).block();
}
/**
* List keys for a topic.
*
* List the two keys used to publish to a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return shared access keys of the Topic.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public TopicSharedAccessKeysInner listSharedAccessKeys(String resourceGroupName, String topicName) {
return listSharedAccessKeysWithResponse(resourceGroupName, topicName, Context.NONE).getValue();
}
/**
* Regenerate key for a topic.
*
* Regenerate a shared access key for a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param regenerateKeyRequest Request body to regenerate key.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return shared access keys of the Topic along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> regenerateKeyWithResponseAsync(String resourceGroupName, String topicName,
TopicRegenerateKeyRequest regenerateKeyRequest) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (topicName == null) {
return Mono.error(new IllegalArgumentException("Parameter topicName is required and cannot be null."));
}
if (regenerateKeyRequest == null) {
return Mono
.error(new IllegalArgumentException("Parameter regenerateKeyRequest is required and cannot be null."));
} else {
regenerateKeyRequest.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.regenerateKey(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, topicName, this.client.getApiVersion(), regenerateKeyRequest, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Regenerate key for a topic.
*
* Regenerate a shared access key for a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param regenerateKeyRequest Request body to regenerate key.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return shared access keys of the Topic along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> regenerateKeyWithResponseAsync(String resourceGroupName, String topicName,
TopicRegenerateKeyRequest regenerateKeyRequest, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (topicName == null) {
return Mono.error(new IllegalArgumentException("Parameter topicName is required and cannot be null."));
}
if (regenerateKeyRequest == null) {
return Mono
.error(new IllegalArgumentException("Parameter regenerateKeyRequest is required and cannot be null."));
} else {
regenerateKeyRequest.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.regenerateKey(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
topicName, this.client.getApiVersion(), regenerateKeyRequest, accept, context);
}
/**
* Regenerate key for a topic.
*
* Regenerate a shared access key for a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param regenerateKeyRequest Request body to regenerate key.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of shared access keys of the Topic.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, TopicSharedAccessKeysInner> beginRegenerateKeyAsync(
String resourceGroupName, String topicName, TopicRegenerateKeyRequest regenerateKeyRequest) {
Mono>> mono
= regenerateKeyWithResponseAsync(resourceGroupName, topicName, regenerateKeyRequest);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), TopicSharedAccessKeysInner.class, TopicSharedAccessKeysInner.class,
this.client.getContext());
}
/**
* Regenerate key for a topic.
*
* Regenerate a shared access key for a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param regenerateKeyRequest Request body to regenerate key.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of shared access keys of the Topic.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, TopicSharedAccessKeysInner> beginRegenerateKeyAsync(
String resourceGroupName, String topicName, TopicRegenerateKeyRequest regenerateKeyRequest, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= regenerateKeyWithResponseAsync(resourceGroupName, topicName, regenerateKeyRequest, context);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), TopicSharedAccessKeysInner.class, TopicSharedAccessKeysInner.class, context);
}
/**
* Regenerate key for a topic.
*
* Regenerate a shared access key for a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param regenerateKeyRequest Request body to regenerate key.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of shared access keys of the Topic.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, TopicSharedAccessKeysInner>
beginRegenerateKey(String resourceGroupName, String topicName, TopicRegenerateKeyRequest regenerateKeyRequest) {
return this.beginRegenerateKeyAsync(resourceGroupName, topicName, regenerateKeyRequest).getSyncPoller();
}
/**
* Regenerate key for a topic.
*
* Regenerate a shared access key for a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param regenerateKeyRequest Request body to regenerate key.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of shared access keys of the Topic.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, TopicSharedAccessKeysInner> beginRegenerateKey(
String resourceGroupName, String topicName, TopicRegenerateKeyRequest regenerateKeyRequest, Context context) {
return this.beginRegenerateKeyAsync(resourceGroupName, topicName, regenerateKeyRequest, context)
.getSyncPoller();
}
/**
* Regenerate key for a topic.
*
* Regenerate a shared access key for a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param regenerateKeyRequest Request body to regenerate key.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return shared access keys of the Topic on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono regenerateKeyAsync(String resourceGroupName, String topicName,
TopicRegenerateKeyRequest regenerateKeyRequest) {
return beginRegenerateKeyAsync(resourceGroupName, topicName, regenerateKeyRequest).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Regenerate key for a topic.
*
* Regenerate a shared access key for a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param regenerateKeyRequest Request body to regenerate key.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return shared access keys of the Topic on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono regenerateKeyAsync(String resourceGroupName, String topicName,
TopicRegenerateKeyRequest regenerateKeyRequest, Context context) {
return beginRegenerateKeyAsync(resourceGroupName, topicName, regenerateKeyRequest, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Regenerate key for a topic.
*
* Regenerate a shared access key for a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param regenerateKeyRequest Request body to regenerate key.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return shared access keys of the Topic.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public TopicSharedAccessKeysInner regenerateKey(String resourceGroupName, String topicName,
TopicRegenerateKeyRequest regenerateKeyRequest) {
return regenerateKeyAsync(resourceGroupName, topicName, regenerateKeyRequest).block();
}
/**
* Regenerate key for a topic.
*
* Regenerate a shared access key for a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param topicName Name of the topic.
* @param regenerateKeyRequest Request body to regenerate key.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return shared access keys of the Topic.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public TopicSharedAccessKeysInner regenerateKey(String resourceGroupName, String topicName,
TopicRegenerateKeyRequest regenerateKeyRequest, Context context) {
return regenerateKeyAsync(resourceGroupName, topicName, regenerateKeyRequest, context).block();
}
/**
* List topic event types.
*
* List event types for a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param providerNamespace Namespace of the provider of the topic.
* @param resourceTypeName Name of the topic type.
* @param resourceName Name of the topic.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Event Types operation along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listEventTypesSinglePageAsync(String resourceGroupName,
String providerNamespace, String resourceTypeName, String resourceName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (providerNamespace == null) {
return Mono
.error(new IllegalArgumentException("Parameter providerNamespace is required and cannot be null."));
}
if (resourceTypeName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceTypeName is required and cannot be null."));
}
if (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.listEventTypes(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, providerNamespace, resourceTypeName, resourceName, this.client.getApiVersion(),
accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(),
res.getHeaders(), res.getValue().value(), null, null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* List topic event types.
*
* List event types for a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param providerNamespace Namespace of the provider of the topic.
* @param resourceTypeName Name of the topic type.
* @param resourceName Name of the topic.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Event Types operation along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listEventTypesSinglePageAsync(String resourceGroupName,
String providerNamespace, String resourceTypeName, String resourceName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (providerNamespace == null) {
return Mono
.error(new IllegalArgumentException("Parameter providerNamespace is required and cannot be null."));
}
if (resourceTypeName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceTypeName is required and cannot be null."));
}
if (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.listEventTypes(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
providerNamespace, resourceTypeName, resourceName, this.client.getApiVersion(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), null, null));
}
/**
* List topic event types.
*
* List event types for a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param providerNamespace Namespace of the provider of the topic.
* @param resourceTypeName Name of the topic type.
* @param resourceName Name of the topic.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Event Types operation as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listEventTypesAsync(String resourceGroupName, String providerNamespace,
String resourceTypeName, String resourceName) {
return new PagedFlux<>(
() -> listEventTypesSinglePageAsync(resourceGroupName, providerNamespace, resourceTypeName, resourceName));
}
/**
* List topic event types.
*
* List event types for a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param providerNamespace Namespace of the provider of the topic.
* @param resourceTypeName Name of the topic type.
* @param resourceName Name of the topic.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Event Types operation as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listEventTypesAsync(String resourceGroupName, String providerNamespace,
String resourceTypeName, String resourceName, Context context) {
return new PagedFlux<>(() -> listEventTypesSinglePageAsync(resourceGroupName, providerNamespace,
resourceTypeName, resourceName, context));
}
/**
* List topic event types.
*
* List event types for a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param providerNamespace Namespace of the provider of the topic.
* @param resourceTypeName Name of the topic type.
* @param resourceName Name of the topic.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Event Types operation as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listEventTypes(String resourceGroupName, String providerNamespace,
String resourceTypeName, String resourceName) {
return new PagedIterable<>(
listEventTypesAsync(resourceGroupName, providerNamespace, resourceTypeName, resourceName));
}
/**
* List topic event types.
*
* List event types for a topic.
*
* @param resourceGroupName The name of the resource group within the user's subscription.
* @param providerNamespace Namespace of the provider of the topic.
* @param resourceTypeName Name of the topic type.
* @param resourceName Name of the topic.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Event Types operation as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listEventTypes(String resourceGroupName, String providerNamespace,
String resourceTypeName, String resourceName, Context context) {
return new PagedIterable<>(
listEventTypesAsync(resourceGroupName, providerNamespace, resourceTypeName, resourceName, context));
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items
*
* The nextLink parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Topics operation along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(),
res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items
*
* The nextLink parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Topics operation along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items
*
* The nextLink parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Topics operation along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(),
res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items
*
* The nextLink parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the List Topics operation along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy