com.azure.resourcemanager.automation.implementation.RunbookDraftsClientImpl 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.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.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.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.exception.ManagementException;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.BinaryData;
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.automation.fluent.RunbookDraftsClient;
import com.azure.resourcemanager.automation.fluent.models.RunbookDraftInner;
import com.azure.resourcemanager.automation.fluent.models.RunbookDraftUndoEditResultInner;
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 RunbookDraftsClient.
*/
public final class RunbookDraftsClientImpl implements RunbookDraftsClient {
/**
* The proxy service used to perform REST calls.
*/
private final RunbookDraftsService service;
/**
* The service client containing this operation class.
*/
private final AutomationClientImpl client;
/**
* Initializes an instance of RunbookDraftsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
RunbookDraftsClientImpl(AutomationClientImpl client) {
this.service
= RestProxy.create(RunbookDraftsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for AutomationClientRunbookDrafts to be used by the proxy service to
* perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "AutomationClientRunb")
public interface RunbookDraftsService {
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> getContent(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("automationAccountName") String automationAccountName,
@PathParam("runbookName") String runbookName, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: text/powershell" })
@Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> replaceContent(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("automationAccountName") String automationAccountName,
@PathParam("runbookName") String runbookName, @QueryParam("api-version") String apiVersion,
@BodyParam("text/powershell") Flux runbookContent,
@HeaderParam("Content-Length") long contentLength, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: text/powershell" })
@Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> replaceContent(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("automationAccountName") String automationAccountName,
@PathParam("runbookName") String runbookName, @QueryParam("api-version") String apiVersion,
@BodyParam("text/powershell") BinaryData runbookContent, @HeaderParam("Content-Length") long contentLength,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> get(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("automationAccountName") String automationAccountName,
@PathParam("runbookName") String runbookName, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/undoEdit")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> undoEdit(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("automationAccountName") String automationAccountName,
@PathParam("runbookName") String runbookName, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
}
/**
* Retrieve the content of runbook draft identified by runbook name.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> getContentWithResponseAsync(String resourceGroupName,
String automationAccountName, String runbookName) {
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 (automationAccountName == null) {
return Mono
.error(new IllegalArgumentException("Parameter automationAccountName is required and cannot be null."));
}
if (runbookName == null) {
return Mono.error(new IllegalArgumentException("Parameter runbookName is required and cannot be null."));
}
final String apiVersion = "2018-06-30";
final String accept = "text/powershell";
return FluxUtil
.withContext(context -> service.getContent(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, automationAccountName, runbookName, apiVersion, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Retrieve the content of runbook draft identified by runbook name.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> getContentWithResponseAsync(String resourceGroupName,
String automationAccountName, String runbookName, 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 (automationAccountName == null) {
return Mono
.error(new IllegalArgumentException("Parameter automationAccountName is required and cannot be null."));
}
if (runbookName == null) {
return Mono.error(new IllegalArgumentException("Parameter runbookName is required and cannot be null."));
}
final String apiVersion = "2018-06-30";
final String accept = "text/powershell";
context = this.client.mergeContext(context);
return service.getContent(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
automationAccountName, runbookName, apiVersion, accept, context);
}
/**
* Retrieve the content of runbook draft identified by runbook name.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getContentAsync(String resourceGroupName, String automationAccountName,
String runbookName) {
return getContentWithResponseAsync(resourceGroupName, automationAccountName, runbookName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Retrieve the content of runbook draft identified by runbook name.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response> getContentWithResponse(String resourceGroupName, String automationAccountName,
String runbookName, Context context) {
return getContentWithResponseAsync(resourceGroupName, automationAccountName, runbookName, context).block();
}
/**
* Retrieve the content of runbook draft identified by runbook name.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Flux getContent(String resourceGroupName, String automationAccountName, String runbookName) {
return getContentWithResponse(resourceGroupName, automationAccountName, runbookName, Context.NONE).getValue();
}
/**
* Replaces the runbook draft content.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param runbookContent The runbook draft content.
* @param contentLength The Content-Length header for the request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> replaceContentWithResponseAsync(String resourceGroupName,
String automationAccountName, String runbookName, Flux runbookContent, long contentLength) {
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 (automationAccountName == null) {
return Mono
.error(new IllegalArgumentException("Parameter automationAccountName is required and cannot be null."));
}
if (runbookName == null) {
return Mono.error(new IllegalArgumentException("Parameter runbookName is required and cannot be null."));
}
if (runbookContent == null) {
return Mono.error(new IllegalArgumentException("Parameter runbookContent is required and cannot be null."));
}
final String apiVersion = "2018-06-30";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.replaceContent(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, automationAccountName, runbookName, apiVersion, runbookContent, contentLength,
accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Replaces the runbook draft content.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param runbookContent The runbook draft content.
* @param contentLength The Content-Length header for the request.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> replaceContentWithResponseAsync(String resourceGroupName,
String automationAccountName, String runbookName, Flux runbookContent, long contentLength,
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 (automationAccountName == null) {
return Mono
.error(new IllegalArgumentException("Parameter automationAccountName is required and cannot be null."));
}
if (runbookName == null) {
return Mono.error(new IllegalArgumentException("Parameter runbookName is required and cannot be null."));
}
if (runbookContent == null) {
return Mono.error(new IllegalArgumentException("Parameter runbookContent is required and cannot be null."));
}
final String apiVersion = "2018-06-30";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.replaceContent(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
automationAccountName, runbookName, apiVersion, runbookContent, contentLength, accept, context);
}
/**
* Replaces the runbook draft content.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param runbookContent The runbook draft content.
* @param contentLength The Content-Length header for the request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, BinaryData> beginReplaceContentAsync(String resourceGroupName,
String automationAccountName, String runbookName, Flux runbookContent, long contentLength) {
Mono>> mono = replaceContentWithResponseAsync(resourceGroupName,
automationAccountName, runbookName, runbookContent, contentLength);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), BinaryData.class,
BinaryData.class, this.client.getContext());
}
/**
* Replaces the runbook draft content.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param runbookContent The runbook draft content.
* @param contentLength The Content-Length header for the request.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, BinaryData> beginReplaceContentAsync(String resourceGroupName,
String automationAccountName, String runbookName, Flux runbookContent, long contentLength,
Context context) {
context = this.client.mergeContext(context);
Mono>> mono = replaceContentWithResponseAsync(resourceGroupName,
automationAccountName, runbookName, runbookContent, contentLength, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), BinaryData.class,
BinaryData.class, context);
}
/**
* Replaces the runbook draft content.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param runbookContent The runbook draft content.
* @param contentLength The Content-Length header for the request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono replaceContentAsync(String resourceGroupName, String automationAccountName,
String runbookName, Flux runbookContent, long contentLength) {
return beginReplaceContentAsync(resourceGroupName, automationAccountName, runbookName, runbookContent,
contentLength).last().flatMap(this.client::getLroFinalResultOrError);
}
/**
* Replaces the runbook draft content.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param runbookContent The runbook draft content.
* @param contentLength The Content-Length header for the request.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono replaceContentAsync(String resourceGroupName, String automationAccountName,
String runbookName, Flux runbookContent, long contentLength, Context context) {
return beginReplaceContentAsync(resourceGroupName, automationAccountName, runbookName, runbookContent,
contentLength, context).last().flatMap(this.client::getLroFinalResultOrError);
}
/**
* Replaces the runbook draft content.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param runbookContent The runbook draft content.
* @param contentLength The Content-Length header for the request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public BinaryData replaceContent(String resourceGroupName, String automationAccountName, String runbookName,
Flux runbookContent, long contentLength) {
return replaceContentAsync(resourceGroupName, automationAccountName, runbookName, runbookContent, contentLength)
.block();
}
/**
* Replaces the runbook draft content.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param runbookContent The runbook draft content.
* @param contentLength The Content-Length header for the request.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public BinaryData replaceContent(String resourceGroupName, String automationAccountName, String runbookName,
Flux runbookContent, long contentLength, Context context) {
return replaceContentAsync(resourceGroupName, automationAccountName, runbookName, runbookContent, contentLength,
context).block();
}
/**
* Replaces the runbook draft content.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param runbookContent The runbook draft content.
* @param contentLength The Content-Length header for the request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> replaceContentWithResponseAsync(String resourceGroupName,
String automationAccountName, String runbookName, BinaryData runbookContent, long contentLength) {
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 (automationAccountName == null) {
return Mono
.error(new IllegalArgumentException("Parameter automationAccountName is required and cannot be null."));
}
if (runbookName == null) {
return Mono.error(new IllegalArgumentException("Parameter runbookName is required and cannot be null."));
}
if (runbookContent == null) {
return Mono.error(new IllegalArgumentException("Parameter runbookContent is required and cannot be null."));
}
final String apiVersion = "2018-06-30";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.replaceContent(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, automationAccountName, runbookName, apiVersion, runbookContent, contentLength,
accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Replaces the runbook draft content.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param runbookContent The runbook draft content.
* @param contentLength The Content-Length header for the request.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> replaceContentWithResponseAsync(String resourceGroupName,
String automationAccountName, String runbookName, BinaryData runbookContent, long contentLength,
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 (automationAccountName == null) {
return Mono
.error(new IllegalArgumentException("Parameter automationAccountName is required and cannot be null."));
}
if (runbookName == null) {
return Mono.error(new IllegalArgumentException("Parameter runbookName is required and cannot be null."));
}
if (runbookContent == null) {
return Mono.error(new IllegalArgumentException("Parameter runbookContent is required and cannot be null."));
}
final String apiVersion = "2018-06-30";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.replaceContent(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
automationAccountName, runbookName, apiVersion, runbookContent, contentLength, accept, context);
}
/**
* Replaces the runbook draft content.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param runbookContent The runbook draft content.
* @param contentLength The Content-Length header for the request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, BinaryData> beginReplaceContentAsync(String resourceGroupName,
String automationAccountName, String runbookName, BinaryData runbookContent, long contentLength) {
Mono>> mono = replaceContentWithResponseAsync(resourceGroupName,
automationAccountName, runbookName, runbookContent, contentLength);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), BinaryData.class,
BinaryData.class, this.client.getContext());
}
/**
* Replaces the runbook draft content.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param runbookContent The runbook draft content.
* @param contentLength The Content-Length header for the request.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, BinaryData> beginReplaceContentAsync(String resourceGroupName,
String automationAccountName, String runbookName, BinaryData runbookContent, long contentLength,
Context context) {
context = this.client.mergeContext(context);
Mono>> mono = replaceContentWithResponseAsync(resourceGroupName,
automationAccountName, runbookName, runbookContent, contentLength, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), BinaryData.class,
BinaryData.class, context);
}
/**
* Replaces the runbook draft content.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param runbookContent The runbook draft content.
* @param contentLength The Content-Length header for the request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, BinaryData> beginReplaceContent(String resourceGroupName,
String automationAccountName, String runbookName, BinaryData runbookContent, long contentLength) {
return this
.beginReplaceContentAsync(resourceGroupName, automationAccountName, runbookName, runbookContent,
contentLength)
.getSyncPoller();
}
/**
* Replaces the runbook draft content.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param runbookContent The runbook draft content.
* @param contentLength The Content-Length header for the request.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, BinaryData> beginReplaceContent(String resourceGroupName,
String automationAccountName, String runbookName, BinaryData runbookContent, long contentLength,
Context context) {
return this
.beginReplaceContentAsync(resourceGroupName, automationAccountName, runbookName, runbookContent,
contentLength, context)
.getSyncPoller();
}
/**
* Replaces the runbook draft content.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param runbookContent The runbook draft content.
* @param contentLength The Content-Length header for the request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono replaceContentAsync(String resourceGroupName, String automationAccountName,
String runbookName, BinaryData runbookContent, long contentLength) {
return beginReplaceContentAsync(resourceGroupName, automationAccountName, runbookName, runbookContent,
contentLength).last().flatMap(this.client::getLroFinalResultOrError);
}
/**
* Replaces the runbook draft content.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param runbookContent The runbook draft content.
* @param contentLength The Content-Length header for the request.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono replaceContentAsync(String resourceGroupName, String automationAccountName,
String runbookName, BinaryData runbookContent, long contentLength, Context context) {
return beginReplaceContentAsync(resourceGroupName, automationAccountName, runbookName, runbookContent,
contentLength, context).last().flatMap(this.client::getLroFinalResultOrError);
}
/**
* Replaces the runbook draft content.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param runbookContent The runbook draft content.
* @param contentLength The Content-Length header for the request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public BinaryData replaceContent(String resourceGroupName, String automationAccountName, String runbookName,
BinaryData runbookContent, long contentLength) {
return replaceContentAsync(resourceGroupName, automationAccountName, runbookName, runbookContent, contentLength)
.block();
}
/**
* Replaces the runbook draft content.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param runbookContent The runbook draft content.
* @param contentLength The Content-Length header for the request.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public BinaryData replaceContent(String resourceGroupName, String automationAccountName, String runbookName,
BinaryData runbookContent, long contentLength, Context context) {
return replaceContentAsync(resourceGroupName, automationAccountName, runbookName, runbookContent, contentLength,
context).block();
}
/**
* Retrieve the runbook draft identified by runbook name.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceGroupName,
String automationAccountName, String runbookName) {
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 (automationAccountName == null) {
return Mono
.error(new IllegalArgumentException("Parameter automationAccountName is required and cannot be null."));
}
if (runbookName == null) {
return Mono.error(new IllegalArgumentException("Parameter runbookName is required and cannot be null."));
}
final String apiVersion = "2018-06-30";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, automationAccountName, runbookName, apiVersion, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Retrieve the runbook draft identified by runbook name.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceGroupName,
String automationAccountName, String runbookName, 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 (automationAccountName == null) {
return Mono
.error(new IllegalArgumentException("Parameter automationAccountName is required and cannot be null."));
}
if (runbookName == null) {
return Mono.error(new IllegalArgumentException("Parameter runbookName is required and cannot be null."));
}
final String apiVersion = "2018-06-30";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
automationAccountName, runbookName, apiVersion, accept, context);
}
/**
* Retrieve the runbook draft identified by runbook name.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono getAsync(String resourceGroupName, String automationAccountName,
String runbookName) {
return getWithResponseAsync(resourceGroupName, automationAccountName, runbookName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Retrieve the runbook draft identified by runbook name.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(String resourceGroupName, String automationAccountName,
String runbookName, Context context) {
return getWithResponseAsync(resourceGroupName, automationAccountName, runbookName, context).block();
}
/**
* Retrieve the runbook draft identified by runbook name.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public RunbookDraftInner get(String resourceGroupName, String automationAccountName, String runbookName) {
return getWithResponse(resourceGroupName, automationAccountName, runbookName, Context.NONE).getValue();
}
/**
* Undo draft edit to last known published state identified by runbook name.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response model for the undo edit runbook operation along with {@link Response} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> undoEditWithResponseAsync(String resourceGroupName,
String automationAccountName, String runbookName) {
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 (automationAccountName == null) {
return Mono
.error(new IllegalArgumentException("Parameter automationAccountName is required and cannot be null."));
}
if (runbookName == null) {
return Mono.error(new IllegalArgumentException("Parameter runbookName is required and cannot be null."));
}
final String apiVersion = "2018-06-30";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.undoEdit(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, automationAccountName, runbookName, apiVersion, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Undo draft edit to last known published state identified by runbook name.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response model for the undo edit runbook operation along with {@link Response} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> undoEditWithResponseAsync(String resourceGroupName,
String automationAccountName, String runbookName, 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 (automationAccountName == null) {
return Mono
.error(new IllegalArgumentException("Parameter automationAccountName is required and cannot be null."));
}
if (runbookName == null) {
return Mono.error(new IllegalArgumentException("Parameter runbookName is required and cannot be null."));
}
final String apiVersion = "2018-06-30";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.undoEdit(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
automationAccountName, runbookName, apiVersion, accept, context);
}
/**
* Undo draft edit to last known published state identified by runbook name.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response model for the undo edit runbook operation on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono undoEditAsync(String resourceGroupName, String automationAccountName,
String runbookName) {
return undoEditWithResponseAsync(resourceGroupName, automationAccountName, runbookName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Undo draft edit to last known published state identified by runbook name.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response model for the undo edit runbook operation along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response undoEditWithResponse(String resourceGroupName,
String automationAccountName, String runbookName, Context context) {
return undoEditWithResponseAsync(resourceGroupName, automationAccountName, runbookName, context).block();
}
/**
* Undo draft edit to last known published state identified by runbook name.
*
* @param resourceGroupName Name of an Azure Resource group.
* @param automationAccountName The name of the automation account.
* @param runbookName The runbook name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response model for the undo edit runbook operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public RunbookDraftUndoEditResultInner undoEdit(String resourceGroupName, String automationAccountName,
String runbookName) {
return undoEditWithResponse(resourceGroupName, automationAccountName, runbookName, Context.NONE).getValue();
}
}