com.azure.resourcemanager.network.implementation.VpnLinkConnectionsClientImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-network Show documentation
Show all versions of azure-resourcemanager-network Show documentation
This package contains Microsoft Azure Network 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.network.implementation;
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.Post;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.exception.ManagementException;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.polling.PollerFlux;
import com.azure.core.util.polling.SyncPoller;
import com.azure.resourcemanager.network.fluent.VpnLinkConnectionsClient;
import com.azure.resourcemanager.network.fluent.models.VpnSiteLinkConnectionInner;
import com.azure.resourcemanager.network.models.ListVpnSiteLinkConnectionsResult;
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 VpnLinkConnectionsClient.
*/
public final class VpnLinkConnectionsClientImpl implements VpnLinkConnectionsClient {
/**
* The proxy service used to perform REST calls.
*/
private final VpnLinkConnectionsService service;
/**
* The service client containing this operation class.
*/
private final NetworkManagementClientImpl client;
/**
* Initializes an instance of VpnLinkConnectionsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
VpnLinkConnectionsClientImpl(NetworkManagementClientImpl client) {
this.service = RestProxy.create(VpnLinkConnectionsService.class, client.getHttpPipeline(),
client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for NetworkManagementClientVpnLinkConnections to be used by the proxy
* service to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "NetworkManagementCli")
public interface VpnLinkConnectionsService {
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}/resetconnection")
@ExpectedResponses({ 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> resetConnection(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("gatewayName") String gatewayName,
@PathParam("connectionName") String connectionName,
@PathParam("linkConnectionName") String linkConnectionName, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}/getikesas")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> getIkeSas(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("gatewayName") String gatewayName,
@PathParam("connectionName") String connectionName,
@PathParam("linkConnectionName") String linkConnectionName, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByVpnConnection(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("gatewayName") String gatewayName,
@PathParam("connectionName") String connectionName, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByVpnConnectionNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept, Context context);
}
/**
* Resets the VpnLink connection specified.
*
* @param resourceGroupName The name of the resource group.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn connection.
* @param linkConnectionName The name of the vpn link 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 {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> resetConnectionWithResponseAsync(String resourceGroupName,
String gatewayName, String connectionName, String linkConnectionName) {
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 (gatewayName == null) {
return Mono.error(new IllegalArgumentException("Parameter gatewayName is required and cannot be null."));
}
if (connectionName == null) {
return Mono.error(new IllegalArgumentException("Parameter connectionName is required and cannot be null."));
}
if (linkConnectionName == null) {
return Mono
.error(new IllegalArgumentException("Parameter linkConnectionName is required and cannot be null."));
}
final String apiVersion = "2023-11-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.resetConnection(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, gatewayName, connectionName, linkConnectionName, apiVersion, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Resets the VpnLink connection specified.
*
* @param resourceGroupName The name of the resource group.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn connection.
* @param linkConnectionName The name of the vpn link 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 {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> resetConnectionWithResponseAsync(String resourceGroupName,
String gatewayName, String connectionName, String linkConnectionName, 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 (gatewayName == null) {
return Mono.error(new IllegalArgumentException("Parameter gatewayName is required and cannot be null."));
}
if (connectionName == null) {
return Mono.error(new IllegalArgumentException("Parameter connectionName is required and cannot be null."));
}
if (linkConnectionName == null) {
return Mono
.error(new IllegalArgumentException("Parameter linkConnectionName is required and cannot be null."));
}
final String apiVersion = "2023-11-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.resetConnection(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
gatewayName, connectionName, linkConnectionName, apiVersion, accept, context);
}
/**
* Resets the VpnLink connection specified.
*
* @param resourceGroupName The name of the resource group.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn connection.
* @param linkConnectionName The name of the vpn link 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 {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginResetConnectionAsync(String resourceGroupName, String gatewayName,
String connectionName, String linkConnectionName) {
Mono>> mono
= resetConnectionWithResponseAsync(resourceGroupName, gatewayName, connectionName, linkConnectionName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Resets the VpnLink connection specified.
*
* @param resourceGroupName The name of the resource group.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn connection.
* @param linkConnectionName The name of the vpn link 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 {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginResetConnectionAsync(String resourceGroupName, String gatewayName,
String connectionName, String linkConnectionName, Context context) {
context = this.client.mergeContext(context);
Mono>> mono = resetConnectionWithResponseAsync(resourceGroupName, gatewayName,
connectionName, linkConnectionName, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Resets the VpnLink connection specified.
*
* @param resourceGroupName The name of the resource group.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn connection.
* @param linkConnectionName The name of the vpn link 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 {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginResetConnection(String resourceGroupName, String gatewayName,
String connectionName, String linkConnectionName) {
return this.beginResetConnectionAsync(resourceGroupName, gatewayName, connectionName, linkConnectionName)
.getSyncPoller();
}
/**
* Resets the VpnLink connection specified.
*
* @param resourceGroupName The name of the resource group.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn connection.
* @param linkConnectionName The name of the vpn link 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 {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginResetConnection(String resourceGroupName, String gatewayName,
String connectionName, String linkConnectionName, Context context) {
return this
.beginResetConnectionAsync(resourceGroupName, gatewayName, connectionName, linkConnectionName, context)
.getSyncPoller();
}
/**
* Resets the VpnLink connection specified.
*
* @param resourceGroupName The name of the resource group.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn connection.
* @param linkConnectionName The name of the vpn link 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 A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono resetConnectionAsync(String resourceGroupName, String gatewayName, String connectionName,
String linkConnectionName) {
return beginResetConnectionAsync(resourceGroupName, gatewayName, connectionName, linkConnectionName).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Resets the VpnLink connection specified.
*
* @param resourceGroupName The name of the resource group.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn connection.
* @param linkConnectionName The name of the vpn link 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 A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono resetConnectionAsync(String resourceGroupName, String gatewayName, String connectionName,
String linkConnectionName, Context context) {
return beginResetConnectionAsync(resourceGroupName, gatewayName, connectionName, linkConnectionName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Resets the VpnLink connection specified.
*
* @param resourceGroupName The name of the resource group.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn connection.
* @param linkConnectionName The name of the vpn link 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.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void resetConnection(String resourceGroupName, String gatewayName, String connectionName,
String linkConnectionName) {
resetConnectionAsync(resourceGroupName, gatewayName, connectionName, linkConnectionName).block();
}
/**
* Resets the VpnLink connection specified.
*
* @param resourceGroupName The name of the resource group.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn connection.
* @param linkConnectionName The name of the vpn link 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.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void resetConnection(String resourceGroupName, String gatewayName, String connectionName,
String linkConnectionName, Context context) {
resetConnectionAsync(resourceGroupName, gatewayName, connectionName, linkConnectionName, context).block();
}
/**
* Lists IKE Security Associations for Vpn Site Link Connection in the specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn connection.
* @param linkConnectionName The name of the vpn link 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 response body along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> getIkeSasWithResponseAsync(String resourceGroupName, String gatewayName,
String connectionName, String linkConnectionName) {
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 (gatewayName == null) {
return Mono.error(new IllegalArgumentException("Parameter gatewayName is required and cannot be null."));
}
if (connectionName == null) {
return Mono.error(new IllegalArgumentException("Parameter connectionName is required and cannot be null."));
}
if (linkConnectionName == null) {
return Mono
.error(new IllegalArgumentException("Parameter linkConnectionName is required and cannot be null."));
}
final String apiVersion = "2023-11-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.getIkeSas(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, gatewayName, connectionName, linkConnectionName, apiVersion, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Lists IKE Security Associations for Vpn Site Link Connection in the specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn connection.
* @param linkConnectionName The name of the vpn link 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 response body along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> getIkeSasWithResponseAsync(String resourceGroupName, String gatewayName,
String connectionName, String linkConnectionName, 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 (gatewayName == null) {
return Mono.error(new IllegalArgumentException("Parameter gatewayName is required and cannot be null."));
}
if (connectionName == null) {
return Mono.error(new IllegalArgumentException("Parameter connectionName is required and cannot be null."));
}
if (linkConnectionName == null) {
return Mono
.error(new IllegalArgumentException("Parameter linkConnectionName is required and cannot be null."));
}
final String apiVersion = "2023-11-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.getIkeSas(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
gatewayName, connectionName, linkConnectionName, apiVersion, accept, context);
}
/**
* Lists IKE Security Associations for Vpn Site Link Connection in the specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn connection.
* @param linkConnectionName The name of the vpn link 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 {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, String> beginGetIkeSasAsync(String resourceGroupName, String gatewayName,
String connectionName, String linkConnectionName) {
Mono>> mono
= getIkeSasWithResponseAsync(resourceGroupName, gatewayName, connectionName, linkConnectionName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), String.class, String.class,
this.client.getContext());
}
/**
* Lists IKE Security Associations for Vpn Site Link Connection in the specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn connection.
* @param linkConnectionName The name of the vpn link 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 {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, String> beginGetIkeSasAsync(String resourceGroupName, String gatewayName,
String connectionName, String linkConnectionName, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= getIkeSasWithResponseAsync(resourceGroupName, gatewayName, connectionName, linkConnectionName, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), String.class, String.class,
context);
}
/**
* Lists IKE Security Associations for Vpn Site Link Connection in the specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn connection.
* @param linkConnectionName The name of the vpn link 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 {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, String> beginGetIkeSas(String resourceGroupName, String gatewayName,
String connectionName, String linkConnectionName) {
return this.beginGetIkeSasAsync(resourceGroupName, gatewayName, connectionName, linkConnectionName)
.getSyncPoller();
}
/**
* Lists IKE Security Associations for Vpn Site Link Connection in the specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn connection.
* @param linkConnectionName The name of the vpn link 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 {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, String> beginGetIkeSas(String resourceGroupName, String gatewayName,
String connectionName, String linkConnectionName, Context context) {
return this.beginGetIkeSasAsync(resourceGroupName, gatewayName, connectionName, linkConnectionName, context)
.getSyncPoller();
}
/**
* Lists IKE Security Associations for Vpn Site Link Connection in the specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn connection.
* @param linkConnectionName The name of the vpn link 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 response body on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono getIkeSasAsync(String resourceGroupName, String gatewayName, String connectionName,
String linkConnectionName) {
return beginGetIkeSasAsync(resourceGroupName, gatewayName, connectionName, linkConnectionName).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Lists IKE Security Associations for Vpn Site Link Connection in the specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn connection.
* @param linkConnectionName The name of the vpn link 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 response body on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono getIkeSasAsync(String resourceGroupName, String gatewayName, String connectionName,
String linkConnectionName, Context context) {
return beginGetIkeSasAsync(resourceGroupName, gatewayName, connectionName, linkConnectionName, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Lists IKE Security Associations for Vpn Site Link Connection in the specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn connection.
* @param linkConnectionName The name of the vpn link 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 response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public String getIkeSas(String resourceGroupName, String gatewayName, String connectionName,
String linkConnectionName) {
return getIkeSasAsync(resourceGroupName, gatewayName, connectionName, linkConnectionName).block();
}
/**
* Lists IKE Security Associations for Vpn Site Link Connection in the specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn connection.
* @param linkConnectionName The name of the vpn link 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 response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public String getIkeSas(String resourceGroupName, String gatewayName, String connectionName,
String linkConnectionName, Context context) {
return getIkeSasAsync(resourceGroupName, gatewayName, connectionName, linkConnectionName, context).block();
}
/**
* Retrieves all vpn site link connections for a particular virtual wan vpn gateway vpn connection.
*
* @param resourceGroupName The resource group name of the vpn gateway.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn 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 result of the request to list all vpn connections to a virtual wan vpn gateway along with
* {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByVpnConnectionSinglePageAsync(String resourceGroupName,
String gatewayName, String connectionName) {
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 (gatewayName == null) {
return Mono.error(new IllegalArgumentException("Parameter gatewayName is required and cannot be null."));
}
if (connectionName == null) {
return Mono.error(new IllegalArgumentException("Parameter connectionName is required and cannot be null."));
}
final String apiVersion = "2023-11-01";
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.listByVpnConnection(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, gatewayName, connectionName, apiVersion, 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()));
}
/**
* Retrieves all vpn site link connections for a particular virtual wan vpn gateway vpn connection.
*
* @param resourceGroupName The resource group name of the vpn gateway.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn 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 result of the request to list all vpn connections to a virtual wan vpn gateway along with
* {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByVpnConnectionSinglePageAsync(String resourceGroupName,
String gatewayName, 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 (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 (gatewayName == null) {
return Mono.error(new IllegalArgumentException("Parameter gatewayName is required and cannot be null."));
}
if (connectionName == null) {
return Mono.error(new IllegalArgumentException("Parameter connectionName is required and cannot be null."));
}
final String apiVersion = "2023-11-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.listByVpnConnection(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
gatewayName, connectionName, apiVersion, accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* Retrieves all vpn site link connections for a particular virtual wan vpn gateway vpn connection.
*
* @param resourceGroupName The resource group name of the vpn gateway.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn 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 result of the request to list all vpn connections to a virtual wan vpn gateway as paginated response with
* {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listByVpnConnectionAsync(String resourceGroupName, String gatewayName,
String connectionName) {
return new PagedFlux<>(() -> listByVpnConnectionSinglePageAsync(resourceGroupName, gatewayName, connectionName),
nextLink -> listByVpnConnectionNextSinglePageAsync(nextLink));
}
/**
* Retrieves all vpn site link connections for a particular virtual wan vpn gateway vpn connection.
*
* @param resourceGroupName The resource group name of the vpn gateway.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn 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 result of the request to list all vpn connections to a virtual wan vpn gateway as paginated response with
* {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByVpnConnectionAsync(String resourceGroupName, String gatewayName,
String connectionName, Context context) {
return new PagedFlux<>(
() -> listByVpnConnectionSinglePageAsync(resourceGroupName, gatewayName, connectionName, context),
nextLink -> listByVpnConnectionNextSinglePageAsync(nextLink, context));
}
/**
* Retrieves all vpn site link connections for a particular virtual wan vpn gateway vpn connection.
*
* @param resourceGroupName The resource group name of the vpn gateway.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn 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 result of the request to list all vpn connections to a virtual wan vpn gateway as paginated response with
* {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByVpnConnection(String resourceGroupName, String gatewayName,
String connectionName) {
return new PagedIterable<>(listByVpnConnectionAsync(resourceGroupName, gatewayName, connectionName));
}
/**
* Retrieves all vpn site link connections for a particular virtual wan vpn gateway vpn connection.
*
* @param resourceGroupName The resource group name of the vpn gateway.
* @param gatewayName The name of the gateway.
* @param connectionName The name of the vpn 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 result of the request to list all vpn connections to a virtual wan vpn gateway as paginated response with
* {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByVpnConnection(String resourceGroupName, String gatewayName,
String connectionName, Context context) {
return new PagedIterable<>(listByVpnConnectionAsync(resourceGroupName, gatewayName, connectionName, context));
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items
*
* The nextLink parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the request to list all vpn connections to a virtual wan vpn gateway along with
* {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByVpnConnectionNextSinglePageAsync(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.listByVpnConnectionNext(nextLink, this.client.getEndpoint(), accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(),
res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items
*
* The nextLink parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the request to list all vpn connections to a virtual wan vpn gateway along with
* {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByVpnConnectionNextSinglePageAsync(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.listByVpnConnectionNext(nextLink, this.client.getEndpoint(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
}