text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.signalr.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.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.signalr.fluent.SignalRSharedPrivateLinkResourcesClient;
import com.azure.resourcemanager.signalr.fluent.models.SharedPrivateLinkResourceInner;
import com.azure.resourcemanager.signalr.models.SharedPrivateLinkResourceList;
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 SignalRSharedPrivateLinkResourcesClient.
 */
public final class SignalRSharedPrivateLinkResourcesClientImpl implements SignalRSharedPrivateLinkResourcesClient {
    /** The proxy service used to perform REST calls. */
    private final SignalRSharedPrivateLinkResourcesService service;

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

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

    /**
     * The interface defining all the services for SignalRManagementClientSignalRSharedPrivateLinkResources to be used
     * by the proxy service to perform REST calls.
     */
    @Host("{$host}")
    @ServiceInterface(name = "SignalRManagementCli")
    public interface SignalRSharedPrivateLinkResourcesService {
        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService"
                + "/signalR/{resourceName}/sharedPrivateLinkResources")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<SharedPrivateLinkResourceList>> list(
            @HostParam("$host") String endpoint,
            @QueryParam("api-version") String apiVersion,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("resourceName") String resourceName,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService"
                + "/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<SharedPrivateLinkResourceInner>> get(
            @HostParam("$host") String endpoint,
            @PathParam("sharedPrivateLinkResourceName") String sharedPrivateLinkResourceName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("resourceName") String resourceName,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Put(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService"
                + "/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}")
        @ExpectedResponses({200, 201})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> createOrUpdate(
            @HostParam("$host") String endpoint,
            @PathParam("sharedPrivateLinkResourceName") String sharedPrivateLinkResourceName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("resourceName") String resourceName,
            @BodyParam("application/json") SharedPrivateLinkResourceInner parameters,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Delete(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService"
                + "/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}")
        @ExpectedResponses({200, 202, 204})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> delete(
            @HostParam("$host") String endpoint,
            @PathParam("sharedPrivateLinkResourceName") String sharedPrivateLinkResourceName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("resourceName") String resourceName,
            @HeaderParam("Accept") String accept,
            Context context);

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

    /**
     * List shared private link resources.
     *
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @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 list of shared private link resources along with {@link PagedResponse} on successful completion of
     *     {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<SharedPrivateLinkResourceInner>> listSinglePageAsync(
        String resourceGroupName, String resourceName) {
        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 (resourceName == null) {
            return Mono.error(new IllegalArgumentException("Parameter resourceName 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(),
                            resourceGroupName,
                            resourceName,
                            accept,
                            context))
            .<PagedResponse<SharedPrivateLinkResourceInner>>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()));
    }

    /**
     * List shared private link resources.
     *
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @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 list of shared private link resources along with {@link PagedResponse} on successful completion of
     *     {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<SharedPrivateLinkResourceInner>> listSinglePageAsync(
        String resourceGroupName, String resourceName, 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 (resourceName == null) {
            return Mono.error(new IllegalArgumentException("Parameter resourceName 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(),
                resourceGroupName,
                resourceName,
                accept,
                context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }

    /**
     * List shared private link resources.
     *
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @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 list of shared private link resources as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<SharedPrivateLinkResourceInner> listAsync(String resourceGroupName, String resourceName) {
        return new PagedFlux<>(
            () -> listSinglePageAsync(resourceGroupName, resourceName), nextLink -> listNextSinglePageAsync(nextLink));
    }

    /**
     * List shared private link resources.
     *
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @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 list of shared private link resources as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<SharedPrivateLinkResourceInner> listAsync(
        String resourceGroupName, String resourceName, Context context) {
        return new PagedFlux<>(
            () -> listSinglePageAsync(resourceGroupName, resourceName, context),
            nextLink -> listNextSinglePageAsync(nextLink, context));
    }

    /**
     * List shared private link resources.
     *
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @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 list of shared private link resources as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<SharedPrivateLinkResourceInner> list(String resourceGroupName, String resourceName) {
        return new PagedIterable<>(listAsync(resourceGroupName, resourceName));
    }

    /**
     * List shared private link resources.
     *
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @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 list of shared private link resources as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<SharedPrivateLinkResourceInner> list(
        String resourceGroupName, String resourceName, Context context) {
        return new PagedIterable<>(listAsync(resourceGroupName, resourceName, context));
    }

    /**
     * Get the specified shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @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 specified shared private link resource along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<SharedPrivateLinkResourceInner>> getWithResponseAsync(
        String sharedPrivateLinkResourceName, String resourceGroupName, String resourceName) {
        if (this.client.getEndpoint() == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (sharedPrivateLinkResourceName == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter sharedPrivateLinkResourceName 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 (resourceName == null) {
            return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .get(
                            this.client.getEndpoint(),
                            sharedPrivateLinkResourceName,
                            this.client.getApiVersion(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            resourceName,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Get the specified shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @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 specified shared private link resource along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<SharedPrivateLinkResourceInner>> getWithResponseAsync(
        String sharedPrivateLinkResourceName, String resourceGroupName, String resourceName, Context context) {
        if (this.client.getEndpoint() == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (sharedPrivateLinkResourceName == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter sharedPrivateLinkResourceName 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 (resourceName == null) {
            return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .get(
                this.client.getEndpoint(),
                sharedPrivateLinkResourceName,
                this.client.getApiVersion(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                resourceName,
                accept,
                context);
    }

    /**
     * Get the specified shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @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 specified shared private link resource on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<SharedPrivateLinkResourceInner> getAsync(
        String sharedPrivateLinkResourceName, String resourceGroupName, String resourceName) {
        return getWithResponseAsync(sharedPrivateLinkResourceName, resourceGroupName, resourceName)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get the specified shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @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 specified shared private link resource along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<SharedPrivateLinkResourceInner> getWithResponse(
        String sharedPrivateLinkResourceName, String resourceGroupName, String resourceName, Context context) {
        return getWithResponseAsync(sharedPrivateLinkResourceName, resourceGroupName, resourceName, context).block();
    }

    /**
     * Get the specified shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @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 specified shared private link resource.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public SharedPrivateLinkResourceInner get(
        String sharedPrivateLinkResourceName, String resourceGroupName, String resourceName) {
        return getWithResponse(sharedPrivateLinkResourceName, resourceGroupName, resourceName, Context.NONE).getValue();
    }

    /**
     * Create or update a shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @param parameters The shared private link resource.
     * @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 describes a Shared Private Link Resource along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(
        String sharedPrivateLinkResourceName,
        String resourceGroupName,
        String resourceName,
        SharedPrivateLinkResourceInner parameters) {
        if (this.client.getEndpoint() == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (sharedPrivateLinkResourceName == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter sharedPrivateLinkResourceName 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 (resourceName == null) {
            return Mono.error(new IllegalArgumentException("Parameter resourceName 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 accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .createOrUpdate(
                            this.client.getEndpoint(),
                            sharedPrivateLinkResourceName,
                            this.client.getApiVersion(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            resourceName,
                            parameters,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Create or update a shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @param parameters The shared private link resource.
     * @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 describes a Shared Private Link Resource along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(
        String sharedPrivateLinkResourceName,
        String resourceGroupName,
        String resourceName,
        SharedPrivateLinkResourceInner parameters,
        Context context) {
        if (this.client.getEndpoint() == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (sharedPrivateLinkResourceName == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter sharedPrivateLinkResourceName 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 (resourceName == null) {
            return Mono.error(new IllegalArgumentException("Parameter resourceName 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 accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .createOrUpdate(
                this.client.getEndpoint(),
                sharedPrivateLinkResourceName,
                this.client.getApiVersion(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                resourceName,
                parameters,
                accept,
                context);
    }

    /**
     * Create or update a shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @param parameters The shared private link resource.
     * @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 describes a Shared Private Link Resource.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<SharedPrivateLinkResourceInner>, SharedPrivateLinkResourceInner>
        beginCreateOrUpdateAsync(
            String sharedPrivateLinkResourceName,
            String resourceGroupName,
            String resourceName,
            SharedPrivateLinkResourceInner parameters) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            createOrUpdateWithResponseAsync(sharedPrivateLinkResourceName, resourceGroupName, resourceName, parameters);
        return this
            .client
            .<SharedPrivateLinkResourceInner, SharedPrivateLinkResourceInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                SharedPrivateLinkResourceInner.class,
                SharedPrivateLinkResourceInner.class,
                this.client.getContext());
    }

    /**
     * Create or update a shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @param parameters The shared private link resource.
     * @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 describes a Shared Private Link Resource.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<SharedPrivateLinkResourceInner>, SharedPrivateLinkResourceInner>
        beginCreateOrUpdateAsync(
            String sharedPrivateLinkResourceName,
            String resourceGroupName,
            String resourceName,
            SharedPrivateLinkResourceInner parameters,
            Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            createOrUpdateWithResponseAsync(
                sharedPrivateLinkResourceName, resourceGroupName, resourceName, parameters, context);
        return this
            .client
            .<SharedPrivateLinkResourceInner, SharedPrivateLinkResourceInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                SharedPrivateLinkResourceInner.class,
                SharedPrivateLinkResourceInner.class,
                context);
    }

    /**
     * Create or update a shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @param parameters The shared private link resource.
     * @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 describes a Shared Private Link Resource.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<SharedPrivateLinkResourceInner>, SharedPrivateLinkResourceInner> beginCreateOrUpdate(
        String sharedPrivateLinkResourceName,
        String resourceGroupName,
        String resourceName,
        SharedPrivateLinkResourceInner parameters) {
        return beginCreateOrUpdateAsync(sharedPrivateLinkResourceName, resourceGroupName, resourceName, parameters)
            .getSyncPoller();
    }

    /**
     * Create or update a shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @param parameters The shared private link resource.
     * @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 describes a Shared Private Link Resource.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<SharedPrivateLinkResourceInner>, SharedPrivateLinkResourceInner> beginCreateOrUpdate(
        String sharedPrivateLinkResourceName,
        String resourceGroupName,
        String resourceName,
        SharedPrivateLinkResourceInner parameters,
        Context context) {
        return beginCreateOrUpdateAsync(
                sharedPrivateLinkResourceName, resourceGroupName, resourceName, parameters, context)
            .getSyncPoller();
    }

    /**
     * Create or update a shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @param parameters The shared private link resource.
     * @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 describes a Shared Private Link Resource on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<SharedPrivateLinkResourceInner> createOrUpdateAsync(
        String sharedPrivateLinkResourceName,
        String resourceGroupName,
        String resourceName,
        SharedPrivateLinkResourceInner parameters) {
        return beginCreateOrUpdateAsync(sharedPrivateLinkResourceName, resourceGroupName, resourceName, parameters)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create or update a shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @param parameters The shared private link resource.
     * @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 describes a Shared Private Link Resource on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<SharedPrivateLinkResourceInner> createOrUpdateAsync(
        String sharedPrivateLinkResourceName,
        String resourceGroupName,
        String resourceName,
        SharedPrivateLinkResourceInner parameters,
        Context context) {
        return beginCreateOrUpdateAsync(
                sharedPrivateLinkResourceName, resourceGroupName, resourceName, parameters, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create or update a shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @param parameters The shared private link resource.
     * @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 describes a Shared Private Link Resource.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public SharedPrivateLinkResourceInner createOrUpdate(
        String sharedPrivateLinkResourceName,
        String resourceGroupName,
        String resourceName,
        SharedPrivateLinkResourceInner parameters) {
        return createOrUpdateAsync(sharedPrivateLinkResourceName, resourceGroupName, resourceName, parameters).block();
    }

    /**
     * Create or update a shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @param parameters The shared private link resource.
     * @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 describes a Shared Private Link Resource.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public SharedPrivateLinkResourceInner createOrUpdate(
        String sharedPrivateLinkResourceName,
        String resourceGroupName,
        String resourceName,
        SharedPrivateLinkResourceInner parameters,
        Context context) {
        return createOrUpdateAsync(sharedPrivateLinkResourceName, resourceGroupName, resourceName, parameters, context)
            .block();
    }

    /**
     * Delete the specified shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @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<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
        String sharedPrivateLinkResourceName, String resourceGroupName, String resourceName) {
        if (this.client.getEndpoint() == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (sharedPrivateLinkResourceName == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter sharedPrivateLinkResourceName 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 (resourceName == null) {
            return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .delete(
                            this.client.getEndpoint(),
                            sharedPrivateLinkResourceName,
                            this.client.getApiVersion(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            resourceName,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Delete the specified shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @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<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
        String sharedPrivateLinkResourceName, String resourceGroupName, String resourceName, Context context) {
        if (this.client.getEndpoint() == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (sharedPrivateLinkResourceName == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter sharedPrivateLinkResourceName 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 (resourceName == null) {
            return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .delete(
                this.client.getEndpoint(),
                sharedPrivateLinkResourceName,
                this.client.getApiVersion(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                resourceName,
                accept,
                context);
    }

    /**
     * Delete the specified shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @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<PollResult<Void>, Void> beginDeleteAsync(
        String sharedPrivateLinkResourceName, String resourceGroupName, String resourceName) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            deleteWithResponseAsync(sharedPrivateLinkResourceName, resourceGroupName, resourceName);
        return this
            .client
            .<Void, Void>getLroResult(
                mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext());
    }

    /**
     * Delete the specified shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @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<PollResult<Void>, Void> beginDeleteAsync(
        String sharedPrivateLinkResourceName, String resourceGroupName, String resourceName, Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            deleteWithResponseAsync(sharedPrivateLinkResourceName, resourceGroupName, resourceName, context);
        return this
            .client
            .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
    }

    /**
     * Delete the specified shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @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<PollResult<Void>, Void> beginDelete(
        String sharedPrivateLinkResourceName, String resourceGroupName, String resourceName) {
        return beginDeleteAsync(sharedPrivateLinkResourceName, resourceGroupName, resourceName).getSyncPoller();
    }

    /**
     * Delete the specified shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @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<PollResult<Void>, Void> beginDelete(
        String sharedPrivateLinkResourceName, String resourceGroupName, String resourceName, Context context) {
        return beginDeleteAsync(sharedPrivateLinkResourceName, resourceGroupName, resourceName, context)
            .getSyncPoller();
    }

    /**
     * Delete the specified shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @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<Void> deleteAsync(
        String sharedPrivateLinkResourceName, String resourceGroupName, String resourceName) {
        return beginDeleteAsync(sharedPrivateLinkResourceName, resourceGroupName, resourceName)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Delete the specified shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @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<Void> deleteAsync(
        String sharedPrivateLinkResourceName, String resourceGroupName, String resourceName, Context context) {
        return beginDeleteAsync(sharedPrivateLinkResourceName, resourceGroupName, resourceName, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Delete the specified shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @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 sharedPrivateLinkResourceName, String resourceGroupName, String resourceName) {
        deleteAsync(sharedPrivateLinkResourceName, resourceGroupName, resourceName).block();
    }

    /**
     * Delete the specified shared private link resource.
     *
     * @param sharedPrivateLinkResourceName The name of the shared private link resource.
     * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value
     *     from the Azure Resource Manager API or the portal.
     * @param resourceName The name of the resource.
     * @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 sharedPrivateLinkResourceName, String resourceGroupName, String resourceName, Context context) {
        deleteAsync(sharedPrivateLinkResourceName, resourceGroupName, resourceName, context).block();
    }

    /**
     * Get the next page of items.
     *
     * @param nextLink The URL to get the next list of items
     *     <p>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 a list of shared private link resources along with {@link PagedResponse} on successful completion of
     *     {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<SharedPrivateLinkResourceInner>> listNextSinglePageAsync(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.listNext(nextLink, this.client.getEndpoint(), accept, context))
            .<PagedResponse<SharedPrivateLinkResourceInner>>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
     *     <p>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 a list of shared private link resources along with {@link PagedResponse} on successful completion of
     *     {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<SharedPrivateLinkResourceInner>> listNextSinglePageAsync(
        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
            .listNext(nextLink, this.client.getEndpoint(), accept, context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }
}


text:
// Generated Source
import CountryInfo from "./CountryInfo";
import ExtensionInfo from "./ExtensionInfo";

interface PhoneNumberInfo {

    /**
     * Internal identifier of a phone number
     */
    id?: string;

    /**
     * Brief information on a phone number country
     */
    country?: CountryInfo;

    /**
     * Information on the extension, to which the phone number is assigned. Returned only for the request of Account phone number list
     */
    extension?: ExtensionInfo;

    /**
     * Custom user name of a phone number, if any. Supported for numbers assigned to Auto-Receptionist, with usage type 'CompanyNumber'
     */
    label?: string;

    /**
     * Location (City, State). Filled for local US numbers
     */
    location?: string;

    /**
     * Payment type. 'External' is returned for forwarded numbers which are not terminated in the RingCentral phone system
     */
    paymentType?: "External" | "TollFree" | "Local";

    /**
     * Phone number
     */
    phoneNumber?: string;

    /**
     * Status of a phone number. If the value is 'Normal', the phone number is ready to be used. Otherwise it is an external number not yet ported to RingCentral
     */
    status?: string;

    /**
     * Phone number type
     */
    type?: "VoiceFax" | "FaxOnly" | "VoiceOnly";

    /**
     * Usage type of the phone number
     */
    usageType?: "MainCompanyNumber" | "AdditionalCompanyNumber" | "CompanyNumber" | "DirectNumber" | "CompanyFaxNumber" | "ForwardedNumber" | "ForwardedCompanyNumber" | "ContactCenterNumber";
}

export default PhoneNumberInfo;

redpajama_set_name: RedPajamaGithub


text:
require 'rails/generators'
require 'rails/generators/rails/plugin_new/plugin_new_generator'

module Mechanic
  class EngineGenerator < Rails::Generators::PluginNewGenerator

    class_option :database, :type => :string, :aliases => '-d', :default => "sqlite3",
      :desc => "Preconfigure for selected database (options: #{DATABASES.join('/')})"

    class_option :github, :type => :string, :aliases => '-G', :default => nil,
      :desc => 'Create Github repository and add remote origin pointed to repo'

    class_option :webkit, :type => :boolean, :aliases => '-W', :default => true,
      :desc => 'Add the Capybara Webkit Javascript integration testing library'

    class_option :skip_test_unit, :type => :boolean, :aliases => '-T', :default => true,
      :desc => 'Skip Test::Unit files'

    class_option :dummy_path, :type => :string, :default => "spec/dummy",
      :desc => "Create dummy application at given path"

    def finish_template
      invoke :call_the_mechanic
      super
    end

    def call_the_mechanic
      invoke :setup_development_environment
      invoke :customize_gemspec
      invoke :setup_test_database
      invoke :configure_engine
      invoke :setup_git
      invoke :create_github_repo
      invoke :wrap_up
    end

    def setup_development_environment
      say 'Setting up the development environment'
      build :raise_delivery_errors
    end

    def customize_gemspec
      build :add_custom_gems

      if options[:webkit]
        build :add_capybara_webkit_gem
      end

      bundle_command 'install'
    end

    def setup_test_database
      say 'Setting up database in spec/dummy'

      if 'postgresql' == options[:database]
        build :use_postgres_config_template
      end

      build :create_database
    end

    def configure_engine
      say 'Configuring engine'
      build :configure_action_mailer
      build :generate_rspec
      build :configure_time_zone

      if options[:webkit]
        build :configure_capybara_webkit
      end

      build :add_email_validator
      build :setup_default_rake_task
    end

    def setup_git
      say 'Initializing git'
      invoke :setup_gitignore
      invoke :init_git
    end

    def create_github_repo
      if options[:github]
        say 'Creating Github repo'
        build :create_github_repo, options[:github]
      end
    end

    def wrap_up
      say 'Congratulations! Your trip to shop was a success.'
    end

    def setup_gitignore
      build :gitignore_files
    end

    def init_git
      build :init_git
    end

    def run_bundle
      # Let's not: We'll bundle manually at the right spot
    end

    private

    def get_builder_class
      Mechanic::EngineBuilder
    end

    def using_active_record?
      !options[:skip_active_record]
    end
  end
end


text:
package dynaml

import (
	"fmt"
	"strings"

	"github.com/mandelsoft/spiff/yaml"
)

const F_TagDef = "tagdef"

func init() {
	RegisterFunction(F_TagDef, func_tagdef)
}

func func_tagdef(arguments []interface{}, binding Binding) (interface{}, EvaluationInfo, bool) {
	info := DefaultInfo()
	ttype := "local"

	if len(arguments) < 2 || len(arguments) > 3 {
		return info.Error("two or three arguments expected for %s", F_TagDef)
	}
	name, ok := arguments[0].(string)
	if !ok {
		return info.Error("name argument for %s must be a string", F_TagDef)
	}
	if strings.HasPrefix(name, "*") && len(arguments) == 2 {
		name = name[1:]
		ttype = "global"
	}
	if err := CheckTagName(name); err != nil {
		return info.Error("invalid tag name %q for %s: %s", name, F_TagDef, err)
	}
	value := yaml.NewNode(arguments[1], fmt.Sprintf("tagdef(%s)", binding.Path()))
	if len(arguments) == 3 {
		str, ok := arguments[2].(string)
		if !ok {
			return info.Error("type argument for %s must be a string (local or global)", F_TagDef)
		}
		ttype = str
	}
	var scope TagScope
	switch ttype {
	case "local":
		scope = TAG_SCOPE_STREAM
	case "global":
		scope = TAG_SCOPE_GLOBAL
	default:
		return info.Error("invalid scope argument %q for %s (must be local or global)", ttype, F_TagDef)
	}
	scope |= TAG_LOCAL
	err := binding.GetState().SetTag(name, value, binding.Path(), scope)
	if err != nil {
		return info.Error("%s", err)
	}
	return arguments[1], info, true
}


text:
namespace blink {

PresentationAvailabilityCallback::PresentationAvailabilityCallback(PassRefPtrWillBeRawPtr<ScriptPromiseResolver> resolver)
    : m_resolver(resolver)
{
    ASSERT(m_resolver);
}

void PresentationAvailabilityCallback::onSuccess(bool* result)
{
    OwnPtr<bool> availability = adoptPtr(result);
    if (!m_resolver->executionContext() || m_resolver->executionContext()->activeDOMObjectsAreStopped())
        return;
    m_resolver->resolve(PresentationAvailability::take(m_resolver.get(), *availability));
}

void PresentationAvailabilityCallback::onError(WebPresentationError* result)
{
    OwnPtr<WebPresentationError> error = adoptPtr(result);
    if (!m_resolver->executionContext() || m_resolver->executionContext()->activeDOMObjectsAreStopped())
        return;
    m_resolver->reject(PresentationError::take(*error));
}

} // namespace blink


text:
'use strict';
var assert = require('assert'),
    redis = require('redis'),
    IORedis = require('ioredis'),
    helpers = require(__dirname + '/helpers'),
    RedisStream = require(__dirname + '/../');

describe('bunyan redis stream - integration', function() {
    var clients = {
            redis   : redis.createClient(),
            ioredis : new IORedis()
        },
        subscribeClients = {
            redis   : redis.createClient(),
            ioredis : new IORedis()
        };

    describe('channel', function() {
        var streams = [
                new RedisStream({
                    client : clients.redis,
                    key    : 'redis',
                    type   : 'channel'
                }),
                new RedisStream({
                    client : clients.ioredis,
                    key    : 'ioredis',
                    type   : 'channel'
                })
            ],
            loggers = [{
                name   : 'redis',
                key    : 'redis',
                client : clients.redis,
                stream : streams[0],
                logger : helpers.getLogger(streams[0])
            }, {
                name   : 'ioredis',
                key    : 'ioredis',
                client : clients.ioredis,
                stream : streams[1],
                logger : helpers.getLogger(streams[1])
            }];

        loggers.forEach(function(logger) {
            describe(logger.name, function() {
                before(function(done) {
                    subscribeClients[logger.name].subscribe(logger.key, function() {
                        done();
                    });
                });

                afterEach(function() {
                    logger.client.flushall();
                });

                it('should publish a message to the correct channel', function(done) {
                    subscribeClients[logger.name].once('message', function(channel) {
                        assert.strictEqual(channel, logger.name);
                        done();
                    });
                    logger.logger.info('test');
                });
                it('should publish a message with the correct msg property value', function(done) {
                    subscribeClients[logger.name].once('message', function(channel, message) {
                        message = JSON.parse(message);
                        assert.strictEqual(message.msg, 'test');
                        done();
                    });
                    logger.logger.info('test');
                });
                it('should publish a message with the correct level property value', function(done) {
                    subscribeClients[logger.name].once('message', function(channel, message) {
                        message = JSON.parse(message);
                        assert.strictEqual(message.level, 30);
                        done();
                    });
                    logger.logger.info('test');
                });
            });
        });
    });

    describe('list', function() {
        var streams = [
                new RedisStream({
                    client : clients.redis,
                    key    : 'redis',
                    type   : 'list'
                }),
                new RedisStream({
                    client : clients.ioredis,
                    key    : 'ioredis',
                    type   : 'list'
                })
            ],
            loggers = [{
                name   : 'redis',
                key    : 'redis',
                client : clients.redis,
                stream : streams[0],
                logger : helpers.getLogger(streams[0])
            }, {
                name   : 'ioredis',
                key    : 'ioredis',
                client : clients.ioredis,
                stream : streams[1],
                logger : helpers.getLogger(streams[1])
            }];

        loggers.forEach(function(logger) {
            describe(logger.name, function() {
                afterEach(function() {
                    logger.client.flushall();
                });

                it('should push a message to the correct list', function(done) {
                    logger.stream.once('logged', function() {
                        logger.client.blpop(logger.key, 0, function(error, value) {
                            assert(value);
                            done();
                        });
                    });
                    logger.logger.info('test');
                });
                it('should push a message with the correct msg property value', function(done) {
                    logger.stream.once('logged', function() {
                        logger.client.blpop(logger.key, 0, function(error, value) {
                            value = JSON.parse(value[1]);
                            assert.strictEqual(value.msg, 'test');
                            done();
                        });
                    });
                    logger.logger.info('test');
                });
                it('should push a message with the correct level property value', function(done) {
                    logger.stream.once('logged', function() {
                        logger.client.blpop(logger.key, 0, function(error, value) {
                            value = JSON.parse(value[1]);
                            assert.strictEqual(value.level, 30);
                            done();
                        });
                    });
                    logger.logger.info('test');
                });
            });
        });
    });
});


text:
require 'actv/asset_channel'
require 'actv/asset_component'
require 'actv/asset_description'
require 'actv/asset_image'
require 'actv/asset_legacy_data'
require 'actv/asset_price'
require 'actv/asset_reference'
require 'actv/asset_status'
require 'actv/asset_tag'
require 'actv/asset_topic'
require 'actv/asset_seo_url'
require 'actv/identity'
require 'actv/place'
require 'actv/recurrence'
require 'actv/asset_source_system'

module ACTV
  class Asset < ACTV::Identity
    include AssetSourceSystem

    @types = []

    attr_reader :assetGuid, :assetName, :assetDsc, :activityStartDate, :activityStartTime, :activityEndDate, :activityEndTime,
      :homePageUrlAdr, :isRecurring, :contactName, :contactEmailAdr, :contactPhone, :showContact, :publishDate, :createdDate, :modifiedDate,
      :authorName, :is_event, :is_article, :currencyCd, :contactTxt, :regReqMinAge, :regReqMaxAge, :regReqGenderCd

    alias id assetGuid
    alias title assetName
    alias start_date activityStartDate
    alias start_time activityStartTime
    alias end_date activityEndDate
    alias end_time activityEndTime
    alias home_page_url homePageUrlAdr
    alias is_recurring? isRecurring
    alias contact_name contactName
    alias contact_email contactEmailAdr
    alias contact_phone contactPhone
    alias contact_txt contactTxt
    alias show_contact? showContact
    alias published_at publishDate
    alias created_at createdDate
    alias updated_at modifiedDate
    alias author_name authorName
    alias activity_start_date activityStartDate
    alias activity_end_date activityEndDate
    alias currency_code currencyCd
    alias minimum_age regReqMinAge
    alias maximum_age regReqMaxAge
    alias required_gender regReqGenderCd

    def initialize options={}
      super
      options[:logoUrlAdr]= replace_http_to_https options[:logoUrlAdr]
    end

    def self.inherited base
      @types << base
    end

    def self.types
      @types + Array(self)
    end

    def self.from_response response={}
      AssetFactory.new(response[:body]).asset
    end

    def self.valid? response
      AssetValidator.new(response).valid?
    end

    def endurance_id
      if self.awendurance?
        query_values = Addressable::URI.parse(registrationUrlAdr.to_s).query_values
        query_values ||= {}
        query_values.fetch 'e', nil
      end
    end

    def recurrences
      @recurrences ||= Array(@attrs[:activityRecurrences]).map do | recurrence |
        ACTV::Recurrence.new(recurrence)
      end
    end

    def place
      @place ||= ACTV::Place.new(@attrs[:place]) unless @attrs[:place].nil?
    end

    def place_timezone
      @place_timezone ||= place[:timezone] unless place[:timezone].nil?
    end

    def org_timezone
      @org_timezone ||= @attrs[:localTimeZoneId] unless @attrs[:localTimeZoneId].nil?
    end

    def version
      @asset_version ||= @attrs[:assetVersion] unless @attrs[:assetVersion].nil?
    end

    def descriptions
      @descriptions ||= Array(@attrs[:assetDescriptions]).map do |description|
        description[:description] = convert_all_resource_to_https(description[:description])
        ACTV::AssetDescription.new(description)
      end
    end
    alias asset_descriptions descriptions
    alias assetDescriptions descriptions

    def status
      @status ||= ACTV::AssetStatus.new(@attrs[:assetStatus]) unless @attrs[:assetStatus].nil?
    end
    alias asset_status status
    alias assetStatus status

    def visible?
      asset_status.visible?
    end

    def legacy_data
      @legacy_data ||= ACTV::AssetLegacyData.new(@attrs[:assetLegacyData]) unless @attrs[:assetLegacyData].nil?
    end
    alias asset_legacy_data legacy_data
    alias assetLegacyData legacy_data

    def channels
      @asset_channels ||= Array(@attrs[:assetChannels]).map do |channel|
        ACTV::AssetChannel.new(channel)
      end
    end
    alias asset_channels channels
    alias assetChannels channels

    def images
      @images ||= Array(@attrs[:assetImages]).map do |img|
        img[:imageUrlAdr] = replace_http_to_https(img[:imageUrlAdr]) unless 'MediaGalleryButton' == img[:imageName]
        ACTV::AssetImage.new(img)
      end
    end
    alias asset_images images
    alias assetImages images

    def tags
      @asset_tags ||= Array(@attrs[:assetTags]).map do |tag|
        ACTV::AssetTag.new(tag)
      end
    end
    alias asset_tags tags
    alias assetTags tags

    def components
      @asset_components ||= Array(@attrs[:assetComponents]).map do |component|
        ACTV::AssetComponent.new(component)
      end
    end
    alias asset_components components
    alias assetComponents components

    def prices
      @asset_prices ||= Array(@attrs[:assetPrices]).map do |price|
        ACTV::AssetPrice.new(price)
      end
    end
    alias asset_prices prices
    alias assetPrices prices

    def has_volume_based_price?
      prices.any? { |price| price.volume_pricing? }
    end

    def topics
      @asset_topics ||= Array(@attrs[:assetTopics]).map do |topic|
        ACTV::AssetTopic.new(topic)
      end.sort
    end
    alias asset_topics topics
    alias assetTopics topics

    def seo_urls
      @seo_urls ||= Array(@attrs[:assetSeoUrls]).map do |seo_url|
        seo_url[:urlAdr] = replace_http_to_https seo_url[:urlAdr]
        ACTV::AssetSeoUrl.new(seo_url)
      end
    end
    alias asset_seo_urls seo_urls
    alias assetSeoUrls seo_urls

    def summary
      @summary ||= description_by_type 'summary'
    end

    def description
      @description ||= description_by_type 'Standard'
    end

    def seo_url(systemName = 'as3')
      seo_url = self.seo_urls.find { |s| s.seoSystemName.downcase == systemName.downcase }
      seo_url.urlAdr unless seo_url.nil?
    end

    def description_by_type(type)
      dsc = self.descriptions.find { |dsc| dsc.type.name.downcase == type.downcase }
      (dsc.description.downcase == 'n/a' ? '' : dsc.description) if dsc
    end

    def image_by_name(name)
      self.images.find { |img| img.name.downcase == name.downcase }
    end

    def tag_by_description(description)
      asset_tag = self.tags.find { |at| at.tag.description.downcase == description.downcase }
      asset_tag.tag.name if asset_tag
    end

    def is_event?
      false
    end

    def is_article?
      false
    end

    def is_video?
      false
    end

    def has_location?
      self.place && place.has_lat_long?
    end

    def evergreen?
      self.evergreenAssetFlag.downcase == 'true' rescue false
    end

    def kids?
      kids_friendly_source_system? && kids_interest?
    end

    def registration_status
      @registration_status ||= nil
    end
    alias reg_status registration_status

    def attributes
      @attributes ||= assetAttributes.sort_by do |attribute|
        attribute[:attribute][:attributeType]
      end.map do |attribute|
        attribute[:attribute][:attributeValue]
      end
    end

    def attribute_paths
      attributes.map do |attribute|
        [sub_topic_path, urlize(attribute)].join "/"
      end
    end

    def meta_interests
      @meta_interests ||= attrs[:assetMetaInterests].sort_by do |interest|
        interest[:sequence]
      end.map do |interest|
        interest[:metaInterest][:metaInterestName]
      end
    end

    def meta_interest_paths
      meta_interests.map do |meta_interest|
        [sub_topic_path, urlize(meta_interest)].join "/"
      end
    end

    def location_path
      @location ||= "#{place.cityName} #{place.stateProvinceCode}".downcase.gsub ' ','-'
    end

    def first_topic
      get_first_topic_taxonomy[0]
    end
    alias topic first_topic

    def first_topic_path
      urlize first_topic
    end

    def first_topic_name
      topics.first.topic.name unless topics.empty?
    end

    def sub_topic
      get_first_topic_taxonomy[1]
    end

    def sub_topic_path
      urlize sub_topic
    end

    def sub_2_topic
      get_first_topic_taxonomy[2]
    end

    def sub_2_topic_path
      urlize "#{sub_topic_path}/#{sub_2_topic}"
    end

    def sub_3_topic
      get_first_topic_taxonomy[3]
    end

    def sub_3_topic_path
      urlize "#{sub_2_topic_path}/#{sub_3_topic}"
    end

    def sub_4_topic
      get_first_topic_taxonomy[4]
    end

    def sub_4_topic_path
      urlize "#{sub_3_topic_path}/#{sub_4_topic}"
    end

    def image_with_placeholder
      if image_path.empty?
        "/images/logo-active-icon-gray.gif"
      else
        image_path
      end
    end

    def image_path
      default_image = 'https://www.active.com/images/events/hotrace.gif'
      image = image_without_placeholder.imageUrlAdr rescue ""

      if image.empty? and (logoUrlAdr && logoUrlAdr != default_image && !(logoUrlAdr =~ URI::regexp).nil?)
        image = logoUrlAdr
      end

      image
    end

    def media_url
      image_without_placeholder.imageUrlAdr rescue ""
    end

    def image
      image_without_placeholder
    end

    def references
      @references ||= Array(@attrs[:assetReferences]).map do |reference|
        ACTV::AssetReference.new reference
      end
    end

    def category_is? name
      @attrs[:assetCategories].any? do |cat|
        cat[:category][:categoryName].downcase == name.downcase
      end
    end

    def organization
      @attrs[:organization] || {}
    end

    def sponsored?
      sponsoredContent.present? && sponsoredContent[:enabled].to_s == 'true' && sponsored_date_available?
    end

    private

    def child_assets_filtered_by_category category
      child_assets.select { |child| child.category_is? category }
    end

    def child_assets
      @child_assets ||= if components.any?
                          ACTV.asset components.map(&:assetGuid)
                        else
                          []
                        end
    end

    def image_without_placeholder
      default_image = 'https://www.active.com/images/events/hotrace.gif'
      current_image = nil

      asset_images.each do |i|
        if i.imageUrlAdr.downcase != default_image
          current_image = i
          break
        end
      end

      current_image
    end

    def get_first_topic_taxonomy
      @first_topic_taxonomy ||= assetTopics.first
      if @first_topic_taxonomy
        @first_topic_taxonomy.topic.topicTaxonomy.split '/'
      else
        []
      end
    end

    def urlize str
      if str
        str.downcase.gsub ' ', '-'
      else
        ""
      end
    end

    def kids_interest?
      interests = meta_interests.to_a.map(&:downcase)
      ['kids', 'family'].any? { |tag| interests.include? tag }
    end

    def sponsoredContent
      @sponsoredContent ||= @attrs[:sponsoredContent] unless @attrs[:sponsoredContent].nil?
    end

    def sponsored_date_available?
      start_time = Time.parse(sponsoredContent[:startDate])
      end_time = Time.parse(sponsoredContent[:endDate])
      Time.now.between?(start_time, end_time)
    end

    def convert_all_resource_to_https content
      content.gsub!(/src=[\'|\"](http:\/\/)/, "src='http://" => "src='https://", 'src="http://' => 'src="https://')
      content
    end

    def replace_http_to_https content
      content = content.to_s
      content.gsub! 'http://', 'https://'
      content
    end
  end
end


text:
{% extends "base.html" %}

{% block content %}

404 not found

{% endblock content %}


text:
Authentication

                Authentication failed! Please check your credentials and try again.

            <form class="form" role="form" ng-submit="login($event)">

                    Login
                    <input type="text" class="form-control" id="username" placeholder="Your login" ng-model="username">

                    Password
                    <input type="password" class="form-control" id="password" placeholder="Your password"
                           ng-model="password">

                        <input type="checkbox" id="rememberMe" ng-model="rememberMe" checked>
                        Automatic Login

                <button type="submit" class="btn btn-primary">Authenticate</button>
            </form>

                Did you forget your password?

                You don't have an account yet? Register a new account


text:
  Ratières est
       un village
       localisé dans le département de Drôme en Rhône-Alpes. Elle totalisait 275 habitants en 2008.

À proximité de Ratières sont situées les villes de
La Motte-de-Galaure à 5 km, 670 habitants,
Châteauneuf-de-Galaure localisée à 5 km, 1 481 habitants,
Saint-Avit à 1 km, 300 habitants,
Bathernay localisée à 2 km, 232 habitants,
Mureils localisée à 4 km, 340 habitants,
Charmes-sur-l'Herbasse à 5 km, 840 habitants,
 entre autres. De plus, Ratières est située à seulement 28 km de Valence.

Si vous pensez demenager à Ratières, vous pourrez facilement trouver une maison à acheter.

La commune propose quelques  aménagements, elle propose entre autres une boucle de randonnée.

Le parc d'habitations, à Ratières, se décomposait en 2011 en huit appartements et 128 maisons soit
 un marché plutôt équilibré.


text:
<!DOCTYPE html>
<title>
  Nested fragmentation for out-of-flow positioned elements create new columns.
</title>
<link rel="help" href="https://www.w3.org/TR/css-position-3/#abspos-breaking">
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">

Test passes if there is a filled green square and no red.


text:
// Type definitions for es6-promise
// Project: https://github.com/jakearchibald/ES6-Promise
// Definitions by: François de Campredon <https://github.com/fdecampredon/>, vvakame <https://github.com/vvakame>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

/**
 * Rx v5 types expect to exist in an ES6 environment (and thus, native Promise) but the build is targeting ES5
 * In order to avoid "not found" problems with Rx v5 types, we need to include this shim.
 */

/* tslint:disable:interface-name */
interface Thenable<R> {
    then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
    then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => void): Thenable<U>;
}

declare class Promise<R> implements Thenable<R> {
  /**
   * If you call resolve in the body of the callback passed to the constructor,
   * your promise is fulfilled with result object passed to resolve.
   * If you call reject your promise is rejected with the object passed to resolve.
   * For consistency and debugging (eg stack traces), obj should be an instanceof Error.
   * Any errors thrown in the constructor callback will be implicitly passed to reject().
   */
  constructor(callback: (resolve: (value?: R | Thenable<R>) => void, reject: (error?: any) => void) => void);

  /**
   * onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
   * Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
   * Both callbacks have a single parameter , the fulfillment value or rejection reason.
   * "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
   * If an error is thrown in the callback, the returned promise rejects with that error.
   *
   * @param onFulfilled called when/if "promise" resolves
   * @param onRejected called when/if "promise" rejects
   */
    then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
    then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => void): Promise<U>;

  /**
   * Sugar for promise.then(undefined, onRejected)
   *
   * @param onRejected called when/if "promise" rejects
   */
  catch<U>(onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
}

interface PromiseConstructor {
    /**
     * A reference to the prototype.
     */
    prototype: Promise<any>;

    [Symbol.species]: Function;
    /**
     * Creates a new Promise.
     * @param executor A callback used to initialize the promise. This callback is passed two arguments:
     * a resolve callback used resolve the promise with a value or the result of another promise,
     * and a reject callback used to reject the promise with a provided reason or error.
     */
    new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;

    /**
     * Creates a new rejected promise for the provided reason.
     * @param reason The reason the promise was rejected.
     * @returns A new rejected Promise.
     */
    reject(reason: any): Promise<void>;

    /**
     * Creates a new rejected promise for the provided reason.
     * @param reason The reason the promise was rejected.
     * @returns A new rejected Promise.
     */
    reject<T>(reason: any): Promise<T>;

    /**
     * Creates a new resolved promise for the provided value.
     * @param value A promise.
     * @returns A promise whose internal state matches the provided promise.
     */
    resolve<T>(value: T | PromiseLike<T>): Promise<T>;

    /**
     * Creates a new resolved promise .
     * @returns A resolved promise.
     */
    resolve(): Promise<void>;
}


text:
<!DOCTYPE html>
{% load staticfiles %}

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <meta name="description" content="">
    <meta name="author" content="">

    <title>{{ title }}</title>

    <link href="{% static 'bootstrap/css/bootstrap.min.css' %}" rel="stylesheet">

    <link href="{% static 'bootstrap/css/bootstrap-theme.min.css' %}" rel="stylesheet">

    <link rel="stylesheet" href="{% static 'css/navbar.css' %}">
    <link rel="stylesheet" type="text/css" href="{% static 'css/footer-distributed.css'%}">
    {% block extra_css %}
        <link rel="stylesheet" href="{% static 'css/choiceSidebar.css' %}">
    {% endblock %}

    {% include 'navbar.html' %}

    {% block jumbotron %}
    {% endblock %}

    {% block content %}
    {% endblock %}

    {% block extra_js %}
    {% endblock %}


text:
package V2.UI;

import V2.DataBaseInteractions.DataBaseObjekts.DataBaseElementObject;
import V2.UI.NonFrameElements.Row;

import javax.swing.*;
import javax.swing.border.LineBorder;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 * Created by Aaron on 14.08.2017.
 */

/*
Gemeinsame Klasse aller Fenster, realisiert Aufbau, Anlegung der Verknüpfung zur Datenbank etc
 */

public abstract class BaseFrame extends JFrame {

    static int amountParametersnewEntry;
    public final int WIDTHGLOBAL = 120;
    final int yCoordinateListEntrys = 260;
    public CopyOnWriteArrayList<Row> listTextRows = new CopyOnWriteArrayList<>();
    public JTextField[] suchLabel;
    public JTextField[] columNames;
    JTextField[] arrCreateEntryFields;
    String[] spaltenNamen;
    int columns;
    private JButton btnEintragserzeugung;

    /*
    Other Variables every Frame uses
     */
    /*
    GUI-Elements that every Frame shares
     */
    private JTextField[] suchFenster;
    private JButton[] sortierButtons;
    private boolean[] sortdirections;

    public BaseFrame(int colums, String strFenstername) {

        super(strFenstername);
        this.getContentPane().setLayout(null);

        columNames = new JTextField[colums];
        arrCreateEntryFields = new JTextField[colums];
        suchLabel = new JTextField[colums];
        suchFenster = new JTextField[colums];
        sortierButtons = new JButton[colums];
        sortdirections = new boolean[colums];
        spaltenNamen = new String[colums];
        JTextField[] createEntryField = new JTextField[amountParametersnewEntry];

        this.columns = colums;

        for (int i_x = 0; i_x < colums; i_x++) {
            columNames[i_x] = new JTextField();
            columNames[i_x].setVisible(true);
            this.getContentPane().add(columNames[i_x]);
            columNames[i_x].setBounds(WIDTHGLOBAL * i_x, 0, WIDTHGLOBAL, 20);

            arrCreateEntryFields[i_x] = new JTextField();
            this.getContentPane().add(arrCreateEntryFields[i_x]);
            arrCreateEntryFields[i_x].setBounds(i_x * WIDTHGLOBAL, yCoordinateListEntrys - 40, WIDTHGLOBAL, 20);
            arrCreateEntryFields[i_x].setVisible(true);

            suchLabel[i_x] = new JTextField();
            suchLabel[i_x].setText("Suche nach:");
            suchLabel[i_x].setBorder(new LineBorder(Color.RED, 1));

            this.getContentPane().add(suchLabel[i_x]);
            suchLabel[i_x].setBounds(WIDTHGLOBAL * i_x, 40, WIDTHGLOBAL, 20);
            suchFenster[i_x] = new JTextField();
            suchFenster[i_x].setText("");

            sortierButtons[i_x] = new JButton();
            this.getContentPane().add(sortierButtons[i_x]);
            sortierButtons[i_x].setBounds(WIDTHGLOBAL * i_x, suchFenster[i_x].getY() + 100, 120, 50);
            sortierButtons[i_x].setBorder(new LineBorder(Color.RED, 1));
            sortierButtons[i_x].setVisible(true);
            sortierButtons[i_x].setText(" A ... Z");
            sortdirections[i_x] = true;

            this.getContentPane().add(suchFenster[i_x]);
            suchFenster[i_x].setBounds(WIDTHGLOBAL * i_x, 70, 120, 20);
            suchFenster[i_x].addKeyListener(new KeyListener() {
                @Override
                public void keyTyped(KeyEvent e) {

                }

                @Override
                public void keyPressed(KeyEvent e) {
                }

                @Override
                public void keyReleased(KeyEvent e) {
                    //     suche();
                }
            });

            sortierButtons[i_x].addMouseListener(new MouseListener() {
                @Override
                public void mouseClicked(MouseEvent e) {

                    for (int j = 0; j < sortierButtons.length; j++) {

                        if (sortierButtons[j].equals(e.getSource())) {
                            ordnen(sortdirections[j], j);
                        }
                    }

                }

                @Override
                public void mousePressed(MouseEvent e) {

                }

                @Override
                public void mouseReleased(MouseEvent e) {

                }

                @Override
                public void mouseEntered(MouseEvent e) {

                }

                @Override
                public void mouseExited(MouseEvent e) {

                }
            });

        }

        for (int i = 0; i < createEntryField.length; i++) {
            createEntryField[i] = new JTextField();
            this.getContentPane().add(createEntryField[i]);
            createEntryField[i].setBounds(this.WIDTHGLOBAL * i, yCoordinateListEntrys - 60, WIDTHGLOBAL, 20);
            createEntryField[i].setVisible(true);
        }

        this.showfixedText();

        try {
            this.generateRows(this.requestDataBaseContent());
        } catch (SQLException e) {
            e.printStackTrace();
        }

        this.updateRowYKoordinate(500);
    }

    public abstract ArrayList<DataBaseElementObject> requestDataBaseContent() throws SQLException;

    void clearRows() {

    }

    void resetInterface() {
        this.clearRows();
        try {
            this.generateRows(this.requestDataBaseContent());
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    void generateRows(ArrayList<DataBaseElementObject> dataBaseEntrys) {
        for (int i = 0; i < dataBaseEntrys.size(); i++) {
            this.listTextRows.add(new Row(this.columns, dataBaseEntrys.get(i), this.getContentPane()));
        }
    }

    void updateRowYKoordinate(int yFirstElement) {
        for (int i = 0; i < this.listTextRows.size(); i++) {
            this.listTextRows.get(i).setYCoordinates(i * 20 + yFirstElement);
        }
    }

    void search(String[] args) {

    }

    void displayText(ArrayList<String[]> rowValues) {

    }

    public void generateNewDataBaseEntry(String[] values) {

    }

    public void ordnen(boolean b_direction_tm, int i_X_colum) {

        sortdirections[i_X_colum] = !sortdirections[i_X_colum];
        if (sortdirections[i_X_colum]) {
            sortierButtons[i_X_colum].setText(" A ... Z");
        } else {
            sortierButtons[i_X_colum].setText("Z ... A");
        }
    }

    public void displayFrame(int i_X, int k_Y, int dx, int dy) {
        this.setVisible(true);
        this.setBounds(i_X, k_Y, dx, dy);
    }

    public abstract void showfixedText();

}