com.azure.resourcemanager.network.implementation.ConnectionMonitorsClientImpl 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
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.network.implementation;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.Delete;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.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.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 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 {
/**
* 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")
public interface ConnectionMonitorsService {
@Headers({ "Content-Type: application/json" })
@Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}")
@ExpectedResponses({ 200, 201 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> 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,
@QueryParam("migrate") String migrate, @BodyParam("application/json") ConnectionMonitorInner parameters,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> 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,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}")
@ExpectedResponses({ 202, 204 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> 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,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> 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, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/stop")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> 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,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/start")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> 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,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/query")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> 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,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> list(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("networkWatcherName") String networkWatcherName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, 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.
* @param migrate Value indicating whether connection monitor V1 should be migrated to V2 format.
* @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 along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> createOrUpdateWithResponseAsync(String resourceGroupName,
String networkWatcherName, String connectionMonitorName, ConnectionMonitorInner parameters, String migrate) {
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 = "2024-03-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.createOrUpdate(this.client.getEndpoint(), resourceGroupName,
networkWatcherName, connectionMonitorName, apiVersion, this.client.getSubscriptionId(), migrate,
parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* 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 migrate Value indicating whether connection monitor V1 should be migrated to V2 format.
* @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 along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName,
String networkWatcherName, String connectionMonitorName, ConnectionMonitorInner parameters, String migrate,
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 = "2024-03-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.createOrUpdate(this.client.getEndpoint(), resourceGroupName, networkWatcherName,
connectionMonitorName, apiVersion, this.client.getSubscriptionId(), migrate, parameters, accept, 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.
* @param migrate Value indicating whether connection monitor V1 should be migrated to V2 format.
* @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 information about the connection monitor.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, ConnectionMonitorResultInner> beginCreateOrUpdateAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName,
ConnectionMonitorInner parameters, String migrate) {
Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, networkWatcherName,
connectionMonitorName, parameters, migrate);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), ConnectionMonitorResultInner.class, ConnectionMonitorResultInner.class,
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.
* @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 information about the connection monitor.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, ConnectionMonitorResultInner> beginCreateOrUpdateAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName,
ConnectionMonitorInner parameters) {
final String migrate = null;
Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, networkWatcherName,
connectionMonitorName, parameters, migrate);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), ConnectionMonitorResultInner.class, ConnectionMonitorResultInner.class,
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 migrate Value indicating whether connection monitor V1 should be migrated to V2 format.
* @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 information about the connection monitor.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, ConnectionMonitorResultInner> beginCreateOrUpdateAsync(
String resourceGroupName, String networkWatcherName, String connectionMonitorName,
ConnectionMonitorInner parameters, String migrate, Context context) {
context = this.client.mergeContext(context);
Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, networkWatcherName,
connectionMonitorName, parameters, migrate, context);
return this.client.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 the {@link SyncPoller} for polling of information about the connection monitor.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ConnectionMonitorResultInner> beginCreateOrUpdate(
String resourceGroupName, String networkWatcherName, String connectionMonitorName,
ConnectionMonitorInner parameters) {
final String migrate = null;
return this
.beginCreateOrUpdateAsync(resourceGroupName, networkWatcherName, connectionMonitorName, parameters, migrate)
.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 migrate Value indicating whether connection monitor V1 should be migrated to V2 format.
* @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 information about the connection monitor.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ConnectionMonitorResultInner> beginCreateOrUpdate(
String resourceGroupName, String networkWatcherName, String connectionMonitorName,
ConnectionMonitorInner parameters, String migrate, Context context) {
return this
.beginCreateOrUpdateAsync(resourceGroupName, networkWatcherName, connectionMonitorName, parameters, migrate,
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.
* @param migrate Value indicating whether connection monitor V1 should be migrated to V2 format.
* @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 on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono createOrUpdateAsync(String resourceGroupName, String networkWatcherName,
String connectionMonitorName, ConnectionMonitorInner parameters, String migrate) {
return beginCreateOrUpdateAsync(resourceGroupName, networkWatcherName, connectionMonitorName, parameters,
migrate).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 on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono createOrUpdateAsync(String resourceGroupName, String networkWatcherName,
String connectionMonitorName, ConnectionMonitorInner parameters) {
final String migrate = null;
return beginCreateOrUpdateAsync(resourceGroupName, networkWatcherName, connectionMonitorName, parameters,
migrate).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 migrate Value indicating whether connection monitor V1 should be migrated to V2 format.
* @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 on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createOrUpdateAsync(String resourceGroupName, String networkWatcherName,
String connectionMonitorName, ConnectionMonitorInner parameters, String migrate, Context context) {
return beginCreateOrUpdateAsync(resourceGroupName, networkWatcherName, connectionMonitorName, parameters,
migrate, 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) {
final String migrate = null;
return createOrUpdateAsync(resourceGroupName, networkWatcherName, connectionMonitorName, parameters, migrate)
.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 migrate Value indicating whether connection monitor V1 should be migrated to V2 format.
* @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, String migrate, Context context) {
return createOrUpdateAsync(resourceGroupName, networkWatcherName, connectionMonitorName, parameters, migrate,
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 along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> 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 = "2024-03-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.get(this.client.getEndpoint(), resourceGroupName, networkWatcherName,
connectionMonitorName, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* 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 along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> 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 = "2024-03-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.get(this.client.getEndpoint(), resourceGroupName, networkWatcherName, connectionMonitorName,
apiVersion, this.client.getSubscriptionId(), accept, 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 on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono getAsync(String resourceGroupName, String networkWatcherName,
String connectionMonitorName) {
return getWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* 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 along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(String resourceGroupName, String networkWatcherName,
String connectionMonitorName, Context context) {
return getWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName, 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 ConnectionMonitorResultInner get(String resourceGroupName, String networkWatcherName,
String connectionMonitorName) {
return getWithResponse(resourceGroupName, networkWatcherName, connectionMonitorName, Context.NONE).getValue();
}
/**
* 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 {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> 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 = "2024-03-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.delete(this.client.getEndpoint(), resourceGroupName, networkWatcherName,
connectionMonitorName, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* 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 {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> 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 = "2024-03-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.delete(this.client.getEndpoint(), resourceGroupName, networkWatcherName, connectionMonitorName,
apiVersion, this.client.getSubscriptionId(), accept, 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 {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String networkWatcherName,
String connectionMonitorName) {
Mono>> mono
= deleteWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
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 {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String networkWatcherName,
String connectionMonitorName, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= deleteWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName, context);
return this.client.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 {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginDelete(String resourceGroupName, String networkWatcherName,
String connectionMonitorName) {
return this.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 {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginDelete(String resourceGroupName, String networkWatcherName,
String connectionMonitorName, Context context) {
return this.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 A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono 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 A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono 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 parameters Parameters supplied to update connection monitor 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 along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> updateTagsWithResponseAsync(String resourceGroupName,
String networkWatcherName, String connectionMonitorName, TagsObject 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 = "2024-03-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.updateTags(this.client.getEndpoint(), resourceGroupName, networkWatcherName,
connectionMonitorName, apiVersion, this.client.getSubscriptionId(), parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* 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 parameters Parameters supplied to update connection monitor 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 along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> updateTagsWithResponseAsync(String resourceGroupName,
String networkWatcherName, String connectionMonitorName, TagsObject 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 = "2024-03-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.updateTags(this.client.getEndpoint(), resourceGroupName, networkWatcherName,
connectionMonitorName, apiVersion, this.client.getSubscriptionId(), parameters, accept, 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 parameters Parameters supplied to update connection monitor 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 on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono updateTagsAsync(String resourceGroupName, String networkWatcherName,
String connectionMonitorName, TagsObject parameters) {
return updateTagsWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName, parameters)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* 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 parameters Parameters supplied to update connection monitor 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 along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response updateTagsWithResponse(String resourceGroupName,
String networkWatcherName, String connectionMonitorName, TagsObject parameters, Context context) {
return updateTagsWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName, parameters,
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 parameters Parameters supplied to update connection monitor 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 ConnectionMonitorResultInner updateTags(String resourceGroupName, String networkWatcherName,
String connectionMonitorName, TagsObject parameters) {
return updateTagsWithResponse(resourceGroupName, networkWatcherName, connectionMonitorName, parameters,
Context.NONE).getValue();
}
/**
* 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 {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> 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 = "2024-03-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.stop(this.client.getEndpoint(), resourceGroupName, networkWatcherName,
connectionMonitorName, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* 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 {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> 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 = "2024-03-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.stop(this.client.getEndpoint(), resourceGroupName, networkWatcherName, connectionMonitorName,
apiVersion, this.client.getSubscriptionId(), accept, 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 {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginStopAsync(String resourceGroupName, String networkWatcherName,
String connectionMonitorName) {
Mono>> mono
= stopWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
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 {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginStopAsync(String resourceGroupName, String networkWatcherName,
String connectionMonitorName, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= stopWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName, context);
return this.client.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 {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginStop(String resourceGroupName, String networkWatcherName,
String connectionMonitorName) {
return this.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 {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginStop(String resourceGroupName, String networkWatcherName,
String connectionMonitorName, Context context) {
return this.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 A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono 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 A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono 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 {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> 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 = "2024-03-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.start(this.client.getEndpoint(), resourceGroupName, networkWatcherName,
connectionMonitorName, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* 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 {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> 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 = "2024-03-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.start(this.client.getEndpoint(), resourceGroupName, networkWatcherName, connectionMonitorName,
apiVersion, this.client.getSubscriptionId(), accept, 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 {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginStartAsync(String resourceGroupName, String networkWatcherName,
String connectionMonitorName) {
Mono>> mono
= startWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
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 {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginStartAsync(String resourceGroupName, String networkWatcherName,
String connectionMonitorName, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= startWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName, context);
return this.client.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 {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginStart(String resourceGroupName, String networkWatcherName,
String connectionMonitorName) {
return this.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 {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginStart(String resourceGroupName, String networkWatcherName,
String connectionMonitorName, Context context) {
return this.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 A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono 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 A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono 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 along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> 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 = "2024-03-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.query(this.client.getEndpoint(), resourceGroupName, networkWatcherName,
connectionMonitorName, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* 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 along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> 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 = "2024-03-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.query(this.client.getEndpoint(), resourceGroupName, networkWatcherName, connectionMonitorName,
apiVersion, this.client.getSubscriptionId(), accept, 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 the {@link PollerFlux} for polling of list of connection states snapshots.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, ConnectionMonitorQueryResultInner>
beginQueryAsync(String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
Mono>> mono
= queryWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), ConnectionMonitorQueryResultInner.class,
ConnectionMonitorQueryResultInner.class, 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 the {@link PollerFlux} for polling of list of connection states snapshots.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, ConnectionMonitorQueryResultInner>
beginQueryAsync(String resourceGroupName, String networkWatcherName, String connectionMonitorName,
Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= queryWithResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName, context);
return this.client.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 the {@link SyncPoller} for polling of list of connection states snapshots.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ConnectionMonitorQueryResultInner>
beginQuery(String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
return this.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 the {@link SyncPoller} for polling of list of connection states snapshots.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ConnectionMonitorQueryResultInner>
beginQuery(String resourceGroupName, String networkWatcherName, String connectionMonitorName, Context context) {
return this.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 on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono 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 on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono 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 along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> 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 = "2024-03-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.list(this.client.getEndpoint(), resourceGroupName, networkWatcherName,
apiVersion, this.client.getSubscriptionId(), accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(),
res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* 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 along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> 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 = "2024-03-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.list(this.client.getEndpoint(), resourceGroupName, networkWatcherName, apiVersion,
this.client.getSubscriptionId(), accept, 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 as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux 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 as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux 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 as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable 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 as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(String resourceGroupName, String networkWatcherName,
Context context) {
return new PagedIterable<>(listAsync(resourceGroupName, networkWatcherName, context));
}
}