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

package com.azure.analytics.synapse.artifacts.implementation;

import com.azure.analytics.synapse.artifacts.models.CloudErrorException;
import com.azure.analytics.synapse.artifacts.models.TriggerListResponse;
import com.azure.analytics.synapse.artifacts.models.TriggerResource;
import com.azure.analytics.synapse.artifacts.models.TriggerSubscriptionOperationStatus;
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.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Post;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.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.util.Context;
import com.azure.core.util.FluxUtil;
import reactor.core.publisher.Mono;

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

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

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

    /**
     * The interface defining all the services for ArtifactsClientTriggers to be used by the proxy service to perform
     * REST calls.
     */
    @Host("{endpoint}")
    @ServiceInterface(name = "ArtifactsClientTrigg")
    public interface TriggersService {
        @Get("/triggers")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<TriggerListResponse>> getTriggersByWorkspace(
                @HostParam("endpoint") String endpoint,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

        @Put("/triggers/{triggerName}")
        @ExpectedResponses({200, 202})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<TriggerResource>> createOrUpdateTrigger(
                @HostParam("endpoint") String endpoint,
                @PathParam("triggerName") String triggerName,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("If-Match") String ifMatch,
                @BodyParam("application/json") TriggerResource trigger,
                @HeaderParam("Accept") String accept,
                Context context);

        @Get("/triggers/{triggerName}")
        @ExpectedResponses({200, 304})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<TriggerResource>> getTrigger(
                @HostParam("endpoint") String endpoint,
                @PathParam("triggerName") String triggerName,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("If-None-Match") String ifNoneMatch,
                @HeaderParam("Accept") String accept,
                Context context);

        @Delete("/triggers/{triggerName}")
        @ExpectedResponses({200, 202, 204})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<Void>> deleteTrigger(
                @HostParam("endpoint") String endpoint,
                @PathParam("triggerName") String triggerName,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

        @Post("/triggers/{triggerName}/subscribeToEvents")
        @ExpectedResponses({200, 202})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<TriggerSubscriptionOperationStatus>> subscribeTriggerToEvents(
                @HostParam("endpoint") String endpoint,
                @PathParam("triggerName") String triggerName,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

        @Post("/triggers/{triggerName}/getEventSubscriptionStatus")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<TriggerSubscriptionOperationStatus>> getEventSubscriptionStatus(
                @HostParam("endpoint") String endpoint,
                @PathParam("triggerName") String triggerName,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

        @Post("/triggers/{triggerName}/unsubscribeFromEvents")
        @ExpectedResponses({200, 202})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<TriggerSubscriptionOperationStatus>> unsubscribeTriggerFromEvents(
                @HostParam("endpoint") String endpoint,
                @PathParam("triggerName") String triggerName,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

        @Post("/triggers/{triggerName}/start")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<Void>> startTrigger(
                @HostParam("endpoint") String endpoint,
                @PathParam("triggerName") String triggerName,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

        @Post("/triggers/{triggerName}/stop")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<Void>> stopTrigger(
                @HostParam("endpoint") String endpoint,
                @PathParam("triggerName") String triggerName,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

        @Get("{nextLink}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<TriggerListResponse>> getTriggersByWorkspaceNext(
                @PathParam(value = "nextLink", encoded = true) String nextLink,
                @HostParam("endpoint") String endpoint,
                @HeaderParam("Accept") String accept,
                Context context);
    }

    /**
     * Lists triggers.
     *
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of trigger resources along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<TriggerResource>> getTriggersByWorkspaceSinglePageAsync() {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return FluxUtil.withContext(
                        context ->
                                service.getTriggersByWorkspace(this.client.getEndpoint(), apiVersion, accept, context))
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        res.getValue().getValue(),
                                        res.getValue().getNextLink(),
                                        null));
    }

    /**
     * Lists triggers.
     *
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of trigger resources along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<TriggerResource>> getTriggersByWorkspaceSinglePageAsync(Context context) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return service.getTriggersByWorkspace(this.client.getEndpoint(), apiVersion, accept, context)
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        res.getValue().getValue(),
                                        res.getValue().getNextLink(),
                                        null));
    }

    /**
     * Lists triggers.
     *
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of trigger resources as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<TriggerResource> getTriggersByWorkspaceAsync() {
        return new PagedFlux<>(
                () -> getTriggersByWorkspaceSinglePageAsync(),
                nextLink -> getTriggersByWorkspaceNextSinglePageAsync(nextLink));
    }

    /**
     * Lists triggers.
     *
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of trigger resources as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<TriggerResource> getTriggersByWorkspaceAsync(Context context) {
        return new PagedFlux<>(
                () -> getTriggersByWorkspaceSinglePageAsync(context),
                nextLink -> getTriggersByWorkspaceNextSinglePageAsync(nextLink, context));
    }

    /**
     * Lists triggers.
     *
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of trigger resources along with {@link PagedResponse}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public PagedResponse<TriggerResource> getTriggersByWorkspaceSinglePage() {
        return getTriggersByWorkspaceSinglePageAsync().block();
    }

    /**
     * Lists triggers.
     *
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of trigger resources along with {@link PagedResponse}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public PagedResponse<TriggerResource> getTriggersByWorkspaceSinglePage(Context context) {
        return getTriggersByWorkspaceSinglePageAsync(context).block();
    }

    /**
     * Lists triggers.
     *
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of trigger resources as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<TriggerResource> getTriggersByWorkspace() {
        return new PagedIterable<>(getTriggersByWorkspaceAsync());
    }

    /**
     * Lists triggers.
     *
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of trigger resources as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<TriggerResource> getTriggersByWorkspace(Context context) {
        return new PagedIterable<>(getTriggersByWorkspaceAsync(context));
    }

    /**
     * Creates or updates a trigger.
     *
     * @param triggerName The trigger name.
     * @param trigger Trigger resource definition.
     * @param ifMatch ETag of the trigger entity. Should only be specified for update, for which it should match
     *     existing entity or can be * for unconditional update.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return trigger resource type along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<TriggerResource>> createOrUpdateTriggerWithResponseAsync(
            String triggerName, TriggerResource trigger, String ifMatch) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.createOrUpdateTrigger(
                                this.client.getEndpoint(), triggerName, apiVersion, ifMatch, trigger, accept, context));
    }

    /**
     * Creates or updates a trigger.
     *
     * @param triggerName The trigger name.
     * @param trigger Trigger resource definition.
     * @param ifMatch ETag of the trigger entity. Should only be specified for update, for which it should match
     *     existing entity or can be * for unconditional update.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return trigger resource type along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<TriggerResource>> createOrUpdateTriggerWithResponseAsync(
            String triggerName, TriggerResource trigger, String ifMatch, Context context) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return service.createOrUpdateTrigger(
                this.client.getEndpoint(), triggerName, apiVersion, ifMatch, trigger, accept, context);
    }

    /**
     * Creates or updates a trigger.
     *
     * @param triggerName The trigger name.
     * @param trigger Trigger resource definition.
     * @param ifMatch ETag of the trigger entity. Should only be specified for update, for which it should match
     *     existing entity or can be * for unconditional update.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return trigger resource type on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<TriggerResource> createOrUpdateTriggerAsync(
            String triggerName, TriggerResource trigger, String ifMatch) {
        return createOrUpdateTriggerWithResponseAsync(triggerName, trigger, ifMatch)
                .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Creates or updates a trigger.
     *
     * @param triggerName The trigger name.
     * @param trigger Trigger resource definition.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return trigger resource type on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<TriggerResource> createOrUpdateTriggerAsync(String triggerName, TriggerResource trigger) {
        final String ifMatch = null;
        return createOrUpdateTriggerWithResponseAsync(triggerName, trigger, ifMatch)
                .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Creates or updates a trigger.
     *
     * @param triggerName The trigger name.
     * @param trigger Trigger resource definition.
     * @param ifMatch ETag of the trigger entity. Should only be specified for update, for which it should match
     *     existing entity or can be * for unconditional update.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return trigger resource type on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<TriggerResource> createOrUpdateTriggerAsync(
            String triggerName, TriggerResource trigger, String ifMatch, Context context) {
        return createOrUpdateTriggerWithResponseAsync(triggerName, trigger, ifMatch, context)
                .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Creates or updates a trigger.
     *
     * @param triggerName The trigger name.
     * @param trigger Trigger resource definition.
     * @param ifMatch ETag of the trigger entity. Should only be specified for update, for which it should match
     *     existing entity or can be * for unconditional update.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return trigger resource type along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<TriggerResource> createOrUpdateTriggerWithResponse(
            String triggerName, TriggerResource trigger, String ifMatch, Context context) {
        return createOrUpdateTriggerWithResponseAsync(triggerName, trigger, ifMatch, context).block();
    }

    /**
     * Creates or updates a trigger.
     *
     * @param triggerName The trigger name.
     * @param trigger Trigger resource definition.
     * @param ifMatch ETag of the trigger entity. Should only be specified for update, for which it should match
     *     existing entity or can be * for unconditional update.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return trigger resource type.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public TriggerResource createOrUpdateTrigger(String triggerName, TriggerResource trigger, String ifMatch) {
        return createOrUpdateTriggerWithResponse(triggerName, trigger, ifMatch, Context.NONE).getValue();
    }

    /**
     * Creates or updates a trigger.
     *
     * @param triggerName The trigger name.
     * @param trigger Trigger resource definition.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return trigger resource type.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public TriggerResource createOrUpdateTrigger(String triggerName, TriggerResource trigger) {
        final String ifMatch = null;
        return createOrUpdateTriggerWithResponse(triggerName, trigger, ifMatch, Context.NONE).getValue();
    }

    /**
     * Gets a trigger.
     *
     * @param triggerName The trigger name.
     * @param ifNoneMatch ETag of the trigger entity. Should only be specified for get. If the ETag matches the existing
     *     entity tag, or if * was provided, then no content will be returned.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a trigger along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<TriggerResource>> getTriggerWithResponseAsync(String triggerName, String ifNoneMatch) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.getTrigger(
                                this.client.getEndpoint(), triggerName, apiVersion, ifNoneMatch, accept, context));
    }

    /**
     * Gets a trigger.
     *
     * @param triggerName The trigger name.
     * @param ifNoneMatch ETag of the trigger entity. Should only be specified for get. If the ETag matches the existing
     *     entity tag, or if * was provided, then no content will be returned.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a trigger along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<TriggerResource>> getTriggerWithResponseAsync(
            String triggerName, String ifNoneMatch, Context context) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return service.getTrigger(this.client.getEndpoint(), triggerName, apiVersion, ifNoneMatch, accept, context);
    }

    /**
     * Gets a trigger.
     *
     * @param triggerName The trigger name.
     * @param ifNoneMatch ETag of the trigger entity. Should only be specified for get. If the ETag matches the existing
     *     entity tag, or if * was provided, then no content will be returned.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a trigger on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<TriggerResource> getTriggerAsync(String triggerName, String ifNoneMatch) {
        return getTriggerWithResponseAsync(triggerName, ifNoneMatch).flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Gets a trigger.
     *
     * @param triggerName The trigger name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a trigger on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<TriggerResource> getTriggerAsync(String triggerName) {
        final String ifNoneMatch = null;
        return getTriggerWithResponseAsync(triggerName, ifNoneMatch).flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Gets a trigger.
     *
     * @param triggerName The trigger name.
     * @param ifNoneMatch ETag of the trigger entity. Should only be specified for get. If the ETag matches the existing
     *     entity tag, or if * was provided, then no content will be returned.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a trigger on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<TriggerResource> getTriggerAsync(String triggerName, String ifNoneMatch, Context context) {
        return getTriggerWithResponseAsync(triggerName, ifNoneMatch, context)
                .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Gets a trigger.
     *
     * @param triggerName The trigger name.
     * @param ifNoneMatch ETag of the trigger entity. Should only be specified for get. If the ETag matches the existing
     *     entity tag, or if * was provided, then no content will be returned.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a trigger along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<TriggerResource> getTriggerWithResponse(String triggerName, String ifNoneMatch, Context context) {
        return getTriggerWithResponseAsync(triggerName, ifNoneMatch, context).block();
    }

    /**
     * Gets a trigger.
     *
     * @param triggerName The trigger name.
     * @param ifNoneMatch ETag of the trigger entity. Should only be specified for get. If the ETag matches the existing
     *     entity tag, or if * was provided, then no content will be returned.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a trigger.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public TriggerResource getTrigger(String triggerName, String ifNoneMatch) {
        return getTriggerWithResponse(triggerName, ifNoneMatch, Context.NONE).getValue();
    }

    /**
     * Gets a trigger.
     *
     * @param triggerName The trigger name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a trigger.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public TriggerResource getTrigger(String triggerName) {
        final String ifNoneMatch = null;
        return getTriggerWithResponse(triggerName, ifNoneMatch, Context.NONE).getValue();
    }

    /**
     * Deletes a trigger.
     *
     * @param triggerName The trigger name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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<Void>> deleteTriggerWithResponseAsync(String triggerName) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context -> service.deleteTrigger(this.client.getEndpoint(), triggerName, apiVersion, accept, context));
    }

    /**
     * Deletes a trigger.
     *
     * @param triggerName The trigger name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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<Void>> deleteTriggerWithResponseAsync(String triggerName, Context context) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return service.deleteTrigger(this.client.getEndpoint(), triggerName, apiVersion, accept, context);
    }

    /**
     * Deletes a trigger.
     *
     * @param triggerName The trigger name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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> deleteTriggerAsync(String triggerName) {
        return deleteTriggerWithResponseAsync(triggerName).flatMap(ignored -> Mono.empty());
    }

    /**
     * Deletes a trigger.
     *
     * @param triggerName The trigger name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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> deleteTriggerAsync(String triggerName, Context context) {
        return deleteTriggerWithResponseAsync(triggerName, context).flatMap(ignored -> Mono.empty());
    }

    /**
     * Deletes a trigger.
     *
     * @param triggerName The trigger name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<Void> deleteTriggerWithResponse(String triggerName, Context context) {
        return deleteTriggerWithResponseAsync(triggerName, context).block();
    }

    /**
     * Deletes a trigger.
     *
     * @param triggerName The trigger name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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 deleteTrigger(String triggerName) {
        deleteTriggerWithResponse(triggerName, Context.NONE);
    }

    /**
     * Subscribe event trigger to events.
     *
     * @param triggerName The trigger name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return defines the response of a trigger subscription operation along with {@link Response} on successful
     *     completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<TriggerSubscriptionOperationStatus>> subscribeTriggerToEventsWithResponseAsync(
            String triggerName) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.subscribeTriggerToEvents(
                                this.client.getEndpoint(), triggerName, apiVersion, accept, context));
    }

    /**
     * Subscribe event trigger to events.
     *
     * @param triggerName The trigger name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return defines the response of a trigger subscription operation along with {@link Response} on successful
     *     completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<TriggerSubscriptionOperationStatus>> subscribeTriggerToEventsWithResponseAsync(
            String triggerName, Context context) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return service.subscribeTriggerToEvents(this.client.getEndpoint(), triggerName, apiVersion, accept, context);
    }

    /**
     * Subscribe event trigger to events.
     *
     * @param triggerName The trigger name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return defines the response of a trigger subscription operation on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<TriggerSubscriptionOperationStatus> subscribeTriggerToEventsAsync(String triggerName) {
        return subscribeTriggerToEventsWithResponseAsync(triggerName).flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Subscribe event trigger to events.
     *
     * @param triggerName The trigger name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return defines the response of a trigger subscription operation on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<TriggerSubscriptionOperationStatus> subscribeTriggerToEventsAsync(String triggerName, Context context) {
        return subscribeTriggerToEventsWithResponseAsync(triggerName, context)
                .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Subscribe event trigger to events.
     *
     * @param triggerName The trigger name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return defines the response of a trigger subscription operation along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<TriggerSubscriptionOperationStatus> subscribeTriggerToEventsWithResponse(
            String triggerName, Context context) {
        return subscribeTriggerToEventsWithResponseAsync(triggerName, context).block();
    }

    /**
     * Subscribe event trigger to events.
     *
     * @param triggerName The trigger name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return defines the response of a trigger subscription operation.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public TriggerSubscriptionOperationStatus subscribeTriggerToEvents(String triggerName) {
        return subscribeTriggerToEventsWithResponse(triggerName, Context.NONE).getValue();
    }

    /**
     * Get a trigger's event subscription status.
     *
     * @param triggerName The trigger name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a trigger's event subscription status along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<TriggerSubscriptionOperationStatus>> getEventSubscriptionStatusWithResponseAsync(
            String triggerName) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.getEventSubscriptionStatus(
                                this.client.getEndpoint(), triggerName, apiVersion, accept, context));
    }

    /**
     * Get a trigger's event subscription status.
     *
     * @param triggerName The trigger name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a trigger's event subscription status along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<TriggerSubscriptionOperationStatus>> getEventSubscriptionStatusWithResponseAsync(
            String triggerName, Context context) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return service.getEventSubscriptionStatus(this.client.getEndpoint(), triggerName, apiVersion, accept, context);
    }

    /**
     * Get a trigger's event subscription status.
     *
     * @param triggerName The trigger name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a trigger's event subscription status on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<TriggerSubscriptionOperationStatus> getEventSubscriptionStatusAsync(String triggerName) {
        return getEventSubscriptionStatusWithResponseAsync(triggerName)
                .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get a trigger's event subscription status.
     *
     * @param triggerName The trigger name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a trigger's event subscription status on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<TriggerSubscriptionOperationStatus> getEventSubscriptionStatusAsync(
            String triggerName, Context context) {
        return getEventSubscriptionStatusWithResponseAsync(triggerName, context)
                .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get a trigger's event subscription status.
     *
     * @param triggerName The trigger name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a trigger's event subscription status along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<TriggerSubscriptionOperationStatus> getEventSubscriptionStatusWithResponse(
            String triggerName, Context context) {
        return getEventSubscriptionStatusWithResponseAsync(triggerName, context).block();
    }

    /**
     * Get a trigger's event subscription status.
     *
     * @param triggerName The trigger name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a trigger's event subscription status.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public TriggerSubscriptionOperationStatus getEventSubscriptionStatus(String triggerName) {
        return getEventSubscriptionStatusWithResponse(triggerName, Context.NONE).getValue();
    }

    /**
     * Unsubscribe event trigger from events.
     *
     * @param triggerName The trigger name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return defines the response of a trigger subscription operation along with {@link Response} on successful
     *     completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<TriggerSubscriptionOperationStatus>> unsubscribeTriggerFromEventsWithResponseAsync(
            String triggerName) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.unsubscribeTriggerFromEvents(
                                this.client.getEndpoint(), triggerName, apiVersion, accept, context));
    }

    /**
     * Unsubscribe event trigger from events.
     *
     * @param triggerName The trigger name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return defines the response of a trigger subscription operation along with {@link Response} on successful
     *     completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<TriggerSubscriptionOperationStatus>> unsubscribeTriggerFromEventsWithResponseAsync(
            String triggerName, Context context) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return service.unsubscribeTriggerFromEvents(
                this.client.getEndpoint(), triggerName, apiVersion, accept, context);
    }

    /**
     * Unsubscribe event trigger from events.
     *
     * @param triggerName The trigger name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return defines the response of a trigger subscription operation on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<TriggerSubscriptionOperationStatus> unsubscribeTriggerFromEventsAsync(String triggerName) {
        return unsubscribeTriggerFromEventsWithResponseAsync(triggerName)
                .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Unsubscribe event trigger from events.
     *
     * @param triggerName The trigger name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return defines the response of a trigger subscription operation on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<TriggerSubscriptionOperationStatus> unsubscribeTriggerFromEventsAsync(
            String triggerName, Context context) {
        return unsubscribeTriggerFromEventsWithResponseAsync(triggerName, context)
                .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Unsubscribe event trigger from events.
     *
     * @param triggerName The trigger name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return defines the response of a trigger subscription operation along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<TriggerSubscriptionOperationStatus> unsubscribeTriggerFromEventsWithResponse(
            String triggerName, Context context) {
        return unsubscribeTriggerFromEventsWithResponseAsync(triggerName, context).block();
    }

    /**
     * Unsubscribe event trigger from events.
     *
     * @param triggerName The trigger name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return defines the response of a trigger subscription operation.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public TriggerSubscriptionOperationStatus unsubscribeTriggerFromEvents(String triggerName) {
        return unsubscribeTriggerFromEventsWithResponse(triggerName, Context.NONE).getValue();
    }

    /**
     * Starts a trigger.
     *
     * @param triggerName The trigger name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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<Void>> startTriggerWithResponseAsync(String triggerName) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context -> service.startTrigger(this.client.getEndpoint(), triggerName, apiVersion, accept, context));
    }

    /**
     * Starts a trigger.
     *
     * @param triggerName The trigger name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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<Void>> startTriggerWithResponseAsync(String triggerName, Context context) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return service.startTrigger(this.client.getEndpoint(), triggerName, apiVersion, accept, context);
    }

    /**
     * Starts a trigger.
     *
     * @param triggerName The trigger name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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> startTriggerAsync(String triggerName) {
        return startTriggerWithResponseAsync(triggerName).flatMap(ignored -> Mono.empty());
    }

    /**
     * Starts a trigger.
     *
     * @param triggerName The trigger name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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> startTriggerAsync(String triggerName, Context context) {
        return startTriggerWithResponseAsync(triggerName, context).flatMap(ignored -> Mono.empty());
    }

    /**
     * Starts a trigger.
     *
     * @param triggerName The trigger name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<Void> startTriggerWithResponse(String triggerName, Context context) {
        return startTriggerWithResponseAsync(triggerName, context).block();
    }

    /**
     * Starts a trigger.
     *
     * @param triggerName The trigger name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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 startTrigger(String triggerName) {
        startTriggerWithResponse(triggerName, Context.NONE);
    }

    /**
     * Stops a trigger.
     *
     * @param triggerName The trigger name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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<Void>> stopTriggerWithResponseAsync(String triggerName) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context -> service.stopTrigger(this.client.getEndpoint(), triggerName, apiVersion, accept, context));
    }

    /**
     * Stops a trigger.
     *
     * @param triggerName The trigger name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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<Void>> stopTriggerWithResponseAsync(String triggerName, Context context) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return service.stopTrigger(this.client.getEndpoint(), triggerName, apiVersion, accept, context);
    }

    /**
     * Stops a trigger.
     *
     * @param triggerName The trigger name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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> stopTriggerAsync(String triggerName) {
        return stopTriggerWithResponseAsync(triggerName).flatMap(ignored -> Mono.empty());
    }

    /**
     * Stops a trigger.
     *
     * @param triggerName The trigger name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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> stopTriggerAsync(String triggerName, Context context) {
        return stopTriggerWithResponseAsync(triggerName, context).flatMap(ignored -> Mono.empty());
    }

    /**
     * Stops a trigger.
     *
     * @param triggerName The trigger name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<Void> stopTriggerWithResponse(String triggerName, Context context) {
        return stopTriggerWithResponseAsync(triggerName, context).block();
    }

    /**
     * Stops a trigger.
     *
     * @param triggerName The trigger name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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 stopTrigger(String triggerName) {
        stopTriggerWithResponse(triggerName, Context.NONE);
    }

    /**
     * Get the next page of items.
     *
     * @param nextLink The URL to get the next list of items
     *     <p>The nextLink parameter.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of trigger resources along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<TriggerResource>> getTriggersByWorkspaceNextSinglePageAsync(String nextLink) {
        final String accept = "application/json";
        return FluxUtil.withContext(
                        context ->
                                service.getTriggersByWorkspaceNext(
                                        nextLink, this.client.getEndpoint(), accept, context))
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        res.getValue().getValue(),
                                        res.getValue().getNextLink(),
                                        null));
    }

    /**
     * Get the next page of items.
     *
     * @param nextLink The URL to get the next list of items
     *     <p>The nextLink parameter.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of trigger resources along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<TriggerResource>> getTriggersByWorkspaceNextSinglePageAsync(
            String nextLink, Context context) {
        final String accept = "application/json";
        return service.getTriggersByWorkspaceNext(nextLink, this.client.getEndpoint(), accept, context)
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        res.getValue().getValue(),
                                        res.getValue().getNextLink(),
                                        null));
    }

    /**
     * Get the next page of items.
     *
     * @param nextLink The URL to get the next list of items
     *     <p>The nextLink parameter.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of trigger resources along with {@link PagedResponse}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public PagedResponse<TriggerResource> getTriggersByWorkspaceNextSinglePage(String nextLink) {
        return getTriggersByWorkspaceNextSinglePageAsync(nextLink).block();
    }

    /**
     * Get the next page of items.
     *
     * @param nextLink The URL to get the next list of items
     *     <p>The nextLink parameter.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of trigger resources along with {@link PagedResponse}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public PagedResponse<TriggerResource> getTriggersByWorkspaceNextSinglePage(String nextLink, Context context) {
        return getTriggersByWorkspaceNextSinglePageAsync(nextLink, context).block();
    }
}
