com.azure.resourcemanager.avs.implementation.LocationsClientImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-avs Show documentation
Show all versions of azure-resourcemanager-avs Show documentation
This package contains Microsoft Azure SDK for Avs Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure VMware Solution API. Package tag package-2023-09-01.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.avs.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.exception.ManagementException;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.resourcemanager.avs.fluent.LocationsClient;
import com.azure.resourcemanager.avs.fluent.models.QuotaInner;
import com.azure.resourcemanager.avs.fluent.models.TrialInner;
import com.azure.resourcemanager.avs.models.Sku;
import reactor.core.publisher.Mono;
/**
* An instance of this class provides access to all the operations defined in LocationsClient.
*/
public final class LocationsClientImpl implements LocationsClient {
/**
* The proxy service used to perform REST calls.
*/
private final LocationsService service;
/**
* The service client containing this operation class.
*/
private final AvsClientImpl client;
/**
* Initializes an instance of LocationsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
LocationsClientImpl(AvsClientImpl client) {
this.service
= RestProxy.create(LocationsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for AvsClientLocations to be used by the proxy service to perform REST
* calls.
*/
@Host("{$host}")
@ServiceInterface(name = "AvsClientLocations")
public interface LocationsService {
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> checkQuotaAvailability(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@PathParam("location") String location, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> checkTrialAvailability(@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@PathParam("location") String location, @BodyParam("application/json") Sku sku,
@HeaderParam("Accept") String accept, Context context);
}
/**
* Return quota for subscription by region.
*
* @param location The name of the Azure region.
* @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 subscription quotas along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> checkQuotaAvailabilityWithResponseAsync(String location) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (location == null) {
return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.checkQuotaAvailability(this.client.getEndpoint(),
this.client.getApiVersion(), this.client.getSubscriptionId(), location, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Return quota for subscription by region.
*
* @param location The name of the Azure region.
* @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 subscription quotas along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> checkQuotaAvailabilityWithResponseAsync(String location, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (location == null) {
return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.checkQuotaAvailability(this.client.getEndpoint(), this.client.getApiVersion(),
this.client.getSubscriptionId(), location, accept, context);
}
/**
* Return quota for subscription by region.
*
* @param location The name of the Azure region.
* @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 subscription quotas on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono checkQuotaAvailabilityAsync(String location) {
return checkQuotaAvailabilityWithResponseAsync(location).flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Return quota for subscription by region.
*
* @param location The name of the Azure region.
* @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 subscription quotas along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response checkQuotaAvailabilityWithResponse(String location, Context context) {
return checkQuotaAvailabilityWithResponseAsync(location, context).block();
}
/**
* Return quota for subscription by region.
*
* @param location The name of the Azure region.
* @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 subscription quotas.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public QuotaInner checkQuotaAvailability(String location) {
return checkQuotaAvailabilityWithResponse(location, Context.NONE).getValue();
}
/**
* Return trial status for subscription by region.
*
* @param location The name of the Azure region.
* @param sku Optionally, check for a specific SKU.
* @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 subscription trial availability along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> checkTrialAvailabilityWithResponseAsync(String location, Sku sku) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (location == null) {
return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null."));
}
if (sku != null) {
sku.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.checkTrialAvailability(this.client.getEndpoint(),
this.client.getApiVersion(), this.client.getSubscriptionId(), location, sku, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Return trial status for subscription by region.
*
* @param location The name of the Azure region.
* @param sku Optionally, check for a specific SKU.
* @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 subscription trial availability along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> checkTrialAvailabilityWithResponseAsync(String location, Sku sku,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (location == null) {
return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null."));
}
if (sku != null) {
sku.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.checkTrialAvailability(this.client.getEndpoint(), this.client.getApiVersion(),
this.client.getSubscriptionId(), location, sku, accept, context);
}
/**
* Return trial status for subscription by region.
*
* @param location The name of the Azure region.
* @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 subscription trial availability on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono checkTrialAvailabilityAsync(String location) {
final Sku sku = null;
return checkTrialAvailabilityWithResponseAsync(location, sku).flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Return trial status for subscription by region.
*
* @param location The name of the Azure region.
* @param sku Optionally, check for a specific SKU.
* @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 subscription trial availability along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response checkTrialAvailabilityWithResponse(String location, Sku sku, Context context) {
return checkTrialAvailabilityWithResponseAsync(location, sku, context).block();
}
/**
* Return trial status for subscription by region.
*
* @param location The name of the Azure region.
* @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 subscription trial availability.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public TrialInner checkTrialAvailability(String location) {
final Sku sku = null;
return checkTrialAvailabilityWithResponse(location, sku, Context.NONE).getValue();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy