com.azure.resourcemanager.redis.implementation.FirewallRulesClientImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-redis Show documentation
Show all versions of azure-resourcemanager-redis Show documentation
This package contains Microsoft Azure Redis Cache SDK.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.redis.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.redis.fluent.FirewallRulesClient;
import com.azure.resourcemanager.redis.fluent.models.RedisFirewallRuleInner;
import com.azure.resourcemanager.redis.models.RedisFirewallRuleListResult;
import reactor.core.publisher.Mono;
/**
* An instance of this class provides access to all the operations defined in FirewallRulesClient.
*/
public final class FirewallRulesClientImpl implements FirewallRulesClient {
/**
* The proxy service used to perform REST calls.
*/
private final FirewallRulesService service;
/**
* The service client containing this operation class.
*/
private final RedisManagementClientImpl client;
/**
* Initializes an instance of FirewallRulesClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
FirewallRulesClientImpl(RedisManagementClientImpl client) {
this.service
= RestProxy.create(FirewallRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for RedisManagementClientFirewallRules to be used by the proxy service to
* perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "RedisManagementClien")
public interface FirewallRulesService {
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> list(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("cacheName") String cacheName,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}")
@ExpectedResponses({ 200, 201 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> createOrUpdate(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("cacheName") String cacheName,
@PathParam("ruleName") String ruleName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") RedisFirewallRuleInner parameters, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> get(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("cacheName") String cacheName,
@PathParam("ruleName") String ruleName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}")
@ExpectedResponses({ 200, 204 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> delete(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("cacheName") String cacheName,
@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> listNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept, Context context);
}
/**
* Gets all firewall rules in the specified redis cache.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param cacheName The name of the Redis cache.
* @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 all firewall rules in the specified redis cache along with {@link PagedResponse} on successful completion
* of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(String resourceGroupName,
String cacheName) {
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 (cacheName == null) {
return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(),
this.client.getSubscriptionId(), resourceGroupName, cacheName, 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()));
}
/**
* Gets all firewall rules in the specified redis cache.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param cacheName The name of the Redis cache.
* @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 all firewall rules in the specified redis cache along with {@link PagedResponse} on successful completion
* of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(String resourceGroupName, String cacheName,
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 (cacheName == null) {
return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(),
resourceGroupName, cacheName, accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* Gets all firewall rules in the specified redis cache.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param cacheName The name of the Redis cache.
* @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 all firewall rules in the specified redis cache as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listAsync(String resourceGroupName, String cacheName) {
return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, cacheName),
nextLink -> listNextSinglePageAsync(nextLink));
}
/**
* Gets all firewall rules in the specified redis cache.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param cacheName The name of the Redis cache.
* @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 all firewall rules in the specified redis cache as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync(String resourceGroupName, String cacheName, Context context) {
return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, cacheName, context),
nextLink -> listNextSinglePageAsync(nextLink, context));
}
/**
* Gets all firewall rules in the specified redis cache.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param cacheName The name of the Redis cache.
* @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 all firewall rules in the specified redis cache as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(String resourceGroupName, String cacheName) {
return new PagedIterable<>(listAsync(resourceGroupName, cacheName));
}
/**
* Gets all firewall rules in the specified redis cache.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param cacheName The name of the Redis cache.
* @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 all firewall rules in the specified redis cache as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(String resourceGroupName, String cacheName, Context context) {
return new PagedIterable<>(listAsync(resourceGroupName, cacheName, context));
}
/**
* Create or update a redis cache firewall rule.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param cacheName The name of the Redis cache.
* @param ruleName The name of the firewall rule.
* @param parameters Parameters supplied to the create or update redis firewall rule 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 firewall rule on a redis cache has a name, and describes a contiguous range of IP addresses permitted
* to connect along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> createOrUpdateWithResponseAsync(String resourceGroupName,
String cacheName, String ruleName, RedisFirewallRuleInner 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 (cacheName == null) {
return Mono.error(new IllegalArgumentException("Parameter cacheName 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, cacheName,
ruleName, this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Create or update a redis cache firewall rule.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param cacheName The name of the Redis cache.
* @param ruleName The name of the firewall rule.
* @param parameters Parameters supplied to the create or update redis firewall rule operation.
* @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 firewall rule on a redis cache has a name, and describes a contiguous range of IP addresses permitted
* to connect along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> createOrUpdateWithResponseAsync(String resourceGroupName,
String cacheName, String ruleName, RedisFirewallRuleInner 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 (cacheName == null) {
return Mono.error(new IllegalArgumentException("Parameter cacheName 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, cacheName, ruleName,
this.client.getApiVersion(), this.client.getSubscriptionId(), parameters, accept, context);
}
/**
* Create or update a redis cache firewall rule.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param cacheName The name of the Redis cache.
* @param ruleName The name of the firewall rule.
* @param parameters Parameters supplied to the create or update redis firewall rule 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 firewall rule on a redis cache has a name, and describes a contiguous range of IP addresses permitted
* to connect on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono createOrUpdateAsync(String resourceGroupName, String cacheName, String ruleName,
RedisFirewallRuleInner parameters) {
return createOrUpdateWithResponseAsync(resourceGroupName, cacheName, ruleName, parameters)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Create or update a redis cache firewall rule.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param cacheName The name of the Redis cache.
* @param ruleName The name of the firewall rule.
* @param parameters Parameters supplied to the create or update redis firewall rule operation.
* @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 firewall rule on a redis cache has a name, and describes a contiguous range of IP addresses permitted
* to connect along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response createOrUpdateWithResponse(String resourceGroupName, String cacheName,
String ruleName, RedisFirewallRuleInner parameters, Context context) {
return createOrUpdateWithResponseAsync(resourceGroupName, cacheName, ruleName, parameters, context).block();
}
/**
* Create or update a redis cache firewall rule.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param cacheName The name of the Redis cache.
* @param ruleName The name of the firewall rule.
* @param parameters Parameters supplied to the create or update redis firewall rule 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 firewall rule on a redis cache has a name, and describes a contiguous range of IP addresses permitted
* to connect.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public RedisFirewallRuleInner createOrUpdate(String resourceGroupName, String cacheName, String ruleName,
RedisFirewallRuleInner parameters) {
return createOrUpdateWithResponse(resourceGroupName, cacheName, ruleName, parameters, Context.NONE).getValue();
}
/**
* Gets a single firewall rule in a specified redis cache.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param cacheName The name of the Redis cache.
* @param ruleName The name of the firewall 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 a single firewall rule in a specified redis cache along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> getWithResponseAsync(String resourceGroupName, String cacheName,
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 (cacheName == null) {
return Mono.error(new IllegalArgumentException("Parameter cacheName 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, cacheName, ruleName,
this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Gets a single firewall rule in a specified redis cache.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param cacheName The name of the Redis cache.
* @param ruleName The name of the firewall 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 a single firewall rule in a specified redis cache along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceGroupName, String cacheName,
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 (cacheName == null) {
return Mono.error(new IllegalArgumentException("Parameter cacheName 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, cacheName, ruleName,
this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context);
}
/**
* Gets a single firewall rule in a specified redis cache.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param cacheName The name of the Redis cache.
* @param ruleName The name of the firewall 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 a single firewall rule in a specified redis cache on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono getAsync(String resourceGroupName, String cacheName, String ruleName) {
return getWithResponseAsync(resourceGroupName, cacheName, ruleName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Gets a single firewall rule in a specified redis cache.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param cacheName The name of the Redis cache.
* @param ruleName The name of the firewall 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 a single firewall rule in a specified redis cache along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(String resourceGroupName, String cacheName, String ruleName,
Context context) {
return getWithResponseAsync(resourceGroupName, cacheName, ruleName, context).block();
}
/**
* Gets a single firewall rule in a specified redis cache.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param cacheName The name of the Redis cache.
* @param ruleName The name of the firewall 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 a single firewall rule in a specified redis cache.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public RedisFirewallRuleInner get(String resourceGroupName, String cacheName, String ruleName) {
return getWithResponse(resourceGroupName, cacheName, ruleName, Context.NONE).getValue();
}
/**
* Deletes a single firewall rule in a specified redis cache.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param cacheName The name of the Redis cache.
* @param ruleName The name of the firewall 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 the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> deleteWithResponseAsync(String resourceGroupName, String cacheName, 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 (cacheName == null) {
return Mono.error(new IllegalArgumentException("Parameter cacheName 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, cacheName, ruleName,
this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Deletes a single firewall rule in a specified redis cache.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param cacheName The name of the Redis cache.
* @param ruleName The name of the firewall 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 the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> deleteWithResponseAsync(String resourceGroupName, String cacheName, 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 (cacheName == null) {
return Mono.error(new IllegalArgumentException("Parameter cacheName 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, cacheName, ruleName,
this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context);
}
/**
* Deletes a single firewall rule in a specified redis cache.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param cacheName The name of the Redis cache.
* @param ruleName The name of the firewall 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 A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono deleteAsync(String resourceGroupName, String cacheName, String ruleName) {
return deleteWithResponseAsync(resourceGroupName, cacheName, ruleName).flatMap(ignored -> Mono.empty());
}
/**
* Deletes a single firewall rule in a specified redis cache.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param cacheName The name of the Redis cache.
* @param ruleName The name of the firewall 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 the {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response deleteWithResponse(String resourceGroupName, String cacheName, String ruleName,
Context context) {
return deleteWithResponseAsync(resourceGroupName, cacheName, ruleName, context).block();
}
/**
* Deletes a single firewall rule in a specified redis cache.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param cacheName The name of the Redis cache.
* @param ruleName The name of the firewall 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.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String cacheName, String ruleName) {
deleteWithResponse(resourceGroupName, cacheName, ruleName, Context.NONE);
}
/**
* 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 list firewall rules Redis operation along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listNextSinglePageAsync(String nextLink) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(),
res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.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 list firewall rules Redis operation along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listNextSinglePageAsync(String nextLink, Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.listNext(nextLink, this.client.getEndpoint(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
}