PacketCapturesClientImpl.java
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.network.implementation;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.Delete;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Post;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.exception.ManagementException;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.logging.ClientLogger;
import com.azure.core.util.polling.PollerFlux;
import com.azure.core.util.polling.SyncPoller;
import com.azure.resourcemanager.network.fluent.PacketCapturesClient;
import com.azure.resourcemanager.network.fluent.models.PacketCaptureInner;
import com.azure.resourcemanager.network.fluent.models.PacketCaptureQueryStatusResultInner;
import com.azure.resourcemanager.network.fluent.models.PacketCaptureResultInner;
import com.azure.resourcemanager.network.models.PacketCaptureListResult;
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 PacketCapturesClient. */
public final class PacketCapturesClientImpl implements PacketCapturesClient {
private final ClientLogger logger = new ClientLogger(PacketCapturesClientImpl.class);
/** The proxy service used to perform REST calls. */
private final PacketCapturesService service;
/** The service client containing this operation class. */
private final NetworkManagementClientImpl client;
/**
* Initializes an instance of PacketCapturesClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
PacketCapturesClientImpl(NetworkManagementClientImpl client) {
this.service =
RestProxy.create(PacketCapturesService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for NetworkManagementClientPacketCaptures to be used by the proxy service
* to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "NetworkManagementCli")
private interface PacketCapturesService {
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Put(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network"
+ "/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}")
@ExpectedResponses({201})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> create(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("networkWatcherName") String networkWatcherName,
@PathParam("packetCaptureName") String packetCaptureName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") PacketCaptureInner parameters,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network"
+ "/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<PacketCaptureResultInner>> get(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("networkWatcherName") String networkWatcherName,
@PathParam("packetCaptureName") String packetCaptureName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
@Delete(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network"
+ "/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}")
@ExpectedResponses({202, 204})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> delete(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("networkWatcherName") String networkWatcherName,
@PathParam("packetCaptureName") String packetCaptureName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network"
+ "/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/stop")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> stop(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("networkWatcherName") String networkWatcherName,
@PathParam("packetCaptureName") String packetCaptureName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network"
+ "/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/queryStatus")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> getStatus(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("networkWatcherName") String networkWatcherName,
@PathParam("packetCaptureName") String packetCaptureName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network"
+ "/networkWatchers/{networkWatcherName}/packetCaptures")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<PacketCaptureListResult>> list(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("networkWatcherName") String networkWatcherName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
}
/**
* Create and start a packet capture on the specified VM.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @param parameters Parameters that define the create packet capture 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 packet capture session.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> createWithResponseAsync(
String resourceGroupName, String networkWatcherName, String packetCaptureName, PacketCaptureInner 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 (packetCaptureName == null) {
return Mono
.error(new IllegalArgumentException("Parameter packetCaptureName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String apiVersion = "2020-05-01";
return FluxUtil
.withContext(
context ->
service
.create(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
packetCaptureName,
apiVersion,
this.client.getSubscriptionId(),
parameters,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Create and start a packet capture on the specified VM.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @param parameters Parameters that define the create packet capture operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return information about packet capture session.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> createWithResponseAsync(
String resourceGroupName,
String networkWatcherName,
String packetCaptureName,
PacketCaptureInner 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 (packetCaptureName == null) {
return Mono
.error(new IllegalArgumentException("Parameter packetCaptureName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String apiVersion = "2020-05-01";
context = this.client.mergeContext(context);
return service
.create(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
packetCaptureName,
apiVersion,
this.client.getSubscriptionId(),
parameters,
context);
}
/**
* Create and start a packet capture on the specified VM.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @param parameters Parameters that define the create packet capture 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 packet capture session.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<PacketCaptureResultInner>, PacketCaptureResultInner> beginCreateAsync(
String resourceGroupName, String networkWatcherName, String packetCaptureName, PacketCaptureInner parameters) {
Mono<Response<Flux<ByteBuffer>>> mono =
createWithResponseAsync(resourceGroupName, networkWatcherName, packetCaptureName, parameters);
return this
.client
.<PacketCaptureResultInner, PacketCaptureResultInner>getLroResult(
mono,
this.client.getHttpPipeline(),
PacketCaptureResultInner.class,
PacketCaptureResultInner.class,
Context.NONE);
}
/**
* Create and start a packet capture on the specified VM.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @param parameters Parameters that define the create packet capture operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return information about packet capture session.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<PacketCaptureResultInner>, PacketCaptureResultInner> beginCreateAsync(
String resourceGroupName,
String networkWatcherName,
String packetCaptureName,
PacketCaptureInner parameters,
Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
createWithResponseAsync(resourceGroupName, networkWatcherName, packetCaptureName, parameters, context);
return this
.client
.<PacketCaptureResultInner, PacketCaptureResultInner>getLroResult(
mono,
this.client.getHttpPipeline(),
PacketCaptureResultInner.class,
PacketCaptureResultInner.class,
context);
}
/**
* Create and start a packet capture on the specified VM.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @param parameters Parameters that define the create packet capture 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 packet capture session.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<PacketCaptureResultInner>, PacketCaptureResultInner> beginCreate(
String resourceGroupName, String networkWatcherName, String packetCaptureName, PacketCaptureInner parameters) {
return beginCreateAsync(resourceGroupName, networkWatcherName, packetCaptureName, parameters).getSyncPoller();
}
/**
* Create and start a packet capture on the specified VM.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @param parameters Parameters that define the create packet capture operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return information about packet capture session.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<PacketCaptureResultInner>, PacketCaptureResultInner> beginCreate(
String resourceGroupName,
String networkWatcherName,
String packetCaptureName,
PacketCaptureInner parameters,
Context context) {
return beginCreateAsync(resourceGroupName, networkWatcherName, packetCaptureName, parameters, context)
.getSyncPoller();
}
/**
* Create and start a packet capture on the specified VM.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @param parameters Parameters that define the create packet capture 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 packet capture session.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PacketCaptureResultInner> createAsync(
String resourceGroupName, String networkWatcherName, String packetCaptureName, PacketCaptureInner parameters) {
return beginCreateAsync(resourceGroupName, networkWatcherName, packetCaptureName, parameters)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Create and start a packet capture on the specified VM.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @param parameters Parameters that define the create packet capture operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return information about packet capture session.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PacketCaptureResultInner> createAsync(
String resourceGroupName,
String networkWatcherName,
String packetCaptureName,
PacketCaptureInner parameters,
Context context) {
return beginCreateAsync(resourceGroupName, networkWatcherName, packetCaptureName, parameters, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Create and start a packet capture on the specified VM.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @param parameters Parameters that define the create packet capture 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 packet capture session.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PacketCaptureResultInner create(
String resourceGroupName, String networkWatcherName, String packetCaptureName, PacketCaptureInner parameters) {
return createAsync(resourceGroupName, networkWatcherName, packetCaptureName, parameters).block();
}
/**
* Create and start a packet capture on the specified VM.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @param parameters Parameters that define the create packet capture operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return information about packet capture session.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PacketCaptureResultInner create(
String resourceGroupName,
String networkWatcherName,
String packetCaptureName,
PacketCaptureInner parameters,
Context context) {
return createAsync(resourceGroupName, networkWatcherName, packetCaptureName, parameters, context).block();
}
/**
* Gets a packet capture session by name.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @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 packet capture session by name.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<PacketCaptureResultInner>> getWithResponseAsync(
String resourceGroupName, String networkWatcherName, String packetCaptureName) {
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 (packetCaptureName == null) {
return Mono
.error(new IllegalArgumentException("Parameter packetCaptureName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2020-05-01";
return FluxUtil
.withContext(
context ->
service
.get(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
packetCaptureName,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Gets a packet capture session by name.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @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 packet capture session by name.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<PacketCaptureResultInner>> getWithResponseAsync(
String resourceGroupName, String networkWatcherName, String packetCaptureName, 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 (packetCaptureName == null) {
return Mono
.error(new IllegalArgumentException("Parameter packetCaptureName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2020-05-01";
context = this.client.mergeContext(context);
return service
.get(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
packetCaptureName,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* Gets a packet capture session by name.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @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 packet capture session by name.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PacketCaptureResultInner> getAsync(
String resourceGroupName, String networkWatcherName, String packetCaptureName) {
return getWithResponseAsync(resourceGroupName, networkWatcherName, packetCaptureName)
.flatMap(
(Response<PacketCaptureResultInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Gets a packet capture session by name.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @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 packet capture session by name.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PacketCaptureResultInner get(String resourceGroupName, String networkWatcherName, String packetCaptureName) {
return getAsync(resourceGroupName, networkWatcherName, packetCaptureName).block();
}
/**
* Gets a packet capture session by name.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @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 packet capture session by name.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<PacketCaptureResultInner> getWithResponse(
String resourceGroupName, String networkWatcherName, String packetCaptureName, Context context) {
return getWithResponseAsync(resourceGroupName, networkWatcherName, packetCaptureName, context).block();
}
/**
* Deletes the specified packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
String resourceGroupName, String networkWatcherName, String packetCaptureName) {
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 (packetCaptureName == null) {
return Mono
.error(new IllegalArgumentException("Parameter packetCaptureName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2020-05-01";
return FluxUtil
.withContext(
context ->
service
.delete(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
packetCaptureName,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Deletes the specified packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
String resourceGroupName, String networkWatcherName, String packetCaptureName, 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 (packetCaptureName == null) {
return Mono
.error(new IllegalArgumentException("Parameter packetCaptureName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2020-05-01";
context = this.client.mergeContext(context);
return service
.delete(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
packetCaptureName,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* Deletes the specified packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginDeleteAsync(
String resourceGroupName, String networkWatcherName, String packetCaptureName) {
Mono<Response<Flux<ByteBuffer>>> mono =
deleteWithResponseAsync(resourceGroupName, networkWatcherName, packetCaptureName);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE);
}
/**
* Deletes the specified packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<Void>, Void> beginDeleteAsync(
String resourceGroupName, String networkWatcherName, String packetCaptureName, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
deleteWithResponseAsync(resourceGroupName, networkWatcherName, packetCaptureName, context);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
}
/**
* Deletes the specified packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginDelete(
String resourceGroupName, String networkWatcherName, String packetCaptureName) {
return beginDeleteAsync(resourceGroupName, networkWatcherName, packetCaptureName).getSyncPoller();
}
/**
* Deletes the specified packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginDelete(
String resourceGroupName, String networkWatcherName, String packetCaptureName, Context context) {
return beginDeleteAsync(resourceGroupName, networkWatcherName, packetCaptureName, context).getSyncPoller();
}
/**
* Deletes the specified packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> deleteAsync(String resourceGroupName, String networkWatcherName, String packetCaptureName) {
return beginDeleteAsync(resourceGroupName, networkWatcherName, packetCaptureName)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes the specified packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> deleteAsync(
String resourceGroupName, String networkWatcherName, String packetCaptureName, Context context) {
return beginDeleteAsync(resourceGroupName, networkWatcherName, packetCaptureName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes the specified packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @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 packetCaptureName) {
deleteAsync(resourceGroupName, networkWatcherName, packetCaptureName).block();
}
/**
* Deletes the specified packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @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 packetCaptureName, Context context) {
deleteAsync(resourceGroupName, networkWatcherName, packetCaptureName, context).block();
}
/**
* Stops a specified packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> stopWithResponseAsync(
String resourceGroupName, String networkWatcherName, String packetCaptureName) {
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 (packetCaptureName == null) {
return Mono
.error(new IllegalArgumentException("Parameter packetCaptureName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2020-05-01";
return FluxUtil
.withContext(
context ->
service
.stop(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
packetCaptureName,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Stops a specified packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> stopWithResponseAsync(
String resourceGroupName, String networkWatcherName, String packetCaptureName, 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 (packetCaptureName == null) {
return Mono
.error(new IllegalArgumentException("Parameter packetCaptureName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2020-05-01";
context = this.client.mergeContext(context);
return service
.stop(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
packetCaptureName,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* Stops a specified packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginStopAsync(
String resourceGroupName, String networkWatcherName, String packetCaptureName) {
Mono<Response<Flux<ByteBuffer>>> mono =
stopWithResponseAsync(resourceGroupName, networkWatcherName, packetCaptureName);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE);
}
/**
* Stops a specified packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<Void>, Void> beginStopAsync(
String resourceGroupName, String networkWatcherName, String packetCaptureName, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
stopWithResponseAsync(resourceGroupName, networkWatcherName, packetCaptureName, context);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
}
/**
* Stops a specified packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginStop(
String resourceGroupName, String networkWatcherName, String packetCaptureName) {
return beginStopAsync(resourceGroupName, networkWatcherName, packetCaptureName).getSyncPoller();
}
/**
* Stops a specified packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginStop(
String resourceGroupName, String networkWatcherName, String packetCaptureName, Context context) {
return beginStopAsync(resourceGroupName, networkWatcherName, packetCaptureName, context).getSyncPoller();
}
/**
* Stops a specified packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> stopAsync(String resourceGroupName, String networkWatcherName, String packetCaptureName) {
return beginStopAsync(resourceGroupName, networkWatcherName, packetCaptureName)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Stops a specified packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> stopAsync(
String resourceGroupName, String networkWatcherName, String packetCaptureName, Context context) {
return beginStopAsync(resourceGroupName, networkWatcherName, packetCaptureName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Stops a specified packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @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 packetCaptureName) {
stopAsync(resourceGroupName, networkWatcherName, packetCaptureName).block();
}
/**
* Stops a specified packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param packetCaptureName The name of the packet capture session.
* @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 packetCaptureName, Context context) {
stopAsync(resourceGroupName, networkWatcherName, packetCaptureName, context).block();
}
/**
* Query the status of a running packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the Network Watcher resource.
* @param packetCaptureName The name given to the packet capture session.
* @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 status of packet capture session.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> getStatusWithResponseAsync(
String resourceGroupName, String networkWatcherName, String packetCaptureName) {
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 (packetCaptureName == null) {
return Mono
.error(new IllegalArgumentException("Parameter packetCaptureName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2020-05-01";
return FluxUtil
.withContext(
context ->
service
.getStatus(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
packetCaptureName,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Query the status of a running packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the Network Watcher resource.
* @param packetCaptureName The name given to the packet capture session.
* @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 status of packet capture session.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> getStatusWithResponseAsync(
String resourceGroupName, String networkWatcherName, String packetCaptureName, 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 (packetCaptureName == null) {
return Mono
.error(new IllegalArgumentException("Parameter packetCaptureName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2020-05-01";
context = this.client.mergeContext(context);
return service
.getStatus(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
packetCaptureName,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* Query the status of a running packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the Network Watcher resource.
* @param packetCaptureName The name given to the packet capture session.
* @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 status of packet capture session.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<PacketCaptureQueryStatusResultInner>, PacketCaptureQueryStatusResultInner>
beginGetStatusAsync(String resourceGroupName, String networkWatcherName, String packetCaptureName) {
Mono<Response<Flux<ByteBuffer>>> mono =
getStatusWithResponseAsync(resourceGroupName, networkWatcherName, packetCaptureName);
return this
.client
.<PacketCaptureQueryStatusResultInner, PacketCaptureQueryStatusResultInner>getLroResult(
mono,
this.client.getHttpPipeline(),
PacketCaptureQueryStatusResultInner.class,
PacketCaptureQueryStatusResultInner.class,
Context.NONE);
}
/**
* Query the status of a running packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the Network Watcher resource.
* @param packetCaptureName The name given to the packet capture session.
* @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 status of packet capture session.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<PacketCaptureQueryStatusResultInner>, PacketCaptureQueryStatusResultInner>
beginGetStatusAsync(
String resourceGroupName, String networkWatcherName, String packetCaptureName, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
getStatusWithResponseAsync(resourceGroupName, networkWatcherName, packetCaptureName, context);
return this
.client
.<PacketCaptureQueryStatusResultInner, PacketCaptureQueryStatusResultInner>getLroResult(
mono,
this.client.getHttpPipeline(),
PacketCaptureQueryStatusResultInner.class,
PacketCaptureQueryStatusResultInner.class,
context);
}
/**
* Query the status of a running packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the Network Watcher resource.
* @param packetCaptureName The name given to the packet capture session.
* @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 status of packet capture session.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<PacketCaptureQueryStatusResultInner>, PacketCaptureQueryStatusResultInner>
beginGetStatus(String resourceGroupName, String networkWatcherName, String packetCaptureName) {
return beginGetStatusAsync(resourceGroupName, networkWatcherName, packetCaptureName).getSyncPoller();
}
/**
* Query the status of a running packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the Network Watcher resource.
* @param packetCaptureName The name given to the packet capture session.
* @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 status of packet capture session.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<PacketCaptureQueryStatusResultInner>, PacketCaptureQueryStatusResultInner>
beginGetStatus(String resourceGroupName, String networkWatcherName, String packetCaptureName, Context context) {
return beginGetStatusAsync(resourceGroupName, networkWatcherName, packetCaptureName, context).getSyncPoller();
}
/**
* Query the status of a running packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the Network Watcher resource.
* @param packetCaptureName The name given to the packet capture session.
* @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 status of packet capture session.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PacketCaptureQueryStatusResultInner> getStatusAsync(
String resourceGroupName, String networkWatcherName, String packetCaptureName) {
return beginGetStatusAsync(resourceGroupName, networkWatcherName, packetCaptureName)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Query the status of a running packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the Network Watcher resource.
* @param packetCaptureName The name given to the packet capture session.
* @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 status of packet capture session.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PacketCaptureQueryStatusResultInner> getStatusAsync(
String resourceGroupName, String networkWatcherName, String packetCaptureName, Context context) {
return beginGetStatusAsync(resourceGroupName, networkWatcherName, packetCaptureName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Query the status of a running packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the Network Watcher resource.
* @param packetCaptureName The name given to the packet capture session.
* @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 status of packet capture session.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PacketCaptureQueryStatusResultInner getStatus(
String resourceGroupName, String networkWatcherName, String packetCaptureName) {
return getStatusAsync(resourceGroupName, networkWatcherName, packetCaptureName).block();
}
/**
* Query the status of a running packet capture session.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the Network Watcher resource.
* @param packetCaptureName The name given to the packet capture session.
* @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 status of packet capture session.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PacketCaptureQueryStatusResultInner getStatus(
String resourceGroupName, String networkWatcherName, String packetCaptureName, Context context) {
return getStatusAsync(resourceGroupName, networkWatcherName, packetCaptureName, context).block();
}
/**
* Lists all packet capture sessions within the specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @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 packet capture sessions.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<PacketCaptureResultInner>> listSinglePageAsync(
String resourceGroupName, String networkWatcherName) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (networkWatcherName == null) {
return Mono
.error(new IllegalArgumentException("Parameter networkWatcherName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2020-05-01";
return FluxUtil
.withContext(
context ->
service
.list(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
apiVersion,
this.client.getSubscriptionId(),
context))
.<PagedResponse<PacketCaptureResultInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Lists all packet capture sessions within the specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @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 packet capture sessions.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<PacketCaptureResultInner>> listSinglePageAsync(
String resourceGroupName, String networkWatcherName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (networkWatcherName == null) {
return Mono
.error(new IllegalArgumentException("Parameter networkWatcherName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2020-05-01";
context = this.client.mergeContext(context);
return service
.list(
this.client.getEndpoint(),
resourceGroupName,
networkWatcherName,
apiVersion,
this.client.getSubscriptionId(),
context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null));
}
/**
* Lists all packet capture sessions within the specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @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 packet capture sessions.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<PacketCaptureResultInner> listAsync(String resourceGroupName, String networkWatcherName) {
return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, networkWatcherName));
}
/**
* Lists all packet capture sessions within the specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @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 packet capture sessions.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux<PacketCaptureResultInner> listAsync(
String resourceGroupName, String networkWatcherName, Context context) {
return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, networkWatcherName, context));
}
/**
* Lists all packet capture sessions within the specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @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 packet capture sessions.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<PacketCaptureResultInner> list(String resourceGroupName, String networkWatcherName) {
return new PagedIterable<>(listAsync(resourceGroupName, networkWatcherName));
}
/**
* Lists all packet capture sessions within the specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @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 packet capture sessions.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<PacketCaptureResultInner> list(
String resourceGroupName, String networkWatcherName, Context context) {
return new PagedIterable<>(listAsync(resourceGroupName, networkWatcherName, context));
}
}