
com.azure.resourcemanager.recoveryservicesdatareplication.implementation.ResourceProvidersClientImpl Maven / Gradle / Ivy
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.recoveryservicesdatareplication.implementation;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Post;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.exception.ManagementException;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.resourcemanager.recoveryservicesdatareplication.fluent.ResourceProvidersClient;
import com.azure.resourcemanager.recoveryservicesdatareplication.fluent.models.CheckNameAvailabilityResponseModelInner;
import com.azure.resourcemanager.recoveryservicesdatareplication.fluent.models.DeploymentPreflightModelInner;
import com.azure.resourcemanager.recoveryservicesdatareplication.models.CheckNameAvailabilityModel;
import reactor.core.publisher.Mono;
/**
* An instance of this class provides access to all the operations defined in ResourceProvidersClient.
*/
public final class ResourceProvidersClientImpl implements ResourceProvidersClient {
/**
* The proxy service used to perform REST calls.
*/
private final ResourceProvidersService service;
/**
* The service client containing this operation class.
*/
private final DataReplicationMgmtClientImpl client;
/**
* Initializes an instance of ResourceProvidersClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
ResourceProvidersClientImpl(DataReplicationMgmtClientImpl client) {
this.service
= RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for DataReplicationMgmtClientResourceProviders to be used by the proxy
* service to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "DataReplicationMgmtC")
public interface ResourceProvidersService {
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/locations/{location}/checkNameAvailability")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> checkNameAvailability(
@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId,
@PathParam("location") String location, @QueryParam("api-version") String apiVersion,
@BodyParam("application/json") CheckNameAvailabilityModel body, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/deployments/{deploymentId}/preflight")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> deploymentPreflight(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("deploymentId") String deploymentId,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") DeploymentPreflightModelInner body, @HeaderParam("Accept") String accept,
Context context);
}
/**
* Performs the resource name availability check.
*
* Checks the resource name availability.
*
* @param location The name of the Azure region.
* @param body Resource details.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return check name availability response model along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
checkNameAvailabilityWithResponseAsync(String location, CheckNameAvailabilityModel body) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (location == null) {
return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null."));
}
if (body != null) {
body.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.checkNameAvailability(this.client.getEndpoint(),
this.client.getSubscriptionId(), location, this.client.getApiVersion(), body, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Performs the resource name availability check.
*
* Checks the resource name availability.
*
* @param location The name of the Azure region.
* @param body Resource details.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return check name availability response model along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
checkNameAvailabilityWithResponseAsync(String location, CheckNameAvailabilityModel body, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (location == null) {
return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null."));
}
if (body != null) {
body.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.checkNameAvailability(this.client.getEndpoint(), this.client.getSubscriptionId(), location,
this.client.getApiVersion(), body, accept, context);
}
/**
* Performs the resource name availability check.
*
* Checks the resource name availability.
*
* @param location The name of the Azure region.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return check name availability response model on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono checkNameAvailabilityAsync(String location) {
final CheckNameAvailabilityModel body = null;
return checkNameAvailabilityWithResponseAsync(location, body).flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Performs the resource name availability check.
*
* Checks the resource name availability.
*
* @param location The name of the Azure region.
* @param body Resource details.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return check name availability response model along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response checkNameAvailabilityWithResponse(String location,
CheckNameAvailabilityModel body, Context context) {
return checkNameAvailabilityWithResponseAsync(location, body, context).block();
}
/**
* Performs the resource name availability check.
*
* Checks the resource name availability.
*
* @param location The name of the Azure region.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return check name availability response model.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public CheckNameAvailabilityResponseModelInner checkNameAvailability(String location) {
final CheckNameAvailabilityModel body = null;
return checkNameAvailabilityWithResponse(location, body, Context.NONE).getValue();
}
/**
* Performs resource deployment validation.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param deploymentId Deployment Id.
* @param body Deployment preflight model.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return deployment preflight model along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> deploymentPreflightWithResponseAsync(String resourceGroupName,
String deploymentId, DeploymentPreflightModelInner body) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (deploymentId == null) {
return Mono.error(new IllegalArgumentException("Parameter deploymentId is required and cannot be null."));
}
if (body != null) {
body.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.deploymentPreflight(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, deploymentId, this.client.getApiVersion(), body, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Performs resource deployment validation.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param deploymentId Deployment Id.
* @param body Deployment preflight model.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return deployment preflight model along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> deploymentPreflightWithResponseAsync(String resourceGroupName,
String deploymentId, DeploymentPreflightModelInner body, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (deploymentId == null) {
return Mono.error(new IllegalArgumentException("Parameter deploymentId is required and cannot be null."));
}
if (body != null) {
body.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.deploymentPreflight(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, deploymentId, this.client.getApiVersion(), body, accept, context);
}
/**
* Performs resource deployment validation.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param deploymentId Deployment Id.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return deployment preflight model on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono deploymentPreflightAsync(String resourceGroupName,
String deploymentId) {
final DeploymentPreflightModelInner body = null;
return deploymentPreflightWithResponseAsync(resourceGroupName, deploymentId, body)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Performs resource deployment validation.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param deploymentId Deployment Id.
* @param body Deployment preflight model.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return deployment preflight model along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response deploymentPreflightWithResponse(String resourceGroupName,
String deploymentId, DeploymentPreflightModelInner body, Context context) {
return deploymentPreflightWithResponseAsync(resourceGroupName, deploymentId, body, context).block();
}
/**
* Performs resource deployment validation.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param deploymentId Deployment Id.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return deployment preflight model.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DeploymentPreflightModelInner deploymentPreflight(String resourceGroupName, String deploymentId) {
final DeploymentPreflightModelInner body = null;
return deploymentPreflightWithResponse(resourceGroupName, deploymentId, body, Context.NONE).getValue();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy