All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.automation.implementation.SoftwareUpdateConfigurationsClientImpl 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.automation.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.PathParam;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.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.SoftwareUpdateConfigurationsClient;
import com.azure.resourcemanager.automation.fluent.models.SoftwareUpdateConfigurationInner;
import com.azure.resourcemanager.automation.fluent.models.SoftwareUpdateConfigurationListResultInner;
import reactor.core.publisher.Mono;

/**
 * An instance of this class provides access to all the operations defined in SoftwareUpdateConfigurationsClient.
 */
public final class SoftwareUpdateConfigurationsClientImpl implements SoftwareUpdateConfigurationsClient {
    /**
     * The proxy service used to perform REST calls.
     */
    private final SoftwareUpdateConfigurationsService service;

    /**
     * The service client containing this operation class.
     */
    private final AutomationClientImpl client;

    /**
     * Initializes an instance of SoftwareUpdateConfigurationsClientImpl.
     * 
     * @param client the instance of the service client containing this operation class.
     */
    SoftwareUpdateConfigurationsClientImpl(AutomationClientImpl client) {
        this.service = RestProxy.create(SoftwareUpdateConfigurationsService.class, client.getHttpPipeline(),
            client.getSerializerAdapter());
        this.client = client;
    }

    /**
     * The interface defining all the services for AutomationClientSoftwareUpdateConfigurations to be used by the proxy
     * service to perform REST calls.
     */
    @Host("{$host}")
    @ServiceInterface(name = "AutomationClientSoft")
    public interface SoftwareUpdateConfigurationsService {
        @Headers({ "Content-Type: application/json" })
        @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}")
        @ExpectedResponses({ 200, 201 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono> create(@HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("automationAccountName") String automationAccountName,
            @PathParam("softwareUpdateConfigurationName") String softwareUpdateConfigurationName,
            @QueryParam("api-version") String apiVersion, @HeaderParam("clientRequestId") String clientRequestId,
            @BodyParam("application/json") SoftwareUpdateConfigurationInner parameters,
            @HeaderParam("Accept") String accept, Context context);

        @Headers({ "Content-Type: application/json" })
        @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}")
        @ExpectedResponses({ 200 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono> getByName(@HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("automationAccountName") String automationAccountName,
            @PathParam("softwareUpdateConfigurationName") String softwareUpdateConfigurationName,
            @QueryParam("api-version") String apiVersion, @HeaderParam("clientRequestId") String clientRequestId,
            @HeaderParam("Accept") String accept, Context context);

        @Headers({ "Content-Type: application/json" })
        @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}")
        @ExpectedResponses({ 200, 204 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono> delete(@HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("automationAccountName") String automationAccountName,
            @PathParam("softwareUpdateConfigurationName") String softwareUpdateConfigurationName,
            @QueryParam("api-version") String apiVersion, @HeaderParam("clientRequestId") String clientRequestId,
            @HeaderParam("Accept") String accept, Context context);

        @Headers({ "Content-Type: application/json" })
        @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations")
        @ExpectedResponses({ 200 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono> list(@HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("automationAccountName") String automationAccountName,
            @QueryParam("api-version") String apiVersion, @HeaderParam("clientRequestId") String clientRequestId,
            @QueryParam("$filter") String filter, @HeaderParam("Accept") String accept, Context context);
    }

    /**
     * Create a new software update configuration with the name given in the URI.
     * 
     * @param resourceGroupName Name of an Azure Resource group.
     * @param automationAccountName The name of the automation account.
     * @param softwareUpdateConfigurationName The name of the software update configuration to be created.
     * @param parameters Request body.
     * @param clientRequestId Identifies this specific client 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 software update configuration properties along with {@link Response} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> createWithResponseAsync(String resourceGroupName,
        String automationAccountName, String softwareUpdateConfigurationName,
        SoftwareUpdateConfigurationInner parameters, String clientRequestId) {
        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 (softwareUpdateConfigurationName == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter softwareUpdateConfigurationName is required and cannot be null."));
        }
        if (parameters == null) {
            return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
        } else {
            parameters.validate();
        }
        final String apiVersion = "2019-06-01";
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.create(this.client.getEndpoint(), this.client.getSubscriptionId(),
                resourceGroupName, automationAccountName, softwareUpdateConfigurationName, apiVersion, clientRequestId,
                parameters, accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Create a new software update configuration with the name given in the URI.
     * 
     * @param resourceGroupName Name of an Azure Resource group.
     * @param automationAccountName The name of the automation account.
     * @param softwareUpdateConfigurationName The name of the software update configuration to be created.
     * @param parameters Request body.
     * @param clientRequestId Identifies this specific client 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 software update configuration properties along with {@link Response} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> createWithResponseAsync(String resourceGroupName,
        String automationAccountName, String softwareUpdateConfigurationName,
        SoftwareUpdateConfigurationInner parameters, String clientRequestId, 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 (softwareUpdateConfigurationName == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter softwareUpdateConfigurationName is required and cannot be null."));
        }
        if (parameters == null) {
            return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
        } else {
            parameters.validate();
        }
        final String apiVersion = "2019-06-01";
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
            automationAccountName, softwareUpdateConfigurationName, apiVersion, clientRequestId, parameters, accept,
            context);
    }

    /**
     * Create a new software update configuration with the name given in the URI.
     * 
     * @param resourceGroupName Name of an Azure Resource group.
     * @param automationAccountName The name of the automation account.
     * @param softwareUpdateConfigurationName The name of the software update configuration to be created.
     * @param parameters Request body.
     * @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 software update configuration properties on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono createAsync(String resourceGroupName, String automationAccountName,
        String softwareUpdateConfigurationName, SoftwareUpdateConfigurationInner parameters) {
        final String clientRequestId = null;
        return createWithResponseAsync(resourceGroupName, automationAccountName, softwareUpdateConfigurationName,
            parameters, clientRequestId).flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Create a new software update configuration with the name given in the URI.
     * 
     * @param resourceGroupName Name of an Azure Resource group.
     * @param automationAccountName The name of the automation account.
     * @param softwareUpdateConfigurationName The name of the software update configuration to be created.
     * @param parameters Request body.
     * @param clientRequestId Identifies this specific client 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 software update configuration properties along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response createWithResponse(String resourceGroupName,
        String automationAccountName, String softwareUpdateConfigurationName,
        SoftwareUpdateConfigurationInner parameters, String clientRequestId, Context context) {
        return createWithResponseAsync(resourceGroupName, automationAccountName, softwareUpdateConfigurationName,
            parameters, clientRequestId, context).block();
    }

    /**
     * Create a new software update configuration with the name given in the URI.
     * 
     * @param resourceGroupName Name of an Azure Resource group.
     * @param automationAccountName The name of the automation account.
     * @param softwareUpdateConfigurationName The name of the software update configuration to be created.
     * @param parameters Request body.
     * @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 software update configuration properties.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public SoftwareUpdateConfigurationInner create(String resourceGroupName, String automationAccountName,
        String softwareUpdateConfigurationName, SoftwareUpdateConfigurationInner parameters) {
        final String clientRequestId = null;
        return createWithResponse(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, parameters,
            clientRequestId, Context.NONE).getValue();
    }

    /**
     * Get a single software update configuration by name.
     * 
     * @param resourceGroupName Name of an Azure Resource group.
     * @param automationAccountName The name of the automation account.
     * @param softwareUpdateConfigurationName The name of the software update configuration to be created.
     * @param clientRequestId Identifies this specific client 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 a single software update configuration by name along with {@link Response} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> getByNameWithResponseAsync(String resourceGroupName,
        String automationAccountName, String softwareUpdateConfigurationName, String clientRequestId) {
        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 (softwareUpdateConfigurationName == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter softwareUpdateConfigurationName is required and cannot be null."));
        }
        final String apiVersion = "2019-06-01";
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.getByName(this.client.getEndpoint(), this.client.getSubscriptionId(),
                resourceGroupName, automationAccountName, softwareUpdateConfigurationName, apiVersion, clientRequestId,
                accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Get a single software update configuration by name.
     * 
     * @param resourceGroupName Name of an Azure Resource group.
     * @param automationAccountName The name of the automation account.
     * @param softwareUpdateConfigurationName The name of the software update configuration to be created.
     * @param clientRequestId Identifies this specific client 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 a single software update configuration by name along with {@link Response} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> getByNameWithResponseAsync(String resourceGroupName,
        String automationAccountName, String softwareUpdateConfigurationName, String clientRequestId, 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 (softwareUpdateConfigurationName == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter softwareUpdateConfigurationName is required and cannot be null."));
        }
        final String apiVersion = "2019-06-01";
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.getByName(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
            automationAccountName, softwareUpdateConfigurationName, apiVersion, clientRequestId, accept, context);
    }

    /**
     * Get a single software update configuration by name.
     * 
     * @param resourceGroupName Name of an Azure Resource group.
     * @param automationAccountName The name of the automation account.
     * @param softwareUpdateConfigurationName The name of the software update configuration to be created.
     * @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 a single software update configuration by name on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono getByNameAsync(String resourceGroupName,
        String automationAccountName, String softwareUpdateConfigurationName) {
        final String clientRequestId = null;
        return getByNameWithResponseAsync(resourceGroupName, automationAccountName, softwareUpdateConfigurationName,
            clientRequestId).flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get a single software update configuration by name.
     * 
     * @param resourceGroupName Name of an Azure Resource group.
     * @param automationAccountName The name of the automation account.
     * @param softwareUpdateConfigurationName The name of the software update configuration to be created.
     * @param clientRequestId Identifies this specific client 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 a single software update configuration by name along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response getByNameWithResponse(String resourceGroupName,
        String automationAccountName, String softwareUpdateConfigurationName, String clientRequestId, Context context) {
        return getByNameWithResponseAsync(resourceGroupName, automationAccountName, softwareUpdateConfigurationName,
            clientRequestId, context).block();
    }

    /**
     * Get a single software update configuration by name.
     * 
     * @param resourceGroupName Name of an Azure Resource group.
     * @param automationAccountName The name of the automation account.
     * @param softwareUpdateConfigurationName The name of the software update configuration to be created.
     * @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 a single software update configuration by name.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public SoftwareUpdateConfigurationInner getByName(String resourceGroupName, String automationAccountName,
        String softwareUpdateConfigurationName) {
        final String clientRequestId = null;
        return getByNameWithResponse(resourceGroupName, automationAccountName, softwareUpdateConfigurationName,
            clientRequestId, Context.NONE).getValue();
    }

    /**
     * delete a specific software update configuration.
     * 
     * @param resourceGroupName Name of an Azure Resource group.
     * @param automationAccountName The name of the automation account.
     * @param softwareUpdateConfigurationName The name of the software update configuration to be created.
     * @param clientRequestId Identifies this specific client 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 Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> deleteWithResponseAsync(String resourceGroupName, String automationAccountName,
        String softwareUpdateConfigurationName, String clientRequestId) {
        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 (softwareUpdateConfigurationName == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter softwareUpdateConfigurationName is required and cannot be null."));
        }
        final String apiVersion = "2019-06-01";
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(),
                resourceGroupName, automationAccountName, softwareUpdateConfigurationName, apiVersion, clientRequestId,
                accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * delete a specific software update configuration.
     * 
     * @param resourceGroupName Name of an Azure Resource group.
     * @param automationAccountName The name of the automation account.
     * @param softwareUpdateConfigurationName The name of the software update configuration to be created.
     * @param clientRequestId Identifies this specific client 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 Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> deleteWithResponseAsync(String resourceGroupName, String automationAccountName,
        String softwareUpdateConfigurationName, String clientRequestId, 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 (softwareUpdateConfigurationName == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter softwareUpdateConfigurationName is required and cannot be null."));
        }
        final String apiVersion = "2019-06-01";
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
            automationAccountName, softwareUpdateConfigurationName, apiVersion, clientRequestId, accept, context);
    }

    /**
     * delete a specific software update configuration.
     * 
     * @param resourceGroupName Name of an Azure Resource group.
     * @param automationAccountName The name of the automation account.
     * @param softwareUpdateConfigurationName The name of the software update configuration to be created.
     * @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 A {@link Mono} that completes when a successful response is received.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono deleteAsync(String resourceGroupName, String automationAccountName,
        String softwareUpdateConfigurationName) {
        final String clientRequestId = null;
        return deleteWithResponseAsync(resourceGroupName, automationAccountName, softwareUpdateConfigurationName,
            clientRequestId).flatMap(ignored -> Mono.empty());
    }

    /**
     * delete a specific software update configuration.
     * 
     * @param resourceGroupName Name of an Azure Resource group.
     * @param automationAccountName The name of the automation account.
     * @param softwareUpdateConfigurationName The name of the software update configuration to be created.
     * @param clientRequestId Identifies this specific client 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 Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response deleteWithResponse(String resourceGroupName, String automationAccountName,
        String softwareUpdateConfigurationName, String clientRequestId, Context context) {
        return deleteWithResponseAsync(resourceGroupName, automationAccountName, softwareUpdateConfigurationName,
            clientRequestId, context).block();
    }

    /**
     * delete a specific software update configuration.
     * 
     * @param resourceGroupName Name of an Azure Resource group.
     * @param automationAccountName The name of the automation account.
     * @param softwareUpdateConfigurationName The name of the software update configuration to be created.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public void delete(String resourceGroupName, String automationAccountName, String softwareUpdateConfigurationName) {
        final String clientRequestId = null;
        deleteWithResponse(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, clientRequestId,
            Context.NONE);
    }

    /**
     * Get all software update configurations for the account.
     * 
     * @param resourceGroupName Name of an Azure Resource group.
     * @param automationAccountName The name of the automation account.
     * @param clientRequestId Identifies this specific client request.
     * @param filter The filter to apply on the 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 all software update configurations for the account along with {@link Response} on successful completion
     * of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listWithResponseAsync(String resourceGroupName,
        String automationAccountName, String clientRequestId, String filter) {
        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."));
        }
        final String apiVersion = "2019-06-01";
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(),
                resourceGroupName, automationAccountName, apiVersion, clientRequestId, filter, accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Get all software update configurations for the account.
     * 
     * @param resourceGroupName Name of an Azure Resource group.
     * @param automationAccountName The name of the automation account.
     * @param clientRequestId Identifies this specific client request.
     * @param filter The filter to apply on the operation.
     * @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 all software update configurations for the account along with {@link Response} on successful completion
     * of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listWithResponseAsync(String resourceGroupName,
        String automationAccountName, String clientRequestId, String filter, 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."));
        }
        final String apiVersion = "2019-06-01";
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
            automationAccountName, apiVersion, clientRequestId, filter, accept, context);
    }

    /**
     * Get all software update configurations for the account.
     * 
     * @param resourceGroupName Name of an Azure Resource group.
     * @param automationAccountName The name of the automation account.
     * @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 all software update configurations for the account on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono listAsync(String resourceGroupName,
        String automationAccountName) {
        final String clientRequestId = null;
        final String filter = null;
        return listWithResponseAsync(resourceGroupName, automationAccountName, clientRequestId, filter)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get all software update configurations for the account.
     * 
     * @param resourceGroupName Name of an Azure Resource group.
     * @param automationAccountName The name of the automation account.
     * @param clientRequestId Identifies this specific client request.
     * @param filter The filter to apply on the operation.
     * @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 all software update configurations for the account along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response listWithResponse(String resourceGroupName,
        String automationAccountName, String clientRequestId, String filter, Context context) {
        return listWithResponseAsync(resourceGroupName, automationAccountName, clientRequestId, filter, context)
            .block();
    }

    /**
     * Get all software update configurations for the account.
     * 
     * @param resourceGroupName Name of an Azure Resource group.
     * @param automationAccountName The name of the automation account.
     * @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 all software update configurations for the account.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public SoftwareUpdateConfigurationListResultInner list(String resourceGroupName, String automationAccountName) {
        final String clientRequestId = null;
        final String filter = null;
        return listWithResponse(resourceGroupName, automationAccountName, clientRequestId, filter, Context.NONE)
            .getValue();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy