com.azure.resourcemanager.servicebus.implementation.RulesClientImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-servicebus Show documentation
Show all versions of azure-resourcemanager-servicebus Show documentation
This package contains Microsoft Azure ServiceBus Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.servicebus.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.PathParam;
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.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.resourcemanager.servicebus.fluent.RulesClient;
import com.azure.resourcemanager.servicebus.fluent.models.RuleInner;
import com.azure.resourcemanager.servicebus.models.RuleListResult;
import reactor.core.publisher.Mono;
/**
* An instance of this class provides access to all the operations defined in RulesClient.
*/
public final class RulesClientImpl implements RulesClient {
/**
* The proxy service used to perform REST calls.
*/
private final RulesService service;
/**
* The service client containing this operation class.
*/
private final ServiceBusManagementClientImpl client;
/**
* Initializes an instance of RulesClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
RulesClientImpl(ServiceBusManagementClientImpl client) {
this.service = RestProxy.create(RulesService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for ServiceBusManagementClientRules to be used by the proxy service to
* perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "ServiceBusManagement")
public interface RulesService {
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listBySubscriptions(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName,
@PathParam("topicName") String topicName, @PathParam("subscriptionName") String subscriptionName,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@QueryParam("$skip") Integer skip, @QueryParam("$top") Integer top, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Content-Type: application/json" })
@Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> createOrUpdate(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName,
@PathParam("topicName") String topicName, @PathParam("subscriptionName") String subscriptionName,
@PathParam("ruleName") String ruleName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId, @BodyParam("application/json") RuleInner parameters,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}")
@ExpectedResponses({ 200, 204 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> delete(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName,
@PathParam("topicName") String topicName, @PathParam("subscriptionName") String subscriptionName,
@PathParam("ruleName") String ruleName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> get(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("namespaceName") String namespaceName,
@PathParam("topicName") String topicName, @PathParam("subscriptionName") String subscriptionName,
@PathParam("ruleName") String ruleName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listBySubscriptionsNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept, Context context);
}
/**
* List all the rules within given topic-subscription.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param namespaceName The namespace name.
* @param topicName The topic name.
* @param subscriptionName The subscription name.
* @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains
* a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting
* point to use for subsequent calls.
* @param top May be used to limit the number of results to the most recent N usageDetails.
* @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 of the List rule operation along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listBySubscriptionsSinglePageAsync(String resourceGroupName,
String namespaceName, String topicName, String subscriptionName, Integer skip, Integer top) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (namespaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null."));
}
if (topicName == null) {
return Mono.error(new IllegalArgumentException("Parameter topicName is required and cannot be null."));
}
if (subscriptionName == null) {
return Mono
.error(new IllegalArgumentException("Parameter subscriptionName 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.listBySubscriptions(this.client.getEndpoint(), resourceGroupName,
namespaceName, topicName, subscriptionName, this.client.getApiVersion(),
this.client.getSubscriptionId(), skip, 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 all the rules within given topic-subscription.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param namespaceName The namespace name.
* @param topicName The topic name.
* @param subscriptionName The subscription name.
* @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains
* a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting
* point to use for subsequent calls.
* @param top May be used to limit the number of results to the most recent N usageDetails.
* @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 of the List rule operation along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listBySubscriptionsSinglePageAsync(String resourceGroupName,
String namespaceName, String topicName, String subscriptionName, Integer skip, 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 (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (namespaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null."));
}
if (topicName == null) {
return Mono.error(new IllegalArgumentException("Parameter topicName is required and cannot be null."));
}
if (subscriptionName == null) {
return Mono
.error(new IllegalArgumentException("Parameter subscriptionName 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.listBySubscriptions(this.client.getEndpoint(), resourceGroupName, namespaceName, topicName,
subscriptionName, this.client.getApiVersion(), this.client.getSubscriptionId(), skip, top, accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* List all the rules within given topic-subscription.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param namespaceName The namespace name.
* @param topicName The topic name.
* @param subscriptionName The subscription name.
* @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains
* a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting
* point to use for subsequent calls.
* @param top May be used to limit the number of results to the most recent N usageDetails.
* @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 of the List rule operation as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listBySubscriptionsAsync(String resourceGroupName, String namespaceName,
String topicName, String subscriptionName, Integer skip, Integer top) {
return new PagedFlux<>(() -> listBySubscriptionsSinglePageAsync(resourceGroupName, namespaceName, topicName,
subscriptionName, skip, top), nextLink -> listBySubscriptionsNextSinglePageAsync(nextLink));
}
/**
* List all the rules within given topic-subscription.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param namespaceName The namespace name.
* @param topicName The topic name.
* @param subscriptionName The subscription name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response of the List rule operation as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listBySubscriptionsAsync(String resourceGroupName, String namespaceName,
String topicName, String subscriptionName) {
final Integer skip = null;
final Integer top = null;
return new PagedFlux<>(() -> listBySubscriptionsSinglePageAsync(resourceGroupName, namespaceName, topicName,
subscriptionName, skip, top), nextLink -> listBySubscriptionsNextSinglePageAsync(nextLink));
}
/**
* List all the rules within given topic-subscription.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param namespaceName The namespace name.
* @param topicName The topic name.
* @param subscriptionName The subscription name.
* @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains
* a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting
* point to use for subsequent calls.
* @param top May be used to limit the number of results to the most recent N usageDetails.
* @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 of the List rule operation as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listBySubscriptionsAsync(String resourceGroupName, String namespaceName,
String topicName, String subscriptionName, Integer skip, Integer top, Context context) {
return new PagedFlux<>(() -> listBySubscriptionsSinglePageAsync(resourceGroupName, namespaceName, topicName,
subscriptionName, skip, top, context),
nextLink -> listBySubscriptionsNextSinglePageAsync(nextLink, context));
}
/**
* List all the rules within given topic-subscription.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param namespaceName The namespace name.
* @param topicName The topic name.
* @param subscriptionName The subscription name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response of the List rule operation as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listBySubscriptions(String resourceGroupName, String namespaceName,
String topicName, String subscriptionName) {
final Integer skip = null;
final Integer top = null;
return new PagedIterable<>(
listBySubscriptionsAsync(resourceGroupName, namespaceName, topicName, subscriptionName, skip, top));
}
/**
* List all the rules within given topic-subscription.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param namespaceName The namespace name.
* @param topicName The topic name.
* @param subscriptionName The subscription name.
* @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains
* a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting
* point to use for subsequent calls.
* @param top May be used to limit the number of results to the most recent N usageDetails.
* @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 of the List rule operation as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listBySubscriptions(String resourceGroupName, String namespaceName,
String topicName, String subscriptionName, Integer skip, Integer top, Context context) {
return new PagedIterable<>(listBySubscriptionsAsync(resourceGroupName, namespaceName, topicName,
subscriptionName, skip, top, context));
}
/**
* Creates a new rule and updates an existing rule.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param namespaceName The namespace name.
* @param topicName The topic name.
* @param subscriptionName The subscription name.
* @param ruleName The rule name.
* @param parameters Parameters supplied to create a rule.
* @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 description of Rule Resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> createOrUpdateWithResponseAsync(String resourceGroupName, String namespaceName,
String topicName, String subscriptionName, String ruleName, RuleInner parameters) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (namespaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null."));
}
if (topicName == null) {
return Mono.error(new IllegalArgumentException("Parameter topicName is required and cannot be null."));
}
if (subscriptionName == null) {
return Mono
.error(new IllegalArgumentException("Parameter subscriptionName is required and cannot be null."));
}
if (ruleName == null) {
return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.createOrUpdate(this.client.getEndpoint(), resourceGroupName, namespaceName,
topicName, subscriptionName, ruleName, this.client.getApiVersion(), this.client.getSubscriptionId(),
parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Creates a new rule and updates an existing rule.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param namespaceName The namespace name.
* @param topicName The topic name.
* @param subscriptionName The subscription name.
* @param ruleName The rule name.
* @param parameters Parameters supplied to create a rule.
* @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 description of Rule Resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, String namespaceName,
String topicName, String subscriptionName, String ruleName, RuleInner parameters, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (namespaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null."));
}
if (topicName == null) {
return Mono.error(new IllegalArgumentException("Parameter topicName is required and cannot be null."));
}
if (subscriptionName == null) {
return Mono
.error(new IllegalArgumentException("Parameter subscriptionName is required and cannot be null."));
}
if (ruleName == null) {
return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.createOrUpdate(this.client.getEndpoint(), resourceGroupName, namespaceName, topicName,
subscriptionName, ruleName, this.client.getApiVersion(), this.client.getSubscriptionId(), parameters,
accept, context);
}
/**
* Creates a new rule and updates an existing rule.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param namespaceName The namespace name.
* @param topicName The topic name.
* @param subscriptionName The subscription name.
* @param ruleName The rule name.
* @param parameters Parameters supplied to create a rule.
* @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 description of Rule Resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono createOrUpdateAsync(String resourceGroupName, String namespaceName, String topicName,
String subscriptionName, String ruleName, RuleInner parameters) {
return createOrUpdateWithResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName,
parameters).flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Creates a new rule and updates an existing rule.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param namespaceName The namespace name.
* @param topicName The topic name.
* @param subscriptionName The subscription name.
* @param ruleName The rule name.
* @param parameters Parameters supplied to create a rule.
* @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 description of Rule Resource along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response createOrUpdateWithResponse(String resourceGroupName, String namespaceName,
String topicName, String subscriptionName, String ruleName, RuleInner parameters, Context context) {
return createOrUpdateWithResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName,
parameters, context).block();
}
/**
* Creates a new rule and updates an existing rule.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param namespaceName The namespace name.
* @param topicName The topic name.
* @param subscriptionName The subscription name.
* @param ruleName The rule name.
* @param parameters Parameters supplied to create a rule.
* @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 description of Rule Resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public RuleInner createOrUpdate(String resourceGroupName, String namespaceName, String topicName,
String subscriptionName, String ruleName, RuleInner parameters) {
return createOrUpdateWithResponse(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName,
parameters, Context.NONE).getValue();
}
/**
* Deletes an existing rule.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param namespaceName The namespace name.
* @param topicName The topic name.
* @param subscriptionName The subscription name.
* @param ruleName The rule name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> deleteWithResponseAsync(String resourceGroupName, String namespaceName,
String topicName, String subscriptionName, String ruleName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (namespaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null."));
}
if (topicName == null) {
return Mono.error(new IllegalArgumentException("Parameter topicName is required and cannot be null."));
}
if (subscriptionName == null) {
return Mono
.error(new IllegalArgumentException("Parameter subscriptionName is required and cannot be null."));
}
if (ruleName == null) {
return Mono.error(new IllegalArgumentException("Parameter ruleName 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.delete(this.client.getEndpoint(), resourceGroupName, namespaceName,
topicName, subscriptionName, ruleName, this.client.getApiVersion(), this.client.getSubscriptionId(),
accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Deletes an existing rule.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param namespaceName The namespace name.
* @param topicName The topic name.
* @param subscriptionName The subscription name.
* @param ruleName The rule name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> deleteWithResponseAsync(String resourceGroupName, String namespaceName,
String topicName, String subscriptionName, String ruleName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (namespaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null."));
}
if (topicName == null) {
return Mono.error(new IllegalArgumentException("Parameter topicName is required and cannot be null."));
}
if (subscriptionName == null) {
return Mono
.error(new IllegalArgumentException("Parameter subscriptionName is required and cannot be null."));
}
if (ruleName == null) {
return Mono.error(new IllegalArgumentException("Parameter ruleName 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.delete(this.client.getEndpoint(), resourceGroupName, namespaceName, topicName, subscriptionName,
ruleName, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context);
}
/**
* Deletes an existing rule.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param namespaceName The namespace name.
* @param topicName The topic name.
* @param subscriptionName The subscription name.
* @param ruleName The rule name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono deleteAsync(String resourceGroupName, String namespaceName, String topicName,
String subscriptionName, String ruleName) {
return deleteWithResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName)
.flatMap(ignored -> Mono.empty());
}
/**
* Deletes an existing rule.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param namespaceName The namespace name.
* @param topicName The topic name.
* @param subscriptionName The subscription name.
* @param ruleName The rule name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response deleteWithResponse(String resourceGroupName, String namespaceName, String topicName,
String subscriptionName, String ruleName, Context context) {
return deleteWithResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName, context)
.block();
}
/**
* Deletes an existing rule.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param namespaceName The namespace name.
* @param topicName The topic name.
* @param subscriptionName The subscription name.
* @param ruleName The rule name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String namespaceName, String topicName, String subscriptionName,
String ruleName) {
deleteWithResponse(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName, Context.NONE);
}
/**
* Retrieves the description for the specified rule.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param namespaceName The namespace name.
* @param topicName The topic name.
* @param subscriptionName The subscription name.
* @param ruleName The rule name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return description of Rule Resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> getWithResponseAsync(String resourceGroupName, String namespaceName,
String topicName, String subscriptionName, String ruleName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (namespaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null."));
}
if (topicName == null) {
return Mono.error(new IllegalArgumentException("Parameter topicName is required and cannot be null."));
}
if (subscriptionName == null) {
return Mono
.error(new IllegalArgumentException("Parameter subscriptionName is required and cannot be null."));
}
if (ruleName == null) {
return Mono.error(new IllegalArgumentException("Parameter ruleName 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.get(this.client.getEndpoint(), resourceGroupName, namespaceName, topicName,
subscriptionName, ruleName, this.client.getApiVersion(), this.client.getSubscriptionId(), accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Retrieves the description for the specified rule.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param namespaceName The namespace name.
* @param topicName The topic name.
* @param subscriptionName The subscription name.
* @param ruleName The rule name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return description of Rule Resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceGroupName, String namespaceName,
String topicName, String subscriptionName, String ruleName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (namespaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null."));
}
if (topicName == null) {
return Mono.error(new IllegalArgumentException("Parameter topicName is required and cannot be null."));
}
if (subscriptionName == null) {
return Mono
.error(new IllegalArgumentException("Parameter subscriptionName is required and cannot be null."));
}
if (ruleName == null) {
return Mono.error(new IllegalArgumentException("Parameter ruleName 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.get(this.client.getEndpoint(), resourceGroupName, namespaceName, topicName, subscriptionName,
ruleName, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context);
}
/**
* Retrieves the description for the specified rule.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param namespaceName The namespace name.
* @param topicName The topic name.
* @param subscriptionName The subscription name.
* @param ruleName The rule name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return description of Rule Resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono getAsync(String resourceGroupName, String namespaceName, String topicName,
String subscriptionName, String ruleName) {
return getWithResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Retrieves the description for the specified rule.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param namespaceName The namespace name.
* @param topicName The topic name.
* @param subscriptionName The subscription name.
* @param ruleName The rule name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return description of Rule Resource along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(String resourceGroupName, String namespaceName, String topicName,
String subscriptionName, String ruleName, Context context) {
return getWithResponseAsync(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName, context)
.block();
}
/**
* Retrieves the description for the specified rule.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param namespaceName The namespace name.
* @param topicName The topic name.
* @param subscriptionName The subscription name.
* @param ruleName The rule name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return description of Rule Resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public RuleInner get(String resourceGroupName, String namespaceName, String topicName, String subscriptionName,
String ruleName) {
return getWithResponse(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName, Context.NONE)
.getValue();
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items.
* @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 of the List rule operation along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listBySubscriptionsNextSinglePageAsync(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.listBySubscriptionsNext(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.
* @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 of the List rule operation along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listBySubscriptionsNextSinglePageAsync(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.listBySubscriptionsNext(nextLink, this.client.getEndpoint(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy