
com.azure.resourcemanager.network.implementation.ExpressRouteConnectionsClientImpl Maven / Gradle / Ivy
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.network.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.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.network.fluent.ExpressRouteConnectionsClient;
import com.azure.resourcemanager.network.fluent.models.ExpressRouteConnectionInner;
import com.azure.resourcemanager.network.fluent.models.ExpressRouteConnectionListInner;
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 ExpressRouteConnectionsClient.
*/
public final class ExpressRouteConnectionsClientImpl implements ExpressRouteConnectionsClient {
/**
* The proxy service used to perform REST calls.
*/
private final ExpressRouteConnectionsService service;
/**
* The service client containing this operation class.
*/
private final NetworkManagementClientImpl client;
/**
* Initializes an instance of ExpressRouteConnectionsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
ExpressRouteConnectionsClientImpl(NetworkManagementClientImpl client) {
this.service = RestProxy.create(ExpressRouteConnectionsService.class, client.getHttpPipeline(),
client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for NetworkManagementClientExpressRouteConnections to be used by the
* proxy service to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "NetworkManagementCli")
public interface ExpressRouteConnectionsService {
@Headers({ "Content-Type: application/json" })
@Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName}")
@ExpectedResponses({ 200, 201 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> createOrUpdate(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("expressRouteGatewayName") String expressRouteGatewayName,
@PathParam("connectionName") String connectionName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") ExpressRouteConnectionInner putExpressRouteConnectionParameters,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> get(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("expressRouteGatewayName") String expressRouteGatewayName,
@PathParam("connectionName") String connectionName, @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.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName}")
@ExpectedResponses({ 200, 202, 204 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> delete(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("expressRouteGatewayName") String expressRouteGatewayName,
@PathParam("connectionName") String connectionName, @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.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> list(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("expressRouteGatewayName") String expressRouteGatewayName,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@HeaderParam("Accept") String accept, Context context);
}
/**
* Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the connection subresource.
* @param putExpressRouteConnectionParameters Parameters required in an ExpressRouteConnection PUT 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 expressRouteConnection resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> createOrUpdateWithResponseAsync(String resourceGroupName,
String expressRouteGatewayName, String connectionName,
ExpressRouteConnectionInner putExpressRouteConnectionParameters) {
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 (expressRouteGatewayName == null) {
return Mono.error(
new IllegalArgumentException("Parameter expressRouteGatewayName is required and cannot be null."));
}
if (connectionName == null) {
return Mono.error(new IllegalArgumentException("Parameter connectionName 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 (putExpressRouteConnectionParameters == null) {
return Mono.error(new IllegalArgumentException(
"Parameter putExpressRouteConnectionParameters is required and cannot be null."));
} else {
putExpressRouteConnectionParameters.validate();
}
final String apiVersion = "2024-03-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.createOrUpdate(this.client.getEndpoint(), resourceGroupName,
expressRouteGatewayName, connectionName, apiVersion, this.client.getSubscriptionId(),
putExpressRouteConnectionParameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the connection subresource.
* @param putExpressRouteConnectionParameters Parameters required in an ExpressRouteConnection PUT 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 expressRouteConnection resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName,
String expressRouteGatewayName, String connectionName,
ExpressRouteConnectionInner putExpressRouteConnectionParameters, 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 (expressRouteGatewayName == null) {
return Mono.error(
new IllegalArgumentException("Parameter expressRouteGatewayName is required and cannot be null."));
}
if (connectionName == null) {
return Mono.error(new IllegalArgumentException("Parameter connectionName 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 (putExpressRouteConnectionParameters == null) {
return Mono.error(new IllegalArgumentException(
"Parameter putExpressRouteConnectionParameters is required and cannot be null."));
} else {
putExpressRouteConnectionParameters.validate();
}
final String apiVersion = "2024-03-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.createOrUpdate(this.client.getEndpoint(), resourceGroupName, expressRouteGatewayName,
connectionName, apiVersion, this.client.getSubscriptionId(), putExpressRouteConnectionParameters, accept,
context);
}
/**
* Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the connection subresource.
* @param putExpressRouteConnectionParameters Parameters required in an ExpressRouteConnection PUT 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 expressRouteConnection resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, ExpressRouteConnectionInner> beginCreateOrUpdateAsync(
String resourceGroupName, String expressRouteGatewayName, String connectionName,
ExpressRouteConnectionInner putExpressRouteConnectionParameters) {
Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName,
expressRouteGatewayName, connectionName, putExpressRouteConnectionParameters);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), ExpressRouteConnectionInner.class, ExpressRouteConnectionInner.class,
this.client.getContext());
}
/**
* Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the connection subresource.
* @param putExpressRouteConnectionParameters Parameters required in an ExpressRouteConnection PUT 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 the {@link PollerFlux} for polling of expressRouteConnection resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, ExpressRouteConnectionInner> beginCreateOrUpdateAsync(
String resourceGroupName, String expressRouteGatewayName, String connectionName,
ExpressRouteConnectionInner putExpressRouteConnectionParameters, Context context) {
context = this.client.mergeContext(context);
Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName,
expressRouteGatewayName, connectionName, putExpressRouteConnectionParameters, context);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), ExpressRouteConnectionInner.class, ExpressRouteConnectionInner.class,
context);
}
/**
* Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the connection subresource.
* @param putExpressRouteConnectionParameters Parameters required in an ExpressRouteConnection PUT 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 expressRouteConnection resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ExpressRouteConnectionInner> beginCreateOrUpdate(
String resourceGroupName, String expressRouteGatewayName, String connectionName,
ExpressRouteConnectionInner putExpressRouteConnectionParameters) {
return this
.beginCreateOrUpdateAsync(resourceGroupName, expressRouteGatewayName, connectionName,
putExpressRouteConnectionParameters)
.getSyncPoller();
}
/**
* Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the connection subresource.
* @param putExpressRouteConnectionParameters Parameters required in an ExpressRouteConnection PUT 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 the {@link SyncPoller} for polling of expressRouteConnection resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ExpressRouteConnectionInner> beginCreateOrUpdate(
String resourceGroupName, String expressRouteGatewayName, String connectionName,
ExpressRouteConnectionInner putExpressRouteConnectionParameters, Context context) {
return this
.beginCreateOrUpdateAsync(resourceGroupName, expressRouteGatewayName, connectionName,
putExpressRouteConnectionParameters, context)
.getSyncPoller();
}
/**
* Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the connection subresource.
* @param putExpressRouteConnectionParameters Parameters required in an ExpressRouteConnection PUT 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 expressRouteConnection resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono createOrUpdateAsync(String resourceGroupName,
String expressRouteGatewayName, String connectionName,
ExpressRouteConnectionInner putExpressRouteConnectionParameters) {
return beginCreateOrUpdateAsync(resourceGroupName, expressRouteGatewayName, connectionName,
putExpressRouteConnectionParameters).last().flatMap(this.client::getLroFinalResultOrError);
}
/**
* Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the connection subresource.
* @param putExpressRouteConnectionParameters Parameters required in an ExpressRouteConnection PUT 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 expressRouteConnection resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createOrUpdateAsync(String resourceGroupName,
String expressRouteGatewayName, String connectionName,
ExpressRouteConnectionInner putExpressRouteConnectionParameters, Context context) {
return beginCreateOrUpdateAsync(resourceGroupName, expressRouteGatewayName, connectionName,
putExpressRouteConnectionParameters, context).last().flatMap(this.client::getLroFinalResultOrError);
}
/**
* Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the connection subresource.
* @param putExpressRouteConnectionParameters Parameters required in an ExpressRouteConnection PUT 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 expressRouteConnection resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ExpressRouteConnectionInner createOrUpdate(String resourceGroupName, String expressRouteGatewayName,
String connectionName, ExpressRouteConnectionInner putExpressRouteConnectionParameters) {
return createOrUpdateAsync(resourceGroupName, expressRouteGatewayName, connectionName,
putExpressRouteConnectionParameters).block();
}
/**
* Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the connection subresource.
* @param putExpressRouteConnectionParameters Parameters required in an ExpressRouteConnection PUT 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 expressRouteConnection resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ExpressRouteConnectionInner createOrUpdate(String resourceGroupName, String expressRouteGatewayName,
String connectionName, ExpressRouteConnectionInner putExpressRouteConnectionParameters, Context context) {
return createOrUpdateAsync(resourceGroupName, expressRouteGatewayName, connectionName,
putExpressRouteConnectionParameters, context).block();
}
/**
* Gets the specified ExpressRouteConnection.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the ExpressRoute connection.
* @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 specified ExpressRouteConnection along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> getWithResponseAsync(String resourceGroupName,
String expressRouteGatewayName, String connectionName) {
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 (expressRouteGatewayName == null) {
return Mono.error(
new IllegalArgumentException("Parameter expressRouteGatewayName is required and cannot be null."));
}
if (connectionName == null) {
return Mono.error(new IllegalArgumentException("Parameter connectionName 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 apiVersion = "2024-03-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.get(this.client.getEndpoint(), resourceGroupName, expressRouteGatewayName,
connectionName, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Gets the specified ExpressRouteConnection.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the ExpressRoute connection.
* @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 specified ExpressRouteConnection along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceGroupName,
String expressRouteGatewayName, String connectionName, 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 (expressRouteGatewayName == null) {
return Mono.error(
new IllegalArgumentException("Parameter expressRouteGatewayName is required and cannot be null."));
}
if (connectionName == null) {
return Mono.error(new IllegalArgumentException("Parameter connectionName 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 apiVersion = "2024-03-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.get(this.client.getEndpoint(), resourceGroupName, expressRouteGatewayName, connectionName,
apiVersion, this.client.getSubscriptionId(), accept, context);
}
/**
* Gets the specified ExpressRouteConnection.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the ExpressRoute connection.
* @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 specified ExpressRouteConnection on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono getAsync(String resourceGroupName, String expressRouteGatewayName,
String connectionName) {
return getWithResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Gets the specified ExpressRouteConnection.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the ExpressRoute connection.
* @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 specified ExpressRouteConnection along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(String resourceGroupName,
String expressRouteGatewayName, String connectionName, Context context) {
return getWithResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName, context).block();
}
/**
* Gets the specified ExpressRouteConnection.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the ExpressRoute connection.
* @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 specified ExpressRouteConnection.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ExpressRouteConnectionInner get(String resourceGroupName, String expressRouteGatewayName,
String connectionName) {
return getWithResponse(resourceGroupName, expressRouteGatewayName, connectionName, Context.NONE).getValue();
}
/**
* Deletes a connection to a ExpressRoute circuit.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the connection subresource.
* @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 expressRouteGatewayName, String connectionName) {
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 (expressRouteGatewayName == null) {
return Mono.error(
new IllegalArgumentException("Parameter expressRouteGatewayName is required and cannot be null."));
}
if (connectionName == null) {
return Mono.error(new IllegalArgumentException("Parameter connectionName 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 apiVersion = "2024-03-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.delete(this.client.getEndpoint(), resourceGroupName,
expressRouteGatewayName, connectionName, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Deletes a connection to a ExpressRoute circuit.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the connection subresource.
* @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 expressRouteGatewayName, String connectionName, 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 (expressRouteGatewayName == null) {
return Mono.error(
new IllegalArgumentException("Parameter expressRouteGatewayName is required and cannot be null."));
}
if (connectionName == null) {
return Mono.error(new IllegalArgumentException("Parameter connectionName 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 apiVersion = "2024-03-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.delete(this.client.getEndpoint(), resourceGroupName, expressRouteGatewayName, connectionName,
apiVersion, this.client.getSubscriptionId(), accept, context);
}
/**
* Deletes a connection to a ExpressRoute circuit.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the connection subresource.
* @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)
public PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String expressRouteGatewayName,
String connectionName) {
Mono>> mono
= deleteWithResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Deletes a connection to a ExpressRoute circuit.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the connection subresource.
* @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 expressRouteGatewayName, String connectionName, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= deleteWithResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Deletes a connection to a ExpressRoute circuit.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the connection subresource.
* @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 expressRouteGatewayName,
String connectionName) {
return this.beginDeleteAsync(resourceGroupName, expressRouteGatewayName, connectionName).getSyncPoller();
}
/**
* Deletes a connection to a ExpressRoute circuit.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the connection subresource.
* @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 expressRouteGatewayName,
String connectionName, Context context) {
return this.beginDeleteAsync(resourceGroupName, expressRouteGatewayName, connectionName, context)
.getSyncPoller();
}
/**
* Deletes a connection to a ExpressRoute circuit.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the connection subresource.
* @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 expressRouteGatewayName, String connectionName) {
return beginDeleteAsync(resourceGroupName, expressRouteGatewayName, connectionName).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes a connection to a ExpressRoute circuit.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the connection subresource.
* @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 expressRouteGatewayName, String connectionName,
Context context) {
return beginDeleteAsync(resourceGroupName, expressRouteGatewayName, connectionName, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes a connection to a ExpressRoute circuit.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the connection subresource.
* @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 expressRouteGatewayName, String connectionName) {
deleteAsync(resourceGroupName, expressRouteGatewayName, connectionName).block();
}
/**
* Deletes a connection to a ExpressRoute circuit.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @param connectionName The name of the connection subresource.
* @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 expressRouteGatewayName, String connectionName,
Context context) {
deleteAsync(resourceGroupName, expressRouteGatewayName, connectionName, context).block();
}
/**
* Lists ExpressRouteConnections.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @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 expressRouteConnection list along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> listWithResponseAsync(String resourceGroupName,
String expressRouteGatewayName) {
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 (expressRouteGatewayName == null) {
return Mono.error(
new IllegalArgumentException("Parameter expressRouteGatewayName 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 apiVersion = "2024-03-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.list(this.client.getEndpoint(), resourceGroupName, expressRouteGatewayName,
apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Lists ExpressRouteConnections.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @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 expressRouteConnection list along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listWithResponseAsync(String resourceGroupName,
String expressRouteGatewayName, 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 (expressRouteGatewayName == null) {
return Mono.error(
new IllegalArgumentException("Parameter expressRouteGatewayName 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 apiVersion = "2024-03-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.list(this.client.getEndpoint(), resourceGroupName, expressRouteGatewayName, apiVersion,
this.client.getSubscriptionId(), accept, context);
}
/**
* Lists ExpressRouteConnections.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @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 expressRouteConnection list on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono listAsync(String resourceGroupName, String expressRouteGatewayName) {
return listWithResponseAsync(resourceGroupName, expressRouteGatewayName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Lists ExpressRouteConnections.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @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 expressRouteConnection list along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response listWithResponse(String resourceGroupName,
String expressRouteGatewayName, Context context) {
return listWithResponseAsync(resourceGroupName, expressRouteGatewayName, context).block();
}
/**
* Lists ExpressRouteConnections.
*
* @param resourceGroupName The name of the resource group.
* @param expressRouteGatewayName The name of the ExpressRoute gateway.
* @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 expressRouteConnection list.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ExpressRouteConnectionListInner list(String resourceGroupName, String expressRouteGatewayName) {
return listWithResponse(resourceGroupName, expressRouteGatewayName, Context.NONE).getValue();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy