DeviceUpdatesImpl.java

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

package com.azure.iot.deviceupdate.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.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Post;
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.exception.HttpResponseException;
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.RequestOptions;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.util.BinaryData;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.polling.DefaultPollingStrategy;
import com.azure.core.util.polling.PollerFlux;
import com.azure.core.util.polling.SyncPoller;
import com.azure.core.util.serializer.TypeReference;
import java.time.Duration;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import reactor.core.publisher.Mono;

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

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

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

    /**
     * The interface defining all the services for DeviceUpdateClientDeviceUpdates to be used by the proxy service to
     * perform REST calls.
     */
    @Host("https://{endpoint}")
    @ServiceInterface(name = "DeviceUpdateClientDe")
    private interface DeviceUpdatesService {
        @Post("/deviceupdate/{instanceId}/updates")
        @ExpectedResponses({202})
        Mono<Response<BinaryData>> importUpdate(
                @HostParam("endpoint") String endpoint,
                @PathParam(value = "instanceId", encoded = true) String instanceId,
                @QueryParam("api-version") String apiVersion,
                @BodyParam("application/json") BinaryData updateToImport,
                RequestOptions requestOptions,
                Context context);

        @Get("/deviceupdate/{instanceId}/updates")
        @ExpectedResponses({200})
        Mono<Response<BinaryData>> listUpdates(
                @HostParam("endpoint") String endpoint,
                @PathParam(value = "instanceId", encoded = true) String instanceId,
                @QueryParam("api-version") String apiVersion,
                RequestOptions requestOptions,
                Context context);

        @Get("/deviceupdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}")
        @ExpectedResponses({200, 304})
        Mono<Response<BinaryData>> getUpdate(
                @HostParam("endpoint") String endpoint,
                @PathParam(value = "instanceId", encoded = true) String instanceId,
                @PathParam("provider") String provider,
                @PathParam("name") String name,
                @PathParam("version") String version,
                @QueryParam("api-version") String apiVersion,
                RequestOptions requestOptions,
                Context context);

        @Delete("/deviceupdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}")
        @ExpectedResponses({202})
        Mono<Response<Void>> deleteUpdate(
                @HostParam("endpoint") String endpoint,
                @PathParam(value = "instanceId", encoded = true) String instanceId,
                @PathParam("provider") String provider,
                @PathParam("name") String name,
                @PathParam("version") String version,
                @QueryParam("api-version") String apiVersion,
                RequestOptions requestOptions,
                Context context);

        @Get("/deviceupdate/{instanceId}/updates/providers")
        @ExpectedResponses({200})
        Mono<Response<BinaryData>> listProviders(
                @HostParam("endpoint") String endpoint,
                @PathParam(value = "instanceId", encoded = true) String instanceId,
                @QueryParam("api-version") String apiVersion,
                RequestOptions requestOptions,
                Context context);

        @Get("/deviceupdate/{instanceId}/updates/providers/{provider}/names")
        @ExpectedResponses({200})
        Mono<Response<BinaryData>> listNames(
                @HostParam("endpoint") String endpoint,
                @PathParam(value = "instanceId", encoded = true) String instanceId,
                @PathParam("provider") String provider,
                @QueryParam("api-version") String apiVersion,
                RequestOptions requestOptions,
                Context context);

        @Get("/deviceupdate/{instanceId}/updates/providers/{provider}/names/{name}/versions")
        @ExpectedResponses({200})
        Mono<Response<BinaryData>> listVersions(
                @HostParam("endpoint") String endpoint,
                @PathParam(value = "instanceId", encoded = true) String instanceId,
                @PathParam("provider") String provider,
                @PathParam("name") String name,
                @QueryParam("api-version") String apiVersion,
                RequestOptions requestOptions,
                Context context);

        @Get("/deviceupdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}/files")
        @ExpectedResponses({200})
        Mono<Response<BinaryData>> listFiles(
                @HostParam("endpoint") String endpoint,
                @PathParam(value = "instanceId", encoded = true) String instanceId,
                @PathParam("provider") String provider,
                @PathParam("name") String name,
                @PathParam("version") String version,
                @QueryParam("api-version") String apiVersion,
                RequestOptions requestOptions,
                Context context);

        @Get("/deviceupdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}/files/{fileId}")
        @ExpectedResponses({200, 304})
        Mono<Response<BinaryData>> getFile(
                @HostParam("endpoint") String endpoint,
                @PathParam(value = "instanceId", encoded = true) String instanceId,
                @PathParam("provider") String provider,
                @PathParam("name") String name,
                @PathParam("version") String version,
                @PathParam("fileId") String fileId,
                @QueryParam("api-version") String apiVersion,
                RequestOptions requestOptions,
                Context context);

        @Get("/deviceupdate/{instanceId}/updates/operations")
        @ExpectedResponses({200})
        Mono<Response<BinaryData>> listOperations(
                @HostParam("endpoint") String endpoint,
                @PathParam(value = "instanceId", encoded = true) String instanceId,
                @QueryParam("api-version") String apiVersion,
                RequestOptions requestOptions,
                Context context);

        @Get("/deviceupdate/{instanceId}/updates/operations/{operationId}")
        @ExpectedResponses({200, 304})
        Mono<Response<BinaryData>> getOperation(
                @HostParam("endpoint") String endpoint,
                @PathParam(value = "instanceId", encoded = true) String instanceId,
                @PathParam("operationId") String operationId,
                @QueryParam("api-version") String apiVersion,
                RequestOptions requestOptions,
                Context context);

        @Get("{nextLink}")
        @ExpectedResponses({200})
        Mono<Response<BinaryData>> listUpdatesNext(
                @PathParam(value = "nextLink", encoded = true) String nextLink,
                @HostParam("endpoint") String endpoint,
                RequestOptions requestOptions,
                Context context);

        @Get("{nextLink}")
        @ExpectedResponses({200})
        Mono<Response<BinaryData>> listProvidersNext(
                @PathParam(value = "nextLink", encoded = true) String nextLink,
                @HostParam("endpoint") String endpoint,
                RequestOptions requestOptions,
                Context context);

        @Get("{nextLink}")
        @ExpectedResponses({200})
        Mono<Response<BinaryData>> listNamesNext(
                @PathParam(value = "nextLink", encoded = true) String nextLink,
                @HostParam("endpoint") String endpoint,
                RequestOptions requestOptions,
                Context context);

        @Get("{nextLink}")
        @ExpectedResponses({200})
        Mono<Response<BinaryData>> listVersionsNext(
                @PathParam(value = "nextLink", encoded = true) String nextLink,
                @HostParam("endpoint") String endpoint,
                RequestOptions requestOptions,
                Context context);

        @Get("{nextLink}")
        @ExpectedResponses({200})
        Mono<Response<BinaryData>> listFilesNext(
                @PathParam(value = "nextLink", encoded = true) String nextLink,
                @HostParam("endpoint") String endpoint,
                RequestOptions requestOptions,
                Context context);

        @Get("{nextLink}")
        @ExpectedResponses({200})
        Mono<Response<BinaryData>> listOperationsNext(
                @PathParam(value = "nextLink", encoded = true) String nextLink,
                @HostParam("endpoint") String endpoint,
                RequestOptions requestOptions,
                Context context);
    }

    /**
     * Import new update version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>action</td><td>String</td><td>Yes</td><td>Import update action.</td></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Request Body Schema</strong>
     *
     * <pre>{@code
     * [
     *     {
     *         importManifest: {
     *             url: String
     *             sizeInBytes: long
     *             hashes: {
     *                 String: String
     *             }
     *         }
     *         friendlyName: String
     *         files: [
     *             {
     *                 filename: String
     *                 url: String
     *             }
     *         ]
     *     }
     * ]
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     description: String
     *     friendlyName: String
     *     isDeployable: Boolean
     *     updateType: String
     *     installedCriteria: String
     *     compatibility: [
     *         {
     *             String: String
     *         }
     *     ]
     *     instructions: {
     *         steps: [
     *             {
     *                 type: String(Inline/Reference)
     *                 description: String
     *                 handler: String
     *                 handlerProperties: Object
     *                 files: [
     *                     String
     *                 ]
     *                 updateId: (recursive schema, see updateId above)
     *             }
     *         ]
     *     }
     *     referencedBy: [
     *         (recursive schema, see above)
     *     ]
     *     scanResult: String
     *     manifestVersion: String
     *     importedDateTime: String
     *     createdDateTime: String
     *     etag: String
     * }
     * }</pre>
     *
     * @param updateToImport The update to be imported.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return update metadata along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> importUpdateWithResponseAsync(
            BinaryData updateToImport, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.importUpdate(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                this.client.getServiceVersion().getVersion(),
                                updateToImport,
                                requestOptions,
                                context));
    }

    /**
     * Import new update version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>action</td><td>String</td><td>Yes</td><td>Import update action.</td></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Request Body Schema</strong>
     *
     * <pre>{@code
     * [
     *     {
     *         importManifest: {
     *             url: String
     *             sizeInBytes: long
     *             hashes: {
     *                 String: String
     *             }
     *         }
     *         friendlyName: String
     *         files: [
     *             {
     *                 filename: String
     *                 url: String
     *             }
     *         ]
     *     }
     * ]
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     description: String
     *     friendlyName: String
     *     isDeployable: Boolean
     *     updateType: String
     *     installedCriteria: String
     *     compatibility: [
     *         {
     *             String: String
     *         }
     *     ]
     *     instructions: {
     *         steps: [
     *             {
     *                 type: String(Inline/Reference)
     *                 description: String
     *                 handler: String
     *                 handlerProperties: Object
     *                 files: [
     *                     String
     *                 ]
     *                 updateId: (recursive schema, see updateId above)
     *             }
     *         ]
     *     }
     *     referencedBy: [
     *         (recursive schema, see above)
     *     ]
     *     scanResult: String
     *     manifestVersion: String
     *     importedDateTime: String
     *     createdDateTime: String
     *     etag: String
     * }
     * }</pre>
     *
     * @param updateToImport The update to be imported.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return update metadata along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> importUpdateWithResponseAsync(
            BinaryData updateToImport, RequestOptions requestOptions, Context context) {
        return service.importUpdate(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                this.client.getServiceVersion().getVersion(),
                updateToImport,
                requestOptions,
                context);
    }

    /**
     * Import new update version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>action</td><td>String</td><td>Yes</td><td>Import update action.</td></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Request Body Schema</strong>
     *
     * <pre>{@code
     * [
     *     {
     *         importManifest: {
     *             url: String
     *             sizeInBytes: long
     *             hashes: {
     *                 String: String
     *             }
     *         }
     *         friendlyName: String
     *         files: [
     *             {
     *                 filename: String
     *                 url: String
     *             }
     *         ]
     *     }
     * ]
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     description: String
     *     friendlyName: String
     *     isDeployable: Boolean
     *     updateType: String
     *     installedCriteria: String
     *     compatibility: [
     *         {
     *             String: String
     *         }
     *     ]
     *     instructions: {
     *         steps: [
     *             {
     *                 type: String(Inline/Reference)
     *                 description: String
     *                 handler: String
     *                 handlerProperties: Object
     *                 files: [
     *                     String
     *                 ]
     *                 updateId: (recursive schema, see updateId above)
     *             }
     *         ]
     *     }
     *     referencedBy: [
     *         (recursive schema, see above)
     *     ]
     *     scanResult: String
     *     manifestVersion: String
     *     importedDateTime: String
     *     createdDateTime: String
     *     etag: String
     * }
     * }</pre>
     *
     * @param updateToImport The update to be imported.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return update metadata along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public PollerFlux<BinaryData, BinaryData> beginImportUpdateAsync(
            BinaryData updateToImport, RequestOptions requestOptions) {
        return PollerFlux.create(
                Duration.ofSeconds(1),
                () -> this.importUpdateWithResponseAsync(updateToImport, requestOptions),
                new DefaultPollingStrategy<>(this.client.getHttpPipeline()),
                new TypeReferenceBinaryData(),
                new TypeReferenceBinaryData());
    }

    /**
     * Import new update version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>action</td><td>String</td><td>Yes</td><td>Import update action.</td></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Request Body Schema</strong>
     *
     * <pre>{@code
     * [
     *     {
     *         importManifest: {
     *             url: String
     *             sizeInBytes: long
     *             hashes: {
     *                 String: String
     *             }
     *         }
     *         friendlyName: String
     *         files: [
     *             {
     *                 filename: String
     *                 url: String
     *             }
     *         ]
     *     }
     * ]
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     description: String
     *     friendlyName: String
     *     isDeployable: Boolean
     *     updateType: String
     *     installedCriteria: String
     *     compatibility: [
     *         {
     *             String: String
     *         }
     *     ]
     *     instructions: {
     *         steps: [
     *             {
     *                 type: String(Inline/Reference)
     *                 description: String
     *                 handler: String
     *                 handlerProperties: Object
     *                 files: [
     *                     String
     *                 ]
     *                 updateId: (recursive schema, see updateId above)
     *             }
     *         ]
     *     }
     *     referencedBy: [
     *         (recursive schema, see above)
     *     ]
     *     scanResult: String
     *     manifestVersion: String
     *     importedDateTime: String
     *     createdDateTime: String
     *     etag: String
     * }
     * }</pre>
     *
     * @param updateToImport The update to be imported.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return update metadata along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public PollerFlux<BinaryData, BinaryData> beginImportUpdateAsync(
            BinaryData updateToImport, RequestOptions requestOptions, Context context) {
        return PollerFlux.create(
                Duration.ofSeconds(1),
                () -> this.importUpdateWithResponseAsync(updateToImport, requestOptions, context),
                new DefaultPollingStrategy<>(this.client.getHttpPipeline()),
                new TypeReferenceBinaryData(),
                new TypeReferenceBinaryData());
    }

    /**
     * Import new update version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>action</td><td>String</td><td>Yes</td><td>Import update action.</td></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Request Body Schema</strong>
     *
     * <pre>{@code
     * [
     *     {
     *         importManifest: {
     *             url: String
     *             sizeInBytes: long
     *             hashes: {
     *                 String: String
     *             }
     *         }
     *         friendlyName: String
     *         files: [
     *             {
     *                 filename: String
     *                 url: String
     *             }
     *         ]
     *     }
     * ]
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     description: String
     *     friendlyName: String
     *     isDeployable: Boolean
     *     updateType: String
     *     installedCriteria: String
     *     compatibility: [
     *         {
     *             String: String
     *         }
     *     ]
     *     instructions: {
     *         steps: [
     *             {
     *                 type: String(Inline/Reference)
     *                 description: String
     *                 handler: String
     *                 handlerProperties: Object
     *                 files: [
     *                     String
     *                 ]
     *                 updateId: (recursive schema, see updateId above)
     *             }
     *         ]
     *     }
     *     referencedBy: [
     *         (recursive schema, see above)
     *     ]
     *     scanResult: String
     *     manifestVersion: String
     *     importedDateTime: String
     *     createdDateTime: String
     *     etag: String
     * }
     * }</pre>
     *
     * @param updateToImport The update to be imported.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return update metadata along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<BinaryData, BinaryData> beginImportUpdate(
            BinaryData updateToImport, RequestOptions requestOptions) {
        return this.beginImportUpdateAsync(updateToImport, requestOptions).getSyncPoller();
    }

    /**
     * Get a list of all updates that have been imported to Device Update for IoT Hub.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     *     <tr><td>search</td><td>String</td><td>No</td><td>Request updates matching a free-text search expression.</td></tr>
     *     <tr><td>filter</td><td>String</td><td>No</td><td>Filter updates by its properties.</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         {
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             description: String
     *             friendlyName: String
     *             isDeployable: Boolean
     *             updateType: String
     *             installedCriteria: String
     *             compatibility: [
     *                 {
     *                     String: String
     *                 }
     *             ]
     *             instructions: {
     *                 steps: [
     *                     {
     *                         type: String(Inline/Reference)
     *                         description: String
     *                         handler: String
     *                         handlerProperties: Object
     *                         files: [
     *                             String
     *                         ]
     *                         updateId: (recursive schema, see updateId above)
     *                     }
     *                 ]
     *             }
     *             referencedBy: [
     *                 (recursive schema, see above)
     *             ]
     *             scanResult: String
     *             manifestVersion: String
     *             importedDateTime: String
     *             createdDateTime: String
     *             etag: String
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all updates that have been imported to Device Update for IoT Hub along with {@link
     *     PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listUpdatesSinglePageAsync(RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listUpdates(
                                        this.client.getEndpoint(),
                                        this.client.getInstanceId(),
                                        this.client.getServiceVersion().getVersion(),
                                        requestOptions,
                                        context))
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    /**
     * Get a list of all updates that have been imported to Device Update for IoT Hub.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     *     <tr><td>search</td><td>String</td><td>No</td><td>Request updates matching a free-text search expression.</td></tr>
     *     <tr><td>filter</td><td>String</td><td>No</td><td>Filter updates by its properties.</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         {
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             description: String
     *             friendlyName: String
     *             isDeployable: Boolean
     *             updateType: String
     *             installedCriteria: String
     *             compatibility: [
     *                 {
     *                     String: String
     *                 }
     *             ]
     *             instructions: {
     *                 steps: [
     *                     {
     *                         type: String(Inline/Reference)
     *                         description: String
     *                         handler: String
     *                         handlerProperties: Object
     *                         files: [
     *                             String
     *                         ]
     *                         updateId: (recursive schema, see updateId above)
     *                     }
     *                 ]
     *             }
     *             referencedBy: [
     *                 (recursive schema, see above)
     *             ]
     *             scanResult: String
     *             manifestVersion: String
     *             importedDateTime: String
     *             createdDateTime: String
     *             etag: String
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all updates that have been imported to Device Update for IoT Hub along with {@link
     *     PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listUpdatesSinglePageAsync(RequestOptions requestOptions, Context context) {
        return service.listUpdates(
                        this.client.getEndpoint(),
                        this.client.getInstanceId(),
                        this.client.getServiceVersion().getVersion(),
                        requestOptions,
                        context)
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    /**
     * Get a list of all updates that have been imported to Device Update for IoT Hub.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     *     <tr><td>search</td><td>String</td><td>No</td><td>Request updates matching a free-text search expression.</td></tr>
     *     <tr><td>filter</td><td>String</td><td>No</td><td>Filter updates by its properties.</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         {
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             description: String
     *             friendlyName: String
     *             isDeployable: Boolean
     *             updateType: String
     *             installedCriteria: String
     *             compatibility: [
     *                 {
     *                     String: String
     *                 }
     *             ]
     *             instructions: {
     *                 steps: [
     *                     {
     *                         type: String(Inline/Reference)
     *                         description: String
     *                         handler: String
     *                         handlerProperties: Object
     *                         files: [
     *                             String
     *                         ]
     *                         updateId: (recursive schema, see updateId above)
     *                     }
     *                 ]
     *             }
     *             referencedBy: [
     *                 (recursive schema, see above)
     *             ]
     *             scanResult: String
     *             manifestVersion: String
     *             importedDateTime: String
     *             createdDateTime: String
     *             etag: String
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all updates that have been imported to Device Update for IoT Hub.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listUpdatesAsync(RequestOptions requestOptions) {
        return new PagedFlux<>(
                () -> listUpdatesSinglePageAsync(requestOptions),
                nextLink -> listUpdatesNextSinglePageAsync(nextLink, null));
    }

    /**
     * Get a list of all updates that have been imported to Device Update for IoT Hub.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     *     <tr><td>search</td><td>String</td><td>No</td><td>Request updates matching a free-text search expression.</td></tr>
     *     <tr><td>filter</td><td>String</td><td>No</td><td>Filter updates by its properties.</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         {
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             description: String
     *             friendlyName: String
     *             isDeployable: Boolean
     *             updateType: String
     *             installedCriteria: String
     *             compatibility: [
     *                 {
     *                     String: String
     *                 }
     *             ]
     *             instructions: {
     *                 steps: [
     *                     {
     *                         type: String(Inline/Reference)
     *                         description: String
     *                         handler: String
     *                         handlerProperties: Object
     *                         files: [
     *                             String
     *                         ]
     *                         updateId: (recursive schema, see updateId above)
     *                     }
     *                 ]
     *             }
     *             referencedBy: [
     *                 (recursive schema, see above)
     *             ]
     *             scanResult: String
     *             manifestVersion: String
     *             importedDateTime: String
     *             createdDateTime: String
     *             etag: String
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all updates that have been imported to Device Update for IoT Hub.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listUpdatesAsync(RequestOptions requestOptions, Context context) {
        return new PagedFlux<>(
                () -> listUpdatesSinglePageAsync(requestOptions, context),
                nextLink -> listUpdatesNextSinglePageAsync(nextLink, null, context));
    }

    /**
     * Get a list of all updates that have been imported to Device Update for IoT Hub.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     *     <tr><td>search</td><td>String</td><td>No</td><td>Request updates matching a free-text search expression.</td></tr>
     *     <tr><td>filter</td><td>String</td><td>No</td><td>Filter updates by its properties.</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         {
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             description: String
     *             friendlyName: String
     *             isDeployable: Boolean
     *             updateType: String
     *             installedCriteria: String
     *             compatibility: [
     *                 {
     *                     String: String
     *                 }
     *             ]
     *             instructions: {
     *                 steps: [
     *                     {
     *                         type: String(Inline/Reference)
     *                         description: String
     *                         handler: String
     *                         handlerProperties: Object
     *                         files: [
     *                             String
     *                         ]
     *                         updateId: (recursive schema, see updateId above)
     *                     }
     *                 ]
     *             }
     *             referencedBy: [
     *                 (recursive schema, see above)
     *             ]
     *             scanResult: String
     *             manifestVersion: String
     *             importedDateTime: String
     *             createdDateTime: String
     *             etag: String
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all updates that have been imported to Device Update for IoT Hub.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<BinaryData> listUpdates(RequestOptions requestOptions) {
        return new PagedIterable<>(listUpdatesAsync(requestOptions));
    }

    /**
     * Get a specific update version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Header Parameters</strong>
     *
     * <table border="1">
     *     <caption>Header Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>ifNoneMatch</td><td>String</td><td>No</td><td>Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value.</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     description: String
     *     friendlyName: String
     *     isDeployable: Boolean
     *     updateType: String
     *     installedCriteria: String
     *     compatibility: [
     *         {
     *             String: String
     *         }
     *     ]
     *     instructions: {
     *         steps: [
     *             {
     *                 type: String(Inline/Reference)
     *                 description: String
     *                 handler: String
     *                 handlerProperties: Object
     *                 files: [
     *                     String
     *                 ]
     *                 updateId: (recursive schema, see updateId above)
     *             }
     *         ]
     *     }
     *     referencedBy: [
     *         (recursive schema, see above)
     *     ]
     *     scanResult: String
     *     manifestVersion: String
     *     importedDateTime: String
     *     createdDateTime: String
     *     etag: String
     * }
     * }</pre>
     *
     * @param provider Update provider.
     * @param name Update name.
     * @param version Update version.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a specific update version along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getUpdateWithResponseAsync(
            String provider, String name, String version, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.getUpdate(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                provider,
                                name,
                                version,
                                this.client.getServiceVersion().getVersion(),
                                requestOptions,
                                context));
    }

    /**
     * Get a specific update version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Header Parameters</strong>
     *
     * <table border="1">
     *     <caption>Header Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>ifNoneMatch</td><td>String</td><td>No</td><td>Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value.</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     description: String
     *     friendlyName: String
     *     isDeployable: Boolean
     *     updateType: String
     *     installedCriteria: String
     *     compatibility: [
     *         {
     *             String: String
     *         }
     *     ]
     *     instructions: {
     *         steps: [
     *             {
     *                 type: String(Inline/Reference)
     *                 description: String
     *                 handler: String
     *                 handlerProperties: Object
     *                 files: [
     *                     String
     *                 ]
     *                 updateId: (recursive schema, see updateId above)
     *             }
     *         ]
     *     }
     *     referencedBy: [
     *         (recursive schema, see above)
     *     ]
     *     scanResult: String
     *     manifestVersion: String
     *     importedDateTime: String
     *     createdDateTime: String
     *     etag: String
     * }
     * }</pre>
     *
     * @param provider Update provider.
     * @param name Update name.
     * @param version Update version.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a specific update version along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getUpdateWithResponseAsync(
            String provider, String name, String version, RequestOptions requestOptions, Context context) {
        return service.getUpdate(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                provider,
                name,
                version,
                this.client.getServiceVersion().getVersion(),
                requestOptions,
                context);
    }

    /**
     * Get a specific update version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Header Parameters</strong>
     *
     * <table border="1">
     *     <caption>Header Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>ifNoneMatch</td><td>String</td><td>No</td><td>Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value.</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     description: String
     *     friendlyName: String
     *     isDeployable: Boolean
     *     updateType: String
     *     installedCriteria: String
     *     compatibility: [
     *         {
     *             String: String
     *         }
     *     ]
     *     instructions: {
     *         steps: [
     *             {
     *                 type: String(Inline/Reference)
     *                 description: String
     *                 handler: String
     *                 handlerProperties: Object
     *                 files: [
     *                     String
     *                 ]
     *                 updateId: (recursive schema, see updateId above)
     *             }
     *         ]
     *     }
     *     referencedBy: [
     *         (recursive schema, see above)
     *     ]
     *     scanResult: String
     *     manifestVersion: String
     *     importedDateTime: String
     *     createdDateTime: String
     *     etag: String
     * }
     * }</pre>
     *
     * @param provider Update provider.
     * @param name Update name.
     * @param version Update version.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a specific update version along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> getUpdateWithResponse(
            String provider, String name, String version, RequestOptions requestOptions) {
        return getUpdateWithResponseAsync(provider, name, version, requestOptions).block();
    }

    /**
     * Delete a specific update version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * @param provider Update provider.
     * @param name Update name.
     * @param version Update version.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return the {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<Void>> deleteUpdateWithResponseAsync(
            String provider, String name, String version, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.deleteUpdate(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                provider,
                                name,
                                version,
                                this.client.getServiceVersion().getVersion(),
                                requestOptions,
                                context));
    }

    /**
     * Delete a specific update version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * @param provider Update provider.
     * @param name Update name.
     * @param version Update version.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return the {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<Void>> deleteUpdateWithResponseAsync(
            String provider, String name, String version, RequestOptions requestOptions, Context context) {
        return service.deleteUpdate(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                provider,
                name,
                version,
                this.client.getServiceVersion().getVersion(),
                requestOptions,
                context);
    }

    /**
     * Delete a specific update version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * @param provider Update provider.
     * @param name Update name.
     * @param version Update version.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return the response body along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public PollerFlux<BinaryData, BinaryData> beginDeleteUpdateAsync(
            String provider, String name, String version, RequestOptions requestOptions) {
        return PollerFlux.create(
                Duration.ofSeconds(1),
                () -> this.deleteUpdateWithResponseAsync(provider, name, version, requestOptions),
                new DefaultPollingStrategy<>(this.client.getHttpPipeline()),
                new TypeReferenceBinaryData(),
                new TypeReferenceBinaryData());
    }

    /**
     * Delete a specific update version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * @param provider Update provider.
     * @param name Update name.
     * @param version Update version.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return the response body along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public PollerFlux<BinaryData, BinaryData> beginDeleteUpdateAsync(
            String provider, String name, String version, RequestOptions requestOptions, Context context) {
        return PollerFlux.create(
                Duration.ofSeconds(1),
                () -> this.deleteUpdateWithResponseAsync(provider, name, version, requestOptions, context),
                new DefaultPollingStrategy<>(this.client.getHttpPipeline()),
                new TypeReferenceBinaryData(),
                new TypeReferenceBinaryData());
    }

    /**
     * Delete a specific update version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * @param provider Update provider.
     * @param name Update name.
     * @param version Update version.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return the response body along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<BinaryData, BinaryData> beginDeleteUpdate(
            String provider, String name, String version, RequestOptions requestOptions) {
        return this.beginDeleteUpdateAsync(provider, name, version, requestOptions).getSyncPoller();
    }

    /**
     * Get a list of all update providers that have been imported to Device Update for IoT Hub.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all update providers that have been imported to Device Update for IoT Hub along with {@link
     *     PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listProvidersSinglePageAsync(RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listProviders(
                                        this.client.getEndpoint(),
                                        this.client.getInstanceId(),
                                        this.client.getServiceVersion().getVersion(),
                                        requestOptions,
                                        context))
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    /**
     * Get a list of all update providers that have been imported to Device Update for IoT Hub.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all update providers that have been imported to Device Update for IoT Hub along with {@link
     *     PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listProvidersSinglePageAsync(
            RequestOptions requestOptions, Context context) {
        return service.listProviders(
                        this.client.getEndpoint(),
                        this.client.getInstanceId(),
                        this.client.getServiceVersion().getVersion(),
                        requestOptions,
                        context)
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    /**
     * Get a list of all update providers that have been imported to Device Update for IoT Hub.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all update providers that have been imported to Device Update for IoT Hub.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listProvidersAsync(RequestOptions requestOptions) {
        return new PagedFlux<>(
                () -> listProvidersSinglePageAsync(requestOptions),
                nextLink -> listProvidersNextSinglePageAsync(nextLink, null));
    }

    /**
     * Get a list of all update providers that have been imported to Device Update for IoT Hub.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all update providers that have been imported to Device Update for IoT Hub.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listProvidersAsync(RequestOptions requestOptions, Context context) {
        return new PagedFlux<>(
                () -> listProvidersSinglePageAsync(requestOptions, context),
                nextLink -> listProvidersNextSinglePageAsync(nextLink, null, context));
    }

    /**
     * Get a list of all update providers that have been imported to Device Update for IoT Hub.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all update providers that have been imported to Device Update for IoT Hub.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<BinaryData> listProviders(RequestOptions requestOptions) {
        return new PagedIterable<>(listProvidersAsync(requestOptions));
    }

    /**
     * Get a list of all update names that match the specified provider.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param provider Update provider.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all update names that match the specified provider along with {@link PagedResponse} on
     *     successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listNamesSinglePageAsync(String provider, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listNames(
                                        this.client.getEndpoint(),
                                        this.client.getInstanceId(),
                                        provider,
                                        this.client.getServiceVersion().getVersion(),
                                        requestOptions,
                                        context))
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    /**
     * Get a list of all update names that match the specified provider.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param provider Update provider.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all update names that match the specified provider along with {@link PagedResponse} on
     *     successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listNamesSinglePageAsync(
            String provider, RequestOptions requestOptions, Context context) {
        return service.listNames(
                        this.client.getEndpoint(),
                        this.client.getInstanceId(),
                        provider,
                        this.client.getServiceVersion().getVersion(),
                        requestOptions,
                        context)
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    /**
     * Get a list of all update names that match the specified provider.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param provider Update provider.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all update names that match the specified provider.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listNamesAsync(String provider, RequestOptions requestOptions) {
        return new PagedFlux<>(
                () -> listNamesSinglePageAsync(provider, requestOptions),
                nextLink -> listNamesNextSinglePageAsync(nextLink, null));
    }

    /**
     * Get a list of all update names that match the specified provider.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param provider Update provider.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all update names that match the specified provider.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listNamesAsync(String provider, RequestOptions requestOptions, Context context) {
        return new PagedFlux<>(
                () -> listNamesSinglePageAsync(provider, requestOptions, context),
                nextLink -> listNamesNextSinglePageAsync(nextLink, null, context));
    }

    /**
     * Get a list of all update names that match the specified provider.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param provider Update provider.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all update names that match the specified provider.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<BinaryData> listNames(String provider, RequestOptions requestOptions) {
        return new PagedIterable<>(listNamesAsync(provider, requestOptions));
    }

    /**
     * Get a list of all update versions that match the specified provider and name.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     *     <tr><td>filter</td><td>String</td><td>No</td><td>Filter updates by its properties.</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param provider Update provider.
     * @param name Update name.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all update versions that match the specified provider and name along with {@link PagedResponse}
     *     on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listVersionsSinglePageAsync(
            String provider, String name, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listVersions(
                                        this.client.getEndpoint(),
                                        this.client.getInstanceId(),
                                        provider,
                                        name,
                                        this.client.getServiceVersion().getVersion(),
                                        requestOptions,
                                        context))
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    /**
     * Get a list of all update versions that match the specified provider and name.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     *     <tr><td>filter</td><td>String</td><td>No</td><td>Filter updates by its properties.</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param provider Update provider.
     * @param name Update name.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all update versions that match the specified provider and name along with {@link PagedResponse}
     *     on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listVersionsSinglePageAsync(
            String provider, String name, RequestOptions requestOptions, Context context) {
        return service.listVersions(
                        this.client.getEndpoint(),
                        this.client.getInstanceId(),
                        provider,
                        name,
                        this.client.getServiceVersion().getVersion(),
                        requestOptions,
                        context)
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    /**
     * Get a list of all update versions that match the specified provider and name.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     *     <tr><td>filter</td><td>String</td><td>No</td><td>Filter updates by its properties.</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param provider Update provider.
     * @param name Update name.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all update versions that match the specified provider and name.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listVersionsAsync(String provider, String name, RequestOptions requestOptions) {
        return new PagedFlux<>(
                () -> listVersionsSinglePageAsync(provider, name, requestOptions),
                nextLink -> listVersionsNextSinglePageAsync(nextLink, null));
    }

    /**
     * Get a list of all update versions that match the specified provider and name.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     *     <tr><td>filter</td><td>String</td><td>No</td><td>Filter updates by its properties.</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param provider Update provider.
     * @param name Update name.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all update versions that match the specified provider and name.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listVersionsAsync(
            String provider, String name, RequestOptions requestOptions, Context context) {
        return new PagedFlux<>(
                () -> listVersionsSinglePageAsync(provider, name, requestOptions, context),
                nextLink -> listVersionsNextSinglePageAsync(nextLink, null, context));
    }

    /**
     * Get a list of all update versions that match the specified provider and name.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     *     <tr><td>filter</td><td>String</td><td>No</td><td>Filter updates by its properties.</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param provider Update provider.
     * @param name Update name.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all update versions that match the specified provider and name.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<BinaryData> listVersions(String provider, String name, RequestOptions requestOptions) {
        return new PagedIterable<>(listVersionsAsync(provider, name, requestOptions));
    }

    /**
     * Get a list of all update file identifiers for the specified version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param provider Update provider.
     * @param name Update name.
     * @param version Update version.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all update file identifiers for the specified version along with {@link PagedResponse} on
     *     successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listFilesSinglePageAsync(
            String provider, String name, String version, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listFiles(
                                        this.client.getEndpoint(),
                                        this.client.getInstanceId(),
                                        provider,
                                        name,
                                        version,
                                        this.client.getServiceVersion().getVersion(),
                                        requestOptions,
                                        context))
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    /**
     * Get a list of all update file identifiers for the specified version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param provider Update provider.
     * @param name Update name.
     * @param version Update version.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all update file identifiers for the specified version along with {@link PagedResponse} on
     *     successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listFilesSinglePageAsync(
            String provider, String name, String version, RequestOptions requestOptions, Context context) {
        return service.listFiles(
                        this.client.getEndpoint(),
                        this.client.getInstanceId(),
                        provider,
                        name,
                        version,
                        this.client.getServiceVersion().getVersion(),
                        requestOptions,
                        context)
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    /**
     * Get a list of all update file identifiers for the specified version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param provider Update provider.
     * @param name Update name.
     * @param version Update version.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all update file identifiers for the specified version.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listFilesAsync(
            String provider, String name, String version, RequestOptions requestOptions) {
        return new PagedFlux<>(
                () -> listFilesSinglePageAsync(provider, name, version, requestOptions),
                nextLink -> listFilesNextSinglePageAsync(nextLink, null));
    }

    /**
     * Get a list of all update file identifiers for the specified version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param provider Update provider.
     * @param name Update name.
     * @param version Update version.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all update file identifiers for the specified version.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listFilesAsync(
            String provider, String name, String version, RequestOptions requestOptions, Context context) {
        return new PagedFlux<>(
                () -> listFilesSinglePageAsync(provider, name, version, requestOptions, context),
                nextLink -> listFilesNextSinglePageAsync(nextLink, null, context));
    }

    /**
     * Get a list of all update file identifiers for the specified version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param provider Update provider.
     * @param name Update name.
     * @param version Update version.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all update file identifiers for the specified version.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<BinaryData> listFiles(
            String provider, String name, String version, RequestOptions requestOptions) {
        return new PagedIterable<>(listFilesAsync(provider, name, version, requestOptions));
    }

    /**
     * Get a specific update file from the version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Header Parameters</strong>
     *
     * <table border="1">
     *     <caption>Header Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>ifNoneMatch</td><td>String</td><td>No</td><td>Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value.</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     fileId: String
     *     fileName: String
     *     sizeInBytes: long
     *     hashes: {
     *         String: String
     *     }
     *     mimeType: String
     *     scanResult: String
     *     scanDetails: String
     *     etag: String
     * }
     * }</pre>
     *
     * @param provider Update provider.
     * @param name Update name.
     * @param version Update version.
     * @param fileId File identifier.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a specific update file from the version along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getFileWithResponseAsync(
            String provider, String name, String version, String fileId, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.getFile(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                provider,
                                name,
                                version,
                                fileId,
                                this.client.getServiceVersion().getVersion(),
                                requestOptions,
                                context));
    }

    /**
     * Get a specific update file from the version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Header Parameters</strong>
     *
     * <table border="1">
     *     <caption>Header Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>ifNoneMatch</td><td>String</td><td>No</td><td>Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value.</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     fileId: String
     *     fileName: String
     *     sizeInBytes: long
     *     hashes: {
     *         String: String
     *     }
     *     mimeType: String
     *     scanResult: String
     *     scanDetails: String
     *     etag: String
     * }
     * }</pre>
     *
     * @param provider Update provider.
     * @param name Update name.
     * @param version Update version.
     * @param fileId File identifier.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a specific update file from the version along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getFileWithResponseAsync(
            String provider,
            String name,
            String version,
            String fileId,
            RequestOptions requestOptions,
            Context context) {
        return service.getFile(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                provider,
                name,
                version,
                fileId,
                this.client.getServiceVersion().getVersion(),
                requestOptions,
                context);
    }

    /**
     * Get a specific update file from the version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Header Parameters</strong>
     *
     * <table border="1">
     *     <caption>Header Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>ifNoneMatch</td><td>String</td><td>No</td><td>Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value.</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     fileId: String
     *     fileName: String
     *     sizeInBytes: long
     *     hashes: {
     *         String: String
     *     }
     *     mimeType: String
     *     scanResult: String
     *     scanDetails: String
     *     etag: String
     * }
     * }</pre>
     *
     * @param provider Update provider.
     * @param name Update name.
     * @param version Update version.
     * @param fileId File identifier.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a specific update file from the version along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> getFileWithResponse(
            String provider, String name, String version, String fileId, RequestOptions requestOptions) {
        return getFileWithResponseAsync(provider, name, version, fileId, requestOptions).block();
    }

    /**
     * Get a list of all import update operations. Completed operations are kept for 7 days before auto-deleted. Delete
     * operations are not returned by this API version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>filter</td><td>String</td><td>No</td><td>Restricts the set of operations returned. Only one specific filter is supported: "status eq 'NotStarted' or status eq 'Running'"</td></tr>
     *     <tr><td>top</td><td>String</td><td>No</td><td>Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n.</td></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         {
     *             operationId: String
     *             status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             resourceLocation: String
     *             error: {
     *                 code: String
     *                 message: String
     *                 target: String
     *                 details: [
     *                     (recursive schema, see above)
     *                 ]
     *                 innererror: {
     *                     code: String
     *                     message: String
     *                     errorDetail: String
     *                     innerError: (recursive schema, see innerError above)
     *                 }
     *                 occurredDateTime: String
     *             }
     *             traceId: String
     *             lastActionDateTime: String
     *             createdDateTime: String
     *             etag: String
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all import update operations along with {@link PagedResponse} on successful completion of
     *     {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listOperationsSinglePageAsync(RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listOperations(
                                        this.client.getEndpoint(),
                                        this.client.getInstanceId(),
                                        this.client.getServiceVersion().getVersion(),
                                        requestOptions,
                                        context))
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    /**
     * Get a list of all import update operations. Completed operations are kept for 7 days before auto-deleted. Delete
     * operations are not returned by this API version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>filter</td><td>String</td><td>No</td><td>Restricts the set of operations returned. Only one specific filter is supported: "status eq 'NotStarted' or status eq 'Running'"</td></tr>
     *     <tr><td>top</td><td>String</td><td>No</td><td>Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n.</td></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         {
     *             operationId: String
     *             status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             resourceLocation: String
     *             error: {
     *                 code: String
     *                 message: String
     *                 target: String
     *                 details: [
     *                     (recursive schema, see above)
     *                 ]
     *                 innererror: {
     *                     code: String
     *                     message: String
     *                     errorDetail: String
     *                     innerError: (recursive schema, see innerError above)
     *                 }
     *                 occurredDateTime: String
     *             }
     *             traceId: String
     *             lastActionDateTime: String
     *             createdDateTime: String
     *             etag: String
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all import update operations along with {@link PagedResponse} on successful completion of
     *     {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listOperationsSinglePageAsync(
            RequestOptions requestOptions, Context context) {
        return service.listOperations(
                        this.client.getEndpoint(),
                        this.client.getInstanceId(),
                        this.client.getServiceVersion().getVersion(),
                        requestOptions,
                        context)
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    /**
     * Get a list of all import update operations. Completed operations are kept for 7 days before auto-deleted. Delete
     * operations are not returned by this API version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>filter</td><td>String</td><td>No</td><td>Restricts the set of operations returned. Only one specific filter is supported: "status eq 'NotStarted' or status eq 'Running'"</td></tr>
     *     <tr><td>top</td><td>String</td><td>No</td><td>Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n.</td></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         {
     *             operationId: String
     *             status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             resourceLocation: String
     *             error: {
     *                 code: String
     *                 message: String
     *                 target: String
     *                 details: [
     *                     (recursive schema, see above)
     *                 ]
     *                 innererror: {
     *                     code: String
     *                     message: String
     *                     errorDetail: String
     *                     innerError: (recursive schema, see innerError above)
     *                 }
     *                 occurredDateTime: String
     *             }
     *             traceId: String
     *             lastActionDateTime: String
     *             createdDateTime: String
     *             etag: String
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all import update operations.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listOperationsAsync(RequestOptions requestOptions) {
        return new PagedFlux<>(
                () -> listOperationsSinglePageAsync(requestOptions),
                nextLink -> listOperationsNextSinglePageAsync(nextLink, null));
    }

    /**
     * Get a list of all import update operations. Completed operations are kept for 7 days before auto-deleted. Delete
     * operations are not returned by this API version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>filter</td><td>String</td><td>No</td><td>Restricts the set of operations returned. Only one specific filter is supported: "status eq 'NotStarted' or status eq 'Running'"</td></tr>
     *     <tr><td>top</td><td>String</td><td>No</td><td>Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n.</td></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         {
     *             operationId: String
     *             status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             resourceLocation: String
     *             error: {
     *                 code: String
     *                 message: String
     *                 target: String
     *                 details: [
     *                     (recursive schema, see above)
     *                 ]
     *                 innererror: {
     *                     code: String
     *                     message: String
     *                     errorDetail: String
     *                     innerError: (recursive schema, see innerError above)
     *                 }
     *                 occurredDateTime: String
     *             }
     *             traceId: String
     *             lastActionDateTime: String
     *             createdDateTime: String
     *             etag: String
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all import update operations.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<BinaryData> listOperationsAsync(RequestOptions requestOptions, Context context) {
        return new PagedFlux<>(
                () -> listOperationsSinglePageAsync(requestOptions, context),
                nextLink -> listOperationsNextSinglePageAsync(nextLink, null, context));
    }

    /**
     * Get a list of all import update operations. Completed operations are kept for 7 days before auto-deleted. Delete
     * operations are not returned by this API version.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>filter</td><td>String</td><td>No</td><td>Restricts the set of operations returned. Only one specific filter is supported: "status eq 'NotStarted' or status eq 'Running'"</td></tr>
     *     <tr><td>top</td><td>String</td><td>No</td><td>Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n.</td></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         {
     *             operationId: String
     *             status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             resourceLocation: String
     *             error: {
     *                 code: String
     *                 message: String
     *                 target: String
     *                 details: [
     *                     (recursive schema, see above)
     *                 ]
     *                 innererror: {
     *                     code: String
     *                     message: String
     *                     errorDetail: String
     *                     innerError: (recursive schema, see innerError above)
     *                 }
     *                 occurredDateTime: String
     *             }
     *             traceId: String
     *             lastActionDateTime: String
     *             createdDateTime: String
     *             etag: String
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a list of all import update operations.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<BinaryData> listOperations(RequestOptions requestOptions) {
        return new PagedIterable<>(listOperationsAsync(requestOptions));
    }

    /**
     * Retrieve operation status.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Header Parameters</strong>
     *
     * <table border="1">
     *     <caption>Header Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>ifNoneMatch</td><td>String</td><td>No</td><td>Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value.</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     operationId: String
     *     status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     resourceLocation: String
     *     error: {
     *         code: String
     *         message: String
     *         target: String
     *         details: [
     *             (recursive schema, see above)
     *         ]
     *         innererror: {
     *             code: String
     *             message: String
     *             errorDetail: String
     *             innerError: (recursive schema, see innerError above)
     *         }
     *         occurredDateTime: String
     *     }
     *     traceId: String
     *     lastActionDateTime: String
     *     createdDateTime: String
     *     etag: String
     * }
     * }</pre>
     *
     * @param operationId Operation identifier.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return operation metadata along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getOperationWithResponseAsync(String operationId, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                context ->
                        service.getOperation(
                                this.client.getEndpoint(),
                                this.client.getInstanceId(),
                                operationId,
                                this.client.getServiceVersion().getVersion(),
                                requestOptions,
                                context));
    }

    /**
     * Retrieve operation status.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Header Parameters</strong>
     *
     * <table border="1">
     *     <caption>Header Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>ifNoneMatch</td><td>String</td><td>No</td><td>Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value.</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     operationId: String
     *     status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     resourceLocation: String
     *     error: {
     *         code: String
     *         message: String
     *         target: String
     *         details: [
     *             (recursive schema, see above)
     *         ]
     *         innererror: {
     *             code: String
     *             message: String
     *             errorDetail: String
     *             innerError: (recursive schema, see innerError above)
     *         }
     *         occurredDateTime: String
     *     }
     *     traceId: String
     *     lastActionDateTime: String
     *     createdDateTime: String
     *     etag: String
     * }
     * }</pre>
     *
     * @param operationId Operation identifier.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return operation metadata along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<BinaryData>> getOperationWithResponseAsync(
            String operationId, RequestOptions requestOptions, Context context) {
        return service.getOperation(
                this.client.getEndpoint(),
                this.client.getInstanceId(),
                operationId,
                this.client.getServiceVersion().getVersion(),
                requestOptions,
                context);
    }

    /**
     * Retrieve operation status.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>apiVersion</td><td>String</td><td>Yes</td><td>Api Version</td></tr>
     * </table>
     *
     * <p><strong>Header Parameters</strong>
     *
     * <table border="1">
     *     <caption>Header Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>ifNoneMatch</td><td>String</td><td>No</td><td>Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value.</td></tr>
     * </table>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     operationId: String
     *     status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     *     updateId: {
     *         provider: String
     *         name: String
     *         version: String
     *     }
     *     resourceLocation: String
     *     error: {
     *         code: String
     *         message: String
     *         target: String
     *         details: [
     *             (recursive schema, see above)
     *         ]
     *         innererror: {
     *             code: String
     *             message: String
     *             errorDetail: String
     *             innerError: (recursive schema, see innerError above)
     *         }
     *         occurredDateTime: String
     *     }
     *     traceId: String
     *     lastActionDateTime: String
     *     createdDateTime: String
     *     etag: String
     * }
     * }</pre>
     *
     * @param operationId Operation identifier.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return operation metadata along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> getOperationWithResponse(String operationId, RequestOptions requestOptions) {
        return getOperationWithResponseAsync(operationId, requestOptions).block();
    }

    /**
     * Get the next page of items.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         {
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             description: String
     *             friendlyName: String
     *             isDeployable: Boolean
     *             updateType: String
     *             installedCriteria: String
     *             compatibility: [
     *                 {
     *                     String: String
     *                 }
     *             ]
     *             instructions: {
     *                 steps: [
     *                     {
     *                         type: String(Inline/Reference)
     *                         description: String
     *                         handler: String
     *                         handlerProperties: Object
     *                         files: [
     *                             String
     *                         ]
     *                         updateId: (recursive schema, see updateId above)
     *                     }
     *                 ]
     *             }
     *             referencedBy: [
     *                 (recursive schema, see above)
     *             ]
     *             scanResult: String
     *             manifestVersion: String
     *             importedDateTime: String
     *             createdDateTime: String
     *             etag: String
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param nextLink The nextLink parameter.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return the list of updates along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listUpdatesNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listUpdatesNext(nextLink, this.client.getEndpoint(), requestOptions, context))
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    /**
     * Get the next page of items.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         {
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             description: String
     *             friendlyName: String
     *             isDeployable: Boolean
     *             updateType: String
     *             installedCriteria: String
     *             compatibility: [
     *                 {
     *                     String: String
     *                 }
     *             ]
     *             instructions: {
     *                 steps: [
     *                     {
     *                         type: String(Inline/Reference)
     *                         description: String
     *                         handler: String
     *                         handlerProperties: Object
     *                         files: [
     *                             String
     *                         ]
     *                         updateId: (recursive schema, see updateId above)
     *                     }
     *                 ]
     *             }
     *             referencedBy: [
     *                 (recursive schema, see above)
     *             ]
     *             scanResult: String
     *             manifestVersion: String
     *             importedDateTime: String
     *             createdDateTime: String
     *             etag: String
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param nextLink The nextLink parameter.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return the list of updates along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listUpdatesNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions, Context context) {
        return service.listUpdatesNext(nextLink, this.client.getEndpoint(), requestOptions, context)
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    /**
     * Get the next page of items.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param nextLink The nextLink parameter.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return the list of strings with server paging support along with {@link PagedResponse} on successful completion
     *     of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listProvidersNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listProvidersNext(nextLink, this.client.getEndpoint(), requestOptions, context))
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    /**
     * Get the next page of items.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param nextLink The nextLink parameter.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return the list of strings with server paging support along with {@link PagedResponse} on successful completion
     *     of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listProvidersNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions, Context context) {
        return service.listProvidersNext(nextLink, this.client.getEndpoint(), requestOptions, context)
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    /**
     * Get the next page of items.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param nextLink The nextLink parameter.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return the list of strings with server paging support along with {@link PagedResponse} on successful completion
     *     of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listNamesNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context -> service.listNamesNext(nextLink, this.client.getEndpoint(), requestOptions, context))
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    /**
     * Get the next page of items.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param nextLink The nextLink parameter.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return the list of strings with server paging support along with {@link PagedResponse} on successful completion
     *     of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listNamesNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions, Context context) {
        return service.listNamesNext(nextLink, this.client.getEndpoint(), requestOptions, context)
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    /**
     * Get the next page of items.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param nextLink The nextLink parameter.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return the list of strings with server paging support along with {@link PagedResponse} on successful completion
     *     of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listVersionsNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listVersionsNext(nextLink, this.client.getEndpoint(), requestOptions, context))
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    /**
     * Get the next page of items.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param nextLink The nextLink parameter.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return the list of strings with server paging support along with {@link PagedResponse} on successful completion
     *     of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listVersionsNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions, Context context) {
        return service.listVersionsNext(nextLink, this.client.getEndpoint(), requestOptions, context)
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    /**
     * Get the next page of items.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param nextLink The nextLink parameter.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return the list of strings with server paging support along with {@link PagedResponse} on successful completion
     *     of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listFilesNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context -> service.listFilesNext(nextLink, this.client.getEndpoint(), requestOptions, context))
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    /**
     * Get the next page of items.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         String
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param nextLink The nextLink parameter.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return the list of strings with server paging support along with {@link PagedResponse} on successful completion
     *     of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listFilesNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions, Context context) {
        return service.listFilesNext(nextLink, this.client.getEndpoint(), requestOptions, context)
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    /**
     * Get the next page of items.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         {
     *             operationId: String
     *             status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             resourceLocation: String
     *             error: {
     *                 code: String
     *                 message: String
     *                 target: String
     *                 details: [
     *                     (recursive schema, see above)
     *                 ]
     *                 innererror: {
     *                     code: String
     *                     message: String
     *                     errorDetail: String
     *                     innerError: (recursive schema, see innerError above)
     *                 }
     *                 occurredDateTime: String
     *             }
     *             traceId: String
     *             lastActionDateTime: String
     *             createdDateTime: String
     *             etag: String
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param nextLink The nextLink parameter.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return the list of operations with server paging support along with {@link PagedResponse} on successful
     *     completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listOperationsNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions) {
        return FluxUtil.withContext(
                        context ->
                                service.listOperationsNext(
                                        nextLink, this.client.getEndpoint(), requestOptions, context))
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    /**
     * Get the next page of items.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     value: [
     *         {
     *             operationId: String
     *             status: String(Undefined/NotStarted/Running/Succeeded/Failed)
     *             updateId: {
     *                 provider: String
     *                 name: String
     *                 version: String
     *             }
     *             resourceLocation: String
     *             error: {
     *                 code: String
     *                 message: String
     *                 target: String
     *                 details: [
     *                     (recursive schema, see above)
     *                 ]
     *                 innererror: {
     *                     code: String
     *                     message: String
     *                     errorDetail: String
     *                     innerError: (recursive schema, see innerError above)
     *                 }
     *                 occurredDateTime: String
     *             }
     *             traceId: String
     *             lastActionDateTime: String
     *             createdDateTime: String
     *             etag: String
     *         }
     *     ]
     *     nextLink: String
     * }
     * }</pre>
     *
     * @param nextLink The nextLink parameter.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @param context The context to associate with this operation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return the list of operations with server paging support along with {@link PagedResponse} on successful
     *     completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<BinaryData>> listOperationsNextSinglePageAsync(
            String nextLink, RequestOptions requestOptions, Context context) {
        return service.listOperationsNext(nextLink, this.client.getEndpoint(), requestOptions, context)
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        getValues(res.getValue(), "value"),
                                        getNextLink(res.getValue(), "nextLink"),
                                        null));
    }

    private static final class TypeReferenceBinaryData extends TypeReference<BinaryData> {
        // empty
    }

    private List<BinaryData> getValues(BinaryData binaryData, String path) {
        try {
            Map<?, ?> obj = binaryData.toObject(Map.class);
            List<?> values = (List<?>) obj.get(path);
            return values.stream().map(BinaryData::fromObject).collect(Collectors.toList());
        } catch (RuntimeException e) {
            return null;
        }
    }

    private String getNextLink(BinaryData binaryData, String path) {
        try {
            Map<?, ?> obj = binaryData.toObject(Map.class);
            return (String) obj.get(path);
        } catch (RuntimeException e) {
            return null;
        }
    }
}