ProximityPlacementGroupsClientImpl.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.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.Patch;
import com.azure.core.annotation.PathParam;
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.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.compute.fluent.ProximityPlacementGroupsClient;
import com.azure.resourcemanager.compute.fluent.models.ProximityPlacementGroupInner;
import com.azure.resourcemanager.compute.models.ProximityPlacementGroupListResult;
import com.azure.resourcemanager.compute.models.UpdateResource;
import com.azure.resourcemanager.resources.fluentcore.collection.InnerSupportsDelete;
import com.azure.resourcemanager.resources.fluentcore.collection.InnerSupportsGet;
import com.azure.resourcemanager.resources.fluentcore.collection.InnerSupportsListing;
import java.util.Map;
import reactor.core.publisher.Mono;
/** An instance of this class provides access to all the operations defined in ProximityPlacementGroupsClient. */
public final class ProximityPlacementGroupsClientImpl
implements InnerSupportsGet<ProximityPlacementGroupInner>,
InnerSupportsListing<ProximityPlacementGroupInner>,
InnerSupportsDelete<Void>,
ProximityPlacementGroupsClient {
private final ClientLogger logger = new ClientLogger(ProximityPlacementGroupsClientImpl.class);
/** The proxy service used to perform REST calls. */
private final ProximityPlacementGroupsService service;
/** The service client containing this operation class. */
private final ComputeManagementClientImpl client;
/**
* Initializes an instance of ProximityPlacementGroupsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
ProximityPlacementGroupsClientImpl(ComputeManagementClientImpl client) {
this.service =
RestProxy
.create(ProximityPlacementGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for ComputeManagementClientProximityPlacementGroups to be used by the
* proxy service to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "ComputeManagementCli")
private interface ProximityPlacementGroupsService {
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Put(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/proximityPlacementGroups/{proximityPlacementGroupName}")
@ExpectedResponses({200, 201})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<ProximityPlacementGroupInner>> createOrUpdate(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("proximityPlacementGroupName") String proximityPlacementGroupName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") ProximityPlacementGroupInner parameters,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Patch(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/proximityPlacementGroups/{proximityPlacementGroupName}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<ProximityPlacementGroupInner>> update(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("proximityPlacementGroupName") String proximityPlacementGroupName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") UpdateResource parameters,
Context context);
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
@Delete(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/proximityPlacementGroups/{proximityPlacementGroupName}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Void>> delete(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("proximityPlacementGroupName") String proximityPlacementGroupName,
@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.Compute"
+ "/proximityPlacementGroups/{proximityPlacementGroupName}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<ProximityPlacementGroupInner>> getByResourceGroup(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("proximityPlacementGroupName") String proximityPlacementGroupName,
@QueryParam("includeColocationStatus") String includeColocationStatus,
@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/proximityPlacementGroups")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<ProximityPlacementGroupListResult>> list(
@HostParam("$host") String endpoint,
@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.Compute"
+ "/proximityPlacementGroups")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<ProximityPlacementGroupListResult>> listByResourceGroup(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get("{nextLink}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<ProximityPlacementGroupListResult>> listBySubscriptionNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get("{nextLink}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<ProximityPlacementGroupListResult>> listByResourceGroupNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, Context context);
}
/**
* Create or update a proximity placement group.
*
* @param resourceGroupName The name of the resource group.
* @param proximityPlacementGroupName The name of the proximity placement group.
* @param parameters Specifies information about the proximity placement group.
* @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 specifies information about the proximity placement group.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<ProximityPlacementGroupInner>> createOrUpdateWithResponseAsync(
String resourceGroupName, String proximityPlacementGroupName, ProximityPlacementGroupInner 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 (proximityPlacementGroupName == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter proximityPlacementGroupName 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.createOrUpdate(
this.client.getEndpoint(),
resourceGroupName,
proximityPlacementGroupName,
apiVersion,
this.client.getSubscriptionId(),
parameters,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Create or update a proximity placement group.
*
* @param resourceGroupName The name of the resource group.
* @param proximityPlacementGroupName The name of the proximity placement group.
* @param parameters Specifies information about the proximity placement group.
* @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 specifies information about the proximity placement group.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<ProximityPlacementGroupInner>> createOrUpdateWithResponseAsync(
String resourceGroupName,
String proximityPlacementGroupName,
ProximityPlacementGroupInner 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 (proximityPlacementGroupName == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter proximityPlacementGroupName 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.createOrUpdate(
this.client.getEndpoint(),
resourceGroupName,
proximityPlacementGroupName,
apiVersion,
this.client.getSubscriptionId(),
parameters,
context);
}
/**
* Create or update a proximity placement group.
*
* @param resourceGroupName The name of the resource group.
* @param proximityPlacementGroupName The name of the proximity placement group.
* @param parameters Specifies information about the proximity placement group.
* @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 specifies information about the proximity placement group.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<ProximityPlacementGroupInner> createOrUpdateAsync(
String resourceGroupName, String proximityPlacementGroupName, ProximityPlacementGroupInner parameters) {
return createOrUpdateWithResponseAsync(resourceGroupName, proximityPlacementGroupName, parameters)
.flatMap(
(Response<ProximityPlacementGroupInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Create or update a proximity placement group.
*
* @param resourceGroupName The name of the resource group.
* @param proximityPlacementGroupName The name of the proximity placement group.
* @param parameters Specifies information about the proximity placement group.
* @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 specifies information about the proximity placement group.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ProximityPlacementGroupInner createOrUpdate(
String resourceGroupName, String proximityPlacementGroupName, ProximityPlacementGroupInner parameters) {
return createOrUpdateAsync(resourceGroupName, proximityPlacementGroupName, parameters).block();
}
/**
* Create or update a proximity placement group.
*
* @param resourceGroupName The name of the resource group.
* @param proximityPlacementGroupName The name of the proximity placement group.
* @param parameters Specifies information about the proximity placement group.
* @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 specifies information about the proximity placement group.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<ProximityPlacementGroupInner> createOrUpdateWithResponse(
String resourceGroupName,
String proximityPlacementGroupName,
ProximityPlacementGroupInner parameters,
Context context) {
return createOrUpdateWithResponseAsync(resourceGroupName, proximityPlacementGroupName, parameters, context)
.block();
}
/**
* Update a proximity placement group.
*
* @param resourceGroupName The name of the resource group.
* @param proximityPlacementGroupName The name of the proximity placement group.
* @param tags Resource tags.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the proximity placement group.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<ProximityPlacementGroupInner>> updateWithResponseAsync(
String resourceGroupName, String proximityPlacementGroupName, Map<String, String> tags) {
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 (proximityPlacementGroupName == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter proximityPlacementGroupName 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";
UpdateResource parameters = new UpdateResource();
parameters.withTags(tags);
return FluxUtil
.withContext(
context ->
service
.update(
this.client.getEndpoint(),
resourceGroupName,
proximityPlacementGroupName,
apiVersion,
this.client.getSubscriptionId(),
parameters,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Update a proximity placement group.
*
* @param resourceGroupName The name of the resource group.
* @param proximityPlacementGroupName The name of the proximity placement group.
* @param tags Resource tags.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the proximity placement group.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<ProximityPlacementGroupInner>> updateWithResponseAsync(
String resourceGroupName, String proximityPlacementGroupName, Map<String, String> tags, 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 (proximityPlacementGroupName == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter proximityPlacementGroupName 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";
UpdateResource parameters = new UpdateResource();
parameters.withTags(tags);
context = this.client.mergeContext(context);
return service
.update(
this.client.getEndpoint(),
resourceGroupName,
proximityPlacementGroupName,
apiVersion,
this.client.getSubscriptionId(),
parameters,
context);
}
/**
* Update a proximity placement group.
*
* @param resourceGroupName The name of the resource group.
* @param proximityPlacementGroupName The name of the proximity placement group.
* @param tags Resource tags.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the proximity placement group.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<ProximityPlacementGroupInner> updateAsync(
String resourceGroupName, String proximityPlacementGroupName, Map<String, String> tags) {
return updateWithResponseAsync(resourceGroupName, proximityPlacementGroupName, tags)
.flatMap(
(Response<ProximityPlacementGroupInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Update a proximity placement group.
*
* @param resourceGroupName The name of the resource group.
* @param proximityPlacementGroupName The name of the proximity placement group.
* @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 specifies information about the proximity placement group.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<ProximityPlacementGroupInner> updateAsync(
String resourceGroupName, String proximityPlacementGroupName) {
final Map<String, String> tags = null;
return updateWithResponseAsync(resourceGroupName, proximityPlacementGroupName, tags)
.flatMap(
(Response<ProximityPlacementGroupInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Update a proximity placement group.
*
* @param resourceGroupName The name of the resource group.
* @param proximityPlacementGroupName The name of the proximity placement group.
* @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 specifies information about the proximity placement group.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ProximityPlacementGroupInner update(String resourceGroupName, String proximityPlacementGroupName) {
final Map<String, String> tags = null;
return updateAsync(resourceGroupName, proximityPlacementGroupName, tags).block();
}
/**
* Update a proximity placement group.
*
* @param resourceGroupName The name of the resource group.
* @param proximityPlacementGroupName The name of the proximity placement group.
* @param tags Resource tags.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the proximity placement group.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<ProximityPlacementGroupInner> updateWithResponse(
String resourceGroupName, String proximityPlacementGroupName, Map<String, String> tags, Context context) {
return updateWithResponseAsync(resourceGroupName, proximityPlacementGroupName, tags, context).block();
}
/**
* Delete a proximity placement group.
*
* @param resourceGroupName The name of the resource group.
* @param proximityPlacementGroupName The name of the proximity placement group.
* @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<Void>> deleteWithResponseAsync(String resourceGroupName, String proximityPlacementGroupName) {
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 (proximityPlacementGroupName == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter proximityPlacementGroupName 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
.delete(
this.client.getEndpoint(),
resourceGroupName,
proximityPlacementGroupName,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Delete a proximity placement group.
*
* @param resourceGroupName The name of the resource group.
* @param proximityPlacementGroupName The name of the proximity placement group.
* @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<Void>> deleteWithResponseAsync(
String resourceGroupName, String proximityPlacementGroupName, 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 (proximityPlacementGroupName == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter proximityPlacementGroupName 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
.delete(
this.client.getEndpoint(),
resourceGroupName,
proximityPlacementGroupName,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* Delete a proximity placement group.
*
* @param resourceGroupName The name of the resource group.
* @param proximityPlacementGroupName The name of the proximity placement group.
* @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 proximityPlacementGroupName) {
return deleteWithResponseAsync(resourceGroupName, proximityPlacementGroupName)
.flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Delete a proximity placement group.
*
* @param resourceGroupName The name of the resource group.
* @param proximityPlacementGroupName The name of the proximity placement group.
* @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 proximityPlacementGroupName) {
deleteAsync(resourceGroupName, proximityPlacementGroupName).block();
}
/**
* Delete a proximity placement group.
*
* @param resourceGroupName The name of the resource group.
* @param proximityPlacementGroupName The name of the proximity placement group.
* @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 response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<Void> deleteWithResponse(
String resourceGroupName, String proximityPlacementGroupName, Context context) {
return deleteWithResponseAsync(resourceGroupName, proximityPlacementGroupName, context).block();
}
/**
* Retrieves information about a proximity placement group .
*
* @param resourceGroupName The name of the resource group.
* @param proximityPlacementGroupName The name of the proximity placement group.
* @param includeColocationStatus includeColocationStatus=true enables fetching the colocation status of all the
* resources in the proximity placement group.
* @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 specifies information about the proximity placement group.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<ProximityPlacementGroupInner>> getByResourceGroupWithResponseAsync(
String resourceGroupName, String proximityPlacementGroupName, String includeColocationStatus) {
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 (proximityPlacementGroupName == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter proximityPlacementGroupName 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
.getByResourceGroup(
this.client.getEndpoint(),
resourceGroupName,
proximityPlacementGroupName,
includeColocationStatus,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Retrieves information about a proximity placement group .
*
* @param resourceGroupName The name of the resource group.
* @param proximityPlacementGroupName The name of the proximity placement group.
* @param includeColocationStatus includeColocationStatus=true enables fetching the colocation status of all the
* resources in the proximity placement group.
* @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 specifies information about the proximity placement group.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<ProximityPlacementGroupInner>> getByResourceGroupWithResponseAsync(
String resourceGroupName, String proximityPlacementGroupName, String includeColocationStatus, 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 (proximityPlacementGroupName == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter proximityPlacementGroupName 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
.getByResourceGroup(
this.client.getEndpoint(),
resourceGroupName,
proximityPlacementGroupName,
includeColocationStatus,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* Retrieves information about a proximity placement group .
*
* @param resourceGroupName The name of the resource group.
* @param proximityPlacementGroupName The name of the proximity placement group.
* @param includeColocationStatus includeColocationStatus=true enables fetching the colocation status of all the
* resources in the proximity placement group.
* @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 specifies information about the proximity placement group.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<ProximityPlacementGroupInner> getByResourceGroupAsync(
String resourceGroupName, String proximityPlacementGroupName, String includeColocationStatus) {
return getByResourceGroupWithResponseAsync(
resourceGroupName, proximityPlacementGroupName, includeColocationStatus)
.flatMap(
(Response<ProximityPlacementGroupInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Retrieves information about a proximity placement group .
*
* @param resourceGroupName The name of the resource group.
* @param proximityPlacementGroupName The name of the proximity placement group.
* @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 specifies information about the proximity placement group.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<ProximityPlacementGroupInner> getByResourceGroupAsync(
String resourceGroupName, String proximityPlacementGroupName) {
final String includeColocationStatus = null;
return getByResourceGroupWithResponseAsync(
resourceGroupName, proximityPlacementGroupName, includeColocationStatus)
.flatMap(
(Response<ProximityPlacementGroupInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Retrieves information about a proximity placement group .
*
* @param resourceGroupName The name of the resource group.
* @param proximityPlacementGroupName The name of the proximity placement group.
* @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 specifies information about the proximity placement group.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ProximityPlacementGroupInner getByResourceGroup(
String resourceGroupName, String proximityPlacementGroupName) {
final String includeColocationStatus = null;
return getByResourceGroupAsync(resourceGroupName, proximityPlacementGroupName, includeColocationStatus).block();
}
/**
* Retrieves information about a proximity placement group .
*
* @param resourceGroupName The name of the resource group.
* @param proximityPlacementGroupName The name of the proximity placement group.
* @param includeColocationStatus includeColocationStatus=true enables fetching the colocation status of all the
* resources in the proximity placement group.
* @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 specifies information about the proximity placement group.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<ProximityPlacementGroupInner> getByResourceGroupWithResponse(
String resourceGroupName, String proximityPlacementGroupName, String includeColocationStatus, Context context) {
return getByResourceGroupWithResponseAsync(
resourceGroupName, proximityPlacementGroupName, includeColocationStatus, context)
.block();
}
/**
* Lists all proximity placement groups in a subscription.
*
* @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 List Proximity Placement Group operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<ProximityPlacementGroupInner>> listSinglePageAsync() {
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."));
}
final String apiVersion = "2019-12-01";
return FluxUtil
.withContext(
context ->
service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), context))
.<PagedResponse<ProximityPlacementGroupInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Lists all proximity placement groups in a subscription.
*
* @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 List Proximity Placement Group operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<ProximityPlacementGroupInner>> listSinglePageAsync(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."));
}
final String apiVersion = "2019-12-01";
context = this.client.mergeContext(context);
return service
.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
/**
* Lists all proximity placement groups in a subscription.
*
* @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 List Proximity Placement Group operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<ProximityPlacementGroupInner> listAsync() {
return new PagedFlux<>(
() -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink));
}
/**
* Lists all proximity placement groups in a subscription.
*
* @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 List Proximity Placement Group operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux<ProximityPlacementGroupInner> listAsync(Context context) {
return new PagedFlux<>(
() -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context));
}
/**
* Lists all proximity placement groups in a subscription.
*
* @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 List Proximity Placement Group operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<ProximityPlacementGroupInner> list() {
return new PagedIterable<>(listAsync());
}
/**
* Lists all proximity placement groups in a subscription.
*
* @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 List Proximity Placement Group operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<ProximityPlacementGroupInner> list(Context context) {
return new PagedIterable<>(listAsync(context));
}
/**
* Lists all proximity placement groups in a resource group.
*
* @param resourceGroupName The name of the resource group.
* @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 List Proximity Placement Group operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<ProximityPlacementGroupInner>> listByResourceGroupSinglePageAsync(
String resourceGroupName) {
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 (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
.listByResourceGroup(
this.client.getEndpoint(),
resourceGroupName,
apiVersion,
this.client.getSubscriptionId(),
context))
.<PagedResponse<ProximityPlacementGroupInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Lists all proximity placement groups in a resource group.
*
* @param resourceGroupName The name of the resource group.
* @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 List Proximity Placement Group operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<ProximityPlacementGroupInner>> listByResourceGroupSinglePageAsync(
String resourceGroupName, 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 (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
.listByResourceGroup(
this.client.getEndpoint(), resourceGroupName, apiVersion, this.client.getSubscriptionId(), context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
/**
* Lists all proximity placement groups in a resource group.
*
* @param resourceGroupName The name of the resource group.
* @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 List Proximity Placement Group operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<ProximityPlacementGroupInner> listByResourceGroupAsync(String resourceGroupName) {
return new PagedFlux<>(
() -> listByResourceGroupSinglePageAsync(resourceGroupName),
nextLink -> listByResourceGroupNextSinglePageAsync(nextLink));
}
/**
* Lists all proximity placement groups in a resource group.
*
* @param resourceGroupName The name of the resource group.
* @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 List Proximity Placement Group operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux<ProximityPlacementGroupInner> listByResourceGroupAsync(
String resourceGroupName, Context context) {
return new PagedFlux<>(
() -> listByResourceGroupSinglePageAsync(resourceGroupName, context),
nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context));
}
/**
* Lists all proximity placement groups in a resource group.
*
* @param resourceGroupName The name of the resource group.
* @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 List Proximity Placement Group operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<ProximityPlacementGroupInner> listByResourceGroup(String resourceGroupName) {
return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName));
}
/**
* Lists all proximity placement groups in a resource group.
*
* @param resourceGroupName The name of the resource group.
* @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 List Proximity Placement Group operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<ProximityPlacementGroupInner> listByResourceGroup(String resourceGroupName, Context context) {
return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink 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 the List Proximity Placement Group operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<ProximityPlacementGroupInner>> listBySubscriptionNextSinglePageAsync(String nextLink) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
return FluxUtil
.withContext(context -> service.listBySubscriptionNext(nextLink, context))
.<PagedResponse<ProximityPlacementGroupInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink 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 the List Proximity Placement Group operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<ProximityPlacementGroupInner>> listBySubscriptionNextSinglePageAsync(
String nextLink, Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
context = this.client.mergeContext(context);
return service
.listBySubscriptionNext(nextLink, context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink 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 the List Proximity Placement Group operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<ProximityPlacementGroupInner>> listByResourceGroupNextSinglePageAsync(String nextLink) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
return FluxUtil
.withContext(context -> service.listByResourceGroupNext(nextLink, context))
.<PagedResponse<ProximityPlacementGroupInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink 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 the List Proximity Placement Group operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<ProximityPlacementGroupInner>> listByResourceGroupNextSinglePageAsync(
String nextLink, Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
context = this.client.mergeContext(context);
return service
.listByResourceGroupNext(nextLink, context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
}