com.azure.resourcemanager.automation.implementation.ResourceProvidersClientImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-automation Show documentation
Show all versions of azure-resourcemanager-automation Show documentation
This package contains Microsoft Azure SDK for Automation Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Automation Client. Package tag package-2022-02-22.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.automation.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.automation.fluent.ResourceProvidersClient;
import com.azure.resourcemanager.automation.fluent.models.GraphicalRunbookContentInner;
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 AutomationClientImpl client;
/**
* Initializes an instance of ResourceProvidersClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
ResourceProvidersClientImpl(AutomationClientImpl client) {
this.service
= RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for AutomationClientResourceProviders to be used by the proxy service to
* perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "AutomationClientReso")
public interface ResourceProvidersService {
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/convertGraphRunbookContent")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> convertGraphRunbookContent(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("automationAccountName") String automationAccountName,
@PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion,
@BodyParam("application/json") GraphicalRunbookContentInner parameters,
@HeaderParam("Accept") String accept, Context context);
}
/**
* Post operation to serialize or deserialize GraphRunbookContent.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param parameters Input data describing the graphical runbook.
* @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 graphical Runbook Content along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> convertGraphRunbookContentWithResponseAsync(
String resourceGroupName, String automationAccountName, GraphicalRunbookContentInner 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 (automationAccountName == null) {
return Mono
.error(new IllegalArgumentException("Parameter automationAccountName 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 = "2021-06-22";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.convertGraphRunbookContent(this.client.getEndpoint(), resourceGroupName,
automationAccountName, this.client.getSubscriptionId(), apiVersion, parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Post operation to serialize or deserialize GraphRunbookContent.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param parameters Input data describing the graphical runbook.
* @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 graphical Runbook Content along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> convertGraphRunbookContentWithResponseAsync(
String resourceGroupName, String automationAccountName, GraphicalRunbookContentInner 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 (automationAccountName == null) {
return Mono
.error(new IllegalArgumentException("Parameter automationAccountName 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 = "2021-06-22";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.convertGraphRunbookContent(this.client.getEndpoint(), resourceGroupName, automationAccountName,
this.client.getSubscriptionId(), apiVersion, parameters, accept, context);
}
/**
* Post operation to serialize or deserialize GraphRunbookContent.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param parameters Input data describing the graphical runbook.
* @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 graphical Runbook Content on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono convertGraphRunbookContentAsync(String resourceGroupName,
String automationAccountName, GraphicalRunbookContentInner parameters) {
return convertGraphRunbookContentWithResponseAsync(resourceGroupName, automationAccountName, parameters)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Post operation to serialize or deserialize GraphRunbookContent.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param parameters Input data describing the graphical runbook.
* @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 graphical Runbook Content along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response convertGraphRunbookContentWithResponse(String resourceGroupName,
String automationAccountName, GraphicalRunbookContentInner parameters, Context context) {
return convertGraphRunbookContentWithResponseAsync(resourceGroupName, automationAccountName, parameters,
context).block();
}
/**
* Post operation to serialize or deserialize GraphRunbookContent.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param parameters Input data describing the graphical runbook.
* @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 graphical Runbook Content.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public GraphicalRunbookContentInner convertGraphRunbookContent(String resourceGroupName,
String automationAccountName, GraphicalRunbookContentInner parameters) {
return convertGraphRunbookContentWithResponse(resourceGroupName, automationAccountName, parameters,
Context.NONE).getValue();
}
}