VirtualMachineImagesClientImpl.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.compute.implementation;
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.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.core.util.logging.ClientLogger;
import com.azure.resourcemanager.compute.fluent.VirtualMachineImagesClient;
import com.azure.resourcemanager.compute.fluent.models.VirtualMachineImageInner;
import com.azure.resourcemanager.compute.fluent.models.VirtualMachineImageResourceInner;
import java.util.List;
import reactor.core.publisher.Mono;
/** An instance of this class provides access to all the operations defined in VirtualMachineImagesClient. */
public final class VirtualMachineImagesClientImpl implements VirtualMachineImagesClient {
private final ClientLogger logger = new ClientLogger(VirtualMachineImagesClientImpl.class);
/** The proxy service used to perform REST calls. */
private final VirtualMachineImagesService service;
/** The service client containing this operation class. */
private final ComputeManagementClientImpl client;
/**
* Initializes an instance of VirtualMachineImagesClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
VirtualMachineImagesClientImpl(ComputeManagementClientImpl client) {
this.service =
RestProxy
.create(VirtualMachineImagesService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for ComputeManagementClientVirtualMachineImages to be used by the proxy
* service to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "ComputeManagementCli")
private interface VirtualMachineImagesService {
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers"
+ "/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<VirtualMachineImageInner>> get(
@HostParam("$host") String endpoint,
@PathParam("location") String location,
@PathParam("publisherName") String publisherName,
@PathParam("offer") String offer,
@PathParam("skus") String skus,
@PathParam("version") String version,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers"
+ "/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<List<VirtualMachineImageResourceInner>>> list(
@HostParam("$host") String endpoint,
@PathParam("location") String location,
@PathParam("publisherName") String publisherName,
@PathParam("offer") String offer,
@PathParam("skus") String skus,
@QueryParam("$expand") String expand,
@QueryParam("$top") Integer top,
@QueryParam("$orderby") String orderby,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers"
+ "/{publisherName}/artifacttypes/vmimage/offers")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<List<VirtualMachineImageResourceInner>>> listOffers(
@HostParam("$host") String endpoint,
@PathParam("location") String location,
@PathParam("publisherName") String publisherName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<List<VirtualMachineImageResourceInner>>> listPublishers(
@HostParam("$host") String endpoint,
@PathParam("location") String location,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers"
+ "/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<List<VirtualMachineImageResourceInner>>> listSkus(
@HostParam("$host") String endpoint,
@PathParam("location") String location,
@PathParam("publisherName") String publisherName,
@PathParam("offer") String offer,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
}
/**
* Gets a virtual machine image.
*
* @param location The name of a supported Azure region.
* @param publisherName A valid image publisher.
* @param offer A valid image publisher offer.
* @param skus A valid image SKU.
* @param version A valid image SKU version.
* @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 virtual machine image.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<VirtualMachineImageInner>> getWithResponseAsync(
String location, String publisherName, String offer, String skus, String version) {
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 (publisherName == null) {
return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null."));
}
if (offer == null) {
return Mono.error(new IllegalArgumentException("Parameter offer is required and cannot be null."));
}
if (skus == null) {
return Mono.error(new IllegalArgumentException("Parameter skus is required and cannot be null."));
}
if (version == null) {
return Mono.error(new IllegalArgumentException("Parameter version 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.get(
this.client.getEndpoint(),
location,
publisherName,
offer,
skus,
version,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Gets a virtual machine image.
*
* @param location The name of a supported Azure region.
* @param publisherName A valid image publisher.
* @param offer A valid image publisher offer.
* @param skus A valid image SKU.
* @param version A valid image SKU version.
* @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 virtual machine image.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<VirtualMachineImageInner>> getWithResponseAsync(
String location, String publisherName, String offer, String skus, String version, 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 (publisherName == null) {
return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null."));
}
if (offer == null) {
return Mono.error(new IllegalArgumentException("Parameter offer is required and cannot be null."));
}
if (skus == null) {
return Mono.error(new IllegalArgumentException("Parameter skus is required and cannot be null."));
}
if (version == null) {
return Mono.error(new IllegalArgumentException("Parameter version 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.get(
this.client.getEndpoint(),
location,
publisherName,
offer,
skus,
version,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* Gets a virtual machine image.
*
* @param location The name of a supported Azure region.
* @param publisherName A valid image publisher.
* @param offer A valid image publisher offer.
* @param skus A valid image SKU.
* @param version A valid image SKU version.
* @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 virtual machine image.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<VirtualMachineImageInner> getAsync(
String location, String publisherName, String offer, String skus, String version) {
return getWithResponseAsync(location, publisherName, offer, skus, version)
.flatMap(
(Response<VirtualMachineImageInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Gets a virtual machine image.
*
* @param location The name of a supported Azure region.
* @param publisherName A valid image publisher.
* @param offer A valid image publisher offer.
* @param skus A valid image SKU.
* @param version A valid image SKU version.
* @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 virtual machine image.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineImageInner get(
String location, String publisherName, String offer, String skus, String version) {
return getAsync(location, publisherName, offer, skus, version).block();
}
/**
* Gets a virtual machine image.
*
* @param location The name of a supported Azure region.
* @param publisherName A valid image publisher.
* @param offer A valid image publisher offer.
* @param skus A valid image SKU.
* @param version A valid image SKU version.
* @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 virtual machine image.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<VirtualMachineImageInner> getWithResponse(
String location, String publisherName, String offer, String skus, String version, Context context) {
return getWithResponseAsync(location, publisherName, offer, skus, version, context).block();
}
/**
* Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU.
*
* @param location The name of a supported Azure region.
* @param publisherName A valid image publisher.
* @param offer A valid image publisher offer.
* @param skus A valid image SKU.
* @param expand The expand expression to apply on the operation.
* @param top The top parameter.
* @param orderby The orderby parameter.
* @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 list of all virtual machine image versions for the specified location, publisher, offer, and SKU.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<List<VirtualMachineImageResourceInner>>> listWithResponseAsync(
String location, String publisherName, String offer, String skus, String expand, Integer top, String orderby) {
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 (publisherName == null) {
return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null."));
}
if (offer == null) {
return Mono.error(new IllegalArgumentException("Parameter offer is required and cannot be null."));
}
if (skus == null) {
return Mono.error(new IllegalArgumentException("Parameter skus 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.list(
this.client.getEndpoint(),
location,
publisherName,
offer,
skus,
expand,
top,
orderby,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU.
*
* @param location The name of a supported Azure region.
* @param publisherName A valid image publisher.
* @param offer A valid image publisher offer.
* @param skus A valid image SKU.
* @param expand The expand expression to apply on the operation.
* @param top The top parameter.
* @param orderby The orderby parameter.
* @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 list of all virtual machine image versions for the specified location, publisher, offer, and SKU.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<List<VirtualMachineImageResourceInner>>> listWithResponseAsync(
String location,
String publisherName,
String offer,
String skus,
String expand,
Integer top,
String orderby,
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 (publisherName == null) {
return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null."));
}
if (offer == null) {
return Mono.error(new IllegalArgumentException("Parameter offer is required and cannot be null."));
}
if (skus == null) {
return Mono.error(new IllegalArgumentException("Parameter skus 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.list(
this.client.getEndpoint(),
location,
publisherName,
offer,
skus,
expand,
top,
orderby,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU.
*
* @param location The name of a supported Azure region.
* @param publisherName A valid image publisher.
* @param offer A valid image publisher offer.
* @param skus A valid image SKU.
* @param expand The expand expression to apply on the operation.
* @param top The top parameter.
* @param orderby The orderby parameter.
* @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 list of all virtual machine image versions for the specified location, publisher, offer, and SKU.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<List<VirtualMachineImageResourceInner>> listAsync(
String location, String publisherName, String offer, String skus, String expand, Integer top, String orderby) {
return listWithResponseAsync(location, publisherName, offer, skus, expand, top, orderby)
.flatMap(
(Response<List<VirtualMachineImageResourceInner>> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU.
*
* @param location The name of a supported Azure region.
* @param publisherName A valid image publisher.
* @param offer A valid image publisher offer.
* @param skus A valid image 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 a list of all virtual machine image versions for the specified location, publisher, offer, and SKU.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<List<VirtualMachineImageResourceInner>> listAsync(
String location, String publisherName, String offer, String skus) {
final String expand = null;
final Integer top = null;
final String orderby = null;
return listWithResponseAsync(location, publisherName, offer, skus, expand, top, orderby)
.flatMap(
(Response<List<VirtualMachineImageResourceInner>> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU.
*
* @param location The name of a supported Azure region.
* @param publisherName A valid image publisher.
* @param offer A valid image publisher offer.
* @param skus A valid image 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 a list of all virtual machine image versions for the specified location, publisher, offer, and SKU.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public List<VirtualMachineImageResourceInner> list(
String location, String publisherName, String offer, String skus) {
final String expand = null;
final Integer top = null;
final String orderby = null;
return listAsync(location, publisherName, offer, skus, expand, top, orderby).block();
}
/**
* Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU.
*
* @param location The name of a supported Azure region.
* @param publisherName A valid image publisher.
* @param offer A valid image publisher offer.
* @param skus A valid image SKU.
* @param expand The expand expression to apply on the operation.
* @param top The top parameter.
* @param orderby The orderby parameter.
* @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 list of all virtual machine image versions for the specified location, publisher, offer, and SKU.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<List<VirtualMachineImageResourceInner>> listWithResponse(
String location,
String publisherName,
String offer,
String skus,
String expand,
Integer top,
String orderby,
Context context) {
return listWithResponseAsync(location, publisherName, offer, skus, expand, top, orderby, context).block();
}
/**
* Gets a list of virtual machine image offers for the specified location and publisher.
*
* @param location The name of a supported Azure region.
* @param publisherName A valid image publisher.
* @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 list of virtual machine image offers for the specified location and publisher.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<List<VirtualMachineImageResourceInner>>> listOffersWithResponseAsync(
String location, String publisherName) {
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 (publisherName == null) {
return Mono.error(new IllegalArgumentException("Parameter publisherName 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.listOffers(
this.client.getEndpoint(),
location,
publisherName,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Gets a list of virtual machine image offers for the specified location and publisher.
*
* @param location The name of a supported Azure region.
* @param publisherName A valid image publisher.
* @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 list of virtual machine image offers for the specified location and publisher.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<List<VirtualMachineImageResourceInner>>> listOffersWithResponseAsync(
String location, String publisherName, 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 (publisherName == null) {
return Mono.error(new IllegalArgumentException("Parameter publisherName 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.listOffers(
this.client.getEndpoint(),
location,
publisherName,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* Gets a list of virtual machine image offers for the specified location and publisher.
*
* @param location The name of a supported Azure region.
* @param publisherName A valid image publisher.
* @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 list of virtual machine image offers for the specified location and publisher.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<List<VirtualMachineImageResourceInner>> listOffersAsync(String location, String publisherName) {
return listOffersWithResponseAsync(location, publisherName)
.flatMap(
(Response<List<VirtualMachineImageResourceInner>> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Gets a list of virtual machine image offers for the specified location and publisher.
*
* @param location The name of a supported Azure region.
* @param publisherName A valid image publisher.
* @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 list of virtual machine image offers for the specified location and publisher.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public List<VirtualMachineImageResourceInner> listOffers(String location, String publisherName) {
return listOffersAsync(location, publisherName).block();
}
/**
* Gets a list of virtual machine image offers for the specified location and publisher.
*
* @param location The name of a supported Azure region.
* @param publisherName A valid image publisher.
* @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 list of virtual machine image offers for the specified location and publisher.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<List<VirtualMachineImageResourceInner>> listOffersWithResponse(
String location, String publisherName, Context context) {
return listOffersWithResponseAsync(location, publisherName, context).block();
}
/**
* Gets a list of virtual machine image publishers for the specified Azure location.
*
* @param location The name of a supported 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 a list of virtual machine image publishers for the specified Azure location.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<List<VirtualMachineImageResourceInner>>> listPublishersWithResponseAsync(String location) {
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."));
}
final String apiVersion = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.listPublishers(
this.client.getEndpoint(), location, apiVersion, this.client.getSubscriptionId(), context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Gets a list of virtual machine image publishers for the specified Azure location.
*
* @param location The name of a supported 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 a list of virtual machine image publishers for the specified Azure location.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<List<VirtualMachineImageResourceInner>>> listPublishersWithResponseAsync(
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 (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."));
}
final String apiVersion = "2019-12-01";
context = this.client.mergeContext(context);
return service
.listPublishers(this.client.getEndpoint(), location, apiVersion, this.client.getSubscriptionId(), context);
}
/**
* Gets a list of virtual machine image publishers for the specified Azure location.
*
* @param location The name of a supported 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 a list of virtual machine image publishers for the specified Azure location.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<List<VirtualMachineImageResourceInner>> listPublishersAsync(String location) {
return listPublishersWithResponseAsync(location)
.flatMap(
(Response<List<VirtualMachineImageResourceInner>> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Gets a list of virtual machine image publishers for the specified Azure location.
*
* @param location The name of a supported 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 a list of virtual machine image publishers for the specified Azure location.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public List<VirtualMachineImageResourceInner> listPublishers(String location) {
return listPublishersAsync(location).block();
}
/**
* Gets a list of virtual machine image publishers for the specified Azure location.
*
* @param location The name of a supported 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 a list of virtual machine image publishers for the specified Azure location.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<List<VirtualMachineImageResourceInner>> listPublishersWithResponse(
String location, Context context) {
return listPublishersWithResponseAsync(location, context).block();
}
/**
* Gets a list of virtual machine image SKUs for the specified location, publisher, and offer.
*
* @param location The name of a supported Azure region.
* @param publisherName A valid image publisher.
* @param offer A valid image publisher offer.
* @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 list of virtual machine image SKUs for the specified location, publisher, and offer.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<List<VirtualMachineImageResourceInner>>> listSkusWithResponseAsync(
String location, String publisherName, String offer) {
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 (publisherName == null) {
return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null."));
}
if (offer == null) {
return Mono.error(new IllegalArgumentException("Parameter offer 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.listSkus(
this.client.getEndpoint(),
location,
publisherName,
offer,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Gets a list of virtual machine image SKUs for the specified location, publisher, and offer.
*
* @param location The name of a supported Azure region.
* @param publisherName A valid image publisher.
* @param offer A valid image publisher offer.
* @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 list of virtual machine image SKUs for the specified location, publisher, and offer.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<List<VirtualMachineImageResourceInner>>> listSkusWithResponseAsync(
String location, String publisherName, String offer, 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 (publisherName == null) {
return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null."));
}
if (offer == null) {
return Mono.error(new IllegalArgumentException("Parameter offer 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.listSkus(
this.client.getEndpoint(),
location,
publisherName,
offer,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* Gets a list of virtual machine image SKUs for the specified location, publisher, and offer.
*
* @param location The name of a supported Azure region.
* @param publisherName A valid image publisher.
* @param offer A valid image publisher offer.
* @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 list of virtual machine image SKUs for the specified location, publisher, and offer.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<List<VirtualMachineImageResourceInner>> listSkusAsync(
String location, String publisherName, String offer) {
return listSkusWithResponseAsync(location, publisherName, offer)
.flatMap(
(Response<List<VirtualMachineImageResourceInner>> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Gets a list of virtual machine image SKUs for the specified location, publisher, and offer.
*
* @param location The name of a supported Azure region.
* @param publisherName A valid image publisher.
* @param offer A valid image publisher offer.
* @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 list of virtual machine image SKUs for the specified location, publisher, and offer.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public List<VirtualMachineImageResourceInner> listSkus(String location, String publisherName, String offer) {
return listSkusAsync(location, publisherName, offer).block();
}
/**
* Gets a list of virtual machine image SKUs for the specified location, publisher, and offer.
*
* @param location The name of a supported Azure region.
* @param publisherName A valid image publisher.
* @param offer A valid image publisher offer.
* @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 list of virtual machine image SKUs for the specified location, publisher, and offer.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<List<VirtualMachineImageResourceInner>> listSkusWithResponse(
String location, String publisherName, String offer, Context context) {
return listSkusWithResponseAsync(location, publisherName, offer, context).block();
}
}