ConnectionMonitorsClientImpl.java
// 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.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.Patch;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Post;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.exception.ManagementException;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.logging.ClientLogger;
import com.azure.core.util.polling.PollerFlux;
import com.azure.core.util.polling.SyncPoller;
import com.azure.resourcemanager.network.fluent.ConnectionMonitorsClient;
import com.azure.resourcemanager.network.fluent.models.ConnectionMonitorInner;
import com.azure.resourcemanager.network.fluent.models.ConnectionMonitorQueryResultInner;
import com.azure.resourcemanager.network.fluent.models.ConnectionMonitorResultInner;
import com.azure.resourcemanager.network.models.ConnectionMonitorListResult;
import com.azure.resourcemanager.network.models.TagsObject;
import java.nio.ByteBuffer;
import java.util.Map;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
/** An instance of this class provides access to all the operations defined in ConnectionMonitorsClient. */
public final class ConnectionMonitorsClientImpl implements ConnectionMonitorsClient {
private final ClientLogger logger = new ClientLogger(ConnectionMonitorsClientImpl.class);
/** The proxy service used to perform REST calls. */
private final ConnectionMonitorsService service;
/** The service client containing this operation class. */
private final NetworkManagementClientImpl client;
/**
* Initializes an instance of ConnectionMonitorsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
ConnectionMonitorsClientImpl(NetworkManagementClientImpl client) {
this.service =
RestProxy.create(ConnectionMonitorsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for NetworkManagementClientConnectionMonitors to be used by the proxy
* service to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "NetworkManagementCli")
private interface ConnectionMonitorsService {
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Put(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network"
+ "/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}")
@ExpectedResponses({200, 201})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> createOrUpdate(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("networkWatcherName") String networkWatcherName,
@PathParam("connectionMonitorName") String connectionMonitorName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") ConnectionMonitorInner parameters,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network"
+ "/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<ConnectionMonitorResultInner>> get(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("networkWatcherName") String networkWatcherName,
@PathParam("connectionMonitorName") String connectionMonitorName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
@Delete(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network"
+ "/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}")
@ExpectedResponses({202, 204})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> delete(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("networkWatcherName") String networkWatcherName,
@PathParam("connectionMonitorName") String connectionMonitorName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Patch(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network"
+ "/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<ConnectionMonitorResultInner>> updateTags(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("networkWatcherName") String networkWatcherName,
@PathParam("connectionMonitorName") String connectionMonitorName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") TagsObject parameters,
Context context);
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network"
+ "/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/stop")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> stop(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("networkWatcherName") String networkWatcherName,
@PathParam("connectionMonitorName") String connectionMonitorName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network"
+ "/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/start")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> start(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("networkWatcherName") String networkWatcherName,
@PathParam("connectionMonitorName") String connectionMonitorName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network"
+ "/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/query")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> query(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("networkWatcherName") String networkWatcherName,
@PathParam("connectionMonitorName") String connectionMonitorName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network"
+ "/networkWatchers/{networkWatcherName}/connectionMonitors")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<ConnectionMonitorListResult>> list(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("networkWatcherName") String networkWatcherName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
}
/**
* Create or update a connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @param parameters Parameters that define the operation to create a connection monitor.
* @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 information about the connection monitor.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(
String resourceGroupName,
String networkWatcherName,
String connectionMonitorName,
ConnectionMonitorInner 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 (networkWatcherName == null) {
return Mono
.error(new IllegalArgumentException("Parameter networkWatcherName is required and cannot be null."));
}
if (connectionMonitorName == null) {
return Mono
.error(new IllegalArgumentException("Parameter connectionMonitorName 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 apiVersion = "2020-05-01";
return FluxUtil
.withContext(
context ->
service
.createOrUpdate(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
connectionMonitorName,
apiVersion,
this.client.getSubscriptionId(),
parameters,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Create or update a connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @param parameters Parameters that define the operation to create a connection monitor.
* @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 information about the connection monitor.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(
String resourceGroupName,
String networkWatcherName,
String connectionMonitorName,
ConnectionMonitorInner 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 (networkWatcherName == null) {
return Mono
.error(new IllegalArgumentException("Parameter networkWatcherName is required and cannot be null."));
}
if (connectionMonitorName == null) {
return Mono
.error(new IllegalArgumentException("Parameter connectionMonitorName 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 apiVersion = "2020-05-01";
context = this.client.mergeContext(context);
return service
.createOrUpdate(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
connectionMonitorName,
apiVersion,
this.client.getSubscriptionId(),
parameters,
context);
}
/**
* Create or update a connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @param parameters Parameters that define the operation to create a connection monitor.
* @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 information about the connection monitor.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<ConnectionMonitorResultInner>, ConnectionMonitorResultInner> beginCreateOrUpdateAsync(
String resourceGroupName,
String networkWatcherName,
String connectionMonitorName,
ConnectionMonitorInner parameters) {
Mono<Response<Flux<ByteBuffer>>> mono =
createOrUpdateWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName, parameters);
return this
.client
.<ConnectionMonitorResultInner, ConnectionMonitorResultInner>getLroResult(
mono,
this.client.getHttpPipeline(),
ConnectionMonitorResultInner.class,
ConnectionMonitorResultInner.class,
Context.NONE);
}
/**
* Create or update a connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @param parameters Parameters that define the operation to create a connection monitor.
* @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 information about the connection monitor.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<ConnectionMonitorResultInner>, ConnectionMonitorResultInner> beginCreateOrUpdateAsync(
String resourceGroupName,
String networkWatcherName,
String connectionMonitorName,
ConnectionMonitorInner parameters,
Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
createOrUpdateWithResponseAsync(
resourceGroupName, networkWatcherName, connectionMonitorName, parameters, context);
return this
.client
.<ConnectionMonitorResultInner, ConnectionMonitorResultInner>getLroResult(
mono,
this.client.getHttpPipeline(),
ConnectionMonitorResultInner.class,
ConnectionMonitorResultInner.class,
context);
}
/**
* Create or update a connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @param parameters Parameters that define the operation to create a connection monitor.
* @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 information about the connection monitor.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<ConnectionMonitorResultInner>, ConnectionMonitorResultInner> beginCreateOrUpdate(
String resourceGroupName,
String networkWatcherName,
String connectionMonitorName,
ConnectionMonitorInner parameters) {
return beginCreateOrUpdateAsync(resourceGroupName, networkWatcherName, connectionMonitorName, parameters)
.getSyncPoller();
}
/**
* Create or update a connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @param parameters Parameters that define the operation to create a connection monitor.
* @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 information about the connection monitor.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<ConnectionMonitorResultInner>, ConnectionMonitorResultInner> beginCreateOrUpdate(
String resourceGroupName,
String networkWatcherName,
String connectionMonitorName,
ConnectionMonitorInner parameters,
Context context) {
return beginCreateOrUpdateAsync(
resourceGroupName, networkWatcherName, connectionMonitorName, parameters, context)
.getSyncPoller();
}
/**
* Create or update a connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @param parameters Parameters that define the operation to create a connection monitor.
* @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 information about the connection monitor.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<ConnectionMonitorResultInner> createOrUpdateAsync(
String resourceGroupName,
String networkWatcherName,
String connectionMonitorName,
ConnectionMonitorInner parameters) {
return beginCreateOrUpdateAsync(resourceGroupName, networkWatcherName, connectionMonitorName, parameters)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Create or update a connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @param parameters Parameters that define the operation to create a connection monitor.
* @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 information about the connection monitor.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<ConnectionMonitorResultInner> createOrUpdateAsync(
String resourceGroupName,
String networkWatcherName,
String connectionMonitorName,
ConnectionMonitorInner parameters,
Context context) {
return beginCreateOrUpdateAsync(
resourceGroupName, networkWatcherName, connectionMonitorName, parameters, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Create or update a connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @param parameters Parameters that define the operation to create a connection monitor.
* @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 information about the connection monitor.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ConnectionMonitorResultInner createOrUpdate(
String resourceGroupName,
String networkWatcherName,
String connectionMonitorName,
ConnectionMonitorInner parameters) {
return createOrUpdateAsync(resourceGroupName, networkWatcherName, connectionMonitorName, parameters).block();
}
/**
* Create or update a connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @param parameters Parameters that define the operation to create a connection monitor.
* @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 information about the connection monitor.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ConnectionMonitorResultInner createOrUpdate(
String resourceGroupName,
String networkWatcherName,
String connectionMonitorName,
ConnectionMonitorInner parameters,
Context context) {
return createOrUpdateAsync(resourceGroupName, networkWatcherName, connectionMonitorName, parameters, context)
.block();
}
/**
* Gets a connection monitor by name.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 connection monitor by name.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<ConnectionMonitorResultInner>> getWithResponseAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
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 (networkWatcherName == null) {
return Mono
.error(new IllegalArgumentException("Parameter networkWatcherName is required and cannot be null."));
}
if (connectionMonitorName == null) {
return Mono
.error(new IllegalArgumentException("Parameter connectionMonitorName 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 = "2020-05-01";
return FluxUtil
.withContext(
context ->
service
.get(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
connectionMonitorName,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Gets a connection monitor by name.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 connection monitor by name.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<ConnectionMonitorResultInner>> getWithResponseAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName, 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 (networkWatcherName == null) {
return Mono
.error(new IllegalArgumentException("Parameter networkWatcherName is required and cannot be null."));
}
if (connectionMonitorName == null) {
return Mono
.error(new IllegalArgumentException("Parameter connectionMonitorName 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 = "2020-05-01";
context = this.client.mergeContext(context);
return service
.get(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
connectionMonitorName,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* Gets a connection monitor by name.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 connection monitor by name.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<ConnectionMonitorResultInner> getAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
return getWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName)
.flatMap(
(Response<ConnectionMonitorResultInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Gets a connection monitor by name.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 connection monitor by name.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ConnectionMonitorResultInner get(
String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
return getAsync(resourceGroupName, networkWatcherName, connectionMonitorName).block();
}
/**
* Gets a connection monitor by name.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 connection monitor by name.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<ConnectionMonitorResultInner> getWithResponse(
String resourceGroupName, String networkWatcherName, String connectionMonitorName, Context context) {
return getWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName, context).block();
}
/**
* Deletes the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
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 (networkWatcherName == null) {
return Mono
.error(new IllegalArgumentException("Parameter networkWatcherName is required and cannot be null."));
}
if (connectionMonitorName == null) {
return Mono
.error(new IllegalArgumentException("Parameter connectionMonitorName 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 = "2020-05-01";
return FluxUtil
.withContext(
context ->
service
.delete(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
connectionMonitorName,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Deletes the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName, 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 (networkWatcherName == null) {
return Mono
.error(new IllegalArgumentException("Parameter networkWatcherName is required and cannot be null."));
}
if (connectionMonitorName == null) {
return Mono
.error(new IllegalArgumentException("Parameter connectionMonitorName 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 = "2020-05-01";
context = this.client.mergeContext(context);
return service
.delete(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
connectionMonitorName,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* Deletes the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginDeleteAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
Mono<Response<Flux<ByteBuffer>>> mono =
deleteWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE);
}
/**
* Deletes the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<Void>, Void> beginDeleteAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
deleteWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName, context);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
}
/**
* Deletes the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginDelete(
String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
return beginDeleteAsync(resourceGroupName, networkWatcherName, connectionMonitorName).getSyncPoller();
}
/**
* Deletes the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginDelete(
String resourceGroupName, String networkWatcherName, String connectionMonitorName, Context context) {
return beginDeleteAsync(resourceGroupName, networkWatcherName, connectionMonitorName, context).getSyncPoller();
}
/**
* Deletes the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> deleteAsync(String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
return beginDeleteAsync(resourceGroupName, networkWatcherName, connectionMonitorName)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> deleteAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName, Context context) {
return beginDeleteAsync(resourceGroupName, networkWatcherName, connectionMonitorName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 networkWatcherName, String connectionMonitorName) {
deleteAsync(resourceGroupName, networkWatcherName, connectionMonitorName).block();
}
/**
* Deletes the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 networkWatcherName, String connectionMonitorName, Context context) {
deleteAsync(resourceGroupName, networkWatcherName, connectionMonitorName, context).block();
}
/**
* Update tags of the specified connection monitor.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param connectionMonitorName The name of the connection monitor.
* @param tags Resource tags.
* @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 information about the connection monitor.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<ConnectionMonitorResultInner>> updateTagsWithResponseAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName, Map<String, String> tags) {
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 (networkWatcherName == null) {
return Mono
.error(new IllegalArgumentException("Parameter networkWatcherName is required and cannot be null."));
}
if (connectionMonitorName == null) {
return Mono
.error(new IllegalArgumentException("Parameter connectionMonitorName 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 = "2020-05-01";
TagsObject parameters = new TagsObject();
parameters.withTags(tags);
return FluxUtil
.withContext(
context ->
service
.updateTags(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
connectionMonitorName,
apiVersion,
this.client.getSubscriptionId(),
parameters,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Update tags of the specified connection monitor.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param connectionMonitorName The name of the connection monitor.
* @param tags Resource tags.
* @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 information about the connection monitor.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<ConnectionMonitorResultInner>> updateTagsWithResponseAsync(
String resourceGroupName,
String networkWatcherName,
String connectionMonitorName,
Map<String, String> tags,
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 (networkWatcherName == null) {
return Mono
.error(new IllegalArgumentException("Parameter networkWatcherName is required and cannot be null."));
}
if (connectionMonitorName == null) {
return Mono
.error(new IllegalArgumentException("Parameter connectionMonitorName 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 = "2020-05-01";
TagsObject parameters = new TagsObject();
parameters.withTags(tags);
context = this.client.mergeContext(context);
return service
.updateTags(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
connectionMonitorName,
apiVersion,
this.client.getSubscriptionId(),
parameters,
context);
}
/**
* Update tags of the specified connection monitor.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param connectionMonitorName The name of the connection monitor.
* @param tags Resource tags.
* @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 information about the connection monitor.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<ConnectionMonitorResultInner> updateTagsAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName, Map<String, String> tags) {
return updateTagsWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName, tags)
.flatMap(
(Response<ConnectionMonitorResultInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Update tags of the specified connection monitor.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param connectionMonitorName The name of the connection monitor.
* @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 information about the connection monitor.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<ConnectionMonitorResultInner> updateTagsAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
final Map<String, String> tags = null;
return updateTagsWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName, tags)
.flatMap(
(Response<ConnectionMonitorResultInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Update tags of the specified connection monitor.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param connectionMonitorName The name of the connection monitor.
* @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 information about the connection monitor.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ConnectionMonitorResultInner updateTags(
String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
final Map<String, String> tags = null;
return updateTagsAsync(resourceGroupName, networkWatcherName, connectionMonitorName, tags).block();
}
/**
* Update tags of the specified connection monitor.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param connectionMonitorName The name of the connection monitor.
* @param tags Resource tags.
* @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 information about the connection monitor.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<ConnectionMonitorResultInner> updateTagsWithResponse(
String resourceGroupName,
String networkWatcherName,
String connectionMonitorName,
Map<String, String> tags,
Context context) {
return updateTagsWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName, tags, context)
.block();
}
/**
* Stops the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> stopWithResponseAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
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 (networkWatcherName == null) {
return Mono
.error(new IllegalArgumentException("Parameter networkWatcherName is required and cannot be null."));
}
if (connectionMonitorName == null) {
return Mono
.error(new IllegalArgumentException("Parameter connectionMonitorName 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 = "2020-05-01";
return FluxUtil
.withContext(
context ->
service
.stop(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
connectionMonitorName,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Stops the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> stopWithResponseAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName, 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 (networkWatcherName == null) {
return Mono
.error(new IllegalArgumentException("Parameter networkWatcherName is required and cannot be null."));
}
if (connectionMonitorName == null) {
return Mono
.error(new IllegalArgumentException("Parameter connectionMonitorName 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 = "2020-05-01";
context = this.client.mergeContext(context);
return service
.stop(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
connectionMonitorName,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* Stops the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginStopAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
Mono<Response<Flux<ByteBuffer>>> mono =
stopWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE);
}
/**
* Stops the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<Void>, Void> beginStopAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
stopWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName, context);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
}
/**
* Stops the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginStop(
String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
return beginStopAsync(resourceGroupName, networkWatcherName, connectionMonitorName).getSyncPoller();
}
/**
* Stops the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginStop(
String resourceGroupName, String networkWatcherName, String connectionMonitorName, Context context) {
return beginStopAsync(resourceGroupName, networkWatcherName, connectionMonitorName, context).getSyncPoller();
}
/**
* Stops the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> stopAsync(String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
return beginStopAsync(resourceGroupName, networkWatcherName, connectionMonitorName)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Stops the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> stopAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName, Context context) {
return beginStopAsync(resourceGroupName, networkWatcherName, connectionMonitorName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Stops the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 stop(String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
stopAsync(resourceGroupName, networkWatcherName, connectionMonitorName).block();
}
/**
* Stops the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 stop(
String resourceGroupName, String networkWatcherName, String connectionMonitorName, Context context) {
stopAsync(resourceGroupName, networkWatcherName, connectionMonitorName, context).block();
}
/**
* Starts the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> startWithResponseAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
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 (networkWatcherName == null) {
return Mono
.error(new IllegalArgumentException("Parameter networkWatcherName is required and cannot be null."));
}
if (connectionMonitorName == null) {
return Mono
.error(new IllegalArgumentException("Parameter connectionMonitorName 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 = "2020-05-01";
return FluxUtil
.withContext(
context ->
service
.start(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
connectionMonitorName,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Starts the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> startWithResponseAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName, 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 (networkWatcherName == null) {
return Mono
.error(new IllegalArgumentException("Parameter networkWatcherName is required and cannot be null."));
}
if (connectionMonitorName == null) {
return Mono
.error(new IllegalArgumentException("Parameter connectionMonitorName 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 = "2020-05-01";
context = this.client.mergeContext(context);
return service
.start(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
connectionMonitorName,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* Starts the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginStartAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
Mono<Response<Flux<ByteBuffer>>> mono =
startWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE);
}
/**
* Starts the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<Void>, Void> beginStartAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
startWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName, context);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
}
/**
* Starts the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginStart(
String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
return beginStartAsync(resourceGroupName, networkWatcherName, connectionMonitorName).getSyncPoller();
}
/**
* Starts the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginStart(
String resourceGroupName, String networkWatcherName, String connectionMonitorName, Context context) {
return beginStartAsync(resourceGroupName, networkWatcherName, connectionMonitorName, context).getSyncPoller();
}
/**
* Starts the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> startAsync(String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
return beginStartAsync(resourceGroupName, networkWatcherName, connectionMonitorName)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Starts the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> startAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName, Context context) {
return beginStartAsync(resourceGroupName, networkWatcherName, connectionMonitorName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Starts the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 start(String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
startAsync(resourceGroupName, networkWatcherName, connectionMonitorName).block();
}
/**
* Starts the specified connection monitor.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name of the connection monitor.
* @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 start(
String resourceGroupName, String networkWatcherName, String connectionMonitorName, Context context) {
startAsync(resourceGroupName, networkWatcherName, connectionMonitorName, context).block();
}
/**
* Query a snapshot of the most recent connection states.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name given to the connection monitor.
* @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 list of connection states snapshots.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> queryWithResponseAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
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 (networkWatcherName == null) {
return Mono
.error(new IllegalArgumentException("Parameter networkWatcherName is required and cannot be null."));
}
if (connectionMonitorName == null) {
return Mono
.error(new IllegalArgumentException("Parameter connectionMonitorName 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 = "2020-05-01";
return FluxUtil
.withContext(
context ->
service
.query(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
connectionMonitorName,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Query a snapshot of the most recent connection states.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name given to the connection monitor.
* @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 list of connection states snapshots.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> queryWithResponseAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName, 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 (networkWatcherName == null) {
return Mono
.error(new IllegalArgumentException("Parameter networkWatcherName is required and cannot be null."));
}
if (connectionMonitorName == null) {
return Mono
.error(new IllegalArgumentException("Parameter connectionMonitorName 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 = "2020-05-01";
context = this.client.mergeContext(context);
return service
.query(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
connectionMonitorName,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* Query a snapshot of the most recent connection states.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name given to the connection monitor.
* @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 list of connection states snapshots.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<ConnectionMonitorQueryResultInner>, ConnectionMonitorQueryResultInner> beginQueryAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
Mono<Response<Flux<ByteBuffer>>> mono =
queryWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName);
return this
.client
.<ConnectionMonitorQueryResultInner, ConnectionMonitorQueryResultInner>getLroResult(
mono,
this.client.getHttpPipeline(),
ConnectionMonitorQueryResultInner.class,
ConnectionMonitorQueryResultInner.class,
Context.NONE);
}
/**
* Query a snapshot of the most recent connection states.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name given to the connection monitor.
* @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 list of connection states snapshots.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<ConnectionMonitorQueryResultInner>, ConnectionMonitorQueryResultInner>
beginQueryAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
queryWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName, context);
return this
.client
.<ConnectionMonitorQueryResultInner, ConnectionMonitorQueryResultInner>getLroResult(
mono,
this.client.getHttpPipeline(),
ConnectionMonitorQueryResultInner.class,
ConnectionMonitorQueryResultInner.class,
context);
}
/**
* Query a snapshot of the most recent connection states.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name given to the connection monitor.
* @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 list of connection states snapshots.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<ConnectionMonitorQueryResultInner>, ConnectionMonitorQueryResultInner> beginQuery(
String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
return beginQueryAsync(resourceGroupName, networkWatcherName, connectionMonitorName).getSyncPoller();
}
/**
* Query a snapshot of the most recent connection states.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name given to the connection monitor.
* @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 list of connection states snapshots.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<ConnectionMonitorQueryResultInner>, ConnectionMonitorQueryResultInner> beginQuery(
String resourceGroupName, String networkWatcherName, String connectionMonitorName, Context context) {
return beginQueryAsync(resourceGroupName, networkWatcherName, connectionMonitorName, context).getSyncPoller();
}
/**
* Query a snapshot of the most recent connection states.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name given to the connection monitor.
* @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 list of connection states snapshots.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<ConnectionMonitorQueryResultInner> queryAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
return beginQueryAsync(resourceGroupName, networkWatcherName, connectionMonitorName)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Query a snapshot of the most recent connection states.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name given to the connection monitor.
* @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 list of connection states snapshots.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<ConnectionMonitorQueryResultInner> queryAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName, Context context) {
return beginQueryAsync(resourceGroupName, networkWatcherName, connectionMonitorName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Query a snapshot of the most recent connection states.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name given to the connection monitor.
* @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 list of connection states snapshots.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ConnectionMonitorQueryResultInner query(
String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
return queryAsync(resourceGroupName, networkWatcherName, connectionMonitorName).block();
}
/**
* Query a snapshot of the most recent connection states.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @param connectionMonitorName The name given to the connection monitor.
* @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 list of connection states snapshots.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ConnectionMonitorQueryResultInner query(
String resourceGroupName, String networkWatcherName, String connectionMonitorName, Context context) {
return queryAsync(resourceGroupName, networkWatcherName, connectionMonitorName, context).block();
}
/**
* Lists all connection monitors for the specified Network Watcher.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @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 list of connection monitors.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<ConnectionMonitorResultInner>> listSinglePageAsync(
String resourceGroupName, String networkWatcherName) {
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 (networkWatcherName == null) {
return Mono
.error(new IllegalArgumentException("Parameter networkWatcherName 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 = "2020-05-01";
return FluxUtil
.withContext(
context ->
service
.list(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
apiVersion,
this.client.getSubscriptionId(),
context))
.<PagedResponse<ConnectionMonitorResultInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Lists all connection monitors for the specified Network Watcher.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @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 list of connection monitors.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<ConnectionMonitorResultInner>> listSinglePageAsync(
String resourceGroupName, String networkWatcherName, 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 (networkWatcherName == null) {
return Mono
.error(new IllegalArgumentException("Parameter networkWatcherName 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 = "2020-05-01";
context = this.client.mergeContext(context);
return service
.list(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
apiVersion,
this.client.getSubscriptionId(),
context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null));
}
/**
* Lists all connection monitors for the specified Network Watcher.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @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 list of connection monitors.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<ConnectionMonitorResultInner> listAsync(String resourceGroupName, String networkWatcherName) {
return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, networkWatcherName));
}
/**
* Lists all connection monitors for the specified Network Watcher.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @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 list of connection monitors.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux<ConnectionMonitorResultInner> listAsync(
String resourceGroupName, String networkWatcherName, Context context) {
return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, networkWatcherName, context));
}
/**
* Lists all connection monitors for the specified Network Watcher.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @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 list of connection monitors.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<ConnectionMonitorResultInner> list(String resourceGroupName, String networkWatcherName) {
return new PagedIterable<>(listAsync(resourceGroupName, networkWatcherName));
}
/**
* Lists all connection monitors for the specified Network Watcher.
*
* @param resourceGroupName The name of the resource group containing Network Watcher.
* @param networkWatcherName The name of the Network Watcher resource.
* @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 list of connection monitors.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<ConnectionMonitorResultInner> list(
String resourceGroupName, String networkWatcherName, Context context) {
return new PagedIterable<>(listAsync(resourceGroupName, networkWatcherName, context));
}
}