com.azure.resourcemanager.compute.implementation.DedicatedHostsClientImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-compute Show documentation
Show all versions of azure-resourcemanager-compute Show documentation
This package contains Microsoft Azure Compute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.compute.implementation;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.Delete;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
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.Patch;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Post;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.polling.PollerFlux;
import com.azure.core.util.polling.SyncPoller;
import com.azure.resourcemanager.compute.fluent.DedicatedHostsClient;
import com.azure.resourcemanager.compute.fluent.models.DedicatedHostInner;
import com.azure.resourcemanager.compute.models.ApiErrorException;
import com.azure.resourcemanager.compute.models.DedicatedHostListResult;
import com.azure.resourcemanager.compute.models.DedicatedHostSizeListResult;
import com.azure.resourcemanager.compute.models.DedicatedHostUpdate;
import com.azure.resourcemanager.compute.models.InstanceViewTypes;
import java.nio.ByteBuffer;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
/**
* An instance of this class provides access to all the operations defined in DedicatedHostsClient.
*/
public final class DedicatedHostsClientImpl implements DedicatedHostsClient {
/**
* The proxy service used to perform REST calls.
*/
private final DedicatedHostsService service;
/**
* The service client containing this operation class.
*/
private final ComputeManagementClientImpl client;
/**
* Initializes an instance of DedicatedHostsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
DedicatedHostsClientImpl(ComputeManagementClientImpl client) {
this.service
= RestProxy.create(DedicatedHostsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for ComputeManagementClientDedicatedHosts to be used by the proxy service
* to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "ComputeManagementCli")
public interface DedicatedHostsService {
@Headers({ "Content-Type: application/json" })
@Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}")
@ExpectedResponses({ 200, 201 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> createOrUpdate(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("hostGroupName") String hostGroupName,
@PathParam("hostName") String hostname, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") DedicatedHostInner parameters, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Content-Type: application/json" })
@Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> update(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("hostGroupName") String hostGroupName,
@PathParam("hostName") String hostname, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") DedicatedHostUpdate parameters, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Content-Type: application/json" })
@Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}")
@ExpectedResponses({ 200, 202, 204 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> delete(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("hostGroupName") String hostGroupName,
@PathParam("hostName") String hostname, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> get(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("hostGroupName") String hostGroupName,
@PathParam("hostName") String hostname, @QueryParam("$expand") InstanceViewTypes expand,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> listByHostGroup(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("hostGroupName") String hostGroupName,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> restart(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("hostGroupName") String hostGroupName,
@PathParam("hostName") String hostname, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/redeploy")
@ExpectedResponses({ 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> redeploy(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("hostGroupName") String hostGroupName,
@PathParam("hostName") String hostname, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/hostSizes")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> listAvailableSizes(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("hostGroupName") String hostGroupName,
@PathParam("hostName") String hostname, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> listByHostGroupNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept, Context context);
}
/**
* Create or update a dedicated host .
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host .
* @param parameters Parameters supplied to the Create Dedicated Host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the Dedicated host along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> createOrUpdateWithResponseAsync(String resourceGroupName,
String hostGroupName, String hostname, DedicatedHostInner 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 (hostGroupName == null) {
return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null."));
}
if (hostname == null) {
return Mono.error(new IllegalArgumentException("Parameter hostname is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.createOrUpdate(this.client.getEndpoint(), resourceGroupName, hostGroupName,
hostname, apiVersion, this.client.getSubscriptionId(), parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Create or update a dedicated host .
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host .
* @param parameters Parameters supplied to the Create Dedicated Host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the Dedicated host along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName,
String hostGroupName, String hostname, DedicatedHostInner 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 (hostGroupName == null) {
return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null."));
}
if (hostname == null) {
return Mono.error(new IllegalArgumentException("Parameter hostname is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.createOrUpdate(this.client.getEndpoint(), resourceGroupName, hostGroupName, hostname, apiVersion,
this.client.getSubscriptionId(), parameters, accept, context);
}
/**
* Create or update a dedicated host .
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host .
* @param parameters Parameters supplied to the Create Dedicated Host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of specifies information about the Dedicated host.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, DedicatedHostInner> beginCreateOrUpdateAsync(
String resourceGroupName, String hostGroupName, String hostname, DedicatedHostInner parameters) {
Mono>> mono
= createOrUpdateWithResponseAsync(resourceGroupName, hostGroupName, hostname, parameters);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
DedicatedHostInner.class, DedicatedHostInner.class, this.client.getContext());
}
/**
* Create or update a dedicated host .
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host .
* @param parameters Parameters supplied to the Create Dedicated Host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of specifies information about the Dedicated host.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, DedicatedHostInner> beginCreateOrUpdateAsync(
String resourceGroupName, String hostGroupName, String hostname, DedicatedHostInner parameters,
Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= createOrUpdateWithResponseAsync(resourceGroupName, hostGroupName, hostname, parameters, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
DedicatedHostInner.class, DedicatedHostInner.class, context);
}
/**
* Create or update a dedicated host .
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host .
* @param parameters Parameters supplied to the Create Dedicated Host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of specifies information about the Dedicated host.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, DedicatedHostInner> beginCreateOrUpdate(String resourceGroupName,
String hostGroupName, String hostname, DedicatedHostInner parameters) {
return this.beginCreateOrUpdateAsync(resourceGroupName, hostGroupName, hostname, parameters).getSyncPoller();
}
/**
* Create or update a dedicated host .
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host .
* @param parameters Parameters supplied to the Create Dedicated Host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of specifies information about the Dedicated host.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, DedicatedHostInner> beginCreateOrUpdate(String resourceGroupName,
String hostGroupName, String hostname, DedicatedHostInner parameters, Context context) {
return this.beginCreateOrUpdateAsync(resourceGroupName, hostGroupName, hostname, parameters, context)
.getSyncPoller();
}
/**
* Create or update a dedicated host .
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host .
* @param parameters Parameters supplied to the Create Dedicated Host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the Dedicated host on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono createOrUpdateAsync(String resourceGroupName, String hostGroupName, String hostname,
DedicatedHostInner parameters) {
return beginCreateOrUpdateAsync(resourceGroupName, hostGroupName, hostname, parameters).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Create or update a dedicated host .
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host .
* @param parameters Parameters supplied to the Create Dedicated Host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the Dedicated host on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createOrUpdateAsync(String resourceGroupName, String hostGroupName,
String hostname, DedicatedHostInner parameters, Context context) {
return beginCreateOrUpdateAsync(resourceGroupName, hostGroupName, hostname, parameters, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Create or update a dedicated host .
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host .
* @param parameters Parameters supplied to the Create Dedicated Host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the Dedicated host.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DedicatedHostInner createOrUpdate(String resourceGroupName, String hostGroupName, String hostname,
DedicatedHostInner parameters) {
return createOrUpdateAsync(resourceGroupName, hostGroupName, hostname, parameters).block();
}
/**
* Create or update a dedicated host .
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host .
* @param parameters Parameters supplied to the Create Dedicated Host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the Dedicated host.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DedicatedHostInner createOrUpdate(String resourceGroupName, String hostGroupName, String hostname,
DedicatedHostInner parameters, Context context) {
return createOrUpdateAsync(resourceGroupName, hostGroupName, hostname, parameters, context).block();
}
/**
* Update a dedicated host .
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host .
* @param parameters Parameters supplied to the Update Dedicated Host operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the Dedicated host along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> updateWithResponseAsync(String resourceGroupName, String hostGroupName,
String hostname, DedicatedHostUpdate 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 (hostGroupName == null) {
return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null."));
}
if (hostname == null) {
return Mono.error(new IllegalArgumentException("Parameter hostname is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.update(this.client.getEndpoint(), resourceGroupName, hostGroupName,
hostname, apiVersion, this.client.getSubscriptionId(), parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Update a dedicated host .
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host .
* @param parameters Parameters supplied to the Update Dedicated Host operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the Dedicated host along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> updateWithResponseAsync(String resourceGroupName, String hostGroupName,
String hostname, DedicatedHostUpdate 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 (hostGroupName == null) {
return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null."));
}
if (hostname == null) {
return Mono.error(new IllegalArgumentException("Parameter hostname is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.update(this.client.getEndpoint(), resourceGroupName, hostGroupName, hostname, apiVersion,
this.client.getSubscriptionId(), parameters, accept, context);
}
/**
* Update a dedicated host .
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host .
* @param parameters Parameters supplied to the Update Dedicated Host operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of specifies information about the Dedicated host.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, DedicatedHostInner> beginUpdateAsync(String resourceGroupName,
String hostGroupName, String hostname, DedicatedHostUpdate parameters) {
Mono>> mono
= updateWithResponseAsync(resourceGroupName, hostGroupName, hostname, parameters);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
DedicatedHostInner.class, DedicatedHostInner.class, this.client.getContext());
}
/**
* Update a dedicated host .
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host .
* @param parameters Parameters supplied to the Update Dedicated Host operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of specifies information about the Dedicated host.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, DedicatedHostInner> beginUpdateAsync(String resourceGroupName,
String hostGroupName, String hostname, DedicatedHostUpdate parameters, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= updateWithResponseAsync(resourceGroupName, hostGroupName, hostname, parameters, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
DedicatedHostInner.class, DedicatedHostInner.class, context);
}
/**
* Update a dedicated host .
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host .
* @param parameters Parameters supplied to the Update Dedicated Host operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of specifies information about the Dedicated host.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, DedicatedHostInner> beginUpdate(String resourceGroupName,
String hostGroupName, String hostname, DedicatedHostUpdate parameters) {
return this.beginUpdateAsync(resourceGroupName, hostGroupName, hostname, parameters).getSyncPoller();
}
/**
* Update a dedicated host .
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host .
* @param parameters Parameters supplied to the Update Dedicated Host operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of specifies information about the Dedicated host.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, DedicatedHostInner> beginUpdate(String resourceGroupName,
String hostGroupName, String hostname, DedicatedHostUpdate parameters, Context context) {
return this.beginUpdateAsync(resourceGroupName, hostGroupName, hostname, parameters, context).getSyncPoller();
}
/**
* Update a dedicated host .
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host .
* @param parameters Parameters supplied to the Update Dedicated Host operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the Dedicated host on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono updateAsync(String resourceGroupName, String hostGroupName, String hostname,
DedicatedHostUpdate parameters) {
return beginUpdateAsync(resourceGroupName, hostGroupName, hostname, parameters).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Update a dedicated host .
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host .
* @param parameters Parameters supplied to the Update Dedicated Host operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the Dedicated host on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono updateAsync(String resourceGroupName, String hostGroupName, String hostname,
DedicatedHostUpdate parameters, Context context) {
return beginUpdateAsync(resourceGroupName, hostGroupName, hostname, parameters, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Update a dedicated host .
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host .
* @param parameters Parameters supplied to the Update Dedicated Host operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the Dedicated host.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DedicatedHostInner update(String resourceGroupName, String hostGroupName, String hostname,
DedicatedHostUpdate parameters) {
return updateAsync(resourceGroupName, hostGroupName, hostname, parameters).block();
}
/**
* Update a dedicated host .
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host .
* @param parameters Parameters supplied to the Update Dedicated Host operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the Dedicated host.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DedicatedHostInner update(String resourceGroupName, String hostGroupName, String hostname,
DedicatedHostUpdate parameters, Context context) {
return updateAsync(resourceGroupName, hostGroupName, hostname, parameters, context).block();
}
/**
* Delete a dedicated host.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> deleteWithResponseAsync(String resourceGroupName, String hostGroupName,
String hostname) {
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 (hostGroupName == null) {
return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null."));
}
if (hostname == null) {
return Mono.error(new IllegalArgumentException("Parameter hostname 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 = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.delete(this.client.getEndpoint(), resourceGroupName, hostGroupName,
hostname, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Delete a dedicated host.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> deleteWithResponseAsync(String resourceGroupName, String hostGroupName,
String hostname, 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 (hostGroupName == null) {
return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null."));
}
if (hostname == null) {
return Mono.error(new IllegalArgumentException("Parameter hostname 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 = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.delete(this.client.getEndpoint(), resourceGroupName, hostGroupName, hostname, apiVersion,
this.client.getSubscriptionId(), accept, context);
}
/**
* Delete a dedicated host.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String hostGroupName,
String hostname) {
Mono>> mono = deleteWithResponseAsync(resourceGroupName, hostGroupName, hostname);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Delete a dedicated host.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String hostGroupName,
String hostname, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= deleteWithResponseAsync(resourceGroupName, hostGroupName, hostname, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Delete a dedicated host.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginDelete(String resourceGroupName, String hostGroupName,
String hostname) {
return this.beginDeleteAsync(resourceGroupName, hostGroupName, hostname).getSyncPoller();
}
/**
* Delete a dedicated host.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginDelete(String resourceGroupName, String hostGroupName,
String hostname, Context context) {
return this.beginDeleteAsync(resourceGroupName, hostGroupName, hostname, context).getSyncPoller();
}
/**
* Delete a dedicated host.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono deleteAsync(String resourceGroupName, String hostGroupName, String hostname) {
return beginDeleteAsync(resourceGroupName, hostGroupName, hostname).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Delete a dedicated host.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono deleteAsync(String resourceGroupName, String hostGroupName, String hostname, Context context) {
return beginDeleteAsync(resourceGroupName, hostGroupName, hostname, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Delete a dedicated host.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String hostGroupName, String hostname) {
deleteAsync(resourceGroupName, hostGroupName, hostname).block();
}
/**
* Delete a dedicated host.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String hostGroupName, String hostname, Context context) {
deleteAsync(resourceGroupName, hostGroupName, hostname, context).block();
}
/**
* Retrieves information about a dedicated host.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance
* views of the dedicated host. 'UserData' is not supported for dedicated host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the Dedicated host along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> getWithResponseAsync(String resourceGroupName, String hostGroupName,
String hostname, InstanceViewTypes expand) {
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 (hostGroupName == null) {
return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null."));
}
if (hostname == null) {
return Mono.error(new IllegalArgumentException("Parameter hostname 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 = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.get(this.client.getEndpoint(), resourceGroupName, hostGroupName, hostname,
expand, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Retrieves information about a dedicated host.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance
* views of the dedicated host. 'UserData' is not supported for dedicated host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the Dedicated host along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceGroupName, String hostGroupName,
String hostname, InstanceViewTypes expand, 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 (hostGroupName == null) {
return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null."));
}
if (hostname == null) {
return Mono.error(new IllegalArgumentException("Parameter hostname 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 = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.get(this.client.getEndpoint(), resourceGroupName, hostGroupName, hostname, expand, apiVersion,
this.client.getSubscriptionId(), accept, context);
}
/**
* Retrieves information about a dedicated host.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the Dedicated host on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono getAsync(String resourceGroupName, String hostGroupName, String hostname) {
final InstanceViewTypes expand = null;
return getWithResponseAsync(resourceGroupName, hostGroupName, hostname, expand)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Retrieves information about a dedicated host.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance
* views of the dedicated host. 'UserData' is not supported for dedicated host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the Dedicated host along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(String resourceGroupName, String hostGroupName, String hostname,
InstanceViewTypes expand, Context context) {
return getWithResponseAsync(resourceGroupName, hostGroupName, hostname, expand, context).block();
}
/**
* Retrieves information about a dedicated host.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies information about the Dedicated host.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DedicatedHostInner get(String resourceGroupName, String hostGroupName, String hostname) {
final InstanceViewTypes expand = null;
return getWithResponse(resourceGroupName, hostGroupName, hostname, expand, Context.NONE).getValue();
}
/**
* Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property in the response
* to get the next page of dedicated hosts.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list dedicated host operation response along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByHostGroupSinglePageAsync(String resourceGroupName,
String hostGroupName) {
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 (hostGroupName == null) {
return Mono.error(new IllegalArgumentException("Parameter hostGroupName 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 = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.listByHostGroup(this.client.getEndpoint(), resourceGroupName, hostGroupName,
apiVersion, this.client.getSubscriptionId(), accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(),
res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property in the response
* to get the next page of dedicated hosts.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list dedicated host operation response along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByHostGroupSinglePageAsync(String resourceGroupName,
String hostGroupName, 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 (hostGroupName == null) {
return Mono.error(new IllegalArgumentException("Parameter hostGroupName 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 = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.listByHostGroup(this.client.getEndpoint(), resourceGroupName, hostGroupName, apiVersion,
this.client.getSubscriptionId(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property in the response
* to get the next page of dedicated hosts.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list dedicated host operation response as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listByHostGroupAsync(String resourceGroupName, String hostGroupName) {
return new PagedFlux<>(() -> listByHostGroupSinglePageAsync(resourceGroupName, hostGroupName),
nextLink -> listByHostGroupNextSinglePageAsync(nextLink));
}
/**
* Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property in the response
* to get the next page of dedicated hosts.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list dedicated host operation response as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByHostGroupAsync(String resourceGroupName, String hostGroupName,
Context context) {
return new PagedFlux<>(() -> listByHostGroupSinglePageAsync(resourceGroupName, hostGroupName, context),
nextLink -> listByHostGroupNextSinglePageAsync(nextLink, context));
}
/**
* Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property in the response
* to get the next page of dedicated hosts.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list dedicated host operation response as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByHostGroup(String resourceGroupName, String hostGroupName) {
return new PagedIterable<>(listByHostGroupAsync(resourceGroupName, hostGroupName));
}
/**
* Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property in the response
* to get the next page of dedicated hosts.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list dedicated host operation response as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByHostGroup(String resourceGroupName, String hostGroupName,
Context context) {
return new PagedIterable<>(listByHostGroupAsync(resourceGroupName, hostGroupName, context));
}
/**
* Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is
* running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource
* Health Center in the Azure Portal. Please refer to
* https://docs.microsoft.com/azure/service-health/resource-health-overview for more details.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> restartWithResponseAsync(String resourceGroupName, String hostGroupName,
String hostname) {
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 (hostGroupName == null) {
return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null."));
}
if (hostname == null) {
return Mono.error(new IllegalArgumentException("Parameter hostname 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 = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.restart(this.client.getEndpoint(), resourceGroupName, hostGroupName,
hostname, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is
* running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource
* Health Center in the Azure Portal. Please refer to
* https://docs.microsoft.com/azure/service-health/resource-health-overview for more details.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> restartWithResponseAsync(String resourceGroupName, String hostGroupName,
String hostname, 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 (hostGroupName == null) {
return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null."));
}
if (hostname == null) {
return Mono.error(new IllegalArgumentException("Parameter hostname 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 = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.restart(this.client.getEndpoint(), resourceGroupName, hostGroupName, hostname, apiVersion,
this.client.getSubscriptionId(), accept, context);
}
/**
* Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is
* running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource
* Health Center in the Azure Portal. Please refer to
* https://docs.microsoft.com/azure/service-health/resource-health-overview for more details.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginRestartAsync(String resourceGroupName, String hostGroupName,
String hostname) {
Mono>> mono = restartWithResponseAsync(resourceGroupName, hostGroupName, hostname);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is
* running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource
* Health Center in the Azure Portal. Please refer to
* https://docs.microsoft.com/azure/service-health/resource-health-overview for more details.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginRestartAsync(String resourceGroupName, String hostGroupName,
String hostname, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= restartWithResponseAsync(resourceGroupName, hostGroupName, hostname, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is
* running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource
* Health Center in the Azure Portal. Please refer to
* https://docs.microsoft.com/azure/service-health/resource-health-overview for more details.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginRestart(String resourceGroupName, String hostGroupName,
String hostname) {
return this.beginRestartAsync(resourceGroupName, hostGroupName, hostname).getSyncPoller();
}
/**
* Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is
* running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource
* Health Center in the Azure Portal. Please refer to
* https://docs.microsoft.com/azure/service-health/resource-health-overview for more details.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginRestart(String resourceGroupName, String hostGroupName,
String hostname, Context context) {
return this.beginRestartAsync(resourceGroupName, hostGroupName, hostname, context).getSyncPoller();
}
/**
* Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is
* running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource
* Health Center in the Azure Portal. Please refer to
* https://docs.microsoft.com/azure/service-health/resource-health-overview for more details.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono restartAsync(String resourceGroupName, String hostGroupName, String hostname) {
return beginRestartAsync(resourceGroupName, hostGroupName, hostname).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is
* running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource
* Health Center in the Azure Portal. Please refer to
* https://docs.microsoft.com/azure/service-health/resource-health-overview for more details.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono restartAsync(String resourceGroupName, String hostGroupName, String hostname, Context context) {
return beginRestartAsync(resourceGroupName, hostGroupName, hostname, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is
* running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource
* Health Center in the Azure Portal. Please refer to
* https://docs.microsoft.com/azure/service-health/resource-health-overview for more details.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void restart(String resourceGroupName, String hostGroupName, String hostname) {
restartAsync(resourceGroupName, hostGroupName, hostname).block();
}
/**
* Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is
* running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource
* Health Center in the Azure Portal. Please refer to
* https://docs.microsoft.com/azure/service-health/resource-health-overview for more details.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void restart(String resourceGroupName, String hostGroupName, String hostname, Context context) {
restartAsync(resourceGroupName, hostGroupName, hostname, context).block();
}
/**
* Redeploy the dedicated host. The operation will complete successfully once the dedicated host has migrated to a
* new node and is running. To determine the health of VMs deployed on the dedicated host after the redeploy check
* the Resource Health Center in the Azure Portal. Please refer to
* https://docs.microsoft.com/azure/service-health/resource-health-overview for more details.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> redeployWithResponseAsync(String resourceGroupName, String hostGroupName,
String hostname) {
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 (hostGroupName == null) {
return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null."));
}
if (hostname == null) {
return Mono.error(new IllegalArgumentException("Parameter hostname 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 = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.redeploy(this.client.getEndpoint(), resourceGroupName, hostGroupName,
hostname, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Redeploy the dedicated host. The operation will complete successfully once the dedicated host has migrated to a
* new node and is running. To determine the health of VMs deployed on the dedicated host after the redeploy check
* the Resource Health Center in the Azure Portal. Please refer to
* https://docs.microsoft.com/azure/service-health/resource-health-overview for more details.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> redeployWithResponseAsync(String resourceGroupName, String hostGroupName,
String hostname, 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 (hostGroupName == null) {
return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null."));
}
if (hostname == null) {
return Mono.error(new IllegalArgumentException("Parameter hostname 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 = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.redeploy(this.client.getEndpoint(), resourceGroupName, hostGroupName, hostname, apiVersion,
this.client.getSubscriptionId(), accept, context);
}
/**
* Redeploy the dedicated host. The operation will complete successfully once the dedicated host has migrated to a
* new node and is running. To determine the health of VMs deployed on the dedicated host after the redeploy check
* the Resource Health Center in the Azure Portal. Please refer to
* https://docs.microsoft.com/azure/service-health/resource-health-overview for more details.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginRedeployAsync(String resourceGroupName, String hostGroupName,
String hostname) {
Mono>> mono = redeployWithResponseAsync(resourceGroupName, hostGroupName, hostname);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Redeploy the dedicated host. The operation will complete successfully once the dedicated host has migrated to a
* new node and is running. To determine the health of VMs deployed on the dedicated host after the redeploy check
* the Resource Health Center in the Azure Portal. Please refer to
* https://docs.microsoft.com/azure/service-health/resource-health-overview for more details.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginRedeployAsync(String resourceGroupName, String hostGroupName,
String hostname, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= redeployWithResponseAsync(resourceGroupName, hostGroupName, hostname, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Redeploy the dedicated host. The operation will complete successfully once the dedicated host has migrated to a
* new node and is running. To determine the health of VMs deployed on the dedicated host after the redeploy check
* the Resource Health Center in the Azure Portal. Please refer to
* https://docs.microsoft.com/azure/service-health/resource-health-overview for more details.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginRedeploy(String resourceGroupName, String hostGroupName,
String hostname) {
return this.beginRedeployAsync(resourceGroupName, hostGroupName, hostname).getSyncPoller();
}
/**
* Redeploy the dedicated host. The operation will complete successfully once the dedicated host has migrated to a
* new node and is running. To determine the health of VMs deployed on the dedicated host after the redeploy check
* the Resource Health Center in the Azure Portal. Please refer to
* https://docs.microsoft.com/azure/service-health/resource-health-overview for more details.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginRedeploy(String resourceGroupName, String hostGroupName,
String hostname, Context context) {
return this.beginRedeployAsync(resourceGroupName, hostGroupName, hostname, context).getSyncPoller();
}
/**
* Redeploy the dedicated host. The operation will complete successfully once the dedicated host has migrated to a
* new node and is running. To determine the health of VMs deployed on the dedicated host after the redeploy check
* the Resource Health Center in the Azure Portal. Please refer to
* https://docs.microsoft.com/azure/service-health/resource-health-overview for more details.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono redeployAsync(String resourceGroupName, String hostGroupName, String hostname) {
return beginRedeployAsync(resourceGroupName, hostGroupName, hostname).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Redeploy the dedicated host. The operation will complete successfully once the dedicated host has migrated to a
* new node and is running. To determine the health of VMs deployed on the dedicated host after the redeploy check
* the Resource Health Center in the Azure Portal. Please refer to
* https://docs.microsoft.com/azure/service-health/resource-health-overview for more details.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono redeployAsync(String resourceGroupName, String hostGroupName, String hostname, Context context) {
return beginRedeployAsync(resourceGroupName, hostGroupName, hostname, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Redeploy the dedicated host. The operation will complete successfully once the dedicated host has migrated to a
* new node and is running. To determine the health of VMs deployed on the dedicated host after the redeploy check
* the Resource Health Center in the Azure Portal. Please refer to
* https://docs.microsoft.com/azure/service-health/resource-health-overview for more details.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void redeploy(String resourceGroupName, String hostGroupName, String hostname) {
redeployAsync(resourceGroupName, hostGroupName, hostname).block();
}
/**
* Redeploy the dedicated host. The operation will complete successfully once the dedicated host has migrated to a
* new node and is running. To determine the health of VMs deployed on the dedicated host after the redeploy check
* the Resource Health Center in the Azure Portal. Please refer to
* https://docs.microsoft.com/azure/service-health/resource-health-overview for more details.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void redeploy(String resourceGroupName, String hostGroupName, String hostname, Context context) {
redeployAsync(resourceGroupName, hostGroupName, hostname, context).block();
}
/**
* Lists all available dedicated host sizes to which the specified dedicated host can be resized. NOTE: The
* dedicated host sizes provided can be used to only scale up the existing dedicated host.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Dedicated Host sizes operation response along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listAvailableSizesSinglePageAsync(String resourceGroupName,
String hostGroupName, String hostname) {
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 (hostGroupName == null) {
return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null."));
}
if (hostname == null) {
return Mono.error(new IllegalArgumentException("Parameter hostname 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 = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.listAvailableSizes(this.client.getEndpoint(), resourceGroupName,
hostGroupName, hostname, apiVersion, this.client.getSubscriptionId(), accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(),
res.getHeaders(), res.getValue().value(), null, null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Lists all available dedicated host sizes to which the specified dedicated host can be resized. NOTE: The
* dedicated host sizes provided can be used to only scale up the existing dedicated host.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Dedicated Host sizes operation response along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listAvailableSizesSinglePageAsync(String resourceGroupName,
String hostGroupName, String hostname, 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 (hostGroupName == null) {
return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null."));
}
if (hostname == null) {
return Mono.error(new IllegalArgumentException("Parameter hostname 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 = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.listAvailableSizes(this.client.getEndpoint(), resourceGroupName, hostGroupName, hostname, apiVersion,
this.client.getSubscriptionId(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), null, null));
}
/**
* Lists all available dedicated host sizes to which the specified dedicated host can be resized. NOTE: The
* dedicated host sizes provided can be used to only scale up the existing dedicated host.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Dedicated Host sizes operation response as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listAvailableSizesAsync(String resourceGroupName, String hostGroupName, String hostname) {
return new PagedFlux<>(() -> listAvailableSizesSinglePageAsync(resourceGroupName, hostGroupName, hostname));
}
/**
* Lists all available dedicated host sizes to which the specified dedicated host can be resized. NOTE: The
* dedicated host sizes provided can be used to only scale up the existing dedicated host.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Dedicated Host sizes operation response as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAvailableSizesAsync(String resourceGroupName, String hostGroupName, String hostname,
Context context) {
return new PagedFlux<>(
() -> listAvailableSizesSinglePageAsync(resourceGroupName, hostGroupName, hostname, context));
}
/**
* Lists all available dedicated host sizes to which the specified dedicated host can be resized. NOTE: The
* dedicated host sizes provided can be used to only scale up the existing dedicated host.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Dedicated Host sizes operation response as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listAvailableSizes(String resourceGroupName, String hostGroupName, String hostname) {
return new PagedIterable<>(listAvailableSizesAsync(resourceGroupName, hostGroupName, hostname));
}
/**
* Lists all available dedicated host sizes to which the specified dedicated host can be resized. NOTE: The
* dedicated host sizes provided can be used to only scale up the existing dedicated host.
*
* @param resourceGroupName The name of the resource group.
* @param hostGroupName The name of the dedicated host group.
* @param hostname The name of the dedicated host.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Dedicated Host sizes operation response as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listAvailableSizes(String resourceGroupName, String hostGroupName, String hostname,
Context context) {
return new PagedIterable<>(listAvailableSizesAsync(resourceGroupName, hostGroupName, hostname, context));
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list dedicated host operation response along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByHostGroupNextSinglePageAsync(String nextLink) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.listByHostGroupNext(nextLink, this.client.getEndpoint(), accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(),
res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list dedicated host operation response along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByHostGroupNextSinglePageAsync(String nextLink,
Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.listByHostGroupNext(nextLink, this.client.getEndpoint(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
}