com.azure.resourcemanager.compute.implementation.LogAnalyticsClientImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-compute Show documentation
Show all versions of azure-resourcemanager-compute Show documentation
This package contains Microsoft Azure Compute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.compute.implementation;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Post;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
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.compute.fluent.LogAnalyticsClient;
import com.azure.resourcemanager.compute.fluent.models.LogAnalyticsOperationResultInner;
import com.azure.resourcemanager.compute.models.ApiErrorException;
import com.azure.resourcemanager.compute.models.RequestRateByIntervalInput;
import com.azure.resourcemanager.compute.models.ThrottledRequestsInput;
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 LogAnalyticsClient.
*/
public final class LogAnalyticsClientImpl implements LogAnalyticsClient {
/**
* The proxy service used to perform REST calls.
*/
private final LogAnalyticsService service;
/**
* The service client containing this operation class.
*/
private final ComputeManagementClientImpl client;
/**
* Initializes an instance of LogAnalyticsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
LogAnalyticsClientImpl(ComputeManagementClientImpl client) {
this.service
= RestProxy.create(LogAnalyticsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for ComputeManagementClientLogAnalytics to be used by the proxy service
* to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "ComputeManagementCli")
public interface LogAnalyticsService {
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> exportRequestRateByInterval(@HostParam("$host") String endpoint,
@PathParam("location") String location, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") RequestRateByIntervalInput parameters, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> exportThrottledRequests(@HostParam("$host") String endpoint,
@PathParam("location") String location, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") ThrottledRequestsInput parameters, @HeaderParam("Accept") String accept,
Context context);
}
/**
* Export logs that show Api requests made by this subscription in the given time window to show throttling
* activities.
*
* @param location The location upon which virtual-machine-sizes is queried.
* @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return logAnalytics operation status response along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> exportRequestRateByIntervalWithResponseAsync(String location,
RequestRateByIntervalInput parameters) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (location == null) {
return Mono.error(new IllegalArgumentException("Parameter location 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-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.exportRequestRateByInterval(this.client.getEndpoint(), location, apiVersion,
this.client.getSubscriptionId(), parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Export logs that show Api requests made by this subscription in the given time window to show throttling
* activities.
*
* @param location The location upon which virtual-machine-sizes is queried.
* @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return logAnalytics operation status response along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> exportRequestRateByIntervalWithResponseAsync(String location,
RequestRateByIntervalInput parameters, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (location == null) {
return Mono.error(new IllegalArgumentException("Parameter location 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-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.exportRequestRateByInterval(this.client.getEndpoint(), location, apiVersion,
this.client.getSubscriptionId(), parameters, accept, context);
}
/**
* Export logs that show Api requests made by this subscription in the given time window to show throttling
* activities.
*
* @param location The location upon which virtual-machine-sizes is queried.
* @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException 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 logAnalytics operation status response.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, LogAnalyticsOperationResultInner>
beginExportRequestRateByIntervalAsync(String location, RequestRateByIntervalInput parameters) {
Mono>> mono = exportRequestRateByIntervalWithResponseAsync(location, parameters);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), LogAnalyticsOperationResultInner.class,
LogAnalyticsOperationResultInner.class, this.client.getContext());
}
/**
* Export logs that show Api requests made by this subscription in the given time window to show throttling
* activities.
*
* @param location The location upon which virtual-machine-sizes is queried.
* @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException 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 logAnalytics operation status response.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, LogAnalyticsOperationResultInner>
beginExportRequestRateByIntervalAsync(String location, RequestRateByIntervalInput parameters, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= exportRequestRateByIntervalWithResponseAsync(location, parameters, context);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), LogAnalyticsOperationResultInner.class,
LogAnalyticsOperationResultInner.class, context);
}
/**
* Export logs that show Api requests made by this subscription in the given time window to show throttling
* activities.
*
* @param location The location upon which virtual-machine-sizes is queried.
* @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException 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 logAnalytics operation status response.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, LogAnalyticsOperationResultInner>
beginExportRequestRateByInterval(String location, RequestRateByIntervalInput parameters) {
return this.beginExportRequestRateByIntervalAsync(location, parameters).getSyncPoller();
}
/**
* Export logs that show Api requests made by this subscription in the given time window to show throttling
* activities.
*
* @param location The location upon which virtual-machine-sizes is queried.
* @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException 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 logAnalytics operation status response.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, LogAnalyticsOperationResultInner>
beginExportRequestRateByInterval(String location, RequestRateByIntervalInput parameters, Context context) {
return this.beginExportRequestRateByIntervalAsync(location, parameters, context).getSyncPoller();
}
/**
* Export logs that show Api requests made by this subscription in the given time window to show throttling
* activities.
*
* @param location The location upon which virtual-machine-sizes is queried.
* @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return logAnalytics operation status response on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono exportRequestRateByIntervalAsync(String location,
RequestRateByIntervalInput parameters) {
return beginExportRequestRateByIntervalAsync(location, parameters).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Export logs that show Api requests made by this subscription in the given time window to show throttling
* activities.
*
* @param location The location upon which virtual-machine-sizes is queried.
* @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return logAnalytics operation status response on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono exportRequestRateByIntervalAsync(String location,
RequestRateByIntervalInput parameters, Context context) {
return beginExportRequestRateByIntervalAsync(location, parameters, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Export logs that show Api requests made by this subscription in the given time window to show throttling
* activities.
*
* @param location The location upon which virtual-machine-sizes is queried.
* @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return logAnalytics operation status response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public LogAnalyticsOperationResultInner exportRequestRateByInterval(String location,
RequestRateByIntervalInput parameters) {
return exportRequestRateByIntervalAsync(location, parameters).block();
}
/**
* Export logs that show Api requests made by this subscription in the given time window to show throttling
* activities.
*
* @param location The location upon which virtual-machine-sizes is queried.
* @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return logAnalytics operation status response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public LogAnalyticsOperationResultInner exportRequestRateByInterval(String location,
RequestRateByIntervalInput parameters, Context context) {
return exportRequestRateByIntervalAsync(location, parameters, context).block();
}
/**
* Export logs that show total throttled Api requests for this subscription in the given time window.
*
* @param location The location upon which virtual-machine-sizes is queried.
* @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return logAnalytics operation status response along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> exportThrottledRequestsWithResponseAsync(String location,
ThrottledRequestsInput parameters) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (location == null) {
return Mono.error(new IllegalArgumentException("Parameter location 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-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.exportThrottledRequests(this.client.getEndpoint(), location, apiVersion,
this.client.getSubscriptionId(), parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Export logs that show total throttled Api requests for this subscription in the given time window.
*
* @param location The location upon which virtual-machine-sizes is queried.
* @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return logAnalytics operation status response along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> exportThrottledRequestsWithResponseAsync(String location,
ThrottledRequestsInput parameters, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (location == null) {
return Mono.error(new IllegalArgumentException("Parameter location 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-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.exportThrottledRequests(this.client.getEndpoint(), location, apiVersion,
this.client.getSubscriptionId(), parameters, accept, context);
}
/**
* Export logs that show total throttled Api requests for this subscription in the given time window.
*
* @param location The location upon which virtual-machine-sizes is queried.
* @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException 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 logAnalytics operation status response.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, LogAnalyticsOperationResultInner>
beginExportThrottledRequestsAsync(String location, ThrottledRequestsInput parameters) {
Mono>> mono = exportThrottledRequestsWithResponseAsync(location, parameters);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), LogAnalyticsOperationResultInner.class,
LogAnalyticsOperationResultInner.class, this.client.getContext());
}
/**
* Export logs that show total throttled Api requests for this subscription in the given time window.
*
* @param location The location upon which virtual-machine-sizes is queried.
* @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException 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 logAnalytics operation status response.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, LogAnalyticsOperationResultInner>
beginExportThrottledRequestsAsync(String location, ThrottledRequestsInput parameters, Context context) {
context = this.client.mergeContext(context);
Mono>> mono = exportThrottledRequestsWithResponseAsync(location, parameters, context);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), LogAnalyticsOperationResultInner.class,
LogAnalyticsOperationResultInner.class, context);
}
/**
* Export logs that show total throttled Api requests for this subscription in the given time window.
*
* @param location The location upon which virtual-machine-sizes is queried.
* @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException 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 logAnalytics operation status response.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, LogAnalyticsOperationResultInner>
beginExportThrottledRequests(String location, ThrottledRequestsInput parameters) {
return this.beginExportThrottledRequestsAsync(location, parameters).getSyncPoller();
}
/**
* Export logs that show total throttled Api requests for this subscription in the given time window.
*
* @param location The location upon which virtual-machine-sizes is queried.
* @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException 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 logAnalytics operation status response.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, LogAnalyticsOperationResultInner>
beginExportThrottledRequests(String location, ThrottledRequestsInput parameters, Context context) {
return this.beginExportThrottledRequestsAsync(location, parameters, context).getSyncPoller();
}
/**
* Export logs that show total throttled Api requests for this subscription in the given time window.
*
* @param location The location upon which virtual-machine-sizes is queried.
* @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return logAnalytics operation status response on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono exportThrottledRequestsAsync(String location,
ThrottledRequestsInput parameters) {
return beginExportThrottledRequestsAsync(location, parameters).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Export logs that show total throttled Api requests for this subscription in the given time window.
*
* @param location The location upon which virtual-machine-sizes is queried.
* @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return logAnalytics operation status response on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono exportThrottledRequestsAsync(String location,
ThrottledRequestsInput parameters, Context context) {
return beginExportThrottledRequestsAsync(location, parameters, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Export logs that show total throttled Api requests for this subscription in the given time window.
*
* @param location The location upon which virtual-machine-sizes is queried.
* @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return logAnalytics operation status response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public LogAnalyticsOperationResultInner exportThrottledRequests(String location,
ThrottledRequestsInput parameters) {
return exportThrottledRequestsAsync(location, parameters).block();
}
/**
* Export logs that show total throttled Api requests for this subscription in the given time window.
*
* @param location The location upon which virtual-machine-sizes is queried.
* @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return logAnalytics operation status response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public LogAnalyticsOperationResultInner exportThrottledRequests(String location, ThrottledRequestsInput parameters,
Context context) {
return exportThrottledRequestsAsync(location, parameters, context).block();
}
}