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

com.azure.resourcemanager.migrationdiscoverysap.implementation.SapDiscoverySitesClientImpl Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for MigrationDiscoverySap Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Migration Discovery SAP Client. Package tag package-preview-2023-10.

There is a newer version: 1.0.0-beta.2
Show 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.migrationdiscoverysap.implementation;

import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.Delete;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.Patch;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Post;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.exception.ManagementException;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.polling.PollerFlux;
import com.azure.core.util.polling.SyncPoller;
import com.azure.resourcemanager.migrationdiscoverysap.fluent.SapDiscoverySitesClient;
import com.azure.resourcemanager.migrationdiscoverysap.fluent.models.OperationStatusResultInner;
import com.azure.resourcemanager.migrationdiscoverysap.fluent.models.SapDiscoverySiteInner;
import com.azure.resourcemanager.migrationdiscoverysap.models.SapDiscoverySiteListResult;
import com.azure.resourcemanager.migrationdiscoverysap.models.SapDiscoverySiteTagsUpdate;
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 SapDiscoverySitesClient.
 */
public final class SapDiscoverySitesClientImpl implements SapDiscoverySitesClient {
    /**
     * The proxy service used to perform REST calls.
     */
    private final SapDiscoverySitesService service;

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

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

    /**
     * The interface defining all the services for MigrationDiscoverySapMgmtClientSapDiscoverySites to be used by the
     * proxy service to perform REST calls.
     */
    @Host("{$host}")
    @ServiceInterface(name = "MigrationDiscoverySa")
    public interface SapDiscoverySitesService {
        @Headers({ "Content-Type: application/json" })
        @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/sapDiscoverySites")
        @ExpectedResponses({ 200 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono> list(@HostParam("$host") String endpoint,
            @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
            @HeaderParam("Accept") String accept, Context context);

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

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

        @Headers({ "Content-Type: application/json" })
        @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapDiscoverySites/{sapDiscoverySiteName}")
        @ExpectedResponses({ 200, 201 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono>> create(@HostParam("$host") String endpoint,
            @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("sapDiscoverySiteName") String sapDiscoverySiteName,
            @BodyParam("application/json") SapDiscoverySiteInner resource, @HeaderParam("Accept") String accept,
            Context context);

        @Headers({ "Content-Type: application/json" })
        @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapDiscoverySites/{sapDiscoverySiteName}")
        @ExpectedResponses({ 200 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono> update(@HostParam("$host") String endpoint,
            @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("sapDiscoverySiteName") String sapDiscoverySiteName,
            @BodyParam("application/json") SapDiscoverySiteTagsUpdate properties, @HeaderParam("Accept") String accept,
            Context context);

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

        @Headers({ "Content-Type: application/json" })
        @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapDiscoverySites/{sapDiscoverySiteName}/importEntities")
        @ExpectedResponses({ 200, 202 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono>> importEntities(@HostParam("$host") String endpoint,
            @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("sapDiscoverySiteName") String sapDiscoverySiteName, @HeaderParam("Accept") String accept,
            Context context);

        @Headers({ "Content-Type: application/json" })
        @Get("{nextLink}")
        @ExpectedResponses({ 200 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono> listBySubscriptionNext(
            @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
            @HeaderParam("Accept") String accept, Context context);

        @Headers({ "Content-Type: application/json" })
        @Get("{nextLink}")
        @ExpectedResponses({ 200 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono> listByResourceGroupNext(
            @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
            @HeaderParam("Accept") String accept, Context context);
    }

    /**
     * Gets all SAP Migration discovery site resources in a Subscription.
     * 
     * @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 SAP Migration discovery site resources in a Subscription along with {@link PagedResponse} on
     * successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listSinglePageAsync() {
        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."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(),
                this.client.getSubscriptionId(), accept, context))
            .>map(res -> new PagedResponseBase<>(res.getRequest(),
                res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Gets all SAP Migration discovery site resources in a Subscription.
     * 
     * @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 SAP Migration discovery site resources in a Subscription along with {@link PagedResponse} on
     * successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listSinglePageAsync(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."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), accept,
                context)
            .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                res.getValue().value(), res.getValue().nextLink(), null));
    }

    /**
     * Gets all SAP Migration discovery site resources in a Subscription.
     * 
     * @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 SAP Migration discovery site resources in a Subscription as paginated response with
     * {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux listAsync() {
        return new PagedFlux<>(() -> listSinglePageAsync(),
            nextLink -> listBySubscriptionNextSinglePageAsync(nextLink));
    }

    /**
     * Gets all SAP Migration discovery site resources in a Subscription.
     * 
     * @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 SAP Migration discovery site resources in a Subscription as paginated response with
     * {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux listAsync(Context context) {
        return new PagedFlux<>(() -> listSinglePageAsync(context),
            nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context));
    }

    /**
     * Gets all SAP Migration discovery site resources in a Subscription.
     * 
     * @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 SAP Migration discovery site resources in a Subscription as paginated response with
     * {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable list() {
        return new PagedIterable<>(listAsync());
    }

    /**
     * Gets all SAP Migration discovery site resources in a Subscription.
     * 
     * @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 SAP Migration discovery site resources in a Subscription as paginated response with
     * {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable list(Context context) {
        return new PagedIterable<>(listAsync(context));
    }

    /**
     * Gets all SAP Migration discovery site resources in a Resource Group.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @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 SAP Migration discovery site resources in a Resource Group along with {@link PagedResponse} on
     * successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) {
        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."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(),
                this.client.getSubscriptionId(), resourceGroupName, accept, context))
            .>map(res -> new PagedResponseBase<>(res.getRequest(),
                res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Gets all SAP Migration discovery site resources in a Resource Group.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @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 SAP Migration discovery site resources in a Resource Group along with {@link PagedResponse} on
     * successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName,
        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."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(),
                this.client.getSubscriptionId(), resourceGroupName, accept, context)
            .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                res.getValue().value(), res.getValue().nextLink(), null));
    }

    /**
     * Gets all SAP Migration discovery site resources in a Resource Group.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @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 SAP Migration discovery site resources in a Resource Group as paginated response with
     * {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux listByResourceGroupAsync(String resourceGroupName) {
        return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName),
            nextLink -> listByResourceGroupNextSinglePageAsync(nextLink));
    }

    /**
     * Gets all SAP Migration discovery site resources in a Resource Group.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @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 SAP Migration discovery site resources in a Resource Group as paginated response with
     * {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) {
        return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context),
            nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context));
    }

    /**
     * Gets all SAP Migration discovery site resources in a Resource Group.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @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 SAP Migration discovery site resources in a Resource Group as paginated response with
     * {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable listByResourceGroup(String resourceGroupName) {
        return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName));
    }

    /**
     * Gets all SAP Migration discovery site resources in a Resource Group.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @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 SAP Migration discovery site resources in a Resource Group as paginated response with
     * {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable listByResourceGroup(String resourceGroupName, Context context) {
        return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context));
    }

    /**
     * Gets a SAP Migration discovery site resource.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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 SAP Migration discovery site resource along with {@link Response} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName,
        String sapDiscoverySiteName) {
        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 (sapDiscoverySiteName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter sapDiscoverySiteName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(),
                this.client.getSubscriptionId(), resourceGroupName, sapDiscoverySiteName, accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Gets a SAP Migration discovery site resource.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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 SAP Migration discovery site resource along with {@link Response} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName,
        String sapDiscoverySiteName, 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 (sapDiscoverySiteName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter sapDiscoverySiteName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(),
            this.client.getSubscriptionId(), resourceGroupName, sapDiscoverySiteName, accept, context);
    }

    /**
     * Gets a SAP Migration discovery site resource.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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 SAP Migration discovery site resource on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono getByResourceGroupAsync(String resourceGroupName, String sapDiscoverySiteName) {
        return getByResourceGroupWithResponseAsync(resourceGroupName, sapDiscoverySiteName)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Gets a SAP Migration discovery site resource.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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 SAP Migration discovery site resource along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response getByResourceGroupWithResponse(String resourceGroupName,
        String sapDiscoverySiteName, Context context) {
        return getByResourceGroupWithResponseAsync(resourceGroupName, sapDiscoverySiteName, context).block();
    }

    /**
     * Gets a SAP Migration discovery site resource.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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 SAP Migration discovery site resource.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public SapDiscoverySiteInner getByResourceGroup(String resourceGroupName, String sapDiscoverySiteName) {
        return getByResourceGroupWithResponse(resourceGroupName, sapDiscoverySiteName, Context.NONE).getValue();
    }

    /**
     * Creates a discovery site resource for SAP Migration. This resource will be used to run system discovery and
     * assessment with Azure Migrate.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @param resource Resource create parameters.
     * @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 define the SAP Migration discovery site resource along with {@link Response} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>> createWithResponseAsync(String resourceGroupName,
        String sapDiscoverySiteName, SapDiscoverySiteInner resource) {
        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 (sapDiscoverySiteName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter sapDiscoverySiteName is required and cannot be null."));
        }
        if (resource == null) {
            return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null."));
        } else {
            resource.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(),
                this.client.getSubscriptionId(), resourceGroupName, sapDiscoverySiteName, resource, accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Creates a discovery site resource for SAP Migration. This resource will be used to run system discovery and
     * assessment with Azure Migrate.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @param resource Resource create parameters.
     * @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 define the SAP Migration discovery site resource along with {@link Response} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>> createWithResponseAsync(String resourceGroupName,
        String sapDiscoverySiteName, SapDiscoverySiteInner resource, 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 (sapDiscoverySiteName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter sapDiscoverySiteName is required and cannot be null."));
        }
        if (resource == null) {
            return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null."));
        } else {
            resource.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.create(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(),
            resourceGroupName, sapDiscoverySiteName, resource, accept, context);
    }

    /**
     * Creates a discovery site resource for SAP Migration. This resource will be used to run system discovery and
     * assessment with Azure Migrate.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @param resource Resource create parameters.
     * @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 define the SAP Migration discovery site resource.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, SapDiscoverySiteInner>
        beginCreateAsync(String resourceGroupName, String sapDiscoverySiteName, SapDiscoverySiteInner resource) {
        Mono>> mono
            = createWithResponseAsync(resourceGroupName, sapDiscoverySiteName, resource);
        return this.client.getLroResult(mono,
            this.client.getHttpPipeline(), SapDiscoverySiteInner.class, SapDiscoverySiteInner.class,
            this.client.getContext());
    }

    /**
     * Creates a discovery site resource for SAP Migration. This resource will be used to run system discovery and
     * assessment with Azure Migrate.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @param resource Resource create parameters.
     * @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 define the SAP Migration discovery site resource.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, SapDiscoverySiteInner> beginCreateAsync(
        String resourceGroupName, String sapDiscoverySiteName, SapDiscoverySiteInner resource, Context context) {
        context = this.client.mergeContext(context);
        Mono>> mono
            = createWithResponseAsync(resourceGroupName, sapDiscoverySiteName, resource, context);
        return this.client.getLroResult(mono,
            this.client.getHttpPipeline(), SapDiscoverySiteInner.class, SapDiscoverySiteInner.class, context);
    }

    /**
     * Creates a discovery site resource for SAP Migration. This resource will be used to run system discovery and
     * assessment with Azure Migrate.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @param resource Resource create parameters.
     * @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 define the SAP Migration discovery site resource.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller, SapDiscoverySiteInner> beginCreate(String resourceGroupName,
        String sapDiscoverySiteName, SapDiscoverySiteInner resource) {
        return this.beginCreateAsync(resourceGroupName, sapDiscoverySiteName, resource).getSyncPoller();
    }

    /**
     * Creates a discovery site resource for SAP Migration. This resource will be used to run system discovery and
     * assessment with Azure Migrate.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @param resource Resource create parameters.
     * @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 define the SAP Migration discovery site resource.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller, SapDiscoverySiteInner> beginCreate(String resourceGroupName,
        String sapDiscoverySiteName, SapDiscoverySiteInner resource, Context context) {
        return this.beginCreateAsync(resourceGroupName, sapDiscoverySiteName, resource, context).getSyncPoller();
    }

    /**
     * Creates a discovery site resource for SAP Migration. This resource will be used to run system discovery and
     * assessment with Azure Migrate.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @param resource Resource create parameters.
     * @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 define the SAP Migration discovery site resource on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono createAsync(String resourceGroupName, String sapDiscoverySiteName,
        SapDiscoverySiteInner resource) {
        return beginCreateAsync(resourceGroupName, sapDiscoverySiteName, resource).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Creates a discovery site resource for SAP Migration. This resource will be used to run system discovery and
     * assessment with Azure Migrate.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @param resource Resource create parameters.
     * @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 define the SAP Migration discovery site resource on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono createAsync(String resourceGroupName, String sapDiscoverySiteName,
        SapDiscoverySiteInner resource, Context context) {
        return beginCreateAsync(resourceGroupName, sapDiscoverySiteName, resource, context).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Creates a discovery site resource for SAP Migration. This resource will be used to run system discovery and
     * assessment with Azure Migrate.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @param resource Resource create parameters.
     * @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 define the SAP Migration discovery site resource.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public SapDiscoverySiteInner create(String resourceGroupName, String sapDiscoverySiteName,
        SapDiscoverySiteInner resource) {
        return createAsync(resourceGroupName, sapDiscoverySiteName, resource).block();
    }

    /**
     * Creates a discovery site resource for SAP Migration. This resource will be used to run system discovery and
     * assessment with Azure Migrate.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @param resource Resource create parameters.
     * @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 define the SAP Migration discovery site resource.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public SapDiscoverySiteInner create(String resourceGroupName, String sapDiscoverySiteName,
        SapDiscoverySiteInner resource, Context context) {
        return createAsync(resourceGroupName, sapDiscoverySiteName, resource, context).block();
    }

    /**
     * Updates a SAP Migration discovery site resource.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @param properties The resource properties to be updated.
     * @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 define the SAP Migration discovery site resource along with {@link Response} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> updateWithResponseAsync(String resourceGroupName,
        String sapDiscoverySiteName, SapDiscoverySiteTagsUpdate properties) {
        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 (sapDiscoverySiteName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter sapDiscoverySiteName is required and cannot be null."));
        }
        if (properties == null) {
            return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null."));
        } else {
            properties.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(),
                this.client.getSubscriptionId(), resourceGroupName, sapDiscoverySiteName, properties, accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Updates a SAP Migration discovery site resource.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @param properties The resource properties to be updated.
     * @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 define the SAP Migration discovery site resource along with {@link Response} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> updateWithResponseAsync(String resourceGroupName,
        String sapDiscoverySiteName, SapDiscoverySiteTagsUpdate properties, 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 (sapDiscoverySiteName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter sapDiscoverySiteName is required and cannot be null."));
        }
        if (properties == null) {
            return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null."));
        } else {
            properties.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(),
            resourceGroupName, sapDiscoverySiteName, properties, accept, context);
    }

    /**
     * Updates a SAP Migration discovery site resource.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @param properties The resource properties to be updated.
     * @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 define the SAP Migration discovery site resource on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono updateAsync(String resourceGroupName, String sapDiscoverySiteName,
        SapDiscoverySiteTagsUpdate properties) {
        return updateWithResponseAsync(resourceGroupName, sapDiscoverySiteName, properties)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Updates a SAP Migration discovery site resource.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @param properties The resource properties to be updated.
     * @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 define the SAP Migration discovery site resource along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response updateWithResponse(String resourceGroupName, String sapDiscoverySiteName,
        SapDiscoverySiteTagsUpdate properties, Context context) {
        return updateWithResponseAsync(resourceGroupName, sapDiscoverySiteName, properties, context).block();
    }

    /**
     * Updates a SAP Migration discovery site resource.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @param properties The resource properties to be updated.
     * @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 define the SAP Migration discovery site resource.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public SapDiscoverySiteInner update(String resourceGroupName, String sapDiscoverySiteName,
        SapDiscoverySiteTagsUpdate properties) {
        return updateWithResponse(resourceGroupName, sapDiscoverySiteName, properties, Context.NONE).getValue();
    }

    /**
     * Deletes a SAP Migration discovery site resource and its child resources, that is the associated SAP Instances and
     * Server Instances.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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 sapDiscoverySiteName) {
        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 (sapDiscoverySiteName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter sapDiscoverySiteName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(),
                this.client.getSubscriptionId(), resourceGroupName, sapDiscoverySiteName, accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Deletes a SAP Migration discovery site resource and its child resources, that is the associated SAP Instances and
     * Server Instances.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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 sapDiscoverySiteName, 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 (sapDiscoverySiteName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter sapDiscoverySiteName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(),
            resourceGroupName, sapDiscoverySiteName, accept, context);
    }

    /**
     * Deletes a SAP Migration discovery site resource and its child resources, that is the associated SAP Instances and
     * Server Instances.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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, Void> beginDeleteAsync(String resourceGroupName, String sapDiscoverySiteName) {
        Mono>> mono = deleteWithResponseAsync(resourceGroupName, sapDiscoverySiteName);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
            this.client.getContext());
    }

    /**
     * Deletes a SAP Migration discovery site resource and its child resources, that is the associated SAP Instances and
     * Server Instances.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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, Void> beginDeleteAsync(String resourceGroupName, String sapDiscoverySiteName,
        Context context) {
        context = this.client.mergeContext(context);
        Mono>> mono
            = deleteWithResponseAsync(resourceGroupName, sapDiscoverySiteName, context);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
            context);
    }

    /**
     * Deletes a SAP Migration discovery site resource and its child resources, that is the associated SAP Instances and
     * Server Instances.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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, Void> beginDelete(String resourceGroupName, String sapDiscoverySiteName) {
        return this.beginDeleteAsync(resourceGroupName, sapDiscoverySiteName).getSyncPoller();
    }

    /**
     * Deletes a SAP Migration discovery site resource and its child resources, that is the associated SAP Instances and
     * Server Instances.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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, Void> beginDelete(String resourceGroupName, String sapDiscoverySiteName,
        Context context) {
        return this.beginDeleteAsync(resourceGroupName, sapDiscoverySiteName, context).getSyncPoller();
    }

    /**
     * Deletes a SAP Migration discovery site resource and its child resources, that is the associated SAP Instances and
     * Server Instances.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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 sapDiscoverySiteName) {
        return beginDeleteAsync(resourceGroupName, sapDiscoverySiteName).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Deletes a SAP Migration discovery site resource and its child resources, that is the associated SAP Instances and
     * Server Instances.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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 {@link Mono} that completes when a successful response is received.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono deleteAsync(String resourceGroupName, String sapDiscoverySiteName, Context context) {
        return beginDeleteAsync(resourceGroupName, sapDiscoverySiteName, context).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Deletes a SAP Migration discovery site resource and its child resources, that is the associated SAP Instances and
     * Server Instances.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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 sapDiscoverySiteName) {
        deleteAsync(resourceGroupName, sapDiscoverySiteName).block();
    }

    /**
     * Deletes a SAP Migration discovery site resource and its child resources, that is the associated SAP Instances and
     * Server Instances.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public void delete(String resourceGroupName, String sapDiscoverySiteName, Context context) {
        deleteAsync(resourceGroupName, sapDiscoverySiteName, context).block();
    }

    /**
     * Import your SAP systems' inventory using the [Discovery
     * template](https://go.microsoft.com/fwlink/?linkid=2249111) into your SAP Migration discovery site resource and
     * it's child resources, the SAP instances and Server instances.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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 current status of an async operation along with {@link Response} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>> importEntitiesWithResponseAsync(String resourceGroupName,
        String sapDiscoverySiteName) {
        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 (sapDiscoverySiteName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter sapDiscoverySiteName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.importEntities(this.client.getEndpoint(), this.client.getApiVersion(),
                this.client.getSubscriptionId(), resourceGroupName, sapDiscoverySiteName, accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Import your SAP systems' inventory using the [Discovery
     * template](https://go.microsoft.com/fwlink/?linkid=2249111) into your SAP Migration discovery site resource and
     * it's child resources, the SAP instances and Server instances.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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 current status of an async operation along with {@link Response} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>> importEntitiesWithResponseAsync(String resourceGroupName,
        String sapDiscoverySiteName, 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 (sapDiscoverySiteName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter sapDiscoverySiteName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.importEntities(this.client.getEndpoint(), this.client.getApiVersion(),
            this.client.getSubscriptionId(), resourceGroupName, sapDiscoverySiteName, accept, context);
    }

    /**
     * Import your SAP systems' inventory using the [Discovery
     * template](https://go.microsoft.com/fwlink/?linkid=2249111) into your SAP Migration discovery site resource and
     * it's child resources, the SAP instances and Server instances.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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 the current status of an async operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, OperationStatusResultInner>
        beginImportEntitiesAsync(String resourceGroupName, String sapDiscoverySiteName) {
        Mono>> mono
            = importEntitiesWithResponseAsync(resourceGroupName, sapDiscoverySiteName);
        return this.client.getLroResult(mono,
            this.client.getHttpPipeline(), OperationStatusResultInner.class, OperationStatusResultInner.class,
            this.client.getContext());
    }

    /**
     * Import your SAP systems' inventory using the [Discovery
     * template](https://go.microsoft.com/fwlink/?linkid=2249111) into your SAP Migration discovery site resource and
     * it's child resources, the SAP instances and Server instances.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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 the current status of an async operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, OperationStatusResultInner>
        beginImportEntitiesAsync(String resourceGroupName, String sapDiscoverySiteName, Context context) {
        context = this.client.mergeContext(context);
        Mono>> mono
            = importEntitiesWithResponseAsync(resourceGroupName, sapDiscoverySiteName, context);
        return this.client.getLroResult(mono,
            this.client.getHttpPipeline(), OperationStatusResultInner.class, OperationStatusResultInner.class, context);
    }

    /**
     * Import your SAP systems' inventory using the [Discovery
     * template](https://go.microsoft.com/fwlink/?linkid=2249111) into your SAP Migration discovery site resource and
     * it's child resources, the SAP instances and Server instances.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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 the current status of an async operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller, OperationStatusResultInner>
        beginImportEntities(String resourceGroupName, String sapDiscoverySiteName) {
        return this.beginImportEntitiesAsync(resourceGroupName, sapDiscoverySiteName).getSyncPoller();
    }

    /**
     * Import your SAP systems' inventory using the [Discovery
     * template](https://go.microsoft.com/fwlink/?linkid=2249111) into your SAP Migration discovery site resource and
     * it's child resources, the SAP instances and Server instances.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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 the current status of an async operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller, OperationStatusResultInner>
        beginImportEntities(String resourceGroupName, String sapDiscoverySiteName, Context context) {
        return this.beginImportEntitiesAsync(resourceGroupName, sapDiscoverySiteName, context).getSyncPoller();
    }

    /**
     * Import your SAP systems' inventory using the [Discovery
     * template](https://go.microsoft.com/fwlink/?linkid=2249111) into your SAP Migration discovery site resource and
     * it's child resources, the SAP instances and Server instances.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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 current status of an async operation on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono importEntitiesAsync(String resourceGroupName,
        String sapDiscoverySiteName) {
        return beginImportEntitiesAsync(resourceGroupName, sapDiscoverySiteName).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Import your SAP systems' inventory using the [Discovery
     * template](https://go.microsoft.com/fwlink/?linkid=2249111) into your SAP Migration discovery site resource and
     * it's child resources, the SAP instances and Server instances.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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 current status of an async operation on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono importEntitiesAsync(String resourceGroupName, String sapDiscoverySiteName,
        Context context) {
        return beginImportEntitiesAsync(resourceGroupName, sapDiscoverySiteName, context).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Import your SAP systems' inventory using the [Discovery
     * template](https://go.microsoft.com/fwlink/?linkid=2249111) into your SAP Migration discovery site resource and
     * it's child resources, the SAP instances and Server instances.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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 current status of an async operation.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public OperationStatusResultInner importEntities(String resourceGroupName, String sapDiscoverySiteName) {
        return importEntitiesAsync(resourceGroupName, sapDiscoverySiteName).block();
    }

    /**
     * Import your SAP systems' inventory using the [Discovery
     * template](https://go.microsoft.com/fwlink/?linkid=2249111) into your SAP Migration discovery site resource and
     * it's child resources, the SAP instances and Server instances.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration.
     * @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 current status of an async operation.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public OperationStatusResultInner importEntities(String resourceGroupName, String sapDiscoverySiteName,
        Context context) {
        return importEntitiesAsync(resourceGroupName, sapDiscoverySiteName, context).block();
    }

    /**
     * Get the next page of items.
     * 
     * @param nextLink The URL to get the next list of items
     * 
     * The nextLink parameter.
     * @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 of a SAPDiscoverySite list operation along with {@link PagedResponse} on successful
     * completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) {
        if (nextLink == null) {
            return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
        }
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context))
            .>map(res -> new PagedResponseBase<>(res.getRequest(),
                res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Get the next page of items.
     * 
     * @param nextLink The URL to get the next list of items
     * 
     * The nextLink parameter.
     * @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 of a SAPDiscoverySite list operation along with {@link PagedResponse} on successful
     * completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listBySubscriptionNextSinglePageAsync(String nextLink,
        Context context) {
        if (nextLink == null) {
            return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
        }
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)
            .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                res.getValue().value(), res.getValue().nextLink(), null));
    }

    /**
     * Get the next page of items.
     * 
     * @param nextLink The URL to get the next list of items
     * 
     * The nextLink parameter.
     * @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 of a SAPDiscoverySite list operation along with {@link PagedResponse} on successful
     * completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) {
        if (nextLink == null) {
            return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
        }
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context))
            .>map(res -> new PagedResponseBase<>(res.getRequest(),
                res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Get the next page of items.
     * 
     * @param nextLink The URL to get the next list of items
     * 
     * The nextLink parameter.
     * @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 of a SAPDiscoverySite list operation along with {@link PagedResponse} on successful
     * completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listByResourceGroupNextSinglePageAsync(String nextLink,
        Context context) {
        if (nextLink == null) {
            return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
        }
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)
            .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                res.getValue().value(), res.getValue().nextLink(), null));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy