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.appplatform.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.appplatform.fluent.BuildpackBindingsClient;
import com.azure.resourcemanager.appplatform.fluent.models.BuildpackBindingResourceInner;
import com.azure.resourcemanager.appplatform.models.BuildpackBindingResourceCollection;
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 BuildpackBindingsClient. */
public final class BuildpackBindingsClientImpl implements BuildpackBindingsClient {
    /** The proxy service used to perform REST calls. */
    private final BuildpackBindingsService service;

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

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

    /**
     * The interface defining all the services for AppPlatformManagementClientBuildpackBindings to be used by the proxy
     * service to perform REST calls.
     */
    @Host("{$host}")
    @ServiceInterface(name = "AppPlatformManagemen")
    private interface BuildpackBindingsService {
        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"
                + "/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings"
                + "/{buildpackBindingName}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<BuildpackBindingResourceInner>> get(
            @HostParam("$host") String endpoint,
            @QueryParam("api-version") String apiVersion,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("serviceName") String serviceName,
            @PathParam("buildServiceName") String buildServiceName,
            @PathParam("builderName") String builderName,
            @PathParam("buildpackBindingName") String buildpackBindingName,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Put(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"
                + "/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings"
                + "/{buildpackBindingName}")
        @ExpectedResponses({200, 201})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> createOrUpdate(
            @HostParam("$host") String endpoint,
            @QueryParam("api-version") String apiVersion,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("serviceName") String serviceName,
            @PathParam("buildServiceName") String buildServiceName,
            @PathParam("builderName") String builderName,
            @PathParam("buildpackBindingName") String buildpackBindingName,
            @BodyParam("application/json") BuildpackBindingResourceInner buildpackBinding,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Delete(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"
                + "/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings"
                + "/{buildpackBindingName}")
        @ExpectedResponses({200, 202, 204})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> delete(
            @HostParam("$host") String endpoint,
            @QueryParam("api-version") String apiVersion,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("serviceName") String serviceName,
            @PathParam("buildServiceName") String buildServiceName,
            @PathParam("builderName") String builderName,
            @PathParam("buildpackBindingName") String buildpackBindingName,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"
                + "/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<BuildpackBindingResourceCollection>> list(
            @HostParam("$host") String endpoint,
            @QueryParam("api-version") String apiVersion,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("serviceName") String serviceName,
            @PathParam("buildServiceName") String buildServiceName,
            @PathParam("builderName") String builderName,
            @HeaderParam("Accept") String accept,
            Context context);

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

    /**
     * Get a buildpack binding by name.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a buildpack binding by name along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BuildpackBindingResourceInner>> getWithResponseAsync(
        String resourceGroupName,
        String serviceName,
        String buildServiceName,
        String builderName,
        String buildpackBindingName) {
        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 (serviceName == null) {
            return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null."));
        }
        if (buildServiceName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter buildServiceName is required and cannot be null."));
        }
        if (builderName == null) {
            return Mono.error(new IllegalArgumentException("Parameter builderName is required and cannot be null."));
        }
        if (buildpackBindingName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter buildpackBindingName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .get(
                            this.client.getEndpoint(),
                            this.client.getApiVersion(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            serviceName,
                            buildServiceName,
                            builderName,
                            buildpackBindingName,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Get a buildpack binding by name.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a buildpack binding by name along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<BuildpackBindingResourceInner>> getWithResponseAsync(
        String resourceGroupName,
        String serviceName,
        String buildServiceName,
        String builderName,
        String buildpackBindingName,
        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 (serviceName == null) {
            return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null."));
        }
        if (buildServiceName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter buildServiceName is required and cannot be null."));
        }
        if (builderName == null) {
            return Mono.error(new IllegalArgumentException("Parameter builderName is required and cannot be null."));
        }
        if (buildpackBindingName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter buildpackBindingName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .get(
                this.client.getEndpoint(),
                this.client.getApiVersion(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                serviceName,
                buildServiceName,
                builderName,
                buildpackBindingName,
                accept,
                context);
    }

    /**
     * Get a buildpack binding by name.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a buildpack binding by name on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<BuildpackBindingResourceInner> getAsync(
        String resourceGroupName,
        String serviceName,
        String buildServiceName,
        String builderName,
        String buildpackBindingName) {
        return getWithResponseAsync(resourceGroupName, serviceName, buildServiceName, builderName, buildpackBindingName)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get a buildpack binding by name.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a buildpack binding by name.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public BuildpackBindingResourceInner get(
        String resourceGroupName,
        String serviceName,
        String buildServiceName,
        String builderName,
        String buildpackBindingName) {
        return getAsync(resourceGroupName, serviceName, buildServiceName, builderName, buildpackBindingName).block();
    }

    /**
     * Get a buildpack binding by name.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a buildpack binding by name along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BuildpackBindingResourceInner> getWithResponse(
        String resourceGroupName,
        String serviceName,
        String buildServiceName,
        String builderName,
        String buildpackBindingName,
        Context context) {
        return getWithResponseAsync(
                resourceGroupName, serviceName, buildServiceName, builderName, buildpackBindingName, context)
            .block();
    }

    /**
     * Create or update a buildpack binding.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @param buildpackBinding The target buildpack binding for the create or update 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 buildpack Binding Resource object along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(
        String resourceGroupName,
        String serviceName,
        String buildServiceName,
        String builderName,
        String buildpackBindingName,
        BuildpackBindingResourceInner buildpackBinding) {
        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 (serviceName == null) {
            return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null."));
        }
        if (buildServiceName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter buildServiceName is required and cannot be null."));
        }
        if (builderName == null) {
            return Mono.error(new IllegalArgumentException("Parameter builderName is required and cannot be null."));
        }
        if (buildpackBindingName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter buildpackBindingName is required and cannot be null."));
        }
        if (buildpackBinding == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter buildpackBinding is required and cannot be null."));
        } else {
            buildpackBinding.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .createOrUpdate(
                            this.client.getEndpoint(),
                            this.client.getApiVersion(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            serviceName,
                            buildServiceName,
                            builderName,
                            buildpackBindingName,
                            buildpackBinding,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Create or update a buildpack binding.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @param buildpackBinding The target buildpack binding for the create or update operation.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return buildpack Binding Resource object along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(
        String resourceGroupName,
        String serviceName,
        String buildServiceName,
        String builderName,
        String buildpackBindingName,
        BuildpackBindingResourceInner buildpackBinding,
        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 (serviceName == null) {
            return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null."));
        }
        if (buildServiceName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter buildServiceName is required and cannot be null."));
        }
        if (builderName == null) {
            return Mono.error(new IllegalArgumentException("Parameter builderName is required and cannot be null."));
        }
        if (buildpackBindingName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter buildpackBindingName is required and cannot be null."));
        }
        if (buildpackBinding == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter buildpackBinding is required and cannot be null."));
        } else {
            buildpackBinding.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .createOrUpdate(
                this.client.getEndpoint(),
                this.client.getApiVersion(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                serviceName,
                buildServiceName,
                builderName,
                buildpackBindingName,
                buildpackBinding,
                accept,
                context);
    }

    /**
     * Create or update a buildpack binding.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @param buildpackBinding The target buildpack binding for the create or update 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 buildpack Binding Resource object.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public PollerFlux<PollResult<BuildpackBindingResourceInner>, BuildpackBindingResourceInner>
        beginCreateOrUpdateAsync(
            String resourceGroupName,
            String serviceName,
            String buildServiceName,
            String builderName,
            String buildpackBindingName,
            BuildpackBindingResourceInner buildpackBinding) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            createOrUpdateWithResponseAsync(
                resourceGroupName, serviceName, buildServiceName, builderName, buildpackBindingName, buildpackBinding);
        return this
            .client
            .<BuildpackBindingResourceInner, BuildpackBindingResourceInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                BuildpackBindingResourceInner.class,
                BuildpackBindingResourceInner.class,
                this.client.getContext());
    }

    /**
     * Create or update a buildpack binding.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @param buildpackBinding The target buildpack binding for the create or update operation.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link PollerFlux} for polling of buildpack Binding Resource object.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<BuildpackBindingResourceInner>, BuildpackBindingResourceInner>
        beginCreateOrUpdateAsync(
            String resourceGroupName,
            String serviceName,
            String buildServiceName,
            String builderName,
            String buildpackBindingName,
            BuildpackBindingResourceInner buildpackBinding,
            Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            createOrUpdateWithResponseAsync(
                resourceGroupName,
                serviceName,
                buildServiceName,
                builderName,
                buildpackBindingName,
                buildpackBinding,
                context);
        return this
            .client
            .<BuildpackBindingResourceInner, BuildpackBindingResourceInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                BuildpackBindingResourceInner.class,
                BuildpackBindingResourceInner.class,
                context);
    }

    /**
     * Create or update a buildpack binding.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @param buildpackBinding The target buildpack binding for the create or update 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 buildpack Binding Resource object.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<BuildpackBindingResourceInner>, BuildpackBindingResourceInner> beginCreateOrUpdate(
        String resourceGroupName,
        String serviceName,
        String buildServiceName,
        String builderName,
        String buildpackBindingName,
        BuildpackBindingResourceInner buildpackBinding) {
        return beginCreateOrUpdateAsync(
                resourceGroupName, serviceName, buildServiceName, builderName, buildpackBindingName, buildpackBinding)
            .getSyncPoller();
    }

    /**
     * Create or update a buildpack binding.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @param buildpackBinding The target buildpack binding for the create or update operation.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of buildpack Binding Resource object.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<BuildpackBindingResourceInner>, BuildpackBindingResourceInner> beginCreateOrUpdate(
        String resourceGroupName,
        String serviceName,
        String buildServiceName,
        String builderName,
        String buildpackBindingName,
        BuildpackBindingResourceInner buildpackBinding,
        Context context) {
        return beginCreateOrUpdateAsync(
                resourceGroupName,
                serviceName,
                buildServiceName,
                builderName,
                buildpackBindingName,
                buildpackBinding,
                context)
            .getSyncPoller();
    }

    /**
     * Create or update a buildpack binding.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @param buildpackBinding The target buildpack binding for the create or update 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 buildpack Binding Resource object on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<BuildpackBindingResourceInner> createOrUpdateAsync(
        String resourceGroupName,
        String serviceName,
        String buildServiceName,
        String builderName,
        String buildpackBindingName,
        BuildpackBindingResourceInner buildpackBinding) {
        return beginCreateOrUpdateAsync(
                resourceGroupName, serviceName, buildServiceName, builderName, buildpackBindingName, buildpackBinding)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create or update a buildpack binding.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @param buildpackBinding The target buildpack binding for the create or update operation.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return buildpack Binding Resource object on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<BuildpackBindingResourceInner> createOrUpdateAsync(
        String resourceGroupName,
        String serviceName,
        String buildServiceName,
        String builderName,
        String buildpackBindingName,
        BuildpackBindingResourceInner buildpackBinding,
        Context context) {
        return beginCreateOrUpdateAsync(
                resourceGroupName,
                serviceName,
                buildServiceName,
                builderName,
                buildpackBindingName,
                buildpackBinding,
                context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create or update a buildpack binding.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @param buildpackBinding The target buildpack binding for the create or update 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 buildpack Binding Resource object.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public BuildpackBindingResourceInner createOrUpdate(
        String resourceGroupName,
        String serviceName,
        String buildServiceName,
        String builderName,
        String buildpackBindingName,
        BuildpackBindingResourceInner buildpackBinding) {
        return createOrUpdateAsync(
                resourceGroupName, serviceName, buildServiceName, builderName, buildpackBindingName, buildpackBinding)
            .block();
    }

    /**
     * Create or update a buildpack binding.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @param buildpackBinding The target buildpack binding for the create or update operation.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return buildpack Binding Resource object.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public BuildpackBindingResourceInner createOrUpdate(
        String resourceGroupName,
        String serviceName,
        String buildServiceName,
        String builderName,
        String buildpackBindingName,
        BuildpackBindingResourceInner buildpackBinding,
        Context context) {
        return createOrUpdateAsync(
                resourceGroupName,
                serviceName,
                buildServiceName,
                builderName,
                buildpackBindingName,
                buildpackBinding,
                context)
            .block();
    }

    /**
     * Operation to delete a Buildpack Binding.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
        String resourceGroupName,
        String serviceName,
        String buildServiceName,
        String builderName,
        String buildpackBindingName) {
        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 (serviceName == null) {
            return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null."));
        }
        if (buildServiceName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter buildServiceName is required and cannot be null."));
        }
        if (builderName == null) {
            return Mono.error(new IllegalArgumentException("Parameter builderName is required and cannot be null."));
        }
        if (buildpackBindingName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter buildpackBindingName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .delete(
                            this.client.getEndpoint(),
                            this.client.getApiVersion(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            serviceName,
                            buildServiceName,
                            builderName,
                            buildpackBindingName,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Operation to delete a Buildpack Binding.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
        String resourceGroupName,
        String serviceName,
        String buildServiceName,
        String builderName,
        String buildpackBindingName,
        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 (serviceName == null) {
            return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null."));
        }
        if (buildServiceName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter buildServiceName is required and cannot be null."));
        }
        if (builderName == null) {
            return Mono.error(new IllegalArgumentException("Parameter builderName is required and cannot be null."));
        }
        if (buildpackBindingName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter buildpackBindingName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .delete(
                this.client.getEndpoint(),
                this.client.getApiVersion(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                serviceName,
                buildServiceName,
                builderName,
                buildpackBindingName,
                accept,
                context);
    }

    /**
     * Operation to delete a Buildpack Binding.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link PollerFlux} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public PollerFlux<PollResult<Void>, Void> beginDeleteAsync(
        String resourceGroupName,
        String serviceName,
        String buildServiceName,
        String builderName,
        String buildpackBindingName) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            deleteWithResponseAsync(
                resourceGroupName, serviceName, buildServiceName, builderName, buildpackBindingName);
        return this
            .client
            .<Void, Void>getLroResult(
                mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext());
    }

    /**
     * Operation to delete a Buildpack Binding.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link PollerFlux} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<Void>, Void> beginDeleteAsync(
        String resourceGroupName,
        String serviceName,
        String buildServiceName,
        String builderName,
        String buildpackBindingName,
        Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            deleteWithResponseAsync(
                resourceGroupName, serviceName, buildServiceName, builderName, buildpackBindingName, context);
        return this
            .client
            .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
    }

    /**
     * Operation to delete a Buildpack Binding.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<Void>, Void> beginDelete(
        String resourceGroupName,
        String serviceName,
        String buildServiceName,
        String builderName,
        String buildpackBindingName) {
        return beginDeleteAsync(resourceGroupName, serviceName, buildServiceName, builderName, buildpackBindingName)
            .getSyncPoller();
    }

    /**
     * Operation to delete a Buildpack Binding.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<Void>, Void> beginDelete(
        String resourceGroupName,
        String serviceName,
        String buildServiceName,
        String builderName,
        String buildpackBindingName,
        Context context) {
        return beginDeleteAsync(
                resourceGroupName, serviceName, buildServiceName, builderName, buildpackBindingName, context)
            .getSyncPoller();
    }

    /**
     * Operation to delete a Buildpack Binding.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return A {@link Mono} that completes when a successful response is received.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Void> deleteAsync(
        String resourceGroupName,
        String serviceName,
        String buildServiceName,
        String builderName,
        String buildpackBindingName) {
        return beginDeleteAsync(resourceGroupName, serviceName, buildServiceName, builderName, buildpackBindingName)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Operation to delete a Buildpack Binding.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return A {@link Mono} that completes when a successful response is received.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Void> deleteAsync(
        String resourceGroupName,
        String serviceName,
        String buildServiceName,
        String builderName,
        String buildpackBindingName,
        Context context) {
        return beginDeleteAsync(
                resourceGroupName, serviceName, buildServiceName, builderName, buildpackBindingName, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Operation to delete a Buildpack Binding.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public void delete(
        String resourceGroupName,
        String serviceName,
        String buildServiceName,
        String builderName,
        String buildpackBindingName) {
        deleteAsync(resourceGroupName, serviceName, buildServiceName, builderName, buildpackBindingName).block();
    }

    /**
     * Operation to delete a Buildpack Binding.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder resource.
     * @param buildpackBindingName The name of the Buildpack Binding Name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public void delete(
        String resourceGroupName,
        String serviceName,
        String buildServiceName,
        String builderName,
        String buildpackBindingName,
        Context context) {
        deleteAsync(resourceGroupName, serviceName, buildServiceName, builderName, buildpackBindingName, context)
            .block();
    }

    /**
     * Handles requests to list all buildpack bindings in a builder.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder 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 object that includes an array of BuildpackBinding resources and a possible link for next set along with
     *     {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<BuildpackBindingResourceInner>> listSinglePageAsync(
        String resourceGroupName, String serviceName, String buildServiceName, String builderName) {
        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 (serviceName == null) {
            return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null."));
        }
        if (buildServiceName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter buildServiceName is required and cannot be null."));
        }
        if (builderName == null) {
            return Mono.error(new IllegalArgumentException("Parameter builderName 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,
                            serviceName,
                            buildServiceName,
                            builderName,
                            accept,
                            context))
            .<PagedResponse<BuildpackBindingResourceInner>>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()));
    }

    /**
     * Handles requests to list all buildpack bindings in a builder.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder 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 object that includes an array of BuildpackBinding resources and a possible link for next set along with
     *     {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<BuildpackBindingResourceInner>> listSinglePageAsync(
        String resourceGroupName, String serviceName, String buildServiceName, String builderName, 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 (serviceName == null) {
            return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null."));
        }
        if (buildServiceName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter buildServiceName is required and cannot be null."));
        }
        if (builderName == null) {
            return Mono.error(new IllegalArgumentException("Parameter builderName 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,
                serviceName,
                buildServiceName,
                builderName,
                accept,
                context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }

    /**
     * Handles requests to list all buildpack bindings in a builder.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder 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 object that includes an array of BuildpackBinding resources and a possible link for next set as paginated
     *     response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BuildpackBindingResourceInner> listAsync(
        String resourceGroupName, String serviceName, String buildServiceName, String builderName) {
        return new PagedFlux<>(
            () -> listSinglePageAsync(resourceGroupName, serviceName, buildServiceName, builderName),
            nextLink -> listNextSinglePageAsync(nextLink));
    }

    /**
     * Handles requests to list all buildpack bindings in a builder.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder 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 object that includes an array of BuildpackBinding resources and a possible link for next set as paginated
     *     response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<BuildpackBindingResourceInner> listAsync(
        String resourceGroupName, String serviceName, String buildServiceName, String builderName, Context context) {
        return new PagedFlux<>(
            () -> listSinglePageAsync(resourceGroupName, serviceName, buildServiceName, builderName, context),
            nextLink -> listNextSinglePageAsync(nextLink, context));
    }

    /**
     * Handles requests to list all buildpack bindings in a builder.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder 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 object that includes an array of BuildpackBinding resources and a possible link for next set as paginated
     *     response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<BuildpackBindingResourceInner> list(
        String resourceGroupName, String serviceName, String buildServiceName, String builderName) {
        return new PagedIterable<>(listAsync(resourceGroupName, serviceName, buildServiceName, builderName));
    }

    /**
     * Handles requests to list all buildpack bindings in a builder.
     *
     * @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 serviceName The name of the Service resource.
     * @param buildServiceName The name of the build service resource.
     * @param builderName The name of the builder 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 object that includes an array of BuildpackBinding resources and a possible link for next set as paginated
     *     response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<BuildpackBindingResourceInner> list(
        String resourceGroupName, String serviceName, String buildServiceName, String builderName, Context context) {
        return new PagedIterable<>(listAsync(resourceGroupName, serviceName, buildServiceName, builderName, context));
    }

    /**
     * Get the next page of items.
     *
     * @param nextLink 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 object that includes an array of BuildpackBinding resources and a possible link for next set along with
     *     {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<BuildpackBindingResourceInner>> 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<BuildpackBindingResourceInner>>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 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 object that includes an array of BuildpackBinding resources and a possible link for next set along with
     *     {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<BuildpackBindingResourceInner>> 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:
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.RouteHref = undefined;

var _dec, _dec2, _dec3, _dec4, _dec5, _class;

var _aureliaTemplating = require('aurelia-templating');

var _aureliaDependencyInjection = require('aurelia-dependency-injection');

var _aureliaRouter = require('aurelia-router');

var _aureliaPal = require('aurelia-pal');

var _aureliaLogging = require('aurelia-logging');

var LogManager = _interopRequireWildcard(_aureliaLogging);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

var logger = LogManager.getLogger('route-href');

var RouteHref = exports.RouteHref = (_dec = (0, _aureliaTemplating.customAttribute)('route-href'), _dec2 = (0, _aureliaTemplating.bindable)({ name: 'route', changeHandler: 'processChange' }), _dec3 = (0, _aureliaTemplating.bindable)({ name: 'params', changeHandler: 'processChange' }), _dec4 = (0, _aureliaTemplating.bindable)({ name: 'attribute', defaultValue: 'href' }), _dec5 = (0, _aureliaDependencyInjection.inject)(_aureliaRouter.Router, _aureliaPal.DOM.Element), _dec(_class = _dec2(_class = _dec3(_class = _dec4(_class = _dec5(_class = function () {
  function RouteHref(router, element) {

    this.router = router;
    this.element = element;
  }

  RouteHref.prototype.bind = function bind() {
    this.isActive = true;
    this.processChange();
  };

  RouteHref.prototype.unbind = function unbind() {
    this.isActive = false;
  };

  RouteHref.prototype.attributeChanged = function attributeChanged(value, previous) {
    if (previous) {
      this.element.removeAttribute(previous);
    }

    this.processChange();
  };

  RouteHref.prototype.processChange = function processChange() {
    var _this = this;

    return this.router.ensureConfigured().then(function () {
      if (!_this.isActive) {
        return;
      }

      var href = _this.router.generate(_this.route, _this.params);
      _this.element.setAttribute(_this.attribute, href);
    }).catch(function (reason) {
      logger.error(reason);
    });
  };

  return RouteHref;
}()) || _class) || _class) || _class) || _class) || _class);

redpajama_set_name: RedPajamaGithub


text:
"""
Plot to test date axis

NOTE (@vladh): Because we're automatically formatting the date, it will most likely look
different in mpl and d3. This is okay.
"""
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
import datetime
import time
import mpld3

def create_plot():
    otimes = [datetime.date(2013, 12, i) for i in range(1, 11)]
    times = matplotlib.dates.date2num(otimes)

    np.random.seed(0)

    fig, ax = plt.subplots()
    ax.xaxis_date()
    fig.autofmt_xdate()
    ax.plot(times, np.random.random(len(times)), "-", linewidth=3)
    ax.set_title(
        'Test date',
        size=14
    )

    return fig

def test_date():
    fig = create_plot()
    mpld3.fig_to_html(fig)
    plt.close(fig)

if __name__ == "__main__":
    mpld3.show(create_plot())


text:
<?php

/** Uses tsc to build typescript source and emit any errors. */
final class TypescriptBuildLinter extends ArcanistExternalLinter {

  public function getInfoName() {
    return 'tsc';
  }

  public function getInfoURI() {
    return '';
  }

  public function getInfoDescription() {
    return pht('Run tsc against typescript source.');
  }

  public function getLinterName() {
    return 'tsc';
  }

  public function getLinterConfigurationName() {
    return 'tsc';
  }

  public function getDefaultBinary() {
    return 'tsc';
  }

  public function getInstallInstructions() {
    return pht('Install tsc with `npm install typescript -g`');
  }

  public function shouldExpectCommandErrors() {
    return true;
  }

  protected function getDefaultMessageSeverity($code) {
    return ArcanistLintSeverity::SEVERITY_ERROR;
  }

  public function getVersion() {
    list($stdout) = execx('%C --version', $this->getDefaultBinary());

    $matches = array();
    $regex = '/(?P<version>\d+\.\d+\.\d+)/';
    if (preg_match($regex, $stdout, $matches)) {
      return $matches['version'];
    } else {
      return false;
    }
  }

  protected function getMandatoryFlags() {
    $flags = array(
      '--noEmit'
    );
    return $flags;
  }

  protected function parseLinterOutput($path, $err, $stdout, $stderr) {
    $lines = explode("\n", $stdout);
    $messages = array();
    foreach ($lines as $line) {
      if (preg_match("/(?P<path>.+)\((?P<line>.+),(?P<char>.+)\): error (?P<code>.+): (?P<message>.+)/", $line, $matches)) {
        $messages []= id(new ArcanistLintMessage())
          ->setPath($path)
          ->setLine($matches['line'])
          ->setChar($matches['char'])
          ->setCode($matches['code'])
          ->setSeverity($this->getLintMessageSeverity($matches['code']))
          ->setName('tsc failure')
          ->setDescription($matches['message']);
      }
    }
    return $messages;
  }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

        <title>

    Base Type API
 —
    SQLAlchemy 1.3 Documentation

        </title>

                <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
                <link rel="stylesheet" href="../_static/docs.css" type="text/css" />
                <link rel="stylesheet" href="../_static/changelog.css" type="text/css" />
                <link rel="stylesheet" href="../_static/sphinx_paramlinks.css" type="text/css" />

    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
        <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="SQLAlchemy 1.3 Documentation" href="../index.html" />
        <link rel="up" title="Column and Data Types" href="types.html" />
        <link rel="next" title="Engine and Connection Use" href="engines_connections.html" />
        <link rel="prev" title="Custom Types" href="custom_types.html" />

        Release: 1.3.17

        | Release Date: May 13, 2020

SQLAlchemy 1.3 Documentation

SQLAlchemy 1.3 Documentation

                Contents |
                Index

                <form class="search" action="../search.html" method="get">

                  Search terms:
                  <input type="text" placeholder="search..." name="q" size="12" />

                  <input type="hidden" name="check_keywords" value="yes" />
                  <input type="hidden" name="area" value="default" />
                </form>

            SQLAlchemy Core

SQL Expression Language Tutorial

SQL Statements and Expressions API

Schema Definition Language

Column and Data Types

Column and Data Types

Custom Types

Base Type API¶

Engine and Connection Use

Core API Basics

Base Type API¶

class sqlalchemy.types.TypeEngine¶

Bases: sqlalchemy.sql.visitors.Visitable

The ultimate base class for all SQL datatypes.

Common subclasses of TypeEngine include
String, Integer, and Boolean.

For an overview of the SQLAlchemy typing system, see
Column and Data Types.

See also

Column and Data Types

class Comparator(expr)¶

Bases: sqlalchemy.sql.operators.ColumnOperators

Base class for custom comparison operations defined at the
type level.  See TypeEngine.comparator_factory.

method sqlalchemy.types.TypeEngine.Comparator.operate(default_comparator, op, *other, **kwargs)¶

Operate on an argument.

This is the lowest level of operation, raises
NotImplementedError by default.

Overriding this on a subclass can allow common
behavior to be applied to all operations.
For example, overriding ColumnOperators
to apply func.lower() to the left and right
side:

class MyComparator(ColumnOperators):
    def operate(self, op, other):
        return op(func.lower(self), func.lower(other))

Parameters

op¶ – Operator callable.

*other¶ – the 'other' side of the operation. Will
be a single scalar for most operations.

**kwargs¶ – modifiers.  These may be passed by special
operators such as ColumnOperators.contains().

method sqlalchemy.types.TypeEngine.Comparator.reverse_operate(default_comparator, op, other, **kwargs)¶

Reverse operate on an argument.

Usage is the same as operate().

method sqlalchemy.types.TypeEngine.adapt(cls, **kw)¶

Produce an "adapted" form of this type, given an "impl" class
to work with.

This method is used internally to associate generic
types with "implementation" types that are specific to a particular
dialect.

method sqlalchemy.types.TypeEngine.bind_expression(bindvalue)¶

"Given a bind value (i.e. a BindParameter instance),
return a SQL expression in its place.

This is typically a SQL function that wraps the existing bound
parameter within the statement.  It is used for special data types
that require literals being wrapped in some special database function
in order to coerce an application-level value into a database-specific
format.  It is the SQL analogue of the
TypeEngine.bind_processor() method.

The method is evaluated at statement compile time, as opposed
to statement construction time.

Note that this method, when implemented, should always return
the exact same structure, without any conditional logic, as it
may be used in an executemany() call against an arbitrary number
of bound parameter sets.

See also

Applying SQL-level Bind/Result Processing

method sqlalchemy.types.TypeEngine.bind_processor(dialect)¶

Return a conversion function for processing bind values.

Returns a callable which will receive a bind parameter value
as the sole positional argument and will return a value to
send to the DB-API.

If processing is not necessary, the method should return None.

Parameters

dialect¶ – Dialect instance in use.

method sqlalchemy.types.TypeEngine.coerce_compared_value(op, value)¶

Suggest a type for a 'coerced' Python value in an expression.

Given an operator and value, gives the type a chance
to return a type which the value should be coerced into.

The default behavior here is conservative; if the right-hand
side is already coerced into a SQL type based on its
Python type, it is usually left alone.

End-user functionality extension here should generally be via
TypeDecorator, which provides more liberal behavior in that
it defaults to coercing the other side of the expression into this
type, thus applying special Python conversions above and beyond those
needed by the DBAPI to both ides. It also provides the public method
TypeDecorator.coerce_compared_value() which is intended for
end-user customization of this behavior.

method sqlalchemy.types.TypeEngine.column_expression(colexpr)¶

Given a SELECT column expression, return a wrapping SQL expression.

This is typically a SQL function that wraps a column expression
as rendered in the columns clause of a SELECT statement.
It is used for special data types that require
columns to be wrapped in some special database function in order
to coerce the value before being sent back to the application.
It is the SQL analogue of the TypeEngine.result_processor()
method.

The method is evaluated at statement compile time, as opposed
to statement construction time.

See also

Applying SQL-level Bind/Result Processing

attribute sqlalchemy.types.TypeEngine.comparator_factory¶

Bases: sqlalchemy.sql.operators.ColumnOperators

A Comparator class which will apply
to operations performed by owning ColumnElement
objects.

The comparator_factory attribute is a hook consulted by
the core expression system when column and SQL expression operations
are performed.   When a Comparator class is
associated with this attribute, it allows custom re-definition of
all existing operators, as well as definition of new operators.
Existing operators include those provided by Python operator overloading
such as ColumnOperators.__add__() and
ColumnOperators.__eq__(),
those provided as standard
attributes of ColumnOperators such as
ColumnOperators.like()
and ColumnOperators.in_().

Rudimentary usage of this hook is allowed through simple subclassing
of existing types, or alternatively by using TypeDecorator.
See the documentation section Redefining and Creating New Operators for examples.

alias of TypeEngine.Comparator

method sqlalchemy.types.TypeEngine.compare_against_backend(dialect, conn_type)¶

Compare this type against the given backend type.

This function is currently not implemented for SQLAlchemy
types, and for all built in types will return None.  However,
it can be implemented by a user-defined type
where it can be consumed by schema comparison tools such as
Alembic autogenerate.

A future release of SQLAlchemy will potentially implement this method
for builtin types as well.

The function should return True if this type is equivalent to the
given type; the type is typically reflected from the database
so should be database specific.  The dialect in use is also
passed.   It can also return False to assert that the type is
not equivalent.

Parameters

dialect¶ – a Dialect that is involved in the comparison.

conn_type¶ – the type object reflected from the backend.

New in version 1.0.3.

method sqlalchemy.types.TypeEngine.compare_values(x, y)¶

Compare two values for equality.

method sqlalchemy.types.TypeEngine.compile(dialect=None)¶

Produce a string-compiled form of this TypeEngine.

When called with no arguments, uses a "default" dialect
to produce a string result.

Parameters

dialect¶ – a Dialect instance.

method sqlalchemy.types.TypeEngine.dialect_impl(dialect)¶

Return a dialect-specific implementation for this
TypeEngine.

method sqlalchemy.types.TypeEngine.evaluates_none()¶

Return a copy of this type which has the should_evaluate_none
flag set to True.

E.g.:

Table(
    'some_table', metadata,
    Column(
        String(50).evaluates_none(),
        nullable=True,
        server_default='no value')
)

The ORM uses this flag to indicate that a positive value of None
is passed to the column in an INSERT statement, rather than omitting
the column from the INSERT statement which has the effect of firing
off column-level defaults.   It also allows for types which have
special behavior associated with the Python None value to indicate
that the value doesn't necessarily translate into SQL NULL; a
prime example of this is a JSON type which may wish to persist the
JSON value 'null'.

In all cases, the actual NULL SQL value can be always be
persisted in any column by using
the null SQL construct in an INSERT statement
or associated with an ORM-mapped attribute.

Note

The "evaluates none" flag does not apply to a value
of None passed to Column.default or
Column.server_default; in these cases,
None
still means "no default".

New in version 1.1.

See also

Forcing NULL on a column with a default - in the ORM documentation

JSON.none_as_null - PostgreSQL JSON
interaction with this flag.

TypeEngine.should_evaluate_none - class-level flag

method sqlalchemy.types.TypeEngine.get_dbapi_type(dbapi)¶

Return the corresponding type object from the underlying DB-API, if
any.

This can be useful for calling setinputsizes(), for example.

attribute sqlalchemy.types.TypeEngine.hashable = True¶

Flag, if False, means values from this type aren't hashable.

Used by the ORM when uniquing result lists.

method sqlalchemy.types.TypeEngine.literal_processor(dialect)¶

Return a conversion function for processing literal values that are
to be rendered directly without using binds.

This function is used when the compiler makes use of the
"literal_binds" flag, typically used in DDL generation as well
as in certain scenarios where backends don't accept bound parameters.

New in version 0.9.0.

attribute sqlalchemy.types.TypeEngine.python_type¶

Return the Python type object expected to be returned
by instances of this type, if known.

Basically, for those types which enforce a return type,
or are known across the board to do such for all common
DBAPIs (like int for example), will return that type.

If a return type is not defined, raises
NotImplementedError.

Note that any type also accommodates NULL in SQL which
means you can also get back None from any type
in practice.

method sqlalchemy.types.TypeEngine.result_processor(dialect, coltype)¶

Return a conversion function for processing result row values.

Returns a callable which will receive a result row column
value as the sole positional argument and will return a value
to return to the user.

If processing is not necessary, the method should return None.

Parameters

dialect¶ – Dialect instance in use.

coltype¶ – DBAPI coltype argument received in cursor.description.

attribute sqlalchemy.types.TypeEngine.should_evaluate_none = False¶

If True, the Python constant None is considered to be handled
explicitly by this type.

The ORM uses this flag to indicate that a positive value of None
is passed to the column in an INSERT statement, rather than omitting
the column from the INSERT statement which has the effect of firing
off column-level defaults.   It also allows types which have special
behavior for Python None, such as a JSON type, to indicate that
they'd like to handle the None value explicitly.

To set this flag on an existing type, use the
TypeEngine.evaluates_none() method.

See also

TypeEngine.evaluates_none()

New in version 1.1.

attribute sqlalchemy.types.TypeEngine.sort_key_function = None¶

A sorting function that can be passed as the key to sorted.

The default value of None indicates that the values stored by
this type are self-sorting.

New in version 1.3.8.

method sqlalchemy.types.TypeEngine.with_variant(type_, dialect_name)¶

Produce a new type object that will utilize the given
type when applied to the dialect of the given name.

e.g.:

from sqlalchemy.types import String
from sqlalchemy.dialects import mysql

s = String()

s = s.with_variant(mysql.VARCHAR(collation='foo'), 'mysql')

The construction of TypeEngine.with_variant() is always
from the "fallback" type to that which is dialect specific.
The returned type is an instance of Variant, which
itself provides a Variant.with_variant()
that can be called repeatedly.

Parameters

type_¶ – a TypeEngine that will be selected
as a variant from the originating type, when a dialect
of the given name is in use.

dialect_name¶ – base name of the dialect which uses
this type. (i.e. 'postgresql', 'mysql', etc.)

class sqlalchemy.types.Concatenable¶

A mixin that marks a type as supporting 'concatenation',
typically strings.

class Comparator(expr)¶

Bases: sqlalchemy.types.Comparator

attribute sqlalchemy.types.Concatenable.comparator_factory¶

alias of Concatenable.Comparator

class sqlalchemy.types.Indexable¶

A mixin that marks a type as supporting indexing operations,
such as array or JSON structures.

New in version 1.1.0.

class Comparator(expr)¶

Bases: sqlalchemy.types.Comparator

attribute sqlalchemy.types.Indexable.comparator_factory¶

alias of Indexable.Comparator

class sqlalchemy.types.NullType¶

Bases: sqlalchemy.types.TypeEngine

An unknown type.

NullType is used as a default type for those cases where
a type cannot be determined, including:

During table reflection, when the type of a column is not recognized
by the Dialect

When constructing SQL expressions using plain Python objects of
unknown types (e.g. somecolumn == my_special_object)

When a new Column is created,
and the given type is passed
as None or is not passed at all.

The NullType can be used within SQL expression invocation
without issue, it just has no behavior either at the expression
construction level or at the bind-parameter/result processing level.
NullType will result in a CompileError if the compiler
is asked to render the type itself, such as if it is used in a
cast() operation or within a schema creation operation such as that
invoked by MetaData.create_all() or the
CreateTable
construct.

class sqlalchemy.types.Variant(base, mapping)¶

Bases: sqlalchemy.types.TypeDecorator

A wrapping type that selects among a variety of
implementations based on dialect in use.

The Variant type is typically constructed
using the TypeEngine.with_variant() method.

See also

TypeEngine.with_variant() for an example of use.

Members

with_variant, __init__

        Previous:
        Custom Types
        Next:
        Engine and Connection Use

        © Copyright 2007-2020, the SQLAlchemy authors and contributors.
        Created using Sphinx 3.0.3.